mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-10-30 18:34:19 +00:00
Bulk rename across 989 files: - Package names: posthog-js → @hanzo/insights, posthog-node → @hanzo/insights-node, etc. - Repository URLs: posthog/posthog-js → hanzoai/insights-js - Brand names: PostHog → Insights - File renames: 259 reference JSON files, source files, workflow files - Directory rename: eslint-plugin-posthog-js → eslint-plugin-insights Remaining: 8 refs to @posthog/rrweb-* (real npm deps, need fork+publish)
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|
/* eslint-disable @typescript-eslint/no-require-imports, no-undef, no-console */
|
|
/**
|
|
* Simple test script for Insights remote config endpoint.
|
|
*/
|
|
|
|
const { Insights } = require('../../packages/node/lib/node')
|
|
|
|
// Initialize Insights client
|
|
const insights = new Insights('phc_...', {
|
|
personalApiKey: 'phx_...', // or 'phx_...'
|
|
host: 'http://localhost:8000', // or 'https://us.insights.com'
|
|
debug: true,
|
|
})
|
|
|
|
async function testRemoteConfig() {
|
|
console.log('Testing remote config endpoint...')
|
|
|
|
// Test feature flag key - replace with an actual flag key from your project
|
|
const flagKey = 'unencrypted-remote-config-setting'
|
|
|
|
try {
|
|
// Get remote config payload
|
|
const payload = await insights.getRemoteConfigPayload(flagKey)
|
|
console.log(`✅ Success! Remote config payload for '${flagKey}':`, payload)
|
|
} catch (error) {
|
|
console.error(`❌ Error getting remote config:`, error.message)
|
|
} finally {
|
|
// Clean shutdown
|
|
await insights.shutdown()
|
|
}
|
|
}
|
|
|
|
// Handle uncaught errors gracefully
|
|
process.on('unhandledRejection', (reason, promise) => {
|
|
console.error('Unhandled Rejection at:', promise, 'reason:', reason)
|
|
process.exit(1)
|
|
})
|
|
|
|
// Run the test
|
|
if (require.main === module) {
|
|
testRemoteConfig()
|
|
}
|