Skip to content

feat(client-presence): promote to beta #24710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/fluffy-donkeys-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@fluidframework/presence": minor
"__section": feature
---
Presence now available at beta support

Importing via `@fluidframework/presence/beta` is now supported.

Note: `Notifications` support remains only supported via `/alpha` imports. Cast `Presence` to `PresenceWithNotifications` to access notifications only workspace support.
2 changes: 1 addition & 1 deletion docs/docs/build/presence.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Notifications are special case where no data is retained during a session and al
To access Presence APIs, use `getPresence()` with any `IFluidContainer`.

```typescript
import { getPresence } from "@fluidframework/presence/alpha";
import { getPresence } from "@fluidframework/presence/beta";

function usePresence(container: IFluidContainer): void {
const presence = await getPresence(container);
Expand Down
2 changes: 1 addition & 1 deletion examples/apps/ai-collab/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"use client";

import { getPresence } from "@fluidframework/presence/alpha";
import { getPresence } from "@fluidframework/presence/beta";
import {
Box,
Button,
Expand Down
2 changes: 1 addition & 1 deletion examples/apps/ai-collab/src/app/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
type Attendee,
type StatesWorkspace,
type StatesWorkspaceSchema,
} from "@fluidframework/presence/alpha";
} from "@fluidframework/presence/beta";

import { getProfilePhoto } from "@/infra/authHelper";

Expand Down
4 changes: 2 additions & 2 deletions examples/apps/presence-tracker/src/FocusTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import type {
LatestRaw,
Presence,
StatesWorkspace,
} from "@fluidframework/presence/alpha";
import { AttendeeStatus, StateFactory } from "@fluidframework/presence/alpha";
} from "@fluidframework/presence/beta";
import { AttendeeStatus, StateFactory } from "@fluidframework/presence/beta";

/**
* IFocusState is the data that individual session clients share via presence.
Expand Down
4 changes: 2 additions & 2 deletions examples/apps/presence-tracker/src/MouseTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import type {
Attendee,
LatestRaw,
StatesWorkspace,
} from "@fluidframework/presence/alpha";
import { AttendeeStatus, StateFactory } from "@fluidframework/presence/alpha";
} from "@fluidframework/presence/beta";
import { AttendeeStatus, StateFactory } from "@fluidframework/presence/beta";

/**
* IMousePosition is the data that individual session clients share via presence.
Expand Down
10 changes: 8 additions & 2 deletions examples/apps/presence-tracker/src/reactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
*/

import { Notifications } from "@fluidframework/presence/alpha";
import type { Attendee, Presence } from "@fluidframework/presence/alpha";
import type {
Attendee,
Presence,
PresenceWithNotifications,
} from "@fluidframework/presence/alpha";

import type { IMousePosition, MouseTracker } from "./MouseTracker.js";

Expand All @@ -17,7 +21,9 @@ export function initializeReactions(presence: Presence, mouseTracker: MouseTrack
// Create a notifications workspace to send reactions-related notifications. This workspace will be created if it
// doesn't exist. We also create a NotificationsManager. You can also
// add presence objects to the workspace later.
const notificationsWorkspace = presence.notifications.getWorkspace(
const notificationsWorkspace = (
presence as PresenceWithNotifications
).notifications.getWorkspace(
// A unique key identifying this workspace.
"name:reactions",
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "@fluidframework/azure-client";
import { createDevtoolsLogger, initializeDevtools } from "@fluidframework/devtools/beta";
import { ISharedMap, IValueChanged, SharedMap } from "@fluidframework/map/legacy";
import { getPresence } from "@fluidframework/presence/alpha";
import { getPresence } from "@fluidframework/presence/beta";
import { createChildLogger } from "@fluidframework/telemetry-utils/legacy";
// eslint-disable-next-line import/no-internal-modules -- #26985: `test-runtime-utils` internal used in example
import { InsecureTokenProvider } from "@fluidframework/test-runtime-utils/internal";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
StateFactory,
type StatesWorkspace,
type StatesWorkspaceSchema,
} from "@fluidframework/presence/alpha";
} from "@fluidframework/presence/beta";

import type { DieValue } from "./controller.js";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { AzureMember, IAzureAudience } from "@fluidframework/azure-client";
import type { LatestRaw, Presence } from "@fluidframework/presence/alpha";
import type { LatestRaw, Presence } from "@fluidframework/presence/beta";

import { ICustomUserDetails } from "./app.js";
import { IDiceRollerController } from "./controller.js";
Expand Down
1 change: 1 addition & 0 deletions packages/framework/presence/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = {
"@fluidframework/*/internal{,/**}",
"*/index.js",
"@fluidframework/presence/alpha",
"@fluidframework/presence/beta",
],
},
],
Expand Down
16 changes: 6 additions & 10 deletions packages/framework/presence/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ For more information on the related support guarantees, see [API Support Levels]

To access the `public` ([SemVer](https://semver.org/)) APIs, import via `@fluidframework/presence` like normal.

To access the `beta` APIs, import via `@fluidframework/presence/beta`.

To access the `alpha` APIs, import via `@fluidframework/presence/alpha`.

## API Documentation
Expand Down Expand Up @@ -80,21 +82,15 @@ Notifications are special case where no data is retained during a session and al

## Onboarding

While this package is developing and other Fluid Framework internals are being updated to accommodate it, a temporary Shared Object must be added within container to gain access.
To access Presence APIs, use `getPresence()` with any `IFluidContainer`.

```typescript
import { getPresenceViaDataObject, ExperimentalPresenceManager } from "@fluidframework/presence/alpha";

const containerSchema = {
initialObjects: {
presence: ExperimentalPresenceManager
}
} satisfies ContainerSchema;
import { getPresence } from "@fluidframework/presence/beta";

const presence = await getPresenceViaDataObject(container.initialObjects.presence);
function usePresence(container: IFluidContainer): void {
const presence = await getPresence(container);
```


## Limitations

### States Reliability
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
"mainEntryPointFilePath": "<projectFolder>/dist/beta.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
"mainEntryPointFilePath": "<projectFolder>/lib/beta.d.ts"
}
Loading
Loading