hemfixarna-web-components 0.3.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/cjs/hemfixarna-address_16.cjs.entry.js +1753 -0
  2. package/dist/cjs/hemfixarna-address_16.cjs.entry.js.map +1 -0
  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-d9e286dc.js +1652 -0
  6. package/dist/cjs/index-d9e286dc.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/hemfixarna.svg +11 -0
  19. package/dist/collection/assets/info.svg +5 -0
  20. package/dist/collection/assets/minus.svg +4 -0
  21. package/dist/collection/assets/plus.svg +5 -0
  22. package/dist/collection/collection-manifest.json +27 -0
  23. package/dist/collection/components/hemfixarna-address/hemfixarna-address.js +67 -0
  24. package/dist/collection/components/hemfixarna-address/hemfixarna-address.js.map +1 -0
  25. package/dist/collection/components/hemfixarna-box/hemfixarna-box.js +97 -0
  26. package/dist/collection/components/hemfixarna-box/hemfixarna-box.js.map +1 -0
  27. package/dist/{hemfixarna-components/hemfixarna-breadcrumbs.entry.js → collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js} +46 -11
  28. package/dist/collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js.map +1 -0
  29. package/dist/collection/components/hemfixarna-byggmax/hemfixarna-byggmax.css +0 -0
  30. package/dist/collection/components/hemfixarna-byggmax/hemfixarna-byggmax.js +50 -0
  31. package/dist/collection/components/hemfixarna-byggmax/hemfixarna-byggmax.js.map +1 -0
  32. package/dist/collection/components/hemfixarna-cart/hemfixarna-cart.js +41 -0
  33. package/dist/collection/components/hemfixarna-cart/hemfixarna-cart.js.map +1 -0
  34. package/dist/collection/components/hemfixarna-category.tsx/hemfixarna-category.js +18 -0
  35. package/dist/collection/components/hemfixarna-category.tsx/hemfixarna-category.js.map +1 -0
  36. package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js +92 -0
  37. package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js.map +1 -0
  38. package/dist/collection/components/hemfixarna-component/hemfixarna-component.js +221 -0
  39. package/dist/collection/components/hemfixarna-component/hemfixarna-component.js.map +1 -0
  40. package/dist/collection/components/hemfixarna-component/hemfixarna.css +752 -0
  41. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.css +118 -0
  42. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js +76 -0
  43. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js.map +1 -0
  44. package/dist/collection/components/hemfixarna-getuser/hemfixarna-getuser.js +84 -0
  45. package/dist/collection/components/hemfixarna-getuser/hemfixarna-getuser.js.map +1 -0
  46. package/dist/{hemfixarna-components/hemfixarna-info.entry.js → collection/components/hemfixarna-info/hemfixarna-info.js} +27 -11
  47. package/dist/collection/components/hemfixarna-info/hemfixarna-info.js.map +1 -0
  48. package/dist/collection/components/hemfixarna-order/hemfixarna-order.js +50 -0
  49. package/dist/collection/components/hemfixarna-order/hemfixarna-order.js.map +1 -0
  50. package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js +80 -0
  51. package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js.map +1 -0
  52. package/dist/{hemfixarna-components/hemfixarna-product.entry.js → collection/components/hemfixarna-product/hemfixarna-product.js} +15 -16
  53. package/dist/collection/components/hemfixarna-product/hemfixarna-product.js.map +1 -0
  54. package/dist/collection/components/hemfixarna-service/hemfixarna-service.js +18 -0
  55. package/dist/collection/components/hemfixarna-service/hemfixarna-service.js.map +1 -0
  56. package/dist/collection/components/hemfixarna-start/hemfixarna-start.js +41 -0
  57. package/dist/collection/components/hemfixarna-start/hemfixarna-start.js.map +1 -0
  58. package/dist/collection/index.js +2 -0
  59. package/dist/collection/index.js.map +1 -0
  60. package/dist/collection/store/index.js +25 -0
  61. package/dist/collection/store/index.js.map +1 -0
  62. package/dist/{hemfixarna-components/index-2bf8566c.js → collection/types/index.js} +3 -6
  63. package/dist/collection/types/index.js.map +1 -0
  64. package/dist/collection/utils/api.js +41 -0
  65. package/dist/collection/utils/api.js.map +1 -0
  66. package/dist/{hemfixarna-components/calc-a9ece205.js → collection/utils/calc.js} +36 -6
  67. package/dist/collection/utils/calc.js.map +1 -0
  68. package/dist/collection/utils/creditSafe.js +18 -0
  69. package/dist/collection/utils/creditSafe.js.map +1 -0
  70. package/dist/collection/utils/felixFunctions.js +189 -0
  71. package/dist/collection/utils/felixFunctions.js.map +1 -0
  72. package/dist/collection/utils/form.js +7 -0
  73. package/dist/collection/utils/form.js.map +1 -0
  74. package/dist/esm/hemfixarna-address_16.entry.js +1734 -0
  75. package/dist/esm/hemfixarna-address_16.entry.js.map +1 -0
  76. package/dist/esm/hemfixarna-components.js +23 -0
  77. package/dist/esm/hemfixarna-components.js.map +1 -0
  78. package/dist/esm/index-ca1aada9.js +1621 -0
  79. package/dist/esm/index-ca1aada9.js.map +1 -0
  80. package/dist/esm/index.js +3 -0
  81. package/dist/esm/index.js.map +1 -0
  82. package/dist/esm/loader.js +20 -0
  83. package/dist/esm/loader.js.map +1 -0
  84. package/dist/esm/polyfills/core-js.js +11 -0
  85. package/dist/esm/polyfills/css-shim.js +1 -0
  86. package/dist/esm/polyfills/dom.js +79 -0
  87. package/dist/esm/polyfills/es5-html-element.js +1 -0
  88. package/dist/esm/polyfills/index.js +34 -0
  89. package/dist/esm/polyfills/system.js +6 -0
  90. package/dist/hemfixarna-components/hemfixarna-components.esm.js +1 -162
  91. package/dist/hemfixarna-components/hemfixarna-components.esm.js.map +1 -1
  92. package/dist/hemfixarna-components/index.esm.js +0 -1
  93. package/dist/hemfixarna-components/index.esm.js.map +1 -1
  94. package/dist/hemfixarna-components/p-8829e98e.js +3 -0
  95. package/dist/hemfixarna-components/p-8829e98e.js.map +1 -0
  96. package/dist/hemfixarna-components/p-c05e2af1.entry.js +2 -0
  97. package/dist/hemfixarna-components/p-c05e2af1.entry.js.map +1 -0
  98. package/dist/index.cjs.js +1 -0
  99. package/dist/index.js +1 -0
  100. package/dist/types/components/hemfixarna-address/hemfixarna-address.d.ts +1 -0
  101. package/dist/types/components/hemfixarna-cart/hemfixarna-cart.d.ts +1 -9
  102. package/dist/types/components/hemfixarna-checkout/hemfixarna-checkout.d.ts +3 -1
  103. package/dist/types/components/hemfixarna-getuser/hemfixarna-getuser.d.ts +1 -1
  104. package/dist/types/components/hemfixarna-order/hemfixarna-order.d.ts +3 -0
  105. package/dist/types/components/hemfixarna-orderrows/hemfixarna-orderrows.d.ts +8 -0
  106. package/dist/types/components.d.ts +19 -0
  107. package/dist/types/store/index.d.ts +2 -6
  108. package/dist/types/types/index.d.ts +18 -7
  109. package/dist/types/utils/api.d.ts +20 -2
  110. package/dist/types/utils/calc.d.ts +5 -1
  111. package/dist/types/utils/creditSafe.d.ts +3 -0
  112. package/dist/types/utils/form.d.ts +2 -0
  113. package/package.json +2 -1
  114. package/dist/hemfixarna-components/api-3228fe30.js +0 -28
  115. package/dist/hemfixarna-components/api-3228fe30.js.map +0 -1
  116. package/dist/hemfixarna-components/app-globals-0f993ce5.js +0 -5
  117. package/dist/hemfixarna-components/app-globals-0f993ce5.js.map +0 -1
  118. package/dist/hemfixarna-components/calc-a9ece205.js.map +0 -1
  119. package/dist/hemfixarna-components/css-shim-62d2171c.js +0 -6
  120. package/dist/hemfixarna-components/css-shim-62d2171c.js.map +0 -1
  121. package/dist/hemfixarna-components/dom-46a68c9b.js +0 -75
  122. package/dist/hemfixarna-components/dom-46a68c9b.js.map +0 -1
  123. package/dist/hemfixarna-components/hemfixarna-address.entry.js +0 -52
  124. package/dist/hemfixarna-components/hemfixarna-address.entry.js.map +0 -1
  125. package/dist/hemfixarna-components/hemfixarna-box.entry.js +0 -35
  126. package/dist/hemfixarna-components/hemfixarna-box.entry.js.map +0 -1
  127. package/dist/hemfixarna-components/hemfixarna-breadcrumbs.entry.js.map +0 -1
  128. package/dist/hemfixarna-components/hemfixarna-byggmax.entry.js +0 -20
  129. package/dist/hemfixarna-components/hemfixarna-byggmax.entry.js.map +0 -1
  130. package/dist/hemfixarna-components/hemfixarna-cart.entry.js +0 -82
  131. package/dist/hemfixarna-components/hemfixarna-cart.entry.js.map +0 -1
  132. package/dist/hemfixarna-components/hemfixarna-category.entry.js +0 -21
  133. package/dist/hemfixarna-components/hemfixarna-category.entry.js.map +0 -1
  134. package/dist/hemfixarna-components/hemfixarna-checkout.entry.js +0 -54
  135. package/dist/hemfixarna-components/hemfixarna-checkout.entry.js.map +0 -1
  136. package/dist/hemfixarna-components/hemfixarna-component.entry.js +0 -133
  137. package/dist/hemfixarna-components/hemfixarna-component.entry.js.map +0 -1
  138. package/dist/hemfixarna-components/hemfixarna-demo.entry.js +0 -65
  139. package/dist/hemfixarna-components/hemfixarna-demo.entry.js.map +0 -1
  140. package/dist/hemfixarna-components/hemfixarna-getuser.entry.js +0 -410
  141. package/dist/hemfixarna-components/hemfixarna-getuser.entry.js.map +0 -1
  142. package/dist/hemfixarna-components/hemfixarna-info.entry.js.map +0 -1
  143. package/dist/hemfixarna-components/hemfixarna-order.entry.js +0 -24
  144. package/dist/hemfixarna-components/hemfixarna-order.entry.js.map +0 -1
  145. package/dist/hemfixarna-components/hemfixarna-product.entry.js.map +0 -1
  146. package/dist/hemfixarna-components/hemfixarna-service.entry.js +0 -21
  147. package/dist/hemfixarna-components/hemfixarna-service.entry.js.map +0 -1
  148. package/dist/hemfixarna-components/hemfixarna-start.entry.js +0 -18
  149. package/dist/hemfixarna-components/hemfixarna-start.entry.js.map +0 -1
  150. package/dist/hemfixarna-components/index-2bf8566c.js.map +0 -1
  151. package/dist/hemfixarna-components/index-59ed730c.js +0 -3397
  152. package/dist/hemfixarna-components/index-59ed730c.js.map +0 -1
  153. package/dist/hemfixarna-components/index-75ed3bb8.js +0 -216
  154. package/dist/hemfixarna-components/index-75ed3bb8.js.map +0 -1
  155. package/dist/hemfixarna-components/shadow-css-05e0c1f4.js +0 -389
  156. package/dist/hemfixarna-components/shadow-css-05e0c1f4.js.map +0 -1
@@ -1,133 +0,0 @@
1
- import { r as registerInstance, g as getAssetPath, h, e as getElement } from './index-59ed730c.js';
2
- import { s as state } from './index-75ed3bb8.js';
3
- import { g as getTaxonomy, a as getOptions } from './api-3228fe30.js';
4
- import { g as getProductPriceWithRotAndRut } from './calc-a9ece205.js';
5
-
6
- const hemfixarnaCss = "@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap\"); *{box-sizing:border-box}:host{font-family:\"Inter\", sans-serif}:host .mb-2{margin-bottom:2rem}:host form{display:flex;flex-direction:column;gap:1rem}:host form img{position:absolute;top:50%;transform:translateY(-50%);pointer-events:none}:host form img:first-of-type{left:1rem}:host form img:last-of-type{right:1rem}:host form span{margin-top:-0.5rem;color:#ec6632}:host form p{text-align:center}:host form p{margin:0}:host form div{position:relative}:host form div label{pointer-events:none;position:absolute;left:1rem;top:50%;transform:translateY(-50%);background:#fff;padding:0.25rem;transition:0.2s all cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host form div input{padding:1rem;width:100%;font-size:1rem;border:1px solid #fcd9c9}:host form div input:focus~label,:host form div .input_active~label{top:0;transform:translateY(-50%);background:linear-gradient(180deg, #fffaf2 50%, #fff 50%)}:host h1{font-size:24px;font-weight:400;line-height:32px;letter-spacing:-3%;text-align:left;margin:0 0 0.5rem}:host h2{margin:0 0 1.5rem;font-weight:700;font-size:20px;line-height:28px;letter-spacing:-3%}:host p{font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna{width:100%;}:host .hemfixarna .switch{position:relative;display:inline-block;width:40px;height:20px}:host .hemfixarna .switch input{opacity:0;width:0;height:0}:host .hemfixarna .slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc;-webkit-transition:0.4s;transition:0.4s;border-radius:34px}:host .hemfixarna .slider:before{position:absolute;content:\"\";height:18px;width:18px;left:2px;bottom:1px;background-color:white;-webkit-transition:0.4s;transition:0.4s;border-radius:50%}:host .hemfixarna input:checked+.slider{background-color:#fcd9c9}:host .hemfixarna input:focus+.slider{box-shadow:0 0 1px #fcd9c9}:host .hemfixarna input:checked+.slider:before{-webkit-transform:translateX(18px);-ms-transform:translateX(18px);transform:translateX(18px);background:#ec6632}:host .hemfixarna_checkbox{display:grid;grid-template-columns:2.5rem auto;font-size:16px;font-weight:400;line-height:24px;letter-spacing:-3%}:host .hemfixarna_checkbox>span{transform:translateY(6px)}:host .hemfixarna_checkbox span,:host .hemfixarna_checkbox span p{color:#474444;font-size:14px}:host .hemfixarna_checkbox p{text-align:left}:host .hemfixarna_info{display:flex;flex-direction:column;gap:1.5rem;padding:2rem;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);border-radius:0.25rem;border:1px solid #fcd9c9}:host .hemfixarna_info h2{margin:0}@media (min-width: 769px){:host .hemfixarna_info{position:sticky;top:0}}:host .hemfixarna_infomodal{position:absolute;top:40%;left:50%;transform:translate(-50%, -50%);width:100%;max-width:80%;background:#fffaf2;border:1px solid #fcd9c9;padding:2rem;z-index:99;border-radius:0.25rem;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;flex-direction:column;gap:1rem}:host .hemfixarna_infomodal button{background:#ec6632;color:#fff;border-radius:60px;font-size:16px;padding:0.5rem 1rem}:host .hemfixarna_addressinfo{padding:1rem 1rem 4rem;border:1px solid #fcd9c9;position:relative;margin-bottom:2rem}:host .hemfixarna_addressinfo button{position:absolute;bottom:1rem;right:1rem;font-weight:500;text-underline-offset:2px;text-decoration:underline}:host .hemfixarna_part{background:#fff;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:grid;padding:1rem;grid-template-columns:auto 75px}:host .hemfixarna_counter{display:flex;align-items:center}:host .hemfixarna_counter span{padding:0 0.5rem}:host .hemfixarna_counter img{cursor:pointer}:host .hemfixarna_counter img:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_terms{font-size:14px}:host .hemfixarna_terms a{color:inherit}:host .hemfixarna_logo{height:4rem}:host .hemfixarna_box{padding:1rem;display:flex;align-items:center;justify-content:space-between;background:#fffaf2;border:1px solid #fcd9c9;width:100%;box-sizing:border-box;border-radius:0.25rem;gap:1rem 0.5rem}:host .hemfixarna_box>div{display:grid;gap:0.5rem}:host .hemfixarna_btn,:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{border:none;border-radius:60px;font-weight:600;letter-spacing:0.5px;line-height:20px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_btn:not(.disabled):hover,:host .hemfixarna_buy:not(.disabled):hover,:host .hemfixarna input[type=submit]:not(.disabled):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_btn{font-size:14px;background:#c84e18;color:#fff;padding:1rem 2rem;white-space:nowrap;position:relative}:host .hemfixarna_btn span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-0.5rem;right:-0.75rem}:host .hemfixarna_btn span{background:#25a710;color:#fff;right:0 !important}:host .hemfixarna_buy,:host .hemfixarna input[type=submit]{font-size:21px;background:#25a710;color:#fff;padding:1rem 1.5rem}:host .hemfixarna .disabled{opacity:0.5;cursor:default}:host .hemfixarna_modal{position:fixed;background:#fffaf2;border:1px solid #fcd9c9;border-radius:0.25rem;top:50%;left:50%;z-index:1000;transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);transform:translate(-50%, -50%) scale(0.7);opacity:0;height:92%;width:92%;max-width:920px;display:flex;flex-direction:column;gap:0.5rem}:host .hemfixarna_modal--open{opacity:1;transform:translate(-50%, -50%) scale(1)}:host .hemfixarna_backdrop{z-index:999;position:fixed;background:#474444;top:0;left:0;bottom:0;right:0;opacity:0;transition:transform 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946), opacity 0.1s cubic-bezier(0.465, 0.183, 0.153, 0.946)}:host .hemfixarna_backdrop--open{opacity:0.3}:host .hemfixarna_order{position:absolute;top:-1px;left:-1px;right:-1px;bottom:-1px;background-repeat:no-repeat !important;background-size:cover !important;background-position:center !important;display:grid;grid-template-columns:1fr 1fr;padding:3rem 2rem 4rem}@media (max-width: 768px){:host .hemfixarna_order{grid-template-columns:1fr;grid-template-rows:0 auto}}:host .hemfixarna_order div:last-of-type{background:#fffaf2;padding:2rem;display:flex;flex-direction:column}:host .hemfixarna_order img{cursor:pointer}:host .hemfixarna_order button{margin:1rem 0;padding:0;text-decoration:underline;text-underline-offset:2px;font-size:14px;font-weight:600}:host .hemfixarna_cart{display:grid;grid-template-columns:1fr 1fr;gap:2rem}@media (max-width: 768px){:host .hemfixarna_cart{grid-template-columns:1fr;gap:0}}:host .hemfixarna_cart--right h2,:host .hemfixarna_cart--left h2{display:flex;align-items:center}:host .hemfixarna_cart--right h2 img,:host .hemfixarna_cart--left h2 img{margin-top:0.2rem}@media (min-width: 769px){:host .hemfixarna_cart--left h2 button{display:none}}@media (max-width: 768px){:host .hemfixarna_cart--right h2 button{display:none}}:host .hemfixarna_cart--startfee{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot{display:flex;justify-content:space-between}:host .hemfixarna_cart--rutrot div{display:flex;gap:1rem;align-items:center}:host .hemfixarna_cart--additional{display:flex;flex-direction:column;gap:1rem;padding:1rem;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--additional p{font-size:14px}:host .hemfixarna_cart--additional strong{text-decoration:underline;text-underline-offset:2px;cursor:pointer;position:relative}:host .hemfixarna_cart--additional strong img{position:absolute;top:50%;transform:translateY(-50%);right:-1.5rem}:host .hemfixarna_cart--price{border-top:1px solid #fcd9c9;padding:1rem;display:flex;justify-content:space-between}:host .hemfixarna_cart--price h3{margin:0}:host .hemfixarna_cart--item{display:flex;flex-direction:column;gap:0.5rem;padding:1rem 0;border-top:1px solid #fcd9c9}:host .hemfixarna_cart--item>div{display:flex;justify-content:space-between}:host .hemfixarna_cart--item>div>div{display:flex;align-items:center;gap:1rem}:host .hemfixarna_cart--item>div button{color:#ec6632}:host .hemfixarna_categories{display:grid;gap:1.5rem}:host .hemfixarna_categories--wrapper{gap:2rem;display:grid;grid-template-columns:1fr 1fr}@media (max-width: 768px){:host .hemfixarna_categories--wrapper{grid-template-columns:1fr}}:host .hemfixarna_categories li{position:relative;background:#fff;border-radius:0.25rem;min-height:132px;padding:1.5rem;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863);display:flex;align-items:center;gap:1.5rem;cursor:pointer}:host .hemfixarna_categories li:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_categories li>button{height:100%;width:100%}:host .hemfixarna_categories li .price{font-weight:700}:host .hemfixarna_content{height:100%;overflow:auto;padding:0 2rem 4rem}:host .hemfixarna_content--5{padding-top:1rem}:host .hemfixarna_crumbs{position:relative;padding:1rem 1.5rem;border-bottom:1px solid #fcd9c9;display:flex;justify-content:space-between}:host .hemfixarna_crumbs--back{padding:1rem 1.5rem 0.5rem;display:flex;align-items:center;gap:0.5rem;box-shadow:none !important}:host .hemfixarna_crumbs--back:hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs img{cursor:pointer}:host .hemfixarna_crumbs .close{position:absolute;right:-1rem;top:-1rem;z-index:9}:host .hemfixarna_crumbs .cart{padding-left:1rem;position:relative}:host .hemfixarna_crumbs .cart img{cursor:inherit}:host .hemfixarna_crumbs .cart span{position:absolute;background:#fff;border-radius:100%;width:24px;height:24px;display:flex;justify-content:center;align-items:center;font-weight:600;font-size:13px;line-height:11px;top:-0.5rem;right:-0.75rem}:host .hemfixarna_crumbs .cart_active{cursor:pointer}:host .hemfixarna_crumbs .cart_active span{background:#25a710;color:#fff}:host .hemfixarna_crumbs--links{display:flex;align-items:center;gap:1rem;overflow:auto}@media (min-width: 769px){:host .hemfixarna_crumbs--links{-ms-overflow-style:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar{display:none}:host .hemfixarna_crumbs--links::-webkit-scrollbar-button{display:none}}:host .hemfixarna_crumbs button{white-space:nowrap;background:#f1ded6;border-radius:4rem;padding:0.75rem 1rem;font-size:12px;font-weight:600;letter-spacing:0.3px;box-shadow:none !important}:host .hemfixarna_crumbs button:not(.active):hover{transition:0.1s all cubic-bezier(0.465, 0.183, 0.153, 0.946);filter:brightness(1.02);transform:scale(1.01);box-shadow:0px 8px 16px 2px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_crumbs .active{background:#fffaf2;cursor:default}:host .hemfixarna_features{gap:0.75rem !important}:host .hemfixarna_features li{display:flex;gap:1rem;align-items:center}:host .hemfixarna_address{margin-bottom:1rem}:host .hemfixarna_product{display:grid;gap:1rem}:host .hemfixarna_product--link{font-weight:700;color:#474444;text-underline-offset:0.25rem}:host .hemfixarna_product--left{gap:2rem}:host .hemfixarna_product--right{gap:2rem}:host .hemfixarna_product--price{margin-top:0.25rem;font-weight:700}:host .hemfixarna_product--total{text-align:center;margin:-1rem 0;font-size:21px;line-height:28px}:host .hemfixarna_product--item{background:#fff;padding:1rem;display:grid;grid-template-columns:auto 75px;box-shadow:0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863)}:host .hemfixarna_product--grid{display:grid;grid-template-columns:1fr 1fr;gap:2rem}@media (max-width: 768px){:host .hemfixarna_product--grid{grid-template-columns:1fr}}:host .hemfixarna_product--grid>div{display:flex;flex-direction:column}:host .hemfixarna_product--grid ul{display:flex;flex-direction:column;gap:0.5rem}:host .hemfixarna_product p{margin:0}:host .hemfixarna_product--top{display:flex;gap:2rem}:host .hemfixarna_product--top>div{width:100%}:host .hemfixarna_product--top>div h1{max-width:80%}@media (max-width: 768px){:host .hemfixarna_product--top>div h1{max-width:100%}}:host .hemfixarna_product--top h4{margin-bottom:0.5rem}:host h5,:host p{margin:0}:host input[type=submit]{cursor:pointer}:host input[type=date]~label{left:3.5rem}:host input[type=date]{border:1px solid #fcd9c9;padding-left:4rem}:host input[type=checkbox]{height:1.125rem;width:1.125rem;border:1px solid #fcd9c9}:host input[type=checkbox]:checked{background:red}:host input[type=date]::-webkit-calendar-picker-indicator{background:transparent;bottom:0;color:transparent;cursor:pointer;height:auto;left:0;position:absolute;right:0;top:0;width:auto}:host button,:host a{cursor:pointer;background:none;border:none}:host ul{list-style:none;margin:0;padding:0}";
7
-
8
- const HemfixarnaComponent = class {
9
- constructor(hostRef) {
10
- registerInstance(this, hostRef);
11
- this.modal = false;
12
- this.showModal = false;
13
- this.tree = null;
14
- this.product = null;
15
- this.slug = undefined;
16
- this.business = undefined;
17
- this.topCategory = undefined;
18
- }
19
- async fetchNewTaxonomy(newValue) {
20
- state.selectedCategory = null;
21
- state.selectedProduct = null;
22
- state.selectedService = null;
23
- const res = await getTaxonomy(newValue);
24
- if ((res === null || res === void 0 ? void 0 : res.code) === 'not_found' || (res === null || res === void 0 ? void 0 : res.code) === 'rest_no_route') {
25
- console.log('taxonomy not found');
26
- }
27
- else if (res) {
28
- this.setTaxonomy(res);
29
- if ((res === null || res === void 0 ? void 0 : res.post_type) === 'ikea_product') {
30
- this.product = res;
31
- }
32
- }
33
- }
34
- async componentWillLoad() {
35
- state.business = this.business;
36
- const cart = window.sessionStorage.getItem(`hemfixarna-${this.business}-cart`);
37
- if (cart) {
38
- state.cart = JSON.parse(cart);
39
- }
40
- const tree = await getTaxonomy(this.topCategory);
41
- if ((tree === null || tree === void 0 ? void 0 : tree.code) === 'not_found') {
42
- console.warn('tree not found');
43
- }
44
- else if (tree) {
45
- this.tree = tree;
46
- console.log(this.tree);
47
- }
48
- if (this.slug) {
49
- const res = await getTaxonomy(this.slug);
50
- if ((res === null || res === void 0 ? void 0 : res.code) === 'not_found') {
51
- console.log('taxonomy not found');
52
- }
53
- else if (res) {
54
- this.setTaxonomy(res);
55
- }
56
- }
57
- const options = await getOptions();
58
- state.options = options;
59
- // const token = await initializeFelix();
60
- // if (token) {
61
- // console.log(token);
62
- // }
63
- }
64
- setTaxonomy(taxonomy) {
65
- if (taxonomy) {
66
- if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.taxonomy) === 'service_cat') {
67
- state.selectedCategory = taxonomy;
68
- state.step = 2;
69
- }
70
- else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'service') {
71
- state.selectedService = taxonomy;
72
- state.selectedCategory = this.tree.sub_cats.find(c => c.services.find(s => s.ID === taxonomy.ID));
73
- state.step = 3;
74
- }
75
- else if ((taxonomy === null || taxonomy === void 0 ? void 0 : taxonomy.post_type) === 'ikea_product') {
76
- state.selectedProduct = taxonomy;
77
- state.selectedService = this.tree.sub_cats
78
- .map(c => c.services)
79
- .flat()
80
- .find(s => s.products.find(p => p.ID === state.selectedProduct.ID));
81
- state.selectedCategory = this.tree.sub_cats.find(c => c.services.find(s => s.ID === state.selectedService.ID));
82
- state.step = 4;
83
- }
84
- }
85
- }
86
- // Open close modal && click outside event
87
- openModal() {
88
- this.modal = true;
89
- setTimeout(() => {
90
- this.showModal = true;
91
- }, 50);
92
- }
93
- closeModal() {
94
- this.showModal = false;
95
- setTimeout(() => {
96
- this.modal = false;
97
- }, 200);
98
- }
99
- handleClick(e) {
100
- const el = this.el.shadowRoot.querySelector('.hemfixarna_modal');
101
- if (el) {
102
- const isClickInside = el.contains(e.composedPath()[0]);
103
- if (!isClickInside) {
104
- this.closeModal();
105
- }
106
- }
107
- const infomodal = this.el.shadowRoot.querySelector('.hemfixarna_infomodal');
108
- if (infomodal) {
109
- const isClickInside = infomodal.contains(e.composedPath()[0]);
110
- if (!isClickInside) {
111
- state.modal = null;
112
- }
113
- }
114
- }
115
- getCartLength() {
116
- return state.cart.reduce((acc, curr) => acc + curr.amount, 0);
117
- }
118
- render() {
119
- var _a, _b;
120
- const logo = getAssetPath(`./assets/hemfixarna.svg`);
121
- return (h("div", { class: "hemfixarna" }, h("div", { class: "hemfixarna_box" }, h("div", null, h("div", null, h("p", null, ((_a = this.product) === null || _a === void 0 ? void 0 : _a.post_title) || (h("span", null, "Montering/Installation p\u00E5 plats - ", h("strong", null, "se priser h\u00E4r"))), this.product && ((_b = this.slug) === null || _b === void 0 ? void 0 : _b.includes('product')) ? (h("span", null, ' från', " ", h("strong", null, getProductPriceWithRotAndRut(this.product), "kr"))) : null)), h("img", { src: logo, width: 104 })), h("button", { onClick: () => this.openModal(), class: "hemfixarna_btn" }, "Till montering", this.getCartLength() > 0 && h("span", null, this.getCartLength()))), this.modal && (h("div", null, h("div", { class: `hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}` }, state.modal && (h("div", { class: "hemfixarna_infomodal" }, h("h2", null, state.modal.title), state.modal.text.map((t) => (h("p", null, t))), h("div", null, h("button", { onClick: () => (state.modal = null) }, "St\u00E4ng")))), this.tree && h("hemfixarna-breadcrumbs", { closeModal: () => this.closeModal(), tree: this.tree }), 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", null))), h("div", { class: `hemfixarna_backdrop ${this.showModal ? 'hemfixarna_backdrop--open' : ''}` })))));
122
- }
123
- static get assetsDirs() { return ["assets"]; }
124
- get el() { return getElement(this); }
125
- static get watchers() { return {
126
- "slug": ["fetchNewTaxonomy"]
127
- }; }
128
- };
129
- HemfixarnaComponent.style = hemfixarnaCss;
130
-
131
- export { HemfixarnaComponent as hemfixarna_component };
132
-
133
- //# sourceMappingURL=hemfixarna-component.entry.js.map
@@ -1 +0,0 @@
1
- {"file":"hemfixarna-component.entry.esm.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -1,65 +0,0 @@
1
- import { r as registerInstance, g as getAssetPath, h } from './index-59ed730c.js';
2
- import { B as Business, T as TopCategory } from './index-2bf8566c.js';
3
- import { g as getTaxonomy } from './api-3228fe30.js';
4
-
5
- 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_example{margin-bottom:1rem;background:#000;padding:1rem;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:-3rem;font-size:16px;left:40%;color:white;padding:0.5rem;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:0.5rem;margin-top:1rem}:host .hemfixarna_categories{max-height:100%;overflow:auto;position:relative}:host .hemfixarna_categories--label{display:flex;align-items:center;justify-content:space-between;padding:0.5rem}:host .hemfixarna_categories--label button{background:#3f3a92;border:none;font-weight:600;padding:0.2rem 0.6rem;border-radius:10px;margin-right:0.5rem;color:#ece8e8}:host .hemfixarna_categories--label button:active{transform:scale(0.95)}:host .hemfixarna_categories--label--big{font-weight:600;background:#9f9da9}:host p{margin:0}:host span{color:darkolivegreen;font-size:10px}:host button{cursor:pointer}:host>div{display:grid;gap:2rem;width:100%;grid-template-columns:1fr 1fr;height:100vh;place-items:center;overflow:hidden;padding:1rem 2rem;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{background:#000;gap:1px;display:grid}:host>div ul li{padding-left:1rem;background:#fff}";
6
-
7
- const MyComponent = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- this.cdnLink = '<script type="module" src="https://cdn.jsdelivr.net/npm//hemfixarna-web-components@latest/dist/hemfixarna-components/hemfixarna-components.esm.js"></script>';
11
- this.selectedSlug = undefined;
12
- this.tooltipText = 'Kopiera till urklipp';
13
- this.tree = null;
14
- }
15
- getTopLevelCategory() {
16
- switch ("byggmax") {
17
- case Business.byggmax:
18
- return TopCategory.byggmax;
19
- default:
20
- return '';
21
- }
22
- }
23
- async componentWillLoad() {
24
- const tree = await getTaxonomy(this.getTopLevelCategory());
25
- if ((tree === null || tree === void 0 ? void 0 : tree.code) === 'not_found') {
26
- console.warn('tree not found');
27
- }
28
- else if (tree) {
29
- this.tree = tree;
30
- }
31
- }
32
- getExample() {
33
- return `<hemfixarna-${"byggmax"}${this.selectedSlug ? ` slug="${this.selectedSlug}" ` : ''}></hemfixarna-${"byggmax"}>`;
34
- }
35
- copyExample() {
36
- navigator.clipboard.writeText(this.getExample());
37
- this.tooltipText = 'Snippet kopierad';
38
- setTimeout(() => {
39
- this.tooltipText = 'Kopiera till urklipp';
40
- }, 2000);
41
- }
42
- copyCdn() {
43
- navigator.clipboard.writeText(this.cdnLink);
44
- this.tooltipText = 'Text kopierad';
45
- setTimeout(() => {
46
- this.tooltipText = 'Kopiera till urklipp';
47
- }, 2000);
48
- }
49
- copyNpmInstall() {
50
- navigator.clipboard.writeText('npm i hemfixarna-web-components');
51
- this.tooltipText = 'Text kopierad';
52
- setTimeout(() => {
53
- this.tooltipText = 'Kopiera till urklipp';
54
- }, 2000);
55
- }
56
- render() {
57
- const copy = getAssetPath(`./assets/copy.png`);
58
- return (h("div", null, h("div", null, 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)), "byggmax" === Business.byggmax && h("hemfixarna-byggmax", { slug: this.selectedSlug }), h("div", { class: "hemfixarna_install" }, h("div", null, h("a", { target: "_blank", href: "https://www.npmjs.com/package/hemfixarna-web-components" }, "Install with npm")), h("div", { onClick: () => this.copyNpmInstall(), class: "hemfixarna_example" }, h("p", null, "npm i hemfixarna-web-components"), h("span", { class: "hemfixarna_example--tooltip" }, this.tooltipText), h("img", { src: copy, height: 20 })), h("p", null, "Or use cdn"), 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("ul", { class: "hemfixarna_categories" }, 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 kategori")))))))))))))))));
59
- }
60
- };
61
- MyComponent.style = hemfixarnaDemoCss;
62
-
63
- export { MyComponent as hemfixarna_demo };
64
-
65
- //# sourceMappingURL=hemfixarna-demo.entry.js.map
@@ -1 +0,0 @@
1
- {"file":"hemfixarna-demo.entry.esm.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -1,410 +0,0 @@
1
- import { r as registerInstance, h } from './index-59ed730c.js';
2
- import { s as state } from './index-75ed3bb8.js';
3
-
4
- // src/errors.ts
5
- var PersonnummerError = class extends Error {
6
- constructor() {
7
- super("Invalid swedish personal identity number");
8
- }
9
- };
10
-
11
- // src/utils.ts
12
- var compareAsc = (dateLeft, dateRight) => {
13
- const diff = dateLeft.getTime() - dateRight.getTime();
14
- return diff < 0 ? -1 : diff > 0 ? 1 : diff;
15
- };
16
- var diffInYears = (dateLeft, dateRight) => {
17
- const sign = compareAsc(dateLeft, dateRight);
18
- const yearDiff = Math.abs(dateLeft.getFullYear() - dateRight.getFullYear());
19
- dateLeft.setFullYear(dateLeft.getFullYear() - sign * yearDiff);
20
- const isLastYearNotFull = compareAsc(dateLeft, dateRight) === -sign;
21
- const result = sign * (yearDiff - +isLastYearNotFull);
22
- return result === 0 ? 0 : result;
23
- };
24
- var luhn = (str) => {
25
- let sum = 0;
26
- str += "";
27
- for (let i = 0, l = str.length; i < l; i++) {
28
- let v = parseInt(str[i]);
29
- v *= 2 - i % 2;
30
- if (v > 9) {
31
- v -= 9;
32
- }
33
- sum += v;
34
- }
35
- return Math.ceil(sum / 10) * 10 - sum;
36
- };
37
- var testDate = (year, month, day) => {
38
- month -= 1;
39
- const date = new Date(year, month, day);
40
- return !(date.getFullYear() !== year || date.getMonth() !== month || date.getDate() !== day);
41
- };
42
-
43
- // src/index.ts
44
- var Personnummer = class {
45
- /**
46
- * Personnummer constructor.
47
- *
48
- * @param {string} pin
49
- * @param {object} options
50
- */
51
- constructor(pin, options) {
52
- /**
53
- * Personnummer century.
54
- *
55
- * @var {string}
56
- */
57
- this._century = "";
58
- /**
59
- * Personnummer full year.
60
- *
61
- * @var {string}
62
- */
63
- this._fullYear = "";
64
- /**
65
- * Personnummer year.
66
- *
67
- * @var {string}
68
- */
69
- this._year = "";
70
- /**
71
- * Personnummer month.
72
- *
73
- * @var {string}
74
- */
75
- this._month = "";
76
- /**
77
- * Personnummer day.
78
- *
79
- * @var {string}
80
- */
81
- this._day = "";
82
- /**
83
- * Personnummer seperator.
84
- *
85
- * @var {string}
86
- */
87
- this._sep = "";
88
- /**
89
- * Personnumer first three of the last four numbers.
90
- *
91
- * @var {string}
92
- */
93
- this._num = "";
94
- /**
95
- * The last number of the personnummer.
96
- *
97
- * @var {string}
98
- */
99
- this._check = "";
100
- this.parse(pin, {
101
- allowCoordinationNumber: true,
102
- allowInterimNumber: false,
103
- ...options
104
- });
105
- }
106
- /**
107
- * Get century.
108
- *
109
- * @return {string}
110
- */
111
- get century() {
112
- return this._century;
113
- }
114
- /**
115
- * Get age.
116
- *
117
- * @return {string}
118
- */
119
- get fullYear() {
120
- return this._fullYear;
121
- }
122
- /**
123
- * Get age.
124
- *
125
- * @return {string}
126
- */
127
- get year() {
128
- return this._year;
129
- }
130
- /**
131
- * Get month.
132
- *
133
- * @return {string}
134
- */
135
- get month() {
136
- return this._month;
137
- }
138
- /**
139
- * Get day.
140
- *
141
- * @return {string}
142
- */
143
- get day() {
144
- return this._day;
145
- }
146
- /**
147
- * Get sep.
148
- *
149
- * @return {string}
150
- */
151
- get sep() {
152
- return this._sep;
153
- }
154
- /**
155
- * Get num.
156
- *
157
- * @return {string}
158
- */
159
- get num() {
160
- return this._num;
161
- }
162
- /**
163
- * Get check.
164
- *
165
- * @return {string}
166
- */
167
- get check() {
168
- return this._check;
169
- }
170
- /**
171
- * Parse personnummer.
172
- *
173
- * @param {string} pin
174
- * @param {object} options
175
- *
176
- * @return {Personnummer}
177
- */
178
- static parse(pin, options) {
179
- return new Personnummer(pin, options);
180
- }
181
- /**
182
- * Validate a Swedish personal identity number.
183
- *
184
- * @param {string} str
185
- * @param {object} options
186
- *
187
- * @return {boolean}
188
- */
189
- static valid(pin, options) {
190
- try {
191
- Personnummer.parse(pin, options);
192
- return true;
193
- } catch (e) {
194
- return false;
195
- }
196
- }
197
- /**
198
- * Parse personnummer and set class properties.
199
- *
200
- * @param {string} pin
201
- * @param {object} options
202
- */
203
- parse(pin, options) {
204
- if (pin.length < 10 || pin.length > 13) {
205
- throw new PersonnummerError();
206
- }
207
- const reg = /^(\d{2}){0,1}(\d{2})(\d{2})(\d{2})([+-]?)((?!000)\d{3}|[TRSUWXJKLMN]\d{2})(\d)$/;
208
- const match = reg.exec(pin);
209
- if (!match) {
210
- throw new PersonnummerError();
211
- }
212
- const century = match[1];
213
- const year = match[2];
214
- const month = match[3];
215
- const day = match[4];
216
- const sep = match[5];
217
- const num = match[6];
218
- const check = match[7];
219
- if (typeof century === "undefined" || !century.length) {
220
- const d = /* @__PURE__ */ new Date();
221
- let baseYear = 0;
222
- if (sep === "+") {
223
- this._sep = "+";
224
- baseYear = d.getFullYear() - 100;
225
- } else {
226
- this._sep = "-";
227
- baseYear = d.getFullYear();
228
- }
229
- this._century = ("" + (baseYear - (baseYear - parseInt(year)) % 100)).substr(0, 2);
230
- } else {
231
- this._century = century;
232
- if ((/* @__PURE__ */ new Date()).getFullYear() - parseInt(century + year, 10) < 100) {
233
- this._sep = "-";
234
- } else {
235
- this._sep = "+";
236
- }
237
- }
238
- this._year = year;
239
- this._fullYear = this._century + year;
240
- this._month = month;
241
- this._day = day;
242
- this._num = num;
243
- this._check = check;
244
- if (!this.valid()) {
245
- throw new PersonnummerError();
246
- }
247
- if (!(options == null ? void 0 : options.allowCoordinationNumber) && this.isCoordinationNumber()) {
248
- throw new PersonnummerError();
249
- }
250
- if (!(options == null ? void 0 : options.allowInterimNumber) && this.isInterimNumber()) {
251
- throw new PersonnummerError();
252
- }
253
- }
254
- /**
255
- * Validate a Swedish personal identity number.
256
- *
257
- * @return {boolean}
258
- */
259
- valid() {
260
- const valid = luhn(
261
- this.year + this.month + this.day + this.num.replace(/[TRSUWXJKLMN]/, "1")
262
- ) === +this.check && !!this.check;
263
- if (valid && testDate(parseInt(this.century + this.year), +this.month, +this.day)) {
264
- return valid;
265
- }
266
- return valid && testDate(parseInt(this.century + this.year), +this.month, +this.day - 60);
267
- }
268
- /**
269
- * Format a Swedish personal identity number as one of the official formats,
270
- * A long format or a short format.
271
- *
272
- * If the input number could not be parsed a empty string will be returned.
273
- *
274
- * @param {boolean} longFormat
275
- *
276
- * @return {string}
277
- */
278
- format(longFormat = false) {
279
- if (longFormat) {
280
- return `${this.century}${this.year}${this.month}${this.day}${this.num}${this.check}`;
281
- }
282
- return `${this.year}${this.month}${this.day}${this.sep}${this.num}${this.check}`;
283
- }
284
- /**
285
- * Get age from a Swedish personal identity number.
286
- *
287
- * @return {number}
288
- */
289
- getAge() {
290
- const date = this.getDate();
291
- return diffInYears(new Date(Date.now()), date);
292
- }
293
- /**
294
- * Get date from a Swedish personal identity number.
295
- *
296
- * @return {Date}
297
- */
298
- getDate() {
299
- let ageDay = +this.day;
300
- if (this.isCoordinationNumber()) {
301
- ageDay -= 60;
302
- }
303
- const ageDate = this.century + this.year + "-" + this.month + "-" + (ageDay < 10 ? "0" + ageDay : ageDay);
304
- return new Date(ageDate);
305
- }
306
- /**
307
- * Check if a Swedish personal identity number is a interim number or not.
308
- *
309
- * @return {boolean}
310
- */
311
- isInterimNumber() {
312
- return /[TRSUWXJKLMN]/.test(this.num[0]);
313
- }
314
- /**
315
- * Check if a Swedish personal identity number is a coordination number or not.
316
- *
317
- * @return {boolean}
318
- */
319
- isCoordinationNumber() {
320
- return testDate(
321
- parseInt(this.century + this.year),
322
- +this.month,
323
- +this.day - 60
324
- );
325
- }
326
- /**
327
- * Check if a Swedish personal identity number is for a female.
328
- *
329
- * @return {boolean}
330
- */
331
- isFemale() {
332
- return !this.isMale();
333
- }
334
- /**
335
- * Check if a Swedish personal identity number is for a male.
336
- *
337
- * @return {boolean}
338
- */
339
- isMale() {
340
- const sexDigit = parseInt(this.num.substr(-1));
341
- return sexDigit % 2 === 1;
342
- }
343
- };
344
- var src_default = Personnummer;
345
-
346
- const HemfixarnaGetuser = class {
347
- constructor(hostRef) {
348
- registerInstance(this, hostRef);
349
- this.handleChangeEmail = (e) => {
350
- this.emailError = null;
351
- this.email = e.target.value;
352
- };
353
- this.handleChangePhone = (e) => {
354
- this.phoneError = null;
355
- this.phone = e.target.value;
356
- };
357
- this.handleChangessn = (e) => {
358
- this.ssnError = null;
359
- this.ssn = e.target.value;
360
- };
361
- this.handleSubmit = (e) => {
362
- e.preventDefault();
363
- const emailRegex = new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
364
- const validEmail = emailRegex.test(this.email);
365
- if (!validEmail) {
366
- this.emailError = 'Ange en giltig e-postadress';
367
- }
368
- const validPhone = this.phone.length > 6;
369
- if (!validPhone) {
370
- this.phoneError = 'Ange ett giltigt telefonnummer';
371
- }
372
- const validssn = src_default.valid(this.ssn);
373
- if (!validssn) {
374
- this.ssnError = 'Ange ett giltigt personnummer';
375
- }
376
- else if (validssn) {
377
- const pn = src_default.parse(this.ssn).format(true);
378
- this.ssn = [pn.slice(0, 8), '-', pn.slice(8)].join('');
379
- }
380
- if (validEmail && validPhone && validssn) {
381
- state.checkoutStep = 2;
382
- state.user = {
383
- email: this.email,
384
- phone: this.phone,
385
- ssn: this.ssn,
386
- };
387
- }
388
- };
389
- this.render = () => {
390
- return (h("form", { class: "mb-2", onSubmit: e => this.handleSubmit(e) }, h("div", null, h("input", { class: `${this.email.length ? 'input_active' : ''}`, onChange: e => this.handleChangeEmail(e), type: "email", name: "email", value: this.email }), h("label", { htmlFor: "email" }, "E-post ")), this.emailError && h("span", null, this.emailError), h("div", null, h("input", { class: `${this.phone.length ? 'input_active' : ''}`, onChange: e => this.handleChangePhone(e), type: "tel", name: "phone", value: this.phone }), h("label", { htmlFor: "phone" }, "Mobiltelefon ")), this.phoneError && h("span", null, this.phoneError), h("div", null, h("input", { class: `${this.ssn.length ? 'input_active' : ''}`, onChange: e => this.handleChangessn(e), type: "tel", name: "ssn", value: this.ssn }), h("label", { htmlFor: "phone" }, "Personnummer*")), this.ssnError && h("span", null, this.ssnError), h("input", { type: "submit", value: "Forts\u00E4tt och Boka*" }), h("p", null, "*Vi h\u00E4mtar din adress")));
391
- };
392
- this.email = '';
393
- this.emailError = null;
394
- this.phone = '';
395
- this.phoneError = null;
396
- this.ssn = '';
397
- this.ssnError = null;
398
- }
399
- componentWillLoad() {
400
- if (state.user) {
401
- this.email = state.user.email;
402
- this.phone = state.user.phone;
403
- this.ssn = state.user.ssn;
404
- }
405
- }
406
- };
407
-
408
- export { HemfixarnaGetuser as hemfixarna_getuser };
409
-
410
- //# sourceMappingURL=hemfixarna-getuser.entry.js.map
@@ -1 +0,0 @@
1
- {"file":"hemfixarna-getuser.entry.esm.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -1 +0,0 @@
1
- {"file":"hemfixarna-info.entry.esm.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -1,24 +0,0 @@
1
- import { r as registerInstance, g as getAssetPath, h } from './index-59ed730c.js';
2
- import { s as state } from './index-75ed3bb8.js';
3
-
4
- const HemfixarnaOrder = class {
5
- constructor(hostRef) {
6
- registerInstance(this, hostRef);
7
- this.render = () => {
8
- const hemfixarna = getAssetPath(`./assets/hemfixarna.svg`);
9
- return (h("div", { style: { background: `url(${state.options.thank_you_image})` }, class: "hemfixarna_order" }, h("div", null), h("div", null, h("h2", null, "Tack f\u00F6r din bokning"), h("img", { onClick: () => this.resetShop(), src: hemfixarna, width: 200, alt: "hemfixarna" }), h("span", { onClick: () => this.resetShop() }, h("button", null, "Ny bokning")))));
10
- };
11
- }
12
- resetShop() {
13
- state.step = 1;
14
- state.cart = [];
15
- state.selectedCategory = null;
16
- state.selectedService = null;
17
- state.selectedProduct = null;
18
- state.checkoutStep = 1;
19
- }
20
- };
21
-
22
- export { HemfixarnaOrder as hemfixarna_order };
23
-
24
- //# sourceMappingURL=hemfixarna-order.entry.js.map
@@ -1 +0,0 @@
1
- {"file":"hemfixarna-order.entry.esm.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}