From 5e87a348292a695217ce94668ff4d1c27af5059b Mon Sep 17 00:00:00 2001 From: Heeryong Kang Date: Tue, 24 Dec 2024 04:57:52 +0900 Subject: [PATCH] =?UTF-8?q?chore(triple-web-nextjs):=20=ED=8F=B4=EB=8D=94?= =?UTF-8?q?=20=EA=B5=AC=EC=A1=B0=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/event-tracking-provider.tsx | 32 ------------------- packages/triple-web-nextjs/src/index.ts | 7 +--- .../{providers => initializers}/client-app.ts | 0 .../index.ts} | 6 ++-- .../{providers => initializers}/session.ts | 0 .../{providers => initializers}/user-agent.ts | 0 .../app-install-cta-modal-provider.mdx | 0 .../app-install-cta-modal-provider.tsx | 0 .../event-metadata-provider.mdx | 0 .../event-metadata-provider.tsx | 0 .../event-tracking-provider.mdx | 0 ...ing-utm.ts => event-tracking-provider.tsx} | 32 ++++++++++++++++++- .../triple-web-nextjs/src/providers/index.ts | 9 +++--- .../login-cta-modal-provider.mdx | 0 .../login-cta-modal-provider.tsx | 0 .../src/{ => providers}/triple-web.mdx | 0 .../src/{ => providers}/triple-web.tsx | 0 17 files changed, 41 insertions(+), 45 deletions(-) delete mode 100644 packages/triple-web-nextjs/src/event-tracking-provider.tsx rename packages/triple-web-nextjs/src/{providers => initializers}/client-app.ts (100%) rename packages/triple-web-nextjs/src/{build-triple-web-props.ts => initializers/index.ts} (65%) rename packages/triple-web-nextjs/src/{providers => initializers}/session.ts (100%) rename packages/triple-web-nextjs/src/{providers => initializers}/user-agent.ts (100%) rename packages/triple-web-nextjs/src/{ => providers}/app-install-cta-modal-provider.mdx (100%) rename packages/triple-web-nextjs/src/{ => providers}/app-install-cta-modal-provider.tsx (100%) rename packages/triple-web-nextjs/src/{ => providers}/event-metadata-provider.mdx (100%) rename packages/triple-web-nextjs/src/{ => providers}/event-metadata-provider.tsx (100%) rename packages/triple-web-nextjs/src/{ => providers}/event-tracking-provider.mdx (100%) rename packages/triple-web-nextjs/src/providers/{event-tracking-utm.ts => event-tracking-provider.tsx} (50%) rename packages/triple-web-nextjs/src/{ => providers}/login-cta-modal-provider.mdx (100%) rename packages/triple-web-nextjs/src/{ => providers}/login-cta-modal-provider.tsx (100%) rename packages/triple-web-nextjs/src/{ => providers}/triple-web.mdx (100%) rename packages/triple-web-nextjs/src/{ => providers}/triple-web.tsx (100%) diff --git a/packages/triple-web-nextjs/src/event-tracking-provider.tsx b/packages/triple-web-nextjs/src/event-tracking-provider.tsx deleted file mode 100644 index ea9e969865..0000000000 --- a/packages/triple-web-nextjs/src/event-tracking-provider.tsx +++ /dev/null @@ -1,32 +0,0 @@ -'use client' - -import { - EventTrackingProvider as EventTrackingProviderBase, - type EventTrackingProviderProps as EventTrackingProviderBaseProps, -} from '@titicaca/triple-web' -import { useSearchParams } from 'next/navigation' - -import { getEventTrackingUtm } from './providers/event-tracking-utm' - -export type EventTrackingProviderProps = Omit< - EventTrackingProviderBaseProps, - 'utm' -> - -export function EventTrackingProvider({ - children, - page, - onError, -}: EventTrackingProviderProps) { - const searchParams = useSearchParams() - - return ( - - {children} - - ) -} diff --git a/packages/triple-web-nextjs/src/index.ts b/packages/triple-web-nextjs/src/index.ts index 977558484e..38cd579b79 100644 --- a/packages/triple-web-nextjs/src/index.ts +++ b/packages/triple-web-nextjs/src/index.ts @@ -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' diff --git a/packages/triple-web-nextjs/src/providers/client-app.ts b/packages/triple-web-nextjs/src/initializers/client-app.ts similarity index 100% rename from packages/triple-web-nextjs/src/providers/client-app.ts rename to packages/triple-web-nextjs/src/initializers/client-app.ts diff --git a/packages/triple-web-nextjs/src/build-triple-web-props.ts b/packages/triple-web-nextjs/src/initializers/index.ts similarity index 65% rename from packages/triple-web-nextjs/src/build-triple-web-props.ts rename to packages/triple-web-nextjs/src/initializers/index.ts index 8424fcbc3e..af41ccde1a 100644 --- a/packages/triple-web-nextjs/src/build-triple-web-props.ts +++ b/packages/triple-web-nextjs/src/initializers/index.ts @@ -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, diff --git a/packages/triple-web-nextjs/src/providers/session.ts b/packages/triple-web-nextjs/src/initializers/session.ts similarity index 100% rename from packages/triple-web-nextjs/src/providers/session.ts rename to packages/triple-web-nextjs/src/initializers/session.ts diff --git a/packages/triple-web-nextjs/src/providers/user-agent.ts b/packages/triple-web-nextjs/src/initializers/user-agent.ts similarity index 100% rename from packages/triple-web-nextjs/src/providers/user-agent.ts rename to packages/triple-web-nextjs/src/initializers/user-agent.ts diff --git a/packages/triple-web-nextjs/src/app-install-cta-modal-provider.mdx b/packages/triple-web-nextjs/src/providers/app-install-cta-modal-provider.mdx similarity index 100% rename from packages/triple-web-nextjs/src/app-install-cta-modal-provider.mdx rename to packages/triple-web-nextjs/src/providers/app-install-cta-modal-provider.mdx diff --git a/packages/triple-web-nextjs/src/app-install-cta-modal-provider.tsx b/packages/triple-web-nextjs/src/providers/app-install-cta-modal-provider.tsx similarity index 100% rename from packages/triple-web-nextjs/src/app-install-cta-modal-provider.tsx rename to packages/triple-web-nextjs/src/providers/app-install-cta-modal-provider.tsx diff --git a/packages/triple-web-nextjs/src/event-metadata-provider.mdx b/packages/triple-web-nextjs/src/providers/event-metadata-provider.mdx similarity index 100% rename from packages/triple-web-nextjs/src/event-metadata-provider.mdx rename to packages/triple-web-nextjs/src/providers/event-metadata-provider.mdx diff --git a/packages/triple-web-nextjs/src/event-metadata-provider.tsx b/packages/triple-web-nextjs/src/providers/event-metadata-provider.tsx similarity index 100% rename from packages/triple-web-nextjs/src/event-metadata-provider.tsx rename to packages/triple-web-nextjs/src/providers/event-metadata-provider.tsx diff --git a/packages/triple-web-nextjs/src/event-tracking-provider.mdx b/packages/triple-web-nextjs/src/providers/event-tracking-provider.mdx similarity index 100% rename from packages/triple-web-nextjs/src/event-tracking-provider.mdx rename to packages/triple-web-nextjs/src/providers/event-tracking-provider.mdx diff --git a/packages/triple-web-nextjs/src/providers/event-tracking-utm.ts b/packages/triple-web-nextjs/src/providers/event-tracking-provider.tsx similarity index 50% rename from packages/triple-web-nextjs/src/providers/event-tracking-utm.ts rename to packages/triple-web-nextjs/src/providers/event-tracking-provider.tsx index b249673729..f4575470b9 100644 --- a/packages/triple-web-nextjs/src/providers/event-tracking-utm.ts +++ b/packages/triple-web-nextjs/src/providers/event-tracking-provider.tsx @@ -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, @@ -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 ( + + {children} + + ) +} diff --git a/packages/triple-web-nextjs/src/providers/index.ts b/packages/triple-web-nextjs/src/providers/index.ts index f9faa7f3ea..f2a17550ba 100644 --- a/packages/triple-web-nextjs/src/providers/index.ts +++ b/packages/triple-web-nextjs/src/providers/index.ts @@ -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' diff --git a/packages/triple-web-nextjs/src/login-cta-modal-provider.mdx b/packages/triple-web-nextjs/src/providers/login-cta-modal-provider.mdx similarity index 100% rename from packages/triple-web-nextjs/src/login-cta-modal-provider.mdx rename to packages/triple-web-nextjs/src/providers/login-cta-modal-provider.mdx diff --git a/packages/triple-web-nextjs/src/login-cta-modal-provider.tsx b/packages/triple-web-nextjs/src/providers/login-cta-modal-provider.tsx similarity index 100% rename from packages/triple-web-nextjs/src/login-cta-modal-provider.tsx rename to packages/triple-web-nextjs/src/providers/login-cta-modal-provider.tsx diff --git a/packages/triple-web-nextjs/src/triple-web.mdx b/packages/triple-web-nextjs/src/providers/triple-web.mdx similarity index 100% rename from packages/triple-web-nextjs/src/triple-web.mdx rename to packages/triple-web-nextjs/src/providers/triple-web.mdx diff --git a/packages/triple-web-nextjs/src/triple-web.tsx b/packages/triple-web-nextjs/src/providers/triple-web.tsx similarity index 100% rename from packages/triple-web-nextjs/src/triple-web.tsx rename to packages/triple-web-nextjs/src/providers/triple-web.tsx