Skip to content

Commit

Permalink
Clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
jcalcaben committed Nov 12, 2024
1 parent efd421a commit e786a76
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
6 changes: 2 additions & 4 deletions blocks/commerce-checkout/amasty-order-attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class AmastyOrderAttributes extends HTMLElement {
}

set orderAttributes(value) {
console.log("orderAttributes", value);
this._orderAttributes = value;

if(!value) return;
Expand All @@ -77,7 +76,7 @@ class AmastyOrderAttributes extends HTMLElement {
(attribute) => attribute.attribute_code === "ddate"
);

if (deliveryDate) {
if (deliveryDate && deliveryDate.value) {
deliveryDateInput.setAttribute("value", convertToDatetimeLocal(deliveryDate.value));
}
}
Expand All @@ -93,7 +92,7 @@ class AmastyOrderAttributes extends HTMLElement {
(attribute) => attribute.attribute_code === "ddate"
);

deliveryDate && deliveryDateInput.setAttribute("value", convertToDatetimeLocal(deliveryDate.value));
deliveryDate && deliveryDate.value && deliveryDateInput.setAttribute("value", convertToDatetimeLocal(deliveryDate.value));

deliveryDateInput.addEventListener("change", (event) => {
deliveryDateInput.setAttribute('disabled', '');
Expand All @@ -108,7 +107,6 @@ class AmastyOrderAttributes extends HTMLElement {
}

render() {
console.log("Rendering AmastyOrderAttributes", this._orderAttributes);
const sdkStyleElement = sdkStyle.cloneNode(true);
const checkoutStyleElement = checkoutStyle.cloneNode(true);
const style = document.createElement("style");
Expand Down
2 changes: 1 addition & 1 deletion blocks/commerce-checkout/gift-options-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class GiftOptionsField extends HTMLElement {
this._formTemplate = document.createElement('template');

this._formTemplate.innerHTML = `
<h2 class="checkout-payment-methods__title">Gift Options</h2>
<h2 class="checkout-payment-methods__title">Gift Message</h2>
<form id="gift-options-form" class="checkout-fields-form__form">
<div class="fromName-wrapper"></div>
<div class="toName-wrapper"></div>
Expand Down
32 changes: 19 additions & 13 deletions scripts/__dropins__/storefront-cart/fragments.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const e=`
const e = `
fragment PRICE_RANGE_FRAGMENT on PriceRange {
minimum_price {
regular_price {
Expand Down Expand Up @@ -29,7 +29,7 @@ const e=`
}
}
}
`,t=`
`, t = `
fragment CUSTOMIZABLE_OPTIONS_FRAGMENT on SelectedCustomizableOption {
type
customizable_option_uid
Expand All @@ -45,7 +45,7 @@ const e=`
}
}
}
`,a=`
`, a = `
fragment CART_ITEM_FRAGMENT on CartItemInterface {
__typename
uid
Expand Down Expand Up @@ -196,8 +196,7 @@ fragment CART_ITEM_FRAGMENT on CartItemInterface {
${e}
${t}
`,r=`
fragment CART_FRAGMENT on Cart {
`, r = (`fragment CART_FRAGMENT on Cart {
id
total_quantity
is_virtual
Expand Down Expand Up @@ -244,11 +243,7 @@ fragment CART_FRAGMENT on Cart {
applied_coupons {
code
}
itemsV2 (
pageSize:$pageSize,
currentPage:$currentPage,
sort: $itemsSortInput
) {
itemsV2(pageSize: $pageSize, currentPage: $currentPage, sort: $itemsSortInput) {
items {
...CART_ITEM_FRAGMENT
}
Expand All @@ -262,7 +257,18 @@ fragment CART_FRAGMENT on Cart {
}
postcode
}
gift_message {
from
to
message
}
amorder_attributes {
attribute_code
value
}
}
${a}
`;export{r as CART_FRAGMENT,a as CART_ITEM_FRAGMENT};
${a}`);
export {
r as CART_FRAGMENT,
a as CART_ITEM_FRAGMENT
};

0 comments on commit e786a76

Please sign in to comment.