Implement UI Website (#2087)
* Implement UI Website system * Add UIWebsite documentation * Implement review fixes * Add getAll function on UIWebsite Co-authored-by: Alexis Faizeau <a.faizeau@workadventu.re>
This commit is contained in:
@@ -39,6 +39,7 @@ import type { RemotePlayerClickedEvent } from "./RemotePlayerClickedEvent";
|
||||
import { isAddActionsMenuKeyToRemotePlayerEvent } from "./AddActionsMenuKeyToRemotePlayerEvent";
|
||||
import type { ActionsMenuActionClickedEvent } from "./ActionsMenuActionClickedEvent";
|
||||
import { isRemoveActionsMenuKeyFromRemotePlayerEvent } from "./RemoveActionsMenuKeyFromRemotePlayerEvent";
|
||||
import { isCreateUIWebsiteEvent, isModifyUIWebsiteEvent, isUIWebsite } from "./ui/UIWebsite";
|
||||
|
||||
export interface TypedMessageEvent<T> extends MessageEvent {
|
||||
data: T;
|
||||
@@ -152,6 +153,10 @@ export const isIframeEventWrapper = z.union([
|
||||
type: z.literal("modifyEmbeddedWebsite"),
|
||||
data: isEmbeddedWebsiteEvent,
|
||||
}),
|
||||
z.object({
|
||||
type: z.literal("modifyUIWebsite"),
|
||||
data: isModifyUIWebsiteEvent,
|
||||
}),
|
||||
]);
|
||||
|
||||
export type IframeEvent = z.infer<typeof isIframeEventWrapper>;
|
||||
@@ -261,6 +266,18 @@ export const iframeQueryMapTypeGuards = {
|
||||
query: isMovePlayerToEventConfig,
|
||||
answer: isMovePlayerToEventAnswer,
|
||||
},
|
||||
openUIWebsite: {
|
||||
query: isCreateUIWebsiteEvent,
|
||||
answer: isUIWebsite,
|
||||
},
|
||||
closeUIWebsite: {
|
||||
query: z.string(),
|
||||
answer: z.undefined(),
|
||||
},
|
||||
getUIWebsites: {
|
||||
query: z.undefined(),
|
||||
answer: z.array(isUIWebsite),
|
||||
},
|
||||
};
|
||||
|
||||
type IframeQueryMapTypeGuardsType = typeof iframeQueryMapTypeGuards;
|
||||
|
||||
Reference in New Issue
Block a user