Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c48bb6b
Add room data support for UIKit view interactions
Copilot Mar 18, 2026
c8f158c
Add rid to modal UIKit interactions when room context is available
Copilot Mar 19, 2026
4bef881
Track rid in ActionManager and pass to modals via props
Copilot Mar 19, 2026
68e99e8
Revert modal changes
d-gubert Mar 19, 2026
7167868
refactor uikit endpoint
d-gubert Mar 19, 2026
cdc2a28
add changeset
d-gubert Mar 23, 2026
6c51739
Add UIKit room context test app and E2E tests
Copilot Mar 23, 2026
7a6f107
Address code review: improve type safety in test file
Copilot Mar 23, 2026
73ea5e8
docs: add UIKit room test app documentation to README
Copilot Mar 23, 2026
d2ecfeb
fix(uikit): fix prettier lint error in uikit-room-context.ts
Copilot Mar 23, 2026
9c6333a
test: add fixture helper and scaffold for ui test
d-gubert Mar 24, 2026
e7b9d17
test(uikit): implement Playwright e2e tests for UIKit interactions
Copilot Mar 24, 2026
f844ad8
fix: improve getAppLogs return type to include success field
Copilot Mar 24, 2026
7a15b0c
fix(e2e): wait for contextual bar URL navigation before using locators
Copilot Mar 24, 2026
20784e8
test: use page fixture
cardoso Mar 24, 2026
ce173e2
test: improve tests
d-gubert Apr 7, 2026
3a239c2
refactor: semantically wrong field being used for user auth
d-gubert Apr 17, 2026
e98442a
refactor: explicit step ignoring room on modal context
d-gubert Apr 23, 2026
5e1c15d
test: found a way to await for the interaction request
d-gubert Apr 23, 2026
919a50e
fix test condition
d-gubert Apr 23, 2026
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
6 changes: 6 additions & 0 deletions .changeset/angry-baboons-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket.chat/ui-kit': patch
'@rocket.chat/meteor': patch
---

Fixes an issue that prevented BlockAction interactions from having room information when triggered in a ContextualBar surface
6 changes: 6 additions & 0 deletions .changeset/tricky-kiwis-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket.chat/ui-kit': minor
'@rocket.chat/meteor': minor
---

Adds support to room information on ViewSubmit and ViewClose events for ContextualBar surface
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ type UseContextualBarContextValueParams = {
blockId?: string | undefined;
};
}>;
rid: string;
};
type UseContextualBarContextValueReturn = ContextType<typeof UiKitContext>;

export const useContextualBarContextValue = ({
view,
values,
updateValues,
rid,
}: UseContextualBarContextValueParams): UseContextualBarContextValueReturn => {
const actionManager = useUiKitActionManager();

Expand All @@ -53,6 +55,7 @@ export const useContextualBarContextValue = ({
blockId,
value,
},
rid,
});
},
updateState: ({ actionId, value, blockId = 'default' }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { useContextualBarContextValue } from '../../../../uikit/hooks/useContext
import { useUiKitActionManager } from '../../../../uikit/hooks/useUiKitActionManager';
import { useUiKitView } from '../../../../uikit/hooks/useUiKitView';
import { getButtonStyle } from '../../../modal/uikit/getButtonStyle';
import { useRoom } from '../../contexts/RoomContext';

type UiKitContextualBarProps = {
key: UiKit.ContextualBarView['id']; // force re-mount when viewId changes
Expand All @@ -34,7 +35,8 @@ type UiKitContextualBarProps = {
const UiKitContextualBar = ({ initialView }: UiKitContextualBarProps): JSX.Element => {
const actionManager = useUiKitActionManager();
const { view, values, updateValues, state } = useUiKitView(initialView);
const contextValue = useContextualBarContextValue({ view, values, updateValues });
const room = useRoom();
const contextValue = useContextualBarContextValue({ view, values, updateValues, rid: room._id });

const { closeTab } = useRoomToolbox();

Expand All @@ -50,6 +52,7 @@ const UiKitContextualBar = ({ initialView }: UiKitContextualBarProps): JSX.Eleme
},
},
viewId: view.id,
rid: room._id,
});
});

Expand All @@ -66,6 +69,7 @@ const UiKitContextualBar = ({ initialView }: UiKitContextualBarProps): JSX.Eleme
},
isCleared: false,
},
rid: room._id,
});
});

Expand All @@ -82,6 +86,7 @@ const UiKitContextualBar = ({ initialView }: UiKitContextualBarProps): JSX.Eleme
},
isCleared: true,
},
rid: room._id,
});
});

Expand Down
18 changes: 11 additions & 7 deletions apps/meteor/ee/server/apps/communication/uikit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,21 +203,20 @@ export class AppUIKitInteractionApi {
constructor(orch: IAppServerOrchestrator) {
this.orch = orch;

router.post('/:id', this.routeHandler);
router.post('/:id', this.routeHandler.bind(this));
}

private routeHandler = async (
private async routeHandler(
req: UiKitUserInteractionRequest,
res: Response<OperationResult<'POST', '/apps/ui.interaction/:id'> | { error: unknown }>,
): Promise<void> => {
): Promise<void> {
const { orch } = this;
const { id: appId } = req.params;

switch (req.body.type) {
case 'blockAction': {
const { type, actionId, triggerId, payload, container } = req.body;
const { type, actionId, triggerId, payload, container, rid } = req.body;
const mid = 'mid' in req.body ? req.body.mid : undefined;
const rid = 'rid' in req.body ? req.body.rid : undefined;

const { visitor } = req.body;
const user = orch.getConverters()?.get('users').convertToApp(req.user);
Expand Down Expand Up @@ -253,15 +252,18 @@ export class AppUIKitInteractionApi {
case 'viewClosed': {
const {
type,
rid,
payload: { view, isCleared },
} = req.body;

const user = orch.getConverters()?.get('users').convertToApp(req.user);
const room = rid ? await orch.getConverters()?.get('rooms').convertById(rid) : undefined;

const action = {
type,
appId,
user,
room,
payload: {
view,
isCleared,
Expand All @@ -280,9 +282,10 @@ export class AppUIKitInteractionApi {
}

case 'viewSubmit': {
const { type, actionId, triggerId, payload } = req.body;
const { type, actionId, triggerId, payload, rid } = req.body;

const user = orch.getConverters()?.get('users').convertToApp(req.user);
const room = rid ? await orch.getConverters()?.get('rooms').convertById(rid) : undefined;

const action = {
type,
Expand All @@ -291,6 +294,7 @@ export class AppUIKitInteractionApi {
triggerId,
payload,
user,
room,
};

try {
Expand Down Expand Up @@ -351,5 +355,5 @@ export class AppUIKitInteractionApi {
}

// TODO: validate payloads per type
};
}
}
Loading
Loading