@workadventure/iframe-api-typings 1.25.6 → 1.25.8

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 (117) hide show
  1. package/iframe_api.d.ts +1 -111
  2. package/libs/shared-utils/src/Events/ChatEvent.d.ts +168 -0
  3. package/package.json +2 -2
  4. package/{Api → play/src/front/Api}/Events/ActionsMenuActionClickedEvent.d.ts +2 -2
  5. package/{Api → play/src/front/Api}/Events/AddActionsMenuKeyToRemotePlayerEvent.d.ts +2 -2
  6. package/{Api → play/src/front/Api}/Events/AddPlayerEvent.d.ts +17 -11
  7. package/{Api → play/src/front/Api}/Events/AskPositionEvent.d.ts +1 -1
  8. package/{Api → play/src/front/Api}/Events/ButtonClickedEvent.d.ts +1 -1
  9. package/{Api → play/src/front/Api}/Events/CameraFollowPlayerEvent.d.ts +4 -1
  10. package/{Api → play/src/front/Api}/Events/CameraSetEvent.d.ts +8 -5
  11. package/{Api → play/src/front/Api}/Events/ChangeAreaEvent.d.ts +1 -1
  12. package/{Api → play/src/front/Api}/Events/ChangeLayerEvent.d.ts +1 -1
  13. package/{Api → play/src/front/Api}/Events/ChatVisibilityEvent.d.ts +1 -1
  14. package/{Api → play/src/front/Api}/Events/ClosePopupEvent.d.ts +1 -1
  15. package/{Api → play/src/front/Api}/Events/ColorEvent.d.ts +1 -1
  16. package/{Api/Events/CreateAreaEvent.d.ts → play/src/front/Api/Events/CreateDynamicAreaEvent.d.ts} +14 -14
  17. package/{Api → play/src/front/Api}/Events/EmbeddedWebsiteEvent.d.ts +32 -32
  18. package/{Api → play/src/front/Api}/Events/EnablePlayersTrackingEvent.d.ts +1 -1
  19. package/{Api → play/src/front/Api}/Events/EnterLeaveEvent.d.ts +1 -1
  20. package/{Api → play/src/front/Api}/Events/GameStateEvent.d.ts +17 -8
  21. package/{Api → play/src/front/Api}/Events/GoToPageEvent.d.ts +1 -1
  22. package/{Api → play/src/front/Api}/Events/HasPlayerMovedEvent.d.ts +5 -5
  23. package/{Api → play/src/front/Api}/Events/IframeEvent.d.ts +1849 -486
  24. package/{Api → play/src/front/Api}/Events/JoinMucEvent.d.ts +3 -3
  25. package/{Api → play/src/front/Api}/Events/LayerEvent.d.ts +1 -1
  26. package/{Api → play/src/front/Api}/Events/LeaveMucEvent.d.ts +1 -1
  27. package/{Api → play/src/front/Api}/Events/LoadPageEvent.d.ts +1 -1
  28. package/{Api → play/src/front/Api}/Events/LoadSoundEvent.d.ts +1 -1
  29. package/{Api → play/src/front/Api}/Events/LoadTilesetEvent.d.ts +1 -1
  30. package/{Api → play/src/front/Api}/Events/MapDataEvent.d.ts +1 -1
  31. package/play/src/front/Api/Events/ModalEvent.d.ts +27 -0
  32. package/{Api → play/src/front/Api}/Events/MovePlayerToEvent.d.ts +3 -3
  33. package/{Api → play/src/front/Api}/Events/MovePlayerToEventAnswer.d.ts +1 -1
  34. package/{Api → play/src/front/Api}/Events/OpenCoWebsiteEvent.d.ts +3 -3
  35. package/{Api → play/src/front/Api}/Events/OpenPopupEvent.d.ts +7 -7
  36. package/{Api → play/src/front/Api}/Events/OpenTabEvent.d.ts +1 -1
  37. package/{Api → play/src/front/Api}/Events/PlaySoundEvent.d.ts +3 -3
  38. package/{Api → play/src/front/Api}/Events/PlayerPosition.d.ts +1 -1
  39. package/play/src/front/Api/Events/ProximityMeeting/AppendPCMDataEvent.d.ts +14 -0
  40. package/{Api → play/src/front/Api}/Events/ProximityMeeting/JoinProximityMeetingEvent.d.ts +14 -9
  41. package/{Api → play/src/front/Api}/Events/ProximityMeeting/ParticipantProximityMeetingEvent.d.ts +14 -9
  42. package/play/src/front/Api/Events/ProximityMeeting/PlaySoundInBubbleEvent.d.ts +12 -0
  43. package/play/src/front/Api/Events/ProximityMeeting/StartStreamInBubbleEvent.d.ts +13 -0
  44. package/play/src/front/Api/Events/ReceiveEventEvent.d.ts +48 -0
  45. package/{Api → play/src/front/Api}/Events/RemoveActionsMenuKeyFromRemotePlayerEvent.d.ts +2 -2
  46. package/play/src/front/Api/Events/SendEventEvent.d.ts +48 -0
  47. package/{Api → play/src/front/Api}/Events/SetAreaPropertyEvent.d.ts +3 -3
  48. package/{Api → play/src/front/Api}/Events/SetPlayerVariableEvent.d.ts +6 -6
  49. package/{Api → play/src/front/Api}/Events/SetPropertyEvent.d.ts +3 -3
  50. package/{Api → play/src/front/Api}/Events/SetSharedPlayerVariableEvent.d.ts +4 -4
  51. package/{Api → play/src/front/Api}/Events/SetTilesEvent.d.ts +1 -1
  52. package/{Api → play/src/front/Api}/Events/SetVariableEvent.d.ts +7 -7
  53. package/play/src/front/Api/Events/SettingsEvent.d.ts +24 -0
  54. package/{Api → play/src/front/Api}/Events/ShowBusinessCardEvent.d.ts +1 -1
  55. package/{Api → play/src/front/Api}/Events/StopSoundEvent.d.ts +1 -1
  56. package/play/src/front/Api/Events/TeleportPlayerToEvent.d.ts +12 -0
  57. package/play/src/front/Api/Events/Ui/BannerEvent.d.ts +42 -0
  58. package/play/src/front/Api/Events/Ui/ButtonActionBarEvent.d.ts +38 -0
  59. package/{Api/Events/Ui/MenuRegisterEvent.d.ts → play/src/front/Api/Events/Ui/MenuEvents.d.ts} +29 -7
  60. package/{Api → play/src/front/Api}/Events/Ui/MenuItemClickedEvent.d.ts +1 -1
  61. package/play/src/front/Api/Events/Ui/PlayVideoEvent.d.ts +67 -0
  62. package/{Api → play/src/front/Api}/Events/Ui/TriggerActionMessageEvent.d.ts +3 -3
  63. package/play/src/front/Api/Events/Ui/TriggerPlayerMessageEvent.d.ts +27 -0
  64. package/{Api/Events/Ui/UIWebsite.d.ts → play/src/front/Api/Events/Ui/UIWebsiteEvent.d.ts} +95 -95
  65. package/{Api → play/src/front/Api}/Events/UserInputChatEvent.d.ts +4 -1
  66. package/play/src/front/Api/Events/WamMapDataEvent.d.ts +12 -0
  67. package/{Api → play/src/front/Api}/Events/WasCameraUpdatedEvent.d.ts +6 -6
  68. package/play/src/front/Api/Iframe/AbstractEvent.d.ts +18 -0
  69. package/play/src/front/Api/Iframe/AbstractState.d.ts +19 -0
  70. package/{Api → play/src/front/Api}/Iframe/Area/Area.d.ts +5 -4
  71. package/{Api → play/src/front/Api}/Iframe/IframeApiContribution.d.ts +2 -2
  72. package/play/src/front/Api/Iframe/MapEditor/MapEditorArea.d.ts +12 -0
  73. package/play/src/front/Api/Iframe/Player/AudioStream.d.ts +5 -0
  74. package/play/src/front/Api/Iframe/Player/ProximityMeeting.d.ts +164 -0
  75. package/{Api → play/src/front/Api}/Iframe/Players/RemotePlayer.d.ts +14 -12
  76. package/play/src/front/Api/Iframe/PrivatePlayerState.d.ts +7 -0
  77. package/play/src/front/Api/Iframe/PublicPlayerState.d.ts +11 -0
  78. package/{Api → play/src/front/Api}/Iframe/Room/EmbeddedWebsite.d.ts +0 -3
  79. package/play/src/front/Api/Iframe/RoomState.d.ts +7 -0
  80. package/{Api → play/src/front/Api}/Iframe/Sound/Sound.d.ts +1 -1
  81. package/play/src/front/Api/Iframe/Ui/Banner.d.ts +21 -0
  82. package/play/src/front/Api/Iframe/Ui/ButtonActionBar.d.ts +25 -0
  83. package/{Api → play/src/front/Api}/Iframe/Ui/ButtonDescriptor.d.ts +1 -1
  84. package/play/src/front/Api/Iframe/Ui/Menu.d.ts +12 -0
  85. package/play/src/front/Api/Iframe/Ui/Modal.d.ts +28 -0
  86. package/play/src/front/Api/Iframe/Ui/PlayerMessage.d.ts +12 -0
  87. package/{Api → play/src/front/Api}/Iframe/Ui/UIWebsite.d.ts +11 -4
  88. package/play/src/front/Api/Iframe/Ui/Video.d.ts +5 -0
  89. package/{Api → play/src/front/Api}/Iframe/area.d.ts +9 -9
  90. package/{Api → play/src/front/Api}/Iframe/camera.d.ts +9 -9
  91. package/play/src/front/Api/Iframe/chat.d.ts +69 -0
  92. package/play/src/front/Api/Iframe/controls.d.ts +116 -0
  93. package/play/src/front/Api/Iframe/event.d.ts +15 -0
  94. package/play/src/front/Api/Iframe/mapEditor.d.ts +52 -0
  95. package/{Api → play/src/front/Api}/Iframe/nav.d.ts +9 -5
  96. package/{Api → play/src/front/Api}/Iframe/player.d.ts +41 -21
  97. package/{Api → play/src/front/Api}/Iframe/playerState.d.ts +8 -6
  98. package/{Api → play/src/front/Api}/Iframe/players.d.ts +30 -18
  99. package/{Api → play/src/front/Api}/Iframe/registeredCallbacks.d.ts +1 -1
  100. package/{Api → play/src/front/Api}/Iframe/room.d.ts +23 -16
  101. package/{Api → play/src/front/Api}/Iframe/sound.d.ts +1 -1
  102. package/{Api → play/src/front/Api}/Iframe/state.d.ts +5 -6
  103. package/{Api → play/src/front/Api}/Iframe/ui.d.ts +50 -8
  104. package/{Api → play/src/front/Api}/Iframe/website.d.ts +4 -4
  105. package/play/src/front/Api/types.d.ts +3 -0
  106. package/play/src/iframe_api.d.ts +130 -0
  107. package/Api/Events/ChatEvent.d.ts +0 -44
  108. package/Api/Events/NotificationEvent.d.ts +0 -18
  109. package/Api/Events/SettingsEvent.d.ts +0 -12
  110. package/Api/Iframe/AbstractState.d.ts +0 -14
  111. package/Api/Iframe/Player/ProximityMeeting.d.ts +0 -85
  112. package/Api/Iframe/Ui/Menu.d.ts +0 -8
  113. package/Api/Iframe/chat.d.ts +0 -36
  114. package/Api/Iframe/controls.d.ts +0 -56
  115. package/Api/types.d.ts +0 -3
  116. /package/{Api → play/src/front/Api}/Iframe/Ui/ActionMessage.d.ts +0 -0
  117. /package/{Api → play/src/front/Api}/Iframe/Ui/Popup.d.ts +0 -0
@@ -1,15 +1,17 @@
1
- import { Observable } from "rxjs";
1
+ import type { Observable } from "rxjs";
2
+ import { Subscription } from "rxjs";
3
+ import type { ITiledMap } from "@workadventure/tiled-map-type-guard";
2
4
  import { IframeApiContribution } from "./IframeApiContribution";
3
5
  import type { WorkadventureRoomWebsiteCommands } from "./website";
4
- import { WorkadventureAreaCommands } from "./area";
5
- import { ITiledMap } from "@workadventure/tiled-map-type-guard";
6
- interface TileDescriptor {
6
+ import type { WorkadventureAreaCommands } from "./area";
7
+ export interface TileDescriptor {
7
8
  x: number;
8
9
  y: number;
9
10
  tile: number | string | null;
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,14 +38,14 @@ 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
- * {@link https://workadventu.re/map-building/api-room.md#detecting-when-the-user-entersleaves-a-layer | Website documentation}
48
+ * {@link https://docs.workadventu.re/map-building/api-room.md#detecting-when-the-user-entersleaves-a-layer | Website documentation}
47
49
  *
48
50
  * @param {string} layerName Name of the layer who as defined in Tiled
49
51
  * @returns {Subject<void>} Event subject can be listen by a subscribtion
@@ -51,7 +53,7 @@ export declare class WorkadventureRoomCommands extends IframeApiContribution<Wor
51
53
  onEnterLayer(layerName: string): Observable<void>;
52
54
  /**
53
55
  * Listens to the position of the current user. The event is triggered when the user leaves a given layer.
54
- * {@link https://workadventu.re/map-building/api-room.md#detecting-when-the-user-entersleaves-a-layer | Website documentation}
56
+ * {@link https://docs.workadventu.re/map-building/api-room.md#detecting-when-the-user-entersleaves-a-layer | Website documentation}
55
57
  *
56
58
  * @param {string} layerName Name of the layer who as defined in Tiled
57
59
  * @returns {Subject<void>} Event subject can be listen by a subscribtion
@@ -59,14 +61,14 @@ export declare class WorkadventureRoomCommands extends IframeApiContribution<Wor
59
61
  onLeaveLayer(layerName: string): Observable<void>;
60
62
  /**
61
63
  * This methods can be used to show a layer. if layerName is the name of a group layer, show all the layer in that group layer.
62
- * {@link https://workadventu.re/map-building/api-room.md#show--hide-a-layer | Website documentation}
64
+ * {@link https://docs.workadventu.re/map-building/api-room.md#show--hide-a-layer | Website documentation}
63
65
  *
64
66
  * @param {string} layerName Name of the layer/group layer who as defined in Tiled
65
67
  */
66
68
  showLayer(layerName: string): void;
67
69
  /**
68
70
  * This methods can be used to hide a layer. if layerName is the name of a group layer, hide all the layer in that group layer.
69
- * {@link https://workadventu.re/map-building/api-room.md#show--hide-a-layer | Website documentation}
71
+ * {@link https://docs.workadventu.re/map-building/api-room.md#show--hide-a-layer | Website documentation}
70
72
  *
71
73
  * @param {string} layerName Name of the layer/group layer who as defined in Tiled
72
74
  */
@@ -75,7 +77,7 @@ export declare class WorkadventureRoomCommands extends IframeApiContribution<Wor
75
77
  * Set the value of the propertyName property of the layer layerName at propertyValue.
76
78
  * If the property doesn't exist, create the property propertyName and set the value of the property at propertyValue.
77
79
  * Note : To unset a property from a layer, use setProperty with propertyValue set to undefined.
78
- * {@link https://workadventu.re/map-building/api-room.md#setcreate-properties-in-a-layer | Website documentation}
80
+ * {@link https://docs.workadventu.re/map-building/api-room.md#setcreate-properties-in-a-layer | Website documentation}
79
81
  *
80
82
  * @param {string} layerName Name of the layer who as defined in Tiled
81
83
  * @param {string} propertyName Name of the property
@@ -85,14 +87,14 @@ export declare class WorkadventureRoomCommands extends IframeApiContribution<Wor
85
87
  /**
86
88
  * Returns a promise that resolves to the JSON map file.
87
89
  * Check the {@link https://doc.mapeditor.org/en/stable/reference/json-map-format/ | Tiled documentation to learn more about the format of the JSON map}.
88
- * {@link https://workadventu.re/map-building/api-room.md#getting-map-data | Website documentation}
90
+ * {@link https://docs.workadventu.re/map-building/api-room.md#getting-map-data | Website documentation}
89
91
  *
90
92
  * @returns {Promise<ITiledMap>} Map in Tiled JSON format
91
93
  */
92
94
  getTiledMap(): Promise<ITiledMap>;
93
95
  /**
94
96
  * Replace the tile at the x and y coordinates in the layer named layer by the tile with the id tile.
95
- * {@link https://workadventu.re/map-building/api-room.md#changing-tiles | Website documentation}
97
+ * {@link https://docs.workadventu.re/map-building/api-room.md#changing-tiles | Website documentation}
96
98
  *
97
99
  * @param {TileDescriptor[]} tiles Description of a tile
98
100
  */
@@ -100,7 +102,7 @@ export declare class WorkadventureRoomCommands extends IframeApiContribution<Wor
100
102
  /**
101
103
  * The ID of the current room is available from the WA.room.id property.
102
104
  * Important: You need to wait for the end of the initialization before accessing.
103
- * {@link https://workadventu.re/map-building/api-room.md#get-the-room-id | Website documentation}
105
+ * {@link https://docs.workadventu.re/map-building/api-room.md#get-the-room-id | Website documentation}
104
106
  *
105
107
  * @returns {string} Id of the room
106
108
  */
@@ -108,14 +110,19 @@ export declare class WorkadventureRoomCommands extends IframeApiContribution<Wor
108
110
  /**
109
111
  * The URL of the map is available from the WA.room.mapURL property.
110
112
  * Important: You need to wait for the end of the initialization before accessing.
111
- * {@link https://workadventu.re/map-building/api-room.md#get-the-map-url | Website documentation}
113
+ * {@link https://docs.workadventu.re/map-building/api-room.md#get-the-map-url | Website documentation}
112
114
  *
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
- * {@link https://workadventu.re/map-building/api-room.md#loading-a-tileset | Website documentation}
125
+ * {@link https://docs.workadventu.re/map-building/api-room.md#loading-a-tileset | Website documentation}
119
126
  *
120
127
  * @param {string} url Url of the tileset
121
128
  * @returns {Promise<number>} Promise to return the id of the tileset
@@ -10,7 +10,7 @@ export declare class WorkadventureSoundCommands extends IframeApiContribution<Wo
10
10
  * The Sound class that represents a loaded sound contains two methods: play(soundConfig : SoundConfig|undefined) and stop().
11
11
  *
12
12
  * The parameter soundConfig is optional, if you call play without a Sound config the sound will be played with the basic configuration.
13
- * {@link https://workadventu.re/map-building/api-sound.md#load-a-sound-from-an-url | Website documentation}
13
+ * {@link https://docs.workadventu.re/map-building/api-sound.md#load-a-sound-from-an-url | Website documentation}
14
14
  *
15
15
  * @param url
16
16
  * @returns
@@ -1,15 +1,14 @@
1
1
  import { AbstractWorkadventureStateCommands } from "./AbstractState";
2
- export declare class WorkadventureStateCommands extends AbstractWorkadventureStateCommands {
2
+ import { RoomState } from "./RoomState";
3
+ export declare class WorkadventureStateCommands extends AbstractWorkadventureStateCommands<RoomState> {
3
4
  constructor();
4
5
  callbacks: {
5
6
  type: "setVariable";
6
7
  callback: (event: {
7
- value?: unknown;
8
8
  key: string;
9
+ value?: unknown;
9
10
  }) => void;
10
11
  }[];
11
- saveVariable(key: string, value: unknown): Promise<void>;
12
+ saveVariable<K extends keyof RoomState & string>(key: K, value: RoomState[K]): Promise<void>;
12
13
  }
13
- export declare function createState(): WorkadventureStateCommands & {
14
- [key: string]: unknown;
15
- };
14
+ export declare function createState(): WorkadventureStateCommands & RoomState;
@@ -1,23 +1,43 @@
1
+ import type { Observable } from "rxjs";
2
+ import { Subject } from "rxjs";
3
+ import type { RequireOnlyOne } from "../types";
4
+ import { VideoConfig } from "../Events/Ui/PlayVideoEvent";
1
5
  import { IframeApiContribution } from "./IframeApiContribution";
2
6
  import type { ButtonDescriptor } from "./Ui/ButtonDescriptor";
3
7
  import { Popup } from "./Ui/Popup";
4
8
  import { ActionMessage } from "./Ui/ActionMessage";
9
+ import { PlayerMessage } from "./Ui/PlayerMessage";
5
10
  import { Menu } from "./Ui/Menu";
6
- import type { RequireOnlyOne } from "../types";
7
- import { Observable, Subject } from "rxjs";
8
11
  import type { UIWebsiteCommands } from "./Ui/UIWebsite";
9
12
  import { RemotePlayer } from "./Players/RemotePlayer";
13
+ import type { WorkadventureModalCommands } from "./Ui/Modal";
14
+ import { WorkAdventureButtonActionBarCommands } from "./Ui/ButtonActionBar";
15
+ import { WorkadventureBannerCommands } from "./Ui/Banner";
16
+ import { Video } from "./Ui/Video";
10
17
  interface MenuDescriptor {
11
18
  callback?: (commandDescriptor: string) => void;
12
19
  iframe?: string;
13
20
  allowApi?: boolean;
21
+ /**
22
+ * A unique technical key identifying this menu
23
+ */
24
+ key?: string;
25
+ /**
26
+ * The "allow" attribute of the iframe tag.
27
+ */
28
+ allow?: string;
14
29
  }
15
- export declare type MenuOptions = RequireOnlyOne<MenuDescriptor, "callback" | "iframe">;
30
+ export type MenuOptions = RequireOnlyOne<MenuDescriptor, "callback" | "iframe">;
16
31
  export interface ActionMessageOptions {
17
32
  message: string;
18
33
  type?: "message" | "warning";
19
34
  callback: () => void;
20
35
  }
36
+ export interface PlayerMessageOptions {
37
+ message: string;
38
+ type?: "message";
39
+ callback: () => void;
40
+ }
21
41
  export declare class ActionsMenuAction {
22
42
  private remotePlayer;
23
43
  private key;
@@ -50,16 +70,17 @@ export declare class WorkAdventureUiCommands extends IframeApiContribution<WorkA
50
70
  } | {
51
71
  type: "remotePlayerClickedEvent";
52
72
  callback: (event: {
53
- outlineColor?: number | undefined;
73
+ name: string;
54
74
  position: {
55
75
  x: number;
56
76
  y: number;
57
77
  };
58
- name: string;
59
78
  playerId: number;
60
79
  variables: Map<string, unknown>;
61
80
  userUuid: string;
62
81
  availabilityStatus: string;
82
+ outlineColor?: number | undefined;
83
+ chatID?: string | null | undefined;
63
84
  }) => void;
64
85
  } | {
65
86
  type: "actionsMenuActionClickedEvent";
@@ -70,7 +91,7 @@ export declare class WorkAdventureUiCommands extends IframeApiContribution<WorkA
70
91
  })[];
71
92
  /**
72
93
  * Open a popup in front of the game.
73
- * {@link https://workadventu.re/map-building/api-ui.md#opening-a-popup | Website documentation}
94
+ * {@link https://docs.workadventu.re/map-building/api-ui.md#opening-a-popup | Website documentation}
74
95
  *
75
96
  * @param {string} targetObject Targeted object name
76
97
  * @param {string} message Message to display
@@ -80,13 +101,19 @@ export declare class WorkAdventureUiCommands extends IframeApiContribution<WorkA
80
101
  openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup;
81
102
  /**
82
103
  * Add a custom menu item containing the text commandDescriptor in the navbar of the menu. options attribute accepts an object.
83
- * {@link https://workadventu.re/map-building/api-ui.md#add-custom-menu | Website documentation}
104
+ * {@link https://docs.workadventu.re/map-building/api-ui.md#add-custom-menu | Website documentation}
84
105
  *
85
106
  * @param {string} commandDescriptor Command description
86
107
  * @param {MenuOptions | ((commandDescriptor: string) => void)} options Manu options
87
108
  * @returns {Menu} Menu created
88
109
  */
89
110
  registerMenuCommand(commandDescriptor: string, options: MenuOptions | ((commandDescriptor: string) => void)): Menu;
111
+ /**
112
+ * Retrieves a menu from its key.
113
+ * Keys are set when the menu is created with `registerMenuCommand`
114
+ * In addition, the standard menus have the following keys: "settings", "profile", "invite", "credit", "globalMessages", "contact", "report"
115
+ */
116
+ getMenuCommand(key: string): Promise<Menu>;
90
117
  addActionsMenuKeyToRemotePlayer(id: number, actionKey: string): void;
91
118
  removeActionsMenuKeyFromRemotePlayer(id: number, actionKey: string): void;
92
119
  /**
@@ -101,13 +128,28 @@ export declare class WorkAdventureUiCommands extends IframeApiContribution<WorkA
101
128
  removeBubble(): void;
102
129
  /**
103
130
  * Displays a message at the bottom of the screen (that will disappear when space bar is pressed).
104
- * {@link https://workadventu.re/map-building/api-ui.md#awaiting-user-confirmation-with-space-bar | Website documentation}
131
+ * {@link https://docs.workadventu.re/map-building/api-ui.md#awaiting-user-confirmation-with-space-bar | Website documentation}
105
132
  *
106
133
  * @param {ActionMessageOptions} actionMessageOptions Action options
107
134
  * @returns {ActionMessage} Trigger action message
108
135
  */
109
136
  displayActionMessage(actionMessageOptions: ActionMessageOptions): ActionMessage;
137
+ /**
138
+ * Displays a player message at the top of the user head (that will disappear when space bar is pressed).
139
+ * {@link https://docs.workadventu.re/map-building/api-ui.md#awaiting-user-confirmation-with-space-bar | Website documentation}
140
+ *
141
+ * @param {PlayerMessageOptions} playerMessageOptions player options
142
+ * @returns {PlayerMessage} Trigger player message
143
+ */
144
+ displayPlayerMessage(playerMessageOptions: PlayerMessageOptions): PlayerMessage;
110
145
  get website(): UIWebsiteCommands;
146
+ get modal(): WorkadventureModalCommands;
147
+ get actionBar(): WorkAdventureButtonActionBarCommands;
148
+ get banner(): WorkadventureBannerCommands;
149
+ /**
150
+ * Plays a video as if the video was a player talking to us.
151
+ */
152
+ playVideo(videoUrl: string, config?: VideoConfig): Promise<Video>;
111
153
  }
112
154
  declare const _default: WorkAdventureUiCommands;
113
155
  export default _default;
@@ -1,11 +1,11 @@
1
+ import type { CreateEmbeddedWebsiteEvent } from "../Events/EmbeddedWebsiteEvent";
1
2
  import { IframeApiContribution } from "./IframeApiContribution";
2
3
  import { EmbeddedWebsite } from "./Room/EmbeddedWebsite";
3
- import type { CreateEmbeddedWebsiteEvent } from "../Events/EmbeddedWebsiteEvent";
4
4
  export declare class WorkadventureRoomWebsiteCommands extends IframeApiContribution<WorkadventureRoomWebsiteCommands> {
5
5
  callbacks: never[];
6
6
  /**
7
7
  * You can get an instance of an embedded website by using the WA.room.website.get() method. It returns a promise of an EmbeddedWebsite instance.
8
- * {@link https://workadventu.re/map-building/api-room.md#getting-an-instance-of-a-website-already-embedded-in-the-map | Website documentation}
8
+ * {@link https://docs.workadventu.re/map-building/api-room.md#getting-an-instance-of-a-website-already-embedded-in-the-map | Website documentation}
9
9
  *
10
10
  * @param {string} objectName Object name
11
11
  * @returns {Promise<EmbeddedWebsite>} Promise to get a embed website
@@ -13,7 +13,7 @@ export declare class WorkadventureRoomWebsiteCommands extends IframeApiContribut
13
13
  get(objectName: string): Promise<EmbeddedWebsite>;
14
14
  /**
15
15
  * You can create an instance of an embedded website by using the WA.room.website.create() method. It returns an EmbeddedWebsite instance.
16
- * {@link https://workadventu.re/map-building/api-room.md#adding-a-new-website-in-a-map | Website documentation}
16
+ * {@link https://docs.workadventu.re/map-building/api-room.md#adding-a-new-website-in-a-map | Website documentation}
17
17
  *
18
18
  * @param createEmbeddedWebsiteEvent
19
19
  * @returns {EmbeddedWebsite} Created embed website
@@ -21,7 +21,7 @@ export declare class WorkadventureRoomWebsiteCommands extends IframeApiContribut
21
21
  create(createEmbeddedWebsiteEvent: CreateEmbeddedWebsiteEvent): EmbeddedWebsite;
22
22
  /**
23
23
  * Use WA.room.website.delete to completely remove an embedded website from your map.
24
- * {@link https://workadventu.re/map-building/api-room.md#deleting-a-website-from-a-map | Website documentation}
24
+ * {@link https://docs.workadventu.re/map-building/api-room.md#deleting-a-website-from-a-map | Website documentation}
25
25
  *
26
26
  * @param {string} objectName Object name
27
27
  * @returns {Promise<void>} Promise to away to known when the object has been deleted
@@ -0,0 +1,3 @@
1
+ export type RequireOnlyOne<T, keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, keys>> & {
2
+ [K in keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<keys, K>, undefined>>;
3
+ }[keys];
@@ -0,0 +1,130 @@
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
+ export type { RoomState } from "./front/Api/Iframe/RoomState";
20
+ export type { PrivatePlayerState } from "./front/Api/Iframe/PrivatePlayerState";
21
+ export type { PublicPlayerState } from "./front/Api/Iframe/PublicPlayerState";
22
+ declare const wa: {
23
+ ui: import("./front/Api/Iframe/ui").WorkAdventureUiCommands;
24
+ nav: import("./front/Api/Iframe/nav").WorkadventureNavigationCommands;
25
+ controls: import("./front/Api/Iframe/controls").WorkadventureControlsCommands;
26
+ chat: import("./front/Api/Iframe/chat").WorkadventureChatCommands<import("./front/Api/Iframe/PublicPlayerState").PublicPlayerState>;
27
+ sound: import("./front/Api/Iframe/sound").WorkadventureSoundCommands;
28
+ room: import("./front/Api/Iframe/room").WorkadventureRoomCommands;
29
+ player: import("./front/Api/Iframe/player").WorkadventurePlayerCommands;
30
+ players: import("./front/Api/Iframe/players").WorkadventurePlayersCommands;
31
+ camera: import("./front/Api/Iframe/camera").WorkAdventureCameraCommands;
32
+ state: import("./front/Api/Iframe/state").WorkadventureStateCommands & import("./front/Api/Iframe/RoomState").RoomState;
33
+ event: import("./front/Api/Iframe/event").WorkadventureEventCommands;
34
+ mapEditor: import("./front/Api/Iframe/mapEditor").WorkadventureMapEditorCommands;
35
+ /**
36
+ * When your script / iFrame loads WorkAdventure, it takes a few milliseconds for your
37
+ * script / iFrame to exchange data with WorkAdventure. You should wait for the WorkAdventure
38
+ * API to be fully ready using the WA.onInit() method.
39
+ * {@link https://docs.workadventu.re/map-building/api-start.md#waiting-for-workadventure-api-to-be-available | Website documentation}
40
+ *
41
+ * Some properties (like the current username, or the room ID) are not available until WA.onInit has completed.
42
+ *
43
+ * @returns {void}
44
+ */
45
+ onInit(): Promise<void>;
46
+ /**
47
+ * The metadata sent by the administration website.
48
+ * Important: You need to wait for the end of the initialization before accessing.
49
+ * {@link https://docs.workadventu.re/map-building/api-metadata.md | Website documentation}
50
+ *
51
+ * @returns {unknown} Metadata
52
+ */
53
+ readonly metadata: unknown;
54
+ /**
55
+ * The iframeId (only set if the code is executed from a UIWebsite iframe)
56
+ * Important: You need to wait for the end of the initialization before accessing.
57
+ * {@link https://docs.workadventu.re/map-building/api-ui.md#get-ui-website-by-id | Website documentation}
58
+ *
59
+ * @returns {string|undefined} IframeId
60
+ */
61
+ readonly iframeId: string | undefined;
62
+ /**
63
+ * @deprecated Use WA.chat.sendChatMessage instead
64
+ */
65
+ sendChatMessage(message: string, author: string): void;
66
+ /**
67
+ * @deprecated Use WA.chat.disablePlayerControls instead
68
+ */
69
+ disablePlayerControls(): void;
70
+ /**
71
+ * @deprecated Use WA.controls.restorePlayerControls instead
72
+ */
73
+ restorePlayerControls(): void;
74
+ /**
75
+ * @deprecated Use WA.ui.displayBubble instead
76
+ */
77
+ displayBubble(): void;
78
+ /**
79
+ * @deprecated Use WA.ui.removeBubble instead
80
+ */
81
+ removeBubble(): void;
82
+ /**
83
+ * @deprecated Use WA.nav.openTab instead
84
+ */
85
+ openTab(url: string): void;
86
+ /**
87
+ * @deprecated Use WA.sound.loadSound instead
88
+ */
89
+ loadSound(url: string): Sound;
90
+ /**
91
+ * @deprecated Use WA.nav.goToPage instead
92
+ */
93
+ goToPage(url: string): void;
94
+ /**
95
+ * @deprecated Use WA.nav.goToRoom instead
96
+ */
97
+ goToRoom(url: string): void;
98
+ /**
99
+ * @deprecated Use WA.nav.openCoWebSite instead
100
+ */
101
+ openCoWebSite(url: string, allowApi?: boolean, allowPolicy?: string): Promise<CoWebsite>;
102
+ /**
103
+ * @deprecated Use WA.nav.closeCoWebSite instead
104
+ */
105
+ closeCoWebSite(): Promise<void>;
106
+ /**
107
+ * @deprecated Use WA.ui.openPopup instead
108
+ */
109
+ openPopup(targetObject: string, message: string, buttons: ButtonDescriptor[]): Popup;
110
+ /**
111
+ * @deprecated Use WA.chat.onChatMessage instead
112
+ */
113
+ onChatMessage(callback: (message: string) => void): void;
114
+ /**
115
+ * @deprecated Use WA.room.onEnterZone instead
116
+ */
117
+ onEnterZone(name: string, callback: () => void): void;
118
+ /**
119
+ * @deprecated Use WA.room.onLeaveZone instead
120
+ */
121
+ onLeaveZone(name: string, callback: () => void): void;
122
+ };
123
+ export type WorkAdventureApi = typeof wa;
124
+ export type { Sound, Popup, ButtonDescriptor, CoWebsite };
125
+ declare global {
126
+ interface Window {
127
+ WA: WorkAdventureApi;
128
+ }
129
+ let WA: WorkAdventureApi;
130
+ }
@@ -1,44 +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.ZodString>>;
25
- targets: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNullable<z.ZodString>, "many">>>;
26
- text: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNullable<z.ZodString>, "many">>>;
27
- }, "strip", z.ZodTypeAny, {
28
- author?: string | null | undefined;
29
- text?: (string | null)[] | null | undefined;
30
- targets?: (string | null)[] | null | undefined;
31
- type: ChatMessageTypes;
32
- date: Date;
33
- }, {
34
- author?: string | null | undefined;
35
- text?: (string | null)[] | null | undefined;
36
- targets?: (string | null)[] | null | undefined;
37
- type: ChatMessageTypes;
38
- date: Date;
39
- }>;
40
- export declare type ChatMessage = z.infer<typeof isChatMessage>;
41
- /**
42
- * A message sent from the iFrame to the game to add a message in the chat.
43
- */
44
- export declare type ChatEvent = z.infer<typeof isChatEvent>;
@@ -1,18 +0,0 @@
1
- import { z } from "zod";
2
- export declare const isNotificationEvent: z.ZodObject<{
3
- userName: z.ZodString;
4
- notificationType: z.ZodNumber;
5
- forum: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6
- }, "strip", z.ZodTypeAny, {
7
- forum?: string | null | undefined;
8
- userName: string;
9
- notificationType: number;
10
- }, {
11
- forum?: string | null | undefined;
12
- userName: string;
13
- notificationType: number;
14
- }>;
15
- /**
16
- * A message sent from the iFrame to the game to emit a notification.
17
- */
18
- export declare type NotificationEvent = z.infer<typeof isNotificationEvent>;
@@ -1,12 +0,0 @@
1
- import { z } from "zod";
2
- export declare const isSettingsEvent: z.ZodObject<{
3
- notification: z.ZodBoolean;
4
- chatSounds: z.ZodBoolean;
5
- }, "strip", z.ZodTypeAny, {
6
- notification: boolean;
7
- chatSounds: boolean;
8
- }, {
9
- notification: boolean;
10
- chatSounds: boolean;
11
- }>;
12
- export declare type SettingsEvent = z.infer<typeof isSettingsEvent>;
@@ -1,14 +0,0 @@
1
- import { Observable, Subject } from "rxjs";
2
- export declare abstract class AbstractWorkadventureStateCommands {
3
- protected setVariableResolvers: Subject<{
4
- value?: unknown;
5
- key: string;
6
- }>;
7
- protected variables: Map<string, unknown>;
8
- private variableSubscribers;
9
- protected constructor();
10
- initVariables(_variables: Map<string, unknown>): void;
11
- loadVariable(key: string): unknown;
12
- hasVariable(key: string): boolean;
13
- onVariableChange(key: string): Observable<unknown>;
14
- }
@@ -1,85 +0,0 @@
1
- import { Subject } from "rxjs";
2
- import { IframeApiContribution } from "../IframeApiContribution";
3
- import { RemotePlayer } from "../Players/RemotePlayer";
4
- export declare class WorkadventureProximityMeetingCommands extends IframeApiContribution<WorkadventureProximityMeetingCommands> {
5
- callbacks: ({
6
- type: "joinProximityMeetingEvent";
7
- callback: (event: {
8
- users: {
9
- outlineColor?: number | undefined;
10
- position: {
11
- x: number;
12
- y: number;
13
- };
14
- name: string;
15
- playerId: number;
16
- variables: Map<string, unknown>;
17
- userUuid: string;
18
- availabilityStatus: string;
19
- }[];
20
- }) => void;
21
- } | {
22
- type: "participantJoinProximityMeetingEvent";
23
- callback: (event: {
24
- user: {
25
- outlineColor?: number | undefined;
26
- position: {
27
- x: number;
28
- y: number;
29
- };
30
- name: string;
31
- playerId: number;
32
- variables: Map<string, unknown>;
33
- userUuid: string;
34
- availabilityStatus: string;
35
- };
36
- }) => void;
37
- } | {
38
- type: "participantLeaveProximityMeetingEvent";
39
- callback: (event: {
40
- user: {
41
- outlineColor?: number | undefined;
42
- position: {
43
- x: number;
44
- y: number;
45
- };
46
- name: string;
47
- playerId: number;
48
- variables: Map<string, unknown>;
49
- userUuid: string;
50
- availabilityStatus: string;
51
- };
52
- }) => void;
53
- } | {
54
- type: "leaveProximityMeetingEvent";
55
- callback: (event: undefined) => void;
56
- })[];
57
- /**
58
- * Detecting when the user enter on a meeting.
59
- * {@link https://workadventu.re/map-building/api-player.md#detecting-when-the-user-entersleaves-a-meeting | Website documentation}
60
- *
61
- * @returns {Subject<RemotePlayer[]>} Observable who return the joined users
62
- */
63
- onJoin(): Subject<RemotePlayer[]>;
64
- /**
65
- * Detecting when a participant joined on the current meeting.
66
- * {@link https://workadventu.re/map-building/api-player.md#detecting-when-a-participant-entersleaves-the-current-meeting | Website documentation}
67
- *
68
- * @returns {Subject<RemotePlayer>} Observable who return the joined user
69
- */
70
- onParticipantJoin(): Subject<RemotePlayer>;
71
- /**
72
- * Detecting when a participant left on the current meeting.
73
- * {@link https://workadventu.re/map-building/api-player.md#detecting-when-a-participant-entersleaves-the-current-meeting | Website documentation}
74
- *
75
- * @returns {Subject<RemotePlayer>} Observable who return the left user
76
- */
77
- onParticipantLeave(): Subject<RemotePlayer>;
78
- /**
79
- * Detecting when the user leave on a meeting.
80
- * {@link https://workadventu.re/map-building/api-player.md#detecting-when-the-user-entersleaves-a-meeting | Website documentation}
81
- */
82
- onLeave(): Subject<void>;
83
- }
84
- declare const _default: WorkadventureProximityMeetingCommands;
85
- export default _default;
@@ -1,8 +0,0 @@
1
- export declare class Menu {
2
- private menuName;
3
- constructor(menuName: string);
4
- /**
5
- * remove the menu
6
- */
7
- remove(): void;
8
- }