@playruo/embed 1.2.1 → 1.2.4
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/README.md +0 -299
- package/dist/index.cjs +585 -129
- package/dist/index.d.cts +32 -20
- package/dist/index.d.ts +32 -20
- package/dist/index.js +572 -127
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
interface PlayruoEmbedState {
|
|
4
5
|
hasPlayedOnce: boolean;
|
|
@@ -9,6 +10,7 @@ interface PlayruoEmbedState {
|
|
|
9
10
|
buyNow: {
|
|
10
11
|
available: boolean;
|
|
11
12
|
status?: string;
|
|
13
|
+
storeUrl?: string;
|
|
12
14
|
};
|
|
13
15
|
}
|
|
14
16
|
interface DemoCompletedPayload {
|
|
@@ -16,15 +18,6 @@ interface DemoCompletedPayload {
|
|
|
16
18
|
storeUrl?: string;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
interface Keyboard {
|
|
20
|
-
lock: (keys: string[]) => Promise<void>;
|
|
21
|
-
unlock: () => void;
|
|
22
|
-
}
|
|
23
|
-
declare global {
|
|
24
|
-
interface Navigator {
|
|
25
|
-
keyboard?: Keyboard;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
21
|
interface PlayruoEmbedActions {
|
|
29
22
|
/** Start the demo session */
|
|
30
23
|
tryNow: () => void;
|
|
@@ -65,6 +58,15 @@ interface PlayruoEmbedProps {
|
|
|
65
58
|
}
|
|
66
59
|
declare const PlayruoEmbed: FC<PlayruoEmbedProps>;
|
|
67
60
|
|
|
61
|
+
interface EmbedTesterProps {
|
|
62
|
+
baseUrl?: string;
|
|
63
|
+
enableConsoleLog?: boolean;
|
|
64
|
+
operation?: string;
|
|
65
|
+
storeUrl?: string;
|
|
66
|
+
className?: string;
|
|
67
|
+
}
|
|
68
|
+
declare const EmbedTester: (props?: EmbedTesterProps) => react_jsx_runtime.JSX.Element;
|
|
69
|
+
|
|
68
70
|
interface PlayruoReadyMessage {
|
|
69
71
|
type: "playruo_ready";
|
|
70
72
|
}
|
|
@@ -88,25 +90,35 @@ interface PlayruoErrorMessage {
|
|
|
88
90
|
message: string;
|
|
89
91
|
} | string;
|
|
90
92
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
interface PlayruoSessionOverMessage {
|
|
94
|
+
type: "playruo_session_over";
|
|
95
|
+
data: PlayruoEmbedState;
|
|
96
|
+
}
|
|
97
|
+
interface PlayruoStreamStartMessage {
|
|
98
|
+
type: "playruo_stream_start";
|
|
94
99
|
}
|
|
95
|
-
interface
|
|
96
|
-
type: "
|
|
100
|
+
interface PlayruoStreamStopMessage {
|
|
101
|
+
type: "playruo_stream_stop";
|
|
97
102
|
}
|
|
98
|
-
|
|
99
|
-
|
|
103
|
+
type PlayruoEmbedMessage = PlayruoReadyMessage | PlayruoStateUpdateMessage | PlayruoPurchaseRequestMessage | PlayruoDemoCompletedMessage | PlayruoErrorMessage | PlayruoSessionOverMessage | PlayruoStreamStartMessage | PlayruoStreamStopMessage;
|
|
104
|
+
interface PlayruoInternalMessage {
|
|
105
|
+
type: "playruo";
|
|
106
|
+
action: "tryNowClick" | "exitFullscreen" | "mute" | "unmute";
|
|
107
|
+
fromEmbed: true;
|
|
108
|
+
isReplay?: boolean;
|
|
109
|
+
parentWillHandleFullscreen?: boolean;
|
|
100
110
|
}
|
|
101
|
-
type PlayruoEmbedCommand = TryNowCommand | BuyNowCommand | GetStateCommand;
|
|
102
111
|
/**
|
|
103
112
|
* Type guard to check if a message event is a Playruo embed message
|
|
113
|
+
* Messages FROM Embed → Host via postMessage
|
|
104
114
|
*/
|
|
105
115
|
declare const isPlayruoEmbedMessage: (data: unknown) => data is PlayruoEmbedMessage;
|
|
106
116
|
/**
|
|
107
|
-
* Type guard to check if a
|
|
117
|
+
* Type guard to check if a message is a Playruo internal message
|
|
118
|
+
* Format: { type: 'playruo', action: '...', fromEmbed: true }
|
|
119
|
+
* These are messages sent TO the iframe (game), not to the parent
|
|
108
120
|
*/
|
|
109
|
-
declare const
|
|
121
|
+
declare const isPlayruoInternalMessage: (data: unknown) => data is PlayruoInternalMessage;
|
|
110
122
|
|
|
111
123
|
interface BuildUrlParams {
|
|
112
124
|
baseUrl: string;
|
|
@@ -121,4 +133,4 @@ interface BuildUrlParams {
|
|
|
121
133
|
*/
|
|
122
134
|
declare const buildEmbedUrl: ({ baseUrl, operation, storeUrl }: BuildUrlParams) => string;
|
|
123
135
|
|
|
124
|
-
export { type
|
|
136
|
+
export { type DemoCompletedPayload, EmbedTester, type EmbedTesterProps, type PlayruoDemoCompletedMessage, PlayruoEmbed, type PlayruoEmbedActions, type PlayruoEmbedMessage, type PlayruoEmbedProps, type PlayruoEmbedRenderState, type PlayruoEmbedState, type PlayruoErrorMessage, type PlayruoInternalMessage, type PlayruoPurchaseRequestMessage, type PlayruoReadyMessage, type PlayruoSessionOverMessage, type PlayruoStateUpdateMessage, type PlayruoStreamStartMessage, buildEmbedUrl, isPlayruoEmbedMessage, isPlayruoInternalMessage };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
3
|
|
|
3
4
|
interface PlayruoEmbedState {
|
|
4
5
|
hasPlayedOnce: boolean;
|
|
@@ -9,6 +10,7 @@ interface PlayruoEmbedState {
|
|
|
9
10
|
buyNow: {
|
|
10
11
|
available: boolean;
|
|
11
12
|
status?: string;
|
|
13
|
+
storeUrl?: string;
|
|
12
14
|
};
|
|
13
15
|
}
|
|
14
16
|
interface DemoCompletedPayload {
|
|
@@ -16,15 +18,6 @@ interface DemoCompletedPayload {
|
|
|
16
18
|
storeUrl?: string;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
interface Keyboard {
|
|
20
|
-
lock: (keys: string[]) => Promise<void>;
|
|
21
|
-
unlock: () => void;
|
|
22
|
-
}
|
|
23
|
-
declare global {
|
|
24
|
-
interface Navigator {
|
|
25
|
-
keyboard?: Keyboard;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
21
|
interface PlayruoEmbedActions {
|
|
29
22
|
/** Start the demo session */
|
|
30
23
|
tryNow: () => void;
|
|
@@ -65,6 +58,15 @@ interface PlayruoEmbedProps {
|
|
|
65
58
|
}
|
|
66
59
|
declare const PlayruoEmbed: FC<PlayruoEmbedProps>;
|
|
67
60
|
|
|
61
|
+
interface EmbedTesterProps {
|
|
62
|
+
baseUrl?: string;
|
|
63
|
+
enableConsoleLog?: boolean;
|
|
64
|
+
operation?: string;
|
|
65
|
+
storeUrl?: string;
|
|
66
|
+
className?: string;
|
|
67
|
+
}
|
|
68
|
+
declare const EmbedTester: (props?: EmbedTesterProps) => react_jsx_runtime.JSX.Element;
|
|
69
|
+
|
|
68
70
|
interface PlayruoReadyMessage {
|
|
69
71
|
type: "playruo_ready";
|
|
70
72
|
}
|
|
@@ -88,25 +90,35 @@ interface PlayruoErrorMessage {
|
|
|
88
90
|
message: string;
|
|
89
91
|
} | string;
|
|
90
92
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
interface PlayruoSessionOverMessage {
|
|
94
|
+
type: "playruo_session_over";
|
|
95
|
+
data: PlayruoEmbedState;
|
|
96
|
+
}
|
|
97
|
+
interface PlayruoStreamStartMessage {
|
|
98
|
+
type: "playruo_stream_start";
|
|
94
99
|
}
|
|
95
|
-
interface
|
|
96
|
-
type: "
|
|
100
|
+
interface PlayruoStreamStopMessage {
|
|
101
|
+
type: "playruo_stream_stop";
|
|
97
102
|
}
|
|
98
|
-
|
|
99
|
-
|
|
103
|
+
type PlayruoEmbedMessage = PlayruoReadyMessage | PlayruoStateUpdateMessage | PlayruoPurchaseRequestMessage | PlayruoDemoCompletedMessage | PlayruoErrorMessage | PlayruoSessionOverMessage | PlayruoStreamStartMessage | PlayruoStreamStopMessage;
|
|
104
|
+
interface PlayruoInternalMessage {
|
|
105
|
+
type: "playruo";
|
|
106
|
+
action: "tryNowClick" | "exitFullscreen" | "mute" | "unmute";
|
|
107
|
+
fromEmbed: true;
|
|
108
|
+
isReplay?: boolean;
|
|
109
|
+
parentWillHandleFullscreen?: boolean;
|
|
100
110
|
}
|
|
101
|
-
type PlayruoEmbedCommand = TryNowCommand | BuyNowCommand | GetStateCommand;
|
|
102
111
|
/**
|
|
103
112
|
* Type guard to check if a message event is a Playruo embed message
|
|
113
|
+
* Messages FROM Embed → Host via postMessage
|
|
104
114
|
*/
|
|
105
115
|
declare const isPlayruoEmbedMessage: (data: unknown) => data is PlayruoEmbedMessage;
|
|
106
116
|
/**
|
|
107
|
-
* Type guard to check if a
|
|
117
|
+
* Type guard to check if a message is a Playruo internal message
|
|
118
|
+
* Format: { type: 'playruo', action: '...', fromEmbed: true }
|
|
119
|
+
* These are messages sent TO the iframe (game), not to the parent
|
|
108
120
|
*/
|
|
109
|
-
declare const
|
|
121
|
+
declare const isPlayruoInternalMessage: (data: unknown) => data is PlayruoInternalMessage;
|
|
110
122
|
|
|
111
123
|
interface BuildUrlParams {
|
|
112
124
|
baseUrl: string;
|
|
@@ -121,4 +133,4 @@ interface BuildUrlParams {
|
|
|
121
133
|
*/
|
|
122
134
|
declare const buildEmbedUrl: ({ baseUrl, operation, storeUrl }: BuildUrlParams) => string;
|
|
123
135
|
|
|
124
|
-
export { type
|
|
136
|
+
export { type DemoCompletedPayload, EmbedTester, type EmbedTesterProps, type PlayruoDemoCompletedMessage, PlayruoEmbed, type PlayruoEmbedActions, type PlayruoEmbedMessage, type PlayruoEmbedProps, type PlayruoEmbedRenderState, type PlayruoEmbedState, type PlayruoErrorMessage, type PlayruoInternalMessage, type PlayruoPurchaseRequestMessage, type PlayruoReadyMessage, type PlayruoSessionOverMessage, type PlayruoStateUpdateMessage, type PlayruoStreamStartMessage, buildEmbedUrl, isPlayruoEmbedMessage, isPlayruoInternalMessage };
|