// Read the launch parameters the operator puts on your frontend URL, in the shape
// SDK login() takes: { loginURL, launchToken }. login() builds the request itself.
//
// There is deliberately no replacement for login() here. login() is the supported
// connect call. Re-implementing it to recover a dropped field risks exchanging a
// single-use launch token twice, and drifts from the SDK on every release.
export function launchParams(search: string): { loginURL: string; launchToken: string } {
  const params = new URLSearchParams(search);
  const loginURL = params.get('login');
  const launchToken = params.get('token');
  if (!loginURL || !launchToken) throw new Error('Launch URL requires login and token');
  return { loginURL, launchToken };
}
