zubbl-sdk 1.0.7 → 1.0.9

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