@sylphx/sdk 0.3.7 → 0.4.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 +360 -1
- package/dist/index.d.ts +360 -1
- package/dist/index.js +113 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +100 -0
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs/index.js +7 -2
- package/dist/nextjs/index.js.map +1 -1
- package/dist/nextjs/index.mjs +7 -2
- package/dist/nextjs/index.mjs.map +1 -1
- package/dist/react/index.d.cts +330 -1
- package/dist/react/index.d.ts +330 -1
- package/dist/react/index.js +710 -543
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +384 -221
- package/dist/react/index.mjs.map +1 -1
- package/dist/server/index.js +30 -11
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +30 -11
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/nextjs/index.mjs
CHANGED
|
@@ -457,7 +457,12 @@ function createSylphxMiddleware(userConfig = {}) {
|
|
|
457
457
|
);
|
|
458
458
|
}
|
|
459
459
|
const secretKey = validateAndSanitizeSecretKey(rawSecretKey);
|
|
460
|
-
const platformUrl = (
|
|
460
|
+
const platformUrl = (() => {
|
|
461
|
+
if (userConfig.platformUrl) return userConfig.platformUrl.trim();
|
|
462
|
+
const parts = secretKey.split("_");
|
|
463
|
+
const ref = parts.length === 4 ? parts[2] : null;
|
|
464
|
+
return ref ? `https://${ref}.${DEFAULT_SDK_API_HOST}` : `https://${DEFAULT_SDK_API_HOST}`;
|
|
465
|
+
})();
|
|
461
466
|
const namespace = getCookieNamespace(secretKey);
|
|
462
467
|
const cookieNames = getCookieNames(namespace);
|
|
463
468
|
const config = {
|
|
@@ -1815,7 +1820,7 @@ function configureServer(config) {
|
|
|
1815
1820
|
const secretKey = validateAndSanitizeSecretKey(config.secretKey);
|
|
1816
1821
|
serverConfig = {
|
|
1817
1822
|
secretKey,
|
|
1818
|
-
platformUrl: `https://${DEFAULT_SDK_API_HOST}`.trim()
|
|
1823
|
+
platformUrl: config.platformUrl?.trim() || `https://${DEFAULT_SDK_API_HOST}`.trim()
|
|
1819
1824
|
};
|
|
1820
1825
|
}
|
|
1821
1826
|
function getConfig() {
|