첫 커밋
This commit is contained in:
14
src/shared/@types/.env.d.ts
vendored
Normal file
14
src/shared/@types/.env.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/// <reference types="vite/client" />
|
||||
interface ImportMetaEnv {
|
||||
readonly DEV: boolean;
|
||||
readonly VITE_APP_NAME: string;
|
||||
readonly VITE_APP_VERSION: string;
|
||||
readonly VITE_APP_ENV: string;
|
||||
readonly VITE_APP_AUTH_PROXY_HOST: string;
|
||||
readonly VITE_APP_API_PROXY_HOST: string;
|
||||
readonly VITE_APP_WEB_VERSION: string;
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv;
|
||||
}
|
||||
33
src/shared/@types/banking-code.ts
Normal file
33
src/shared/@types/banking-code.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/* eslint-disable @cspell/spellchecker */
|
||||
/**
|
||||
* 은행에서 사용하는 코드 모음
|
||||
*/
|
||||
|
||||
export type YN = 'Y' | 'N';
|
||||
|
||||
/**
|
||||
* 은행코드
|
||||
*/
|
||||
export const enum BankCode {
|
||||
A = '011',
|
||||
B = '004',
|
||||
}
|
||||
|
||||
/**
|
||||
* 은행이름
|
||||
*/
|
||||
export const enum BankName {
|
||||
A = 'A은행',
|
||||
B = 'B은행',
|
||||
}
|
||||
|
||||
export const enum BankValue {
|
||||
A = 'NHB',
|
||||
B = 'KBB',
|
||||
}
|
||||
|
||||
/**
|
||||
* 은행코드로 어떤 은행인지 확인
|
||||
*/
|
||||
export const isBankA = (bkcd: BankCode) => bkcd === BankCode.A;
|
||||
export const isBankB = (bkcd: BankCode) => bkcd === BankCode.B;
|
||||
14
src/shared/@types/error.ts
Normal file
14
src/shared/@types/error.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { AxiosError } from 'axios';
|
||||
|
||||
export type CBDCAxiosError = AxiosError<{
|
||||
errorCode?: string;
|
||||
code?: string;
|
||||
message?: string;
|
||||
data?: any;
|
||||
status?: string;
|
||||
}>;
|
||||
|
||||
export interface CBDCAxiosFallbackProps {
|
||||
error: CBDCAxiosError;
|
||||
resetErrorBoundary?: (...args: unknown[]) => void;
|
||||
}
|
||||
45
src/shared/@types/global.d.ts
vendored
Normal file
45
src/shared/@types/global.d.ts
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import type { DefaultEvents, EventEmitter } from '@webview-bridge/web';
|
||||
|
||||
export {};
|
||||
|
||||
declare module '*.svg' {
|
||||
import React = require('react');
|
||||
|
||||
export const ReactComponent: React.SFC<React.SVGProps<SVGSVGElement>>;
|
||||
const src: string;
|
||||
export default src;
|
||||
}
|
||||
|
||||
declare module '*.png';
|
||||
|
||||
declare module '*.scss' {
|
||||
const content: Record<string, string>;
|
||||
export = content;
|
||||
}
|
||||
|
||||
declare module '*.css' {
|
||||
const css: string;
|
||||
export default css;
|
||||
}
|
||||
|
||||
declare module 'lodash-es';
|
||||
|
||||
declare module '*.lottie';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
store: StoreApi<RootStore>;
|
||||
webViewBridge: {
|
||||
send<T = any, R = Promise<T>>(url: string, data?: any): Promise<R>;
|
||||
};
|
||||
__bridgeMethods__?: string[];
|
||||
|
||||
__bridgeInitialState__?: Record<string, any>;
|
||||
nativeEmitter?: EventEmitter<DefaultEvents>;
|
||||
nativeBatchedEvents?: [string, ...any][];
|
||||
webEmitter?: EventEmitter<DefaultEvents>;
|
||||
ReactNativeWebView: {
|
||||
postMessage: (data: string) => void;
|
||||
};
|
||||
}
|
||||
}
|
||||
9
src/shared/@types/qrcode.ts
Normal file
9
src/shared/@types/qrcode.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/* eslint-disable @cspell/spellchecker */
|
||||
export interface MyWalletQRCode {
|
||||
walletAddr: string;
|
||||
bankCode: string;
|
||||
}
|
||||
|
||||
export interface MyPaymentQRcode extends MyWalletQRCode {
|
||||
exptime: string; // 'YYYY-MM-DD H:m:s';
|
||||
}
|
||||
31
src/shared/@types/query.ts
Normal file
31
src/shared/@types/query.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { QueryKey, UseInfiniteQueryOptions, UseMutationOptions, UseQueryOptions } from '@tanstack/react-query';
|
||||
import { CBDCAxiosError } from '@/shared/@types/error';
|
||||
|
||||
export type QueryOptions<
|
||||
TQueryFnData = unknown,
|
||||
TError = CBDCAxiosError,
|
||||
TData = TQueryFnData,
|
||||
TQueryKey extends QueryKey = QueryKey,
|
||||
> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryKey' | 'queryFn' | 'initialData'>;
|
||||
|
||||
export type MutationOptions<TVariables = unknown, TError = CBDCAxiosError, TData = void, TContext = unknown> = Omit<
|
||||
UseMutationOptions<TData, TError, TVariables, TContext>,
|
||||
'mutationKey' | 'mutationFn'
|
||||
>;
|
||||
|
||||
export type InfiniteQueryOptions<
|
||||
TQueryFnData = unknown,
|
||||
TError = CBDCAxiosError,
|
||||
TData = TQueryFnData,
|
||||
TQueryKey extends QueryKey = QueryKey,
|
||||
TPageParam = unknown,
|
||||
> = Omit<
|
||||
UseInfiniteQueryOptions<
|
||||
TQueryFnData,
|
||||
TError,
|
||||
TData,
|
||||
TQueryKey,
|
||||
TPageParam
|
||||
>,
|
||||
'queryKey' | 'queryFn' | 'initialData' | 'getNextPageParam' | 'initialPageParam'
|
||||
>;
|
||||
18
src/shared/@types/webview-bridge.ts
Normal file
18
src/shared/@types/webview-bridge.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
export interface WebViewBridgeResponse {
|
||||
targetFunc: string;
|
||||
data: any;
|
||||
msgId: string;
|
||||
isSuccessful: boolean;
|
||||
}
|
||||
|
||||
export const PERMISSION_RESULTS = Object.freeze({
|
||||
UNAVAILABLE: 'unavailable', // This feature is not available (on this device / in this context)
|
||||
BLOCKED: 'blocked', // The permission has not been requested / is denied but requestable
|
||||
DENIED: 'denied', // The permission is limited: some actions are possible
|
||||
GRANTED: 'granted', // The permission is granted
|
||||
LIMITED: 'limited', // The permission is denied and not requestable anymore
|
||||
} as const);
|
||||
|
||||
export type PermissionResultMap = typeof PERMISSION_RESULTS;
|
||||
|
||||
export type PermissionResultValues = PermissionResultMap[keyof PermissionResultMap];
|
||||
Reference in New Issue
Block a user