diff --git a/src/entities/payment/model/types.ts b/src/entities/payment/model/types.ts index a24a122..48ce61f 100644 --- a/src/entities/payment/model/types.ts +++ b/src/entities/payment/model/types.ts @@ -16,12 +16,10 @@ export enum NotifyRowKeys { MobilePayment = 'MobilePayment', EscrowPayment = 'EscrowPayment', }; -export interface PaymentCommonParams { + +export interface PaymentNotificationDataParams { mid: string; }; -export interface PaymentNotificationDataParams extends PaymentCommonParams { - gid: string; -}; export interface PaymentNotificationDataResponse { merchantInfo: MerchantInfo; creditCard: CreditCard; @@ -46,7 +44,7 @@ export interface PaymentNotificationDataCommonType { encryptionStatus: string; expandable: boolean; detail: Record; -} +}; export interface CreditCard extends PaymentNotificationDataCommonType {}; export interface AccountTransfer extends PaymentNotificationDataCommonType {}; @@ -54,7 +52,8 @@ export interface VirtualAccount extends PaymentNotificationDataCommonType {}; export interface MobilePayment extends PaymentNotificationDataCommonType {}; export interface EscrowPayment extends PaymentNotificationDataCommonType {}; -export interface PaymentNonCardParams extends PaymentCommonParams { +export interface PaymentNonCardParams { + mid: string; paymentMethod: string; }; export interface PaymentNonCardResponse { @@ -96,7 +95,8 @@ export interface CategoryFees { export interface OtherPaymentData { feeRate: number; }; -export interface PaymentInstallmentParams extends PaymentCommonParams { +export interface PaymentInstallmentParams { + mid: string; paymentMethod: string; }; export interface PaymentInstallmentResponse { @@ -113,7 +113,8 @@ export interface InstallmentDetails { applicationPeriod: string; applicationAmount: number; }; -export interface PaymentInstallmentDetailParams extends PaymentCommonParams { +export interface PaymentInstallmentDetailParams { + mid: string; cardCompany: string; }; export interface PaymentInstallmentDetailResponse { @@ -121,7 +122,8 @@ export interface PaymentInstallmentDetailResponse { cardCompanyOptions: Array; installmentDetails: Array; }; -export interface PaymentCardParams extends PaymentCommonParams{ +export interface PaymentCardParams { + mid: string; paymentMethod: string; }; export interface PaymentCardResponse { diff --git a/src/entities/payment/ui/notification-data-wrap.tsx b/src/entities/payment/ui/notification-data-wrap.tsx index deb2ceb..c049c53 100644 --- a/src/entities/payment/ui/notification-data-wrap.tsx +++ b/src/entities/payment/ui/notification-data-wrap.tsx @@ -1,6 +1,6 @@ import { ChangeEvent, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { NotifyRowKeys } from '../model/types'; +import { NotifyRowKeys, PaymentNotificationDataParams, PaymentNotificationDataResponse } from '../model/types'; import { usePaymentNotificationDataMutation } from '../api/use-payment-notification-data-mutation'; import { useStore } from '@/shared/model/store'; import { NotifyRow } from './section/notify-row'; @@ -26,13 +26,11 @@ export const NotificationDataWrap = () => { const { mutateAsync: paymentNotificationData } = usePaymentNotificationDataMutation(); const callPaymentNotificationData = () => { - let params = { - mid: mid, - gid: mid + let params: PaymentNotificationDataParams = { + mid: mid }; - paymentNotificationData(params).then((rs) => { - console.log(rs); + paymentNotificationData(params).then((rs: PaymentNotificationDataResponse) => { setMerchantInfo(rs?.merchantInfo); setCreditCard(rs?.creditCard.detail); setAccountTransfer(rs?.accountTransfer.detail); diff --git a/src/shared/lib/hooks/index.tsx b/src/shared/lib/hooks/index.tsx index f07b18d..bca3b46 100644 --- a/src/shared/lib/hooks/index.tsx +++ b/src/shared/lib/hooks/index.tsx @@ -1,5 +1,4 @@ export * from './use-navigate'; -export * from './use-change-bg-color'; export * from './use-device-uid'; export * from './use-fix-scroll-view-safari'; export * from './use-has-bio-hardware'; @@ -7,5 +6,4 @@ export * from './use-navigate'; export * from './use-location-permission'; export * from './use-window-focus-change'; export * from './use-router-listener'; -export * from './use-scroll-to-top'; diff --git a/src/shared/lib/hooks/use-change-bg-color.ts b/src/shared/lib/hooks/use-change-bg-color.ts deleted file mode 100644 index 0e56eca..0000000 --- a/src/shared/lib/hooks/use-change-bg-color.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* eslint-disable react-hooks/exhaustive-deps */ -import { useLayoutEffect } from 'react'; - -import useLocalStorageState from 'use-local-storage-state'; -import { DEFAULT_BACKGROUND_COLOR } from '@/shared/constants/colors'; -import { StorageKeys } from '@/shared/constants/local-storage'; -import { NativeFunction } from '@/shared/constants/native-function'; -import { useRouterListener } from './use-router-listener'; - -export const useChangeBgColor = (color: string) => { - const [, setAppColor] = useAppColor(); - - useLayoutEffect(() => { - setAppColor(color); - window.webViewBridge.send(NativeFunction.SetAppColor, color); - document.body.style.backgroundColor = color; - }, []); -}; - -export const useResetBgColor = () => { - const [, setAppColor] = useAppColor(); - const defaultColor = DEFAULT_BACKGROUND_COLOR; - - useLayoutEffect(() => { - setAppColor(defaultColor); - window.webViewBridge.send(NativeFunction.SetAppColor, defaultColor); - document.body.style.backgroundColor = defaultColor; - }, []); -}; - -export const useResetBgColorOnLeave = () => { - const [, setAppColor] = useAppColor(); - const defaultColor = DEFAULT_BACKGROUND_COLOR; - - useRouterListener(() => { - setAppColor(defaultColor); - document.body.style.backgroundColor = defaultColor; - window.webViewBridge.send(NativeFunction.SetAppColor, defaultColor); - }); -}; - -export const useAppColor = () => { - return useLocalStorageState(StorageKeys.AppColor, { defaultValue: DEFAULT_BACKGROUND_COLOR }); -}; diff --git a/src/shared/lib/hooks/use-fixed-button-position.ts b/src/shared/lib/hooks/use-fixed-button-position.ts deleted file mode 100644 index 64edc48..0000000 --- a/src/shared/lib/hooks/use-fixed-button-position.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { CSSProperties, useEffect, useState } from 'react'; - -export const useFixedButtonPosition = () => { - const [buttonStyle, setButtonStyle] = useState(); - - const updateButtonPosition = () => { - const viewport = window.visualViewport; - const viewportHeight = viewport?.height; - const viewportOffsetTop = viewport?.offsetTop ?? 0; - - if (viewportHeight && viewportHeight < window.innerHeight) { - setButtonStyle({ bottom: `${window.innerHeight - viewportHeight - viewportOffsetTop + 15}px` }); - } else { - setButtonStyle(undefined); - } - }; - - useEffect(() => { - const handleResize = () => { - updateButtonPosition(); - }; - - visualViewport?.addEventListener('resize', handleResize); - window.addEventListener('resize', handleResize); // fallback for window resize - - return () => { - visualViewport?.removeEventListener('resize', handleResize); - window.removeEventListener('resize', handleResize); - }; - }, []); - - useEffect(() => { - const handleScroll = () => { - updateButtonPosition(); - }; - - window.addEventListener('scroll', handleScroll); - - return () => { - window.removeEventListener('scroll', handleScroll); - }; - }, []); - - return buttonStyle; -}; diff --git a/src/shared/lib/hooks/use-scroll-to-top.ts b/src/shared/lib/hooks/use-scroll-to-top.ts deleted file mode 100644 index 4756d03..0000000 --- a/src/shared/lib/hooks/use-scroll-to-top.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { useEffect } from 'react'; - -export const useScrollToTop = () => { - useEffect(() => { - document.body.scrollTop = 0; - }, []); -}; diff --git a/src/widgets/sub-layout/index.tsx b/src/widgets/sub-layout/index.tsx index 098a329..79205a1 100644 --- a/src/widgets/sub-layout/index.tsx +++ b/src/widgets/sub-layout/index.tsx @@ -10,7 +10,6 @@ import { HeaderNavigation } from '@/widgets/navigation/header'; import { FooterNavigation } from '@/widgets/navigation/footer'; import { PullToRefresh } from '@/widgets/pull-to-refresh/pull-to-refresh'; import { useNavigate } from '@/shared/lib/hooks'; -import { useScrollToTop } from '@/shared/lib/hooks/use-scroll-to-top'; import { CodeListItem, CodesSelectParams, @@ -59,7 +58,6 @@ export interface OnSetCommonCodesProps { }; export const SubLayout = () => { - useScrollToTop(); const { callLogin, updateUserData