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
package/dist/esm/wizard/index.js
CHANGED
|
@@ -655,25 +655,72 @@ export default defineNuxtPlugin(() => {
|
|
|
655
655
|
description: 'Added HumanBehaviorModule to Angular app'
|
|
656
656
|
});
|
|
657
657
|
}
|
|
658
|
-
// Handle Angular environment
|
|
658
|
+
// Handle Angular environment files (proper Angular way)
|
|
659
659
|
const envFile = path.join(this.projectRoot, 'src', 'environments', 'environment.ts');
|
|
660
|
+
const envProdFile = path.join(this.projectRoot, 'src', 'environments', 'environment.prod.ts');
|
|
661
|
+
// Create environments directory if it doesn't exist
|
|
662
|
+
const envDir = path.dirname(envFile);
|
|
663
|
+
if (!fs.existsSync(envDir)) {
|
|
664
|
+
fs.mkdirSync(envDir, { recursive: true });
|
|
665
|
+
}
|
|
666
|
+
// Create or update development environment
|
|
660
667
|
if (fs.existsSync(envFile)) {
|
|
661
668
|
const content = fs.readFileSync(envFile, 'utf8');
|
|
662
669
|
if (!content.includes('humanBehaviorApiKey')) {
|
|
663
670
|
const modifiedContent = content.replace(/export const environment = {([\s\S]*?)};/, `export const environment = {
|
|
664
671
|
$1,
|
|
665
|
-
humanBehaviorApiKey:
|
|
672
|
+
humanBehaviorApiKey: '${this.apiKey}'
|
|
666
673
|
};`);
|
|
667
674
|
modifications.push({
|
|
668
675
|
filePath: envFile,
|
|
669
676
|
action: 'modify',
|
|
670
677
|
content: modifiedContent,
|
|
671
|
-
description: 'Added API key to Angular environment'
|
|
678
|
+
description: 'Added API key to Angular development environment'
|
|
672
679
|
});
|
|
673
680
|
}
|
|
674
681
|
}
|
|
675
|
-
|
|
676
|
-
|
|
682
|
+
else {
|
|
683
|
+
// Create new development environment file
|
|
684
|
+
modifications.push({
|
|
685
|
+
filePath: envFile,
|
|
686
|
+
action: 'create',
|
|
687
|
+
content: `export const environment = {
|
|
688
|
+
production: false,
|
|
689
|
+
humanBehaviorApiKey: '${this.apiKey}'
|
|
690
|
+
};`,
|
|
691
|
+
description: 'Created Angular development environment file'
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
// Create or update production environment
|
|
695
|
+
if (fs.existsSync(envProdFile)) {
|
|
696
|
+
const content = fs.readFileSync(envProdFile, 'utf8');
|
|
697
|
+
if (!content.includes('humanBehaviorApiKey')) {
|
|
698
|
+
const modifiedContent = content.replace(/export const environment = {([\s\S]*?)};/, `export const environment = {
|
|
699
|
+
$1,
|
|
700
|
+
humanBehaviorApiKey: '${this.apiKey}'
|
|
701
|
+
};`);
|
|
702
|
+
modifications.push({
|
|
703
|
+
filePath: envProdFile,
|
|
704
|
+
action: 'modify',
|
|
705
|
+
content: modifiedContent,
|
|
706
|
+
description: 'Added API key to Angular production environment'
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
else {
|
|
711
|
+
// Create new production environment file
|
|
712
|
+
modifications.push({
|
|
713
|
+
filePath: envProdFile,
|
|
714
|
+
action: 'create',
|
|
715
|
+
content: `export const environment = {
|
|
716
|
+
production: true,
|
|
717
|
+
humanBehaviorApiKey: '${this.apiKey}'
|
|
718
|
+
};`,
|
|
719
|
+
description: 'Created Angular production environment file'
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
// For Angular, we don't need .env files since we use environment.ts
|
|
723
|
+
// The environment files are already created above
|
|
677
724
|
return modifications;
|
|
678
725
|
});
|
|
679
726
|
}
|
|
@@ -1091,16 +1138,15 @@ export default function App()`);
|
|
|
1091
1138
|
return content;
|
|
1092
1139
|
}
|
|
1093
1140
|
const importStatement = `import { initializeHumanBehavior } from 'humanbehavior-js/angular';`;
|
|
1094
|
-
|
|
1095
|
-
|
|
1141
|
+
const environmentImport = `import { environment } from './environments/environment';`;
|
|
1142
|
+
// Add imports at the top
|
|
1143
|
+
let modifiedContent = content.replace(/import.*from.*['"]@angular/, `${importStatement}\n${environmentImport}\n$&`);
|
|
1096
1144
|
// Add initialization after bootstrapApplication
|
|
1097
1145
|
modifiedContent = modifiedContent.replace(/(bootstrapApplication\([^}]+\}?\)(?:\s*\.catch[^;]+;)?)/, `$1
|
|
1098
1146
|
|
|
1099
1147
|
// Initialize HumanBehavior SDK (client-side only)
|
|
1100
1148
|
if (typeof window !== 'undefined') {
|
|
1101
|
-
const tracker = initializeHumanBehavior(
|
|
1102
|
-
'${this.apiKey}'
|
|
1103
|
-
);
|
|
1149
|
+
const tracker = initializeHumanBehavior(environment.humanBehaviorApiKey);
|
|
1104
1150
|
}`);
|
|
1105
1151
|
return modifiedContent;
|
|
1106
1152
|
}
|