Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: notify on unsaved address #762

Merged
merged 7 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/web/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@
"saveAddress": "Adresse speichern",
"savedBillingAddress": "Gespeicherte Rechnungsadressen",
"savedShippingAddress": "Gespeicherte Lieferadressen",
"unsavedAddress": "Die eingegebene Adresse wurde noch nicht gespeichert.",
"scrollTop": "Nach oben scrollen",
"search": "Suche",
"shipping": {
Expand Down
1 change: 1 addition & 0 deletions apps/web/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@
"saveAddress": "Save address",
"savedBillingAddress": "Saved billing adresses",
"savedShippingAddress": "Saved shipping adresses",
"unsavedAddress": "The address you entered has not yet been saved. Click Save address to proceed with the checkout.",
"scrollTop": "Scroll to top",
"search": "Search",
"shipping": {
Expand Down
18 changes: 12 additions & 6 deletions apps/web/pages/checkout.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<NuxtLayout
name="checkout"
:back-label-desktop="$t('backToCart')"
:back-label-mobile="$t('back')"
:heading="$t('checkout')"
:back-label-desktop="t('backToCart')"
:back-label-mobile="t('back')"
:heading="t('checkout')"
>
<div v-if="cart" class="lg:grid lg:grid-cols-12 lg:gap-x-6">
<div class="col-span-6 xl:col-span-7 mb-10 lg:mb-0">
Expand Down Expand Up @@ -64,7 +64,7 @@
size="lg"
class="w-full mb-4 md:mb-0 cursor-pointer"
>
{{ $t('buy') }}
{{ t('buy') }}
</UiButton>
<UiButton
v-else
Expand All @@ -76,7 +76,7 @@
class="w-full mb-4 md:mb-0 cursor-pointer"
>
<SfLoaderCircular v-if="createOrderLoading" class="flex justify-center items-center" size="sm" />
<template v-else>{{ $t('buy') }}</template>
<template v-else>{{ t('buy') }}</template>
</UiButton>
<!-- <PayPalApplePayButton
v-if="applePayAvailable"
Expand Down Expand Up @@ -112,6 +112,8 @@ definePageMeta({
pageType: 'static',
});

const { send } = useNotification();
const { t } = useI18n();
const localePath = useLocalePath();
const { loading: createOrderLoading, createOrder } = useMakeOrder();
const { shippingPrivacyAgreement } = useAdditionalInformation();
Expand Down Expand Up @@ -177,7 +179,11 @@ const paypalCreditCardPaymentId = computed(() => {
// const applePayAvailable = computed(() => import.meta.client && (window as any).ApplePaySession);

const readyToBuy = () => {
if (anyAddressFormIsOpen.value) return backToFormEditing();
if (anyAddressFormIsOpen.value) {
send({ type: 'secondary', message: t('unsavedAddress') });
return backToFormEditing();
}

return !(!validateTerms() || !hasShippingAddress.value || !hasBillingAddress.value);
};

Expand Down
1 change: 1 addition & 0 deletions docs/changelog/changelog_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

### New

- Clicking "Buy" with an unsaved Address will now display a notification.
- When an EU country is selected as the shipping country, all EU countries become available as billing options.
- Added a new request header for configId and added no cache to environment variables.
- Implement new notification design
Expand Down
Loading