@staffbase/widget-sdk 3.4.0-beta.4 → 3.4.0-beta.5

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,29 @@
1
+ # [3.4.0-beta.5](https://github.com/Staffbase/widget-sdk/compare/3.4.0-beta.4...3.4.0-beta.5) (2022-01-21)
2
+
3
+
4
+ ### Code Refactoring
5
+
6
+ * remove unused import ([5887ace](https://github.com/Staffbase/widget-sdk/commit/5887ace86935f8078b97f33a976ae11a1e26ef58))
7
+
8
+
9
+ ### Documentation
10
+
11
+ * fix documentation ([2844477](https://github.com/Staffbase/widget-sdk/commit/2844477028de22386759e13a8c154480a3096aeb))
12
+
13
+
14
+ ### Features
15
+
16
+ * add integration state enum ([5c3f4cd](https://github.com/Staffbase/widget-sdk/commit/5c3f4cd836bd96eb2a5615aba0d0d295ff0bf16d))
17
+ * change type signature ([fff78ca](https://github.com/Staffbase/widget-sdk/commit/fff78ca2be153bc06f4d14c5c913650e7ed85f76))
18
+ * extend integration api ([ab53de9](https://github.com/Staffbase/widget-sdk/commit/ab53de9e78f92a09b54cc712fd83bcc948e7e62c))
19
+ * extend integration api ([be172b6](https://github.com/Staffbase/widget-sdk/commit/be172b6809bbe4dfba40e4d24fb5f7b9b420308a))
20
+ * harden return type, add refresh argument ([42719ac](https://github.com/Staffbase/widget-sdk/commit/42719ac56aff63016498b9e3f8d862f07bd5ad52))
21
+
22
+
23
+ ### Miscellaneous
24
+
25
+ * Merge branch 'NFS-1519-add-integrations' into beta ([f13d1f4](https://github.com/Staffbase/widget-sdk/commit/f13d1f494b5402a1c37e5aa35fb7fce1e0043499))
26
+
1
27
  # [3.4.0-beta.4](https://github.com/Staffbase/widget-sdk/compare/3.4.0-beta.3...3.4.0-beta.4) (2021-11-23)
2
28
 
3
29
 
@@ -198,3 +198,28 @@ export interface IntegrationToken {
198
198
  // date when the access token expires
199
199
  accessTokenExpiresAt?: Date;
200
200
  }
201
+
202
+ /**
203
+ * All available states the integration can take
204
+ */
205
+ export enum IntegrationState {
206
+ UNAVAILABLE = 'unavailable',
207
+ AVAILABLE = 'available',
208
+ LOGGED_OUT = 'loggedOut',
209
+ }
210
+
211
+ /**
212
+ * Information about the requested Integration target
213
+ */
214
+ export interface IntegrationInformation {
215
+ // The status of the integration
216
+ status: IntegrationState
217
+ // All features enabled for the current slug
218
+ enabledFeatures: string[],
219
+ // All features supported by the integration
220
+ supportedFeatures: string[],
221
+ // The integration token
222
+ token?: IntegrationToken,
223
+ // A function to trigger the sign-in flow of the integration
224
+ signIn?: () => void
225
+ }
package/lib/widget-api.ts CHANGED
@@ -11,7 +11,7 @@
11
11
  * limitations under the License.
12
12
  */
13
13
 
14
- import { ColorTheme, IntegrationToken, IntegrationType, SBUserProfile, UserListRequestQuery, UserListResponse } from './widget-api-types';
14
+ import { ColorTheme, IntegrationInformation, IntegrationType, SBUserProfile, UserListRequestQuery, UserListResponse } from './widget-api-types';
15
15
 
16
16
 
17
17
  /**
@@ -55,14 +55,21 @@ export interface WidgetApi {
55
55
  */
56
56
  getUserList(query: UserListRequestQuery): Promise<UserListResponse>;
57
57
 
58
-
59
58
  /**
60
59
  * Call to retrieve a valid token to access the Microsoft API. Includes a time value to
61
60
  * refresh the token.
62
61
  *
63
62
  * @param type The name of the integration. ("ms365")
64
- * @returns A promise containing the IntegrationToken is returned. If the user session is
65
- * not existing, null is returned. In case of an error, the promise is rejected.
63
+ * @param refresh Force a refresh of the integration.
64
+ *
65
+ * @returns A promise containing the IntegrationInformation is returned. If the user session is
66
+ * not existing, the status is set to 'loggedOut' and the token is null. Additionally if the
67
+ * integration is not configured the status returns 'unavailable'.
68
+ *
69
+ * In case of an error, the promise is rejected.
70
+ *
71
+ * @deprecated Returns a IntegrationToken or null if the user is not logged in. This will be replaced
72
+ * completely by the IntegrationInformation, containing the token.
66
73
  */
67
- getIntegration(type: IntegrationType): Promise<IntegrationToken | null>;
74
+ getIntegration(type: IntegrationType, refresh?: boolean): Promise<IntegrationInformation>;
68
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staffbase/widget-sdk",
3
- "version": "3.4.0-beta.4",
3
+ "version": "3.4.0-beta.5",
4
4
  "description": "Staffbase SDK for Custom Widgets",
5
5
  "keywords": [
6
6
  "web-components"