hemfixarna-web-components 1.8.13 → 1.8.15

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.
@@ -91,7 +91,7 @@ const getRutPrice = (price) => {
91
91
  return Math.ceil(price / 2);
92
92
  };
93
93
  const getRotPrice = (price) => {
94
- return Math.ceil(price / 2);
94
+ return Math.ceil(price * 0.7);
95
95
  };
96
96
  const getGreenPrice = (price) => {
97
97
  return Math.ceil(price * 0.5);
@@ -506,7 +506,11 @@ const HemfixarnaCheckout = class {
506
506
  this.dateError = null;
507
507
  this.date = e.target.value;
508
508
  };
509
- this.handleChangeTerms = () => {
509
+ this.handleChangeTerms = (e) => {
510
+ this.generalError = null;
511
+ this.termsChecked = e.target.checked;
512
+ };
513
+ this.handleChangeItemTerms = () => {
510
514
  this.generalError = null;
511
515
  };
512
516
  this.sendOrder = async () => {
@@ -568,6 +572,7 @@ const HemfixarnaCheckout = class {
568
572
  id_sub_source: this.selectedSubSource ? this.selectedSubSource : '',
569
573
  seller_id: (_a = this.sellerID) !== null && _a !== void 0 ? _a : '',
570
574
  referral_id: (_b = this.RefferalID) !== null && _b !== void 0 ? _b : '',
575
+ marketing_approval: this.termsChecked ? 1 : 0,
571
576
  };
572
577
  const felixOrder = await postPerson(order);
573
578
  if (!felixOrder || !((_d = (_c = felixOrder.response) === null || _c === void 0 ? void 0 : _c.scriptResult) === null || _d === void 0 ? void 0 : _d.includes('OK'))) {
@@ -600,11 +605,6 @@ const HemfixarnaCheckout = class {
600
605
  if (!validDate) {
601
606
  this.dateError = 'Ange ett giltigt datum';
602
607
  }
603
- const checkBoxes = Array.from(this.el.querySelectorAll('input[type="checkbox"]'));
604
- const notValidTerms = checkBoxes.find(i => !i.checked);
605
- if (notValidTerms) {
606
- this.generalError = 'Du måste godkänna villkoren';
607
- }
608
608
  if (index$1.state.customer.source && index$1.state.selectSource) {
609
609
  if (!this.sellerID) {
610
610
  this.generalError = 'Ange säljare';
@@ -615,7 +615,7 @@ const HemfixarnaCheckout = class {
615
615
  return;
616
616
  }
617
617
  }
618
- if (validDate && !notValidTerms) {
618
+ if (validDate) {
619
619
  this.sendOrder();
620
620
  }
621
621
  };
@@ -631,9 +631,9 @@ const HemfixarnaCheckout = class {
631
631
  return index.h("hemfixarna-getuser", null);
632
632
  }
633
633
  else if (index$1.state.checkoutStep === 2) {
634
- return (index.h("div", { class: "mb-2" }, index.h("div", { class: "hemfixarna_addressinfo" }, index.h("div", null, index.h("p", null, hideField(index$1.state.user.firstName)), index.h("p", null, hideField(index$1.state.user.lastName)), index.h("p", null, index$1.state.user.email), index.h("p", null, index$1.state.user.phone)), index.h("div", null, index.h("p", null, hideField(index$1.state.user.street)), index.h("p", null, hideField(index$1.state.user.zip)), index.h("p", null, hideField(index$1.state.user.town))), index.h("button", { onClick: () => (index$1.state.checkoutEdit = true) }, "Beh\u00F6ver du \u00E4ndra adressen?")), index.h("form", { onSubmit: e => this.handleSubmit(e) }, index.h("div", null, index.h("img", { src: dateLogo, width: 24 }), index.h("input", { class: `${this.date.length ? 'input_active' : ''}`, min: new Date().toISOString().split('T')[0], onChange: e => this.handleChangeDate(e), type: "date", name: "date", value: this.date }), index.h("label", { htmlFor: "date" }, "Tidigaste datum f\u00F6r hembes\u00F6k"), index.h("img", { src: down, width: 24 })), this.dateError && index.h("span", null, this.dateError), index$1.state.customer.source && index$1.state.selectSource ? (index.h(index.Fragment, null, index.h("p", null, "Inloggad som:", index.h("strong", null, " ", index$1.state.customer.source.fieldData.So01_Name)), index.h("label", null, "S\u00E4ljare (S\u00E4ljarId)", index.h("input", { type: "text", value: this.sellerID, onChange: e => (this.sellerID = e.target.value) })), index.h("label", null, "PartnerOrderID (RefferalID)", index.h("input", { type: "text", value: this.RefferalID, onChange: e => (this.RefferalID = e.target.value) })), ((_a = index$1.state.customer.source.sub_sources) === null || _a === void 0 ? void 0 : _a.length) ? (index.h("div", null, index.h("select", { onChange: e => (this.selectedSubSource = e.target.value) }, index.h("option", { disabled: true, selected: true, value: "null" }, "V\u00E4lj underk\u00E4lla"), index$1.state.customer.source.sub_sources.map(sub => (index.h("option", { value: sub['So_SubSource::Sus01_Name'] }, sub['So_SubSource::Sus01_Name'])))))) : (index.h("p", null, "Det finns inga underk\u00E4llor att v\u00E4lja")))) : null, index.h("label", { class: "hemfixarna_checkbox" }, index.h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), index.h("span", { innerHTML: index$1.state.options.terms })), index$1.state.cart
634
+ return (index.h("div", { class: "mb-2" }, index.h("div", { class: "hemfixarna_addressinfo" }, index.h("div", null, index.h("p", null, hideField(index$1.state.user.firstName)), index.h("p", null, hideField(index$1.state.user.lastName)), index.h("p", null, index$1.state.user.email), index.h("p", null, index$1.state.user.phone)), index.h("div", null, index.h("p", null, hideField(index$1.state.user.street)), index.h("p", null, hideField(index$1.state.user.zip)), index.h("p", null, hideField(index$1.state.user.town))), index.h("button", { onClick: () => (index$1.state.checkoutEdit = true) }, "Beh\u00F6ver du \u00E4ndra adressen?")), index.h("form", { onSubmit: e => this.handleSubmit(e) }, index.h("div", null, index.h("img", { src: dateLogo, width: 24 }), index.h("input", { class: `${this.date.length ? 'input_active' : ''}`, min: new Date().toISOString().split('T')[0], onChange: e => this.handleChangeDate(e), type: "date", name: "date", value: this.date }), index.h("label", { htmlFor: "date" }, "Tidigaste datum f\u00F6r hembes\u00F6k"), index.h("img", { src: down, width: 24 })), this.dateError && index.h("span", null, this.dateError), index$1.state.customer.source && index$1.state.selectSource ? (index.h(index.Fragment, null, index.h("p", null, "Inloggad som:", index.h("strong", null, " ", index$1.state.customer.source.fieldData.So01_Name)), index.h("label", null, "S\u00E4ljare (S\u00E4ljarId)", index.h("input", { type: "text", value: this.sellerID, onChange: e => (this.sellerID = e.target.value) })), index.h("label", null, "PartnerOrderID (RefferalID)", index.h("input", { type: "text", value: this.RefferalID, onChange: e => (this.RefferalID = e.target.value) })), ((_a = index$1.state.customer.source.sub_sources) === null || _a === void 0 ? void 0 : _a.length) ? (index.h("div", null, index.h("select", { onChange: e => (this.selectedSubSource = e.target.value) }, index.h("option", { disabled: true, selected: true, value: "null" }, "V\u00E4lj underk\u00E4lla"), index$1.state.customer.source.sub_sources.map(sub => (index.h("option", { value: sub['So_SubSource::Sus01_Name'] }, sub['So_SubSource::Sus01_Name'])))))) : (index.h("p", null, "Det finns inga underk\u00E4llor att v\u00E4lja")))) : null, index.h("label", { class: "hemfixarna_checkbox" }, index.h("input", { onChange: e => this.handleChangeTerms(e), type: "checkbox" }), index.h("span", { innerHTML: index$1.state.options.terms })), index$1.state.cart
635
635
  .filter(i => { var _a; return (_a = i.terms_checkout) === null || _a === void 0 ? void 0 : _a.length; })
636
- .map(item => (index.h(index.Fragment, null, index.h("label", { class: "hemfixarna_checkbox" }, index.h("input", { onChange: () => this.handleChangeTerms(), type: "checkbox" }), index.h("span", null, item.terms_checkout))))), this.generalError && index.h("span", null, this.generalError), index.h("div", { class: this.loading ? 'loading' : '' }, index.h("input", { type: "submit", value: this.loading ? '' : 'Skicka bokning' }), index.h("img", { width: 20, height: 20, src: loading, alt: "spinner" })))));
636
+ .map(item => (index.h(index.Fragment, null, index.h("label", { class: "hemfixarna_checkbox" }, index.h("input", { onChange: () => this.handleChangeItemTerms(), type: "checkbox" }), index.h("span", null, item.terms_checkout))))), this.generalError && index.h("span", null, this.generalError), index.h("div", { class: this.loading ? 'loading' : '' }, index.h("input", { type: "submit", value: this.loading ? '' : 'Skicka bokning' }), index.h("img", { width: 20, height: 20, src: loading, alt: "spinner" })))));
637
637
  }
638
638
  };
639
639
  this.date = '';
@@ -645,6 +645,7 @@ const HemfixarnaCheckout = class {
645
645
  this.partnerOrderId = null;
646
646
  this.sellerID = null;
647
647
  this.RefferalID = null;
648
+ this.termsChecked = false;
648
649
  }
649
650
  componentWillLoad() {
650
651
  if (Boolean(index$1.state.user && index$1.state.user.street)) {