@playruo/embed 1.5.0 → 1.7.0

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.cjs CHANGED
@@ -31,18 +31,54 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
33
  EmbedTester: () => EmbedTester,
34
+ PLAYRUO_IFRAME_ALLOW: () => PLAYRUO_IFRAME_ALLOW,
34
35
  PLAYRUO_UUID_STORAGE_KEY: () => PLAYRUO_UUID_STORAGE_KEY,
35
36
  PlayruoEmbed: () => PlayruoEmbed,
36
37
  buildEmbedUrl: () => buildEmbedUrl,
37
38
  isPlayruoEmbedMessage: () => isPlayruoEmbedMessage,
38
39
  isPlayruoInternalMessage: () => isPlayruoInternalMessage,
40
+ normalizePlayruoError: () => normalizePlayruoError,
39
41
  resolveVisitorUuid: () => resolveVisitorUuid
40
42
  });
41
43
  module.exports = __toCommonJS(index_exports);
42
44
 
45
+ // src/iframe-allow.ts
46
+ var PLAYRUO_IFRAME_ALLOW = "cross-origin-isolated; fullscreen *; autoplay *; gamepad *; clipboard-write *; web-share *; encrypted-media *; accelerometer *; gyroscope *; screen-wake-lock *";
47
+
43
48
  // src/react/playruo-embed.tsx
44
49
  var import_react = require("react");
45
50
 
51
+ // src/post-message-types.ts
52
+ var normalizePlayruoError = (data) => {
53
+ if (typeof data === "string") {
54
+ return { message: data || "Unknown error" };
55
+ }
56
+ if (!data || typeof data !== "object") {
57
+ return { message: "Unknown error" };
58
+ }
59
+ const record = data;
60
+ const message = typeof record.message === "string" && record.message ? record.message : "Unknown error";
61
+ const details = { message };
62
+ if (typeof record.code === "string") {
63
+ details.code = record.code;
64
+ }
65
+ if (typeof record.event === "string") {
66
+ details.event = record.event;
67
+ }
68
+ return details;
69
+ };
70
+ var isPlayruoEmbedMessage = (data) => {
71
+ if (!data || typeof data !== "object") return false;
72
+ const msg = data;
73
+ if (typeof msg.type !== "string") return false;
74
+ return msg.type === "playruo_ready" || msg.type === "playruo_state_update" || msg.type === "playruo_purchase_request" || msg.type === "playruo_demo_completed" || msg.type === "playruo_error" || msg.type === "playruo_session_over" || msg.type === "playruo_stream_start" || msg.type === "playruo_stream_stop" || msg.type === "REQUEST_EXIT_FULLSCREEN" || msg.type === "playruo_event" || msg.type === "playruo_password_required" || msg.type === "playruo_password_not_required" || msg.type === "playruo_password_result";
75
+ };
76
+ var isPlayruoInternalMessage = (data) => {
77
+ if (!data || typeof data !== "object") return false;
78
+ const msg = data;
79
+ return msg.type === "playruo" && typeof msg.action === "string" && (msg.action === "tryNowClick" || msg.action === "exitFullscreen" || msg.action === "mute" || msg.action === "unmute" || msg.action === "submitPassword" || msg.action === "requestPassword") && msg.fromEmbed === true;
80
+ };
81
+
46
82
  // src/url.ts
47
83
  var PLAYRUO_ORIGIN = "https://playruo.live";
48
84
  var normalizeOperation = (operation) => {
@@ -445,7 +481,7 @@ var PlayruoEmbed = ({
445
481
  console.error("[PlayruoEmbed] Failed to start game:", error);
446
482
  setShowGameIframe(false);
447
483
  setErrorMessage("Failed to start game");
448
- onError?.("Failed to start game");
484
+ onError?.("Failed to start game", { message: "Failed to start game" });
449
485
  }
450
486
  }, [
451
487
  enableWindowedLaunch,
@@ -502,8 +538,9 @@ var PlayruoEmbed = ({
502
538
  console.log("\u{1F537} [Embed] playruo_demo_completed received:", data);
503
539
  cleanupEmbedSession({ payload: data });
504
540
  } else if (type === "playruo_error") {
505
- const errorMessage2 = typeof data === "string" ? data : data?.message || "Unknown error";
506
- console.log("\u{1F537} [Embed] playruo_error received:", errorMessage2);
541
+ const details = normalizePlayruoError(data);
542
+ const errorMessage2 = details.message;
543
+ console.log("\u{1F537} [Embed] playruo_error received:", errorMessage2, details);
507
544
  setErrorMessage(errorMessage2);
508
545
  const errorState = {
509
546
  hasPlayedOnce,
@@ -518,7 +555,7 @@ var PlayruoEmbed = ({
518
555
  };
519
556
  setIframeState(errorState);
520
557
  onStateChange?.(errorState);
521
- onError?.(errorMessage2);
558
+ onError?.(errorMessage2, details);
522
559
  } else if (type === "playruo_session_over" && data) {
523
560
  console.log("\u{1F537} [Embed] playruo_session_over received:", data);
524
561
  void exitEmbedFullscreen({ reason: "playruo_session_over" });
@@ -836,7 +873,7 @@ var PlayruoEmbed = ({
836
873
  {
837
874
  ref: iframeRef,
838
875
  src,
839
- allow: "cross-origin-isolated; fullscreen *; autoplay *; gamepad *; clipboard-write *; web-share *; encrypted-media *; accelerometer *; gyroscope *",
876
+ allow: PLAYRUO_IFRAME_ALLOW,
840
877
  className: "w-full h-[70vh] rounded-lg border",
841
878
  ...{ credentialless: "true" },
842
879
  sandbox: "allow-same-origin allow-scripts allow-popups allow-forms allow-presentation allow-top-navigation allow-modals allow-pointer-lock",
@@ -856,7 +893,7 @@ var PlayruoEmbed = ({
856
893
  onError: () => {
857
894
  console.error("[PlayruoEmbed] Iframe failed to load");
858
895
  setErrorMessage("Failed to load game");
859
- onError?.("Failed to load game");
896
+ onError?.("Failed to load game", { message: "Failed to load game" });
860
897
  }
861
898
  }
862
899
  )
@@ -2129,26 +2166,15 @@ var EmbedTester = (props = {}) => {
2129
2166
  }
2130
2167
  );
2131
2168
  };
2132
-
2133
- // src/post-message-types.ts
2134
- var isPlayruoEmbedMessage = (data) => {
2135
- if (!data || typeof data !== "object") return false;
2136
- const msg = data;
2137
- if (typeof msg.type !== "string") return false;
2138
- return msg.type === "playruo_ready" || msg.type === "playruo_state_update" || msg.type === "playruo_purchase_request" || msg.type === "playruo_demo_completed" || msg.type === "playruo_error" || msg.type === "playruo_session_over" || msg.type === "playruo_stream_start" || msg.type === "playruo_stream_stop" || msg.type === "REQUEST_EXIT_FULLSCREEN" || msg.type === "playruo_event" || msg.type === "playruo_password_required" || msg.type === "playruo_password_not_required" || msg.type === "playruo_password_result";
2139
- };
2140
- var isPlayruoInternalMessage = (data) => {
2141
- if (!data || typeof data !== "object") return false;
2142
- const msg = data;
2143
- return msg.type === "playruo" && typeof msg.action === "string" && (msg.action === "tryNowClick" || msg.action === "exitFullscreen" || msg.action === "mute" || msg.action === "unmute" || msg.action === "submitPassword" || msg.action === "requestPassword") && msg.fromEmbed === true;
2144
- };
2145
2169
  // Annotate the CommonJS export names for ESM import in node:
2146
2170
  0 && (module.exports = {
2147
2171
  EmbedTester,
2172
+ PLAYRUO_IFRAME_ALLOW,
2148
2173
  PLAYRUO_UUID_STORAGE_KEY,
2149
2174
  PlayruoEmbed,
2150
2175
  buildEmbedUrl,
2151
2176
  isPlayruoEmbedMessage,
2152
2177
  isPlayruoInternalMessage,
2178
+ normalizePlayruoError,
2153
2179
  resolveVisitorUuid
2154
2180
  });
package/dist/index.d.cts CHANGED
@@ -1,6 +1,14 @@
1
1
  import { FC, ReactNode } from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
 
4
+ /**
5
+ * iframe `allow` feature policy delegated to the Playruo player.
6
+ * Must stay aligned with the webapp embed harness (`front/scripts/embed-host/host.js`)
7
+ * and `next.config.ts` Permissions-Policy. `screen-wake-lock` is required so the
8
+ * framed player can hold a Wake Lock while streaming.
9
+ */
10
+ declare const PLAYRUO_IFRAME_ALLOW = "cross-origin-isolated; fullscreen *; autoplay *; gamepad *; clipboard-write *; web-share *; encrypted-media *; accelerometer *; gyroscope *; screen-wake-lock *";
11
+
4
12
  interface PlayruoEmbedState {
5
13
  hasPlayedOnce: boolean;
6
14
  tryNow: {
@@ -41,12 +49,35 @@ interface PlayruoDemoCompletedMessage {
41
49
  type: "playruo_demo_completed";
42
50
  data: DemoCompletedPayload;
43
51
  }
52
+ /**
53
+ * What React `onError` sees after normalisation. `code` and `event` come from
54
+ * structured hard errors; extras such as `visibility` are dropped on purpose.
55
+ */
56
+ type PlayruoErrorDetails = {
57
+ message: string;
58
+ code?: string;
59
+ event?: string;
60
+ };
44
61
  interface PlayruoErrorMessage {
45
62
  type: "playruo_error";
63
+ /**
64
+ * Production hard errors carry `code` and `event`. Soft capacity blocks and
65
+ * legacy paths may send only `{ message }` or a bare string. Extra keys may
66
+ * appear on the wire; hosts that go through `normalizePlayruoError` never see
67
+ * them.
68
+ */
46
69
  data: {
47
70
  message: string;
71
+ code?: string;
72
+ event?: string;
48
73
  } | string;
49
74
  }
75
+ /**
76
+ * Reduce a `playruo_error.data` value (or a host-local string) to the shape
77
+ * React `onError` receives. Only string `code` / `event` survive; everything
78
+ * else is dropped so a host cannot grow a dependency on accidental extras.
79
+ */
80
+ declare const normalizePlayruoError: (data: unknown) => PlayruoErrorDetails;
50
81
  interface PlayruoSessionOverMessage {
51
82
  type: "playruo_session_over";
52
83
  data: PlayruoEmbedState;
@@ -196,7 +227,7 @@ interface PlayruoEmbedProps {
196
227
  onPurchaseRequest?: (data: {
197
228
  storeUrl: string;
198
229
  }) => void;
199
- onError?: (error: string) => void;
230
+ onError?: (error: string, details: PlayruoErrorDetails) => void;
200
231
  /** The operation is password protected and waits for one. */
201
232
  onPasswordRequired?: () => void;
202
233
  /** Answer to a submitted password. */
@@ -265,4 +296,4 @@ declare const PLAYRUO_UUID_STORAGE_KEY = "playruo_uuid";
265
296
  */
266
297
  declare const resolveVisitorUuid: (clientFingerprint?: string) => string;
267
298
 
268
- export { type DemoCompletedPayload, EmbedTester, type EmbedTesterProps, PLAYRUO_UUID_STORAGE_KEY, type PlayruoDemoCompletedMessage, PlayruoEmbed, type PlayruoEmbedActions, type PlayruoEmbedMessage, type PlayruoEmbedPasswordState, type PlayruoEmbedProps, type PlayruoEmbedRenderState, type PlayruoEmbedState, type PlayruoErrorMessage, type PlayruoEventMessage, type PlayruoEventPayload, type PlayruoInternalMessage, type PlayruoPasswordError, type PlayruoPasswordErrorCode, type PlayruoPasswordNotRequiredMessage, type PlayruoPasswordRequiredMessage, type PlayruoPasswordResultMessage, type PlayruoPurchaseRequestMessage, type PlayruoReadyMessage, type PlayruoRequestExitFullscreenMessage, type PlayruoSessionOverMessage, type PlayruoStateUpdateMessage, type PlayruoStreamStartMessage, type PlayruoStreamStopMessage, buildEmbedUrl, isPlayruoEmbedMessage, isPlayruoInternalMessage, resolveVisitorUuid };
299
+ export { type DemoCompletedPayload, EmbedTester, type EmbedTesterProps, PLAYRUO_IFRAME_ALLOW, PLAYRUO_UUID_STORAGE_KEY, type PlayruoDemoCompletedMessage, PlayruoEmbed, type PlayruoEmbedActions, type PlayruoEmbedMessage, type PlayruoEmbedPasswordState, type PlayruoEmbedProps, type PlayruoEmbedRenderState, type PlayruoEmbedState, type PlayruoErrorDetails, type PlayruoErrorMessage, type PlayruoEventMessage, type PlayruoEventPayload, type PlayruoInternalMessage, type PlayruoPasswordError, type PlayruoPasswordErrorCode, type PlayruoPasswordNotRequiredMessage, type PlayruoPasswordRequiredMessage, type PlayruoPasswordResultMessage, type PlayruoPurchaseRequestMessage, type PlayruoReadyMessage, type PlayruoRequestExitFullscreenMessage, type PlayruoSessionOverMessage, type PlayruoStateUpdateMessage, type PlayruoStreamStartMessage, type PlayruoStreamStopMessage, buildEmbedUrl, isPlayruoEmbedMessage, isPlayruoInternalMessage, normalizePlayruoError, resolveVisitorUuid };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,14 @@
1
1
  import { FC, ReactNode } from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
 
4
+ /**
5
+ * iframe `allow` feature policy delegated to the Playruo player.
6
+ * Must stay aligned with the webapp embed harness (`front/scripts/embed-host/host.js`)
7
+ * and `next.config.ts` Permissions-Policy. `screen-wake-lock` is required so the
8
+ * framed player can hold a Wake Lock while streaming.
9
+ */
10
+ declare const PLAYRUO_IFRAME_ALLOW = "cross-origin-isolated; fullscreen *; autoplay *; gamepad *; clipboard-write *; web-share *; encrypted-media *; accelerometer *; gyroscope *; screen-wake-lock *";
11
+
4
12
  interface PlayruoEmbedState {
5
13
  hasPlayedOnce: boolean;
6
14
  tryNow: {
@@ -41,12 +49,35 @@ interface PlayruoDemoCompletedMessage {
41
49
  type: "playruo_demo_completed";
42
50
  data: DemoCompletedPayload;
43
51
  }
52
+ /**
53
+ * What React `onError` sees after normalisation. `code` and `event` come from
54
+ * structured hard errors; extras such as `visibility` are dropped on purpose.
55
+ */
56
+ type PlayruoErrorDetails = {
57
+ message: string;
58
+ code?: string;
59
+ event?: string;
60
+ };
44
61
  interface PlayruoErrorMessage {
45
62
  type: "playruo_error";
63
+ /**
64
+ * Production hard errors carry `code` and `event`. Soft capacity blocks and
65
+ * legacy paths may send only `{ message }` or a bare string. Extra keys may
66
+ * appear on the wire; hosts that go through `normalizePlayruoError` never see
67
+ * them.
68
+ */
46
69
  data: {
47
70
  message: string;
71
+ code?: string;
72
+ event?: string;
48
73
  } | string;
49
74
  }
75
+ /**
76
+ * Reduce a `playruo_error.data` value (or a host-local string) to the shape
77
+ * React `onError` receives. Only string `code` / `event` survive; everything
78
+ * else is dropped so a host cannot grow a dependency on accidental extras.
79
+ */
80
+ declare const normalizePlayruoError: (data: unknown) => PlayruoErrorDetails;
50
81
  interface PlayruoSessionOverMessage {
51
82
  type: "playruo_session_over";
52
83
  data: PlayruoEmbedState;
@@ -196,7 +227,7 @@ interface PlayruoEmbedProps {
196
227
  onPurchaseRequest?: (data: {
197
228
  storeUrl: string;
198
229
  }) => void;
199
- onError?: (error: string) => void;
230
+ onError?: (error: string, details: PlayruoErrorDetails) => void;
200
231
  /** The operation is password protected and waits for one. */
201
232
  onPasswordRequired?: () => void;
202
233
  /** Answer to a submitted password. */
@@ -265,4 +296,4 @@ declare const PLAYRUO_UUID_STORAGE_KEY = "playruo_uuid";
265
296
  */
266
297
  declare const resolveVisitorUuid: (clientFingerprint?: string) => string;
267
298
 
268
- export { type DemoCompletedPayload, EmbedTester, type EmbedTesterProps, PLAYRUO_UUID_STORAGE_KEY, type PlayruoDemoCompletedMessage, PlayruoEmbed, type PlayruoEmbedActions, type PlayruoEmbedMessage, type PlayruoEmbedPasswordState, type PlayruoEmbedProps, type PlayruoEmbedRenderState, type PlayruoEmbedState, type PlayruoErrorMessage, type PlayruoEventMessage, type PlayruoEventPayload, type PlayruoInternalMessage, type PlayruoPasswordError, type PlayruoPasswordErrorCode, type PlayruoPasswordNotRequiredMessage, type PlayruoPasswordRequiredMessage, type PlayruoPasswordResultMessage, type PlayruoPurchaseRequestMessage, type PlayruoReadyMessage, type PlayruoRequestExitFullscreenMessage, type PlayruoSessionOverMessage, type PlayruoStateUpdateMessage, type PlayruoStreamStartMessage, type PlayruoStreamStopMessage, buildEmbedUrl, isPlayruoEmbedMessage, isPlayruoInternalMessage, resolveVisitorUuid };
299
+ export { type DemoCompletedPayload, EmbedTester, type EmbedTesterProps, PLAYRUO_IFRAME_ALLOW, PLAYRUO_UUID_STORAGE_KEY, type PlayruoDemoCompletedMessage, PlayruoEmbed, type PlayruoEmbedActions, type PlayruoEmbedMessage, type PlayruoEmbedPasswordState, type PlayruoEmbedProps, type PlayruoEmbedRenderState, type PlayruoEmbedState, type PlayruoErrorDetails, type PlayruoErrorMessage, type PlayruoEventMessage, type PlayruoEventPayload, type PlayruoInternalMessage, type PlayruoPasswordError, type PlayruoPasswordErrorCode, type PlayruoPasswordNotRequiredMessage, type PlayruoPasswordRequiredMessage, type PlayruoPasswordResultMessage, type PlayruoPurchaseRequestMessage, type PlayruoReadyMessage, type PlayruoRequestExitFullscreenMessage, type PlayruoSessionOverMessage, type PlayruoStateUpdateMessage, type PlayruoStreamStartMessage, type PlayruoStreamStopMessage, buildEmbedUrl, isPlayruoEmbedMessage, isPlayruoInternalMessage, normalizePlayruoError, resolveVisitorUuid };
package/dist/index.js CHANGED
@@ -1,6 +1,40 @@
1
+ // src/iframe-allow.ts
2
+ var PLAYRUO_IFRAME_ALLOW = "cross-origin-isolated; fullscreen *; autoplay *; gamepad *; clipboard-write *; web-share *; encrypted-media *; accelerometer *; gyroscope *; screen-wake-lock *";
3
+
1
4
  // src/react/playruo-embed.tsx
2
5
  import { useEffect, useMemo, useRef, useState, useCallback } from "react";
3
6
 
7
+ // src/post-message-types.ts
8
+ var normalizePlayruoError = (data) => {
9
+ if (typeof data === "string") {
10
+ return { message: data || "Unknown error" };
11
+ }
12
+ if (!data || typeof data !== "object") {
13
+ return { message: "Unknown error" };
14
+ }
15
+ const record = data;
16
+ const message = typeof record.message === "string" && record.message ? record.message : "Unknown error";
17
+ const details = { message };
18
+ if (typeof record.code === "string") {
19
+ details.code = record.code;
20
+ }
21
+ if (typeof record.event === "string") {
22
+ details.event = record.event;
23
+ }
24
+ return details;
25
+ };
26
+ var isPlayruoEmbedMessage = (data) => {
27
+ if (!data || typeof data !== "object") return false;
28
+ const msg = data;
29
+ if (typeof msg.type !== "string") return false;
30
+ return msg.type === "playruo_ready" || msg.type === "playruo_state_update" || msg.type === "playruo_purchase_request" || msg.type === "playruo_demo_completed" || msg.type === "playruo_error" || msg.type === "playruo_session_over" || msg.type === "playruo_stream_start" || msg.type === "playruo_stream_stop" || msg.type === "REQUEST_EXIT_FULLSCREEN" || msg.type === "playruo_event" || msg.type === "playruo_password_required" || msg.type === "playruo_password_not_required" || msg.type === "playruo_password_result";
31
+ };
32
+ var isPlayruoInternalMessage = (data) => {
33
+ if (!data || typeof data !== "object") return false;
34
+ const msg = data;
35
+ return msg.type === "playruo" && typeof msg.action === "string" && (msg.action === "tryNowClick" || msg.action === "exitFullscreen" || msg.action === "mute" || msg.action === "unmute" || msg.action === "submitPassword" || msg.action === "requestPassword") && msg.fromEmbed === true;
36
+ };
37
+
4
38
  // src/url.ts
5
39
  var PLAYRUO_ORIGIN = "https://playruo.live";
6
40
  var normalizeOperation = (operation) => {
@@ -403,7 +437,7 @@ var PlayruoEmbed = ({
403
437
  console.error("[PlayruoEmbed] Failed to start game:", error);
404
438
  setShowGameIframe(false);
405
439
  setErrorMessage("Failed to start game");
406
- onError?.("Failed to start game");
440
+ onError?.("Failed to start game", { message: "Failed to start game" });
407
441
  }
408
442
  }, [
409
443
  enableWindowedLaunch,
@@ -460,8 +494,9 @@ var PlayruoEmbed = ({
460
494
  console.log("\u{1F537} [Embed] playruo_demo_completed received:", data);
461
495
  cleanupEmbedSession({ payload: data });
462
496
  } else if (type === "playruo_error") {
463
- const errorMessage2 = typeof data === "string" ? data : data?.message || "Unknown error";
464
- console.log("\u{1F537} [Embed] playruo_error received:", errorMessage2);
497
+ const details = normalizePlayruoError(data);
498
+ const errorMessage2 = details.message;
499
+ console.log("\u{1F537} [Embed] playruo_error received:", errorMessage2, details);
465
500
  setErrorMessage(errorMessage2);
466
501
  const errorState = {
467
502
  hasPlayedOnce,
@@ -476,7 +511,7 @@ var PlayruoEmbed = ({
476
511
  };
477
512
  setIframeState(errorState);
478
513
  onStateChange?.(errorState);
479
- onError?.(errorMessage2);
514
+ onError?.(errorMessage2, details);
480
515
  } else if (type === "playruo_session_over" && data) {
481
516
  console.log("\u{1F537} [Embed] playruo_session_over received:", data);
482
517
  void exitEmbedFullscreen({ reason: "playruo_session_over" });
@@ -794,7 +829,7 @@ var PlayruoEmbed = ({
794
829
  {
795
830
  ref: iframeRef,
796
831
  src,
797
- allow: "cross-origin-isolated; fullscreen *; autoplay *; gamepad *; clipboard-write *; web-share *; encrypted-media *; accelerometer *; gyroscope *",
832
+ allow: PLAYRUO_IFRAME_ALLOW,
798
833
  className: "w-full h-[70vh] rounded-lg border",
799
834
  ...{ credentialless: "true" },
800
835
  sandbox: "allow-same-origin allow-scripts allow-popups allow-forms allow-presentation allow-top-navigation allow-modals allow-pointer-lock",
@@ -814,7 +849,7 @@ var PlayruoEmbed = ({
814
849
  onError: () => {
815
850
  console.error("[PlayruoEmbed] Iframe failed to load");
816
851
  setErrorMessage("Failed to load game");
817
- onError?.("Failed to load game");
852
+ onError?.("Failed to load game", { message: "Failed to load game" });
818
853
  }
819
854
  }
820
855
  )
@@ -2087,25 +2122,14 @@ var EmbedTester = (props = {}) => {
2087
2122
  }
2088
2123
  );
2089
2124
  };
2090
-
2091
- // src/post-message-types.ts
2092
- var isPlayruoEmbedMessage = (data) => {
2093
- if (!data || typeof data !== "object") return false;
2094
- const msg = data;
2095
- if (typeof msg.type !== "string") return false;
2096
- return msg.type === "playruo_ready" || msg.type === "playruo_state_update" || msg.type === "playruo_purchase_request" || msg.type === "playruo_demo_completed" || msg.type === "playruo_error" || msg.type === "playruo_session_over" || msg.type === "playruo_stream_start" || msg.type === "playruo_stream_stop" || msg.type === "REQUEST_EXIT_FULLSCREEN" || msg.type === "playruo_event" || msg.type === "playruo_password_required" || msg.type === "playruo_password_not_required" || msg.type === "playruo_password_result";
2097
- };
2098
- var isPlayruoInternalMessage = (data) => {
2099
- if (!data || typeof data !== "object") return false;
2100
- const msg = data;
2101
- return msg.type === "playruo" && typeof msg.action === "string" && (msg.action === "tryNowClick" || msg.action === "exitFullscreen" || msg.action === "mute" || msg.action === "unmute" || msg.action === "submitPassword" || msg.action === "requestPassword") && msg.fromEmbed === true;
2102
- };
2103
2125
  export {
2104
2126
  EmbedTester,
2127
+ PLAYRUO_IFRAME_ALLOW,
2105
2128
  PLAYRUO_UUID_STORAGE_KEY,
2106
2129
  PlayruoEmbed,
2107
2130
  buildEmbedUrl,
2108
2131
  isPlayruoEmbedMessage,
2109
2132
  isPlayruoInternalMessage,
2133
+ normalizePlayruoError,
2110
2134
  resolveVisitorUuid
2111
2135
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playruo/embed",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "React SDK to embed Playruo with postMessage API.",
5
5
  "license": "MIT",
6
6
  "type": "module",