feat: sync and update with all changes from fork (#720)

* feat: sync and update with all changes from fork
* refactor: extract clipboard copy logic into custom hook
* fix: correct spelling of DEFAULT_REFRESH_FREQUENCY_MS in Stamps and WalletBalance providers
* refactor(ui-tests): replace fixed sleeps with condition-based waits
* fix: handle null values for size and granteeCount in infoGroups
* fix(lint): add newline at end of file in useClipboardCopy hook
* fix(ui-tests): page.goto URL
* refactor: update import paths for useClipboardCopy

---------

Co-authored-by: Ferenc Sárai <sarai.ferenc@gmail.com>
This commit is contained in:
Bálint Ujvári
2026-03-02 11:34:39 +01:00
committed by GitHub
parent b0f00a624a
commit 519c411db0
303 changed files with 16609 additions and 29415 deletions
@@ -1,10 +1,12 @@
import { useEffect, useRef, useCallback } from 'react'
import { useLocation } from 'react-router-dom'
import formbricks from '@formbricks/js'
import { useCallback, useEffect, useRef } from 'react'
import { useLocation } from 'react-router-dom'
import { LocalStorageKeys } from '../../../../utils/localStorage'
const FM_CLICK_STORAGE_KEY = 'fm_click_count_v1'
const FM_SURVEY_TRIGGERED_KEY = 'fm_survey_triggered_v1'
const FM_CLICK_THRESHOLD = 25
const FM_FORMBRICKS_TRACK_CODE = 'file_manager_engagement_25_clicks'
const FORMBRICKS_INIT_TIMEOUT_MS = 1000
interface FormbricksIntegrationProps {
isActive: boolean
@@ -16,14 +18,14 @@ export function FormbricksIntegration({ isActive }: FormbricksIntegrationProps)
const formbricksReadyRef = useRef(false)
const pendingEventRef = useRef(false)
const environmentId = process.env.REACT_APP_FORMBRICKS_ENV_ID
const appUrl = process.env.REACT_APP_FORMBRICKS_APP_URL
const environmentId = import.meta.env.VITE_FORMBRICKS_ENV_ID
const appUrl = import.meta.env.VITE_FORMBRICKS_APP_URL
const flushPendingEvent = useCallback(() => {
if (pendingEventRef.current && localStorage.getItem(FM_SURVEY_TRIGGERED_KEY) !== 'true') {
if (pendingEventRef.current && localStorage.getItem(LocalStorageKeys.fmSurveyTriggered) !== 'true') {
try {
formbricks.track('file_manager_engagement_25_clicks')
localStorage.setItem(FM_SURVEY_TRIGGERED_KEY, 'true')
formbricks.track(FM_FORMBRICKS_TRACK_CODE)
localStorage.setItem(LocalStorageKeys.fmSurveyTriggered, 'true')
pendingEventRef.current = false
} catch {
// no-op
@@ -45,7 +47,7 @@ export function FormbricksIntegration({ isActive }: FormbricksIntegrationProps)
appUrl,
})
await new Promise(resolve => setTimeout(resolve, 1000))
await new Promise(resolve => setTimeout(resolve, FORMBRICKS_INIT_TIMEOUT_MS))
if (!cancelled) {
formbricksReadyRef.current = true
@@ -79,11 +81,11 @@ export function FormbricksIntegration({ isActive }: FormbricksIntegrationProps)
if (!isActive) return
const handleClick = async () => {
if (localStorage.getItem(FM_SURVEY_TRIGGERED_KEY) === 'true') return
if (localStorage.getItem(LocalStorageKeys.fmSurveyTriggered) === 'true') return
let count = 0
try {
const stored = localStorage.getItem(FM_CLICK_STORAGE_KEY)
const stored = localStorage.getItem(LocalStorageKeys.fmClickStorage)
if (stored) count = parseInt(stored, 10) || 0
} catch {
@@ -92,7 +94,7 @@ export function FormbricksIntegration({ isActive }: FormbricksIntegrationProps)
count += 1
try {
localStorage.setItem(FM_CLICK_STORAGE_KEY, String(count))
localStorage.setItem(LocalStorageKeys.fmClickStorage, String(count))
} catch {
// no-op
}
@@ -111,8 +113,8 @@ export function FormbricksIntegration({ isActive }: FormbricksIntegrationProps)
}
try {
await formbricks.track('file_manager_engagement_25_clicks')
localStorage.setItem(FM_SURVEY_TRIGGERED_KEY, 'true')
await formbricks.track(FM_FORMBRICKS_TRACK_CODE)
localStorage.setItem(LocalStorageKeys.fmSurveyTriggered, 'true')
} catch {
// no-op
}