zubbl-sdk 1.1.0 → 1.1.1

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.
@@ -22,13 +22,13 @@ async function identifyUser({ email, name }) {
22
22
  if (!email) throw new Error("email is required");
23
23
 
24
24
  try {
25
+ // Correct: send Authorization header as Bearer
25
26
  const headers = {
26
- "x-api-key": config.apiKey,
27
- "x-tenant-id": config.tenantId,
28
- "x-app-id": config.appId
27
+ Authorization: `Bearer ${config.apiKey}`,
28
+ "X-Tenant-Id": config.tenantId,
29
+ "X-App-Id": config.appId
29
30
  };
30
31
 
31
- // FIXED ROUTE:
32
32
  const response = await axios.post(
33
33
  "https://api.zubbl.com/sdk/identify",
34
34
  { email, name },
@@ -38,7 +38,7 @@ async function identifyUser({ email, name }) {
38
38
  console.log("[ZUBBL SDK] identifyUser response:", response.data);
39
39
  return response.data;
40
40
  } catch (err) {
41
- console.error("[ZUBBL SDK] identifyUser error:", err);
41
+ console.error("[ZUBBL SDK] identifyUser error:", err.response?.data || err);
42
42
  throw err;
43
43
  }
44
44
  }
@@ -51,9 +51,9 @@ async function getTiles({ external_user_id }) {
51
51
 
52
52
  try {
53
53
  const headers = {
54
- "x-api-key": config.apiKey,
55
- "x-tenant-id": config.tenantId,
56
- "x-app-id": config.appId
54
+ Authorization: `Bearer ${config.apiKey}`,
55
+ "X-Tenant-Id": config.tenantId,
56
+ "X-App-Id": config.appId
57
57
  };
58
58
 
59
59
  const response = await axios.get(
@@ -64,7 +64,7 @@ async function getTiles({ external_user_id }) {
64
64
  console.log("[ZUBBL SDK] getTiles response:", response.data);
65
65
  return response.data;
66
66
  } catch (err) {
67
- console.error("[ZUBBL SDK] getTiles error:", err);
67
+ console.error("[ZUBBL SDK] getTiles error:", err.response?.data || err);
68
68
  throw err;
69
69
  }
70
70
  }
@@ -20,13 +20,13 @@ async function identifyUser({ email, name }) {
20
20
  if (!email) throw new Error("email is required");
21
21
 
22
22
  try {
23
+ // Correct: send Authorization header as Bearer
23
24
  const headers = {
24
- "x-api-key": config.apiKey,
25
- "x-tenant-id": config.tenantId,
26
- "x-app-id": config.appId
25
+ Authorization: `Bearer ${config.apiKey}`,
26
+ "X-Tenant-Id": config.tenantId,
27
+ "X-App-Id": config.appId
27
28
  };
28
29
 
29
- // FIXED ROUTE:
30
30
  const response = await axios.post(
31
31
  "https://api.zubbl.com/sdk/identify",
32
32
  { email, name },
@@ -36,7 +36,7 @@ async function identifyUser({ email, name }) {
36
36
  console.log("[ZUBBL SDK] identifyUser response:", response.data);
37
37
  return response.data;
38
38
  } catch (err) {
39
- console.error("[ZUBBL SDK] identifyUser error:", err);
39
+ console.error("[ZUBBL SDK] identifyUser error:", err.response?.data || err);
40
40
  throw err;
41
41
  }
42
42
  }
@@ -49,9 +49,9 @@ async function getTiles({ external_user_id }) {
49
49
 
50
50
  try {
51
51
  const headers = {
52
- "x-api-key": config.apiKey,
53
- "x-tenant-id": config.tenantId,
54
- "x-app-id": config.appId
52
+ Authorization: `Bearer ${config.apiKey}`,
53
+ "X-Tenant-Id": config.tenantId,
54
+ "X-App-Id": config.appId
55
55
  };
56
56
 
57
57
  const response = await axios.get(
@@ -62,7 +62,7 @@ async function getTiles({ external_user_id }) {
62
62
  console.log("[ZUBBL SDK] getTiles response:", response.data);
63
63
  return response.data;
64
64
  } catch (err) {
65
- console.error("[ZUBBL SDK] getTiles error:", err);
65
+ console.error("[ZUBBL SDK] getTiles error:", err.response?.data || err);
66
66
  throw err;
67
67
  }
68
68
  }
@@ -24,13 +24,13 @@
24
24
  if (!email) throw new Error("email is required");
25
25
 
26
26
  try {
27
+ // Correct: send Authorization header as Bearer
27
28
  const headers = {
28
- "x-api-key": config.apiKey,
29
- "x-tenant-id": config.tenantId,
30
- "x-app-id": config.appId
29
+ Authorization: `Bearer ${config.apiKey}`,
30
+ "X-Tenant-Id": config.tenantId,
31
+ "X-App-Id": config.appId
31
32
  };
32
33
 
33
- // FIXED ROUTE:
34
34
  const response = await axios.post(
35
35
  "https://api.zubbl.com/sdk/identify",
36
36
  { email, name },
@@ -40,7 +40,7 @@
40
40
  console.log("[ZUBBL SDK] identifyUser response:", response.data);
41
41
  return response.data;
42
42
  } catch (err) {
43
- console.error("[ZUBBL SDK] identifyUser error:", err);
43
+ console.error("[ZUBBL SDK] identifyUser error:", err.response?.data || err);
44
44
  throw err;
45
45
  }
46
46
  }
@@ -53,9 +53,9 @@
53
53
 
54
54
  try {
55
55
  const headers = {
56
- "x-api-key": config.apiKey,
57
- "x-tenant-id": config.tenantId,
58
- "x-app-id": config.appId
56
+ Authorization: `Bearer ${config.apiKey}`,
57
+ "X-Tenant-Id": config.tenantId,
58
+ "X-App-Id": config.appId
59
59
  };
60
60
 
61
61
  const response = await axios.get(
@@ -66,7 +66,7 @@
66
66
  console.log("[ZUBBL SDK] getTiles response:", response.data);
67
67
  return response.data;
68
68
  } catch (err) {
69
- console.error("[ZUBBL SDK] getTiles error:", err);
69
+ console.error("[ZUBBL SDK] getTiles error:", err.response?.data || err);
70
70
  throw err;
71
71
  }
72
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zubbl-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Zubbl SDK for secure policy enforcement (browser, Node, universal)",
5
5
  "main": "dist/zubbl-sdk.cjs.js",
6
6
  "module": "dist/zubbl-sdk.esm.js",