@workadventure/iframe-api-typings 1.17.6 → 1.18.0

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 (98) hide show
  1. package/libs/shared-utils/src/Events/ChatEvent.d.ts +165 -0
  2. package/package.json +1 -1
  3. package/{front → play/src/front}/Api/Events/GameStateEvent.d.ts +15 -12
  4. package/{front → play/src/front}/Api/Events/IframeEvent.d.ts +495 -230
  5. package/play/src/front/Api/Events/ProximityMeeting/PlaySoundInBubbleEvent.d.ts +12 -0
  6. package/play/src/front/Api/Events/ReceiveEventEvent.d.ts +48 -0
  7. package/play/src/front/Api/Events/SendEventEvent.d.ts +48 -0
  8. package/{front → play/src/front}/Api/Events/SetSharedPlayerVariableEvent.d.ts +3 -3
  9. package/{front → play/src/front}/Api/Events/UserInputChatEvent.d.ts +3 -0
  10. package/play/src/front/Api/Iframe/AbstractEvent.d.ts +18 -0
  11. package/{front → play/src/front}/Api/Iframe/Player/ProximityMeeting.d.ts +10 -9
  12. package/{front → play/src/front}/Api/Iframe/Players/RemotePlayer.d.ts +6 -0
  13. package/play/src/front/Api/Iframe/chat.d.ts +66 -0
  14. package/play/src/front/Api/Iframe/event.d.ts +15 -0
  15. package/{front → play/src/front}/Api/Iframe/player.d.ts +3 -1
  16. package/{front → play/src/front}/Api/Iframe/room.d.ts +9 -2
  17. package/{iframe_api.d.ts → play/src/iframe_api.d.ts} +4 -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 -36
  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/playerState.d.ts +0 -0
  92. package/{front → play/src/front}/Api/Iframe/players.d.ts +6 -6
  93. package/{front → play/src/front}/Api/Iframe/registeredCallbacks.d.ts +0 -0
  94. package/{front → play/src/front}/Api/Iframe/sound.d.ts +0 -0
  95. package/{front → play/src/front}/Api/Iframe/state.d.ts +0 -0
  96. package/{front → play/src/front}/Api/Iframe/ui.d.ts +3 -3
  97. /package/{front → play/src/front}/Api/Iframe/website.d.ts +0 -0
  98. /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;
@@ -1,3 +1,4 @@
1
+ import { Subscription } from "rxjs";
1
2
  import type { HasPlayerMovedEventCallback } from "../Events/HasPlayerMovedEvent";
2
3
  import { IframeApiContribution } from "./IframeApiContribution";
3
4
  import type { WorkadventureProximityMeetingCommands } from "./Player/ProximityMeeting";
@@ -86,8 +87,9 @@ export declare class WorkadventurePlayerCommands extends IframeApiContribution<W
86
87
  * {@link https://workadventu.re/map-building/api-player.md#listen-to-player-movement | Website documentation}
87
88
  *
88
89
  * @param {HasPlayerMovedEventCallback} callback Function that will be called when the current player is moving. It contains the event
90
+ * @return {Subscription} Subscription to the stream. Use ".unsubscribe()" to stop listening.
89
91
  */
90
- onPlayerMove(callback: HasPlayerMovedEventCallback): void;
92
+ onPlayerMove(callback: HasPlayerMovedEventCallback): Subscription;
91
93
  /**
92
94
  * Player will try to find the shortest path to the destination point and proceed to move there.
93
95
  * {@link https://workadventu.re/map-building/api-player.md#move-player-to-position | Website documentation}
@@ -1,4 +1,5 @@
1
1
  import type { Observable } from "rxjs";
2
+ import { Subscription } from "rxjs";
2
3
  import type { ITiledMap } from "@workadventure/tiled-map-type-guard";
3
4
  import { IframeApiContribution } from "./IframeApiContribution";
4
5
  import type { WorkadventureRoomWebsiteCommands } from "./website";
@@ -10,6 +11,7 @@ export interface TileDescriptor {
10
11
  layer: string;
11
12
  }
12
13
  export declare const setRoomId: (id: string) => void;
14
+ export declare const setHashParameters: (theHashParameters: Record<string, string>) => void;
13
15
  export declare const setMapURL: (url: string) => void;
14
16
  export declare class WorkadventureRoomCommands extends IframeApiContribution<WorkadventureRoomCommands> {
15
17
  callbacks: ({
@@ -36,11 +38,11 @@ export declare class WorkadventureRoomCommands extends IframeApiContribution<Wor
36
38
  /**
37
39
  * @deprecated Use onEnterLayer instead
38
40
  */
39
- onEnterZone(name: string, callback: () => void): void;
41
+ onEnterZone(name: string, callback: () => void): Subscription;
40
42
  /**
41
43
  * @deprecated Use onLeaveLayer instead
42
44
  */
43
- onLeaveZone(name: string, callback: () => void): void;
45
+ onLeaveZone(name: string, callback: () => void): Subscription;
44
46
  /**
45
47
  * Listens to the position of the current user. The event is triggered when the user enters a given layer.
46
48
  * {@link https://workadventu.re/map-building/api-room.md#detecting-when-the-user-entersleaves-a-layer | Website documentation}
@@ -113,6 +115,11 @@ export declare class WorkadventureRoomCommands extends IframeApiContribution<Wor
113
115
  * @returns {string} Url of the map
114
116
  */
115
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>;
116
123
  /**
117
124
  * Load a tileset in JSON format from an url and return the id of the first tile of the loaded tileset.
118
125
  * {@link https://workadventu.re/map-building/api-room.md#loading-a-tileset | Website documentation}
@@ -11,6 +11,9 @@ export type { EmbeddedWebsite } from "./front/Api/Iframe/Room/EmbeddedWebsite";
11
11
  export type { Area } from "./front/Api/Iframe/Area/Area";
12
12
  export type { ActionsMenuAction } from "./front/Api/Iframe/ui";
13
13
  export type { TileDescriptor } from "./front/Api/Iframe/room";
14
+ export type { ScriptingEvent } from "./front/Api/Iframe/AbstractEvent";
15
+ export type { RemotePlayerInterface } from "./front/Api/Iframe/Players/RemotePlayer";
16
+ export type { SendChatMessageOptions, SendLocalChatMessageOptions, SendBubbleChatMessageOptions, } from "../../libs/shared-utils/src/Events/ChatEvent";
14
17
  declare const wa: {
15
18
  ui: import("./front/Api/Iframe/ui").WorkAdventureUiCommands;
16
19
  nav: import("./front/Api/Iframe/nav").WorkadventureNavigationCommands;
@@ -24,6 +27,7 @@ declare const wa: {
24
27
  state: import("./front/Api/Iframe/state").WorkadventureStateCommands & {
25
28
  [key: string]: unknown;
26
29
  };
30
+ event: import("./front/Api/Iframe/event").WorkadventureEventCommands;
27
31
  /**
28
32
  * When your script / iFrame loads WorkAdventure, it takes a few milliseconds for your
29
33
  * script / iFrame to exchange data with WorkAdventure. You should wait for the WorkAdventure
@@ -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,36 +0,0 @@
1
- import { IframeApiContribution } from "./IframeApiContribution";
2
- export declare class WorkadventureChatCommands extends IframeApiContribution<WorkadventureChatCommands> {
3
- callbacks: {
4
- type: "userInputChat";
5
- callback: (event: {
6
- message: string;
7
- }) => void;
8
- }[];
9
- /**
10
- * Open instantly the chat window.
11
- * {@link https://workadventu.re/map-building/api-chat.md#open-the-chat-window | Website documentation}
12
- */
13
- open(): void;
14
- /**
15
- * Close instantly the chat window.
16
- * {@link https://workadventu.re/map-building/api-chat.md#close-the-chat-window | Website documentation}
17
- */
18
- close(): void;
19
- /**
20
- * Sends a message in the chat. The message is only visible in the browser of the current user.
21
- * {@link https://workadventu.re/map-building/api-chat.md#sending-a-message-in-the-chat | Website documentation}
22
- *
23
- * @param {string} message Message to be displayed in the chat
24
- * @param {string|undefined} author Name displayed for the author of the message. It does not have to be a real user
25
- */
26
- sendChatMessage(message: string, author?: string): void;
27
- /**
28
- * Listens to messages typed by the current user and calls the callback. Messages from other users in the chat cannot be listened to.
29
- * {@link https://workadventu.re/map-building/api-chat.md#listening-to-messages-from-the-chat | Website documentation}
30
- *
31
- * @param {function(string): void} callback Function that will be called when a message is received. It contains the message typed by the user
32
- */
33
- onChatMessage(callback: (message: string) => void): void;
34
- }
35
- declare const _default: WorkadventureChatCommands;
36
- export default _default;
@@ -19,28 +19,30 @@ export declare const isAddPlayerEvent: z.ZodObject<{
19
19
  }, "strip", z.ZodTypeAny, {
20
20
  outlineColor?: number | undefined;
21
21
  name: string;
22
+ availabilityStatus: string;
22
23
  position: {
23
24
  x: number;
24
25
  y: number;
25
26
  };
26
- playerId: number;
27
- variables: Map<string, unknown>;
28
27
  userUuid: string;
29
- availabilityStatus: string;
28
+ variables: Map<string, unknown>;
29
+ playerId: number;
30
30
  }, {
31
31
  outlineColor?: number | undefined;
32
32
  name: string;
33
+ availabilityStatus: string;
33
34
  position: {
34
35
  x: number;
35
36
  y: number;
36
37
  };
37
- playerId: number;
38
- variables: Map<string, unknown>;
39
38
  userUuid: string;
40
- availabilityStatus: string;
39
+ variables: Map<string, unknown>;
40
+ playerId: number;
41
41
  }>;
42
42
  export declare const isRemotePlayerChangedEvent: z.ZodObject<{
43
43
  name: z.ZodOptional<z.ZodString>;
44
+ outlineColor: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
45
+ availabilityStatus: z.ZodOptional<z.ZodString>;
44
46
  position: z.ZodOptional<z.ZodObject<{
45
47
  x: z.ZodNumber;
46
48
  y: z.ZodNumber;
@@ -51,29 +53,27 @@ export declare const isRemotePlayerChangedEvent: z.ZodObject<{
51
53
  x: number;
52
54
  y: number;
53
55
  }>>;
54
- playerId: z.ZodNumber;
55
56
  variables: z.ZodOptional<z.ZodMap<z.ZodString, z.ZodUnknown>>;
56
- availabilityStatus: z.ZodOptional<z.ZodString>;
57
- outlineColor: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
57
+ playerId: z.ZodNumber;
58
58
  }, "strip", z.ZodTypeAny, {
59
59
  name?: string | undefined;
60
+ outlineColor?: number | undefined;
61
+ availabilityStatus?: string | undefined;
60
62
  position?: {
61
63
  x: number;
62
64
  y: number;
63
65
  } | undefined;
64
66
  variables?: Map<string, unknown> | undefined;
65
- availabilityStatus?: string | undefined;
66
- outlineColor?: number | undefined;
67
67
  playerId: number;
68
68
  }, {
69
69
  name?: string | undefined;
70
+ outlineColor?: number | undefined;
71
+ availabilityStatus?: string | undefined;
70
72
  position?: {
71
73
  x: number;
72
74
  y: number;
73
75
  } | undefined;
74
76
  variables?: Map<string, unknown> | undefined;
75
- availabilityStatus?: string | undefined;
76
- outlineColor?: number | undefined;
77
77
  playerId: number;
78
78
  }>;
79
79
  /**
@@ -3,11 +3,11 @@ export declare const isAskPositionEvent: z.ZodObject<{
3
3
  uuid: z.ZodString;
4
4
  playUri: z.ZodString;
5
5
  }, "strip", z.ZodTypeAny, {
6
- uuid: string;
7
6
  playUri: string;
8
- }, {
9
7
  uuid: string;
8
+ }, {
10
9
  playUri: string;
10
+ uuid: string;
11
11
  }>;
12
12
  /**
13
13
  * A message sent from the iFrame to the game to ask the position of the user with uuid and walk to him.
@@ -31,14 +31,14 @@ export declare const isCreateDynamicAreaEvent: z.ZodObject<{
31
31
  }, "strip", z.ZodTypeAny, {
32
32
  height: number;
33
33
  width: number;
34
- name: string;
35
34
  x: number;
36
35
  y: number;
36
+ name: string;
37
37
  }, {
38
38
  height: number;
39
39
  width: number;
40
- name: string;
41
40
  x: number;
42
41
  y: number;
42
+ name: string;
43
43
  }>;
44
44
  export type CreateDynamicAreaEvent = z.infer<typeof isCreateDynamicAreaEvent>;