@workadventure/iframe-api-typings 1.9.5 → 1.10.2

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 (46) hide show
  1. package/Api/Events/ActionsMenuActionClickedEvent.d.ts +9 -3
  2. package/Api/Events/AddActionsMenuKeyToRemotePlayerEvent.d.ts +9 -3
  3. package/Api/Events/ButtonClickedEvent.d.ts +9 -3
  4. package/Api/Events/CameraFollowPlayerEvent.d.ts +7 -3
  5. package/Api/Events/CameraSetEvent.d.ts +19 -5
  6. package/Api/Events/ChangeAreaEvent.d.ts +12 -0
  7. package/Api/Events/ChangeLayerEvent.d.ts +7 -3
  8. package/Api/Events/ChatEvent.d.ts +9 -3
  9. package/Api/Events/ClosePopupEvent.d.ts +7 -3
  10. package/Api/Events/ColorEvent.d.ts +11 -3
  11. package/Api/Events/EmbeddedWebsiteEvent.d.ts +98 -28
  12. package/Api/Events/EnterLeaveEvent.d.ts +7 -3
  13. package/Api/Events/GameStateEvent.d.ts +31 -9
  14. package/Api/Events/GoToPageEvent.d.ts +7 -3
  15. package/Api/Events/HasPlayerMovedEvent.d.ts +20 -6
  16. package/Api/Events/IframeEvent.d.ts +1330 -131
  17. package/Api/Events/LayerEvent.d.ts +7 -3
  18. package/Api/Events/LoadPageEvent.d.ts +7 -3
  19. package/Api/Events/LoadSoundEvent.d.ts +7 -3
  20. package/Api/Events/LoadTilesetEvent.d.ts +7 -3
  21. package/Api/Events/MapDataEvent.d.ts +8 -4
  22. package/Api/Events/MovePlayerToEvent.d.ts +12 -4
  23. package/Api/Events/MovePlayerToEventAnswer.d.ts +11 -3
  24. package/Api/Events/OpenCoWebsiteEvent.d.ts +30 -10
  25. package/Api/Events/OpenPopupEvent.d.ts +38 -6
  26. package/Api/Events/OpenTabEvent.d.ts +7 -3
  27. package/Api/Events/PlaySoundEvent.d.ts +75 -12
  28. package/Api/Events/PlayerPosition.d.ts +9 -3
  29. package/Api/Events/RemotePlayerClickedEvent.d.ts +7 -3
  30. package/Api/Events/RemoveActionsMenuKeyFromRemotePlayerEvent.d.ts +9 -3
  31. package/Api/Events/SetTilesEvent.d.ts +14 -4
  32. package/Api/Events/SetVariableEvent.d.ts +40 -10
  33. package/Api/Events/StopSoundEvent.d.ts +7 -3
  34. package/Api/Events/UserInputChatEvent.d.ts +7 -3
  35. package/Api/Events/WasCameraUpdatedEvent.d.ts +15 -3
  36. package/Api/Events/setPropertyEvent.d.ts +12 -4
  37. package/Api/Events/ui/MenuItemClickedEvent.d.ts +7 -3
  38. package/Api/Events/ui/MenuRegisterEvent.d.ts +32 -8
  39. package/Api/Events/ui/TriggerActionMessageEvent.d.ts +19 -7
  40. package/Api/Events/ui/UIWebsite.d.ts +289 -0
  41. package/Api/iframe/IframeApiContribution.d.ts +4 -4
  42. package/Api/iframe/Ui/UIWebsite.d.ts +33 -0
  43. package/Api/iframe/controls.d.ts +2 -0
  44. package/Api/iframe/ui.d.ts +2 -0
  45. package/package.json +1 -1
  46. package/Api/Events/ChangeZoneEvent.d.ts +0 -8
@@ -1,15 +1,27 @@
1
- import * as tg from "generic-type-guard";
1
+ import { z } from "zod";
2
2
  export declare const triggerActionMessage = "triggerActionMessage";
3
3
  export declare const removeActionMessage = "removeActionMessage";
4
- export declare const isActionMessageType: tg.TypeGuard<"message" | "warning">;
5
- export declare type ActionMessageType = tg.GuardedType<typeof isActionMessageType>;
6
- export declare const isTriggerActionMessageEvent: tg.TypeGuard<object & {
4
+ export declare const isActionMessageType: z.ZodEnum<["message", "warning"]>;
5
+ export declare type ActionMessageType = z.infer<typeof isActionMessageType>;
6
+ export declare const isTriggerActionMessageEvent: z.ZodObject<{
7
+ message: z.ZodString;
8
+ uuid: z.ZodString;
9
+ type: z.ZodEnum<["message", "warning"]>;
10
+ }, "strip", z.ZodTypeAny, {
7
11
  message: string;
12
+ type: "message" | "warning";
8
13
  uuid: string;
14
+ }, {
15
+ message: string;
9
16
  type: "message" | "warning";
17
+ uuid: string;
10
18
  }>;
11
- export declare type TriggerActionMessageEvent = tg.GuardedType<typeof isTriggerActionMessageEvent>;
12
- export declare const isMessageReferenceEvent: tg.TypeGuard<object & {
19
+ export declare type TriggerActionMessageEvent = z.infer<typeof isTriggerActionMessageEvent>;
20
+ export declare const isMessageReferenceEvent: z.ZodObject<{
21
+ uuid: z.ZodString;
22
+ }, "strip", z.ZodTypeAny, {
23
+ uuid: string;
24
+ }, {
13
25
  uuid: string;
14
26
  }>;
15
- export declare type MessageReferenceEvent = tg.GuardedType<typeof isMessageReferenceEvent>;
27
+ export declare type MessageReferenceEvent = z.infer<typeof isMessageReferenceEvent>;
@@ -0,0 +1,289 @@
1
+ import { z } from "zod";
2
+ export declare const isUIWebsiteCSSValue: z.ZodString;
3
+ export declare type UIWebsiteCSSValue = z.infer<typeof isUIWebsiteCSSValue>;
4
+ export declare const isUIWebsiteMargin: z.ZodObject<{
5
+ top: z.ZodOptional<z.ZodString>;
6
+ bottom: z.ZodOptional<z.ZodString>;
7
+ left: z.ZodOptional<z.ZodString>;
8
+ right: z.ZodOptional<z.ZodString>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ right?: string | undefined;
11
+ left?: string | undefined;
12
+ top?: string | undefined;
13
+ bottom?: string | undefined;
14
+ }, {
15
+ right?: string | undefined;
16
+ left?: string | undefined;
17
+ top?: string | undefined;
18
+ bottom?: string | undefined;
19
+ }>;
20
+ export declare type UIWebsiteMargin = z.infer<typeof isUIWebsiteMargin>;
21
+ export declare const isViewportPositionVertical: z.ZodEnum<["top", "middle", "bottom"]>;
22
+ export declare type ViewportPositionVertical = z.infer<typeof isViewportPositionVertical>;
23
+ export declare const isViewportPositionHorizontal: z.ZodEnum<["left", "middle", "right"]>;
24
+ export declare type ViewportPositionHorizontal = z.infer<typeof isViewportPositionHorizontal>;
25
+ export declare const isUIWebsitePosition: z.ZodObject<{
26
+ vertical: z.ZodEnum<["top", "middle", "bottom"]>;
27
+ horizontal: z.ZodEnum<["left", "middle", "right"]>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ vertical: "top" | "middle" | "bottom";
30
+ horizontal: "right" | "left" | "middle";
31
+ }, {
32
+ vertical: "top" | "middle" | "bottom";
33
+ horizontal: "right" | "left" | "middle";
34
+ }>;
35
+ export declare type UIWebsitePosition = z.infer<typeof isUIWebsitePosition>;
36
+ export declare const isUIWebsiteSize: z.ZodObject<{
37
+ height: z.ZodString;
38
+ width: z.ZodString;
39
+ }, "strip", z.ZodTypeAny, {
40
+ width: string;
41
+ height: string;
42
+ }, {
43
+ width: string;
44
+ height: string;
45
+ }>;
46
+ export declare type UIWebsiteSize = z.infer<typeof isUIWebsiteSize>;
47
+ export declare const isCreateUIWebsiteEvent: z.ZodObject<{
48
+ url: z.ZodString;
49
+ visible: z.ZodOptional<z.ZodBoolean>;
50
+ allowApi: z.ZodOptional<z.ZodBoolean>;
51
+ allowPolicy: z.ZodOptional<z.ZodString>;
52
+ position: z.ZodObject<{
53
+ vertical: z.ZodEnum<["top", "middle", "bottom"]>;
54
+ horizontal: z.ZodEnum<["left", "middle", "right"]>;
55
+ }, "strip", z.ZodTypeAny, {
56
+ vertical: "top" | "middle" | "bottom";
57
+ horizontal: "right" | "left" | "middle";
58
+ }, {
59
+ vertical: "top" | "middle" | "bottom";
60
+ horizontal: "right" | "left" | "middle";
61
+ }>;
62
+ size: z.ZodObject<{
63
+ height: z.ZodString;
64
+ width: z.ZodString;
65
+ }, "strip", z.ZodTypeAny, {
66
+ width: string;
67
+ height: string;
68
+ }, {
69
+ width: string;
70
+ height: string;
71
+ }>;
72
+ margin: z.ZodOptional<z.ZodObject<{
73
+ top: z.ZodOptional<z.ZodString>;
74
+ bottom: z.ZodOptional<z.ZodString>;
75
+ left: z.ZodOptional<z.ZodString>;
76
+ right: z.ZodOptional<z.ZodString>;
77
+ }, "strip", z.ZodTypeAny, {
78
+ right?: string | undefined;
79
+ left?: string | undefined;
80
+ top?: string | undefined;
81
+ bottom?: string | undefined;
82
+ }, {
83
+ right?: string | undefined;
84
+ left?: string | undefined;
85
+ top?: string | undefined;
86
+ bottom?: string | undefined;
87
+ }>>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ allowApi?: boolean | undefined;
90
+ allowPolicy?: string | undefined;
91
+ visible?: boolean | undefined;
92
+ margin?: {
93
+ right?: string | undefined;
94
+ left?: string | undefined;
95
+ top?: string | undefined;
96
+ bottom?: string | undefined;
97
+ } | undefined;
98
+ url: string;
99
+ position: {
100
+ vertical: "top" | "middle" | "bottom";
101
+ horizontal: "right" | "left" | "middle";
102
+ };
103
+ size: {
104
+ width: string;
105
+ height: string;
106
+ };
107
+ }, {
108
+ allowApi?: boolean | undefined;
109
+ allowPolicy?: string | undefined;
110
+ visible?: boolean | undefined;
111
+ margin?: {
112
+ right?: string | undefined;
113
+ left?: string | undefined;
114
+ top?: string | undefined;
115
+ bottom?: string | undefined;
116
+ } | undefined;
117
+ url: string;
118
+ position: {
119
+ vertical: "top" | "middle" | "bottom";
120
+ horizontal: "right" | "left" | "middle";
121
+ };
122
+ size: {
123
+ width: string;
124
+ height: string;
125
+ };
126
+ }>;
127
+ export declare type CreateUIWebsiteEvent = z.infer<typeof isCreateUIWebsiteEvent>;
128
+ export declare const isModifyUIWebsiteEvent: z.ZodObject<{
129
+ id: z.ZodString;
130
+ url: z.ZodOptional<z.ZodString>;
131
+ visible: z.ZodOptional<z.ZodBoolean>;
132
+ position: z.ZodOptional<z.ZodObject<{
133
+ vertical: z.ZodEnum<["top", "middle", "bottom"]>;
134
+ horizontal: z.ZodEnum<["left", "middle", "right"]>;
135
+ }, "strip", z.ZodTypeAny, {
136
+ vertical: "top" | "middle" | "bottom";
137
+ horizontal: "right" | "left" | "middle";
138
+ }, {
139
+ vertical: "top" | "middle" | "bottom";
140
+ horizontal: "right" | "left" | "middle";
141
+ }>>;
142
+ size: z.ZodOptional<z.ZodObject<{
143
+ height: z.ZodString;
144
+ width: z.ZodString;
145
+ }, "strip", z.ZodTypeAny, {
146
+ width: string;
147
+ height: string;
148
+ }, {
149
+ width: string;
150
+ height: string;
151
+ }>>;
152
+ margin: z.ZodOptional<z.ZodObject<{
153
+ top: z.ZodOptional<z.ZodString>;
154
+ bottom: z.ZodOptional<z.ZodString>;
155
+ left: z.ZodOptional<z.ZodString>;
156
+ right: z.ZodOptional<z.ZodString>;
157
+ }, "strip", z.ZodTypeAny, {
158
+ right?: string | undefined;
159
+ left?: string | undefined;
160
+ top?: string | undefined;
161
+ bottom?: string | undefined;
162
+ }, {
163
+ right?: string | undefined;
164
+ left?: string | undefined;
165
+ top?: string | undefined;
166
+ bottom?: string | undefined;
167
+ }>>;
168
+ }, "strip", z.ZodTypeAny, {
169
+ url?: string | undefined;
170
+ position?: {
171
+ vertical: "top" | "middle" | "bottom";
172
+ horizontal: "right" | "left" | "middle";
173
+ } | undefined;
174
+ visible?: boolean | undefined;
175
+ size?: {
176
+ width: string;
177
+ height: string;
178
+ } | undefined;
179
+ margin?: {
180
+ right?: string | undefined;
181
+ left?: string | undefined;
182
+ top?: string | undefined;
183
+ bottom?: string | undefined;
184
+ } | undefined;
185
+ id: string;
186
+ }, {
187
+ url?: string | undefined;
188
+ position?: {
189
+ vertical: "top" | "middle" | "bottom";
190
+ horizontal: "right" | "left" | "middle";
191
+ } | undefined;
192
+ visible?: boolean | undefined;
193
+ size?: {
194
+ width: string;
195
+ height: string;
196
+ } | undefined;
197
+ margin?: {
198
+ right?: string | undefined;
199
+ left?: string | undefined;
200
+ top?: string | undefined;
201
+ bottom?: string | undefined;
202
+ } | undefined;
203
+ id: string;
204
+ }>;
205
+ export declare type ModifyUIWebsiteEvent = z.infer<typeof isModifyUIWebsiteEvent>;
206
+ export declare const isUIWebsite: z.ZodObject<{
207
+ id: z.ZodString;
208
+ url: z.ZodString;
209
+ visible: z.ZodBoolean;
210
+ allowApi: z.ZodBoolean;
211
+ allowPolicy: z.ZodString;
212
+ position: z.ZodObject<{
213
+ vertical: z.ZodEnum<["top", "middle", "bottom"]>;
214
+ horizontal: z.ZodEnum<["left", "middle", "right"]>;
215
+ }, "strip", z.ZodTypeAny, {
216
+ vertical: "top" | "middle" | "bottom";
217
+ horizontal: "right" | "left" | "middle";
218
+ }, {
219
+ vertical: "top" | "middle" | "bottom";
220
+ horizontal: "right" | "left" | "middle";
221
+ }>;
222
+ size: z.ZodObject<{
223
+ height: z.ZodString;
224
+ width: z.ZodString;
225
+ }, "strip", z.ZodTypeAny, {
226
+ width: string;
227
+ height: string;
228
+ }, {
229
+ width: string;
230
+ height: string;
231
+ }>;
232
+ margin: z.ZodOptional<z.ZodObject<{
233
+ top: z.ZodOptional<z.ZodString>;
234
+ bottom: z.ZodOptional<z.ZodString>;
235
+ left: z.ZodOptional<z.ZodString>;
236
+ right: z.ZodOptional<z.ZodString>;
237
+ }, "strip", z.ZodTypeAny, {
238
+ right?: string | undefined;
239
+ left?: string | undefined;
240
+ top?: string | undefined;
241
+ bottom?: string | undefined;
242
+ }, {
243
+ right?: string | undefined;
244
+ left?: string | undefined;
245
+ top?: string | undefined;
246
+ bottom?: string | undefined;
247
+ }>>;
248
+ }, "strip", z.ZodTypeAny, {
249
+ margin?: {
250
+ right?: string | undefined;
251
+ left?: string | undefined;
252
+ top?: string | undefined;
253
+ bottom?: string | undefined;
254
+ } | undefined;
255
+ url: string;
256
+ allowApi: boolean;
257
+ allowPolicy: string;
258
+ position: {
259
+ vertical: "top" | "middle" | "bottom";
260
+ horizontal: "right" | "left" | "middle";
261
+ };
262
+ id: string;
263
+ visible: boolean;
264
+ size: {
265
+ width: string;
266
+ height: string;
267
+ };
268
+ }, {
269
+ margin?: {
270
+ right?: string | undefined;
271
+ left?: string | undefined;
272
+ top?: string | undefined;
273
+ bottom?: string | undefined;
274
+ } | undefined;
275
+ url: string;
276
+ allowApi: boolean;
277
+ allowPolicy: string;
278
+ position: {
279
+ vertical: "top" | "middle" | "bottom";
280
+ horizontal: "right" | "left" | "middle";
281
+ };
282
+ id: string;
283
+ visible: boolean;
284
+ size: {
285
+ width: string;
286
+ height: string;
287
+ };
288
+ }>;
289
+ export declare type UIWebsite = z.infer<typeof isUIWebsite>;
@@ -1,12 +1,12 @@
1
- import type * as tg from "generic-type-guard";
2
- import type { IframeEvent, IframeEventMap, IframeQuery, IframeQueryMap, IframeResponseEventMap } from "../Events/IframeEvent";
3
- export declare function sendToWorkadventure(content: IframeEvent<keyof IframeEventMap>): void;
1
+ import { z } from "zod";
2
+ import type { IframeEvent, IframeQuery, IframeQueryMap, IframeResponseEventMap } from "../Events/IframeEvent";
3
+ export declare function sendToWorkadventure(content: IframeEvent): void;
4
4
  export declare const answerPromises: Map<number, {
5
5
  resolve: (value: IframeQueryMap[keyof IframeQueryMap]["answer"] | PromiseLike<IframeQueryMap[keyof IframeQueryMap]["answer"]>) => void;
6
6
  reject: (reason?: any) => void;
7
7
  }>;
8
8
  export declare function queryWorkadventure<T extends keyof IframeQueryMap>(content: IframeQuery<T>): Promise<IframeQueryMap[T]["answer"]>;
9
- export interface IframeCallback<Key extends keyof IframeResponseEventMap, T = IframeResponseEventMap[Key], Guard = tg.TypeGuard<T>> {
9
+ export interface IframeCallback<Key extends keyof IframeResponseEventMap, T = IframeResponseEventMap[Key], Guard = z.ZodType<T>> {
10
10
  typeChecker: Guard;
11
11
  callback: (payloadData: T) => void;
12
12
  }
@@ -0,0 +1,33 @@
1
+ import { CreateUIWebsiteEvent, UIWebsiteMargin, UIWebsitePosition, UIWebsiteSize, UIWebsite as UIWebsiteCore } from "../../Events/ui/UIWebsite";
2
+ import { IframeApiContribution } from "../IframeApiContribution";
3
+ export declare class UIWebsite {
4
+ readonly id: string;
5
+ private _url;
6
+ private _visible;
7
+ private readonly _allowPolicy;
8
+ private readonly _allowApi;
9
+ private _position;
10
+ private _size;
11
+ private _margin;
12
+ constructor(config: UIWebsiteCore);
13
+ get url(): string;
14
+ set url(url: string);
15
+ get visible(): boolean;
16
+ set visible(visible: boolean);
17
+ get allowPolicy(): string;
18
+ get allowApi(): boolean;
19
+ get position(): UIWebsitePosition;
20
+ set position(position: UIWebsitePosition);
21
+ get size(): UIWebsiteSize;
22
+ set size(size: UIWebsiteSize);
23
+ get margin(): UIWebsiteMargin;
24
+ set margin(margin: UIWebsiteMargin);
25
+ close(): Promise<void>;
26
+ }
27
+ export declare class UIWebsiteCommands extends IframeApiContribution<UIWebsiteCommands> {
28
+ callbacks: never[];
29
+ open(createUIWebsite: CreateUIWebsiteEvent): Promise<UIWebsite>;
30
+ getAll(): Promise<UIWebsite[]>;
31
+ }
32
+ declare const _default: UIWebsiteCommands;
33
+ export default _default;
@@ -3,6 +3,8 @@ export declare class WorkadventureControlsCommands extends IframeApiContribution
3
3
  callbacks: never[];
4
4
  disablePlayerControls(): void;
5
5
  restorePlayerControls(): void;
6
+ disablePlayerProximityMeeting(): void;
7
+ restorePlayerProximityMeeting(): void;
6
8
  }
7
9
  declare const _default: WorkadventureControlsCommands;
8
10
  export default _default;
@@ -5,6 +5,7 @@ import { ActionMessage } from "./Ui/ActionMessage";
5
5
  import { Menu } from "./Ui/Menu";
6
6
  import type { RequireOnlyOne } from "../types";
7
7
  import { Observable, Subject } from "rxjs";
8
+ import type { UIWebsiteCommands } from "./Ui/UIWebsite";
8
9
  interface MenuDescriptor {
9
10
  callback?: (commandDescriptor: string) => void;
10
11
  iframe?: string;
@@ -48,6 +49,7 @@ export declare class WorkAdventureUiCommands extends IframeApiContribution<WorkA
48
49
  displayBubble(): void;
49
50
  removeBubble(): void;
50
51
  displayActionMessage(actionMessageOptions: ActionMessageOptions): ActionMessage;
52
+ get website(): UIWebsiteCommands;
51
53
  }
52
54
  declare const _default: WorkAdventureUiCommands;
53
55
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workadventure/iframe-api-typings",
3
- "version": "v1.9.5",
3
+ "version": "v1.10.2",
4
4
  "description": "Typescript typings for WorkAdventure iFrame API",
5
5
  "main": "iframe_api.js",
6
6
  "types": "iframe_api.d.ts",
@@ -1,8 +0,0 @@
1
- import * as tg from "generic-type-guard";
2
- export declare const isChangeZoneEvent: tg.TypeGuard<object & {
3
- name: string;
4
- }>;
5
- /**
6
- * A message sent from the game to the iFrame when a user enters or leaves a zone.
7
- */
8
- export declare type ChangeZoneEvent = tg.GuardedType<typeof isChangeZoneEvent>;