Skip to content

Commit 28fd463

Browse files
crowrishclaude
andcommitted
Apply code formatting with Prettier
- Format all TypeScript and configuration files - Improve code consistency and readability - Fix indentation and line spacing - Ensure consistent import ordering - All files now follow project style guidelines 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 31344c8 commit 28fd463

8 files changed

Lines changed: 147 additions & 47 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Deploy to GitHub Pages
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
workflow_dispatch:
77

88
permissions:
@@ -11,7 +11,7 @@ permissions:
1111
id-token: write
1212

1313
concurrency:
14-
group: "pages"
14+
group: 'pages'
1515
cancel-in-progress: false
1616

1717
jobs:
@@ -20,24 +20,24 @@ jobs:
2020
steps:
2121
- name: Checkout
2222
uses: actions/checkout@v4
23-
23+
2424
- name: Setup Node.js
2525
uses: actions/setup-node@v4
2626
with:
2727
node-version: '18'
2828
cache: 'npm'
29-
29+
3030
- name: Install dependencies
3131
run: npm ci
32-
32+
3333
- name: Setup Pages
3434
uses: actions/configure-pages@v4
3535
with:
3636
static_site_generator: next
37-
37+
3838
- name: Build with Next.js
3939
run: npm run build
40-
40+
4141
- name: Upload artifact
4242
uses: actions/upload-pages-artifact@v3
4343
with:
@@ -52,4 +52,4 @@ jobs:
5252
steps:
5353
- name: Deploy to GitHub Pages
5454
id: deployment
55-
uses: actions/deploy-pages@v4
55+
uses: actions/deploy-pages@v4

src/app/layout.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Geist, Geist_Mono } from 'next/font/google';
33
import type { Metadata } from 'next';
44

55
import Footer from '@/components/Footer';
6+
67
import './globals.css';
78

89
const geistSans = Geist({
@@ -17,8 +18,18 @@ const geistMono = Geist_Mono({
1718

1819
export const metadata: Metadata = {
1920
title: 'Korean Services Integration Kit For Next.js',
20-
description: '한국 웹 서비스들을 Next.js에 쉽게 통합하고 테스트할 수 있는 개발자 도구입니다. API를 실시간으로 테스트해보세요.',
21-
keywords: ['토스페이먼츠', '포트원', '채널톡', 'Next.js', 'Korean payment', 'TossPayments', 'PortOne', 'ChannelTalk'],
21+
description:
22+
'한국 웹 서비스들을 Next.js에 쉽게 통합하고 테스트할 수 있는 개발자 도구입니다. API를 실시간으로 테스트해보세요.',
23+
keywords: [
24+
'토스페이먼츠',
25+
'포트원',
26+
'채널톡',
27+
'Next.js',
28+
'Korean payment',
29+
'TossPayments',
30+
'PortOne',
31+
'ChannelTalk',
32+
],
2233
};
2334

2435
export default function RootLayout({
@@ -31,9 +42,7 @@ export default function RootLayout({
3142
<body
3243
className={`${geistSans.variable} ${geistMono.variable} antialiased min-h-screen flex flex-col`}
3344
>
34-
<main className="flex-grow">
35-
{children}
36-
</main>
45+
<main className="flex-grow">{children}</main>
3746
<Footer />
3847
</body>
3948
</html>

src/app/portone-v2/page.tsx

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ export default function PortOneV2Page() {
2828
const [isPaymentLoading, setIsPaymentLoading] = useState(false);
2929
const [productName, setProductName] = useState('테스트 상품');
3030
const [amount, setAmount] = useState('1000');
31-
const [payMethod, setPayMethod] = useState<'CARD' | 'VIRTUAL_ACCOUNT' | 'TRANSFER'>('CARD');
31+
const [payMethod, setPayMethod] = useState<
32+
'CARD' | 'VIRTUAL_ACCOUNT' | 'TRANSFER'
33+
>('CARD');
3234
const [paymentResult, setPaymentResult] = useState<PortOneV2Response | null>(
3335
null
3436
);
@@ -39,7 +41,12 @@ export default function PortOneV2Page() {
3941
};
4042
}, []);
4143

42-
const handleValueChange = (setter: (v: string) => void, validator: (v: string) => boolean, validSetter: (v: boolean) => void) =>
44+
const handleValueChange =
45+
(
46+
setter: (v: string) => void,
47+
validator: (v: string) => boolean,
48+
validSetter: (v: boolean) => void
49+
) =>
4350
(value: string) => {
4451
setter(value);
4552
validSetter(validator(value));
@@ -49,11 +56,22 @@ export default function PortOneV2Page() {
4956
}
5057
};
5158

52-
const handleStoreIdChange = handleValueChange(setStoreId, validatePortOneV2StoreId, setIsStoreIdValid);
53-
const handleChannelKeyChange = handleValueChange(setChannelKey, validatePortOneV2ChannelKey, setIsChannelKeyValid);
59+
const handleStoreIdChange = handleValueChange(
60+
setStoreId,
61+
validatePortOneV2StoreId,
62+
setIsStoreIdValid
63+
);
64+
const handleChannelKeyChange = handleValueChange(
65+
setChannelKey,
66+
validatePortOneV2ChannelKey,
67+
setIsChannelKeyValid
68+
);
5469

5570
const handleStartTest = async () => {
56-
if (validatePortOneV2StoreId(storeId) && validatePortOneV2ChannelKey(channelKey)) {
71+
if (
72+
validatePortOneV2StoreId(storeId) &&
73+
validatePortOneV2ChannelKey(channelKey)
74+
) {
5775
setIsActive(await initializePortOneV2({ storeId, channelKey }));
5876
}
5977
};
@@ -251,7 +269,9 @@ export default function PortOneV2Page() {
251269
<select
252270
id="payMethod"
253271
value={payMethod}
254-
onChange={(e) => setPayMethod(e.target.value as typeof payMethod)}
272+
onChange={(e) =>
273+
setPayMethod(e.target.value as typeof payMethod)
274+
}
255275
className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-transparent"
256276
>
257277
<option value="CARD">신용카드</option>
@@ -340,12 +360,16 @@ export default function PortOneV2Page() {
340360
</div>
341361

342362
<div className="mb-4">
343-
<div className={`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium ${
344-
!paymentResult.code || paymentResult.code === '0'
345-
? 'bg-green-100 text-green-800'
346-
: 'bg-red-100 text-red-800'
347-
}`}>
348-
{!paymentResult.code || paymentResult.code === '0' ? '✅ 결제 성공' : '❌ 결제 실패'}
363+
<div
364+
className={`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium ${
365+
!paymentResult.code || paymentResult.code === '0'
366+
? 'bg-green-100 text-green-800'
367+
: 'bg-red-100 text-red-800'
368+
}`}
369+
>
370+
{!paymentResult.code || paymentResult.code === '0'
371+
? '✅ 결제 성공'
372+
: '❌ 결제 실패'}
349373
</div>
350374
</div>
351375

src/app/tosspayments/page.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ export default function TossPaymentsPage() {
2828
const [amount, setAmount] = useState('50000');
2929
const [customerName, setCustomerName] = useState('김토스');
3030
const [customerEmail, setCustomerEmail] = useState('test@example.com');
31-
const [paymentResult, setPaymentResult] = useState<TossPaymentsResponse | null>(null);
31+
const [paymentResult, setPaymentResult] =
32+
useState<TossPaymentsResponse | null>(null);
3233
const [widgetsRendered, setWidgetsRendered] = useState(false);
3334

3435
const paymentMethodsRef = useRef<HTMLDivElement>(null);
@@ -52,7 +53,10 @@ export default function TossPaymentsPage() {
5253

5354
const handleStartTest = async () => {
5455
if (clientKey.trim()) {
55-
const success = await initializeTossPayments({ clientKey, customerKey: 'customer-' + Date.now() });
56+
const success = await initializeTossPayments({
57+
clientKey,
58+
customerKey: 'customer-' + Date.now(),
59+
});
5660
if (success) {
5761
setIsActive(true);
5862
await renderPaymentWidgets();
@@ -65,7 +69,7 @@ export default function TossPaymentsPage() {
6569
await Promise.all([
6670
setPaymentAmount(parseInt(amount)),
6771
renderPaymentMethods('#payment-methods'),
68-
renderAgreement('#agreement')
72+
renderAgreement('#agreement'),
6973
]);
7074
setWidgetsRendered(true);
7175
} catch (error) {

src/components/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ export default function Footer() {
1919
</div>
2020
</footer>
2121
);
22-
}
22+
}

src/components/ServiceCard.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,18 @@ export default function ServiceCard({ service }: ServiceCardProps) {
5858
className="text-sm text-blue-600 hover:text-blue-800 underline flex items-center space-x-1"
5959
>
6060
<span>문서 보기</span>
61-
<svg className="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
62-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
61+
<svg
62+
className="w-3 h-3"
63+
fill="none"
64+
stroke="currentColor"
65+
viewBox="0 0 24 24"
66+
>
67+
<path
68+
strokeLinecap="round"
69+
strokeLinejoin="round"
70+
strokeWidth={2}
71+
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
72+
/>
6373
</svg>
6474
</Link>
6575

src/lib/services/portone-v2.ts

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,26 @@ let isSDKInitialized = false;
4545

4646
export const validatePortOneV2StoreId = (storeId: string): boolean => {
4747
if (!storeId || typeof storeId !== 'string') return false;
48-
return /^store-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(storeId);
48+
return /^store-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(
49+
storeId
50+
);
4951
};
5052

5153
export const validatePortOneV2ChannelKey = (channelKey: string): boolean => {
5254
if (!channelKey || typeof channelKey !== 'string') return false;
53-
return /^channel-key-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(channelKey);
55+
return /^channel-key-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(
56+
channelKey
57+
);
5458
};
5559

56-
export const initializePortOneV2 = async (config: PortOneV2Config): Promise<boolean> => {
60+
export const initializePortOneV2 = async (
61+
config: PortOneV2Config
62+
): Promise<boolean> => {
5763
try {
5864
if (typeof window === 'undefined') {
59-
console.error('PortOne v2 can only be initialized in browser environment');
65+
console.error(
66+
'PortOne v2 can only be initialized in browser environment'
67+
);
6068
return false;
6169
}
6270

@@ -77,13 +85,19 @@ export const requestPortOneV2Payment = async (
7785

7886
return new Promise((resolve, reject) => {
7987
if (!isSDKInitialized) {
80-
const error = createError('NOT_INITIALIZED', 'PortOne v2 SDK not initialized');
88+
const error = createError(
89+
'NOT_INITIALIZED',
90+
'PortOne v2 SDK not initialized'
91+
);
8192
onResult?.(error);
8293
return reject(error);
8394
}
8495

8596
if (typeof window === 'undefined') {
86-
const error = createError('BROWSER_ONLY', 'Payment can only be requested in browser environment');
97+
const error = createError(
98+
'BROWSER_ONLY',
99+
'Payment can only be requested in browser environment'
100+
);
87101
onResult?.(error);
88102
return reject(error);
89103
}
@@ -95,7 +109,10 @@ export const requestPortOneV2Payment = async (
95109
paymentId: paymentData.paymentId,
96110
orderName: paymentData.orderName,
97111
totalAmount: paymentData.totalAmount,
98-
currency: paymentData.currency === 'KRW' ? Entity.Currency.KRW : Entity.Currency.USD,
112+
currency:
113+
paymentData.currency === 'KRW'
114+
? Entity.Currency.KRW
115+
: Entity.Currency.USD,
99116
payMethod: paymentData.payMethod,
100117
customer: paymentData.customer,
101118
};

0 commit comments

Comments
 (0)