luxlabs 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -44,6 +44,13 @@ function writeBoilerplateFiles(targetDir) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
copyDirRecursive(templatesDir, targetDir);
|
|
47
|
+
|
|
48
|
+
// Rename gitignore.template to .gitignore (npm ignores dotfiles in packages)
|
|
49
|
+
const gitignoreTemplate = path.join(targetDir, 'gitignore.template');
|
|
50
|
+
const gitignoreDest = path.join(targetDir, '.gitignore');
|
|
51
|
+
if (fs.existsSync(gitignoreTemplate)) {
|
|
52
|
+
fs.renameSync(gitignoreTemplate, gitignoreDest);
|
|
53
|
+
}
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
module.exports = {
|
package/package.json
CHANGED
|
@@ -10,9 +10,33 @@ const POSTHOG_HOST = process.env.NEXT_PUBLIC_POSTHOG_HOST || 'https://us.i.posth
|
|
|
10
10
|
const LUX_INTERFACE_ID = process.env.NEXT_PUBLIC_LUX_INTERFACE_ID
|
|
11
11
|
const LUX_ORG_ID = process.env.NEXT_PUBLIC_LUX_ORG_ID
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Parse Lux Studio flag overrides from URL query params.
|
|
15
|
+
* When previewing A/B test variants in Lux Studio, the preview URL includes
|
|
16
|
+
* ?__lux_flag_overrides={"flag-key":"variant-key"} to force specific variants.
|
|
17
|
+
*/
|
|
18
|
+
function getLuxFlagOverrides(): Record<string, string> | undefined {
|
|
19
|
+
if (typeof window === 'undefined') return undefined
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
const params = new URLSearchParams(window.location.search)
|
|
23
|
+
const overrides = params.get('__lux_flag_overrides')
|
|
24
|
+
if (overrides) {
|
|
25
|
+
const parsed = JSON.parse(overrides)
|
|
26
|
+
console.log('[PostHog] Lux Studio flag overrides detected:', parsed)
|
|
27
|
+
return parsed
|
|
28
|
+
}
|
|
29
|
+
} catch (e) {
|
|
30
|
+
console.warn('[PostHog] Failed to parse __lux_flag_overrides:', e)
|
|
31
|
+
}
|
|
32
|
+
return undefined
|
|
33
|
+
}
|
|
34
|
+
|
|
13
35
|
export function PostHogProvider({ children }: { children: React.ReactNode }) {
|
|
14
36
|
const initialized = useRef(false)
|
|
37
|
+
const searchParams = useSearchParams()
|
|
15
38
|
|
|
39
|
+
// Initialize PostHog once
|
|
16
40
|
useEffect(() => {
|
|
17
41
|
if (!POSTHOG_KEY || initialized.current) {
|
|
18
42
|
if (!POSTHOG_KEY) {
|
|
@@ -40,6 +64,22 @@ export function PostHogProvider({ children }: { children: React.ReactNode }) {
|
|
|
40
64
|
initialized.current = true
|
|
41
65
|
}, [])
|
|
42
66
|
|
|
67
|
+
// Apply Lux Studio flag overrides whenever URL changes
|
|
68
|
+
// This uses posthog.featureFlags.override() which works even after init
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (!POSTHOG_KEY) return
|
|
71
|
+
|
|
72
|
+
const flagOverrides = getLuxFlagOverrides()
|
|
73
|
+
if (flagOverrides) {
|
|
74
|
+
// Override feature flags for Lux Studio preview
|
|
75
|
+
posthog.featureFlags.override(flagOverrides)
|
|
76
|
+
console.log('[PostHog] Applied Lux Studio flag overrides:', flagOverrides)
|
|
77
|
+
} else {
|
|
78
|
+
// Clear any previous overrides when not in preview mode
|
|
79
|
+
posthog.featureFlags.override(false)
|
|
80
|
+
}
|
|
81
|
+
}, [searchParams])
|
|
82
|
+
|
|
43
83
|
if (!POSTHOG_KEY) {
|
|
44
84
|
return <>{children}</>
|
|
45
85
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
.pnp
|
|
4
|
+
.pnp.js
|
|
5
|
+
|
|
6
|
+
# Build outputs
|
|
7
|
+
.next/
|
|
8
|
+
out/
|
|
9
|
+
build/
|
|
10
|
+
dist/
|
|
11
|
+
|
|
12
|
+
# Debug
|
|
13
|
+
npm-debug.log*
|
|
14
|
+
yarn-debug.log*
|
|
15
|
+
yarn-error.log*
|
|
16
|
+
|
|
17
|
+
# Local env files
|
|
18
|
+
.env
|
|
19
|
+
.env.local
|
|
20
|
+
.env.development.local
|
|
21
|
+
.env.test.local
|
|
22
|
+
.env.production.local
|
|
23
|
+
|
|
24
|
+
# Vercel
|
|
25
|
+
.vercel
|
|
26
|
+
|
|
27
|
+
# TypeScript
|
|
28
|
+
*.tsbuildinfo
|
|
29
|
+
next-env.d.ts
|
|
30
|
+
|
|
31
|
+
# IDE
|
|
32
|
+
.idea/
|
|
33
|
+
.vscode/
|
|
34
|
+
*.swp
|
|
35
|
+
*.swo
|
|
36
|
+
|
|
37
|
+
# OS
|
|
38
|
+
.DS_Store
|
|
39
|
+
Thumbs.db
|
|
40
|
+
|
|
41
|
+
# Testing
|
|
42
|
+
coverage/
|