Skip to content

Commit

Permalink
chore(triple-web-nextjs): 폴더 구조 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
drakang4 committed Jan 3, 2025
1 parent 3c9ba6e commit 5e87a34
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 45 deletions.
32 changes: 0 additions & 32 deletions packages/triple-web-nextjs/src/event-tracking-provider.tsx

This file was deleted.

7 changes: 1 addition & 6 deletions packages/triple-web-nextjs/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
export * from './initializers'
export * from './providers'
export * from './app-install-cta-modal-provider'
export * from './build-triple-web-props'
export * from './event-metadata-provider'
export * from './event-tracking-provider'
export * from './login-cta-modal-provider'
export * from './triple-web'
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { TripleWebProps } from './triple-web'
import type { TripleWebProps } from '../providers'

import { getClientApp, getSession, getUserAgent } from '.'
import { getClientApp } from './client-app'
import { getSession } from './session'
import { getUserAgent } from './user-agent'

export type BuildTripleWebPropsResult = Omit<
TripleWebProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import type { EventTrackingUtmValue } from '@titicaca/triple-web'
'use client'

import {
EventTrackingProvider as EventTrackingProviderBase,
type EventTrackingUtmValue,
type EventTrackingProviderProps as EventTrackingProviderBaseProps,
} from '@titicaca/triple-web'
import { useSearchParams } from 'next/navigation'

export function getEventTrackingUtm(
searchParams: URLSearchParams,
Expand All @@ -25,3 +32,26 @@ export function getEventTrackingUtm(
partner: searchParams.get('prt') || undefined,
}
}

export type EventTrackingProviderProps = Omit<
EventTrackingProviderBaseProps,
'utm'
>

export function EventTrackingProvider({
children,
page,
onError,
}: EventTrackingProviderProps) {
const searchParams = useSearchParams()

return (
<EventTrackingProviderBase
page={page}
utm={getEventTrackingUtm(searchParams)}
onError={onError}
>
{children}
</EventTrackingProviderBase>
)
}
9 changes: 5 additions & 4 deletions packages/triple-web-nextjs/src/providers/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './client-app'
export * from './event-tracking-utm'
export * from './session'
export * from './user-agent'
export * from './app-install-cta-modal-provider'
export * from './event-metadata-provider'
export * from './event-tracking-provider'
export * from './login-cta-modal-provider'
export * from './triple-web'

0 comments on commit 5e87a34

Please sign in to comment.