@cobaltio/cobalt-js 5.0.1 → 5.1.0

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.
Files changed (2) hide show
  1. package/cobalt.js +20 -0
  2. package/package.json +1 -1
package/cobalt.js CHANGED
@@ -74,6 +74,26 @@ class Cobalt {
74
74
  return this.sessionToken = typeof token === "string" ? token : "";
75
75
  };
76
76
 
77
+ /**
78
+ * Returns the org & customer details for the associated token.
79
+ * @private
80
+ * @returns {Promise<unknown>}
81
+ */
82
+ async getAccountDetails() {
83
+ const res = await fetch(`${this.baseUrl}/api/v3/org/basics`, {
84
+ headers: {
85
+ authorization: `Bearer ${this.token}`,
86
+ },
87
+ });
88
+
89
+ if (res.status >= 400 && res.status < 600) {
90
+ throw new Error(res.statusText);
91
+ }
92
+
93
+ const data = await res.json();
94
+ return data;
95
+ }
96
+
77
97
  /**
78
98
  * Returns the application details for the specified application, provided
79
99
  * the application is enabled in Cobalt. If no application is specified,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobaltio/cobalt-js",
3
- "version": "5.0.1",
3
+ "version": "5.1.0",
4
4
  "description": "Cobalt frontend SDK",
5
5
  "main": "./cobalt.js",
6
6
  "scripts": {