From 383e457aab9227ed4bbf356b9eeadb145cc72a03 Mon Sep 17 00:00:00 2001 From: Jade Date: Mon, 11 Aug 2025 13:14:27 +0200 Subject: [PATCH 01/10] Listen to all changes on address data instead of only manual input --- resources/js/components/GraphqlMutation.vue | 11 +++++++++++ .../views/checkout/steps/billing_address.blade.php | 11 ++++++----- .../views/checkout/steps/shipping_address.blade.php | 9 +++++++-- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/resources/js/components/GraphqlMutation.vue b/resources/js/components/GraphqlMutation.vue index 34b694653..bc6db1676 100644 --- a/resources/js/components/GraphqlMutation.vue +++ b/resources/js/components/GraphqlMutation.vue @@ -110,6 +110,13 @@ export default { deepMerge(this.data, diff) } }, + + data: { + handler() { + this.changeFn(this) + }, + deep: true + }, }, mounted() { @@ -123,6 +130,10 @@ export default { }, methods: { + changeFn: useDebounceFn((self) => { + self.$emit('change', { target: self.$el, mutate: self.mutate }) + }, 500), + async mutateFn() { if (this.running) { return diff --git a/resources/views/checkout/steps/billing_address.blade.php b/resources/views/checkout/steps/billing_address.blade.php index d24165a36..0d51da001 100644 --- a/resources/views/checkout/steps/billing_address.blade.php +++ b/resources/views/checkout/steps/billing_address.blade.php @@ -13,14 +13,15 @@ :error-callback="checkResponseForExpiredCart" group="billing" mutate-event="setBillingAddressOnCart" + v-on:change="function (e) { + e.target.closest('fieldset').querySelector(':invalid') === null + && (!variables.same_as_shipping || !!cart?.shipping_addresses?.[0]?.postcode) + && window.app.$emit('setBillingAddressOnCart') + }" v-slot="{ mutate, variables }" >
-
+