@workadventure/iframe-api-typings 1.17.7 → 1.18.1

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.
Files changed (99) hide show
  1. package/iframe_api.d.ts +1 -122
  2. package/libs/shared-utils/src/Events/ChatEvent.d.ts +165 -0
  3. package/package.json +1 -1
  4. package/{front → play/src/front}/Api/Events/GameStateEvent.d.ts +15 -12
  5. package/{front → play/src/front}/Api/Events/IframeEvent.d.ts +495 -230
  6. package/play/src/front/Api/Events/ProximityMeeting/PlaySoundInBubbleEvent.d.ts +12 -0
  7. package/play/src/front/Api/Events/ReceiveEventEvent.d.ts +48 -0
  8. package/play/src/front/Api/Events/SendEventEvent.d.ts +48 -0
  9. package/{front → play/src/front}/Api/Events/SetSharedPlayerVariableEvent.d.ts +3 -3
  10. package/{front → play/src/front}/Api/Events/UserInputChatEvent.d.ts +3 -0
  11. package/play/src/front/Api/Iframe/AbstractEvent.d.ts +18 -0
  12. package/{front → play/src/front}/Api/Iframe/Player/ProximityMeeting.d.ts +10 -9
  13. package/{front → play/src/front}/Api/Iframe/Players/RemotePlayer.d.ts +6 -0
  14. package/play/src/front/Api/Iframe/chat.d.ts +66 -0
  15. package/play/src/front/Api/Iframe/event.d.ts +15 -0
  16. package/{front → play/src/front}/Api/Iframe/room.d.ts +6 -0
  17. package/play/src/iframe_api.d.ts +128 -0
  18. package/front/Api/Events/ChatEvent.d.ts +0 -47
  19. package/front/Api/Events/XmppSettingsMessageEvent.d.ts +0 -43
  20. package/front/Api/Iframe/chat.d.ts +0 -38
  21. package/{front → play/src/front}/Api/Events/ActionsMenuActionClickedEvent.d.ts +0 -0
  22. package/{front → play/src/front}/Api/Events/AddActionsMenuKeyToRemotePlayerEvent.d.ts +0 -0
  23. package/{front → play/src/front}/Api/Events/AddPlayerEvent.d.ts +13 -13
  24. package/{front → play/src/front}/Api/Events/AskPositionEvent.d.ts +2 -2
  25. package/{front → play/src/front}/Api/Events/ButtonClickedEvent.d.ts +0 -0
  26. package/{front → play/src/front}/Api/Events/CameraFollowPlayerEvent.d.ts +0 -0
  27. package/{front → play/src/front}/Api/Events/CameraSetEvent.d.ts +0 -0
  28. package/{front → play/src/front}/Api/Events/ChangeAreaEvent.d.ts +0 -0
  29. package/{front → play/src/front}/Api/Events/ChangeLayerEvent.d.ts +0 -0
  30. package/{front → play/src/front}/Api/Events/ChatVisibilityEvent.d.ts +0 -0
  31. package/{front → play/src/front}/Api/Events/ClosePopupEvent.d.ts +0 -0
  32. package/{front → play/src/front}/Api/Events/ColorEvent.d.ts +0 -0
  33. package/{front → play/src/front}/Api/Events/CreateDynamicAreaEvent.d.ts +2 -2
  34. package/{front → play/src/front}/Api/Events/EmbeddedWebsiteEvent.d.ts +2 -2
  35. package/{front → play/src/front}/Api/Events/EnablePlayersTrackingEvent.d.ts +0 -0
  36. package/{front → play/src/front}/Api/Events/EnterLeaveEvent.d.ts +0 -0
  37. package/{front → play/src/front}/Api/Events/GoToPageEvent.d.ts +0 -0
  38. package/{front → play/src/front}/Api/Events/HasPlayerMovedEvent.d.ts +0 -0
  39. package/{front → play/src/front}/Api/Events/JoinMucEvent.d.ts +0 -0
  40. package/{front → play/src/front}/Api/Events/LayerEvent.d.ts +0 -0
  41. package/{front → play/src/front}/Api/Events/LeaveMucEvent.d.ts +0 -0
  42. package/{front → play/src/front}/Api/Events/LoadPageEvent.d.ts +0 -0
  43. package/{front → play/src/front}/Api/Events/LoadSoundEvent.d.ts +0 -0
  44. package/{front → play/src/front}/Api/Events/LoadTilesetEvent.d.ts +0 -0
  45. package/{front → play/src/front}/Api/Events/MapDataEvent.d.ts +0 -0
  46. package/{front → play/src/front}/Api/Events/ModalEvent.d.ts +3 -3
  47. package/{front → play/src/front}/Api/Events/MovePlayerToEvent.d.ts +0 -0
  48. package/{front → play/src/front}/Api/Events/MovePlayerToEventAnswer.d.ts +0 -0
  49. package/{front → play/src/front}/Api/Events/NotificationEvent.d.ts +0 -0
  50. package/{front → play/src/front}/Api/Events/OpenCoWebsiteEvent.d.ts +2 -2
  51. package/{front → play/src/front}/Api/Events/OpenPopupEvent.d.ts +0 -0
  52. package/{front → play/src/front}/Api/Events/OpenTabEvent.d.ts +0 -0
  53. package/{front → play/src/front}/Api/Events/PlaySoundEvent.d.ts +0 -0
  54. package/{front → play/src/front}/Api/Events/PlayerPosition.d.ts +0 -0
  55. package/{front → play/src/front}/Api/Events/ProximityMeeting/JoinProximityMeetingEvent.d.ts +12 -12
  56. package/{front → play/src/front}/Api/Events/ProximityMeeting/ParticipantProximityMeetingEvent.d.ts +12 -12
  57. package/{front → play/src/front}/Api/Events/RemoveActionsMenuKeyFromRemotePlayerEvent.d.ts +0 -0
  58. package/{front → play/src/front}/Api/Events/SetAreaPropertyEvent.d.ts +0 -0
  59. package/{front → play/src/front}/Api/Events/SetPlayerVariableEvent.d.ts +0 -0
  60. package/{front → play/src/front}/Api/Events/SetPropertyEvent.d.ts +0 -0
  61. package/{front → play/src/front}/Api/Events/SetTilesEvent.d.ts +0 -0
  62. package/{front → play/src/front}/Api/Events/SetVariableEvent.d.ts +0 -0
  63. package/{front → play/src/front}/Api/Events/SettingsEvent.d.ts +3 -3
  64. package/{front → play/src/front}/Api/Events/ShowBusinessCardEvent.d.ts +0 -0
  65. package/{front → play/src/front}/Api/Events/StopSoundEvent.d.ts +0 -0
  66. package/{front → play/src/front}/Api/Events/TeleportPlayerToEvent.d.ts +0 -0
  67. package/{front → play/src/front}/Api/Events/Ui/BannerEvent.d.ts +0 -0
  68. package/{front → play/src/front}/Api/Events/Ui/ButtonActionBarEvent.d.ts +0 -0
  69. package/{front → play/src/front}/Api/Events/Ui/MenuEvents.d.ts +2 -2
  70. package/{front → play/src/front}/Api/Events/Ui/MenuItemClickedEvent.d.ts +0 -0
  71. package/{front → play/src/front}/Api/Events/Ui/TriggerActionMessageEvent.d.ts +0 -0
  72. package/{front → play/src/front}/Api/Events/Ui/UIWebsiteEvent.d.ts +20 -20
  73. package/{front → play/src/front}/Api/Events/WasCameraUpdatedEvent.d.ts +0 -0
  74. package/{front → play/src/front}/Api/Iframe/AbstractState.d.ts +0 -0
  75. package/{front → play/src/front}/Api/Iframe/Area/Area.d.ts +0 -0
  76. package/{front → play/src/front}/Api/Iframe/IframeApiContribution.d.ts +0 -0
  77. package/{front → play/src/front}/Api/Iframe/Room/EmbeddedWebsite.d.ts +0 -0
  78. package/{front → play/src/front}/Api/Iframe/Sound/Sound.d.ts +0 -0
  79. package/{front → play/src/front}/Api/Iframe/Ui/ActionMessage.d.ts +0 -0
  80. package/{front → play/src/front}/Api/Iframe/Ui/Banner.d.ts +0 -0
  81. package/{front → play/src/front}/Api/Iframe/Ui/ButtonActionBar.d.ts +0 -0
  82. package/{front → play/src/front}/Api/Iframe/Ui/ButtonDescriptor.d.ts +0 -0
  83. package/{front → play/src/front}/Api/Iframe/Ui/Menu.d.ts +0 -0
  84. package/{front → play/src/front}/Api/Iframe/Ui/Modal.d.ts +2 -2
  85. package/{front → play/src/front}/Api/Iframe/Ui/Popup.d.ts +0 -0
  86. package/{front → play/src/front}/Api/Iframe/Ui/UIWebsite.d.ts +0 -0
  87. package/{front → play/src/front}/Api/Iframe/area.d.ts +0 -0
  88. package/{front → play/src/front}/Api/Iframe/camera.d.ts +0 -0
  89. package/{front → play/src/front}/Api/Iframe/controls.d.ts +0 -0
  90. package/{front → play/src/front}/Api/Iframe/nav.d.ts +0 -0
  91. package/{front → play/src/front}/Api/Iframe/player.d.ts +0 -0
  92. package/{front → play/src/front}/Api/Iframe/playerState.d.ts +0 -0
  93. package/{front → play/src/front}/Api/Iframe/players.d.ts +6 -6
  94. package/{front → play/src/front}/Api/Iframe/registeredCallbacks.d.ts +0 -0
  95. package/{front → play/src/front}/Api/Iframe/sound.d.ts +0 -0
  96. package/{front → play/src/front}/Api/Iframe/state.d.ts +0 -0
  97. package/{front → play/src/front}/Api/Iframe/ui.d.ts +3 -3
  98. /package/{front → play/src/front}/Api/Iframe/website.d.ts +0 -0
  99. /package/{front → play/src/front}/Api/types.d.ts +0 -0
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+ export declare const isPlaySoundInBubbleEvent: z.ZodObject<{
3
+ url: z.ZodString;
4
+ }, "strip", z.ZodTypeAny, {
5
+ url: string;
6
+ }, {
7
+ url: string;
8
+ }>;
9
+ /**
10
+ * A message sent from the iFrame to the game to play a message to all players in a bubble.
11
+ */
12
+ export type PlaySoundInBubbleEvent = z.infer<typeof isPlaySoundInBubbleEvent>;
@@ -0,0 +1,48 @@
1
+ import { z } from "zod";
2
+ export declare const isReceiveEventEvent: z.ZodObject<{
3
+ name: z.ZodString;
4
+ data: z.ZodUnknown;
5
+ senderId: z.ZodOptional<z.ZodNumber>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ data?: unknown;
8
+ senderId?: number | undefined;
9
+ name: string;
10
+ }, {
11
+ data?: unknown;
12
+ senderId?: number | undefined;
13
+ name: string;
14
+ }>;
15
+ export declare const isReceiveEventIframeEvent: z.ZodObject<{
16
+ type: z.ZodLiteral<"receiveEvent">;
17
+ data: z.ZodObject<{
18
+ name: z.ZodString;
19
+ data: z.ZodUnknown;
20
+ senderId: z.ZodOptional<z.ZodNumber>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ data?: unknown;
23
+ senderId?: number | undefined;
24
+ name: string;
25
+ }, {
26
+ data?: unknown;
27
+ senderId?: number | undefined;
28
+ name: string;
29
+ }>;
30
+ }, "strip", z.ZodTypeAny, {
31
+ type: "receiveEvent";
32
+ data: {
33
+ data?: unknown;
34
+ senderId?: number | undefined;
35
+ name: string;
36
+ };
37
+ }, {
38
+ type: "receiveEvent";
39
+ data: {
40
+ data?: unknown;
41
+ senderId?: number | undefined;
42
+ name: string;
43
+ };
44
+ }>;
45
+ /**
46
+ * A message sent to dispatch an event to/from the iFrame
47
+ */
48
+ export type ReceiveEventEvent = z.infer<typeof isReceiveEventEvent>;
@@ -0,0 +1,48 @@
1
+ import { z } from "zod";
2
+ export declare const isSendEventEvent: z.ZodObject<{
3
+ name: z.ZodString;
4
+ data: z.ZodUnknown;
5
+ targetUserIds: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ data?: unknown;
8
+ targetUserIds?: number[] | undefined;
9
+ name: string;
10
+ }, {
11
+ data?: unknown;
12
+ targetUserIds?: number[] | undefined;
13
+ name: string;
14
+ }>;
15
+ export declare const isSendEventIframeEvent: z.ZodObject<{
16
+ type: z.ZodLiteral<"dispatchEvent">;
17
+ data: z.ZodObject<{
18
+ name: z.ZodString;
19
+ data: z.ZodUnknown;
20
+ targetUserIds: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ data?: unknown;
23
+ targetUserIds?: number[] | undefined;
24
+ name: string;
25
+ }, {
26
+ data?: unknown;
27
+ targetUserIds?: number[] | undefined;
28
+ name: string;
29
+ }>;
30
+ }, "strip", z.ZodTypeAny, {
31
+ type: "dispatchEvent";
32
+ data: {
33
+ data?: unknown;
34
+ targetUserIds?: number[] | undefined;
35
+ name: string;
36
+ };
37
+ }, {
38
+ type: "dispatchEvent";
39
+ data: {
40
+ data?: unknown;
41
+ targetUserIds?: number[] | undefined;
42
+ name: string;
43
+ };
44
+ }>;
45
+ /**
46
+ * A message sent to dispatch an event to/from the iFrame
47
+ */
48
+ export type SendEventEvent = z.infer<typeof isSendEventEvent>;
@@ -5,14 +5,14 @@ export declare const isSetSharedPlayerVariableEvent: z.ZodObject<{
5
5
  playerId: z.ZodNumber;
6
6
  }, "strip", z.ZodTypeAny, {
7
7
  value?: unknown;
8
- playerId: number;
9
8
  key: string;
9
+ playerId: number;
10
10
  }, {
11
11
  value?: unknown;
12
- playerId: number;
13
12
  key: string;
13
+ playerId: number;
14
14
  }>;
15
15
  /**
16
- * A message sent from the iFrame to the game to change the value of the property of the layer
16
+ * A message sent from the game to the iframe to change the value of a player variable
17
17
  */
18
18
  export type SetSharedPlayerVariableEvent = z.infer<typeof isSetSharedPlayerVariableEvent>;
@@ -1,9 +1,12 @@
1
1
  import { z } from "zod";
2
2
  export declare const isUserInputChatEvent: z.ZodObject<{
3
3
  message: z.ZodString;
4
+ senderId: z.ZodOptional<z.ZodNumber>;
4
5
  }, "strip", z.ZodTypeAny, {
6
+ senderId?: number | undefined;
5
7
  message: string;
6
8
  }, {
9
+ senderId?: number | undefined;
7
10
  message: string;
8
11
  }>;
9
12
  /**
@@ -0,0 +1,18 @@
1
+ import type { Observable } from "rxjs";
2
+ import { Subject } from "rxjs";
3
+ import { ReceiveEventEvent } from "../Events/ReceiveEventEvent";
4
+ export type ScriptingEvent = ReceiveEventEvent;
5
+ export declare abstract class AbstractWorkadventureEventCommands {
6
+ protected receivedEventResolvers: Subject<{
7
+ data?: unknown;
8
+ senderId?: number | undefined;
9
+ name: string;
10
+ }>;
11
+ protected eventSubscribers: Map<string, Subject<{
12
+ data?: unknown;
13
+ senderId?: number | undefined;
14
+ name: string;
15
+ }>>;
16
+ protected constructor();
17
+ on(key: string): Observable<ScriptingEvent>;
18
+ }
@@ -8,14 +8,14 @@ export declare class WorkadventureProximityMeetingCommands extends IframeApiCont
8
8
  users: {
9
9
  outlineColor?: number | undefined;
10
10
  name: string;
11
+ availabilityStatus: string;
11
12
  position: {
12
13
  x: number;
13
14
  y: number;
14
15
  };
15
- playerId: number;
16
- variables: Map<string, unknown>;
17
16
  userUuid: string;
18
- availabilityStatus: string;
17
+ variables: Map<string, unknown>;
18
+ playerId: number;
19
19
  }[];
20
20
  }) => void;
21
21
  } | {
@@ -24,14 +24,14 @@ export declare class WorkadventureProximityMeetingCommands extends IframeApiCont
24
24
  user: {
25
25
  outlineColor?: number | undefined;
26
26
  name: string;
27
+ availabilityStatus: string;
27
28
  position: {
28
29
  x: number;
29
30
  y: number;
30
31
  };
31
- playerId: number;
32
- variables: Map<string, unknown>;
33
32
  userUuid: string;
34
- availabilityStatus: string;
33
+ variables: Map<string, unknown>;
34
+ playerId: number;
35
35
  };
36
36
  }) => void;
37
37
  } | {
@@ -40,14 +40,14 @@ export declare class WorkadventureProximityMeetingCommands extends IframeApiCont
40
40
  user: {
41
41
  outlineColor?: number | undefined;
42
42
  name: string;
43
+ availabilityStatus: string;
43
44
  position: {
44
45
  x: number;
45
46
  y: number;
46
47
  };
47
- playerId: number;
48
- variables: Map<string, unknown>;
49
48
  userUuid: string;
50
- availabilityStatus: string;
49
+ variables: Map<string, unknown>;
50
+ playerId: number;
51
51
  };
52
52
  }) => void;
53
53
  } | {
@@ -80,6 +80,7 @@ export declare class WorkadventureProximityMeetingCommands extends IframeApiCont
80
80
  * {@link https://workadventu.re/map-building/api-player.md#detecting-when-the-user-entersleaves-a-meeting | Website documentation}
81
81
  */
82
82
  onLeave(): Subject<void>;
83
+ playSound(url: string): Promise<void>;
83
84
  }
84
85
  declare const _default: WorkadventureProximityMeetingCommands;
85
86
  export default _default;
@@ -34,6 +34,11 @@ export interface RemotePlayerInterface {
34
34
  * An object storing players variables
35
35
  */
36
36
  readonly state: ReadOnlyState;
37
+ /**
38
+ * Send an event to the player.
39
+ * Remote player can listen to this event using `WA.event.on(key).subscribe((event) => { ... })`.
40
+ */
41
+ sendEvent(key: string, value: unknown): Promise<void>;
37
42
  }
38
43
  export type ReadOnlyState = {
39
44
  onVariableChange(key: string): Observable<unknown>;
@@ -74,6 +79,7 @@ export declare class RemotePlayer implements RemotePlayerInterface {
74
79
  addAction(key: string, callback: () => void): ActionsMenuAction;
75
80
  callAction(key: string): void;
76
81
  removeAction(key: string): void;
82
+ sendEvent(name: string, data: unknown): Promise<void>;
77
83
  }
78
84
  export interface RemotePlayerMoved {
79
85
  player: RemotePlayerInterface;
@@ -0,0 +1,66 @@
1
+ import { Subscription } from "rxjs";
2
+ import { SendChatMessageOptions } from "@workadventure/shared-utils";
3
+ import { IframeApiContribution } from "./IframeApiContribution";
4
+ import { RemotePlayerInterface } from "./Players/RemotePlayer";
5
+ export interface OnChatMessageOptions {
6
+ scope: "local" | "bubble";
7
+ }
8
+ export declare class WorkadventureChatCommands extends IframeApiContribution<WorkadventureChatCommands> {
9
+ callbacks: {
10
+ type: "userInputChat";
11
+ callback: (event: {
12
+ senderId?: number | undefined;
13
+ message: string;
14
+ }) => void;
15
+ }[];
16
+ /**
17
+ * Open instantly the chat window.
18
+ * {@link https://workadventu.re/map-building/api-chat.md#open-the-chat-window | Website documentation}
19
+ */
20
+ open(): void;
21
+ /**
22
+ * Close instantly the chat window.
23
+ * {@link https://workadventu.re/map-building/api-chat.md#close-the-chat-window | Website documentation}
24
+ */
25
+ close(): void;
26
+ /**
27
+ * Sends a message in the chat. The message is only visible in the browser of the current user.
28
+ * {@link https://docs.workadventu.re/developer/map-scripting/references/api-chat#sending-a-message-in-the-chat | Website documentation}
29
+ * @deprecated Use the overload with "options" instead
30
+ * @param {string} message Message to be displayed in the chat
31
+ * @param {string|undefined} author Name displayed for the author of the message. It does not have to be a real user
32
+ */
33
+ sendChatMessage(message: string, author?: string): void;
34
+ /**
35
+ * Simulates a user is currently typing a message in the chat.
36
+ *
37
+ * If the scope is "bubble", the typing indicator will be displayed in the chat of all users in the bubble (except the current user)
38
+ * If the scope is "local", the typing indicator will be displayed in the chat of the current user only (and will appear to come from the user whose name is "author")
39
+ *
40
+ * @param options
41
+ */
42
+ startTyping(options: SendChatMessageOptions): void;
43
+ /**
44
+ * Simulates a user has stopped typing a message in the chat.
45
+ *
46
+ * If the scope is "bubble", the typing indicator will be removed in the chat of all users in the bubble (except the current user)
47
+ * If the scope is "local", the typing indicator will be removed in the chat of the current user only (and will appear to come from the user whose name is "author")
48
+ *
49
+ * @param options
50
+ */
51
+ stopTyping(options: SendChatMessageOptions): void;
52
+ /**
53
+ * Listens to messages typed in the chat history.
54
+ * {@link https://workadventu.re/map-building/api-chat.md#listening-to-messages-from-the-chat | Website documentation}
55
+ *
56
+ * @param {function(message: string, event: { authorId: number|undefined, user: RemotePlayerInterface|undefined }): void} callback Function that will be called when a message is received. It contains the message typed by the user
57
+ * @param {OnChatMessageOptions} options Options to decide if we listen only to messages from the local user (default) or from all users in the bubble.
58
+ * @return {Subscription} Subscription to the chat message. Call ".unsubscribe()" to stop listening to the chat.
59
+ */
60
+ onChatMessage(callback: (message: string, event: {
61
+ authorId: number | undefined;
62
+ author: RemotePlayerInterface | undefined;
63
+ }) => void, options?: OnChatMessageOptions): Subscription;
64
+ }
65
+ declare const _default: WorkadventureChatCommands;
66
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import { AbstractWorkadventureEventCommands } from "./AbstractEvent";
2
+ export declare class WorkadventureEventCommands extends AbstractWorkadventureEventCommands {
3
+ constructor();
4
+ callbacks: {
5
+ type: "receiveEvent";
6
+ callback: (event: {
7
+ data?: unknown;
8
+ senderId?: number | undefined;
9
+ name: string;
10
+ }) => void;
11
+ }[];
12
+ broadcast(name: string, data: unknown): Promise<void>;
13
+ }
14
+ declare const _default: WorkadventureEventCommands;
15
+ export default _default;
@@ -11,6 +11,7 @@ export interface TileDescriptor {
11
11
  layer: string;
12
12
  }
13
13
  export declare const setRoomId: (id: string) => void;
14
+ export declare const setHashParameters: (theHashParameters: Record<string, string>) => void;
14
15
  export declare const setMapURL: (url: string) => void;
15
16
  export declare class WorkadventureRoomCommands extends IframeApiContribution<WorkadventureRoomCommands> {
16
17
  callbacks: ({
@@ -114,6 +115,11 @@ export declare class WorkadventureRoomCommands extends IframeApiContribution<Wor
114
115
  * @returns {string} Url of the map
115
116
  */
116
117
  get mapURL(): string;
118
+ /**
119
+ * The parameters behind the hash (#) of the URL are available from the WA.room.hashParameters property.
120
+ * They should follow the format key=value&key2=value2.
121
+ */
122
+ get hashParameters(): Record<string, string>;
117
123
  /**
118
124
  * Load a tileset in JSON format from an url and return the id of the first tile of the loaded tileset.
119
125
  * {@link https://workadventu.re/map-building/api-room.md#loading-a-tileset | Website documentation}
@@ -0,0 +1,128 @@
1
+ import type { CoWebsite } from "./front/Api/Iframe/nav";
2
+ import type { ButtonDescriptor } from "./front/Api/Iframe/Ui/ButtonDescriptor";
3
+ import type { Popup } from "./front/Api/Iframe/Ui/Popup";
4
+ import type { Sound } from "./front/Api/Iframe/Sound/Sound";
5
+ export type { CreateUIWebsiteEvent, ModifyUIWebsiteEvent, UIWebsiteEvent, UIWebsiteCSSValue, UIWebsiteMargin, UIWebsitePosition, UIWebsiteSize, ViewportPositionHorizontal, ViewportPositionVertical, } from "./front/Api/Events/Ui/UIWebsiteEvent";
6
+ export type { CreateEmbeddedWebsiteEvent, ModifyEmbeddedWebsiteEvent, Rectangle, } from "./front/Api/Events/EmbeddedWebsiteEvent";
7
+ export type { HasPlayerMovedEvent } from "./front/Api/Events/HasPlayerMovedEvent";
8
+ export type { UIWebsite } from "./front/Api/Iframe/Ui/UIWebsite";
9
+ export type { Menu } from "./front/Api/Iframe/Ui/Menu";
10
+ export type { ActionMessage } from "./front/Api/Iframe/Ui/ActionMessage";
11
+ export type { Position } from "./front/Api/Iframe/player";
12
+ export type { EmbeddedWebsite } from "./front/Api/Iframe/Room/EmbeddedWebsite";
13
+ export type { Area } from "./front/Api/Iframe/Area/Area";
14
+ export type { ActionsMenuAction } from "./front/Api/Iframe/ui";
15
+ export type { TileDescriptor } from "./front/Api/Iframe/room";
16
+ export type { ScriptingEvent } from "./front/Api/Iframe/AbstractEvent";
17
+ export type { RemotePlayerInterface } from "./front/Api/Iframe/Players/RemotePlayer";
18
+ export type { SendChatMessageOptions, SendLocalChatMessageOptions, SendBubbleChatMessageOptions, } from "../../libs/shared-utils/src/Events/ChatEvent";
19
+ declare const wa: {
20
+ ui: import("./front/Api/Iframe/ui").WorkAdventureUiCommands;
21
+ nav: import("./front/Api/Iframe/nav").WorkadventureNavigationCommands;
22
+ controls: import("./front/Api/Iframe/controls").WorkadventureControlsCommands;
23
+ chat: import("./front/Api/Iframe/chat").WorkadventureChatCommands;
24
+ sound: import("./front/Api/Iframe/sound").WorkadventureSoundCommands;
25
+ room: import("./front/Api/Iframe/room").WorkadventureRoomCommands;
26
+ player: import("./front/Api/Iframe/player").WorkadventurePlayerCommands;
27
+ players: import("./front/Api/Iframe/players").WorkadventurePlayersCommands;
28
+ camera: import("./front/Api/Iframe/camera").WorkAdventureCameraCommands;
29
+ state: import("./front/Api/Iframe/state").WorkadventureStateCommands & {
30
+ [key: string]: unknown;
31
+ };
32
+ event: import("./front/Api/Iframe/event").WorkadventureEventCommands;
33
+ /**
34
+ * When your script / iFrame loads WorkAdventure, it takes a few milliseconds for your
35
+ * script / iFrame to exchange data with WorkAdventure. You should wait for the WorkAdventure
36
+ * API to be fully ready using the WA.onInit() method.
37
+ * {@link https://workadventu.re/map-building/api-start.md#waiting-for-workadventure-api-to-be-available | Website documentation}
38
+ *
39
+ * Some properties (like the current username, or the room ID) are not available until WA.onInit has completed.
40
+ *
41
+ * @returns {void}
42
+ */
43
+ onInit(): Promise<void>;
44
+ /**
45
+ * The metadata sent by the administration website.
46
+ * Important: You need to wait for the end of the initialization before accessing.
47
+ * {@link https://workadventu.re/map-building/api-metadata.md | Website documentation}
48
+ *
49
+ * @returns {unknown|undefined} Metadata
50
+ */
51
+ readonly metadata: unknown;
52
+ /**
53
+ * The iframeId (only set if the code is executed from a UIWebsite iframe)
54
+ * Important: You need to wait for the end of the initialization before accessing.
55
+ * {@link https://workadventu.re/map-building/api-ui.md#get-ui-website-by-id | Website documentation}
56
+ *
57
+ * @returns {string|undefined} IframeId
58
+ */
59
+ readonly iframeId: string | undefined;
60
+ /**
61
+ * @deprecated Use WA.chat.sendChatMessage instead
62
+ */
63
+ sendChatMessage(message: string, author: string): void;
64
+ /**
65
+ * @deprecated Use WA.chat.disablePlayerControls instead
66
+ */
67
+ disablePlayerControls(): void;
68
+ /**
69
+ * @deprecated Use WA.controls.restorePlayerControls instead
70
+ */
71
+ restorePlayerControls(): void;
72
+ /**
73
+ * @deprecated Use WA.ui.displayBubble instead
74
+ */
75
+ displayBubble(): void;
76
+ /**
77
+ * @deprecated Use WA.ui.removeBubble instead
78
+ */
79
+ removeBubble(): void;
80
+ /**
81
+ * @deprecated Use WA.nav.openTab instead
82
+ */
83
+ openTab(url: string): void;
84
+ /**
85
+ * @deprecated Use WA.sound.loadSound instead
86
+ */
87
+ loadSound(url: string): Sound;
88
+ /**
89
+ * @deprecated Use WA.nav.goToPage instead
90
+ */
91
+ goToPage(url: string): void;
92
+ /**
93
+ * @deprecated Use WA.nav.goToRoom instead
94
+ */
95
+ goToRoom(url: string): void;
96
+ /**
97
+ * @deprecated Use WA.nav.openCoWebSite instead
98
+ */
99
+ openCoWebSite(url: string, allowApi?: boolean, allowPolicy?: string): Promise<CoWebsite>;
100
+ /**
101
+ * @deprecated Use WA.nav.closeCoWebSite instead
102
+ */
103
+ closeCoWebSite(): Promise<void>;
104
+ /**
105
+ * @deprecated Use WA.ui.openPopup instead
106
+ */
107
+ openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup;
108
+ /**
109
+ * @deprecated Use WA.chat.onChatMessage instead
110
+ */
111
+ onChatMessage(callback: (message: string) => void): void;
112
+ /**
113
+ * @deprecated Use WA.room.onEnterZone instead
114
+ */
115
+ onEnterZone(name: string, callback: () => void): void;
116
+ /**
117
+ * @deprecated Use WA.room.onLeaveZone instead
118
+ */
119
+ onLeaveZone(name: string, callback: () => void): void;
120
+ };
121
+ export type WorkAdventureApi = typeof wa;
122
+ export type { Sound, Popup, ButtonDescriptor, CoWebsite };
123
+ declare global {
124
+ interface Window {
125
+ WA: WorkAdventureApi;
126
+ }
127
+ let WA: WorkAdventureApi;
128
+ }
@@ -1,47 +0,0 @@
1
- import { z } from "zod";
2
- export declare const isChatEvent: z.ZodObject<{
3
- message: z.ZodString;
4
- author: z.ZodString;
5
- }, "strip", z.ZodTypeAny, {
6
- message: string;
7
- author: string;
8
- }, {
9
- message: string;
10
- author: string;
11
- }>;
12
- export declare enum ChatMessageTypes {
13
- text = 1,
14
- me = 2,
15
- userIncoming = 3,
16
- userOutcoming = 4,
17
- userWriting = 5,
18
- userStopWriting = 6
19
- }
20
- export declare const isChatMessageTypes: z.ZodNativeEnum<typeof ChatMessageTypes>;
21
- export declare const isChatMessage: z.ZodObject<{
22
- type: z.ZodNativeEnum<typeof ChatMessageTypes>;
23
- date: z.ZodDate;
24
- author: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
25
- name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
- targets: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNullable<z.ZodString>, "many">>>;
27
- text: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNullable<z.ZodString>, "many">>>;
28
- }, "strip", z.ZodTypeAny, {
29
- author?: any;
30
- text?: (string | null)[] | null | undefined;
31
- name?: string | null | undefined;
32
- targets?: (string | null)[] | null | undefined;
33
- type: ChatMessageTypes;
34
- date: Date;
35
- }, {
36
- author?: any;
37
- text?: (string | null)[] | null | undefined;
38
- name?: string | null | undefined;
39
- targets?: (string | null)[] | null | undefined;
40
- type: ChatMessageTypes;
41
- date: Date;
42
- }>;
43
- export type ChatMessage = z.infer<typeof isChatMessage>;
44
- /**
45
- * A message sent from the iFrame to the game to add a message in the chat.
46
- */
47
- export type ChatEvent = z.infer<typeof isChatEvent>;
@@ -1,43 +0,0 @@
1
- import { z } from "zod";
2
- export declare const isXmppSettingsMessageEvent: z.ZodObject<{
3
- conferenceDomain: z.ZodString;
4
- rooms: z.ZodArray<z.ZodObject<{
5
- name: z.ZodString;
6
- url: z.ZodString;
7
- type: z.ZodString;
8
- subscribe: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
9
- }, "strip", z.ZodTypeAny, {
10
- url: string;
11
- type: string;
12
- name: string;
13
- subscribe: boolean;
14
- }, {
15
- subscribe?: boolean | undefined;
16
- url: string;
17
- type: string;
18
- name: string;
19
- }>, "many">;
20
- jabberId: z.ZodString;
21
- jabberPassword: z.ZodString;
22
- }, "strip", z.ZodTypeAny, {
23
- conferenceDomain: string;
24
- rooms: {
25
- url: string;
26
- type: string;
27
- name: string;
28
- subscribe: boolean;
29
- }[];
30
- jabberId: string;
31
- jabberPassword: string;
32
- }, {
33
- conferenceDomain: string;
34
- rooms: {
35
- subscribe?: boolean | undefined;
36
- url: string;
37
- type: string;
38
- name: string;
39
- }[];
40
- jabberId: string;
41
- jabberPassword: string;
42
- }>;
43
- export type XmppSettingsMessageEvent = z.infer<typeof isXmppSettingsMessageEvent>;
@@ -1,38 +0,0 @@
1
- import { Subscription } from "rxjs";
2
- import { IframeApiContribution } from "./IframeApiContribution";
3
- export declare class WorkadventureChatCommands extends IframeApiContribution<WorkadventureChatCommands> {
4
- callbacks: {
5
- type: "userInputChat";
6
- callback: (event: {
7
- message: string;
8
- }) => void;
9
- }[];
10
- /**
11
- * Open instantly the chat window.
12
- * {@link https://workadventu.re/map-building/api-chat.md#open-the-chat-window | Website documentation}
13
- */
14
- open(): void;
15
- /**
16
- * Close instantly the chat window.
17
- * {@link https://workadventu.re/map-building/api-chat.md#close-the-chat-window | Website documentation}
18
- */
19
- close(): void;
20
- /**
21
- * Sends a message in the chat. The message is only visible in the browser of the current user.
22
- * {@link https://workadventu.re/map-building/api-chat.md#sending-a-message-in-the-chat | Website documentation}
23
- *
24
- * @param {string} message Message to be displayed in the chat
25
- * @param {string|undefined} author Name displayed for the author of the message. It does not have to be a real user
26
- */
27
- sendChatMessage(message: string, author?: string): void;
28
- /**
29
- * Listens to messages typed by the current user and calls the callback. Messages from other users in the chat cannot be listened to.
30
- * {@link https://workadventu.re/map-building/api-chat.md#listening-to-messages-from-the-chat | Website documentation}
31
- *
32
- * @param {function(string): void} callback Function that will be called when a message is received. It contains the message typed by the user
33
- * @return {Subscription} Subscription to the chat message. Call ".unsubscribe()" to stop listening to the chat.
34
- */
35
- onChatMessage(callback: (message: string) => void): Subscription;
36
- }
37
- declare const _default: WorkadventureChatCommands;
38
- export default _default;