( webBaseUrl: string | undefined, orgSlug: string | undefined, input: typeof ConnectionCreateHandoffInput.Type, )
| 488 | }; |
| 489 | |
| 490 | const connectionCreateHandoffUrl = ( |
| 491 | webBaseUrl: string | undefined, |
| 492 | orgSlug: string | undefined, |
| 493 | input: typeof ConnectionCreateHandoffInput.Type, |
| 494 | ): string => { |
| 495 | const search = new URLSearchParams({ addAccount: "1" }); |
| 496 | if (input.owner !== undefined) search.set("owner", input.owner); |
| 497 | if (input.template !== undefined) search.set("template", input.template); |
| 498 | if (input.label !== undefined) search.set("label", input.label); |
| 499 | // Org-scoped hosts (cloud, self-host, cloudflare) serve the console under an |
| 500 | // optional `/<org-slug>` segment. Pin the URL to the executor's bound org so |
| 501 | // it opens that org directly instead of relying on the browser's last-active |
| 502 | // org (which `OrgSlugGate` would otherwise canonicalize a bare URL to). When |
| 503 | // no slug is known (CLI, local, non-request callers) we emit the bare path. |
| 504 | const orgPrefix = orgSlug !== undefined && orgSlug.length > 0 ? `/${orgSlug}` : ""; |
| 505 | const path = `${orgPrefix}/integrations/${encodeURIComponent(input.integration)}?${search.toString()}`; |
| 506 | if (webBaseUrl === undefined || webBaseUrl.length === 0) return path; |
| 507 | return new URL(path, webBaseUrl.endsWith("/") ? webBaseUrl : `${webBaseUrl}/`).toString(); |
| 508 | }; |
| 509 | |
| 510 | const oauthClientCreateHandoffUrl = ( |
| 511 | webBaseUrl: string | undefined, |
no test coverage detected