@sylphx/sdk 0.3.6 → 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.
@@ -511,7 +511,12 @@ function createSylphxMiddleware(userConfig = {}) {
511
511
  );
512
512
  }
513
513
  const secretKey = validateAndSanitizeSecretKey(rawSecretKey);
514
- const platformUrl = (userConfig.platformUrl || `https://${DEFAULT_SDK_API_HOST}`).trim();
514
+ const platformUrl = (() => {
515
+ if (userConfig.platformUrl) return userConfig.platformUrl.trim();
516
+ const parts = secretKey.split("_");
517
+ const ref = parts.length === 4 ? parts[2] : null;
518
+ return ref ? `https://${ref}.${DEFAULT_SDK_API_HOST}` : `https://${DEFAULT_SDK_API_HOST}`;
519
+ })();
515
520
  const namespace = getCookieNamespace(secretKey);
516
521
  const cookieNames = getCookieNames(namespace);
517
522
  const config = {
@@ -1869,7 +1874,7 @@ function configureServer(config) {
1869
1874
  const secretKey = validateAndSanitizeSecretKey(config.secretKey);
1870
1875
  serverConfig = {
1871
1876
  secretKey,
1872
- platformUrl: `https://${DEFAULT_SDK_API_HOST}`.trim()
1877
+ platformUrl: config.platformUrl?.trim() || `https://${DEFAULT_SDK_API_HOST}`.trim()
1873
1878
  };
1874
1879
  }
1875
1880
  function getConfig() {