@microsoft/rayfin-auth-provider-fabric 1.33.2 → 1.34.0-alpha.1148

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.
@@ -26,9 +26,41 @@ import type { FabricAuthOptions } from './types.js';
26
26
  * Steps 1–3 do not open windows and are safe to call on page load.
27
27
  *
28
28
  * @param auth - The Auth instance.
29
- * @param options - Fabric authentication options (workspaceId, projectId, returnOrigin).
29
+ * @param options - Fabric authentication options (workspaceId, projectId, fabricPortalUrl, returnOrigin).
30
30
  * @returns A promise that resolves with the authenticated session.
31
31
  * @throws `AuthError` - If all steps fail or the broker tab is blocked.
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * import { Auth } from '@microsoft/rayfin-auth';
36
+ * import { ApiClient } from '@microsoft/rayfin-lib';
37
+ * import {
38
+ * ensureSignedInWithFabric,
39
+ * type FabricAuthOptions,
40
+ * } from '@microsoft/rayfin-auth-provider-fabric';
41
+ *
42
+ * const apiClient = new ApiClient({
43
+ * baseUrl: import.meta.env.VITE_RAYFIN_API_URL,
44
+ * publishableKey: import.meta.env.VITE_RAYFIN_PUBLISHABLE_KEY,
45
+ * });
46
+ * const auth = new Auth(apiClient);
47
+ * const fabricOptions: FabricAuthOptions = {
48
+ * workspaceId: import.meta.env.VITE_FABRIC_WORKSPACE_ID,
49
+ * projectId: import.meta.env.VITE_FABRIC_ITEM_ID,
50
+ * fabricPortalUrl: import.meta.env.VITE_FABRIC_PORTAL_URL,
51
+ * returnOrigin: window.location.origin,
52
+ * };
53
+ *
54
+ * // Wire to a button click so step 4 (window.open) is in a user-gesture context.
55
+ * signInButton.addEventListener('click', async () => {
56
+ * try {
57
+ * const session = await ensureSignedInWithFabric(auth, fabricOptions);
58
+ * console.log('Signed in as', session.user?.email);
59
+ * } catch (error) {
60
+ * console.error('Fabric sign-in failed:', error.message);
61
+ * }
62
+ * });
63
+ * ```
32
64
  */
33
65
  export declare function ensureSignedInWithFabric(auth: Auth, options: FabricAuthOptions): Promise<OpaqueSession>;
34
66
  //# sourceMappingURL=ensureSignedInWithFabric.d.ts.map
@@ -28,9 +28,41 @@ import { initiateFabricLogin } from './initiateFabricLogin.js';
28
28
  * Steps 1–3 do not open windows and are safe to call on page load.
29
29
  *
30
30
  * @param auth - The Auth instance.
31
- * @param options - Fabric authentication options (workspaceId, projectId, returnOrigin).
31
+ * @param options - Fabric authentication options (workspaceId, projectId, fabricPortalUrl, returnOrigin).
32
32
  * @returns A promise that resolves with the authenticated session.
33
33
  * @throws `AuthError` - If all steps fail or the broker tab is blocked.
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * import { Auth } from '@microsoft/rayfin-auth';
38
+ * import { ApiClient } from '@microsoft/rayfin-lib';
39
+ * import {
40
+ * ensureSignedInWithFabric,
41
+ * type FabricAuthOptions,
42
+ * } from '@microsoft/rayfin-auth-provider-fabric';
43
+ *
44
+ * const apiClient = new ApiClient({
45
+ * baseUrl: import.meta.env.VITE_RAYFIN_API_URL,
46
+ * publishableKey: import.meta.env.VITE_RAYFIN_PUBLISHABLE_KEY,
47
+ * });
48
+ * const auth = new Auth(apiClient);
49
+ * const fabricOptions: FabricAuthOptions = {
50
+ * workspaceId: import.meta.env.VITE_FABRIC_WORKSPACE_ID,
51
+ * projectId: import.meta.env.VITE_FABRIC_ITEM_ID,
52
+ * fabricPortalUrl: import.meta.env.VITE_FABRIC_PORTAL_URL,
53
+ * returnOrigin: window.location.origin,
54
+ * };
55
+ *
56
+ * // Wire to a button click so step 4 (window.open) is in a user-gesture context.
57
+ * signInButton.addEventListener('click', async () => {
58
+ * try {
59
+ * const session = await ensureSignedInWithFabric(auth, fabricOptions);
60
+ * console.log('Signed in as', session.user?.email);
61
+ * } catch (error) {
62
+ * console.error('Fabric sign-in failed:', error.message);
63
+ * }
64
+ * });
65
+ * ```
34
66
  */
35
67
  export async function ensureSignedInWithFabric(auth, options) {
36
68
  // Steps 1-2: existing session or refresh.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/rayfin-auth-provider-fabric",
3
- "version": "1.33.2",
3
+ "version": "1.34.0-alpha.1148",
4
4
  "description": "Fabric brokered authentication provider for Rayfin SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,9 +13,9 @@
13
13
  ],
14
14
  "type": "module",
15
15
  "dependencies": {
16
- "@microsoft/rayfin-auth": "1.33.2",
17
- "@microsoft/fabric-embedded-host": "1.33.2",
18
- "@microsoft/rayfin-lib": "1.33.2"
16
+ "@microsoft/rayfin-auth": "1.34.0-alpha.1148",
17
+ "@microsoft/fabric-embedded-host": "1.34.0-alpha.1148",
18
+ "@microsoft/rayfin-lib": "1.34.0-alpha.1148"
19
19
  },
20
20
  "devDependencies": {
21
21
  "typescript": "^5.8.3",