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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "humanbehavior-js",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "SDK for HumanBehavior session and event recording",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
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
- 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
- });
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
- if (!response.ok) {
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
- const responseJson = await response.json();
70
+ const responseJson = await response.json();
71
71
  console.log('API init success:', responseJson);
72
- return {
73
- sessionId: responseJson.sessionId,
74
- endUserId: responseJson.endUserId
72
+ return {
73
+ sessionId: responseJson.sessionId,
74
+ endUserId: responseJson.endUserId
75
75
  }
76
76
  } catch (error) {
77
77
  console.error('API init error:', error);
@@ -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
- process.env.NEXT_PUBLIC_INGESTION_URL || 'https://ingestion.humanbehavior.ai'
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