@playruo/embed 1.3.3 → 1.5.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.d.cts CHANGED
@@ -24,6 +24,106 @@ type PlayruoEventPayload = Record<string, unknown> & {
24
24
  name?: string;
25
25
  };
26
26
 
27
+ interface PlayruoReadyMessage {
28
+ type: "playruo_ready";
29
+ }
30
+ interface PlayruoStateUpdateMessage {
31
+ type: "playruo_state_update";
32
+ data: PlayruoEmbedState;
33
+ }
34
+ interface PlayruoPurchaseRequestMessage {
35
+ type: "playruo_purchase_request";
36
+ data: {
37
+ storeUrl: string;
38
+ };
39
+ }
40
+ interface PlayruoDemoCompletedMessage {
41
+ type: "playruo_demo_completed";
42
+ data: DemoCompletedPayload;
43
+ }
44
+ interface PlayruoErrorMessage {
45
+ type: "playruo_error";
46
+ data: {
47
+ message: string;
48
+ } | string;
49
+ }
50
+ interface PlayruoSessionOverMessage {
51
+ type: "playruo_session_over";
52
+ data: PlayruoEmbedState;
53
+ }
54
+ interface PlayruoStreamStartMessage {
55
+ type: "playruo_stream_start";
56
+ }
57
+ interface PlayruoStreamStopMessage {
58
+ type: "playruo_stream_stop";
59
+ }
60
+ interface PlayruoRequestExitFullscreenMessage {
61
+ type: "REQUEST_EXIT_FULLSCREEN";
62
+ }
63
+ interface PlayruoEventMessage {
64
+ type: "playruo_event";
65
+ data: PlayruoEventPayload;
66
+ }
67
+ /**
68
+ * Why a password submission was refused. `already_validating` answers a submit
69
+ * sent while another one is still being checked, so the host may simply send it
70
+ * again; `too_many_attempts` closes the operation for this visitor and reopens
71
+ * on its own after a delay.
72
+ */
73
+ type PlayruoPasswordError = "invalid_password" | "already_validating" | "too_many_attempts";
74
+ /**
75
+ * A refusal code as a host reads it: one of the codes above, or any other one
76
+ * the operation may answer with. `string & {}` rather than `string`, which
77
+ * would absorb the union and drop the known codes from autocompletion.
78
+ */
79
+ type PlayruoPasswordErrorCode = PlayruoPasswordError | (string & {});
80
+ /**
81
+ * A password protected operation announces itself once its configuration is
82
+ * loaded. The iframe stays invisible until a session starts, so it renders no
83
+ * form of its own: the host collects the password and sends it back with the
84
+ * submitPassword action.
85
+ */
86
+ interface PlayruoPasswordRequiredMessage {
87
+ type: "playruo_password_required";
88
+ }
89
+ /**
90
+ * Answers a requestPassword sent to an operation that is not protected. Without
91
+ * it a host cannot tell "no password needed" from "the announce has not come
92
+ * yet", and waits forever on a gate that will never open.
93
+ */
94
+ interface PlayruoPasswordNotRequiredMessage {
95
+ type: "playruo_password_not_required";
96
+ }
97
+ interface PlayruoPasswordResultMessage {
98
+ type: "playruo_password_result";
99
+ data: {
100
+ success: boolean;
101
+ error?: PlayruoPasswordErrorCode;
102
+ };
103
+ }
104
+ type PlayruoEmbedMessage = PlayruoReadyMessage | PlayruoStateUpdateMessage | PlayruoPurchaseRequestMessage | PlayruoDemoCompletedMessage | PlayruoErrorMessage | PlayruoSessionOverMessage | PlayruoStreamStartMessage | PlayruoStreamStopMessage | PlayruoRequestExitFullscreenMessage | PlayruoEventMessage | PlayruoPasswordRequiredMessage | PlayruoPasswordNotRequiredMessage | PlayruoPasswordResultMessage;
105
+ interface PlayruoInternalMessage {
106
+ type: "playruo";
107
+ action: "tryNowClick" | "exitFullscreen" | "mute" | "unmute" | "submitPassword" | "requestPassword";
108
+ fromEmbed: true;
109
+ isReplay?: boolean;
110
+ isFullscreen?: boolean;
111
+ parentWillHandleFullscreen?: boolean;
112
+ /** Only read by the submitPassword action. */
113
+ password?: string;
114
+ }
115
+ /**
116
+ * Type guard to check if a message event is a Playruo embed message
117
+ * Messages FROM Embed → Host via postMessage
118
+ */
119
+ declare const isPlayruoEmbedMessage: (data: unknown) => data is PlayruoEmbedMessage;
120
+ /**
121
+ * Type guard to check if a message is a Playruo internal message
122
+ * Format: { type: 'playruo', action: '...', fromEmbed: true }
123
+ * These are messages sent TO the iframe (game), not to the parent
124
+ */
125
+ declare const isPlayruoInternalMessage: (data: unknown) => data is PlayruoInternalMessage;
126
+
27
127
  interface PlayruoEmbedActions {
28
128
  /** Start the demo session */
29
129
  tryNow: () => void;
@@ -33,18 +133,60 @@ interface PlayruoEmbedActions {
33
133
  canTryNow: boolean;
34
134
  /** Whether buy now is currently available */
35
135
  canBuyNow: boolean;
136
+ /** Send the password collected by the host to a protected operation. */
137
+ submitPassword: (password: string) => void;
138
+ /**
139
+ * Ask the operation to announce again whether it needs a password. The
140
+ * announcement is emitted once, so a host that mounts late can miss it.
141
+ */
142
+ requestPassword: () => void;
143
+ }
144
+ interface PlayruoEmbedPasswordState {
145
+ /**
146
+ * The operation asked for a password. Stays true once it was given, so read
147
+ * `unlocked` for the gate itself.
148
+ */
149
+ required: boolean;
150
+ /**
151
+ * The operation said whether it is protected. Until then `required: false`
152
+ * only means nothing was announced yet, so a host that called
153
+ * `requestPassword` cannot tell an unprotected operation from a silent one.
154
+ */
155
+ checked: boolean;
156
+ /** A submitted password was accepted. */
157
+ unlocked: boolean;
158
+ /** Code of the last refusal, from PlayruoPasswordError when known. */
159
+ error?: PlayruoPasswordErrorCode;
36
160
  }
37
161
  interface PlayruoEmbedRenderState {
38
162
  status: "loading" | "available" | "unavailable" | "error";
39
163
  message?: string;
40
164
  actions: PlayruoEmbedActions;
165
+ /**
166
+ * A protected operation never announces ready while it is locked, so a host
167
+ * that ignores this stays on `loading` for as long as the visitor has not
168
+ * been asked for the password.
169
+ */
170
+ password: PlayruoEmbedPasswordState;
41
171
  }
42
172
  interface PlayruoEmbedProps {
43
173
  /** Game origin (scheme + host). Omit to use production (`https://playruo.live`). */
44
174
  baseUrl?: string;
45
175
  /** Game operation slug used to build the iframe URL. */
46
176
  operation: string;
177
+ /**
178
+ * Which operation of the campaign to open, when it holds more than one. Sent
179
+ * as `?op=`. Without it the campaign picks its own.
180
+ */
181
+ operationKey?: string;
47
182
  storeUrl?: string;
183
+ /**
184
+ * Stable visitor identity the host already owns (account id, CRM id, …).
185
+ * When set, answers `playruo_uuid_request` with this value and skips
186
+ * `localStorage["playruo_uuid"]`. Omit to keep the SDK-managed UUID.
187
+ * Playruo derives the session fingerprint from the answered `uuid`.
188
+ */
189
+ clientFingerprint?: string;
48
190
  showIframe?: boolean;
49
191
  className?: string;
50
192
  onReady?: () => void;
@@ -55,6 +197,13 @@ interface PlayruoEmbedProps {
55
197
  storeUrl: string;
56
198
  }) => void;
57
199
  onError?: (error: string) => void;
200
+ /** The operation is password protected and waits for one. */
201
+ onPasswordRequired?: () => void;
202
+ /** Answer to a submitted password. */
203
+ onPasswordResult?: (result: {
204
+ success: boolean;
205
+ error?: PlayruoPasswordErrorCode;
206
+ }) => void;
58
207
  /**
59
208
  * Skip the parent fullscreen request and start the experience inside the
60
209
  * current iframe bounds. Defaults to false to preserve the current behavior.
@@ -74,7 +223,7 @@ interface PlayruoEmbedProps {
74
223
  /**
75
224
  * Ref to access the iframe element for fullscreen requests
76
225
  */
77
- iframeRef?: React.RefObject<HTMLIFrameElement>;
226
+ iframeRef?: React.RefObject<HTMLIFrameElement | null>;
78
227
  }
79
228
  declare const PlayruoEmbed: FC<PlayruoEmbedProps>;
80
229
 
@@ -90,69 +239,14 @@ interface EmbedTesterProps {
90
239
  }
91
240
  declare const EmbedTester: (props?: EmbedTesterProps) => react_jsx_runtime.JSX.Element;
92
241
 
93
- interface PlayruoReadyMessage {
94
- type: "playruo_ready";
95
- }
96
- interface PlayruoStateUpdateMessage {
97
- type: "playruo_state_update";
98
- data: PlayruoEmbedState;
99
- }
100
- interface PlayruoPurchaseRequestMessage {
101
- type: "playruo_purchase_request";
102
- data: {
103
- storeUrl: string;
104
- };
105
- }
106
- interface PlayruoDemoCompletedMessage {
107
- type: "playruo_demo_completed";
108
- data: DemoCompletedPayload;
109
- }
110
- interface PlayruoErrorMessage {
111
- type: "playruo_error";
112
- data: {
113
- message: string;
114
- } | string;
115
- }
116
- interface PlayruoSessionOverMessage {
117
- type: "playruo_session_over";
118
- data: PlayruoEmbedState;
119
- }
120
- interface PlayruoStreamStartMessage {
121
- type: "playruo_stream_start";
122
- }
123
- interface PlayruoStreamStopMessage {
124
- type: "playruo_stream_stop";
125
- }
126
- interface PlayruoRequestExitFullscreenMessage {
127
- type: "REQUEST_EXIT_FULLSCREEN";
128
- }
129
- interface PlayruoEventMessage {
130
- type: "playruo_event";
131
- data: PlayruoEventPayload;
132
- }
133
- type PlayruoEmbedMessage = PlayruoReadyMessage | PlayruoStateUpdateMessage | PlayruoPurchaseRequestMessage | PlayruoDemoCompletedMessage | PlayruoErrorMessage | PlayruoSessionOverMessage | PlayruoStreamStartMessage | PlayruoStreamStopMessage | PlayruoRequestExitFullscreenMessage | PlayruoEventMessage;
134
- interface PlayruoInternalMessage {
135
- type: "playruo";
136
- action: "tryNowClick" | "exitFullscreen" | "mute" | "unmute";
137
- fromEmbed: true;
138
- isReplay?: boolean;
139
- isFullscreen?: boolean;
140
- parentWillHandleFullscreen?: boolean;
141
- }
142
- /**
143
- * Type guard to check if a message event is a Playruo embed message
144
- * Messages FROM Embed → Host via postMessage
145
- */
146
- declare const isPlayruoEmbedMessage: (data: unknown) => data is PlayruoEmbedMessage;
147
- /**
148
- * Type guard to check if a message is a Playruo internal message
149
- * Format: { type: 'playruo', action: '...', fromEmbed: true }
150
- * These are messages sent TO the iframe (game), not to the parent
151
- */
152
- declare const isPlayruoInternalMessage: (data: unknown) => data is PlayruoInternalMessage;
153
-
154
242
  interface BuildUrlParams {
155
243
  operation: string;
244
+ /**
245
+ * Which operation of the campaign to open, when it holds more than one. Sent
246
+ * as `?op=`. Without it the campaign picks its own, which is what a single
247
+ * operation campaign wants.
248
+ */
249
+ operationKey?: string;
156
250
  storeUrl?: string;
157
251
  }
158
252
  /**
@@ -161,6 +255,14 @@ interface BuildUrlParams {
161
255
  * buildEmbedUrl({ operation: "my-game" })
162
256
  * // => "https://playruo.live/my-game?iframe=true"
163
257
  */
164
- declare const buildEmbedUrl: ({ operation, storeUrl }: BuildUrlParams) => string;
258
+ declare const buildEmbedUrl: ({ operation, operationKey, storeUrl, }: BuildUrlParams) => string;
259
+
260
+ declare const PLAYRUO_UUID_STORAGE_KEY = "playruo_uuid";
261
+ /**
262
+ * Visitor identity the host answers on `playruo_uuid_request`.
263
+ * Same rule as PlayruoEmbed `clientFingerprint`: a non-empty value is used as-is
264
+ * and is not written to localStorage. Otherwise the SDK-managed UUID is used.
265
+ */
266
+ declare const resolveVisitorUuid: (clientFingerprint?: string) => string;
165
267
 
166
- export { type DemoCompletedPayload, EmbedTester, type EmbedTesterProps, type PlayruoDemoCompletedMessage, PlayruoEmbed, type PlayruoEmbedActions, type PlayruoEmbedMessage, type PlayruoEmbedProps, type PlayruoEmbedRenderState, type PlayruoEmbedState, type PlayruoErrorMessage, type PlayruoEventMessage, type PlayruoEventPayload, type PlayruoInternalMessage, type PlayruoPurchaseRequestMessage, type PlayruoReadyMessage, type PlayruoRequestExitFullscreenMessage, type PlayruoSessionOverMessage, type PlayruoStateUpdateMessage, type PlayruoStreamStartMessage, type PlayruoStreamStopMessage, buildEmbedUrl, isPlayruoEmbedMessage, isPlayruoInternalMessage };
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 };
package/dist/index.d.ts CHANGED
@@ -24,6 +24,106 @@ type PlayruoEventPayload = Record<string, unknown> & {
24
24
  name?: string;
25
25
  };
26
26
 
27
+ interface PlayruoReadyMessage {
28
+ type: "playruo_ready";
29
+ }
30
+ interface PlayruoStateUpdateMessage {
31
+ type: "playruo_state_update";
32
+ data: PlayruoEmbedState;
33
+ }
34
+ interface PlayruoPurchaseRequestMessage {
35
+ type: "playruo_purchase_request";
36
+ data: {
37
+ storeUrl: string;
38
+ };
39
+ }
40
+ interface PlayruoDemoCompletedMessage {
41
+ type: "playruo_demo_completed";
42
+ data: DemoCompletedPayload;
43
+ }
44
+ interface PlayruoErrorMessage {
45
+ type: "playruo_error";
46
+ data: {
47
+ message: string;
48
+ } | string;
49
+ }
50
+ interface PlayruoSessionOverMessage {
51
+ type: "playruo_session_over";
52
+ data: PlayruoEmbedState;
53
+ }
54
+ interface PlayruoStreamStartMessage {
55
+ type: "playruo_stream_start";
56
+ }
57
+ interface PlayruoStreamStopMessage {
58
+ type: "playruo_stream_stop";
59
+ }
60
+ interface PlayruoRequestExitFullscreenMessage {
61
+ type: "REQUEST_EXIT_FULLSCREEN";
62
+ }
63
+ interface PlayruoEventMessage {
64
+ type: "playruo_event";
65
+ data: PlayruoEventPayload;
66
+ }
67
+ /**
68
+ * Why a password submission was refused. `already_validating` answers a submit
69
+ * sent while another one is still being checked, so the host may simply send it
70
+ * again; `too_many_attempts` closes the operation for this visitor and reopens
71
+ * on its own after a delay.
72
+ */
73
+ type PlayruoPasswordError = "invalid_password" | "already_validating" | "too_many_attempts";
74
+ /**
75
+ * A refusal code as a host reads it: one of the codes above, or any other one
76
+ * the operation may answer with. `string & {}` rather than `string`, which
77
+ * would absorb the union and drop the known codes from autocompletion.
78
+ */
79
+ type PlayruoPasswordErrorCode = PlayruoPasswordError | (string & {});
80
+ /**
81
+ * A password protected operation announces itself once its configuration is
82
+ * loaded. The iframe stays invisible until a session starts, so it renders no
83
+ * form of its own: the host collects the password and sends it back with the
84
+ * submitPassword action.
85
+ */
86
+ interface PlayruoPasswordRequiredMessage {
87
+ type: "playruo_password_required";
88
+ }
89
+ /**
90
+ * Answers a requestPassword sent to an operation that is not protected. Without
91
+ * it a host cannot tell "no password needed" from "the announce has not come
92
+ * yet", and waits forever on a gate that will never open.
93
+ */
94
+ interface PlayruoPasswordNotRequiredMessage {
95
+ type: "playruo_password_not_required";
96
+ }
97
+ interface PlayruoPasswordResultMessage {
98
+ type: "playruo_password_result";
99
+ data: {
100
+ success: boolean;
101
+ error?: PlayruoPasswordErrorCode;
102
+ };
103
+ }
104
+ type PlayruoEmbedMessage = PlayruoReadyMessage | PlayruoStateUpdateMessage | PlayruoPurchaseRequestMessage | PlayruoDemoCompletedMessage | PlayruoErrorMessage | PlayruoSessionOverMessage | PlayruoStreamStartMessage | PlayruoStreamStopMessage | PlayruoRequestExitFullscreenMessage | PlayruoEventMessage | PlayruoPasswordRequiredMessage | PlayruoPasswordNotRequiredMessage | PlayruoPasswordResultMessage;
105
+ interface PlayruoInternalMessage {
106
+ type: "playruo";
107
+ action: "tryNowClick" | "exitFullscreen" | "mute" | "unmute" | "submitPassword" | "requestPassword";
108
+ fromEmbed: true;
109
+ isReplay?: boolean;
110
+ isFullscreen?: boolean;
111
+ parentWillHandleFullscreen?: boolean;
112
+ /** Only read by the submitPassword action. */
113
+ password?: string;
114
+ }
115
+ /**
116
+ * Type guard to check if a message event is a Playruo embed message
117
+ * Messages FROM Embed → Host via postMessage
118
+ */
119
+ declare const isPlayruoEmbedMessage: (data: unknown) => data is PlayruoEmbedMessage;
120
+ /**
121
+ * Type guard to check if a message is a Playruo internal message
122
+ * Format: { type: 'playruo', action: '...', fromEmbed: true }
123
+ * These are messages sent TO the iframe (game), not to the parent
124
+ */
125
+ declare const isPlayruoInternalMessage: (data: unknown) => data is PlayruoInternalMessage;
126
+
27
127
  interface PlayruoEmbedActions {
28
128
  /** Start the demo session */
29
129
  tryNow: () => void;
@@ -33,18 +133,60 @@ interface PlayruoEmbedActions {
33
133
  canTryNow: boolean;
34
134
  /** Whether buy now is currently available */
35
135
  canBuyNow: boolean;
136
+ /** Send the password collected by the host to a protected operation. */
137
+ submitPassword: (password: string) => void;
138
+ /**
139
+ * Ask the operation to announce again whether it needs a password. The
140
+ * announcement is emitted once, so a host that mounts late can miss it.
141
+ */
142
+ requestPassword: () => void;
143
+ }
144
+ interface PlayruoEmbedPasswordState {
145
+ /**
146
+ * The operation asked for a password. Stays true once it was given, so read
147
+ * `unlocked` for the gate itself.
148
+ */
149
+ required: boolean;
150
+ /**
151
+ * The operation said whether it is protected. Until then `required: false`
152
+ * only means nothing was announced yet, so a host that called
153
+ * `requestPassword` cannot tell an unprotected operation from a silent one.
154
+ */
155
+ checked: boolean;
156
+ /** A submitted password was accepted. */
157
+ unlocked: boolean;
158
+ /** Code of the last refusal, from PlayruoPasswordError when known. */
159
+ error?: PlayruoPasswordErrorCode;
36
160
  }
37
161
  interface PlayruoEmbedRenderState {
38
162
  status: "loading" | "available" | "unavailable" | "error";
39
163
  message?: string;
40
164
  actions: PlayruoEmbedActions;
165
+ /**
166
+ * A protected operation never announces ready while it is locked, so a host
167
+ * that ignores this stays on `loading` for as long as the visitor has not
168
+ * been asked for the password.
169
+ */
170
+ password: PlayruoEmbedPasswordState;
41
171
  }
42
172
  interface PlayruoEmbedProps {
43
173
  /** Game origin (scheme + host). Omit to use production (`https://playruo.live`). */
44
174
  baseUrl?: string;
45
175
  /** Game operation slug used to build the iframe URL. */
46
176
  operation: string;
177
+ /**
178
+ * Which operation of the campaign to open, when it holds more than one. Sent
179
+ * as `?op=`. Without it the campaign picks its own.
180
+ */
181
+ operationKey?: string;
47
182
  storeUrl?: string;
183
+ /**
184
+ * Stable visitor identity the host already owns (account id, CRM id, …).
185
+ * When set, answers `playruo_uuid_request` with this value and skips
186
+ * `localStorage["playruo_uuid"]`. Omit to keep the SDK-managed UUID.
187
+ * Playruo derives the session fingerprint from the answered `uuid`.
188
+ */
189
+ clientFingerprint?: string;
48
190
  showIframe?: boolean;
49
191
  className?: string;
50
192
  onReady?: () => void;
@@ -55,6 +197,13 @@ interface PlayruoEmbedProps {
55
197
  storeUrl: string;
56
198
  }) => void;
57
199
  onError?: (error: string) => void;
200
+ /** The operation is password protected and waits for one. */
201
+ onPasswordRequired?: () => void;
202
+ /** Answer to a submitted password. */
203
+ onPasswordResult?: (result: {
204
+ success: boolean;
205
+ error?: PlayruoPasswordErrorCode;
206
+ }) => void;
58
207
  /**
59
208
  * Skip the parent fullscreen request and start the experience inside the
60
209
  * current iframe bounds. Defaults to false to preserve the current behavior.
@@ -74,7 +223,7 @@ interface PlayruoEmbedProps {
74
223
  /**
75
224
  * Ref to access the iframe element for fullscreen requests
76
225
  */
77
- iframeRef?: React.RefObject<HTMLIFrameElement>;
226
+ iframeRef?: React.RefObject<HTMLIFrameElement | null>;
78
227
  }
79
228
  declare const PlayruoEmbed: FC<PlayruoEmbedProps>;
80
229
 
@@ -90,69 +239,14 @@ interface EmbedTesterProps {
90
239
  }
91
240
  declare const EmbedTester: (props?: EmbedTesterProps) => react_jsx_runtime.JSX.Element;
92
241
 
93
- interface PlayruoReadyMessage {
94
- type: "playruo_ready";
95
- }
96
- interface PlayruoStateUpdateMessage {
97
- type: "playruo_state_update";
98
- data: PlayruoEmbedState;
99
- }
100
- interface PlayruoPurchaseRequestMessage {
101
- type: "playruo_purchase_request";
102
- data: {
103
- storeUrl: string;
104
- };
105
- }
106
- interface PlayruoDemoCompletedMessage {
107
- type: "playruo_demo_completed";
108
- data: DemoCompletedPayload;
109
- }
110
- interface PlayruoErrorMessage {
111
- type: "playruo_error";
112
- data: {
113
- message: string;
114
- } | string;
115
- }
116
- interface PlayruoSessionOverMessage {
117
- type: "playruo_session_over";
118
- data: PlayruoEmbedState;
119
- }
120
- interface PlayruoStreamStartMessage {
121
- type: "playruo_stream_start";
122
- }
123
- interface PlayruoStreamStopMessage {
124
- type: "playruo_stream_stop";
125
- }
126
- interface PlayruoRequestExitFullscreenMessage {
127
- type: "REQUEST_EXIT_FULLSCREEN";
128
- }
129
- interface PlayruoEventMessage {
130
- type: "playruo_event";
131
- data: PlayruoEventPayload;
132
- }
133
- type PlayruoEmbedMessage = PlayruoReadyMessage | PlayruoStateUpdateMessage | PlayruoPurchaseRequestMessage | PlayruoDemoCompletedMessage | PlayruoErrorMessage | PlayruoSessionOverMessage | PlayruoStreamStartMessage | PlayruoStreamStopMessage | PlayruoRequestExitFullscreenMessage | PlayruoEventMessage;
134
- interface PlayruoInternalMessage {
135
- type: "playruo";
136
- action: "tryNowClick" | "exitFullscreen" | "mute" | "unmute";
137
- fromEmbed: true;
138
- isReplay?: boolean;
139
- isFullscreen?: boolean;
140
- parentWillHandleFullscreen?: boolean;
141
- }
142
- /**
143
- * Type guard to check if a message event is a Playruo embed message
144
- * Messages FROM Embed → Host via postMessage
145
- */
146
- declare const isPlayruoEmbedMessage: (data: unknown) => data is PlayruoEmbedMessage;
147
- /**
148
- * Type guard to check if a message is a Playruo internal message
149
- * Format: { type: 'playruo', action: '...', fromEmbed: true }
150
- * These are messages sent TO the iframe (game), not to the parent
151
- */
152
- declare const isPlayruoInternalMessage: (data: unknown) => data is PlayruoInternalMessage;
153
-
154
242
  interface BuildUrlParams {
155
243
  operation: string;
244
+ /**
245
+ * Which operation of the campaign to open, when it holds more than one. Sent
246
+ * as `?op=`. Without it the campaign picks its own, which is what a single
247
+ * operation campaign wants.
248
+ */
249
+ operationKey?: string;
156
250
  storeUrl?: string;
157
251
  }
158
252
  /**
@@ -161,6 +255,14 @@ interface BuildUrlParams {
161
255
  * buildEmbedUrl({ operation: "my-game" })
162
256
  * // => "https://playruo.live/my-game?iframe=true"
163
257
  */
164
- declare const buildEmbedUrl: ({ operation, storeUrl }: BuildUrlParams) => string;
258
+ declare const buildEmbedUrl: ({ operation, operationKey, storeUrl, }: BuildUrlParams) => string;
259
+
260
+ declare const PLAYRUO_UUID_STORAGE_KEY = "playruo_uuid";
261
+ /**
262
+ * Visitor identity the host answers on `playruo_uuid_request`.
263
+ * Same rule as PlayruoEmbed `clientFingerprint`: a non-empty value is used as-is
264
+ * and is not written to localStorage. Otherwise the SDK-managed UUID is used.
265
+ */
266
+ declare const resolveVisitorUuid: (clientFingerprint?: string) => string;
165
267
 
166
- export { type DemoCompletedPayload, EmbedTester, type EmbedTesterProps, type PlayruoDemoCompletedMessage, PlayruoEmbed, type PlayruoEmbedActions, type PlayruoEmbedMessage, type PlayruoEmbedProps, type PlayruoEmbedRenderState, type PlayruoEmbedState, type PlayruoErrorMessage, type PlayruoEventMessage, type PlayruoEventPayload, type PlayruoInternalMessage, type PlayruoPurchaseRequestMessage, type PlayruoReadyMessage, type PlayruoRequestExitFullscreenMessage, type PlayruoSessionOverMessage, type PlayruoStateUpdateMessage, type PlayruoStreamStartMessage, type PlayruoStreamStopMessage, buildEmbedUrl, isPlayruoEmbedMessage, isPlayruoInternalMessage };
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 };