hemfixarna-web-components 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/cjs/{hemfixarna-address_16.cjs.entry.js → hemfixarna-address_18.cjs.entry.js} +239 -55
  2. package/dist/{esm/hemfixarna-address_16.entry.js.map → cjs/hemfixarna-address_18.cjs.entry.js.map} +1 -1
  3. package/dist/cjs/hemfixarna-components.cjs.js +1 -1
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/collection/collection-manifest.json +3 -1
  6. package/dist/collection/components/hemfixarna-box/hemfixarna-box.js +39 -2
  7. package/dist/collection/components/hemfixarna-box/hemfixarna-box.js.map +1 -1
  8. package/dist/collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js +8 -2
  9. package/dist/collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js.map +1 -1
  10. package/dist/collection/components/hemfixarna-byggmax/hemfixarna-byggmax.js +38 -2
  11. package/dist/collection/components/hemfixarna-byggmax/hemfixarna-byggmax.js.map +1 -1
  12. package/dist/collection/components/hemfixarna-component/hemfixarna-component.js +84 -18
  13. package/dist/collection/components/hemfixarna-component/hemfixarna-component.js.map +1 -1
  14. package/dist/collection/components/hemfixarna-component/hemfixarna.css +29 -1
  15. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.css +4 -2
  16. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js +14 -5
  17. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js.map +1 -1
  18. package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js +32 -16
  19. package/dist/collection/components/hemfixarna-orderrows/hemfixarna-orderrows.js.map +1 -1
  20. package/dist/collection/components/hemfixarna-product/hemfixarna-product.js +6 -4
  21. package/dist/collection/components/hemfixarna-product/hemfixarna-product.js.map +1 -1
  22. package/dist/collection/components/hemfixarna-skanska/hemfixarna-skanska.css +0 -0
  23. package/dist/collection/components/hemfixarna-skanska/hemfixarna-skanska.js +62 -0
  24. package/dist/collection/components/hemfixarna-skanska/hemfixarna-skanska.js.map +1 -0
  25. package/dist/collection/components/hemfixarna-start/hemfixarna-start.js +29 -2
  26. package/dist/collection/components/hemfixarna-start/hemfixarna-start.js.map +1 -1
  27. package/dist/collection/components/hemfixarna-string/hemfixarna-string-furniture.js +62 -0
  28. package/dist/collection/components/hemfixarna-string/hemfixarna-string-furniture.js.map +1 -0
  29. package/dist/collection/components/hemfixarna-string/hemfixarna-string.css +0 -0
  30. package/dist/collection/store/index.js +28 -0
  31. package/dist/collection/store/index.js.map +1 -1
  32. package/dist/collection/types/index.js +2 -0
  33. package/dist/collection/types/index.js.map +1 -1
  34. package/dist/collection/utils/api.js +28 -1
  35. package/dist/collection/utils/api.js.map +1 -1
  36. package/dist/collection/utils/types.js +5 -0
  37. package/dist/collection/utils/types.js.map +1 -0
  38. package/dist/esm/{hemfixarna-address_16.entry.js → hemfixarna-address_18.entry.js} +237 -55
  39. package/dist/{cjs/hemfixarna-address_16.cjs.entry.js.map → esm/hemfixarna-address_18.entry.js.map} +1 -1
  40. package/dist/esm/hemfixarna-components.js +1 -1
  41. package/dist/esm/loader.js +1 -1
  42. package/dist/hemfixarna-components/hemfixarna-components.esm.js +1 -1
  43. package/dist/hemfixarna-components/p-29459e2b.entry.js +2 -0
  44. package/dist/types/components/hemfixarna-box/hemfixarna-box.d.ts +3 -1
  45. package/dist/types/components/hemfixarna-byggmax/hemfixarna-byggmax.d.ts +4 -2
  46. package/dist/types/components/hemfixarna-component/hemfixarna-component.d.ts +5 -2
  47. package/dist/types/components/hemfixarna-demo/hemfixarna-demo.d.ts +3 -1
  48. package/dist/types/components/hemfixarna-orderrows/hemfixarna-orderrows.d.ts +2 -1
  49. package/dist/types/components/hemfixarna-product/hemfixarna-product.d.ts +1 -0
  50. package/dist/types/components/hemfixarna-skanska/hemfixarna-skanska.d.ts +5 -0
  51. package/dist/types/components/hemfixarna-start/hemfixarna-start.d.ts +4 -2
  52. package/dist/types/components/hemfixarna-string/hemfixarna-string-furniture.d.ts +5 -0
  53. package/dist/types/components.d.ts +50 -6
  54. package/dist/types/store/index.d.ts +7 -2
  55. package/dist/types/types/index.d.ts +44 -3
  56. package/dist/types/utils/api.d.ts +5 -2
  57. package/dist/types/utils/types.d.ts +3 -0
  58. package/package.json +1 -1
  59. package/dist/hemfixarna-components/p-afaaa209.entry.js +0 -2
  60. /package/dist/hemfixarna-components/{p-afaaa209.entry.js.map → p-29459e2b.entry.js.map} +0 -0
@@ -210,6 +210,11 @@ const { state, onChange, } = createStore({
210
210
  token: null,
211
211
  user: null,
212
212
  modal: null,
213
+ rutOptions: null,
214
+ rotOptions: null,
215
+ customer: null,
216
+ selectedCustomerCategory: null,
217
+ parentCategory: null,
213
218
  });
214
219
  onChange('cart', cart => {
215
220
  window.sessionStorage.setItem(`hemfixarna-${state.business}-cart`, JSON.stringify(cart));
@@ -217,6 +222,29 @@ onChange('cart', cart => {
217
222
  onChange('user', user => {
218
223
  window.sessionStorage.setItem(`hemfixarna-${state.business}-user`, JSON.stringify(user));
219
224
  });
225
+ onChange('selectedProduct', product => {
226
+ if (!state.customer || !product)
227
+ return;
228
+ const categories = [...state.customer.categories, ...state.customer.categories.map(c => { var _a; return (_a = c.sub_categories) !== null && _a !== void 0 ? _a : []; })].flat();
229
+ const category = categories.find(c => c && c.id === product.category);
230
+ if (category) {
231
+ state.parentCategory = category;
232
+ return;
233
+ }
234
+ state.parentCategory = null;
235
+ });
236
+ onChange('selectedCustomerCategory', category => {
237
+ if (!state.customer || !category)
238
+ return;
239
+ if (category.parent) {
240
+ const parent = state.customer.categories.find(c => c.id === category.parent);
241
+ if (parent) {
242
+ state.parentCategory = parent;
243
+ return;
244
+ }
245
+ }
246
+ state.parentCategory = null;
247
+ });
220
248
 
221
249
  const hideField = (field) => {
222
250
  return field.split(' ').reduce((acc, curr) => {
@@ -383,10 +411,15 @@ const getTotalPrice = () => {
383
411
  return state.cart.reduce((acc, curr) => acc + getItemPrice(curr), 0) + getStartFee().rot + getStartFee().rut;
384
412
  };
385
413
 
414
+ const isProduct = (category) => {
415
+ return category.post_name !== undefined;
416
+ };
417
+
386
418
  const HemfixarnaBox = class {
387
419
  constructor(hostRef) {
388
420
  index.registerInstance(this, hostRef);
389
421
  this.post = undefined;
422
+ this.category = undefined;
390
423
  this.icon = undefined;
391
424
  this.postTitle = undefined;
392
425
  }
@@ -408,8 +441,15 @@ const HemfixarnaBox = class {
408
441
  scrollToTop(el);
409
442
  }
410
443
  }
444
+ setProduct() {
445
+ state.selectedProduct = this.category;
446
+ state.step = 4;
447
+ state.selectedCustomerCategory = null;
448
+ const el = this.el.closest('.hemfixarna_content');
449
+ scrollToTop(el);
450
+ }
411
451
  render() {
412
- return (index.h("li", { onClick: () => this.setTaxonomy(this.post) }, this.post.icon && index.h("img", { class: "hemfixarna_logo", height: 82, src: this.icon, alt: this.postTitle }), index.h("div", null, index.h("p", null, this.postTitle), state.step === 3 && index.h("p", { class: "price" }, "Fr\u00E5n ", getProductPrice(this.post), "kr"))));
452
+ return this.category ? (index.h(index.Fragment, null, isProduct(this.category) ? (index.h("li", { onClick: () => this.setProduct() }, index.h("img", { class: "hemfixarna_logo", height: 82, src: this.category.icon, alt: this.category.post_name }), index.h("div", null, index.h("p", null, this.category.post_title), index.h("p", { class: "price" }, "Fr\u00E5n ", getProductPrice(this.category), "kr")))) : (index.h("li", { onClick: () => (state.selectedCustomerCategory = this.category) }, index.h("img", { class: "hemfixarna_logo", height: 82, src: this.category.icon, alt: this.category.name }), index.h("div", null, index.h("p", null, this.category.name)))))) : (index.h("li", { onClick: () => this.setTaxonomy(this.post) }, this.post.icon && index.h("img", { class: "hemfixarna_logo", height: 82, src: this.icon, alt: this.postTitle }), index.h("div", null, index.h("p", null, this.postTitle), state.step === 3 && index.h("p", { class: "price" }, "Fr\u00E5n ", getProductPrice(this.post), "kr"))));
413
453
  }
414
454
  get el() { return index.getElement(this); }
415
455
  };
@@ -436,6 +476,8 @@ const HemfixarnaBreadcrumbs = class {
436
476
  }
437
477
  handleHomePageClick() {
438
478
  state.step = 1;
479
+ state.parentCategory = null;
480
+ state.selectedCustomerCategory = null;
439
481
  this.triggerScrollTotop();
440
482
  setTimeout(() => {
441
483
  state.selectedCategory = null;
@@ -448,9 +490,13 @@ const HemfixarnaBreadcrumbs = class {
448
490
  const close = index.getAssetPath(`./assets/close.svg`);
449
491
  const cart = index.getAssetPath(`./assets/cart.svg`);
450
492
  const back = index.getAssetPath(`./assets/back.svg`);
451
- return (index.h("div", null, index.h("div", { class: "hemfixarna_crumbs" }, index.h("div", { class: "hemfixarna_crumbs--links" }, index.h("img", { onClick: () => this.handleHomePageClick(), src: logo, width: 110 }), index.h("img", { onClick: () => this.closeModal(), class: "close", src: close, width: 32 }), index.h("div", null, index.h("button", { onClick: () => this.handleHomePageClick() }, "Alla tj\u00E4nster"))), index.h("div", { onClick: () => this.handleCartClick(), class: `cart ${this.getCartLength() > 0 ? 'cart_active' : ''}` }, index.h("img", { src: cart, width: 24 }), index.h("span", null, this.getCartLength()))), [3, 4].includes(state.step) && (index.h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
493
+ return (index.h("div", null, index.h("div", { class: "hemfixarna_crumbs" }, index.h("div", { class: "hemfixarna_crumbs--links" }, index.h("img", { onClick: () => this.handleHomePageClick(), src: logo, width: 110 }), index.h("img", { onClick: () => this.closeModal(), class: "close", src: close, width: 32 }), index.h("div", null, index.h("button", { onClick: () => this.handleHomePageClick() }, "Alla tj\u00E4nster"))), index.h("div", { onClick: () => this.handleCartClick(), class: `cart ${this.getCartLength() > 0 ? 'cart_active' : ''}` }, index.h("img", { src: cart, width: 24 }), index.h("span", null, this.getCartLength()))), [3, 4].includes(state.step) && !state.customer && (index.h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
452
494
  state.step = state.step === 4 ? 3 : 2;
453
- } }, index.h("img", { width: 24, src: back, alt: "back arrow" }), index.h("span", null, "Se allt ", state.step === 4 ? state.selectedService.post_title : state.selectedCategory.name)))));
495
+ } }, index.h("img", { width: 24, src: back, alt: "back arrow" }), index.h("span", null, "Se allt ", state.step === 4 ? state.selectedService.post_title : state.selectedCategory.name))), state.parentCategory && state.step < 5 && (index.h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
496
+ state.step = 1;
497
+ state.selectedCustomerCategory = state.parentCategory;
498
+ state.selectedProduct = null;
499
+ } }, index.h("img", { width: 24, src: back, alt: "back arrow" }), index.h("span", null, "Se allt ", state.parentCategory.name)))));
454
500
  }
455
501
  get el() { return index.getElement(this); }
456
502
  };
@@ -458,6 +504,8 @@ const HemfixarnaBreadcrumbs = class {
458
504
  var Business;
459
505
  (function (Business) {
460
506
  Business["byggmax"] = "byggmax";
507
+ Business["skanska"] = "skanska";
508
+ Business["string"] = "string-furniture";
461
509
  })(Business || (Business = {}));
462
510
  var TopCategory;
463
511
  (function (TopCategory) {
@@ -466,17 +514,19 @@ var TopCategory;
466
514
 
467
515
  const hemfixarnaByggmaxCss = "";
468
516
 
469
- const MyComponent$1 = class {
517
+ const MyComponent$3 = class {
470
518
  constructor(hostRef) {
471
519
  index.registerInstance(this, hostRef);
472
520
  this.tree = null;
473
521
  this.slug = undefined;
522
+ this.categoryId = undefined;
523
+ this.customer = undefined;
474
524
  }
475
525
  render() {
476
- return index.h("hemfixarna-component", { slug: this.slug, business: Business.byggmax, topCategory: TopCategory.byggmax });
526
+ return index.h("hemfixarna-component", { categoryId: this.categoryId, slug: this.slug, business: Business.byggmax, topCategory: TopCategory.byggmax });
477
527
  }
478
528
  };
479
- MyComponent$1.style = hemfixarnaByggmaxCss;
529
+ MyComponent$3.style = hemfixarnaByggmaxCss;
480
530
 
481
531
  const HemfixarnaCart = class {
482
532
  constructor(hostRef) {
@@ -526,6 +576,15 @@ const getTaxonomy = async (endpoint) => {
526
576
  console.log(error);
527
577
  }
528
578
  };
579
+ const getCustomer = async (slug) => {
580
+ try {
581
+ const res = await fetch(`${base}/customer/${slug}`);
582
+ return await res.json();
583
+ }
584
+ catch (error) {
585
+ console.log(error);
586
+ }
587
+ };
529
588
  const getOptions = async () => {
530
589
  try {
531
590
  const res = await fetch(`${base}/webcoptions`);
@@ -535,6 +594,24 @@ const getOptions = async () => {
535
594
  console.log(error);
536
595
  }
537
596
  };
597
+ const getRut = async () => {
598
+ try {
599
+ const res = await fetch(`${base}/rut`);
600
+ return (await res.json());
601
+ }
602
+ catch (error) {
603
+ console.log(error);
604
+ }
605
+ };
606
+ const getRot = async () => {
607
+ try {
608
+ const res = await fetch(`${base}/rot`);
609
+ return (await res.json());
610
+ }
611
+ catch (error) {
612
+ console.log(error);
613
+ }
614
+ };
538
615
  const postOrder = async (data) => {
539
616
  try {
540
617
  const res = await fetch(`${base}/weborder`, {
@@ -633,7 +710,7 @@ const HemfixarnaCheckout = class {
633
710
  get el() { return index.getElement(this); }
634
711
  };
635
712
 
636
- 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 button{color:#474444}: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;display:grid;grid-template-columns:1fr;gap:0.5rem}@media (min-width: 769px){:host .hemfixarna_addressinfo{grid-template-columns:1fr 1fr}}: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 1.5rem;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;max-height:100%;overflow:auto}: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}";
713
+ 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 button{color:#474444}: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 p,:host .hemfixarna_infomodal h4{margin:0}: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;display:grid;grid-template-columns:1fr;gap:0.5rem}@media (min-width: 769px){:host .hemfixarna_addressinfo{grid-template-columns:1fr 1fr}}: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_description{display:grid;gap:1rem}:host .hemfixarna_description ul{list-style:disc;padding-right:0.75rem;transform:translateX(0.75rem)}:host .hemfixarna_description--hidden{max-height:140px;overflow:hidden;position:relative;cursor:pointer}:host .hemfixarna_description--hidden::after{content:\"\";position:absolute;bottom:0;left:0;right:0;height:8rem;background:linear-gradient(180deg, rgba(255, 253, 250, 0), rgba(255, 253, 250, 0.46) 50%, #fffaf2)}: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 1.5rem;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;max-height:100%;overflow:auto}: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.25rem}: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}";
637
714
 
638
715
  const HemfixarnaComponent = class {
639
716
  constructor(hostRef) {
@@ -647,12 +724,39 @@ const HemfixarnaComponent = class {
647
724
  this.tree = null;
648
725
  this.product = null;
649
726
  this.slug = undefined;
727
+ this.categoryId = undefined;
650
728
  this.business = undefined;
651
729
  this.topCategory = undefined;
652
730
  }
731
+ loadCategoryOrProduct(id) {
732
+ if (id.startsWith('c-')) {
733
+ const categories = [...state.customer.categories, ...state.customer.categories.map(c => { var _a; return (_a = c.sub_categories) !== null && _a !== void 0 ? _a : []; })].flat();
734
+ const category = categories.find(c => c && c.id === id.replace('c-', ''));
735
+ if (category) {
736
+ state.selectedCustomerCategory = category;
737
+ state.step = 2;
738
+ }
739
+ }
740
+ else {
741
+ const products = state.customer.categories
742
+ .map(c => (c.show_products ? c.products : c.sub_categories ? c.sub_categories.map(c => c.products) : []))
743
+ .flat()
744
+ .flat();
745
+ const product = products.find(p => p && p.fields.ID === parseInt(id));
746
+ if (product) {
747
+ state.selectedProduct = product.fields;
748
+ state.step = 4;
749
+ }
750
+ }
751
+ }
653
752
  async watchSlugChange(newValue) {
654
753
  this.fetchNewTaxonomy(newValue);
655
754
  }
755
+ async watchIdChange(id) {
756
+ if (id && state.customer) {
757
+ this.loadCategoryOrProduct(id);
758
+ }
759
+ }
656
760
  async fetchNewTaxonomy(slug) {
657
761
  state.selectedCategory = null;
658
762
  state.selectedProduct = null;
@@ -678,26 +782,43 @@ const HemfixarnaComponent = class {
678
782
  if (user) {
679
783
  state.user = JSON.parse(user);
680
784
  }
681
- const tree = await getTaxonomy(this.topCategory);
682
- if ((tree === null || tree === void 0 ? void 0 : tree.code) === 'not_found') {
683
- console.warn('tree not found');
785
+ const [tree, res, options, rut, rot] = await Promise.all([
786
+ this.topCategory ? getTaxonomy(this.topCategory) : null,
787
+ this.slug ? getTaxonomy(this.slug) : Promise.resolve(null),
788
+ getOptions(),
789
+ getRut(),
790
+ getRot(),
791
+ ]);
792
+ try {
793
+ const customer = await getCustomer(this.business);
794
+ if ((customer === null || customer === void 0 ? void 0 : customer.code) === 'not_found') {
795
+ console.warn('customer not found');
796
+ }
797
+ else if (customer) {
798
+ state.customer = customer;
799
+ if (this.categoryId) {
800
+ this.loadCategoryOrProduct(this.categoryId);
801
+ }
802
+ }
803
+ }
804
+ catch (error) {
805
+ console.warn('customer not found');
684
806
  }
807
+ if ((tree === null || tree === void 0 ? void 0 : tree.code) === 'not_found') ;
685
808
  else if (tree) {
686
809
  this.tree = tree;
687
810
  }
688
- if (this.slug) {
689
- const res = await getTaxonomy(this.slug);
690
- if ((res === null || res === void 0 ? void 0 : res.code) === 'not_found') {
691
- console.log('taxonomy not found');
692
- }
693
- else if (res) {
694
- this.setTaxonomy(res);
695
- if ((res === null || res === void 0 ? void 0 : res.post_type) === 'ikea_product') {
696
- this.product = res;
697
- }
811
+ if ((res === null || res === void 0 ? void 0 : res.code) === 'not_found') {
812
+ console.log('taxonomy not found');
813
+ }
814
+ else if (res) {
815
+ this.setTaxonomy(res);
816
+ if ((res === null || res === void 0 ? void 0 : res.post_type) === 'ikea_product') {
817
+ this.product = res;
698
818
  }
699
819
  }
700
- const options = await getOptions();
820
+ state.rotOptions = rot;
821
+ state.rutOptions = rut;
701
822
  state.options = options;
702
823
  }
703
824
  setTaxonomy(taxonomy) {
@@ -758,28 +879,31 @@ const HemfixarnaComponent = class {
758
879
  render() {
759
880
  var _a, _b;
760
881
  const logo = index.getAssetPath(`./assets/hemfixarna.svg`);
761
- return (index.h("div", { class: "hemfixarna" }, index.h("div", { class: "hemfixarna_box" }, index.h("div", null, index.h("div", null, index.h("p", null, ((_a = this.product) === null || _a === void 0 ? void 0 : _a.post_title) || (index.h("span", null, "Montering", index.h("wbr", null), "/Installation p\u00E5 plats - ", index.h("strong", null, "se priser h\u00E4r"))), this.product && ((_b = this.slug) === null || _b === void 0 ? void 0 : _b.includes('product')) ? (index.h("span", null, ' från', " ", index.h("strong", null, getProductPriceWithRotAndRut(this.product), "kr"))) : null)), index.h("img", { src: logo, width: 104 })), index.h("button", { onClick: () => this.openModal(), class: "hemfixarna_btn" }, "Till montering", this.getCartLength() > 0 && index.h("span", null, this.getCartLength()))), this.modal && (index.h("div", null, index.h("div", { class: `hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}` }, state.modal && (index.h("div", { class: "hemfixarna_infomodal" }, index.h("h2", null, state.modal.title), state.modal.text.map((t) => (index.h("p", null, t))), index.h("div", null, index.h("button", { onClick: () => (state.modal = null) }, "St\u00E4ng")))), this.tree && index.h("hemfixarna-breadcrumbs", { closeModal: () => this.closeModal(), tree: this.tree }), index.h("div", { class: `hemfixarna_content hemfixarna_content--${state.step}` }, state.step === 1 && this.tree && index.h("hemfixarna-start", { tree: this.tree }), state.step === 2 && state.selectedCategory && index.h("hemfixarna-category", null), state.step === 3 && state.selectedService && index.h("hemfixarna-service", null), state.step === 4 && state.selectedProduct && index.h("hemfixarna-product", null), state.step === 5 && index.h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && index.h("hemfixarna-order", { tree: this.tree }))), index.h("div", { class: `hemfixarna_backdrop ${this.showModal ? 'hemfixarna_backdrop--open' : ''}` })))));
882
+ return (index.h("div", { class: "hemfixarna" }, index.h("div", { class: "hemfixarna_box" }, index.h("div", null, index.h("div", null, index.h("p", null, ((_a = this.product) === null || _a === void 0 ? void 0 : _a.post_title) || (index.h("span", null, "Montering", index.h("wbr", null), "/Installation p\u00E5 plats - ", index.h("strong", null, "se priser h\u00E4r"))), this.product && ((_b = this.slug) === null || _b === void 0 ? void 0 : _b.includes('product')) ? (index.h("span", null, ' från', " ", index.h("strong", null, getProductPriceWithRotAndRut(this.product), "kr"))) : null)), index.h("img", { src: logo, width: 104 })), index.h("button", { onClick: () => this.openModal(), class: "hemfixarna_btn" }, "Till montering", this.getCartLength() > 0 && index.h("span", null, this.getCartLength()))), this.modal && (index.h("div", null, index.h("div", { class: `hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}` }, state.modal && (index.h("div", { class: "hemfixarna_infomodal" }, state.modal.title && index.h("h2", null, state.modal.title), state.modal.text.map((t) => (index.h("p", { innerHTML: t }))), index.h("div", null, index.h("button", { onClick: () => (state.modal = null) }, "St\u00E4ng")))), (this.tree || state.customer) && index.h("hemfixarna-breadcrumbs", { closeModal: () => this.closeModal(), tree: this.tree }), !state.customer ? (index.h("div", { class: `hemfixarna_content hemfixarna_content--${state.step}` }, state.step === 1 && this.tree && index.h("hemfixarna-start", { tree: this.tree }), state.step === 2 && state.selectedCategory && index.h("hemfixarna-category", null), state.step === 3 && state.selectedService && index.h("hemfixarna-service", null), state.step === 4 && state.selectedProduct && index.h("hemfixarna-product", null), state.step === 5 && index.h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && index.h("hemfixarna-order", { tree: this.tree }))) : (index.h("div", { class: `hemfixarna_content hemfixarna_content--${state.step}` }, state.step < 4 && index.h("hemfixarna-start", null), state.step === 4 && state.selectedProduct && index.h("hemfixarna-product", null), state.step === 5 && index.h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && index.h("hemfixarna-order", { tree: this.tree })))), index.h("div", { class: `hemfixarna_backdrop ${this.showModal ? 'hemfixarna_backdrop--open' : ''}` })))));
762
883
  }
763
884
  static get assetsDirs() { return ["assets"]; }
764
885
  get el() { return index.getElement(this); }
765
886
  static get watchers() { return {
766
- "slug": ["watchSlugChange"]
887
+ "slug": ["watchSlugChange"],
888
+ "categoryId": ["watchIdChange"]
767
889
  }; }
768
890
  };
769
891
  HemfixarnaComponent.style = hemfixarnaCss;
770
892
 
771
- 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}";
893
+ 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_product--label{background:#e1e0f5}:host .hemfixarna_categories{max-height:100%;overflow:auto;position:relative}:host .hemfixarna_categories--label{display:flex;align-items:center;justify-content:space-between;padding: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;border-bottom:1px solid black}: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{gap:1px;display:grid}:host>div ul li{padding-left:1rem;background:#fff}";
772
894
 
773
- const MyComponent = class {
895
+ const MyComponent$2 = class {
774
896
  constructor(hostRef) {
775
897
  index.registerInstance(this, hostRef);
776
898
  this.cdnLink = '<script type="module" src="https://cdn.jsdelivr.net/npm//hemfixarna-web-components@latest/dist/hemfixarna-components/hemfixarna-components.esm.js"></script>';
777
899
  this.selectedSlug = undefined;
900
+ this.selectedID = undefined;
778
901
  this.tooltipText = 'Kopiera till urklipp';
779
902
  this.tree = null;
903
+ this.customer = null;
780
904
  }
781
905
  getTopLevelCategory() {
782
- switch ("byggmax") {
906
+ switch ("string-furniture") {
783
907
  case Business.byggmax:
784
908
  return TopCategory.byggmax;
785
909
  default:
@@ -787,16 +911,18 @@ const MyComponent = class {
787
911
  }
788
912
  }
789
913
  async componentWillLoad() {
790
- const tree = await getTaxonomy(this.getTopLevelCategory());
791
- if ((tree === null || tree === void 0 ? void 0 : tree.code) === 'not_found') {
792
- console.warn('tree not found');
914
+ const customer = await getCustomer("string-furniture");
915
+ if (customer.code !== 'not_found' && customer) {
916
+ this.customer = customer;
793
917
  }
918
+ const tree = await getTaxonomy(this.getTopLevelCategory());
919
+ if ((tree === null || tree === void 0 ? void 0 : tree.code) === 'not_found') ;
794
920
  else if (tree) {
795
921
  this.tree = tree;
796
922
  }
797
923
  }
798
924
  getExample() {
799
- return `<hemfixarna-${"byggmax"}${this.selectedSlug ? ` slug="${this.selectedSlug}" ` : ''}></hemfixarna-${"byggmax"}>`;
925
+ return `<hemfixarna-${"string-furniture"}${this.selectedSlug ? ` slug="${this.selectedSlug}" ` : ''}${this.selectedID ? ` id="${this.selectedID}" ` : ''}></hemfixarna-${"string-furniture"}>`;
800
926
  }
801
927
  copyExample() {
802
928
  navigator.clipboard.writeText(this.getExample());
@@ -821,10 +947,11 @@ const MyComponent = class {
821
947
  }
822
948
  render() {
823
949
  const copy = index.getAssetPath(`./assets/copy.png`);
824
- return (index.h("div", null, index.h("div", null, index.h("div", { onClick: () => this.copyExample(), class: "hemfixarna_example" }, index.h("p", null, this.getExample()), index.h("img", { src: copy, height: 20 }), index.h("span", { class: "hemfixarna_example--tooltip" }, this.tooltipText)), "byggmax" === Business.byggmax && index.h("hemfixarna-byggmax", { slug: this.selectedSlug }), index.h("div", { class: "hemfixarna_install" }, index.h("div", null, index.h("a", { target: "_blank", href: "https://www.npmjs.com/package/hemfixarna-web-components" }, "Install with npm")), index.h("div", { onClick: () => this.copyNpmInstall(), class: "hemfixarna_example" }, index.h("p", null, "npm i hemfixarna-web-components"), index.h("span", { class: "hemfixarna_example--tooltip" }, this.tooltipText), index.h("img", { src: copy, height: 20 })), index.h("p", null, "Or use cdn"), index.h("div", { onClick: () => this.copyCdn(), class: "hemfixarna_example" }, index.h("p", null, this.cdnLink), index.h("span", { class: "hemfixarna_example--tooltip" }, this.tooltipText), index.h("img", { src: copy, height: 20 })))), index.h("ul", { class: "hemfixarna_categories" }, this.tree.sub_cats.map(c => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label hemfixarna_categories--label--big" }, index.h("div", null, index.h("p", null, c.name), index.h("span", null, `category/${c.slug}`)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(`category/${c.slug}`) }, "Kopiera slug"), index.h("button", { onClick: () => (this.selectedSlug = `category/${c.slug}`) }, "Ladda kategori"))), index.h("ul", null, c.services.map(sc => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label" }, index.h("div", null, index.h("p", null, sc.post_title), index.h("span", null, `service/${sc.post_name}`)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(`service/${sc.post_name}`) }, "Kopiera slug"), index.h("button", { onClick: () => (this.selectedSlug = `service/${sc.post_name}`) }, "Ladda kategori"))), index.h("ul", null, sc.products.map(sc => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label" }, index.h("div", null, index.h("p", null, sc.post_title), index.h("span", null, `product/${sc.post_name}`)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(`product/${sc.post_name}`) }, "Kopiera slug"), index.h("button", { onClick: () => (this.selectedSlug = `product/${sc.post_name}`) }, "Ladda kategori")))))))))))))))));
950
+ return (index.h("div", null, index.h("div", null, index.h("div", { onClick: () => this.copyExample(), class: "hemfixarna_example" }, index.h("p", null, this.getExample()), index.h("img", { src: copy, height: 20 }), index.h("span", { class: "hemfixarna_example--tooltip" }, this.tooltipText)), "string-furniture" === Business.byggmax && index.h("hemfixarna-byggmax", { slug: this.selectedSlug, categoryId: this.selectedID }), "string-furniture" === Business.skanska && index.h("hemfixarna-skanska", { categoryId: this.selectedID }), "string-furniture" === Business.string && index.h("hemfixarna-string-furniture", { categoryId: this.selectedID }), index.h("div", { class: "hemfixarna_install" }, index.h("div", { onClick: () => this.copyCdn(), class: "hemfixarna_example" }, index.h("p", null, this.cdnLink), index.h("span", { class: "hemfixarna_example--tooltip" }, this.tooltipText), index.h("img", { src: copy, height: 20 })))), index.h("ul", { class: "hemfixarna_categories" }, this.customer ? (index.h("div", null, this.customer.categories.map(c => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label hemfixarna_categories--label--big" }, index.h("div", null, index.h("p", null, c.name), index.h("span", null, `c-${c.id}`)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(`c-${c.id}`) }, "Kopiera ID"), index.h("button", { onClick: () => (this.selectedID = `c-${c.id}`) }, "Ladda kategori"))), c.show_products && c.products ? (index.h("ul", null, c.products.map(p => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label hemfixarna_product--label" }, index.h("div", null, index.h("p", null, p.fields.post_title), index.h("span", null, p.fields.ID)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(String(p.fields.ID)) }, "Kopiera ID"), index.h("button", { onClick: () => (this.selectedID = String(p.fields.ID)) }, "Ladda produkt")))))))) : (index.h("ul", null, c.sub_categories &&
951
+ c.sub_categories.map(sc => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label" }, index.h("div", null, index.h("p", null, sc.name), index.h("span", null, `c-${sc.id}`)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(`c-${sc.id}`) }, "Kopiera ID"), index.h("button", { onClick: () => (this.selectedID = `c-${sc.id}`) }, "Ladda kategori"))), index.h("ul", null, sc.products.map(p => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label hemfixarna_product--label" }, index.h("div", null, index.h("p", null, p.fields.post_title), index.h("span", null, p.fields.ID)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(String(p.fields.ID)) }, "Kopiera ID"), index.h("button", { onClick: () => (this.selectedID = String(p.fields.ID)) }, "Ladda produkt"))))))))))))))))) : (index.h("div", null, this.tree.sub_cats.map(c => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label hemfixarna_categories--label--big" }, index.h("div", null, index.h("p", null, c.name), index.h("span", null, `category/${c.slug}`)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(`category/${c.slug}`) }, "Kopiera slug"), index.h("button", { onClick: () => (this.selectedSlug = `category/${c.slug}`) }, "Ladda kategori"))), index.h("ul", null, c.services.map(sc => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label" }, index.h("div", null, index.h("p", null, sc.post_title), index.h("span", null, `service/${sc.post_name}`)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(`service/${sc.post_name}`) }, "Kopiera slug"), index.h("button", { onClick: () => (this.selectedSlug = `service/${sc.post_name}`) }, "Ladda kategori"))), index.h("ul", null, sc.products.map(sc => (index.h("li", null, index.h("div", { class: "hemfixarna_categories--label" }, index.h("div", null, index.h("p", null, sc.post_title), index.h("span", null, `product/${sc.post_name}`)), index.h("div", null, index.h("button", { onClick: () => navigator.clipboard.writeText(`product/${sc.post_name}`) }, "Kopiera slug"), index.h("button", { onClick: () => (this.selectedSlug = `product/${sc.post_name}`) }, "Ladda kategori")))))))))))))))))));
825
952
  }
826
953
  };
827
- MyComponent.style = hemfixarnaDemoCss;
954
+ MyComponent$2.style = hemfixarnaDemoCss;
828
955
 
829
956
  // src/errors.ts
830
957
  var PersonnummerError = class extends Error {
@@ -1598,23 +1725,39 @@ const HemfixarnaOrderrows = class {
1598
1725
  this.tree = undefined;
1599
1726
  }
1600
1727
  goToProduct(id) {
1601
- const services = this.tree.sub_cats.map((c) => c.services).flat();
1602
- const products = services.map((s) => s.products).flat();
1603
- const product = products.find((p) => p.ID === id);
1604
- const service = services.find((s) => s.products.find((p) => p.ID === id));
1605
- const category = this.tree.sub_cats.find((c) => c.services.find((s) => s.products.find((p) => p.ID === id)));
1606
- state.selectedCategory = category;
1607
- state.selectedService = service;
1608
- state.selectedProduct = product;
1609
- state.step = 4;
1728
+ if (state.customer) {
1729
+ const products = state.customer.categories
1730
+ .map(c => (c.show_products ? c.products : c.sub_categories ? c.sub_categories.map(c => c.products) : []))
1731
+ .flat()
1732
+ .flat();
1733
+ const product = products.find(p => p && p.fields.ID === id);
1734
+ if (product) {
1735
+ state.selectedProduct = product.fields;
1736
+ state.step = 4;
1737
+ }
1738
+ }
1739
+ else {
1740
+ const services = this.tree.sub_cats.map((c) => c.services).flat();
1741
+ const products = services.map((s) => s.products).flat();
1742
+ const product = products.find((p) => p.ID === id);
1743
+ const service = services.find((s) => s.products.find((p) => p.ID === id));
1744
+ const category = this.tree.sub_cats.find((c) => c.services.find((s) => s.products.find((p) => p.ID === id)));
1745
+ state.selectedCategory = category;
1746
+ state.selectedService = service;
1747
+ state.selectedProduct = product;
1748
+ state.step = 4;
1749
+ }
1610
1750
  }
1611
- openMontering() {
1751
+ openRot() {
1612
1752
  state.modal = {
1613
- title: 'Monteringsavgift',
1614
- text: [
1615
- 'Monteringsavgiften är en fast avgift som läggs på din beställning. Avgiften täcker kostnader för att montera produkterna du beställer.',
1616
- 'Monteringsavgiften debiteras per påbörjat nytt uppdrag. Om du bokar ett uppdrag som både innehåller RUT- och ROT-avdrag så kommer uppdraget att delas upp och således kommer två monteringsavgifter att debiteras och två fakturor att utställas.',
1617
- ],
1753
+ title: state.rotOptions.rot_start_fee_heading,
1754
+ text: [state.rotOptions.rot_start_fee_text, state.rotOptions.rot_start_fee_text_secondary],
1755
+ };
1756
+ }
1757
+ openRut() {
1758
+ state.modal = {
1759
+ title: state.rutOptions.rut_start_fee_heading,
1760
+ text: [state.rutOptions.rut_start_fee_text, state.rutOptions.rut_start_fee_text_secondary],
1618
1761
  };
1619
1762
  }
1620
1763
  render() {
@@ -1622,7 +1765,7 @@ const HemfixarnaOrderrows = class {
1622
1765
  return (index.h(index.Fragment, null, index.h("ul", { class: "hemfixarna_cart--items" }, state.cart.map(item => {
1623
1766
  var _a;
1624
1767
  return (index.h("li", { class: "hemfixarna_cart--item" }, index.h("div", null, index.h("div", null, item.icon && index.h("img", { width: 30, src: (_a = item.icon.url) !== null && _a !== void 0 ? _a : item.icon, alt: item.name }), index.h("p", null, index.h("strong", null, item.amount, "x "), item.name)), this.cart && index.h("button", { onClick: () => this.goToProduct(item.id) }, "\u00C4ndra")), index.h("p", null, index.h("strong", null, getProductPrice(item, item.price, item.amount), "kr")), item.parts.length > 0 && (index.h("ul", null, item.parts.map(part => (index.h("li", null, index.h("p", null, index.h("strong", null, part.amount, "x "), part.name), index.h("p", null, index.h("strong", null, getPartPrice(part, item, part.amount), "kr")))))))));
1625
- })), index.h("div", { class: "hemfixarna_cart--additional" }, getStartFee().length > 0 && (index.h("div", { class: "hemfixarna_cart--startfee" }, index.h("p", null, getStartFee().length, "x", ' ', index.h("strong", { onClick: () => this.openMontering() }, "Monteringsavgift", index.h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), index.h("p", null, getStartFee().rot + getStartFee().rut, "kr"))), state.cart.find((item) => item.rot) && (index.h("div", { class: "hemfixarna_cart--rutrot" }, index.h("div", null, this.cart && (index.h("label", { class: "switch" }, index.h("input", { checked: state.rot, onChange: () => (state.rot = !state.rot), type: "checkbox" }), index.h("span", { class: "slider" }))), index.h("p", null, "ROT-avdrag")), index.h("p", null, "(-", state.rot ? calculateRot() : 0, "kr)"))), state.cart.find((item) => item.rut) && (index.h("div", { class: "hemfixarna_cart--rutrot" }, index.h("div", null, index.h("label", { class: "switch" }, index.h("input", { onChange: () => (state.rut = !state.rut), checked: state.rut, type: "checkbox" }), index.h("span", { class: "slider" })), index.h("p", null, "RUT-avdrag")), index.h("p", null, "(-", state.rut ? calculateRut() : 0, "kr)")))), index.h("div", { class: "hemfixarna_cart--price" }, index.h("h2", null, "Totalbelopp: "), index.h("h2", null, getTotalPrice(), "kr"))));
1768
+ })), index.h("div", { class: "hemfixarna_cart--additional" }, getStartFee().rot > 0 && (index.h("div", { class: "hemfixarna_cart--startfee" }, index.h("p", null, index.h("strong", { onClick: () => this.openRot() }, state.rotOptions.rot_start_fee_heading, index.h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), index.h("p", null, getStartFee().rot, "kr"))), getStartFee().rut > 0 && (index.h("div", { class: "hemfixarna_cart--startfee" }, index.h("p", null, index.h("strong", { onClick: () => this.openRut() }, state.rutOptions.rut_start_fee_heading, index.h("img", { height: 16, src: info, alt: "info monteringsavgift" }))), index.h("p", null, getStartFee().rut, "kr"))), state.cart.find((item) => item.rot) && (index.h("div", { class: "hemfixarna_cart--rutrot" }, index.h("div", null, this.cart && (index.h("label", { class: "switch" }, index.h("input", { checked: state.rot, onChange: () => (state.rot = !state.rot), type: "checkbox" }), index.h("span", { class: "slider" }))), index.h("p", null, "ROT-avdrag")), index.h("p", null, "(-", state.rot ? calculateRot() : 0, "kr)"))), state.cart.find((item) => item.rut) && (index.h("div", { class: "hemfixarna_cart--rutrot" }, index.h("div", null, index.h("label", { class: "switch" }, index.h("input", { onChange: () => (state.rut = !state.rut), checked: state.rut, type: "checkbox" }), index.h("span", { class: "slider" })), index.h("p", null, "RUT-avdrag")), index.h("p", null, "(-", state.rut ? calculateRut() : 0, "kr)")))), index.h("div", { class: "hemfixarna_cart--price" }, index.h("h2", null, "Totalbelopp: "), index.h("h2", null, getTotalPrice(), "kr"))));
1626
1769
  }
1627
1770
  };
1628
1771
 
@@ -1630,6 +1773,7 @@ const HemfixarnaProduct = class {
1630
1773
  constructor(hostRef) {
1631
1774
  index.registerInstance(this, hostRef);
1632
1775
  this.amount = 0;
1776
+ this.hideDescription = true;
1633
1777
  }
1634
1778
  addProduct() {
1635
1779
  const productInCart = state.cart.find(p => p.id === state.selectedProduct.ID);
@@ -1648,7 +1792,7 @@ const HemfixarnaProduct = class {
1648
1792
  parts: [],
1649
1793
  price: state.selectedProduct.price,
1650
1794
  name: state.selectedProduct.post_title,
1651
- start_fee: !state.selectedProduct.start_fee,
1795
+ start_fee: !state.selectedProduct.hide_start_fee,
1652
1796
  terms_checkout: state.selectedProduct.terms_checkout,
1653
1797
  terms_show_checkbox: state.selectedProduct.terms_show_checkbox,
1654
1798
  icon: state.selectedProduct.icon,
@@ -1735,11 +1879,11 @@ const HemfixarnaProduct = class {
1735
1879
  const checked = index.getAssetPath(`./assets/checked.svg`);
1736
1880
  const plus = index.getAssetPath(`./assets/plus.svg`);
1737
1881
  const minus = index.getAssetPath(`./assets/minus.svg`);
1738
- return (index.h("div", { class: "hemfixarna_product" }, index.h("div", { class: "hemfixarna_product--top" }, state.selectedProduct.icon && (index.h("img", { width: 80, src: (_a = state.selectedProduct.icon.url) !== null && _a !== void 0 ? _a : state.selectedProduct.icon, alt: state.selectedProduct.post_title })), index.h("div", null, index.h("h1", null, state.selectedProduct.post_title), index.h("h2", null, "Fr\u00E5n: ", getProductPrice(state.selectedProduct), " kr"))), index.h("div", { class: "hemfixarna_product--grid" }, index.h("div", { class: "hemfixarna_product--left" }, ((_b = state.selectedProduct.list) === null || _b === void 0 ? void 0 : _b.length) && (index.h("ul", { class: "hemfixarna_features" }, state.selectedProduct.list.map(l => (index.h("li", { key: l.bullet }, index.h("img", { src: checked, alt: "checked" }), index.h("p", null, l.bullet)))))), index.h("p", { class: "hemfixarna_terms" }, index.h("strong", null, "OBS! "), index.h("span", { innerHTML: state.selectedProduct.terms }))), index.h("div", { class: "hemfixarna_product--right" }, index.h("ul", null, index.h("li", { class: "hemfixarna_product--item" }, index.h("div", null, index.h("p", null, "Antal ", state.selectedProduct.post_title), index.h("p", { class: "hemfixarna_product--price" }, getProductPrice(state.selectedProduct), "kr/st")), index.h("div", { class: "hemfixarna_counter" }, index.h("img", { class: `${this.getAmount() === 0 ? 'disabled' : ''}`, src: minus, onClick: () => this.removeProduct() }), index.h("span", null, this.getAmount()), index.h("img", { src: plus, onClick: () => this.addProduct() }))), ((_c = state.selectedProduct.parts) === null || _c === void 0 ? void 0 : _c.length) &&
1882
+ return (index.h("div", { class: "hemfixarna_product" }, index.h("div", { class: "hemfixarna_product--top" }, state.selectedProduct.icon && (index.h("img", { width: 80, src: (_a = state.selectedProduct.icon.url) !== null && _a !== void 0 ? _a : state.selectedProduct.icon, alt: state.selectedProduct.post_title })), index.h("div", null, index.h("h1", null, state.selectedProduct.post_title), index.h("h2", null, "Fr\u00E5n: ", getProductPrice(state.selectedProduct), " kr"))), index.h("div", { class: "hemfixarna_product--grid" }, index.h("div", { class: "hemfixarna_product--left" }, ((_b = state.selectedProduct.list) === null || _b === void 0 ? void 0 : _b.length) && (index.h("ul", { class: "hemfixarna_features" }, state.selectedProduct.list.map(l => (index.h("li", { key: l.bullet }, index.h("img", { src: checked, alt: "checked" }), index.h("p", null, l.bullet)))))), state.selectedProduct.description && (index.h("p", { onClick: () => (this.hideDescription = false), class: `hemfixarna_description ${this.hideDescription ? 'hemfixarna_description--hidden' : ''}`, innerHTML: state.selectedProduct.description }))), index.h("div", { class: "hemfixarna_product--right" }, index.h("ul", null, index.h("li", { class: "hemfixarna_product--item" }, index.h("div", null, index.h("p", null, "Antal ", state.selectedProduct.post_title), index.h("p", { class: "hemfixarna_product--price" }, getProductPrice(state.selectedProduct), "kr/st")), index.h("div", { class: "hemfixarna_counter" }, index.h("img", { class: `${this.getAmount() === 0 ? 'disabled' : ''}`, src: minus, onClick: () => this.removeProduct() }), index.h("span", null, this.getAmount()), index.h("img", { src: plus, onClick: () => this.addProduct() }))), ((_c = state.selectedProduct.parts) === null || _c === void 0 ? void 0 : _c.length) &&
1739
1883
  state.selectedProduct.parts.map(p => {
1740
1884
  var _a;
1741
1885
  return (index.h("li", { class: "hemfixarna_part" }, index.h("div", null, index.h("p", null, (_a = p.title) !== null && _a !== void 0 ? _a : p.post_title), index.h("p", { class: "hemfixarna_product--price" }, getPartPrice(p, state.selectedProduct), "kr/st")), index.h("div", { class: "hemfixarna_counter" }, index.h("img", { class: `${this.getPartAmount(p.ID) === 0 ? 'disabled' : ''}`, src: minus, onClick: () => this.removePart(p) }), index.h("span", null, this.getPartAmount(p.ID)), index.h("img", { class: `${this.getAmount() === 0 ? 'disabled' : ''}`, src: plus, onClick: () => this.addPart(p) }))));
1742
- })), index.h("h4", { class: "hemfixarna_product--total" }, "Totalt ", this.getTotalPrice(), " kr"), index.h("button", { onClick: () => this.goToCart(), class: `hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}` }, "Boka"), state.options && index.h("hemfixarna-info", { list: state.options.trust })))));
1886
+ })), index.h("h4", { class: "hemfixarna_product--total" }, "Totalt ", this.getTotalPrice(), " kr"), index.h("button", { onClick: () => this.goToCart(), class: `hemfixarna_buy ${this.getAmount() === 0 ? 'disabled' : ''}` }, "Boka"), !state.selectedProduct.hide_start_fee && (state.selectedProduct.rot || state.selectedProduct.rut) && state.rutOptions && state.rotOptions && (index.h("p", { class: "hemfixarna_terms" }, index.h("strong", null, state.selectedProduct.rot ? state.rotOptions.rot_start_fee_heading : state.rutOptions.rut_start_fee_heading), index.h("br", null), index.h("span", { innerHTML: state.selectedProduct.rot ? state.rotOptions.rot_start_fee_text : state.rutOptions.rut_start_fee_text }))), state.options && index.h("hemfixarna-info", { list: state.options.trust })))));
1743
1887
  }
1744
1888
  get el() { return index.getElement(this); }
1745
1889
  };
@@ -1758,13 +1902,37 @@ const HemfixarnaService = class {
1758
1902
  }
1759
1903
  };
1760
1904
 
1905
+ const hemfixarnaSkanskaCss = "";
1906
+
1907
+ const MyComponent$1 = class {
1908
+ constructor(hostRef) {
1909
+ index.registerInstance(this, hostRef);
1910
+ this.categoryId = undefined;
1911
+ this.customer = undefined;
1912
+ }
1913
+ render() {
1914
+ return index.h("hemfixarna-component", { categoryId: this.categoryId, business: Business.skanska });
1915
+ }
1916
+ };
1917
+ MyComponent$1.style = hemfixarnaSkanskaCss;
1918
+
1761
1919
  const HemfixarnaGrid = class {
1762
1920
  constructor(hostRef) {
1763
1921
  index.registerInstance(this, hostRef);
1764
1922
  this.tree = undefined;
1923
+ this.slug = undefined;
1924
+ }
1925
+ isMainCategory(category) {
1926
+ return category.show_products !== undefined;
1765
1927
  }
1766
1928
  render() {
1767
- return (index.h("div", null, index.h("h2", null, "Alla tj\u00E4nster"), index.h("div", { class: "hemfixarna_categories--wrapper" }, index.h("ul", { class: "hemfixarna_categories" }, this.tree.sub_cats
1929
+ return state.customer ? (index.h("div", null, index.h("h2", null, state.selectedCustomerCategory ? state.selectedCustomerCategory.name : 'Alla tjänster'), index.h("div", { class: "hemfixarna_categories--wrapper" }, index.h("ul", { class: "hemfixarna_categories" }, state.selectedCustomerCategory
1930
+ ? this.isMainCategory(state.selectedCustomerCategory) && state.selectedCustomerCategory.sub_categories && !state.selectedCustomerCategory.show_products
1931
+ ? state.selectedCustomerCategory.sub_categories.map(c => index.h("hemfixarna-box", { category: c }))
1932
+ : state.selectedCustomerCategory.products
1933
+ ? state.selectedCustomerCategory.products.map(c => index.h("hemfixarna-box", { category: c.fields }))
1934
+ : null
1935
+ : state.customer.categories.map(c => index.h("hemfixarna-box", { category: c }))), index.h("hemfixarna-info", { list: state.options.trust })))) : (index.h("div", null, index.h("h2", null, "Alla tj\u00E4nster"), index.h("div", { class: "hemfixarna_categories--wrapper" }, index.h("ul", { class: "hemfixarna_categories" }, this.tree.sub_cats
1768
1936
  .sort((a, b) => (a.name < b.name ? -1 : 1))
1769
1937
  .map(c => {
1770
1938
  var _a;
@@ -1773,21 +1941,37 @@ const HemfixarnaGrid = class {
1773
1941
  }
1774
1942
  };
1775
1943
 
1944
+ const hemfixarnaStringCss = "";
1945
+
1946
+ const MyComponent = class {
1947
+ constructor(hostRef) {
1948
+ index.registerInstance(this, hostRef);
1949
+ this.categoryId = undefined;
1950
+ this.customer = undefined;
1951
+ }
1952
+ render() {
1953
+ return index.h("hemfixarna-component", { categoryId: this.categoryId, business: Business.string });
1954
+ }
1955
+ };
1956
+ MyComponent.style = hemfixarnaStringCss;
1957
+
1776
1958
  exports.hemfixarna_address = HemfixarnaAddress;
1777
1959
  exports.hemfixarna_box = HemfixarnaBox;
1778
1960
  exports.hemfixarna_breadcrumbs = HemfixarnaBreadcrumbs;
1779
- exports.hemfixarna_byggmax = MyComponent$1;
1961
+ exports.hemfixarna_byggmax = MyComponent$3;
1780
1962
  exports.hemfixarna_cart = HemfixarnaCart;
1781
1963
  exports.hemfixarna_category = HemfixarnaCategory;
1782
1964
  exports.hemfixarna_checkout = HemfixarnaCheckout;
1783
1965
  exports.hemfixarna_component = HemfixarnaComponent;
1784
- exports.hemfixarna_demo = MyComponent;
1966
+ exports.hemfixarna_demo = MyComponent$2;
1785
1967
  exports.hemfixarna_getuser = HemfixarnaGetuser;
1786
1968
  exports.hemfixarna_info = HemfixarnaInfo;
1787
1969
  exports.hemfixarna_order = HemfixarnaOrder;
1788
1970
  exports.hemfixarna_orderrows = HemfixarnaOrderrows;
1789
1971
  exports.hemfixarna_product = HemfixarnaProduct;
1790
1972
  exports.hemfixarna_service = HemfixarnaService;
1973
+ exports.hemfixarna_skanska = MyComponent$1;
1791
1974
  exports.hemfixarna_start = HemfixarnaGrid;
1975
+ exports.hemfixarna_string_furniture = MyComponent;
1792
1976
 
1793
- //# sourceMappingURL=hemfixarna-address_16.cjs.entry.js.map
1977
+ //# sourceMappingURL=hemfixarna-address_18.cjs.entry.js.map