@playcademy/sdk 0.0.1-beta.20 → 0.0.1-beta.21

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/dist/index.js CHANGED
@@ -167,10 +167,8 @@ class PlaycademyMessaging {
167
167
  };
168
168
  }
169
169
  sendViaPostMessage(type, payload, target = window.parent, origin = "*") {
170
- let messageData = { type };
171
- if (payload !== undefined && typeof payload === "object" && payload !== null) {
172
- messageData = { ...messageData, ...payload };
173
- } else if (payload !== undefined) {
170
+ const messageData = { type };
171
+ if (payload !== undefined) {
174
172
  messageData.payload = payload;
175
173
  }
176
174
  target.postMessage(messageData, origin);
@@ -377,11 +377,10 @@ declare class PlaycademyMessaging {
377
377
  * **Message Structure**:
378
378
  * The method creates a message object with the following structure:
379
379
  * - `type`: The message event type (e.g., 'PLAYCADEMY_READY')
380
- * - Payload data: Either spread into the object or in a `payload` property
380
+ * - `payload`: The message data (if any)
381
381
  *
382
382
  * **Payload Handling**:
383
- * - **Object payloads**: Spread directly into the message (e.g., { type, token, exp })
384
- * - **Primitive payloads**: Wrapped in a `payload` property (e.g., { type, payload: true })
383
+ * - **All payloads**: Wrapped in a `payload` property for consistency (e.g., { type, payload: data })
385
384
  * - **Undefined payloads**: Only the type is sent (e.g., { type })
386
385
  *
387
386
  * **Security**:
@@ -402,7 +401,7 @@ declare class PlaycademyMessaging {
402
401
  *
403
402
  * // Send telemetry data (object payload)
404
403
  * sendViaPostMessage(MessageEvents.TELEMETRY, { fps: 60, mem: 128 })
405
- * // Sends: { type: 'PLAYCADEMY_TELEMETRY', fps: 60, mem: 128 }
404
+ * // Sends: { type: 'PLAYCADEMY_TELEMETRY', payload: { fps: 60, mem: 128 } }
406
405
  *
407
406
  * // Send overlay state (primitive payload)
408
407
  * sendViaPostMessage(MessageEvents.OVERLAY, true)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@playcademy/sdk",
3
3
  "type": "module",
4
- "version": "0.0.1-beta.20",
4
+ "version": "0.0.1-beta.21",
5
5
  "exports": {
6
6
  ".": {
7
7
  "import": "./dist/index.js",