mirror of
https://github.com/langgenius/dify.git
synced 2026-05-11 06:37:13 +08:00
25 lines
617 B
TypeScript
25 lines
617 B
TypeScript
'use client'
|
|
|
|
import type { FC } from 'react'
|
|
import type { AmplitudeInitializationOptions } from './init'
|
|
import * as React from 'react'
|
|
import { useEffect } from 'react'
|
|
import { ensureAmplitudeInitialized } from './init'
|
|
|
|
export type IAmplitudeProps = AmplitudeInitializationOptions
|
|
|
|
const AmplitudeProvider: FC<IAmplitudeProps> = ({
|
|
sessionReplaySampleRate = 0.5,
|
|
}) => {
|
|
useEffect(() => {
|
|
ensureAmplitudeInitialized({
|
|
sessionReplaySampleRate,
|
|
})
|
|
}, [sessionReplaySampleRate])
|
|
|
|
// This is a client component that renders nothing
|
|
return null
|
|
}
|
|
|
|
export default React.memo(AmplitudeProvider)
|