@getlimelight/sdk 0.2.1 → 0.3.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.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +17 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -219,7 +219,10 @@ var SENSITIVE_HEADERS = [
|
|
|
219
219
|
"x-secret",
|
|
220
220
|
"bearer"
|
|
221
221
|
];
|
|
222
|
-
var
|
|
222
|
+
var LIMELIGHT_WEB_WSS_URL = "wss://api.getlimelight.io";
|
|
223
|
+
var LIMELIGHT_DESKTOP_WSS_URL = "ws://localhost:8484";
|
|
224
|
+
var WS_PATH = "/limelight";
|
|
225
|
+
var SDK_VERSION = true ? "0.3.0" : "test-version";
|
|
223
226
|
var RENDER_THRESHOLDS = {
|
|
224
227
|
HOT_VELOCITY: 5,
|
|
225
228
|
HIGH_RENDER_COUNT: 50,
|
|
@@ -1597,18 +1600,19 @@ var LimelightClient = class {
|
|
|
1597
1600
|
* @returns {void}
|
|
1598
1601
|
*/
|
|
1599
1602
|
configure(config) {
|
|
1600
|
-
const isEnabled = config
|
|
1603
|
+
const isEnabled = config?.enabled ?? isDevelopment();
|
|
1604
|
+
const configServerUrl = config?.serverUrl ? config.serverUrl : config?.projectKey ? `${LIMELIGHT_WEB_WSS_URL}${WS_PATH}` : `${LIMELIGHT_DESKTOP_WSS_URL}${WS_PATH}`;
|
|
1601
1605
|
this.config = {
|
|
1602
|
-
|
|
1603
|
-
|
|
1606
|
+
...config,
|
|
1607
|
+
appName: config?.appName ?? "Limelight App",
|
|
1608
|
+
serverUrl: configServerUrl,
|
|
1604
1609
|
enabled: isEnabled,
|
|
1605
|
-
enableNetworkInspector: true,
|
|
1606
|
-
enableConsole: true,
|
|
1607
|
-
enableGraphQL: true,
|
|
1608
|
-
enableRenderInspector: true
|
|
1609
|
-
...config
|
|
1610
|
+
enableNetworkInspector: config?.enableNetworkInspector ?? true,
|
|
1611
|
+
enableConsole: config?.enableConsole ?? true,
|
|
1612
|
+
enableGraphQL: config?.enableGraphQL ?? true,
|
|
1613
|
+
enableRenderInspector: config?.enableRenderInspector ?? true
|
|
1610
1614
|
};
|
|
1611
|
-
if (!this.config
|
|
1615
|
+
if (!this.config?.enabled) {
|
|
1612
1616
|
return;
|
|
1613
1617
|
}
|
|
1614
1618
|
this.sessionId = createSessionId();
|
|
@@ -1639,13 +1643,7 @@ var LimelightClient = class {
|
|
|
1639
1643
|
* @returns {void}
|
|
1640
1644
|
*/
|
|
1641
1645
|
connect(config) {
|
|
1642
|
-
|
|
1643
|
-
this.configure(config);
|
|
1644
|
-
} else if (!this.config) {
|
|
1645
|
-
throw new Error(
|
|
1646
|
-
"[Limelight] Limelight not configured. Please provide a configuration object when calling connect(). Project id is the only required field."
|
|
1647
|
-
);
|
|
1648
|
-
}
|
|
1646
|
+
this.configure(config);
|
|
1649
1647
|
if (!this.config?.enabled) {
|
|
1650
1648
|
return;
|
|
1651
1649
|
}
|
|
@@ -1677,7 +1675,7 @@ var LimelightClient = class {
|
|
|
1677
1675
|
data: {
|
|
1678
1676
|
appName,
|
|
1679
1677
|
platform: platform || (typeof window !== "undefined" ? "web" : "react-native"),
|
|
1680
|
-
projectKey: this.config.projectKey,
|
|
1678
|
+
projectKey: this.config.projectKey || "",
|
|
1681
1679
|
sdkVersion: SDK_VERSION
|
|
1682
1680
|
}
|
|
1683
1681
|
};
|
|
@@ -1719,13 +1717,7 @@ var LimelightClient = class {
|
|
|
1719
1717
|
);
|
|
1720
1718
|
this.reconnectTimer = setTimeout(() => {
|
|
1721
1719
|
this.reconnectTimer = null;
|
|
1722
|
-
|
|
1723
|
-
this.configure(this.config);
|
|
1724
|
-
} else if (!this.config) {
|
|
1725
|
-
throw new Error(
|
|
1726
|
-
"[Limelight] Limelight not configured. Please provide a configuration object when calling connect(). Project id is the only required field."
|
|
1727
|
-
);
|
|
1728
|
-
}
|
|
1720
|
+
this.connect(this.config || void 0);
|
|
1729
1721
|
}, delay);
|
|
1730
1722
|
}
|
|
1731
1723
|
/**
|