restream-sdk 0.1.2 → 0.1.3
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 +1 -1
- package/src/core.js +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "restream-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Plug-and-play headless React hooks to add multi-platform restreaming (connect socials, go live, live chat + viewers) with zero client backend.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
package/src/core.js
CHANGED
|
@@ -131,10 +131,12 @@ export class RestreamStudio extends EventTarget {
|
|
|
131
131
|
|
|
132
132
|
/** Open the hosted OAuth popup for a platform; resolves when connected (or the popup closes). */
|
|
133
133
|
async connect(platform) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const popup = window.open(
|
|
134
|
+
// Open the popup synchronously, inside the click's user-activation window —
|
|
135
|
+
// any await before window.open consumes the gesture and the browser blocks it.
|
|
136
|
+
const popup = window.open("", "restream_connect", "width=560,height=760");
|
|
137
137
|
if (!popup) throw new Error("popup blocked — allow popups to connect accounts");
|
|
138
|
+
const q = await this._authQuery();
|
|
139
|
+
popup.location = `${this.apiBase}/api/v1/connect/${platform}/start?${new URLSearchParams(q)}`;
|
|
138
140
|
return new Promise((resolve, reject) => {
|
|
139
141
|
const cleanup = () => {
|
|
140
142
|
window.removeEventListener("message", onMsg);
|