@workadventure/iframe-api-typings 1.14.8 → 1.15.3

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 (70) hide show
  1. package/front/Api/Events/ActionsMenuActionClickedEvent.d.ts +2 -2
  2. package/front/Api/Events/AddActionsMenuKeyToRemotePlayerEvent.d.ts +2 -2
  3. package/front/Api/Events/AddPlayerEvent.d.ts +2 -2
  4. package/front/Api/Events/AskPositionEvent.d.ts +1 -1
  5. package/front/Api/Events/ButtonClickedEvent.d.ts +1 -1
  6. package/front/Api/Events/CameraFollowPlayerEvent.d.ts +1 -1
  7. package/front/Api/Events/CameraSetEvent.d.ts +1 -1
  8. package/front/Api/Events/ChangeAreaEvent.d.ts +1 -1
  9. package/front/Api/Events/ChangeLayerEvent.d.ts +1 -1
  10. package/front/Api/Events/ChatEvent.d.ts +2 -2
  11. package/front/Api/Events/ChatVisibilityEvent.d.ts +1 -1
  12. package/front/Api/Events/ClosePopupEvent.d.ts +1 -1
  13. package/front/Api/Events/ColorEvent.d.ts +1 -1
  14. package/front/Api/Events/CreateAreaEvent.d.ts +2 -2
  15. package/front/Api/Events/EmbeddedWebsiteEvent.d.ts +7 -7
  16. package/front/Api/Events/EnablePlayersTrackingEvent.d.ts +1 -1
  17. package/front/Api/Events/EnterLeaveEvent.d.ts +1 -1
  18. package/front/Api/Events/GameStateEvent.d.ts +4 -1
  19. package/front/Api/Events/GoToPageEvent.d.ts +1 -1
  20. package/front/Api/Events/HasPlayerMovedEvent.d.ts +2 -2
  21. package/front/Api/Events/IframeEvent.d.ts +308 -76
  22. package/front/Api/Events/JoinMucEvent.d.ts +1 -1
  23. package/front/Api/Events/LayerEvent.d.ts +1 -1
  24. package/front/Api/Events/LeaveMucEvent.d.ts +1 -1
  25. package/front/Api/Events/LoadPageEvent.d.ts +1 -1
  26. package/front/Api/Events/LoadSoundEvent.d.ts +1 -1
  27. package/front/Api/Events/LoadTilesetEvent.d.ts +1 -1
  28. package/front/Api/Events/MapDataEvent.d.ts +1 -1
  29. package/front/Api/Events/ModalEvent.d.ts +1 -1
  30. package/front/Api/Events/MovePlayerToEvent.d.ts +1 -1
  31. package/front/Api/Events/MovePlayerToEventAnswer.d.ts +1 -1
  32. package/front/Api/Events/NotificationEvent.d.ts +1 -1
  33. package/front/Api/Events/OpenCoWebsiteEvent.d.ts +1 -1
  34. package/front/Api/Events/OpenPopupEvent.d.ts +1 -1
  35. package/front/Api/Events/OpenTabEvent.d.ts +1 -1
  36. package/front/Api/Events/PlaySoundEvent.d.ts +1 -1
  37. package/front/Api/Events/PlayerPosition.d.ts +1 -1
  38. package/front/Api/Events/ProximityMeeting/JoinProximityMeetingEvent.d.ts +1 -1
  39. package/front/Api/Events/ProximityMeeting/ParticipantProximityMeetingEvent.d.ts +1 -1
  40. package/front/Api/Events/RemoveActionsMenuKeyFromRemotePlayerEvent.d.ts +2 -2
  41. package/front/Api/Events/SetAreaPropertyEvent.d.ts +1 -1
  42. package/front/Api/Events/SetPlayerVariableEvent.d.ts +1 -1
  43. package/front/Api/Events/SetPropertyEvent.d.ts +1 -1
  44. package/front/Api/Events/SetSharedPlayerVariableEvent.d.ts +1 -1
  45. package/front/Api/Events/SetTilesEvent.d.ts +1 -1
  46. package/front/Api/Events/SetVariableEvent.d.ts +1 -1
  47. package/front/Api/Events/SettingsEvent.d.ts +1 -1
  48. package/front/Api/Events/ShowBusinessCardEvent.d.ts +1 -1
  49. package/front/Api/Events/StopSoundEvent.d.ts +1 -1
  50. package/front/Api/Events/Ui/BannerEvent.d.ts +39 -0
  51. package/front/Api/Events/Ui/ButtonActionBarEvent.d.ts +53 -4
  52. package/front/Api/Events/Ui/MenuItemClickedEvent.d.ts +1 -1
  53. package/front/Api/Events/Ui/MenuRegisterEvent.d.ts +2 -2
  54. package/front/Api/Events/Ui/TriggerActionMessageEvent.d.ts +3 -3
  55. package/front/Api/Events/Ui/UIWebsite.d.ts +49 -49
  56. package/front/Api/Events/UserInputChatEvent.d.ts +1 -1
  57. package/front/Api/Events/WasCameraUpdatedEvent.d.ts +2 -2
  58. package/front/Api/Events/XmppSettingsMessageEvent.d.ts +1 -1
  59. package/front/Api/Iframe/Area/Area.d.ts +1 -1
  60. package/front/Api/Iframe/Players/RemotePlayer.d.ts +1 -1
  61. package/front/Api/Iframe/Sound/Sound.d.ts +1 -1
  62. package/front/Api/Iframe/Ui/Banner.d.ts +21 -0
  63. package/front/Api/Iframe/Ui/ButtonActionBar.d.ts +22 -3
  64. package/front/Api/Iframe/Ui/ButtonDescriptor.d.ts +1 -1
  65. package/front/Api/Iframe/Ui/UIWebsite.d.ts +7 -0
  66. package/front/Api/Iframe/player.d.ts +1 -1
  67. package/front/Api/Iframe/ui.d.ts +3 -1
  68. package/front/Api/types.d.ts +1 -1
  69. package/iframe_api.d.ts +9 -1
  70. package/package.json +1 -1
@@ -35,7 +35,7 @@ export interface RemotePlayerInterface {
35
35
  */
36
36
  readonly state: ReadOnlyState;
37
37
  }
38
- export declare type ReadOnlyState = {
38
+ export type ReadOnlyState = {
39
39
  onVariableChange(key: string): Observable<unknown>;
40
40
  } & {
41
41
  readonly [key: string]: unknown;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * A copy of the SoundConfig type from Phaser
3
3
  */
4
- export declare type SoundConfig = {
4
+ export type SoundConfig = {
5
5
  /**
6
6
  * Boolean indicating whether the sound should be muted or not.
7
7
  */
@@ -0,0 +1,21 @@
1
+ import { BannerEvent } from "./../../Events/Ui/BannerEvent";
2
+ import { IframeApiContribution } from "../IframeApiContribution";
3
+ export declare class WorkadventureBannerCommands extends IframeApiContribution<WorkadventureBannerCommands> {
4
+ callbacks: never[];
5
+ /**
6
+ * Open banner message with link
7
+ *
8
+ * {@link http://workadventure.localhost/map-building/api-ui.md#open-banner | Website documentation}
9
+ * @param bannerEvent
10
+ * @returns
11
+ */
12
+ openBanner(bannerEvent: BannerEvent): void;
13
+ /**
14
+ * Close banner message
15
+ * {@link http://workadventure.localhost/map-building/api-ui.md#close-banner | Website documentation}
16
+ * @returns
17
+ */
18
+ closeBanner(): void;
19
+ }
20
+ declare const _default: WorkadventureBannerCommands;
21
+ export default _default;
@@ -1,9 +1,22 @@
1
1
  import { AddButtonActionBarEvent } from "../../Events/Ui/ButtonActionBarEvent";
2
2
  import { IframeApiContribution } from "../IframeApiContribution";
3
- export declare type ButtonActionBarClickedCallback = (buttonActionBar: AddButtonActionBarEvent) => void;
4
- export declare type ActionBarButtonDescriptor = {
3
+ export type ButtonActionBarClickedCallback = (buttonActionBar: AddButtonActionBarEvent) => void;
4
+ declare const ActionBarButtonType: {
5
+ readonly button: "button";
6
+ readonly action: "action";
7
+ };
8
+ type ActionBarButtonType = (typeof ActionBarButtonType)[keyof typeof ActionBarButtonType];
9
+ export type ActionBarClassicButtonDescriptor = {
5
10
  id: string;
6
11
  label: string;
12
+ type?: ActionBarButtonType;
13
+ callback?: ButtonActionBarClickedCallback;
14
+ };
15
+ export type ActionBarActionButtonDescriptor = {
16
+ id: string;
17
+ type: ActionBarButtonType;
18
+ imageSrc: string;
19
+ toolTip: string;
7
20
  callback?: ButtonActionBarClickedCallback;
8
21
  };
9
22
  export declare class WorkAdventureButtonActionBarCommands extends IframeApiContribution<WorkAdventureButtonActionBarCommands> {
@@ -11,15 +24,21 @@ export declare class WorkAdventureButtonActionBarCommands extends IframeApiContr
11
24
  callbacks: {
12
25
  type: "buttonActionBarTrigger";
13
26
  callback: (event: {
27
+ type: "button";
14
28
  id: string;
15
29
  label: string;
30
+ } | {
31
+ type: "action";
32
+ id: string;
33
+ imageSrc: string;
34
+ toolTip: string;
16
35
  }) => void;
17
36
  }[];
18
37
  /**
19
38
  * Add action bar button
20
39
  * {@link http://workadventure.localhost/map-building/api-ui.md#add-action-bar | Website documentation}
21
40
  */
22
- addButton(descriptor: ActionBarButtonDescriptor): void;
41
+ addButton(descriptor: ActionBarClassicButtonDescriptor | ActionBarActionButtonDescriptor): void;
23
42
  /**
24
43
  * Remove action bar button
25
44
  * {@link http://workadventure.localhost/map-building/api-ui.md#remove-action-bar | Website documentation}
@@ -1,5 +1,5 @@
1
1
  import type { Popup } from "./Popup";
2
- export declare type ButtonClickedCallback = (popup: Popup) => void;
2
+ export type ButtonClickedCallback = (popup: Popup) => void;
3
3
  export interface ButtonDescriptor {
4
4
  /**
5
5
  * The label of the button
@@ -41,6 +41,13 @@ export declare class UIWebsiteCommands extends IframeApiContribution<UIWebsiteCo
41
41
  * @returns {Promise<UIWebsite[]>} Promise to return all UI websites
42
42
  */
43
43
  getAll(): Promise<UIWebsite[]>;
44
+ /**
45
+ * Returns one UI website (iframe positionned on the viewport) by ID.
46
+ * {@link https://workadventu.re/map-building/api-ui.md#get-all-ui-websites | Website documentation}
47
+ * @param {string} id The id of the UIWebsite
48
+ * @returns {Promise<UIWebsite | undefined>} Promise to return UI website
49
+ */
50
+ getById(id: string): Promise<UIWebsite | undefined>;
44
51
  }
45
52
  declare const _default: UIWebsiteCommands;
46
53
  export default _default;
@@ -151,7 +151,7 @@ export declare class WorkadventurePlayerCommands extends IframeApiContribution<W
151
151
  */
152
152
  getWokaPicture(): Promise<string>;
153
153
  }
154
- export declare type Position = {
154
+ export type Position = {
155
155
  x: number;
156
156
  y: number;
157
157
  };
@@ -10,12 +10,13 @@ import type { UIWebsiteCommands } from "./Ui/UIWebsite";
10
10
  import { RemotePlayer } from "./Players/RemotePlayer";
11
11
  import type { WorkadventureModalCommands } from "./Ui/Modal";
12
12
  import { WorkAdventureButtonActionBarCommands } from "./Ui/ButtonActionBar";
13
+ import { WorkadventureBannerCommands } from "./Ui/Banner";
13
14
  interface MenuDescriptor {
14
15
  callback?: (commandDescriptor: string) => void;
15
16
  iframe?: string;
16
17
  allowApi?: boolean;
17
18
  }
18
- export declare type MenuOptions = RequireOnlyOne<MenuDescriptor, "callback" | "iframe">;
19
+ export type MenuOptions = RequireOnlyOne<MenuDescriptor, "callback" | "iframe">;
19
20
  export interface ActionMessageOptions {
20
21
  message: string;
21
22
  type?: "message" | "warning";
@@ -113,6 +114,7 @@ export declare class WorkAdventureUiCommands extends IframeApiContribution<WorkA
113
114
  get website(): UIWebsiteCommands;
114
115
  get modal(): WorkadventureModalCommands;
115
116
  get actionBar(): WorkAdventureButtonActionBarCommands;
117
+ get banner(): WorkadventureBannerCommands;
116
118
  }
117
119
  declare const _default: WorkAdventureUiCommands;
118
120
  export default _default;
@@ -1,3 +1,3 @@
1
- export declare type RequireOnlyOne<T, keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, keys>> & {
1
+ export type RequireOnlyOne<T, keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, keys>> & {
2
2
  [K in keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<keys, K>, undefined>>;
3
3
  }[keys];
package/iframe_api.d.ts CHANGED
@@ -40,6 +40,14 @@ declare const wa: {
40
40
  * @returns {unknown|undefined} Metadata
41
41
  */
42
42
  readonly metadata: unknown;
43
+ /**
44
+ * The iframeId (only set if the code is executed from a UIWebsite iframe)
45
+ * Important: You need to wait for the end of the initialization before accessing.
46
+ * {@link https://workadventu.re/map-building/api-ui.md#get-ui-website-by-id | Website documentation}
47
+ *
48
+ * @returns {string|undefined} IframeId
49
+ */
50
+ readonly iframeId: string | undefined;
43
51
  /**
44
52
  * @deprecated Use WA.chat.sendChatMessage instead
45
53
  */
@@ -101,7 +109,7 @@ declare const wa: {
101
109
  */
102
110
  onLeaveZone(name: string, callback: () => void): void;
103
111
  };
104
- export declare type WorkAdventureApi = typeof wa;
112
+ export type WorkAdventureApi = typeof wa;
105
113
  export type { Sound, Popup, ButtonDescriptor, CoWebsite };
106
114
  declare global {
107
115
  interface Window {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workadventure/iframe-api-typings",
3
- "version": "v1.14.8",
3
+ "version": "v1.15.3",
4
4
  "description": "Typescript typings for WorkAdventure iFrame API",
5
5
  "main": "iframe_api.js",
6
6
  "types": "iframe_api.d.ts",