humanbehavior-js 0.4.19 → 0.4.21
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.
- package/dist/cjs/angular/index.cjs +799 -13
- package/dist/cjs/angular/index.cjs.map +1 -1
- package/dist/cjs/index.cjs +815 -13
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/install-wizard.cjs +56 -10
- package/dist/cjs/install-wizard.cjs.map +1 -1
- package/dist/cjs/react/index.cjs +800 -14
- package/dist/cjs/react/index.cjs.map +1 -1
- package/dist/cjs/remix/index.cjs +800 -14
- package/dist/cjs/remix/index.cjs.map +1 -1
- package/dist/cjs/svelte/index.cjs +799 -13
- package/dist/cjs/svelte/index.cjs.map +1 -1
- package/dist/cjs/vue/index.cjs +799 -13
- package/dist/cjs/vue/index.cjs.map +1 -1
- package/dist/cjs/wizard/index.cjs +56 -10
- package/dist/cjs/wizard/index.cjs.map +1 -1
- package/dist/cli/ai-auto-install.js +56 -10
- package/dist/cli/ai-auto-install.js.map +1 -1
- package/dist/cli/auto-install.js +56 -10
- package/dist/cli/auto-install.js.map +1 -1
- package/dist/esm/angular/index.js +799 -13
- package/dist/esm/angular/index.js.map +1 -1
- package/dist/esm/index.js +807 -14
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/install-wizard.js +56 -10
- package/dist/esm/install-wizard.js.map +1 -1
- package/dist/esm/react/index.js +800 -14
- package/dist/esm/react/index.js.map +1 -1
- package/dist/esm/remix/index.js +800 -14
- package/dist/esm/remix/index.js.map +1 -1
- package/dist/esm/svelte/index.js +799 -13
- package/dist/esm/svelte/index.js.map +1 -1
- package/dist/esm/vue/index.js +799 -13
- package/dist/esm/vue/index.js.map +1 -1
- package/dist/esm/wizard/index.js +56 -10
- package/dist/esm/wizard/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/types/angular/index.d.ts +60 -1
- package/dist/types/index.d.ts +258 -3
- package/dist/types/react/index.d.ts +60 -1
- package/dist/types/remix/index.d.ts +60 -1
- package/dist/types/svelte/index.d.ts +60 -1
- package/package/canvas-recording-demo.html +1 -1
- package/package/simple-spa.html +1 -1
- package/package/src/angular/index.ts +3 -3
- package/package/src/react/index.tsx +2 -2
- package/package/src/svelte/index.ts +1 -1
- package/package/src/tracker.ts +2 -2
- package/package/src/vue/index.ts +1 -1
- package/package.json +1 -1
- package/simple-spa.html +164 -2
- package/src/angular/index.ts +3 -3
- package/src/api.ts +40 -0
- package/src/index.ts +7 -0
- package/src/react/index.tsx +2 -2
- package/src/svelte/index.ts +1 -1
- package/src/tracker.ts +175 -11
- package/src/utils/ip-detector.ts +158 -0
- package/src/utils/property-detector.ts +345 -0
- package/src/utils/property-manager.ts +274 -0
- package/src/vue/index.ts +1 -1
- package/src/wizard/core/install-wizard.ts +60 -10
- package/canvas-recording-demo.html +0 -143
- package/clean-console-demo.html +0 -39
- package/simple-demo.html +0 -26
|
@@ -679,25 +679,72 @@ export default defineNuxtPlugin(() => {
|
|
|
679
679
|
description: 'Added HumanBehaviorModule to Angular app'
|
|
680
680
|
});
|
|
681
681
|
}
|
|
682
|
-
// Handle Angular environment
|
|
682
|
+
// Handle Angular environment files (proper Angular way)
|
|
683
683
|
const envFile = path__namespace.join(this.projectRoot, 'src', 'environments', 'environment.ts');
|
|
684
|
+
const envProdFile = path__namespace.join(this.projectRoot, 'src', 'environments', 'environment.prod.ts');
|
|
685
|
+
// Create environments directory if it doesn't exist
|
|
686
|
+
const envDir = path__namespace.dirname(envFile);
|
|
687
|
+
if (!fs__namespace.existsSync(envDir)) {
|
|
688
|
+
fs__namespace.mkdirSync(envDir, { recursive: true });
|
|
689
|
+
}
|
|
690
|
+
// Create or update development environment
|
|
684
691
|
if (fs__namespace.existsSync(envFile)) {
|
|
685
692
|
const content = fs__namespace.readFileSync(envFile, 'utf8');
|
|
686
693
|
if (!content.includes('humanBehaviorApiKey')) {
|
|
687
694
|
const modifiedContent = content.replace(/export const environment = {([\s\S]*?)};/, `export const environment = {
|
|
688
695
|
$1,
|
|
689
|
-
humanBehaviorApiKey:
|
|
696
|
+
humanBehaviorApiKey: '${this.apiKey}'
|
|
690
697
|
};`);
|
|
691
698
|
modifications.push({
|
|
692
699
|
filePath: envFile,
|
|
693
700
|
action: 'modify',
|
|
694
701
|
content: modifiedContent,
|
|
695
|
-
description: 'Added API key to Angular environment'
|
|
702
|
+
description: 'Added API key to Angular development environment'
|
|
696
703
|
});
|
|
697
704
|
}
|
|
698
705
|
}
|
|
699
|
-
|
|
700
|
-
|
|
706
|
+
else {
|
|
707
|
+
// Create new development environment file
|
|
708
|
+
modifications.push({
|
|
709
|
+
filePath: envFile,
|
|
710
|
+
action: 'create',
|
|
711
|
+
content: `export const environment = {
|
|
712
|
+
production: false,
|
|
713
|
+
humanBehaviorApiKey: '${this.apiKey}'
|
|
714
|
+
};`,
|
|
715
|
+
description: 'Created Angular development environment file'
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
// Create or update production environment
|
|
719
|
+
if (fs__namespace.existsSync(envProdFile)) {
|
|
720
|
+
const content = fs__namespace.readFileSync(envProdFile, 'utf8');
|
|
721
|
+
if (!content.includes('humanBehaviorApiKey')) {
|
|
722
|
+
const modifiedContent = content.replace(/export const environment = {([\s\S]*?)};/, `export const environment = {
|
|
723
|
+
$1,
|
|
724
|
+
humanBehaviorApiKey: '${this.apiKey}'
|
|
725
|
+
};`);
|
|
726
|
+
modifications.push({
|
|
727
|
+
filePath: envProdFile,
|
|
728
|
+
action: 'modify',
|
|
729
|
+
content: modifiedContent,
|
|
730
|
+
description: 'Added API key to Angular production environment'
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
else {
|
|
735
|
+
// Create new production environment file
|
|
736
|
+
modifications.push({
|
|
737
|
+
filePath: envProdFile,
|
|
738
|
+
action: 'create',
|
|
739
|
+
content: `export const environment = {
|
|
740
|
+
production: true,
|
|
741
|
+
humanBehaviorApiKey: '${this.apiKey}'
|
|
742
|
+
};`,
|
|
743
|
+
description: 'Created Angular production environment file'
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
// For Angular, we don't need .env files since we use environment.ts
|
|
747
|
+
// The environment files are already created above
|
|
701
748
|
return modifications;
|
|
702
749
|
});
|
|
703
750
|
}
|
|
@@ -1115,16 +1162,15 @@ export default function App()`);
|
|
|
1115
1162
|
return content;
|
|
1116
1163
|
}
|
|
1117
1164
|
const importStatement = `import { initializeHumanBehavior } from 'humanbehavior-js/angular';`;
|
|
1118
|
-
|
|
1119
|
-
|
|
1165
|
+
const environmentImport = `import { environment } from './environments/environment';`;
|
|
1166
|
+
// Add imports at the top
|
|
1167
|
+
let modifiedContent = content.replace(/import.*from.*['"]@angular/, `${importStatement}\n${environmentImport}\n$&`);
|
|
1120
1168
|
// Add initialization after bootstrapApplication
|
|
1121
1169
|
modifiedContent = modifiedContent.replace(/(bootstrapApplication\([^}]+\}?\)(?:\s*\.catch[^;]+;)?)/, `$1
|
|
1122
1170
|
|
|
1123
1171
|
// Initialize HumanBehavior SDK (client-side only)
|
|
1124
1172
|
if (typeof window !== 'undefined') {
|
|
1125
|
-
const tracker = initializeHumanBehavior(
|
|
1126
|
-
'${this.apiKey}'
|
|
1127
|
-
);
|
|
1173
|
+
const tracker = initializeHumanBehavior(environment.humanBehaviorApiKey);
|
|
1128
1174
|
}`);
|
|
1129
1175
|
return modifiedContent;
|
|
1130
1176
|
}
|