@workadventure/iframe-api-typings 1.26.15 → 1.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -2
- package/play/src/front/Api/Events/IframeEvent.d.ts +10 -5
- package/play/src/front/Api/Events/MessagePortEvents.d.ts +393 -0
- package/play/src/front/Api/Events/NewSpaceUserEvent.d.ts +45 -0
- package/play/src/front/Api/Events/Ui/ButtonActionBarEvent.d.ts +5 -2
- package/play/src/front/Api/Iframe/CheckedIframeMessagePort.d.ts +18 -0
- package/play/src/front/Api/Iframe/IframeApiContribution.d.ts +13 -2
- package/play/src/front/Api/Iframe/Player/AudioStream.d.ts +5 -0
- package/play/src/front/Api/Iframe/Spaces/Space.d.ts +25 -0
- package/play/src/front/Api/Iframe/Spaces/SpaceUser.d.ts +8 -0
- package/play/src/front/Api/Iframe/spaces.d.ts +23 -0
- package/play/src/iframe_api.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workadventure/iframe-api-typings",
|
|
3
|
-
"version": "v1.
|
|
3
|
+
"version": "v1.27.1",
|
|
4
4
|
"description": "Typescript typings for WorkAdventure iFrame API",
|
|
5
5
|
"main": "iframe_api.js",
|
|
6
6
|
"types": "iframe_api.d.ts",
|
|
7
|
-
"repository":
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/workadventure/workadventure.git"
|
|
10
|
+
},
|
|
8
11
|
"author": "David Négrier <d.negrier@thecodingmachine.com>",
|
|
9
12
|
"license": "MIT",
|
|
10
13
|
"publishConfig": {
|
|
@@ -1227,15 +1227,17 @@ export declare const isIframeEventWrapper: z.ZodUnion<[z.ZodObject<{
|
|
|
1227
1227
|
bgColor: z.ZodOptional<z.ZodString>;
|
|
1228
1228
|
textColor: z.ZodOptional<z.ZodString>;
|
|
1229
1229
|
imageSrc: z.ZodOptional<z.ZodString>;
|
|
1230
|
-
isGradient: z.
|
|
1230
|
+
isGradient: z.ZodOptional<z.ZodBoolean>;
|
|
1231
|
+
location: z.ZodOptional<z.ZodEnum<["top", "appsMenu", "buildMenu", "profileMenu"]>>;
|
|
1231
1232
|
}, "strip", z.ZodTypeAny, {
|
|
1232
1233
|
id: string;
|
|
1233
|
-
isGradient: boolean;
|
|
1234
1234
|
label?: string | undefined;
|
|
1235
1235
|
toolTip?: string | undefined;
|
|
1236
1236
|
bgColor?: string | undefined;
|
|
1237
1237
|
textColor?: string | undefined;
|
|
1238
1238
|
imageSrc?: string | undefined;
|
|
1239
|
+
isGradient?: boolean | undefined;
|
|
1240
|
+
location?: "top" | "appsMenu" | "buildMenu" | "profileMenu" | undefined;
|
|
1239
1241
|
}, {
|
|
1240
1242
|
id: string;
|
|
1241
1243
|
label?: string | undefined;
|
|
@@ -1244,17 +1246,19 @@ export declare const isIframeEventWrapper: z.ZodUnion<[z.ZodObject<{
|
|
|
1244
1246
|
textColor?: string | undefined;
|
|
1245
1247
|
imageSrc?: string | undefined;
|
|
1246
1248
|
isGradient?: boolean | undefined;
|
|
1249
|
+
location?: "top" | "appsMenu" | "buildMenu" | "profileMenu" | undefined;
|
|
1247
1250
|
}>;
|
|
1248
1251
|
}, "strip", z.ZodTypeAny, {
|
|
1249
1252
|
type: "addButtonActionBar";
|
|
1250
1253
|
data: {
|
|
1251
1254
|
id: string;
|
|
1252
|
-
isGradient: boolean;
|
|
1253
1255
|
label?: string | undefined;
|
|
1254
1256
|
toolTip?: string | undefined;
|
|
1255
1257
|
bgColor?: string | undefined;
|
|
1256
1258
|
textColor?: string | undefined;
|
|
1257
1259
|
imageSrc?: string | undefined;
|
|
1260
|
+
isGradient?: boolean | undefined;
|
|
1261
|
+
location?: "top" | "appsMenu" | "buildMenu" | "profileMenu" | undefined;
|
|
1258
1262
|
};
|
|
1259
1263
|
}, {
|
|
1260
1264
|
type: "addButtonActionBar";
|
|
@@ -1266,6 +1270,7 @@ export declare const isIframeEventWrapper: z.ZodUnion<[z.ZodObject<{
|
|
|
1266
1270
|
textColor?: string | undefined;
|
|
1267
1271
|
imageSrc?: string | undefined;
|
|
1268
1272
|
isGradient?: boolean | undefined;
|
|
1273
|
+
location?: "top" | "appsMenu" | "buildMenu" | "profileMenu" | undefined;
|
|
1269
1274
|
};
|
|
1270
1275
|
}>, z.ZodObject<{
|
|
1271
1276
|
type: z.ZodLiteral<"removeButtonActionBar">;
|
|
@@ -4306,7 +4311,7 @@ export declare const iframeQueryMapTypeGuards: {
|
|
|
4306
4311
|
};
|
|
4307
4312
|
};
|
|
4308
4313
|
type IframeQueryMapTypeGuardsType = typeof iframeQueryMapTypeGuards;
|
|
4309
|
-
type UnknownToVoid<T> = undefined extends T ? void : T;
|
|
4314
|
+
export type UnknownToVoid<T> = undefined extends T ? void : T;
|
|
4310
4315
|
export type IframeQueryMap = {
|
|
4311
4316
|
[key in keyof IframeQueryMapTypeGuardsType]: {
|
|
4312
4317
|
query: z.infer<(typeof iframeQueryMapTypeGuards)[key]["query"]>;
|
|
@@ -4344,7 +4349,7 @@ export declare const isIframeErrorAnswerEvent: z.ZodObject<{
|
|
|
4344
4349
|
id: number;
|
|
4345
4350
|
}>;
|
|
4346
4351
|
/**
|
|
4347
|
-
* A message sent from the game to the iFrame when
|
|
4352
|
+
* A message sent from the game to the iFrame when an error occurs while processing a query.
|
|
4348
4353
|
*/
|
|
4349
4354
|
export type IframeErrorAnswerEvent = z.infer<typeof isIframeErrorAnswerEvent>;
|
|
4350
4355
|
export {};
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* List of events that can open a message channel/port between the game and the iFrame.
|
|
4
|
+
* For each message port, we define a type (key), zod validator for data passed on creation, and the
|
|
5
|
+
* list of events that can be sent and received through this message port.
|
|
6
|
+
*/
|
|
7
|
+
export declare const iframeMessagePortTypeGuards: {
|
|
8
|
+
joinSpace: {
|
|
9
|
+
data: z.ZodObject<{
|
|
10
|
+
spaceName: z.ZodString;
|
|
11
|
+
filterType: z.ZodEnum<["everyone", "streaming"]>;
|
|
12
|
+
propertiesToSync: z.ZodArray<z.ZodString, "many">;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
spaceName: string;
|
|
15
|
+
filterType: "everyone" | "streaming";
|
|
16
|
+
propertiesToSync: string[];
|
|
17
|
+
}, {
|
|
18
|
+
spaceName: string;
|
|
19
|
+
filterType: "everyone" | "streaming";
|
|
20
|
+
propertiesToSync: string[];
|
|
21
|
+
}>;
|
|
22
|
+
iframeEvents: z.ZodUnion<[z.ZodObject<{
|
|
23
|
+
type: z.ZodLiteral<"watch">;
|
|
24
|
+
data: z.ZodUndefined;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
type: "watch";
|
|
27
|
+
data?: undefined;
|
|
28
|
+
}, {
|
|
29
|
+
type: "watch";
|
|
30
|
+
data?: undefined;
|
|
31
|
+
}>, z.ZodObject<{
|
|
32
|
+
type: z.ZodLiteral<"unwatch">;
|
|
33
|
+
data: z.ZodUndefined;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
type: "unwatch";
|
|
36
|
+
data?: undefined;
|
|
37
|
+
}, {
|
|
38
|
+
type: "unwatch";
|
|
39
|
+
data?: undefined;
|
|
40
|
+
}>, z.ZodObject<{
|
|
41
|
+
type: z.ZodLiteral<"leave">;
|
|
42
|
+
data: z.ZodUndefined;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
type: "leave";
|
|
45
|
+
data?: undefined;
|
|
46
|
+
}, {
|
|
47
|
+
type: "leave";
|
|
48
|
+
data?: undefined;
|
|
49
|
+
}>, z.ZodObject<{
|
|
50
|
+
type: z.ZodLiteral<"startStreaming">;
|
|
51
|
+
data: z.ZodUndefined;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
type: "startStreaming";
|
|
54
|
+
data?: undefined;
|
|
55
|
+
}, {
|
|
56
|
+
type: "startStreaming";
|
|
57
|
+
data?: undefined;
|
|
58
|
+
}>, z.ZodObject<{
|
|
59
|
+
type: z.ZodLiteral<"stopStreaming">;
|
|
60
|
+
data: z.ZodUndefined;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
type: "stopStreaming";
|
|
63
|
+
data?: undefined;
|
|
64
|
+
}, {
|
|
65
|
+
type: "stopStreaming";
|
|
66
|
+
data?: undefined;
|
|
67
|
+
}>, z.ZodObject<{
|
|
68
|
+
type: z.ZodLiteral<"setMetadata">;
|
|
69
|
+
data: z.ZodObject<{
|
|
70
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
metadata: Record<string, unknown>;
|
|
73
|
+
}, {
|
|
74
|
+
metadata: Record<string, unknown>;
|
|
75
|
+
}>;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
type: "setMetadata";
|
|
78
|
+
data: {
|
|
79
|
+
metadata: Record<string, unknown>;
|
|
80
|
+
};
|
|
81
|
+
}, {
|
|
82
|
+
type: "setMetadata";
|
|
83
|
+
data: {
|
|
84
|
+
metadata: Record<string, unknown>;
|
|
85
|
+
};
|
|
86
|
+
}>]>;
|
|
87
|
+
workAdventureEvents: z.ZodUnion<[z.ZodObject<{
|
|
88
|
+
type: z.ZodLiteral<"onNewUser">;
|
|
89
|
+
data: z.ZodObject<{
|
|
90
|
+
spaceUserId: z.ZodString;
|
|
91
|
+
name: z.ZodString;
|
|
92
|
+
playUri: z.ZodString;
|
|
93
|
+
isLogged: z.ZodBoolean;
|
|
94
|
+
availabilityStatus: z.ZodNumber;
|
|
95
|
+
tags: z.ZodArray<z.ZodString, "many">;
|
|
96
|
+
cameraState: z.ZodBoolean;
|
|
97
|
+
microphoneState: z.ZodBoolean;
|
|
98
|
+
screenSharingState: z.ZodBoolean;
|
|
99
|
+
megaphoneState: z.ZodBoolean;
|
|
100
|
+
uuid: z.ZodString;
|
|
101
|
+
chatID: z.ZodOptional<z.ZodString>;
|
|
102
|
+
showVoiceIndicator: z.ZodBoolean;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
name: string;
|
|
105
|
+
uuid: string;
|
|
106
|
+
tags: string[];
|
|
107
|
+
isLogged: boolean;
|
|
108
|
+
playUri: string;
|
|
109
|
+
availabilityStatus: number;
|
|
110
|
+
spaceUserId: string;
|
|
111
|
+
cameraState: boolean;
|
|
112
|
+
microphoneState: boolean;
|
|
113
|
+
screenSharingState: boolean;
|
|
114
|
+
megaphoneState: boolean;
|
|
115
|
+
showVoiceIndicator: boolean;
|
|
116
|
+
chatID?: string | undefined;
|
|
117
|
+
}, {
|
|
118
|
+
name: string;
|
|
119
|
+
uuid: string;
|
|
120
|
+
tags: string[];
|
|
121
|
+
isLogged: boolean;
|
|
122
|
+
playUri: string;
|
|
123
|
+
availabilityStatus: number;
|
|
124
|
+
spaceUserId: string;
|
|
125
|
+
cameraState: boolean;
|
|
126
|
+
microphoneState: boolean;
|
|
127
|
+
screenSharingState: boolean;
|
|
128
|
+
megaphoneState: boolean;
|
|
129
|
+
showVoiceIndicator: boolean;
|
|
130
|
+
chatID?: string | undefined;
|
|
131
|
+
}>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
type: "onNewUser";
|
|
134
|
+
data: {
|
|
135
|
+
name: string;
|
|
136
|
+
uuid: string;
|
|
137
|
+
tags: string[];
|
|
138
|
+
isLogged: boolean;
|
|
139
|
+
playUri: string;
|
|
140
|
+
availabilityStatus: number;
|
|
141
|
+
spaceUserId: string;
|
|
142
|
+
cameraState: boolean;
|
|
143
|
+
microphoneState: boolean;
|
|
144
|
+
screenSharingState: boolean;
|
|
145
|
+
megaphoneState: boolean;
|
|
146
|
+
showVoiceIndicator: boolean;
|
|
147
|
+
chatID?: string | undefined;
|
|
148
|
+
};
|
|
149
|
+
}, {
|
|
150
|
+
type: "onNewUser";
|
|
151
|
+
data: {
|
|
152
|
+
name: string;
|
|
153
|
+
uuid: string;
|
|
154
|
+
tags: string[];
|
|
155
|
+
isLogged: boolean;
|
|
156
|
+
playUri: string;
|
|
157
|
+
availabilityStatus: number;
|
|
158
|
+
spaceUserId: string;
|
|
159
|
+
cameraState: boolean;
|
|
160
|
+
microphoneState: boolean;
|
|
161
|
+
screenSharingState: boolean;
|
|
162
|
+
megaphoneState: boolean;
|
|
163
|
+
showVoiceIndicator: boolean;
|
|
164
|
+
chatID?: string | undefined;
|
|
165
|
+
};
|
|
166
|
+
}>, z.ZodObject<{
|
|
167
|
+
type: z.ZodLiteral<"onDeleteUser">;
|
|
168
|
+
data: z.ZodObject<{
|
|
169
|
+
spaceUserId: z.ZodString;
|
|
170
|
+
}, "strip", z.ZodTypeAny, {
|
|
171
|
+
spaceUserId: string;
|
|
172
|
+
}, {
|
|
173
|
+
spaceUserId: string;
|
|
174
|
+
}>;
|
|
175
|
+
}, "strip", z.ZodTypeAny, {
|
|
176
|
+
type: "onDeleteUser";
|
|
177
|
+
data: {
|
|
178
|
+
spaceUserId: string;
|
|
179
|
+
};
|
|
180
|
+
}, {
|
|
181
|
+
type: "onDeleteUser";
|
|
182
|
+
data: {
|
|
183
|
+
spaceUserId: string;
|
|
184
|
+
};
|
|
185
|
+
}>, z.ZodObject<{
|
|
186
|
+
type: z.ZodLiteral<"onUpdateUser">;
|
|
187
|
+
data: z.ZodObject<{
|
|
188
|
+
spaceUserId: z.ZodString;
|
|
189
|
+
changes: z.ZodObject<{
|
|
190
|
+
spaceUserId: z.ZodOptional<z.ZodString>;
|
|
191
|
+
name: z.ZodOptional<z.ZodString>;
|
|
192
|
+
playUri: z.ZodOptional<z.ZodString>;
|
|
193
|
+
isLogged: z.ZodOptional<z.ZodBoolean>;
|
|
194
|
+
availabilityStatus: z.ZodOptional<z.ZodNumber>;
|
|
195
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
196
|
+
cameraState: z.ZodOptional<z.ZodBoolean>;
|
|
197
|
+
microphoneState: z.ZodOptional<z.ZodBoolean>;
|
|
198
|
+
screenSharingState: z.ZodOptional<z.ZodBoolean>;
|
|
199
|
+
megaphoneState: z.ZodOptional<z.ZodBoolean>;
|
|
200
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
201
|
+
chatID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
202
|
+
showVoiceIndicator: z.ZodOptional<z.ZodBoolean>;
|
|
203
|
+
}, "strip", z.ZodTypeAny, {
|
|
204
|
+
name?: string | undefined;
|
|
205
|
+
uuid?: string | undefined;
|
|
206
|
+
tags?: string[] | undefined;
|
|
207
|
+
isLogged?: boolean | undefined;
|
|
208
|
+
playUri?: string | undefined;
|
|
209
|
+
availabilityStatus?: number | undefined;
|
|
210
|
+
chatID?: string | undefined;
|
|
211
|
+
spaceUserId?: string | undefined;
|
|
212
|
+
cameraState?: boolean | undefined;
|
|
213
|
+
microphoneState?: boolean | undefined;
|
|
214
|
+
screenSharingState?: boolean | undefined;
|
|
215
|
+
megaphoneState?: boolean | undefined;
|
|
216
|
+
showVoiceIndicator?: boolean | undefined;
|
|
217
|
+
}, {
|
|
218
|
+
name?: string | undefined;
|
|
219
|
+
uuid?: string | undefined;
|
|
220
|
+
tags?: string[] | undefined;
|
|
221
|
+
isLogged?: boolean | undefined;
|
|
222
|
+
playUri?: string | undefined;
|
|
223
|
+
availabilityStatus?: number | undefined;
|
|
224
|
+
chatID?: string | undefined;
|
|
225
|
+
spaceUserId?: string | undefined;
|
|
226
|
+
cameraState?: boolean | undefined;
|
|
227
|
+
microphoneState?: boolean | undefined;
|
|
228
|
+
screenSharingState?: boolean | undefined;
|
|
229
|
+
megaphoneState?: boolean | undefined;
|
|
230
|
+
showVoiceIndicator?: boolean | undefined;
|
|
231
|
+
}>;
|
|
232
|
+
updateMask: z.ZodArray<z.ZodString, "many">;
|
|
233
|
+
}, "strip", z.ZodTypeAny, {
|
|
234
|
+
spaceUserId: string;
|
|
235
|
+
changes: {
|
|
236
|
+
name?: string | undefined;
|
|
237
|
+
uuid?: string | undefined;
|
|
238
|
+
tags?: string[] | undefined;
|
|
239
|
+
isLogged?: boolean | undefined;
|
|
240
|
+
playUri?: string | undefined;
|
|
241
|
+
availabilityStatus?: number | undefined;
|
|
242
|
+
chatID?: string | undefined;
|
|
243
|
+
spaceUserId?: string | undefined;
|
|
244
|
+
cameraState?: boolean | undefined;
|
|
245
|
+
microphoneState?: boolean | undefined;
|
|
246
|
+
screenSharingState?: boolean | undefined;
|
|
247
|
+
megaphoneState?: boolean | undefined;
|
|
248
|
+
showVoiceIndicator?: boolean | undefined;
|
|
249
|
+
};
|
|
250
|
+
updateMask: string[];
|
|
251
|
+
}, {
|
|
252
|
+
spaceUserId: string;
|
|
253
|
+
changes: {
|
|
254
|
+
name?: string | undefined;
|
|
255
|
+
uuid?: string | undefined;
|
|
256
|
+
tags?: string[] | undefined;
|
|
257
|
+
isLogged?: boolean | undefined;
|
|
258
|
+
playUri?: string | undefined;
|
|
259
|
+
availabilityStatus?: number | undefined;
|
|
260
|
+
chatID?: string | undefined;
|
|
261
|
+
spaceUserId?: string | undefined;
|
|
262
|
+
cameraState?: boolean | undefined;
|
|
263
|
+
microphoneState?: boolean | undefined;
|
|
264
|
+
screenSharingState?: boolean | undefined;
|
|
265
|
+
megaphoneState?: boolean | undefined;
|
|
266
|
+
showVoiceIndicator?: boolean | undefined;
|
|
267
|
+
};
|
|
268
|
+
updateMask: string[];
|
|
269
|
+
}>;
|
|
270
|
+
}, "strip", z.ZodTypeAny, {
|
|
271
|
+
type: "onUpdateUser";
|
|
272
|
+
data: {
|
|
273
|
+
spaceUserId: string;
|
|
274
|
+
changes: {
|
|
275
|
+
name?: string | undefined;
|
|
276
|
+
uuid?: string | undefined;
|
|
277
|
+
tags?: string[] | undefined;
|
|
278
|
+
isLogged?: boolean | undefined;
|
|
279
|
+
playUri?: string | undefined;
|
|
280
|
+
availabilityStatus?: number | undefined;
|
|
281
|
+
chatID?: string | undefined;
|
|
282
|
+
spaceUserId?: string | undefined;
|
|
283
|
+
cameraState?: boolean | undefined;
|
|
284
|
+
microphoneState?: boolean | undefined;
|
|
285
|
+
screenSharingState?: boolean | undefined;
|
|
286
|
+
megaphoneState?: boolean | undefined;
|
|
287
|
+
showVoiceIndicator?: boolean | undefined;
|
|
288
|
+
};
|
|
289
|
+
updateMask: string[];
|
|
290
|
+
};
|
|
291
|
+
}, {
|
|
292
|
+
type: "onUpdateUser";
|
|
293
|
+
data: {
|
|
294
|
+
spaceUserId: string;
|
|
295
|
+
changes: {
|
|
296
|
+
name?: string | undefined;
|
|
297
|
+
uuid?: string | undefined;
|
|
298
|
+
tags?: string[] | undefined;
|
|
299
|
+
isLogged?: boolean | undefined;
|
|
300
|
+
playUri?: string | undefined;
|
|
301
|
+
availabilityStatus?: number | undefined;
|
|
302
|
+
chatID?: string | undefined;
|
|
303
|
+
spaceUserId?: string | undefined;
|
|
304
|
+
cameraState?: boolean | undefined;
|
|
305
|
+
microphoneState?: boolean | undefined;
|
|
306
|
+
screenSharingState?: boolean | undefined;
|
|
307
|
+
megaphoneState?: boolean | undefined;
|
|
308
|
+
showVoiceIndicator?: boolean | undefined;
|
|
309
|
+
};
|
|
310
|
+
updateMask: string[];
|
|
311
|
+
};
|
|
312
|
+
}>, z.ZodObject<{
|
|
313
|
+
type: z.ZodLiteral<"onSetMetadata">;
|
|
314
|
+
data: z.ZodObject<{
|
|
315
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
316
|
+
}, "strip", z.ZodTypeAny, {
|
|
317
|
+
metadata: Record<string, unknown>;
|
|
318
|
+
}, {
|
|
319
|
+
metadata: Record<string, unknown>;
|
|
320
|
+
}>;
|
|
321
|
+
}, "strip", z.ZodTypeAny, {
|
|
322
|
+
type: "onSetMetadata";
|
|
323
|
+
data: {
|
|
324
|
+
metadata: Record<string, unknown>;
|
|
325
|
+
};
|
|
326
|
+
}, {
|
|
327
|
+
type: "onSetMetadata";
|
|
328
|
+
data: {
|
|
329
|
+
metadata: Record<string, unknown>;
|
|
330
|
+
};
|
|
331
|
+
}>]>;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
type IframeMessagePortTypeGuards = typeof iframeMessagePortTypeGuards;
|
|
335
|
+
export type IframeMessagePortMap = {
|
|
336
|
+
[key in keyof IframeMessagePortTypeGuards]: {
|
|
337
|
+
data: z.infer<IframeMessagePortTypeGuards[key]["data"]>;
|
|
338
|
+
iframeEvents: z.infer<IframeMessagePortTypeGuards[key]["iframeEvents"]>;
|
|
339
|
+
workAdventureEvents: IframeMessagePortTypeGuards[key]["workAdventureEvents"];
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
export interface IframeMessagePortData<T extends keyof IframeMessagePortMap> {
|
|
343
|
+
type: T;
|
|
344
|
+
data: IframeMessagePortMap[T]["data"];
|
|
345
|
+
}
|
|
346
|
+
export interface MessagePortIframeEvent<T extends keyof IframeMessagePortMap> {
|
|
347
|
+
type: T;
|
|
348
|
+
data: IframeMessagePortMap[T]["iframeEvents"];
|
|
349
|
+
}
|
|
350
|
+
export interface MessagePortWorkAdventureEvent<T extends keyof IframeMessagePortMap> {
|
|
351
|
+
type: T;
|
|
352
|
+
data: IframeMessagePortMap[T]["workAdventureEvents"];
|
|
353
|
+
}
|
|
354
|
+
export declare const isIframeMessagePortType: (type: string) => type is keyof IframeMessagePortMap;
|
|
355
|
+
export interface IframeMessagePortWrapper<T extends keyof IframeMessagePortMap> {
|
|
356
|
+
messagePort: true;
|
|
357
|
+
id: number;
|
|
358
|
+
type: T;
|
|
359
|
+
data: IframeMessagePortMap[T]["data"];
|
|
360
|
+
}
|
|
361
|
+
export declare const isIframeMessagePortWrapper: (event: any) => event is IframeMessagePortWrapper<keyof IframeMessagePortMap>;
|
|
362
|
+
export declare const isIframeErrorMessagePortEvent: z.ZodObject<{
|
|
363
|
+
id: z.ZodNumber;
|
|
364
|
+
error: z.ZodString;
|
|
365
|
+
messagePort: z.ZodLiteral<true>;
|
|
366
|
+
}, "strip", z.ZodTypeAny, {
|
|
367
|
+
error: string;
|
|
368
|
+
id: number;
|
|
369
|
+
messagePort: true;
|
|
370
|
+
}, {
|
|
371
|
+
error: string;
|
|
372
|
+
id: number;
|
|
373
|
+
messagePort: true;
|
|
374
|
+
}>;
|
|
375
|
+
/**
|
|
376
|
+
* A message sent from the game to the iFrame when an error occurs while processing a message port opening.
|
|
377
|
+
*/
|
|
378
|
+
export type IframeErrorMessagePortEvent = z.infer<typeof isIframeErrorMessagePortEvent>;
|
|
379
|
+
export declare const isIframeSuccessMessagePortEvent: z.ZodObject<{
|
|
380
|
+
id: z.ZodNumber;
|
|
381
|
+
messagePort: z.ZodLiteral<true>;
|
|
382
|
+
}, "strip", z.ZodTypeAny, {
|
|
383
|
+
id: number;
|
|
384
|
+
messagePort: true;
|
|
385
|
+
}, {
|
|
386
|
+
id: number;
|
|
387
|
+
messagePort: true;
|
|
388
|
+
}>;
|
|
389
|
+
/**
|
|
390
|
+
* A message sent from the game to the iFrame when an error occurs while processing a message port opening.
|
|
391
|
+
*/
|
|
392
|
+
export type IframeSuccessMessagePortEvent = z.infer<typeof isIframeSuccessMessagePortEvent>;
|
|
393
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const NewSpaceUserEvent: z.ZodObject<{
|
|
3
|
+
spaceUserId: z.ZodString;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
playUri: z.ZodString;
|
|
6
|
+
isLogged: z.ZodBoolean;
|
|
7
|
+
availabilityStatus: z.ZodNumber;
|
|
8
|
+
tags: z.ZodArray<z.ZodString, "many">;
|
|
9
|
+
cameraState: z.ZodBoolean;
|
|
10
|
+
microphoneState: z.ZodBoolean;
|
|
11
|
+
screenSharingState: z.ZodBoolean;
|
|
12
|
+
megaphoneState: z.ZodBoolean;
|
|
13
|
+
uuid: z.ZodString;
|
|
14
|
+
chatID: z.ZodOptional<z.ZodString>;
|
|
15
|
+
showVoiceIndicator: z.ZodBoolean;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
name: string;
|
|
18
|
+
uuid: string;
|
|
19
|
+
tags: string[];
|
|
20
|
+
isLogged: boolean;
|
|
21
|
+
playUri: string;
|
|
22
|
+
availabilityStatus: number;
|
|
23
|
+
spaceUserId: string;
|
|
24
|
+
cameraState: boolean;
|
|
25
|
+
microphoneState: boolean;
|
|
26
|
+
screenSharingState: boolean;
|
|
27
|
+
megaphoneState: boolean;
|
|
28
|
+
showVoiceIndicator: boolean;
|
|
29
|
+
chatID?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
name: string;
|
|
32
|
+
uuid: string;
|
|
33
|
+
tags: string[];
|
|
34
|
+
isLogged: boolean;
|
|
35
|
+
playUri: string;
|
|
36
|
+
availabilityStatus: number;
|
|
37
|
+
spaceUserId: string;
|
|
38
|
+
cameraState: boolean;
|
|
39
|
+
microphoneState: boolean;
|
|
40
|
+
screenSharingState: boolean;
|
|
41
|
+
megaphoneState: boolean;
|
|
42
|
+
showVoiceIndicator: boolean;
|
|
43
|
+
chatID?: string | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
export type NewSpaceUserEvent = z.infer<typeof NewSpaceUserEvent>;
|
|
@@ -6,15 +6,17 @@ export declare const isAddActionBarButtonEvent: z.ZodObject<{
|
|
|
6
6
|
bgColor: z.ZodOptional<z.ZodString>;
|
|
7
7
|
textColor: z.ZodOptional<z.ZodString>;
|
|
8
8
|
imageSrc: z.ZodOptional<z.ZodString>;
|
|
9
|
-
isGradient: z.
|
|
9
|
+
isGradient: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
location: z.ZodOptional<z.ZodEnum<["top", "appsMenu", "buildMenu", "profileMenu"]>>;
|
|
10
11
|
}, "strip", z.ZodTypeAny, {
|
|
11
12
|
id: string;
|
|
12
|
-
isGradient: boolean;
|
|
13
13
|
label?: string | undefined;
|
|
14
14
|
toolTip?: string | undefined;
|
|
15
15
|
bgColor?: string | undefined;
|
|
16
16
|
textColor?: string | undefined;
|
|
17
17
|
imageSrc?: string | undefined;
|
|
18
|
+
isGradient?: boolean | undefined;
|
|
19
|
+
location?: "top" | "appsMenu" | "buildMenu" | "profileMenu" | undefined;
|
|
18
20
|
}, {
|
|
19
21
|
id: string;
|
|
20
22
|
label?: string | undefined;
|
|
@@ -23,6 +25,7 @@ export declare const isAddActionBarButtonEvent: z.ZodObject<{
|
|
|
23
25
|
textColor?: string | undefined;
|
|
24
26
|
imageSrc?: string | undefined;
|
|
25
27
|
isGradient?: boolean | undefined;
|
|
28
|
+
location?: "top" | "appsMenu" | "buildMenu" | "profileMenu" | undefined;
|
|
26
29
|
}>;
|
|
27
30
|
export type AddButtonActionBarEvent = z.infer<typeof isAddActionBarButtonEvent>;
|
|
28
31
|
export type AddActionButtonActionBarEvent = AddButtonActionBarEvent;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
import { IframeMessagePortMap, MessagePortIframeEvent, MessagePortWorkAdventureEvent } from "../Events/MessagePortEvents";
|
|
4
|
+
type MessagePortMessageEvent<K extends keyof IframeMessagePortMap> = MessageEvent<z.infer<MessagePortWorkAdventureEvent<K>["data"]>>;
|
|
5
|
+
/**
|
|
6
|
+
* A wrapper around a MessagePort that ensures the messages sent and received conform to a specific type.
|
|
7
|
+
* This class is used on the iframe side to communicate with the main application.
|
|
8
|
+
*/
|
|
9
|
+
export declare class CheckedIframeMessagePort<K extends keyof IframeMessagePortMap> {
|
|
10
|
+
private type;
|
|
11
|
+
private readonly port;
|
|
12
|
+
private readonly _messages;
|
|
13
|
+
readonly messages: Observable<MessagePortMessageEvent<K>>;
|
|
14
|
+
constructor(port: MessagePort, type: K);
|
|
15
|
+
postMessage(message: MessagePortIframeEvent<K>["data"]): void;
|
|
16
|
+
close(): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { IframeMessagePortData, IframeMessagePortMap } from "../Events/MessagePortEvents";
|
|
2
|
+
import { IframeEvent, IframeQuery, IframeQueryMap } from "../Events/IframeEvent";
|
|
3
|
+
import { CheckedIframeMessagePort } from "./CheckedIframeMessagePort";
|
|
2
4
|
export declare function sendToWorkadventure(content: IframeEvent, transfer?: Transferable[]): void;
|
|
3
5
|
export declare const answerPromises: Map<number, {
|
|
4
6
|
resolve: (value: IframeQueryMap[keyof IframeQueryMap]["answer"] | PromiseLike<IframeQueryMap[keyof IframeQueryMap]["answer"]>) => void;
|
|
5
7
|
reject: (reason?: any) => void;
|
|
6
8
|
}>;
|
|
7
|
-
export declare
|
|
9
|
+
export declare const answerPromisesMessagePort: Map<number, {
|
|
10
|
+
resolve: () => void;
|
|
11
|
+
reject: (reason?: any) => void;
|
|
12
|
+
}>;
|
|
13
|
+
export declare function queryWorkadventure<T extends keyof IframeQueryMap>(content: IframeQuery<T>, options?: {
|
|
14
|
+
transfer?: Transferable[];
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
timeout?: number | null;
|
|
17
|
+
}): Promise<IframeQueryMap[T]["answer"]>;
|
|
18
|
+
export declare function openMessagePort<K extends keyof IframeMessagePortMap>(type: K, data: IframeMessagePortData<K>["data"]): Promise<CheckedIframeMessagePort<K>>;
|
|
8
19
|
/**
|
|
9
20
|
* !! be aware that the implemented attributes (addMethodsAtRoot and subObjectIdentifier) must be readonly
|
|
10
21
|
*
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export declare class AudioStream {
|
|
2
|
+
/**
|
|
3
|
+
* Append raw PCM audio data to the audio stream.
|
|
4
|
+
* The promise resolves when the sound is played. If the audio buffer is reset with resetAudioBuffer before
|
|
5
|
+
* the data was played, the promise will reject.
|
|
6
|
+
*/
|
|
2
7
|
appendAudioData(float32Array: Float32Array): Promise<void>;
|
|
3
8
|
resetAudioBuffer(): Promise<void>;
|
|
4
9
|
close(): Promise<void>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { CheckedIframeMessagePort } from "../CheckedIframeMessagePort";
|
|
3
|
+
import { SpaceUser } from "./SpaceUser";
|
|
4
|
+
export declare class Space {
|
|
5
|
+
private readonly port;
|
|
6
|
+
private watchCount;
|
|
7
|
+
private messagesSubscription;
|
|
8
|
+
private readonly users;
|
|
9
|
+
readonly userJoinedObservable: Observable<SpaceUser>;
|
|
10
|
+
readonly userLeftObservable: Observable<SpaceUser>;
|
|
11
|
+
readonly metadataObservable: Observable<Map<string, unknown>>;
|
|
12
|
+
private _userJoinedSubscriber;
|
|
13
|
+
private _userLeftSubscriber;
|
|
14
|
+
private _metadataSubscriber;
|
|
15
|
+
private left;
|
|
16
|
+
private metadata;
|
|
17
|
+
constructor(port: CheckedIframeMessagePort<"joinSpace">);
|
|
18
|
+
private createReactiveUser;
|
|
19
|
+
private watch;
|
|
20
|
+
private unwatch;
|
|
21
|
+
leave(): void;
|
|
22
|
+
startStreaming(): void;
|
|
23
|
+
stopStreaming(): void;
|
|
24
|
+
setMetadata(metadata: Map<string, unknown>): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { NewSpaceUserEvent } from "../../Events/NewSpaceUserEvent";
|
|
3
|
+
export type SpaceUser = NewSpaceUserEvent & {
|
|
4
|
+
reactiveUser: ReactiveSpaceUser;
|
|
5
|
+
};
|
|
6
|
+
export type ReactiveSpaceUser = {
|
|
7
|
+
[K in keyof Omit<SpaceUser, "spaceUserId">]: Readonly<Observable<SpaceUser[K]>>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IframeApiContribution } from "./IframeApiContribution";
|
|
2
|
+
import { Space } from "./Spaces/Space";
|
|
3
|
+
export declare class WorkAdventureSpacesCommands extends IframeApiContribution<WorkAdventureSpacesCommands> {
|
|
4
|
+
callbacks: never[];
|
|
5
|
+
/**
|
|
6
|
+
* Joins a space.
|
|
7
|
+
* A space is a structure containing a set of players.
|
|
8
|
+
* Players in a space can talk to each others.
|
|
9
|
+
*
|
|
10
|
+
* Use this if you want some players to be able to talk to each others without going through a bubble or a meeting room.
|
|
11
|
+
* Note: users in the same world, but on different maps, can be part of the same space.
|
|
12
|
+
* The spaceName is scope to the world.
|
|
13
|
+
*
|
|
14
|
+
* {@link https://docs.workadventu.re/map-building/api-spaces.md#start-following-player | Website documentation}
|
|
15
|
+
*
|
|
16
|
+
* @param {string} spaceName Name of the space to join
|
|
17
|
+
* @param {("everyone"|"streaming")} filterType Type of filter to apply when joining the space. This must match the filter decided by the first person joining the space.
|
|
18
|
+
* @param {string[]} propertiesToSync List of properties to listen to. You will be notified if any of these properties change when synchronizing in the space.
|
|
19
|
+
*/
|
|
20
|
+
joinSpace(spaceName: string, filterType: "everyone" | "streaming", propertiesToSync: string[]): Promise<Space>;
|
|
21
|
+
}
|
|
22
|
+
declare const _default: WorkAdventureSpacesCommands;
|
|
23
|
+
export default _default;
|
package/play/src/iframe_api.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ declare const wa: {
|
|
|
29
29
|
player: import("./front/Api/Iframe/player").WorkadventurePlayerCommands;
|
|
30
30
|
players: import("./front/Api/Iframe/players").WorkadventurePlayersCommands;
|
|
31
31
|
camera: import("./front/Api/Iframe/camera").WorkAdventureCameraCommands;
|
|
32
|
+
spaces: import("./front/Api/Iframe/spaces").WorkAdventureSpacesCommands;
|
|
32
33
|
state: import("./front/Api/Iframe/state").WorkadventureStateCommands & import("./front/Api/Iframe/RoomState").RoomState;
|
|
33
34
|
event: import("./front/Api/Iframe/event").WorkadventureEventCommands;
|
|
34
35
|
mapEditor: import("./front/Api/Iframe/mapEditor").WorkadventureMapEditorCommands;
|