zubbl-sdk 1.1.1 → 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,20 +21,18 @@ async function identifyUser({ email, name }) {
21
21
  }
22
22
  if (!email) throw new Error("email is required");
23
23
 
24
- try {
25
- // Correct: send Authorization header as Bearer
26
- const headers = {
27
- Authorization: `Bearer ${config.apiKey}`,
28
- "X-Tenant-Id": config.tenantId,
29
- "X-App-Id": config.appId
30
- };
24
+ const headers = {
25
+ Authorization: `Bearer ${config.apiKey}`,
26
+ "X-Tenant-Id": config.tenantId,
27
+ "X-App-Id": config.appId
28
+ };
31
29
 
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) {
@@ -49,20 +47,19 @@ 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
- Authorization: `Bearer ${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
64
  console.error("[ZUBBL SDK] getTiles error:", err.response?.data || err);
68
65
  throw err;
@@ -19,20 +19,18 @@ async function identifyUser({ email, name }) {
19
19
  }
20
20
  if (!email) throw new Error("email is required");
21
21
 
22
- try {
23
- // Correct: send Authorization header as Bearer
24
- const headers = {
25
- Authorization: `Bearer ${config.apiKey}`,
26
- "X-Tenant-Id": config.tenantId,
27
- "X-App-Id": config.appId
28
- };
22
+ const headers = {
23
+ Authorization: `Bearer ${config.apiKey}`,
24
+ "X-Tenant-Id": config.tenantId,
25
+ "X-App-Id": config.appId
26
+ };
29
27
 
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) {
@@ -47,20 +45,19 @@ 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
- Authorization: `Bearer ${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
62
  console.error("[ZUBBL SDK] getTiles error:", err.response?.data || err);
66
63
  throw err;
@@ -23,20 +23,18 @@
23
23
  }
24
24
  if (!email) throw new Error("email is required");
25
25
 
26
- try {
27
- // Correct: send Authorization header as Bearer
28
- const headers = {
29
- Authorization: `Bearer ${config.apiKey}`,
30
- "X-Tenant-Id": config.tenantId,
31
- "X-App-Id": config.appId
32
- };
26
+ const headers = {
27
+ Authorization: `Bearer ${config.apiKey}`,
28
+ "X-Tenant-Id": config.tenantId,
29
+ "X-App-Id": config.appId
30
+ };
33
31
 
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) {
@@ -51,20 +49,19 @@
51
49
  }
52
50
  if (!external_user_id) throw new Error("external_user_id is required");
53
51
 
54
- try {
55
- const headers = {
56
- Authorization: `Bearer ${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
66
  console.error("[ZUBBL SDK] getTiles error:", err.response?.data || err);
70
67
  throw err;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zubbl-sdk",
3
- "version": "1.1.1",
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",