hemfixarna-web-components 1.2.0 → 1.2.1

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 (39) hide show
  1. package/dist/cjs/hemfixarna-address_20.cjs.entry.js +29 -15
  2. package/dist/cjs/hemfixarna-address_20.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/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js +20 -1
  6. package/dist/collection/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.js.map +1 -1
  7. package/dist/collection/components/hemfixarna-byggmax/hemfixarna-byggmax.js +11 -10
  8. package/dist/collection/components/hemfixarna-byggmax/hemfixarna-byggmax.js.map +1 -1
  9. package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js +2 -2
  10. package/dist/collection/components/hemfixarna-checkout/hemfixarna-checkout.js.map +1 -1
  11. package/dist/collection/components/hemfixarna-component/hemfixarna-component.js +48 -1
  12. package/dist/collection/components/hemfixarna-component/hemfixarna-component.js.map +1 -1
  13. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js +1 -1
  14. package/dist/collection/components/hemfixarna-demo/hemfixarna-demo.js.map +1 -1
  15. package/dist/collection/components/hemfixarna-hornbach/hemfixarna-hornbach.js +28 -8
  16. package/dist/collection/components/hemfixarna-hornbach/hemfixarna-hornbach.js.map +1 -1
  17. package/dist/collection/components/hemfixarna-kund/hemfixarna-kund.js +9 -8
  18. package/dist/collection/components/hemfixarna-kund/hemfixarna-kund.js.map +1 -1
  19. package/dist/collection/components/hemfixarna-skanska/hemfixarna-skanska.js +20 -1
  20. package/dist/collection/components/hemfixarna-skanska/hemfixarna-skanska.js.map +1 -1
  21. package/dist/collection/components/hemfixarna-string/hemfixarna-string-furniture.js +9 -8
  22. package/dist/collection/components/hemfixarna-string/hemfixarna-string-furniture.js.map +1 -1
  23. package/dist/esm/hemfixarna-address_20.entry.js +29 -15
  24. package/dist/esm/hemfixarna-address_20.entry.js.map +1 -1
  25. package/dist/esm/hemfixarna-components.js +1 -1
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/hemfixarna-components/hemfixarna-components.esm.js +1 -1
  28. package/dist/hemfixarna-components/p-5ae727bd.entry.js +2 -0
  29. package/dist/types/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.d.ts +1 -0
  30. package/dist/types/components/hemfixarna-byggmax/hemfixarna-byggmax.d.ts +1 -1
  31. package/dist/types/components/hemfixarna-component/hemfixarna-component.d.ts +2 -0
  32. package/dist/types/components/hemfixarna-hornbach/hemfixarna-hornbach.d.ts +2 -1
  33. package/dist/types/components/hemfixarna-kund/hemfixarna-kund.d.ts +1 -1
  34. package/dist/types/components/hemfixarna-skanska/hemfixarna-skanska.d.ts +1 -0
  35. package/dist/types/components/hemfixarna-string/hemfixarna-string-furniture.d.ts +1 -1
  36. package/dist/types/components.d.ts +18 -8
  37. package/package.json +1 -1
  38. package/dist/hemfixarna-components/p-8b5cb9c4.entry.js +0 -2
  39. /package/dist/hemfixarna-components/{p-8b5cb9c4.entry.js.map → p-5ae727bd.entry.js.map} +0 -0
@@ -463,6 +463,7 @@ const HemfixarnaBreadcrumbs = class {
463
463
  };
464
464
  this.tree = undefined;
465
465
  this.closeModal = undefined;
466
+ this.loadFromQuery = false;
466
467
  }
467
468
  getCartLength() {
468
469
  return state.cart.reduce((acc, curr) => acc + curr.amount, 0);
@@ -490,7 +491,7 @@ const HemfixarnaBreadcrumbs = class {
490
491
  const close = index.getAssetPath(`./assets/close.svg`);
491
492
  const cart = index.getAssetPath(`./assets/cart.svg`);
492
493
  const back = index.getAssetPath(`./assets/back.svg`);
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: () => {
494
+ return (index.h("div", null, index.h("div", { class: "hemfixarna_crumbs" }, index.h("div", { class: "hemfixarna_crumbs--links" }, index.h("img", { onClick: () => this.handleHomePageClick(), src: logo, width: 110 }), !this.loadFromQuery ? index.h("img", { onClick: () => this.closeModal(), class: "close", src: close, width: 32 }) : null, index.h("div", null, index.h("button", { onClick: () => this.handleHomePageClick() }, "Alla tj\u00E4nster"))), index.h("div", { 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: () => {
494
495
  state.step = state.step === 4 ? 3 : 2;
495
496
  } }, 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
497
  state.step = 1;
@@ -522,11 +523,11 @@ const MyComponent$5 = class {
522
523
  this.tree = null;
523
524
  this.slug = undefined;
524
525
  this.id = undefined;
525
- this.customer = undefined;
526
526
  this.forceOldTree = false;
527
+ this.loadFromQuery = false;
527
528
  }
528
529
  render() {
529
- return (index.h("hemfixarna-component", { forceOldTree: this.forceOldTree, id: this.id, slug: this.slug, business: Business.byggmax, topCategory: TopCategory.byggmax }));
530
+ return (index.h("hemfixarna-component", { loadFromQuery: this.loadFromQuery, forceOldTree: this.forceOldTree, id: this.id, slug: this.slug, business: Business.byggmax, topCategory: TopCategory.byggmax }));
530
531
  }
531
532
  };
532
533
  MyComponent$5.style = hemfixarnaByggmaxCss;
@@ -737,6 +738,8 @@ const HemfixarnaComponent = class {
737
738
  this.business = undefined;
738
739
  this.topCategory = undefined;
739
740
  this.forceOldTree = false;
741
+ this.loadFromQuery = false;
742
+ this.isDemo = false;
740
743
  }
741
744
  loadCategoryOrProduct(id) {
742
745
  this.proppedProduct = null;
@@ -839,6 +842,13 @@ const HemfixarnaComponent = class {
839
842
  this.product = res;
840
843
  }
841
844
  }
845
+ if (this.loadFromQuery) {
846
+ const params = new URL(document.location.toString()).searchParams;
847
+ this.id = params.get('id');
848
+ if (!this.isDemo) {
849
+ this.openModal();
850
+ }
851
+ }
842
852
  state.rotOptions = rot;
843
853
  state.rutOptions = rut;
844
854
  state.options = options;
@@ -880,6 +890,8 @@ const HemfixarnaComponent = class {
880
890
  }, 200);
881
891
  }
882
892
  handleClick(e) {
893
+ if (this.loadFromQuery && !this.isDemo)
894
+ return;
883
895
  const el = this.el.shadowRoot.querySelector('.hemfixarna_modal');
884
896
  if (el) {
885
897
  const isClickInside = el.contains(e.composedPath()[0]);
@@ -901,7 +913,7 @@ const HemfixarnaComponent = class {
901
913
  render() {
902
914
  var _a, _b, _c;
903
915
  const logo = index.getAssetPath(`./assets/hemfixarna.svg`);
904
- 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) || ((_b = this.proppedProduct) === null || _b === void 0 ? void 0 : _b.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 && ((_c = this.slug) === null || _c === void 0 ? void 0 : _c.includes('product'))) || this.proppedProduct ? (index.h("span", null, ' från', " ", index.h("strong", null, getProductPriceWithRotAndRut(this.proppedProduct || 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 || this.slugIsOldFormat(this.slug) ? (index.h("div", { class: `hemfixarna_content hemfixarna_content--${state.step}` }, state.step === 1 && this.tree && index.h("hemfixarna-start", { tree: this.tree }), state.step === 2 && state.selectedCategory && index.h("hemfixarna-category", null), state.step === 3 && state.selectedService && index.h("hemfixarna-service", null), state.step === 4 && state.selectedProduct && index.h("hemfixarna-product", null), state.step === 5 && index.h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && index.h("hemfixarna-order", { tree: this.tree }))) : (index.h("div", { class: `hemfixarna_content hemfixarna_content--${state.step}` }, state.step < 4 && 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' : ''}` })))));
916
+ return (index.h("div", { class: "hemfixarna" }, !this.loadFromQuery || this.isDemo ? (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) || ((_b = this.proppedProduct) === null || _b === void 0 ? void 0 : _b.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 && ((_c = this.slug) === null || _c === void 0 ? void 0 : _c.includes('product'))) || this.proppedProduct ? (index.h("span", null, ' från', " ", index.h("strong", null, getProductPriceWithRotAndRut(this.proppedProduct || 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())))) : null, this.modal && (index.h("div", null, index.h("div", { class: `hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}` }, state.modal && (index.h("div", { class: "hemfixarna_infomodal" }, state.modal.title && index.h("h2", null, state.modal.title), state.modal.text.map((t) => (index.h("p", { innerHTML: t }))), index.h("div", null, index.h("button", { onClick: () => (state.modal = null) }, "St\u00E4ng")))), (this.tree || state.customer) && index.h("hemfixarna-breadcrumbs", { loadFromQuery: this.loadFromQuery, closeModal: () => this.closeModal(), tree: this.tree }), !state.customer || this.slugIsOldFormat(this.slug) ? (index.h("div", { class: `hemfixarna_content hemfixarna_content--${state.step}` }, state.step === 1 && this.tree && index.h("hemfixarna-start", { tree: this.tree }), state.step === 2 && state.selectedCategory && index.h("hemfixarna-category", null), state.step === 3 && state.selectedService && index.h("hemfixarna-service", null), state.step === 4 && state.selectedProduct && index.h("hemfixarna-product", null), state.step === 5 && index.h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && index.h("hemfixarna-order", { tree: this.tree }))) : (index.h("div", { class: `hemfixarna_content hemfixarna_content--${state.step}` }, state.step < 4 && 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' : ''}` })))));
905
917
  }
906
918
  static get assetsDirs() { return ["assets"]; }
907
919
  get el() { return index.getElement(this); }
@@ -925,7 +937,7 @@ const MyComponent$4 = class {
925
937
  this.customer = null;
926
938
  }
927
939
  getTopLevelCategory() {
928
- switch ("byggmax") {
940
+ switch ("hornbach") {
929
941
  case Business.byggmax:
930
942
  return TopCategory.byggmax;
931
943
  default:
@@ -941,14 +953,14 @@ const MyComponent$4 = class {
941
953
  }
942
954
  }
943
955
  else {
944
- const customer = await getCustomer("byggmax");
956
+ const customer = await getCustomer("hornbach");
945
957
  if (customer.code !== 'not_found' && customer) {
946
958
  this.customer = customer;
947
959
  }
948
960
  }
949
961
  }
950
962
  getExample() {
951
- return `<hemfixarna-${"byggmax"}${this.selectedSlug ? ` slug="${this.selectedSlug}" ` : ''}${this.selectedID ? ` id="${this.selectedID}" ` : ''}></hemfixarna-${"byggmax"}>`;
963
+ return `<hemfixarna-${"hornbach"}${this.selectedSlug ? ` slug="${this.selectedSlug}" ` : ''}${this.selectedID ? ` id="${this.selectedID}" ` : ''}></hemfixarna-${"hornbach"}>`;
952
964
  }
953
965
  copyExample() {
954
966
  navigator.clipboard.writeText(this.getExample());
@@ -973,7 +985,7 @@ const MyComponent$4 = class {
973
985
  }
974
986
  render() {
975
987
  const copy = index.getAssetPath(`./assets/copy.png`);
976
- 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", { forceOldTree: Boolean(process.env.FORCE_OLD_TREE), slug: this.selectedSlug, id: this.selectedID })), "byggmax" === Business.skanska && index.h("hemfixarna-skanska", { id: this.selectedID }), "byggmax" === Business.string && index.h("hemfixarna-string-furniture", { id: this.selectedID }), "byggmax" === Business.hornbach && index.h("hemfixarna-hornbach", { id: this.selectedID }), "byggmax" === Business.kund && index.h("hemfixarna-kund", { id: this.selectedID }), index.h("div", { class: "hemfixarna_install" }, index.h("div", { onClick: () => this.copyCdn(), class: "hemfixarna_example" }, index.h("p", null, this.cdnLink), index.h("span", { class: "hemfixarna_example--tooltip" }, this.tooltipText), index.h("img", { src: copy, height: 20 })))), index.h("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 &&
988
+ 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)), "hornbach" === Business.byggmax && (index.h("hemfixarna-byggmax", { forceOldTree: Boolean(process.env.FORCE_OLD_TREE), slug: this.selectedSlug, id: this.selectedID })), "hornbach" === Business.skanska && index.h("hemfixarna-skanska", { id: this.selectedID }), "hornbach" === Business.string && index.h("hemfixarna-string-furniture", { id: this.selectedID }), "hornbach" === Business.hornbach && index.h("hemfixarna-hornbach", { isDemo: true, id: this.selectedID }), "hornbach" === Business.kund && index.h("hemfixarna-kund", { id: this.selectedID }), index.h("div", { class: "hemfixarna_install" }, index.h("div", { onClick: () => this.copyCdn(), class: "hemfixarna_example" }, index.h("p", null, this.cdnLink), index.h("span", { class: "hemfixarna_example--tooltip" }, this.tooltipText), index.h("img", { src: copy, height: 20 })))), index.h("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 &&
977
989
  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")))))))))))))))))));
978
990
  }
979
991
  };
@@ -1707,10 +1719,11 @@ const MyComponent$3 = class {
1707
1719
  constructor(hostRef) {
1708
1720
  index.registerInstance(this, hostRef);
1709
1721
  this.id = undefined;
1710
- this.customer = undefined;
1722
+ this.loadFromQuery = true;
1723
+ this.isDemo = false;
1711
1724
  }
1712
1725
  render() {
1713
- return index.h("hemfixarna-component", { id: this.id, business: Business.hornbach });
1726
+ return index.h("hemfixarna-component", { isDemo: this.isDemo, loadFromQuery: this.loadFromQuery, id: this.id, business: Business.hornbach });
1714
1727
  }
1715
1728
  };
1716
1729
  MyComponent$3.style = hemfixarnaHornbachCss;
@@ -1738,10 +1751,10 @@ const MyComponent$2 = class {
1738
1751
  constructor(hostRef) {
1739
1752
  index.registerInstance(this, hostRef);
1740
1753
  this.id = undefined;
1741
- this.customer = undefined;
1754
+ this.loadFromQuery = false;
1742
1755
  }
1743
1756
  render() {
1744
- return index.h("hemfixarna-component", { id: this.id, business: Business.kund });
1757
+ return index.h("hemfixarna-component", { loadFromQuery: this.loadFromQuery, id: this.id, business: Business.kund });
1745
1758
  }
1746
1759
  };
1747
1760
 
@@ -1960,9 +1973,10 @@ const MyComponent$1 = class {
1960
1973
  index.registerInstance(this, hostRef);
1961
1974
  this.id = undefined;
1962
1975
  this.customer = undefined;
1976
+ this.loadFromQuery = false;
1963
1977
  }
1964
1978
  render() {
1965
- return index.h("hemfixarna-component", { id: this.id, business: Business.skanska });
1979
+ return index.h("hemfixarna-component", { loadFromQuery: this.loadFromQuery, id: this.id, business: Business.skanska });
1966
1980
  }
1967
1981
  };
1968
1982
  MyComponent$1.style = hemfixarnaSkanskaCss;
@@ -1998,10 +2012,10 @@ const MyComponent = class {
1998
2012
  constructor(hostRef) {
1999
2013
  index.registerInstance(this, hostRef);
2000
2014
  this.id = undefined;
2001
- this.customer = undefined;
2015
+ this.loadFromQuery = false;
2002
2016
  }
2003
2017
  render() {
2004
- return index.h("hemfixarna-component", { id: this.id, business: Business.string });
2018
+ return index.h("hemfixarna-component", { loadFromQuery: this.loadFromQuery, id: this.id, business: Business.string });
2005
2019
  }
2006
2020
  };
2007
2021
  MyComponent.style = hemfixarnaStringCss;
@@ -1 +1 @@
1
- {"file":"hemfixarna-address.hemfixarna-box.hemfixarna-breadcrumbs.hemfixarna-byggmax.hemfixarna-cart.hemfixarna-category.hemfixarna-checkout.hemfixarna-component.hemfixarna-demo.hemfixarna-getuser.hemfixarna-hornbach.hemfixarna-info.hemfixarna-kund.hemfixarna-order.hemfixarna-orderrows.hemfixarna-product.hemfixarna-service.hemfixarna-skanska.hemfixarna-start.hemfixarna-string-furniture.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
1
+ {"file":"hemfixarna-address.hemfixarna-box.hemfixarna-breadcrumbs.hemfixarna-byggmax.hemfixarna-cart.hemfixarna-category.hemfixarna-checkout.hemfixarna-component.hemfixarna-demo.hemfixarna-getuser.hemfixarna-hornbach.hemfixarna-info.hemfixarna-kund.hemfixarna-order.hemfixarna-orderrows.hemfixarna-product.hemfixarna-service.hemfixarna-skanska.hemfixarna-start.h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;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -20,7 +20,7 @@ const patchBrowser = () => {
20
20
  };
21
21
 
22
22
  patchBrowser().then(options => {
23
- return index.bootstrapLazy([["hemfixarna-address_20.cjs",[[1,"hemfixarna-demo",{"selectedSlug":[32],"selectedID":[32],"tooltipText":[32],"tree":[32],"customer":[32]}],[1,"hemfixarna-byggmax",{"slug":[1],"id":[1],"customer":[1],"forceOldTree":[4,"force-old-tree"],"tree":[32]}],[1,"hemfixarna-hornbach",{"id":[1],"customer":[1]}],[1,"hemfixarna-kund",{"id":[1],"customer":[1]}],[1,"hemfixarna-skanska",{"id":[1],"customer":[1]}],[1,"hemfixarna-string-furniture",{"id":[1],"customer":[1]}],[1,"hemfixarna-component",{"slug":[1],"id":[1],"business":[1],"topCategory":[1,"top-category"],"forceOldTree":[4,"force-old-tree"],"modal":[32],"showModal":[32],"tree":[32],"product":[32],"proppedProduct":[32]},[[0,"click","handleClick"]]],[0,"hemfixarna-cart",{"tree":[16]}],[0,"hemfixarna-category"],[0,"hemfixarna-order",{"tree":[16]}],[0,"hemfixarna-service"],[0,"hemfixarna-start",{"tree":[16],"slug":[1]}],[0,"hemfixarna-product",{"amount":[32],"hideDescription":[32]}],[0,"hemfixarna-breadcrumbs",{"tree":[16],"closeModal":[16]}],[0,"hemfixarna-checkout",{"date":[32],"dateError":[32],"generalError":[32]}],[0,"hemfixarna-address",{"street":[32],"streetError":[32],"zip":[32],"zipError":[32],"town":[32],"townError":[32]}],[0,"hemfixarna-getuser",{"email":[32],"emailError":[32],"phone":[32],"phoneError":[32],"ssn":[32],"ssnError":[32]}],[0,"hemfixarna-orderrows",{"cart":[4],"tree":[16]}],[0,"hemfixarna-box",{"post":[16],"category":[16],"icon":[1],"postTitle":[1,"post-title"]}],[0,"hemfixarna-info",{"list":[16]}]]]], options);
23
+ return index.bootstrapLazy([["hemfixarna-address_20.cjs",[[1,"hemfixarna-demo",{"selectedSlug":[32],"selectedID":[32],"tooltipText":[32],"tree":[32],"customer":[32]}],[1,"hemfixarna-byggmax",{"slug":[1],"id":[1],"forceOldTree":[4,"force-old-tree"],"loadFromQuery":[4,"load-from-query"],"tree":[32]}],[1,"hemfixarna-hornbach",{"id":[1],"loadFromQuery":[4,"load-from-query"],"isDemo":[4,"is-demo"]}],[1,"hemfixarna-kund",{"id":[1],"loadFromQuery":[4,"load-from-query"]}],[1,"hemfixarna-skanska",{"id":[1],"customer":[1],"loadFromQuery":[4,"load-from-query"]}],[1,"hemfixarna-string-furniture",{"id":[1],"loadFromQuery":[4,"load-from-query"]}],[1,"hemfixarna-component",{"slug":[1],"id":[1],"business":[1],"topCategory":[1,"top-category"],"forceOldTree":[4,"force-old-tree"],"loadFromQuery":[4,"load-from-query"],"isDemo":[4,"is-demo"],"modal":[32],"showModal":[32],"tree":[32],"product":[32],"proppedProduct":[32]},[[0,"click","handleClick"]]],[0,"hemfixarna-cart",{"tree":[16]}],[0,"hemfixarna-category"],[0,"hemfixarna-order",{"tree":[16]}],[0,"hemfixarna-service"],[0,"hemfixarna-start",{"tree":[16],"slug":[1]}],[0,"hemfixarna-product",{"amount":[32],"hideDescription":[32]}],[0,"hemfixarna-breadcrumbs",{"tree":[16],"closeModal":[16],"loadFromQuery":[4,"load-from-query"]}],[0,"hemfixarna-checkout",{"date":[32],"dateError":[32],"generalError":[32]}],[0,"hemfixarna-address",{"street":[32],"streetError":[32],"zip":[32],"zipError":[32],"town":[32],"townError":[32]}],[0,"hemfixarna-getuser",{"email":[32],"emailError":[32],"phone":[32],"phoneError":[32],"ssn":[32],"ssnError":[32]}],[0,"hemfixarna-orderrows",{"cart":[4],"tree":[16]}],[0,"hemfixarna-box",{"post":[16],"category":[16],"icon":[1],"postTitle":[1,"post-title"]}],[0,"hemfixarna-info",{"list":[16]}]]]], options);
24
24
  });
25
25
 
26
26
  exports.setNonce = index.setNonce;
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["hemfixarna-address_20.cjs",[[1,"hemfixarna-demo",{"selectedSlug":[32],"selectedID":[32],"tooltipText":[32],"tree":[32],"customer":[32]}],[1,"hemfixarna-byggmax",{"slug":[1],"id":[1],"customer":[1],"forceOldTree":[4,"force-old-tree"],"tree":[32]}],[1,"hemfixarna-hornbach",{"id":[1],"customer":[1]}],[1,"hemfixarna-kund",{"id":[1],"customer":[1]}],[1,"hemfixarna-skanska",{"id":[1],"customer":[1]}],[1,"hemfixarna-string-furniture",{"id":[1],"customer":[1]}],[1,"hemfixarna-component",{"slug":[1],"id":[1],"business":[1],"topCategory":[1,"top-category"],"forceOldTree":[4,"force-old-tree"],"modal":[32],"showModal":[32],"tree":[32],"product":[32],"proppedProduct":[32]},[[0,"click","handleClick"]]],[0,"hemfixarna-cart",{"tree":[16]}],[0,"hemfixarna-category"],[0,"hemfixarna-order",{"tree":[16]}],[0,"hemfixarna-service"],[0,"hemfixarna-start",{"tree":[16],"slug":[1]}],[0,"hemfixarna-product",{"amount":[32],"hideDescription":[32]}],[0,"hemfixarna-breadcrumbs",{"tree":[16],"closeModal":[16]}],[0,"hemfixarna-checkout",{"date":[32],"dateError":[32],"generalError":[32]}],[0,"hemfixarna-address",{"street":[32],"streetError":[32],"zip":[32],"zipError":[32],"town":[32],"townError":[32]}],[0,"hemfixarna-getuser",{"email":[32],"emailError":[32],"phone":[32],"phoneError":[32],"ssn":[32],"ssnError":[32]}],[0,"hemfixarna-orderrows",{"cart":[4],"tree":[16]}],[0,"hemfixarna-box",{"post":[16],"category":[16],"icon":[1],"postTitle":[1,"post-title"]}],[0,"hemfixarna-info",{"list":[16]}]]]], options);
17
+ return index.bootstrapLazy([["hemfixarna-address_20.cjs",[[1,"hemfixarna-demo",{"selectedSlug":[32],"selectedID":[32],"tooltipText":[32],"tree":[32],"customer":[32]}],[1,"hemfixarna-byggmax",{"slug":[1],"id":[1],"forceOldTree":[4,"force-old-tree"],"loadFromQuery":[4,"load-from-query"],"tree":[32]}],[1,"hemfixarna-hornbach",{"id":[1],"loadFromQuery":[4,"load-from-query"],"isDemo":[4,"is-demo"]}],[1,"hemfixarna-kund",{"id":[1],"loadFromQuery":[4,"load-from-query"]}],[1,"hemfixarna-skanska",{"id":[1],"customer":[1],"loadFromQuery":[4,"load-from-query"]}],[1,"hemfixarna-string-furniture",{"id":[1],"loadFromQuery":[4,"load-from-query"]}],[1,"hemfixarna-component",{"slug":[1],"id":[1],"business":[1],"topCategory":[1,"top-category"],"forceOldTree":[4,"force-old-tree"],"loadFromQuery":[4,"load-from-query"],"isDemo":[4,"is-demo"],"modal":[32],"showModal":[32],"tree":[32],"product":[32],"proppedProduct":[32]},[[0,"click","handleClick"]]],[0,"hemfixarna-cart",{"tree":[16]}],[0,"hemfixarna-category"],[0,"hemfixarna-order",{"tree":[16]}],[0,"hemfixarna-service"],[0,"hemfixarna-start",{"tree":[16],"slug":[1]}],[0,"hemfixarna-product",{"amount":[32],"hideDescription":[32]}],[0,"hemfixarna-breadcrumbs",{"tree":[16],"closeModal":[16],"loadFromQuery":[4,"load-from-query"]}],[0,"hemfixarna-checkout",{"date":[32],"dateError":[32],"generalError":[32]}],[0,"hemfixarna-address",{"street":[32],"streetError":[32],"zip":[32],"zipError":[32],"town":[32],"townError":[32]}],[0,"hemfixarna-getuser",{"email":[32],"emailError":[32],"phone":[32],"phoneError":[32],"ssn":[32],"ssnError":[32]}],[0,"hemfixarna-orderrows",{"cart":[4],"tree":[16]}],[0,"hemfixarna-box",{"post":[16],"category":[16],"icon":[1],"postTitle":[1,"post-title"]}],[0,"hemfixarna-info",{"list":[16]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -9,6 +9,7 @@ export class HemfixarnaBreadcrumbs {
9
9
  };
10
10
  this.tree = undefined;
11
11
  this.closeModal = undefined;
12
+ this.loadFromQuery = false;
12
13
  }
13
14
  getCartLength() {
14
15
  return state.cart.reduce((acc, curr) => acc + curr.amount, 0);
@@ -36,7 +37,7 @@ export class HemfixarnaBreadcrumbs {
36
37
  const close = getAssetPath(`./assets/close.svg`);
37
38
  const cart = getAssetPath(`./assets/cart.svg`);
38
39
  const back = getAssetPath(`./assets/back.svg`);
39
- return (h("div", null, h("div", { class: "hemfixarna_crumbs" }, h("div", { class: "hemfixarna_crumbs--links" }, h("img", { onClick: () => this.handleHomePageClick(), src: logo, width: 110 }), h("img", { onClick: () => this.closeModal(), class: "close", src: close, width: 32 }), h("div", null, h("button", { onClick: () => this.handleHomePageClick() }, "Alla tj\u00E4nster"))), h("div", { onClick: () => this.handleCartClick(), class: `cart ${this.getCartLength() > 0 ? 'cart_active' : ''}` }, h("img", { src: cart, width: 24 }), h("span", null, this.getCartLength()))), [3, 4].includes(state.step) && !state.customer && (h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
40
+ return (h("div", null, h("div", { class: "hemfixarna_crumbs" }, h("div", { class: "hemfixarna_crumbs--links" }, h("img", { onClick: () => this.handleHomePageClick(), src: logo, width: 110 }), !this.loadFromQuery ? h("img", { onClick: () => this.closeModal(), class: "close", src: close, width: 32 }) : null, h("div", null, h("button", { onClick: () => this.handleHomePageClick() }, "Alla tj\u00E4nster"))), h("div", { onClick: () => this.handleCartClick(), class: `cart ${this.getCartLength() > 0 ? 'cart_active' : ''}` }, h("img", { src: cart, width: 24 }), h("span", null, this.getCartLength()))), [3, 4].includes(state.step) && !state.customer && (h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
40
41
  state.step = state.step === 4 ? 3 : 2;
41
42
  } }, h("img", { width: 24, src: back, alt: "back arrow" }), h("span", null, "Se allt ", state.step === 4 ? state.selectedService.post_title : state.selectedCategory.name))), state.parentCategory && state.step < 5 && (h("button", { class: "hemfixarna_crumbs--back", onClick: () => {
42
43
  state.step = 1;
@@ -81,6 +82,24 @@ export class HemfixarnaBreadcrumbs {
81
82
  "tags": [],
82
83
  "text": ""
83
84
  }
85
+ },
86
+ "loadFromQuery": {
87
+ "type": "boolean",
88
+ "mutable": false,
89
+ "complexType": {
90
+ "original": "boolean",
91
+ "resolved": "boolean",
92
+ "references": {}
93
+ },
94
+ "required": false,
95
+ "optional": false,
96
+ "docs": {
97
+ "tags": [],
98
+ "text": ""
99
+ },
100
+ "attribute": "load-from-query",
101
+ "reflect": false,
102
+ "defaultValue": "false"
84
103
  }
85
104
  };
86
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hemfixarna-breadcrumbs.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-breadcrumbs/hemfixarna-breadcrumbs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE1E,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMjD,MAAM,OAAO,qBAAqB;;IAShC,uBAAkB,GAAG,GAAG,EAAE;MACxB,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,WAA0B,CAAC;MAC9C,WAAW,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,CAAC;;;;EAPF,aAAa;IACX,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;EAChE,CAAC;EAOD,eAAe;;IACb,IAAI,MAAA,KAAK,CAAC,IAAI,0CAAE,MAAM,EAAE;MACtB,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;MACf,IAAI,CAAC,kBAAkB,EAAE,CAAC;KAC3B;EACH,CAAC;EAED,mBAAmB;IACjB,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;IACf,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,wBAAwB,GAAG,IAAI,CAAC;IAC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CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CACjD,cACE,KAAK,EAAC,yBAAyB,EAC/B,OAAO,EAAE,GAAG,EAAE;UACZ,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,CAAC;QAED,WAAK,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,YAAY,GAAG;QAC9C;;UAAe,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAQ,CACjG,CACV;MACA,KAAK,CAAC,cAAc,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,CACzC,cACE,KAAK,EAAC,yBAAyB,EAC/B,OAAO,EAAE,GAAG,EAAE;UACZ,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;UACf,KAAK,CAAC,wBAAwB,GAAG,KAAK,CAAC,cAAc,CAAC;UACtD,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC;QAC/B,CAAC;QAED,WAAK,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,YAAY,GAAG;QAC9C;;UAAe,KAAK,CAAC,cAAc,CAAC,IAAI,CAAQ,CACzC,CACV,CACG,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, getAssetPath, h, Element } from '@stencil/core';\nimport { Category } from '../../types';\nimport state from '../../store';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-breadcrumbs',\n shadow: false,\n})\nexport class HemfixarnaBreadcrumbs {\n @Prop() tree: Category;\n @Prop() closeModal: () => void;\n @Element() private el: HTMLElement;\n\n getCartLength() {\n return state.cart.reduce((acc, curr) => acc + curr.amount, 0);\n }\n\n triggerScrollTotop = () => {\n const el = this.el.nextSibling as HTMLElement;\n scrollToTop(el);\n };\n\n handleCartClick() {\n if (state.cart?.length) {\n state.step = 5;\n this.triggerScrollTotop();\n }\n }\n\n handleHomePageClick() {\n state.step = 1;\n state.parentCategory = null;\n state.selectedCustomerCategory = null;\n this.triggerScrollTotop();\n setTimeout(() => {\n state.selectedCategory = null;\n state.selectedProduct = null;\n state.selectedService = null;\n }, 200);\n }\n\n render() {\n const logo = getAssetPath(`./assets/hemfixarna.svg`);\n const close = getAssetPath(`./assets/close.svg`);\n const cart = getAssetPath(`./assets/cart.svg`);\n const back = getAssetPath(`./assets/back.svg`);\n\n return (\n <div>\n <div class=\"hemfixarna_crumbs\">\n <div class=\"hemfixarna_crumbs--links\">\n <img onClick={() => this.handleHomePageClick()} src={logo} width={110} />\n <img onClick={() => this.closeModal()} class=\"close\" src={close} width={32} />\n <div>\n <button onClick={() => this.handleHomePageClick()}>Alla tjänster</button>\n </div>\n </div>\n <div onClick={() => this.handleCartClick()} class={`cart ${this.getCartLength() > 0 ? 'cart_active' : ''}`}>\n <img src={cart} width={24} />\n <span>{this.getCartLength()}</span>\n </div>\n </div>\n {[3, 4].includes(state.step) && !state.customer && (\n <button\n class=\"hemfixarna_crumbs--back\"\n onClick={() => {\n state.step = state.step === 4 ? 3 : 2;\n }}\n >\n <img width={24} src={back} alt=\"back arrow\" />\n <span>Se allt {state.step === 4 ? state.selectedService.post_title : state.selectedCategory.name}</span>\n </button>\n )}\n {state.parentCategory && state.step < 5 && (\n <button\n class=\"hemfixarna_crumbs--back\"\n onClick={() => {\n state.step = 1;\n state.selectedCustomerCategory = state.parentCategory;\n state.selectedProduct = null;\n }}\n >\n <img width={24} src={back} alt=\"back arrow\" />\n <span>Se allt {state.parentCategory.name}</span>\n </button>\n )}\n </div>\n );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ACZ,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,CAAC;QAED,WAAK,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,YAAY,GAAG;QAC9C;;UAAe,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAQ,CACjG,CACV;MACA,KAAK,CAAC,cAAc,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,CACzC,cACE,KAAK,EAAC,yBAAyB,EAC/B,OAAO,EAAE,GAAG,EAAE;UACZ,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;UACf,KAAK,CAAC,wBAAwB,GAAG,KAAK,CAAC,cAAc,CAAC;UACtD,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC;QAC/B,CAAC;QAED,WAAK,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,YAAY,GAAG;QAC9C;;UAAe,KAAK,CAAC,cAAc,CAAC,IAAI,CAAQ,CACzC,CACV,CACG,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Prop, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { Category } from '../../types';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-breadcrumbs',\n shadow: false,\n})\nexport class HemfixarnaBreadcrumbs {\n @Prop() tree: Category;\n @Prop() closeModal: () => void;\n @Prop() loadFromQuery: boolean = false;\n @Element() private el: HTMLElement;\n\n getCartLength() {\n return state.cart.reduce((acc, curr) => acc + curr.amount, 0);\n }\n\n triggerScrollTotop = () => {\n const el = this.el.nextSibling as HTMLElement;\n scrollToTop(el);\n };\n\n handleCartClick() {\n if (state.cart?.length) {\n state.step = 5;\n this.triggerScrollTotop();\n }\n }\n\n handleHomePageClick() {\n state.step = 1;\n state.parentCategory = null;\n state.selectedCustomerCategory = null;\n this.triggerScrollTotop();\n setTimeout(() => {\n state.selectedCategory = null;\n state.selectedProduct = null;\n state.selectedService = null;\n }, 200);\n }\n\n render() {\n const logo = getAssetPath(`./assets/hemfixarna.svg`);\n const close = getAssetPath(`./assets/close.svg`);\n const cart = getAssetPath(`./assets/cart.svg`);\n const back = getAssetPath(`./assets/back.svg`);\n\n return (\n <div>\n <div class=\"hemfixarna_crumbs\">\n <div class=\"hemfixarna_crumbs--links\">\n <img onClick={() => this.handleHomePageClick()} src={logo} width={110} />\n {!this.loadFromQuery ? <img onClick={() => this.closeModal()} class=\"close\" src={close} width={32} /> : null}\n <div>\n <button onClick={() => this.handleHomePageClick()}>Alla tjänster</button>\n </div>\n </div>\n <div onClick={() => this.handleCartClick()} class={`cart ${this.getCartLength() > 0 ? 'cart_active' : ''}`}>\n <img src={cart} width={24} />\n <span>{this.getCartLength()}</span>\n </div>\n </div>\n {[3, 4].includes(state.step) && !state.customer && (\n <button\n class=\"hemfixarna_crumbs--back\"\n onClick={() => {\n state.step = state.step === 4 ? 3 : 2;\n }}\n >\n <img width={24} src={back} alt=\"back arrow\" />\n <span>Se allt {state.step === 4 ? state.selectedService.post_title : state.selectedCategory.name}</span>\n </button>\n )}\n {state.parentCategory && state.step < 5 && (\n <button\n class=\"hemfixarna_crumbs--back\"\n onClick={() => {\n state.step = 1;\n state.selectedCustomerCategory = state.parentCategory;\n state.selectedProduct = null;\n }}\n >\n <img width={24} src={back} alt=\"back arrow\" />\n <span>Se allt {state.parentCategory.name}</span>\n </button>\n )}\n </div>\n );\n }\n}\n"]}
@@ -5,11 +5,11 @@ export class MyComponent {
5
5
  this.tree = null;
6
6
  this.slug = undefined;
7
7
  this.id = undefined;
8
- this.customer = undefined;
9
8
  this.forceOldTree = false;
9
+ this.loadFromQuery = false;
10
10
  }
11
11
  render() {
12
- return (h("hemfixarna-component", { forceOldTree: this.forceOldTree, id: this.id, slug: this.slug, business: Business.byggmax, topCategory: TopCategory.byggmax }));
12
+ return (h("hemfixarna-component", { loadFromQuery: this.loadFromQuery, forceOldTree: this.forceOldTree, id: this.id, slug: this.slug, business: Business.byggmax, topCategory: TopCategory.byggmax }));
13
13
  }
14
14
  static get is() { return "hemfixarna-byggmax"; }
15
15
  static get encapsulation() { return "shadow"; }
@@ -59,12 +59,12 @@ export class MyComponent {
59
59
  "attribute": "id",
60
60
  "reflect": false
61
61
  },
62
- "customer": {
63
- "type": "string",
62
+ "forceOldTree": {
63
+ "type": "boolean",
64
64
  "mutable": false,
65
65
  "complexType": {
66
- "original": "string",
67
- "resolved": "string",
66
+ "original": "boolean",
67
+ "resolved": "boolean",
68
68
  "references": {}
69
69
  },
70
70
  "required": false,
@@ -73,10 +73,11 @@ export class MyComponent {
73
73
  "tags": [],
74
74
  "text": ""
75
75
  },
76
- "attribute": "customer",
77
- "reflect": false
76
+ "attribute": "force-old-tree",
77
+ "reflect": false,
78
+ "defaultValue": "false"
78
79
  },
79
- "forceOldTree": {
80
+ "loadFromQuery": {
80
81
  "type": "boolean",
81
82
  "mutable": false,
82
83
  "complexType": {
@@ -90,7 +91,7 @@ export class MyComponent {
90
91
  "tags": [],
91
92
  "text": ""
92
93
  },
93
- "attribute": "force-old-tree",
94
+ "attribute": "load-from-query",
94
95
  "reflect": false,
95
96
  "defaultValue": "false"
96
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hemfixarna-byggmax.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-byggmax/hemfixarna-byggmax.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAY,WAAW,EAAE,MAAM,aAAa,CAAC;AAO9D,MAAM,OAAO,WAAW;;gBACY,IAAI;;;;wBAIL,KAAK;;EAEtC,MAAM;IACJ,OAAO,CACL,4BAAsB,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,WAAW,CAAC,OAAO,GAAyB,CAC3K,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, State, h } from '@stencil/core';\nimport { Business, Category, TopCategory } from '../../types';\n\n@Component({\n tag: 'hemfixarna-byggmax',\n styleUrl: 'hemfixarna-byggmax.scss',\n shadow: true,\n})\nexport class MyComponent {\n @State() tree?: Category | null = null;\n @Prop() slug?: string;\n @Prop() id?: string;\n @Prop() customer?: string;\n @Prop() forceOldTree?: boolean = false;\n\n render() {\n return (\n <hemfixarna-component forceOldTree={this.forceOldTree} id={this.id} slug={this.slug} business={Business.byggmax} topCategory={TopCategory.byggmax}></hemfixarna-component>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"hemfixarna-byggmax.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-byggmax/hemfixarna-byggmax.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAY,WAAW,EAAE,MAAM,aAAa,CAAC;AAO9D,MAAM,OAAO,WAAW;;gBACY,IAAI;;;wBAGL,KAAK;yBACJ,KAAK;;EAEvC,MAAM;IACJ,OAAO,CACL,4BACE,aAAa,EAAE,IAAI,CAAC,aAAa,EACjC,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,EAAE,EAAE,IAAI,CAAC,EAAE,EACX,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,QAAQ,EAAE,QAAQ,CAAC,OAAO,EAC1B,WAAW,EAAE,WAAW,CAAC,OAAO,GACV,CACzB,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, State, h } from '@stencil/core';\nimport { Business, Category, TopCategory } from '../../types';\n\n@Component({\n tag: 'hemfixarna-byggmax',\n styleUrl: 'hemfixarna-byggmax.scss',\n shadow: true,\n})\nexport class MyComponent {\n @State() tree?: Category | null = null;\n @Prop() slug?: string;\n @Prop() id?: string;\n @Prop() forceOldTree?: boolean = false;\n @Prop() loadFromQuery?: boolean = false;\n\n render() {\n return (\n <hemfixarna-component\n loadFromQuery={this.loadFromQuery}\n forceOldTree={this.forceOldTree}\n id={this.id}\n slug={this.slug}\n business={Business.byggmax}\n topCategory={TopCategory.byggmax}\n ></hemfixarna-component>\n );\n }\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  import { Fragment, getAssetPath, h } from '@stencil/core';
2
2
  import state from '../../store';
3
- import { hideField } from '../../utils/form';
4
- import { getPartPrice, getProductPrice, getStartFee, getTotalPrice } from '../../utils/calc';
5
3
  import { postOrder } from '../../utils/api';
4
+ import { getPartPrice, getProductPrice, getStartFee, getTotalPrice } from '../../utils/calc';
5
+ import { hideField } from '../../utils/form';
6
6
  import { scrollToTop } from '../../utils/scroll';
7
7
  export class HemfixarnaCheckout {
8
8
  constructor() {
@@ -1 +1 @@
1
- {"version":3,"file":"hemfixarna-checkout.js","sourceRoot":"","sources":["../../../src/components/hemfixarna-checkout/hemfixarna-checkout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,K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AI,CAAC,SAAS,IAAI,gBAAO,IAAI,CAAC,SAAS,CAAQ;YAChD,aAAO,KAAK,EAAC,qBAAqB;cAChC,aAAO,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAC,UAAU,GAAG;cACnE,YAAM,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,GAAI,CAClC;YACP,KAAK,CAAC,IAAI;eACR,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,IAAI,CAAC,CAAC,mBAAmB,CAAC;eACtD,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CACX,EAAC,QAAQ;cACP,aAAO,KAAK,EAAC,qBAAqB;gBAChC,aAAO,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAC,UAAU,GAAG;gBACnE,gBAAO,IAAI,CAAC,cAAc,CAAQ,CAC5B,CACC,CACZ,CAAC;YACH,IAAI,CAAC,YAAY,IAAI,gBAAO,IAAI,CAAC,YAAY,CAAQ;YACtD,aAAO,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,sBAAiB,GAAG,CAC1C,CACH,CACP,CAAC;OACH;IACH,CAAC,CAAC;gBArIsB,EAAE;qBACU,IAAI;wBACD,IAAI;;EAiE3C,iBAAiB;IACf,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;MAC5C,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC;KACxB;EACH,CAAC;;;;;;;;CA+DF","sourcesContent":["import { Component, Fragment, State, getAssetPath, h, Element } from '@stencil/core';\nimport state from '../../store';\nimport { hideField } from '../../utils/form';\nimport { getPartPrice, getProductPrice, getStartFee, getTotalPrice } from '../../utils/calc';\nimport { postOrder } from '../../utils/api';\nimport { Business } from '../../types';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-checkout',\n shadow: false,\n})\nexport class HemfixarnaCheckout {\n @State() date: string = '';\n @State() dateError: string | null = null;\n @State() generalError: string | null = null;\n @Element() private el: HTMLElement;\n\n handleChangeDate = (e: Event) => {\n this.dateError = null;\n this.date = (e.target as HTMLInputElement).value;\n };\n\n handleChangeTerms = () => {\n this.generalError = null;\n };\n\n sendOrder = async () => {\n // Test order post (remove later)\n\n const order = {\n name: state.user.firstName + ' ' + state.user.lastName,\n customer: state.business as Business,\n phone: state.user.phone,\n social_security_number: state.user.ssn,\n email: state.user.email,\n address: `${state.user.street} | ${state.user.zip} | ${state.user.town}`,\n earliest_visit_date: this.date,\n order_items: JSON.stringify(\n state.cart.map(\n item =>\n `${item.amount}st ${item.name} ${getProductPrice(item, item.price, item.amount)}kr ${\n item.parts.length ? `| ${item.parts.map(part => `${part.amount}st ${part.name} ${getPartPrice(part, item, part.amount)}kr`).join(' | ')} ` : ''\n } ${item.rot && state.rot ? '(med rot)' : state.rut && item.rut ? '(med rut)' : '(utan rut/rot)'}`,\n ),\n ),\n start_fee: `${getStartFee().rut > 0 ? `Rut: ${getStartFee().rut}kr` : 'Rut: 0'} ` + `${getStartFee().rot > 0 ? `Rot: ${getStartFee().rot}kr` : 'Rot: 0'}`,\n total: getTotalPrice(),\n };\n try {\n const { data: orderConfirm, status } = await postOrder(order);\n if (orderConfirm && status && status === 200) {\n state.step = 6;\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n } else {\n this.generalError = 'Något gick fel, försök igen senare';\n }\n } catch (_) {\n this.generalError = 'Något gick fel, försök igen senare';\n }\n };\n\n handleSubmit = (e: Event) => {\n e.preventDefault();\n this.generalError = null;\n const validDate = this.date.length > 0;\n if (!validDate) {\n this.dateError = 'Ange ett giltigt datum';\n }\n const checkBoxes = Array.from(this.el.querySelectorAll('input[type=\"checkbox\"]'));\n const notValidTerms = checkBoxes.find(i => !(i as HTMLInputElement).checked);\n if (notValidTerms) {\n this.generalError = 'Du måste godkänna villkoren';\n }\n if (validDate && !notValidTerms) {\n this.sendOrder();\n }\n };\n\n componentWillLoad() {\n if (Boolean(state.user && state.user.street)) {\n state.checkoutStep = 2;\n }\n }\n\n render = () => {\n const dateLogo = getAssetPath(`./assets/date.svg`);\n const down = getAssetPath(`./assets/down.svg`);\n\n if (state.checkoutEdit) {\n return <hemfixarna-address />;\n } else if (state.checkoutStep === 1) {\n return <hemfixarna-getuser />;\n } else if (state.checkoutStep === 2) {\n return (\n <div class=\"mb-2\">\n <div class=\"hemfixarna_addressinfo\">\n <div>\n <p>{hideField(state.user.firstName)}</p>\n <p>{hideField(state.user.lastName)}</p>\n <p>{state.user.email}</p>\n <p>{state.user.phone}</p>\n </div>\n <div>\n <p>{hideField(state.user.street)}</p>\n <p>{hideField(state.user.zip)}</p>\n <p>{hideField(state.user.town)}</p>\n </div>\n <button onClick={() => (state.checkoutEdit = true)}>Behöver du ändra adressen?</button>\n </div>\n <form onSubmit={e => this.handleSubmit(e)}>\n <div>\n <img src={dateLogo} width={24} />\n <input\n class={`${this.date.length ? 'input_active' : ''}`}\n min={new Date().toISOString().split('T')[0]}\n onChange={e => this.handleChangeDate(e)}\n type=\"date\"\n name=\"date\"\n value={this.date}\n />\n <label htmlFor=\"date\">Tidigaste datum för hembesök</label>\n <img src={down} width={24} />\n </div>\n {this.dateError && <span>{this.dateError}</span>}\n <label class=\"hemfixarna_checkbox\">\n <input onChange={() => this.handleChangeTerms()} type=\"checkbox\" />\n <span innerHTML={state.options.terms} />\n </label>\n {state.cart\n .filter(i => i.terms_checkout && i.terms_show_checkbox)\n .map(item => (\n <Fragment>\n <label class=\"hemfixarna_checkbox\">\n <input onChange={() => this.handleChangeTerms()} type=\"checkbox\" />\n <span>{item.terms_checkout}</span>\n </label>\n </Fragment>\n ))}\n {this.generalError && <span>{this.generalError}</span>}\n <input type=\"submit\" value=\"Slutför Bokning\" />\n </form>\n </div>\n );\n }\n };\n}\n"]}
1
+ {"version":3,"file":"hemfixarna-checkout.js","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, State, getAssetPath, h } from '@stencil/core';\nimport state from '../../store';\nimport { Business } from '../../types';\nimport { postOrder } from '../../utils/api';\nimport { getPartPrice, getProductPrice, getStartFee, getTotalPrice } from '../../utils/calc';\nimport { hideField } from '../../utils/form';\nimport { scrollToTop } from '../../utils/scroll';\n\n@Component({\n tag: 'hemfixarna-checkout',\n shadow: false,\n})\nexport class HemfixarnaCheckout {\n @State() date: string = '';\n @State() dateError: string | null = null;\n @State() generalError: string | null = null;\n @Element() private el: HTMLElement;\n\n handleChangeDate = (e: Event) => {\n this.dateError = null;\n this.date = (e.target as HTMLInputElement).value;\n };\n\n handleChangeTerms = () => {\n this.generalError = null;\n };\n\n sendOrder = async () => {\n // Test order post (remove later)\n\n const order = {\n name: state.user.firstName + ' ' + state.user.lastName,\n customer: state.business as Business,\n phone: state.user.phone,\n social_security_number: state.user.ssn,\n email: state.user.email,\n address: `${state.user.street} | ${state.user.zip} | ${state.user.town}`,\n earliest_visit_date: this.date,\n order_items: JSON.stringify(\n state.cart.map(\n item =>\n `${item.amount}st ${item.name} ${getProductPrice(item, item.price, item.amount)}kr ${\n item.parts.length ? `| ${item.parts.map(part => `${part.amount}st ${part.name} ${getPartPrice(part, item, part.amount)}kr`).join(' | ')} ` : ''\n } ${item.rot && state.rot ? '(med rot)' : state.rut && item.rut ? '(med rut)' : '(utan rut/rot)'}`,\n ),\n ),\n start_fee: `${getStartFee().rut > 0 ? `Rut: ${getStartFee().rut}kr` : 'Rut: 0'} ` + `${getStartFee().rot > 0 ? `Rot: ${getStartFee().rot}kr` : 'Rot: 0'}`,\n total: getTotalPrice(),\n };\n try {\n const { data: orderConfirm, status } = await postOrder(order);\n if (orderConfirm && status && status === 200) {\n state.step = 6;\n const el = this.el.closest('.hemfixarna_content');\n scrollToTop(el);\n } else {\n this.generalError = 'Något gick fel, försök igen senare';\n }\n } catch (_) {\n this.generalError = 'Något gick fel, försök igen senare';\n }\n };\n\n handleSubmit = (e: Event) => {\n e.preventDefault();\n this.generalError = null;\n const validDate = this.date.length > 0;\n if (!validDate) {\n this.dateError = 'Ange ett giltigt datum';\n }\n const checkBoxes = Array.from(this.el.querySelectorAll('input[type=\"checkbox\"]'));\n const notValidTerms = checkBoxes.find(i => !(i as HTMLInputElement).checked);\n if (notValidTerms) {\n this.generalError = 'Du måste godkänna villkoren';\n }\n if (validDate && !notValidTerms) {\n this.sendOrder();\n }\n };\n\n componentWillLoad() {\n if (Boolean(state.user && state.user.street)) {\n state.checkoutStep = 2;\n }\n }\n\n render = () => {\n const dateLogo = getAssetPath(`./assets/date.svg`);\n const down = getAssetPath(`./assets/down.svg`);\n\n if (state.checkoutEdit) {\n return <hemfixarna-address />;\n } else if (state.checkoutStep === 1) {\n return <hemfixarna-getuser />;\n } else if (state.checkoutStep === 2) {\n return (\n <div class=\"mb-2\">\n <div class=\"hemfixarna_addressinfo\">\n <div>\n <p>{hideField(state.user.firstName)}</p>\n <p>{hideField(state.user.lastName)}</p>\n <p>{state.user.email}</p>\n <p>{state.user.phone}</p>\n </div>\n <div>\n <p>{hideField(state.user.street)}</p>\n <p>{hideField(state.user.zip)}</p>\n <p>{hideField(state.user.town)}</p>\n </div>\n <button onClick={() => (state.checkoutEdit = true)}>Behöver du ändra adressen?</button>\n </div>\n <form onSubmit={e => this.handleSubmit(e)}>\n <div>\n <img src={dateLogo} width={24} />\n <input\n class={`${this.date.length ? 'input_active' : ''}`}\n min={new Date().toISOString().split('T')[0]}\n onChange={e => this.handleChangeDate(e)}\n type=\"date\"\n name=\"date\"\n value={this.date}\n />\n <label htmlFor=\"date\">Tidigaste datum för hembesök</label>\n <img src={down} width={24} />\n </div>\n {this.dateError && <span>{this.dateError}</span>}\n <label class=\"hemfixarna_checkbox\">\n <input onChange={() => this.handleChangeTerms()} type=\"checkbox\" />\n <span innerHTML={state.options.terms} />\n </label>\n {state.cart\n .filter(i => i.terms_checkout && i.terms_show_checkbox)\n .map(item => (\n <Fragment>\n <label class=\"hemfixarna_checkbox\">\n <input onChange={() => this.handleChangeTerms()} type=\"checkbox\" />\n <span>{item.terms_checkout}</span>\n </label>\n </Fragment>\n ))}\n {this.generalError && <span>{this.generalError}</span>}\n <input type=\"submit\" value=\"Slutför Bokning\" />\n </form>\n </div>\n );\n }\n };\n}\n"]}
@@ -24,6 +24,8 @@ export class HemfixarnaComponent {
24
24
  this.business = undefined;
25
25
  this.topCategory = undefined;
26
26
  this.forceOldTree = false;
27
+ this.loadFromQuery = false;
28
+ this.isDemo = false;
27
29
  }
28
30
  loadCategoryOrProduct(id) {
29
31
  this.proppedProduct = null;
@@ -128,6 +130,13 @@ export class HemfixarnaComponent {
128
130
  this.product = res;
129
131
  }
130
132
  }
133
+ if (this.loadFromQuery) {
134
+ const params = new URL(document.location.toString()).searchParams;
135
+ this.id = params.get('id');
136
+ if (!this.isDemo) {
137
+ this.openModal();
138
+ }
139
+ }
131
140
  state.rotOptions = rot;
132
141
  state.rutOptions = rut;
133
142
  state.options = options;
@@ -169,6 +178,8 @@ export class HemfixarnaComponent {
169
178
  }, 200);
170
179
  }
171
180
  handleClick(e) {
181
+ if (this.loadFromQuery && !this.isDemo)
182
+ return;
172
183
  const el = this.el.shadowRoot.querySelector('.hemfixarna_modal');
173
184
  if (el) {
174
185
  const isClickInside = el.contains(e.composedPath()[0]);
@@ -190,7 +201,7 @@ export class HemfixarnaComponent {
190
201
  render() {
191
202
  var _a, _b, _c;
192
203
  const logo = getAssetPath(`./assets/hemfixarna.svg`);
193
- 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) || ((_b = this.proppedProduct) === null || _b === void 0 ? void 0 : _b.post_title) || (h("span", null, "Montering", h("wbr", null), "/Installation p\u00E5 plats - ", h("strong", null, "se priser h\u00E4r"))), (this.product && ((_c = this.slug) === null || _c === void 0 ? void 0 : _c.includes('product'))) || this.proppedProduct ? (h("span", null, ' från', " ", h("strong", null, getProductPriceWithRotAndRut(this.proppedProduct || 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" }, state.modal.title && h("h2", null, state.modal.title), state.modal.text.map((t) => (h("p", { innerHTML: t }))), h("div", null, h("button", { onClick: () => (state.modal = null) }, "St\u00E4ng")))), (this.tree || state.customer) && h("hemfixarna-breadcrumbs", { closeModal: () => this.closeModal(), tree: this.tree }), !state.customer || this.slugIsOldFormat(this.slug) ? (h("div", { class: `hemfixarna_content hemfixarna_content--${state.step}` }, state.step === 1 && this.tree && h("hemfixarna-start", { tree: this.tree }), state.step === 2 && state.selectedCategory && h("hemfixarna-category", null), state.step === 3 && state.selectedService && h("hemfixarna-service", null), state.step === 4 && state.selectedProduct && h("hemfixarna-product", null), state.step === 5 && h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && h("hemfixarna-order", { tree: this.tree }))) : (h("div", { class: `hemfixarna_content hemfixarna_content--${state.step}` }, state.step < 4 && h("hemfixarna-start", null), state.step === 4 && state.selectedProduct && h("hemfixarna-product", null), state.step === 5 && h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && h("hemfixarna-order", { tree: this.tree })))), h("div", { class: `hemfixarna_backdrop ${this.showModal ? 'hemfixarna_backdrop--open' : ''}` })))));
204
+ return (h("div", { class: "hemfixarna" }, !this.loadFromQuery || this.isDemo ? (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) || ((_b = this.proppedProduct) === null || _b === void 0 ? void 0 : _b.post_title) || (h("span", null, "Montering", h("wbr", null), "/Installation p\u00E5 plats - ", h("strong", null, "se priser h\u00E4r"))), (this.product && ((_c = this.slug) === null || _c === void 0 ? void 0 : _c.includes('product'))) || this.proppedProduct ? (h("span", null, ' från', " ", h("strong", null, getProductPriceWithRotAndRut(this.proppedProduct || 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())))) : null, this.modal && (h("div", null, h("div", { class: `hemfixarna_modal ${this.showModal ? 'hemfixarna_modal--open' : ''}` }, state.modal && (h("div", { class: "hemfixarna_infomodal" }, state.modal.title && h("h2", null, state.modal.title), state.modal.text.map((t) => (h("p", { innerHTML: t }))), h("div", null, h("button", { onClick: () => (state.modal = null) }, "St\u00E4ng")))), (this.tree || state.customer) && h("hemfixarna-breadcrumbs", { loadFromQuery: this.loadFromQuery, closeModal: () => this.closeModal(), tree: this.tree }), !state.customer || this.slugIsOldFormat(this.slug) ? (h("div", { class: `hemfixarna_content hemfixarna_content--${state.step}` }, state.step === 1 && this.tree && h("hemfixarna-start", { tree: this.tree }), state.step === 2 && state.selectedCategory && h("hemfixarna-category", null), state.step === 3 && state.selectedService && h("hemfixarna-service", null), state.step === 4 && state.selectedProduct && h("hemfixarna-product", null), state.step === 5 && h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && h("hemfixarna-order", { tree: this.tree }))) : (h("div", { class: `hemfixarna_content hemfixarna_content--${state.step}` }, state.step < 4 && h("hemfixarna-start", null), state.step === 4 && state.selectedProduct && h("hemfixarna-product", null), state.step === 5 && h("hemfixarna-cart", { tree: this.tree }), state.step === 6 && h("hemfixarna-order", { tree: this.tree })))), h("div", { class: `hemfixarna_backdrop ${this.showModal ? 'hemfixarna_backdrop--open' : ''}` })))));
194
205
  }
195
206
  static get is() { return "hemfixarna-component"; }
196
207
  static get encapsulation() { return "shadow"; }
@@ -302,6 +313,42 @@ export class HemfixarnaComponent {
302
313
  "attribute": "force-old-tree",
303
314
  "reflect": false,
304
315
  "defaultValue": "false"
316
+ },
317
+ "loadFromQuery": {
318
+ "type": "boolean",
319
+ "mutable": false,
320
+ "complexType": {
321
+ "original": "boolean",
322
+ "resolved": "boolean",
323
+ "references": {}
324
+ },
325
+ "required": false,
326
+ "optional": true,
327
+ "docs": {
328
+ "tags": [],
329
+ "text": ""
330
+ },
331
+ "attribute": "load-from-query",
332
+ "reflect": false,
333
+ "defaultValue": "false"
334
+ },
335
+ "isDemo": {
336
+ "type": "boolean",
337
+ "mutable": false,
338
+ "complexType": {
339
+ "original": "boolean",
340
+ "resolved": "boolean",
341
+ "references": {}
342
+ },
343
+ "required": false,
344
+ "optional": true,
345
+ "docs": {
346
+ "tags": [],
347
+ "text": ""
348
+ },
349
+ "attribute": "is-demo",
350
+ "reflect": false,
351
+ "defaultValue": "false"
305
352
  }
306
353
  };
307
354
  }