zubbl-sdk 1.1.0 → 1.1.2

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.
@@ -21,24 +21,22 @@ async function identifyUser({ email, name }) {
21
21
  }
22
22
  if (!email) throw new Error("email is required");
23
23
 
24
- try {
25
- const headers = {
26
- "x-api-key": config.apiKey,
27
- "x-tenant-id": config.tenantId,
28
- "x-app-id": config.appId
29
- };
24
+ const headers = {
25
+ Authorization: `Bearer ${config.apiKey}`,
26
+ "X-Tenant-Id": config.tenantId,
27
+ "X-App-Id": config.appId
28
+ };
30
29
 
31
- // FIXED ROUTE:
30
+ try {
32
31
  const response = await axios.post(
33
32
  "https://api.zubbl.com/sdk/identify",
34
33
  { email, name },
35
34
  { headers }
36
35
  );
37
-
38
36
  console.log("[ZUBBL SDK] identifyUser response:", response.data);
39
37
  return response.data;
40
38
  } catch (err) {
41
- console.error("[ZUBBL SDK] identifyUser error:", err);
39
+ console.error("[ZUBBL SDK] identifyUser error:", err.response?.data || err);
42
40
  throw err;
43
41
  }
44
42
  }
@@ -49,22 +47,21 @@ async function getTiles({ external_user_id }) {
49
47
  }
50
48
  if (!external_user_id) throw new Error("external_user_id is required");
51
49
 
52
- try {
53
- const headers = {
54
- "x-api-key": config.apiKey,
55
- "x-tenant-id": config.tenantId,
56
- "x-app-id": config.appId
57
- };
50
+ const headers = {
51
+ Authorization: `Bearer ${config.apiKey}`,
52
+ "X-Tenant-Id": config.tenantId,
53
+ "X-App-Id": config.appId
54
+ };
58
55
 
56
+ try {
59
57
  const response = await axios.get(
60
58
  `https://api.zubbl.com/sdk/external-users/${external_user_id}/tiles`,
61
59
  { headers }
62
60
  );
63
-
64
61
  console.log("[ZUBBL SDK] getTiles response:", response.data);
65
- return response.data;
62
+ return response.data; // <- This is your final, merged tile set for the user
66
63
  } catch (err) {
67
- console.error("[ZUBBL SDK] getTiles error:", err);
64
+ console.error("[ZUBBL SDK] getTiles error:", err.response?.data || err);
68
65
  throw err;
69
66
  }
70
67
  }
@@ -19,24 +19,22 @@ async function identifyUser({ email, name }) {
19
19
  }
20
20
  if (!email) throw new Error("email is required");
21
21
 
22
- try {
23
- const headers = {
24
- "x-api-key": config.apiKey,
25
- "x-tenant-id": config.tenantId,
26
- "x-app-id": config.appId
27
- };
22
+ const headers = {
23
+ Authorization: `Bearer ${config.apiKey}`,
24
+ "X-Tenant-Id": config.tenantId,
25
+ "X-App-Id": config.appId
26
+ };
28
27
 
29
- // FIXED ROUTE:
28
+ try {
30
29
  const response = await axios.post(
31
30
  "https://api.zubbl.com/sdk/identify",
32
31
  { email, name },
33
32
  { headers }
34
33
  );
35
-
36
34
  console.log("[ZUBBL SDK] identifyUser response:", response.data);
37
35
  return response.data;
38
36
  } catch (err) {
39
- console.error("[ZUBBL SDK] identifyUser error:", err);
37
+ console.error("[ZUBBL SDK] identifyUser error:", err.response?.data || err);
40
38
  throw err;
41
39
  }
42
40
  }
@@ -47,22 +45,21 @@ async function getTiles({ external_user_id }) {
47
45
  }
48
46
  if (!external_user_id) throw new Error("external_user_id is required");
49
47
 
50
- try {
51
- const headers = {
52
- "x-api-key": config.apiKey,
53
- "x-tenant-id": config.tenantId,
54
- "x-app-id": config.appId
55
- };
48
+ const headers = {
49
+ Authorization: `Bearer ${config.apiKey}`,
50
+ "X-Tenant-Id": config.tenantId,
51
+ "X-App-Id": config.appId
52
+ };
56
53
 
54
+ try {
57
55
  const response = await axios.get(
58
56
  `https://api.zubbl.com/sdk/external-users/${external_user_id}/tiles`,
59
57
  { headers }
60
58
  );
61
-
62
59
  console.log("[ZUBBL SDK] getTiles response:", response.data);
63
- return response.data;
60
+ return response.data; // <- This is your final, merged tile set for the user
64
61
  } catch (err) {
65
- console.error("[ZUBBL SDK] getTiles error:", err);
62
+ console.error("[ZUBBL SDK] getTiles error:", err.response?.data || err);
66
63
  throw err;
67
64
  }
68
65
  }
@@ -23,24 +23,22 @@
23
23
  }
24
24
  if (!email) throw new Error("email is required");
25
25
 
26
- try {
27
- const headers = {
28
- "x-api-key": config.apiKey,
29
- "x-tenant-id": config.tenantId,
30
- "x-app-id": config.appId
31
- };
26
+ const headers = {
27
+ Authorization: `Bearer ${config.apiKey}`,
28
+ "X-Tenant-Id": config.tenantId,
29
+ "X-App-Id": config.appId
30
+ };
32
31
 
33
- // FIXED ROUTE:
32
+ try {
34
33
  const response = await axios.post(
35
34
  "https://api.zubbl.com/sdk/identify",
36
35
  { email, name },
37
36
  { headers }
38
37
  );
39
-
40
38
  console.log("[ZUBBL SDK] identifyUser response:", response.data);
41
39
  return response.data;
42
40
  } catch (err) {
43
- console.error("[ZUBBL SDK] identifyUser error:", err);
41
+ console.error("[ZUBBL SDK] identifyUser error:", err.response?.data || err);
44
42
  throw err;
45
43
  }
46
44
  }
@@ -51,22 +49,21 @@
51
49
  }
52
50
  if (!external_user_id) throw new Error("external_user_id is required");
53
51
 
54
- try {
55
- const headers = {
56
- "x-api-key": config.apiKey,
57
- "x-tenant-id": config.tenantId,
58
- "x-app-id": config.appId
59
- };
52
+ const headers = {
53
+ Authorization: `Bearer ${config.apiKey}`,
54
+ "X-Tenant-Id": config.tenantId,
55
+ "X-App-Id": config.appId
56
+ };
60
57
 
58
+ try {
61
59
  const response = await axios.get(
62
60
  `https://api.zubbl.com/sdk/external-users/${external_user_id}/tiles`,
63
61
  { headers }
64
62
  );
65
-
66
63
  console.log("[ZUBBL SDK] getTiles response:", response.data);
67
- return response.data;
64
+ return response.data; // <- This is your final, merged tile set for the user
68
65
  } catch (err) {
69
- console.error("[ZUBBL SDK] getTiles error:", err);
66
+ console.error("[ZUBBL SDK] getTiles error:", err.response?.data || err);
70
67
  throw err;
71
68
  }
72
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zubbl-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
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",