humanbehavior-js 0.1.4 → 0.1.6
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/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/react/index.js +1 -1
- package/dist/cjs/react/index.js.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react/index.js +1 -1
- package/dist/esm/react/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +20 -20
- package/src/react/index.tsx +1 -1
- package/src/tracker.ts +2 -1
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -44,34 +44,34 @@ export class HumanBehaviorAPI {
|
|
|
44
44
|
console.log('API init called with:', { sessionId, userId, entryURL, referrer, baseUrl: this.baseUrl });
|
|
45
45
|
|
|
46
46
|
try {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
const response = await fetch(`${this.baseUrl}/api/ingestion/init`, {
|
|
48
|
+
method: 'POST',
|
|
49
|
+
headers: {
|
|
50
|
+
'Content-Type': 'application/json',
|
|
51
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
52
|
+
'Referer': referrer || ''
|
|
53
|
+
},
|
|
54
|
+
body: JSON.stringify({
|
|
55
|
+
sessionId: sessionId,
|
|
56
|
+
endUserId: userId,
|
|
57
|
+
entryURL: entryURL,
|
|
58
|
+
referrer: referrer
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
61
|
|
|
62
62
|
console.log('API init response status:', response.status);
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
if (!response.ok) {
|
|
65
65
|
const errorText = await response.text();
|
|
66
66
|
console.error('API init failed:', response.status, errorText);
|
|
67
67
|
throw new Error(`Failed to initialize ingestion: ${response.statusText} - ${errorText}`);
|
|
68
|
-
|
|
68
|
+
}
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
const responseJson = await response.json();
|
|
71
71
|
console.log('API init success:', responseJson);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
return {
|
|
73
|
+
sessionId: responseJson.sessionId,
|
|
74
|
+
endUserId: responseJson.endUserId
|
|
75
75
|
}
|
|
76
76
|
} catch (error) {
|
|
77
77
|
console.error('API init error:', error);
|
package/src/react/index.tsx
CHANGED
|
@@ -108,7 +108,7 @@ export const HumanBehaviorProvider = ({ apiKey, client, children, options }: Hum
|
|
|
108
108
|
// Create new tracker instance with the validated apiKey
|
|
109
109
|
const tracker = new HumanBehaviorTracker(
|
|
110
110
|
apiKeyRef.current.trim(),
|
|
111
|
-
|
|
111
|
+
'https://ingest.humanbehavior.co'
|
|
112
112
|
);
|
|
113
113
|
setHumanBehavior(tracker);
|
|
114
114
|
|
package/src/tracker.ts
CHANGED
|
@@ -115,7 +115,8 @@ export class HumanBehaviorTracker {
|
|
|
115
115
|
|
|
116
116
|
// Initialize API
|
|
117
117
|
//const defaultIngestionUrl = 'http://3.137.217.33:3000'; // AWS Development Server
|
|
118
|
-
const defaultIngestionUrl = 'http://ingestion-server-alb-1823866402.us-east-2.elb.amazonaws.com'; // ALB
|
|
118
|
+
//const defaultIngestionUrl = 'http://ingestion-server-alb-1823866402.us-east-2.elb.amazonaws.com'; // ALB
|
|
119
|
+
const defaultIngestionUrl = 'https://ingest.humanbehavior.co'; // HTTPS ALB
|
|
119
120
|
this.api = new HumanBehaviorAPI({
|
|
120
121
|
apiKey: apiKey,
|
|
121
122
|
ingestionUrl: ingestionUrl || defaultIngestionUrl
|