From 8d7685ef67055d8adbe2e1a98775e9b373d43abc Mon Sep 17 00:00:00 2001 From: Alexandr SaVBaD Waltz Date: Sun, 1 Mar 2026 15:30:47 +0300 Subject: [PATCH] feat(notification): integrate global notification plugin using `ElNotification` Added a global `notify` method via Nuxt plugin to replace `useNotification`. Improved messaging structure by embedding progress bars and handled dynamic durations. Updated usage across composables and components for consistency. - Replaced `useNotification` with `$notify` in all applicable files. - Updated `app.config.ts` to support customizable notification positions. - Refactored affected composables for simplified notification calls. - Enhanced progress indicator display within notifications. Breaking Changes: `useNotification` is removed, requiring migration to the new `$notify` API. --- storefront/app.config.d.ts | 3 +- storefront/app/app.config.ts | 2 +- storefront/app/app.vue | 1 - .../app/components/base/header/index.vue | 4 +- storefront/app/composables/auth/useLogin.ts | 86 +++++++++---------- .../app/composables/auth/useNewPassword.ts | 6 +- .../app/composables/auth/usePasswordReset.ts | 6 +- storefront/app/composables/auth/useRefresh.ts | 10 +-- .../app/composables/auth/useRegister.ts | 6 +- .../composables/config/useProjectConfig.ts | 4 +- .../app/composables/contact/useContactUs.ts | 6 +- .../feedbacks/useFeedbackAction.ts | 8 +- .../notification/useNotification.ts | 76 +++++++++------- .../app/composables/orders/useOrderBuy.ts | 4 +- .../composables/orders/useOrderOverwrite.ts | 29 +++---- .../app/composables/products/useProductBuy.ts | 5 +- .../composables/rules/useFormValidation.ts | 8 +- .../app/composables/search/useSearch.ts | 4 +- .../app/composables/user/useAvatarUpload.ts | 6 +- storefront/app/composables/user/useDeposit.ts | 4 +- .../app/composables/user/useUserActivation.ts | 6 +- .../app/composables/user/useUserBaseData.ts | 58 +++++++------ .../app/composables/user/useUserUpdating.ts | 11 ++- .../wishlist/useWishlistOverwrite.ts | 23 +++-- .../composables/wishlist/useWishlistSync.ts | 7 +- storefront/app/pages/index.vue | 4 +- storefront/app/pages/profile/promocodes.vue | 4 +- storefront/app/pages/profile/settings.vue | 5 +- storefront/app/plugins/03.notification.ts | 52 +++++++++++ storefront/nuxt-app.d.ts | 2 + storefront/tsconfig.json | 6 +- 31 files changed, 257 insertions(+), 199 deletions(-) create mode 100644 storefront/app/plugins/03.notification.ts diff --git a/storefront/app.config.d.ts b/storefront/app.config.d.ts index 3b7fc2c4..2b49b607 100644 --- a/storefront/app.config.d.ts +++ b/storefront/app.config.d.ts @@ -6,14 +6,13 @@ declare module 'nuxt/schema' { file: string; default: boolean; }>; - defaultLocale: string; }; ui: { showBreadcrumbs: boolean; showSearchBar: boolean; isHeaderFixed: boolean; isAuthModals: boolean; - toastPosition: string; + notificationPosition: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'; }; } } diff --git a/storefront/app/app.config.ts b/storefront/app/app.config.ts index 978f1b57..8243a15d 100644 --- a/storefront/app/app.config.ts +++ b/storefront/app/app.config.ts @@ -9,6 +9,6 @@ export default defineAppConfig({ showSearchBar: true, isHeaderFixed: true, isAuthModals: false, - toastPosition: 'top-right', + notificationPosition: 'top-right', }, }); diff --git a/storefront/app/app.vue b/storefront/app/app.vue index 45aad876..72b3ee50 100644 --- a/storefront/app/app.vue +++ b/storefront/app/app.vue @@ -51,7 +51,6 @@ const appStore = useAppStore(); const { $appHelpers } = useNuxtApp(); const { isDemoMode, uiConfig } = useProjectConfig(); -const toaster = { position: uiConfig.value.toastPosition }; const switchLocalePath = useSwitchLocalePath(); const showBreadcrumbs = computed(() => { diff --git a/storefront/app/components/base/header/index.vue b/storefront/app/components/base/header/index.vue index 3a8d24c9..ac7ffc57 100644 --- a/storefront/app/components/base/header/index.vue +++ b/storefront/app/components/base/header/index.vue @@ -99,10 +99,9 @@ -