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