Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
feat(integrations): show Coming soon for internal-only integrations
Raul92281eceee1a
diff --git a/.claude/rules/onshape-panel.md b/.claude/rules/onshape-panel.mdindex d2e3824f22..85d85a7cca 100644--- a/.claude/rules/onshape-panel.md+++ b/.claude/rules/onshape-panel.md@@ -20,7 +20,7 @@ A Carbon panel in Onshape's element right panel. Users push parts, assemblies an- `ONSHAPE_INTEGRATION_IDS`, `OnshapeIntegrationId`, `isOnshapeIntegrationId` and `getConflictingOnshapeIntegration` (`lib/connection.ts`) cover the two sync connections only. `OnshapeOAuthIntegrationId` covers all three.- Status, releases and the three plan routes read the connection with the service role. The `companyIntegration` SELECT policy needs settings view; through a parts-view user's client the row reads as absent and the panel says Onshape is not connected. The Fields route uses the user's client: it requires settings update anyway.- Only an `onshape-v2` item link means "the panel pushes to this item". A sync connection's item row is BOM-import bookkeeping for the BoM Explorer; the item card and Detach never read or delete it.-- OAuth: the sync integration and the panel are two Onshape apps and share no variable. `onshape` reads `ONSHAPE_CLIENT_ID`, `ONSHAPE_CLIENT_SECRET`, `ONSHAPE_OAUTH_REDIRECT_URL` (→ `/api/integrations/onshape/oauth`); `onshape-v2` reads `ONSHAPE_V2_CLIENT_ID`, `ONSHAPE_V2_CLIENT_SECRET`, `ONSHAPE_V2_OAUTH_REDIRECT_URL` (→ `/api/integrations/onshape-v2/oauth`). Both ask for `OAuth2Read OAuth2Write`. Each card is `active` only when its own client id is set (`config.tsx`, `config-v2.tsx`); otherwise it reads Not Configured, Install is disabled and an installed connection's Details link goes nowhere; the env schema groups them as `onshape` and `onshapeV2`. Install routes call `beginOnshapeAuthorization`; callbacks call `completeOnshapeAuthorization` (`modules/settings/settings.service.ts`); `getOnshapeOAuthConfig` picks the client and redirect per id and answers `not-configured` when one of that integration's three variables is missing. A connection's tokens belong to the app that issued them: changing an integration's client id means reconnecting. State is the cookie-bound one from `@carbon/auth/oauth-state.server`.+- OAuth: the sync integration and the panel are two Onshape apps and share no variable. `onshape` reads `ONSHAPE_CLIENT_ID`, `ONSHAPE_CLIENT_SECRET`, `ONSHAPE_OAUTH_REDIRECT_URL` (→ `/api/integrations/onshape/oauth`); `onshape-v2` reads `ONSHAPE_V2_CLIENT_ID`, `ONSHAPE_V2_CLIENT_SECRET`, `ONSHAPE_V2_OAUTH_REDIRECT_URL` (→ `/api/integrations/onshape-v2/oauth`). Both ask for `OAuth2Read OAuth2Write`. Each card is `active` only when its own client id is set (`config.tsx`, `config-v2.tsx`); otherwise it reads Not Configured, Install is disabled and an installed connection's Details link goes nowhere; the env schema groups them as `onshape` and `onshapeV2`. `onshape-v2` is also `internalOnly`: on Carbon Cloud only Carbon staff can install it, in any company, and everyone else sees Coming soon (`isIntegrationComingSoon`, `@carbon/ee/plan`). The install route refuses them with `coming-soon` (`isIntegrationInstallWithheld`, `modules/settings/settings.service.ts`); a company that has it installed keeps it. Install routes call `beginOnshapeAuthorization`; callbacks call `completeOnshapeAuthorization` (`modules/settings/settings.service.ts`); `getOnshapeOAuthConfig` picks the client and redirect per id and answers `not-configured` when one of that integration's three variables is missing. A connection's tokens belong to the app that issued them: changing an integration's client id means reconnecting. State is the cookie-bound one from `@carbon/auth/oauth-state.server`.- Connect opens a popup (`beginOAuthPopup`, `packages/ee/src/oauth-popup.ts`, opened inside the click). The callback renders `oauthPopupResponse`: it posts the outcome to the opener and closes, or lands on the integrations page with no opener. The drawer's Reconnect action POSTs to the install route and follows `{ redirectUrl }`.- Uninstall only sets `active = false` and keeps the tokens, so `getOnshapeClient` reads the `onshape-v2` row only while it is active: after an uninstall every panel read answers "not connected". A plan already stored can still be applied until it expires (15 min); APPLY makes no Onshape call.- `onshapeHealthcheck` (`hooks.server.ts`) builds the client (refreshing an expired token) and reads `/companies`; a revoked grant reads unhealthy.diff --git a/apps/erp/app/modules/settings/integration-errors.ts b/apps/erp/app/modules/settings/integration-errors.tsindex 36490ee446..601f85a2f3 100644--- a/apps/erp/app/modules/settings/integration-errors.ts+++ b/apps/erp/app/modules/settings/integration-errors.ts@@ -166,6 +166,15 @@ export function integrationErrorSearch<T extends IntegrationWithErrors>(return `?integration=${integration}&error=${error}`;}+/** Codes any integration's install can answer. */+const sharedErrors = {+ // `isIntegrationInstallWithheld`: an `internalOnly` integration.+ "coming-soon": {+ title: msg`This integration isn't available yet`,+ description: msg`It is coming soon. Contact Carbon to have it set up for your company.`+ }+} satisfies Record<string, IntegrationErrorMessage>;+/** Resolves those params back to copy. Unknown integration or code → nothing. */export function getIntegrationError(integration: string | null,@@ -176,5 +185,8 @@ export function getIntegrationError(const messages =integrationErrors[integration as IntegrationWithErrors] ?? undefined;- return messages?.[error as keyof typeof messages];+ return (+ messages?.[error as keyof typeof messages] ??+ sharedErrors[error as keyof typeof sharedErrors]+ );}diff --git a/apps/erp/app/modules/settings/settings.service.ts b/apps/erp/app/modules/settings/settings.service.tsindex 6ed6554daf..576174c199 100644--- a/apps/erp/app/modules/settings/settings.service.ts+++ b/apps/erp/app/modules/settings/settings.service.ts@@ -11,6 +11,7 @@ import type {ServiceContext} from "@carbon/api/service-fn.server";import {+ CarbonEdition,CONTROLLED_ENVIRONMENT,SUPABASE_INTERNAL_URL,SUPABASE_URL,@@ -82,6 +83,7 @@ import type {StandardFieldWriter} from "@carbon/ee";import {+ integrations as availableIntegrations,bomLineItemType,CUSTOM_FIELD_TYPE_LABELS,changeNoticeDescriptionJson,@@ -180,6 +182,7 @@ import {patchOnshapeOAuthGrant,patchOnshapeSettings} from "@carbon/ee/onshape.server";+import { isIntegrationComingSoon } from "@carbon/ee/plan";import { companyHasFeature } from "@carbon/ee/plan.server";import { patchRampSettings } from "@carbon/ee/ramp.server";import { resolveCapabilities } from "@carbon/ee/sync";@@ -562,6 +565,41 @@ export async function getIntegration(.maybeSingle();}+const integrationInstallLogger = getLogger("erp", "settings", "integrations");++/**+ * Whether a new install is refused: an `internalOnly` integration this user+ * sees as "Coming soon" (`isIntegrationComingSoon`), in a company that does not+ * have it installed. A failed read refuses.+ */+export async function isIntegrationInstallWithheld(+ client: SupabaseClient<Database>,+ {+ companyId,+ integrationId,+ }: { companyId: string; integrationId: string; email: string }+): Promise<boolean> {+ const integration = availableIntegrations.find((i) => i.id === integrationId);+ if (+ !integration ||+ !isIntegrationComingSoon(integration, { edition: CarbonEdition, email })+ ) {+ return false;+ }++ const existing = await getIntegration(client, integrationId, companyId);+ if (existing.error) {+ integrationInstallLogger.error("Failed to read the integration install", {+ companyId,+ integrationId,+ error: existing.error+ });+ return true;+ }+ return existing.data?.active !== true;+}+export async function getIntegrations(client: SupabaseClient<Database>,companyId: stringdiff --git a/apps/erp/app/modules/settings/ui/Integrations/IntegrationCard.tsx b/apps/erp/app/modules/settings/ui/Integrations/IntegrationCard.tsxindex 962911c796..2cd6adcaad 100644--- a/apps/erp/app/modules/settings/ui/Integrations/IntegrationCard.tsx+++ b/apps/erp/app/modules/settings/ui/Integrations/IntegrationCard.tsx@@ -3,7 +3,10 @@// including ports, remain AGPLv3; serving them over a network requires releasing their source.import type { Integration } from "@carbon/ee";-import { isIntegrationWhitelisted } from "@carbon/ee/plan";+import {+ isIntegrationComingSoon,+ isIntegrationWhitelisted+} from "@carbon/ee/plan";import { getLogger } from "@carbon/logger";import { useRevalidator } from "@carbon/query";import {@@ -19,6 +22,7 @@ import {TooltipContent,TooltipTrigger,toast,+ useEdition,useRouteData} from "@carbon/react";import { Trans, useLingui } from "@lingui/react/macro";@@ -26,6 +30,7 @@ import { useEffect, useState } from "react";import { LuLock } from "react-icons/lu";import { Link, useFetcher, useNavigate } from "react-router";import { usePlanGate } from "~/hooks/usePlanGate";+import { useUser } from "~/hooks/useUser";import { getIntegrationError } from "~/modules/settings/integration-errors";import { isOAuthPopupResult } from "~/modules/settings/oauth-popup";import { path } from "~/utils/path";@@ -87,6 +92,13 @@ export function IntegrationCard({const { isGated } = usePlanGate({ feature: "INTEGRATIONS" });const isWhitelisted = isIntegrationWhitelisted(integration.id);const isStarterPlan = isGated && !isWhitelisted;+ const edition = useEdition();+ const user = useUser();+ // Only an install is withheld: a company where Carbon staff installed it+ // keeps a working card.+ const comingSoon =+ !installed &&+ isIntegrationComingSoon(integration, { edition, email: user.email });// At most one ACTIVE integration per provider role, enforced by a database// trigger. Surfacing it here is what keeps a customer from meeting that@@ -206,6 +218,10 @@ export function IntegrationCard({<Badge className="flex-shrink-0" variant="green"><Trans>Installed</Trans></Badge>+ ) : comingSoon ? (+ <Badge className="flex-shrink-0" variant="secondary">+ <Trans>Coming soon</Trans>+ </Badge>) : null) : (<Badge className="flex-shrink-0" variant="secondary">@@ -271,6 +287,7 @@ export function IntegrationCard({<ButtonisDisabled={!integration.active ||+ comingSoon ||!!conflictsWith ||fetcher.state !== "idle"}diff --git a/apps/erp/app/modules/settings/ui/Integrations/IntegrationsList.tsx b/apps/erp/app/modules/settings/ui/Integrations/IntegrationsList.tsxindex f48f6e87cb..28ec1994da 100644--- a/apps/erp/app/modules/settings/ui/Integrations/IntegrationsList.tsx+++ b/apps/erp/app/modules/settings/ui/Integrations/IntegrationsList.tsx@@ -3,12 +3,14 @@// including ports, remain AGPLv3; serving them over a network requires releasing their source.import type { Integration, QuickInstallConnector } from "@carbon/ee";+import { isIntegrationComingSoon } from "@carbon/ee/plan";import {Select,SelectContent,SelectItem,SelectTrigger,SelectValue,+ useEdition,useUrlParams} from "@carbon/react";import { Trans, useLingui } from "@lingui/react/macro";@@ -26,6 +28,7 @@ import {} from "~/components/UpgradeOverlay";import { useAnyVisible } from "~/hooks/useAnyVisible";import { usePlanGate } from "~/hooks/usePlanGate";+import { useUser } from "~/hooks/useUser";import type { IntegrationHealth } from "./IntegrationCard";import { IntegrationCard } from "./IntegrationCard";import { QuickInstall } from "./QuickInstall";@@ -47,6 +50,8 @@ const IntegrationsList = ({"all");const { isGated } = usePlanGate({ feature: "INTEGRATIONS" });+ const edition = useEdition();+ const { email } = useUser();const search = params.get("search") || "";const gridRef = useRef<HTMLDivElement>(null);@@ -70,12 +75,14 @@ const IntegrationsList = ({} else if (filter === "available") {filtered = filtered.filter((integration) =>- !installedIds.includes(integration.id) && integration.active+ !installedIds.includes(integration.id) &&+ integration.active &&+ !isIntegrationComingSoon(integration, { edition, email }));}return filtered;- }, [availableIntegrations, installedIds, search, filter]);+ }, [availableIntegrations, installedIds, search, filter, edition, email]);const anyWhitelistedVisible = useAnyVisible({containerRef: gridRef,diff --git a/apps/erp/app/routes/api+/integrations.$id.connect.ts b/apps/erp/app/routes/api+/integrations.$id.connect.tsindex 2666b48847..d2c2d8c438 100644--- a/apps/erp/app/routes/api+/integrations.$id.connect.ts+++ b/apps/erp/app/routes/api+/integrations.$id.connect.ts@@ -9,6 +9,7 @@ import { getIntegrationIdsByRole, integrations } from "@carbon/ee";import { redirectExternal } from "@carbon/utils";import type { LoaderFunctionArgs } from "react-router";import { buildIntegrationOAuthUrl } from "~/modules/settings/integration-oauth";+import { isIntegrationInstallWithheld } from "~/modules/settings/settings.service";import { path } from "~/utils/path";// nodejs runtime: issuing the signed state cookie.@@ -29,9 +30,12 @@ export const config = {* parameter the callback reads back.*/export async function loader({ request, params }: LoaderFunctionArgs) {- const { userId, companyId, client } = await requirePermissions(request, {- update: "settings"- });+ const { userId, companyId, client, email } = await requirePermissions(+ request,+ {+ update: "settings"+ }+ );const integrationId = params.id;const integration = integrations.find((i) => i.id === integrationId);@@ -49,6 +53,18 @@ export async function loader({ request, params }: LoaderFunctionArgs) {);}+ if (+ await isIntegrationInstallWithheld(client, {+ companyId,+ integrationId,+ })+ ) {+ return redirectExternal(+ `${getAppUrl()}${path.to.integrations}?error=coming-soon&integration=${integrationId}`+ );+ }+// Refuse before consent when the integration's role slot is already taken. The// database enforces this too (`companyIntegration_single_active_role`), but// reaching that refusal AFTER the customer has authorized at the providerdiff --git a/apps/erp/app/routes/api+/integrations.onshape-v2.install.ts b/apps/erp/app/routes/api+/integrations.onshape-v2.install.tsindex ebc5360209..a3fa095e64 100644--- a/apps/erp/app/routes/api+/integrations.onshape-v2.install.ts+++ b/apps/erp/app/routes/api+/integrations.onshape-v2.install.ts@@ -7,12 +7,25 @@ import { ONSHAPE_V2_INTEGRATION_ID } from "@carbon/ee/onshape";import { beginOnshapeAuthorization } from "@carbon/ee/onshape.server";import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";import { data } from "react-router";+import { isIntegrationInstallWithheld } from "~/modules/settings/settings.service";import { path } from "~/utils/path";async function authorize(request: Request) {- const { userId, companyId } = await requirePermissions(request, {- update: "settings"- });+ const { client, userId, companyId, email } = await requirePermissions(+ request,+ {+ update: "settings"+ }+ );+ if (+ await isIntegrationInstallWithheld(client, {+ companyId,+ integrationId: ONSHAPE_V2_INTEGRATION_ID,+ })+ ) {+ return { ok: false as const, reason: "coming-soon" as const };+ }return beginOnshapeAuthorization(request, {integrationId: ONSHAPE_V2_INTEGRATION_ID,userId,@@ -26,7 +39,14 @@ export async function loader({ request }: LoaderFunctionArgs) {if (!started.ok) {return data({ error: started.reason },- { status: started.reason === "not-configured" ? 500 : 409 }+ {+ status:+ started.reason === "not-configured"+ ? 500+ : started.reason === "coming-soon"+ ? 403+ : 409+ });}diff --git a/apps/erp/app/routes/x+/settings+/integrations.$id.tsx b/apps/erp/app/routes/x+/settings+/integrations.$id.tsxindex 143b751d65..ffe4943119 100644--- a/apps/erp/app/routes/x+/settings+/integrations.$id.tsx+++ b/apps/erp/app/routes/x+/settings+/integrations.$id.tsx@@ -111,6 +111,7 @@ import {getProviderDimensionTargets,getSyncOperationReadableIds,invalidateIntegrationHealthCache,+ isIntegrationInstallWithheld,upsertCompanyIntegration} from "~/modules/settings/settings.service";import { IntegrationForm, SyncActivity } from "~/modules/settings/ui";@@ -1129,9 +1130,12 @@ export async function action(args: ActionFunctionArgs) {*/async function installIntegration({ request, params }: ActionFunctionArgs) {assertIsPost(request);- const { client, companyId, userId } = await requirePermissions(request, {- update: "settings"- });+ const { client, companyId, userId, email } = await requirePermissions(+ request,+ {+ update: "settings"+ }+ );const { id: integrationId } = params;if (!integrationId) throw new Error("Integration ID not found");@@ -1152,6 +1156,22 @@ async function installIntegration({ request, params }: ActionFunctionArgs) {if (!integration) throw new Error("Integration not found");+ if (+ await isIntegrationInstallWithheld(client, {+ companyId,+ integrationId,+ })+ ) {+ return data(+ {},+ await flash(+ request,+ error(null, `${integration.name} isn't available yet.`)+ )+ );+ }+const validation = await validator(// integration.schema is a union across all integrations (incl. a// discriminated union for Email). Cast to a generic ZodType so thediff --git a/packages/ee/AGENTS.md b/packages/ee/AGENTS.mdindex 5b0070e00b..a7c4c720be 100644--- a/packages/ee/AGENTS.md+++ b/packages/ee/AGENTS.md@@ -76,6 +76,7 @@ pnpm --filter @carbon/ee typecheck- **Provider roles**: every integration that participates in sync declares `providerRole: "accounting" | "spend" | "oee"` on its descriptor. That ONE declaration replaces the id lists that used to answer "which are accounting providers" five different ways, and the database enforces at most one ACTIVE integration per role per company (`companyIntegration_single_active_role`, migration `20260924133915`) — except `oee`, which may have several active integrations at once (`check_single_active_provider_role()` skips it, migration `20261013030022`); its one-device-per-work-center rule is `UNIQUE(workCenterId, companyId)` on `workCenterDevice` instead (`.claude/rules/oee-provider.md`). `getIntegrationsByRole`/`getIntegrationIdsByRole` (barrel) are the lookups; `no-integration-id-branching` (`@carbon/checks`) stops new id branching. NOTE the barrel cannot be imported from a `*.service.ts` (browser-bundled) or from most tests — it reaches `@carbon/auth`, which validates the full server env at import time; that is why `./sync` takes the registry slice as an argument instead of importing it- **Ledger delegation**: when a spend provider's mode declares `ownsLedgerFamilies`, `applyLedgerDelegation` sets that family to `"none"` AND disables its backing entities — derived from `POSTING_POLICY`, never a hard-coded `"bill"`. Each half alone is wrong (families-only leaves the document pushing; entity-only parks a `DOC_SYNC_DISABLED` Warning forever). `getJournalPostingPolicyDecision` accepts only `EffectivePostingSyncSettings`, so the compiler refuses a posting decision made from raw settings- **Integration pattern**: `defineIntegration()` → config with id, name, settings, OAuth, actions+- **Internal-only integrations**: `internalOnly: true` on a descriptor makes it installable on Carbon Cloud by Carbon staff only (`isInternalEmail`), in any company; everyone else sees a Coming soon card. Self-hosted editions are not gated. `isIntegrationComingSoon` (`./plan`) is the one rule; the ERP's `isIntegrationInstallWithheld` (`modules/settings/settings.service.ts`) applies it in the connect route, the install action and the `onshape-v2` install route, and only to a company that does not have the integration installed. An integration with its own install route must call it there too- **SAML SSO** (`./sso.server`, `src/sso/`): `isSsoEnabled()` (`gate.ts` — Enterprise edition AND `sso` in `AUTH_PROVIDERS`) is the ONE flag; the connection lookups and admin mutations self-gate on it. `provider.server.ts` = GoTrue admin API wrappers + `getSamlSpUrls`; `connections.server.ts` = `ssoConnection` lookups (each attaches a computed `domains: string[]` of VERIFIED `ssoDomain` claims), `isSsoRequiredForEmail`, `getSsoAwareInviteLink`, upsert/requireSso/deactivate mutations, and the domain-claim flows `addSsoDomain`/`verifySsoDomain`/`removeSsoDomain`; `verification.server.ts` = the DNS TXT ownership challenge (`_carbon-challenge.<domain>` → `carbon-domain-verification=<token>`, `checkDomainVerification` with pinned public resolvers, one-shot manual verify — no polling or re-verification); `session.server.ts` = amr-based session classification (`getSsoProviderIdFromSession` for enforcement, never `getSsoProviderIdFromUser`); `provisioning.server.ts` = identity linking + invite-first migration + `deleteJitSsoUser` (full removal of a rejected throwaway JIT user — auth user AND its trigger-created `user`/`userPermission` rows, guarded on zero memberships; takes a `Kysely<KyselyDatabase>` param — callers pass their own db client) + the **pre-seed** helpers `seedSsoIdentityForUser` / `backfillSsoIdentitiesForDomain` / `removeSsoIdentitiesForDomain` (+ pure `emailDomain` / `ssoProviderColumn`). Pre-seeding is the account-linking fix under `GOTRUE_DISABLE_SIGNUP=true`: a row in `auth.identities` with `identity_data.email = lower(email)` makes GoTrue link a SAML sign-in to the existing user via its **email-column** fallback — provider-agnostic (works for any IdP: Okta/Entra/OneLogin/Ping/…, whose NameID shapes differ), keyed on the generated `email` column NOT `provider_id`. `verifySsoDomain` backfills every existing on-domain user when a domain is verified; the three account-creation flows (`apps/erp/.../users.service.ts`) seed newly-invited users; `removeSsoDomain` tears the domain's identities down. A DB guard trigger on `auth.sso_domains` (migration `…_sso-domain-guard.sql`, `ssoReservedDomain` table) blocks registering an unclaimed/reserved domain. Only verified domains ever reach GoTrue. Full architecture + the provider-agnostic linking rationale: `.claude/rules/authentication-system.md` (Enterprise SAML SSO section); design: `.ai/specs/2026-08-29-saml-sso-account-linking.md`- **Onshape panel auth** (`./onshape/panel-session.server`, `src/onshape/panel/session.server.ts`): the `cps_` bearer credential for the Onshape iframe, which the `SameSite=Lax` `carbon` cookie cannot reach. Mints, stores (Redis `panel-session:<token>`, 12 h) and revokes sessions, and exports `requireOnshapePanelPermissions`, the panel routes' gate: the same claims check as `requirePermissions`, answering 401/403 with no redirect. Imports `getUserClaims`, `userHasVerifiedTotpFactor`, `getUserScopedClient` and `hasPermission` from `@carbon/auth`; auth never imports it back. See `.claude/rules/onshape-panel.md`- **Exports**: `./accounting`, `./plan`, `./plan.server`, `./entitlements.server`, `./permissions.server`, `./console.server`, `./approvals`, `./audit.server`, `./backups.server`, `./email-notifications.server`, `./api-keys.server`, `./webhooks.server`, `./two-factor.server`, `./forecast.server`, `./customer-portals.server`, `./mcp`, `./mcp.server`, `./rules` (client-safe storage + sales rule query services/UI), `./rules.server` (both evaluators AND the entitlement-gated authoring writes — `upsertEnforcementRule`/`deleteEnforcementRule`/`assign*`/`unassign*` in `rules/service.server.ts`, each embedding `requireEntitlement("SALES_RULES"|"STORAGE_RULES")`), `./workflows`, `./workflows/help`, `./workflows/labels`, `./workflows.server`, `./slack.server`, `./hooks.server`, `./sso.server`, `./onshape/integration-id`, `./onshape/panel-session.server`, `./jira`, `./linear`, `./rillet/hooks.server`, `./xero/hooks.server`, `./ramp.server`, `./ramp/hooks.server`, `./oee`, `./oee.server`, `./sense/hooks.server`, etc.diff --git a/packages/ee/src/onshape/config-v2.tsx b/packages/ee/src/onshape/config-v2.tsxindex 7001a2a248..7a9ee9fa76 100644--- a/packages/ee/src/onshape/config-v2.tsx+++ b/packages/ee/src/onshape/config-v2.tsx@@ -13,6 +13,7 @@ export const OnshapeV2 = defineIntegration({name: "Onshape V2",id: ONSHAPE_V2_INTEGRATION_ID,active: !!ONSHAPE_V2_CLIENT_ID,+ internalOnly: true,category: "CAD",logo: Logo,description:diff --git a/packages/ee/src/plan.test.ts b/packages/ee/src/plan.test.tsnew file mode 100644index 0000000000..cf2ce845b3--- /dev/null+++ b/packages/ee/src/plan.test.ts@@ -0,0 +1,66 @@+// SPDX-License-Identifier: LicenseRef-Carbon-Commercial+// Carbon Enterprise file, licensed only under the Carbon Commercial License+// (packages/ee/LICENSE). Not AGPL. Running, modifying, or copying it beyond those terms requires a commercial license.++import { Edition } from "@carbon/utils";+import { describe, expect, it } from "vitest";+import { isIntegrationComingSoon } from "./plan";++const internalOnly = { id: "cad", internalOnly: true };+const customer = "[email protected]";++describe("isIntegrationComingSoon", () => {+ it("withholds an internal-only integration from a customer on Cloud", () => {+ expect(+ isIntegrationComingSoon(internalOnly, {+ edition: Edition.Cloud,+ email: customer+ })+ ).toBe(true);+ });++ it("offers it to Carbon staff on Cloud, whatever the casing", () => {+ for (const email of [+ "[email protected]",+ "[email protected]",+ ]) {+ expect(+ isIntegrationComingSoon(internalOnly, { edition: Edition.Cloud, email })+ ).toBe(false);+ }+ });++ it("withholds it when the email is unknown", () => {+ expect(+ isIntegrationComingSoon(internalOnly, {+ edition: Edition.Cloud,+ email: null+ })+ ).toBe(true);+ });++ it("does not gate a self-hosted edition", () => {+ for (const edition of [+ Edition.Enterprise,+ Edition.Community,+ Edition.Test+ ]) {+ expect(+ isIntegrationComingSoon(internalOnly, { edition, email: customer })+ ).toBe(false);+ }+ });++ it("does not gate an integration that is not internal-only", () => {+ expect(+ isIntegrationComingSoon(+ { id: "cad" },+ {+ edition: Edition.Cloud,+ email: customer+ }+ )+ ).toBe(false);+ });+});diff --git a/packages/ee/src/plan.ts b/packages/ee/src/plan.tsindex 9156d03c44..72cfbad33f 100644--- a/packages/ee/src/plan.ts+++ b/packages/ee/src/plan.ts@@ -2,7 +2,7 @@// Carbon Enterprise file, licensed only under the Carbon Commercial License// (packages/ee/LICENSE). Not AGPL. Running, modifying, or copying it beyond those terms requires a commercial license.-import { Plan } from "@carbon/utils";+import { Edition, isInternalEmail, Plan } from "@carbon/utils";import type { IntegrationID } from "./index";/**@@ -49,6 +49,26 @@ export function isIntegrationWhitelisted(id: string) {return INTEGRATION_WHITELIST.has(id as IntegrationID);}+/**+ * Whether this user sees an `internalOnly` integration as "Coming soon" and+ * cannot install it. Carbon staff (`isInternalEmail`) can, in any company.+ * Only Carbon Cloud gates it: a self-hosted instance configures its own OAuth+ * app and has no Carbon staff to install it.+ *+ * It gates the install only. A company where staff installed it keeps it, so+ * its own admins can open, reconnect and uninstall it.+ */+export function isIntegrationComingSoon(+ integration: { id: string; internalOnly?: boolean },+ { edition, email }: { edition: Edition; email: string | null | undefined }+): boolean {+ return (+ integration.internalOnly === true &&+ edition === Edition.Cloud &&+ !isInternalEmail(email)+ );+}+export type PlanRequirement = Plan | Plan[];export type GateSpec =diff --git a/packages/ee/src/types.ts b/packages/ee/src/types.tsindex 2246ccd802..017e2b96e8 100644--- a/packages/ee/src/types.ts+++ b/packages/ee/src/types.ts@@ -201,6 +201,13 @@ export type IntegrationConfig = {* Defaults to true if not specified.*/active?: boolean;+ /**+ * Installable on Carbon Cloud by Carbon staff only, while the integration is+ * rolled out. Everyone else sees a "Coming soon" card. Staff may install it in+ * any company, and the install then works for that company like any other.+ * See `isIntegrationComingSoon` (`plan.ts`).+ */+ internalOnly?: boolean;/** Category for grouping in the UI (e.g., "Accounting", "CAD", "Email") */category: string;/**diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.poindex aeaddd6609..a7fa0354ef 100644--- a/packages/locale/locales/de/erp.po+++ b/packages/locale/locales/de/erp.po@@ -12056,6 +12056,9 @@ msgstr "Ausstellungsdatum"msgid "Issues"msgstr "Probleme"+msgid "It is coming soon. Contact Carbon to have it set up for your company."+msgstr ""+msgid "It will stop running until you publish a version again. Nothing is deleted."msgstr "Es wird nicht mehr ausgeführt, bis Sie erneut eine Version veröffentlichen. Nichts wird gelöscht."@@ -23859,6 +23862,9 @@ msgstr "Diese Information ist für alle Benutzer sichtbar. Seien Sie daher vorsimsgid "this inspection plan"msgstr "dieser Prüfplan"+msgid "This integration isn't available yet"+msgstr ""+#. placeholder {0}: company?.name ?? "Carbon"msgid "This invitation to join {0} has expired. You can request a new invite to be sent to your email."msgstr "Diese Einladung zum Beitritt zu {0} ist abgelaufen. Sie können eine neue Einladung anfordern, die an Ihre E-Mail gesendet wird."diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.poindex 9e97bb1ee4..56bef30c3c 100644--- a/packages/locale/locales/en/erp.po+++ b/packages/locale/locales/en/erp.po@@ -12056,6 +12056,9 @@ msgstr "Issued Date"msgid "Issues"msgstr "Issues"+msgid "It is coming soon. Contact Carbon to have it set up for your company."+msgstr "It is coming soon. Contact Carbon to have it set up for your company."+msgid "It will stop running until you publish a version again. Nothing is deleted."msgstr "It will stop running until you publish a version again. Nothing is deleted."@@ -23859,6 +23862,9 @@ msgstr "This information will be visible to all users, so be careful what you shmsgid "this inspection plan"msgstr "this inspection plan"+msgid "This integration isn't available yet"+msgstr "This integration isn't available yet"+#. placeholder {0}: company?.name ?? "Carbon"msgid "This invitation to join {0} has expired. You can request a new invite to be sent to your email."msgstr "This invitation to join {0} has expired. You can request a new invite to be sent to your email."diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.poindex 4a4384e0a3..e4c100f07f 100644--- a/packages/locale/locales/es/erp.po+++ b/packages/locale/locales/es/erp.po@@ -12056,6 +12056,9 @@ msgstr "Fecha de Emisión"msgid "Issues"msgstr "Problemas"+msgid "It is coming soon. Contact Carbon to have it set up for your company."+msgstr ""+msgid "It will stop running until you publish a version again. Nothing is deleted."msgstr "Se detendrá hasta que publique una Versión nuevamente. Nada se elimina."@@ -23859,6 +23862,9 @@ msgstr "Esta información será visible para todos los usuarios, así que ten cumsgid "this inspection plan"msgstr "este plan de inspección"+msgid "This integration isn't available yet"+msgstr ""+#. placeholder {0}: company?.name ?? "Carbon"msgid "This invitation to join {0} has expired. You can request a new invite to be sent to your email."msgstr "Esta invitación para unirse a {0} ha vencido. Puedes solicitar que se envíe una nueva invitación a tu correo electrónico."diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.poindex d7227a3646..688c5e6ae2 100644--- a/packages/locale/locales/fr/erp.po+++ b/packages/locale/locales/fr/erp.po@@ -12056,6 +12056,9 @@ msgstr "Date d'émission"msgid "Issues"msgstr "Problèmes"+msgid "It is coming soon. Contact Carbon to have it set up for your company."+msgstr ""+msgid "It will stop running until you publish a version again. Nothing is deleted."msgstr "Elle s'arrêtera d'être exécutée jusqu'à ce que vous publiiez une nouvelle version. Rien n'est supprimé."@@ -23859,6 +23862,9 @@ msgstr "Ces informations seront visibles à tous les utilisateurs, soyez prudentmsgid "this inspection plan"msgstr "ce plan de contrôle"+msgid "This integration isn't available yet"+msgstr ""+#. placeholder {0}: company?.name ?? "Carbon"msgid "This invitation to join {0} has expired. You can request a new invite to be sent to your email."msgstr "Cette invitation pour rejoindre {0} a expiré. Vous pouvez demander une nouvelle invitation à envoyer à votre e-mail."diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.poindex f5eba58477..fa2abd9542 100644--- a/packages/locale/locales/hi/erp.po+++ b/packages/locale/locales/hi/erp.po@@ -12056,6 +12056,9 @@ msgstr "जारी तारीख"msgid "Issues"msgstr "समस्याएं"+msgid "It is coming soon. Contact Carbon to have it set up for your company."+msgstr ""+msgid "It will stop running until you publish a version again. Nothing is deleted."msgstr "यह तब तक चलना बंद कर देगा जब तक आप फिर से एक संस्करण प्रकाशित नहीं करते। कुछ भी हटाया नहीं गया है।"@@ -23859,6 +23862,9 @@ msgstr "यह जानकारी सभी उपयोगकर्ताओmsgid "this inspection plan"msgstr "इस निरीक्षण योजना"+msgid "This integration isn't available yet"+msgstr ""+#. placeholder {0}: company?.name ?? "Carbon"msgid "This invitation to join {0} has expired. You can request a new invite to be sent to your email."msgstr "यह आमंत्रण {0} में शामिल होने के लिए समाप्त हो गया है। आप अपने ईमेल पर भेजने के लिए नया आमंत्रण का अनुरोध कर सकते हैं।"diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.poindex 77e806e34e..ff11db432b 100644--- a/packages/locale/locales/it/erp.po+++ b/packages/locale/locales/it/erp.po@@ -12056,6 +12056,9 @@ msgstr "Data di Emissione"msgid "Issues"msgstr "Problemi"+msgid "It is coming soon. Contact Carbon to have it set up for your company."+msgstr ""+msgid "It will stop running until you publish a version again. Nothing is deleted."msgstr "Si interromperà fino a quando non pubblichi di nuovo una versione. Nulla viene eliminato."@@ -23859,6 +23862,9 @@ msgstr "Queste informazioni saranno visibili a tutti gli utenti, quindi fai attemsgid "this inspection plan"msgstr "questo piano di controllo"+msgid "This integration isn't available yet"+msgstr ""+#. placeholder {0}: company?.name ?? "Carbon"msgid "This invitation to join {0} has expired. You can request a new invite to be sent to your email."msgstr "Questo invito per unirti a {0} è scaduto. Puoi richiedere un nuovo invito da inviare alla tua email."diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.poindex c0b64b99dd..01b8f78c6d 100644--- a/packages/locale/locales/ja/erp.po+++ b/packages/locale/locales/ja/erp.po@@ -12056,6 +12056,9 @@ msgstr "発行日"msgid "Issues"msgstr "問題"+msgid "It is coming soon. Contact Carbon to have it set up for your company."+msgstr ""+msgid "It will stop running until you publish a version again. Nothing is deleted."msgstr "バージョンを再度公開するまで実行は停止します。削除されるものはありません。"@@ -23859,6 +23862,9 @@ msgstr "この情報はすべてのユーザーに表示されるため、共有msgid "this inspection plan"msgstr "この検査計画"+msgid "This integration isn't available yet"+msgstr ""+#. placeholder {0}: company?.name ?? "Carbon"msgid "This invitation to join {0} has expired. You can request a new invite to be sent to your email."msgstr "この{0}への参加への招待は期限切れです。新しい招待をメールで送信されるようにリクエストできます。"diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.poindex d14369daac..8f1730f175 100644--- a/packages/locale/locales/ko/erp.po+++ b/packages/locale/locales/ko/erp.po@@ -12056,6 +12056,9 @@ msgstr "출고일"msgid "Issues"msgstr "이슈"+msgid "It is coming soon. Contact Carbon to have it set up for your company."+msgstr ""+msgid "It will stop running until you publish a version again. Nothing is deleted."msgstr "다시 버전을 게시할 때까지 실행이 중지됩니다. 삭제된 내용은 없습니다."@@ -23859,6 +23862,9 @@ msgstr "이 정보는 모든 사용자에게 표시되므로 공유할 내용을msgid "this inspection plan"msgstr "이 검사 계획"+msgid "This integration isn't available yet"+msgstr ""+#. placeholder {0}: company?.name ?? "Carbon"msgid "This invitation to join {0} has expired. You can request a new invite to be sent to your email."msgstr "이 {0}에 가입하라는 초대가 만료되었습니다. 새 초대를 이메일로 보내달라고 요청할 수 있습니다."diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.poindex e32806f7ef..5a86ce6295 100644--- a/packages/locale/locales/pl/erp.po+++ b/packages/locale/locales/pl/erp.po@@ -12056,6 +12056,9 @@ msgstr "Data wystawienia"msgid "Issues"msgstr "Problemy"+msgid "It is coming soon. Contact Carbon to have it set up for your company."+msgstr ""+msgid "It will stop running until you publish a version again. Nothing is deleted."msgstr "To przestanie działać, dopóki nie opublikujesz wersji ponownie. Nic nie jest usunięte."@@ -23859,6 +23862,9 @@ msgstr "Te informacje będą widoczne dla wszystkich użytkowników, więc uważmsgid "this inspection plan"msgstr "ten plan kontroli"+msgid "This integration isn't available yet"+msgstr ""+#. placeholder {0}: company?.name ?? "Carbon"msgid "This invitation to join {0} has expired. You can request a new invite to be sent to your email."msgstr "To zaproszenie do dołączenia do {0} wygasło. Możesz poprosić o wysłanie nowego zaproszenia na Twoją wiadomość e-mail."diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.poindex 935faf76ad..0fca8edf6d 100644--- a/packages/locale/locales/pt/erp.po+++ b/packages/locale/locales/pt/erp.po@@ -12056,6 +12056,9 @@ msgstr "Data de Emissão"msgid "Issues"msgstr "Problemas"+msgid "It is coming soon. Contact Carbon to have it set up for your company."+msgstr ""+msgid "It will stop running until you publish a version again. Nothing is deleted."msgstr "Ele parará de ser executado até que você publique uma versão novamente. Nada é excluído."@@ -23859,6 +23862,9 @@ msgstr "Estas informações serão visíveis para todos os usuários, portanto,msgid "this inspection plan"msgstr "este plano de inspeção"+msgid "This integration isn't available yet"+msgstr ""+#. placeholder {0}: company?.name ?? "Carbon"msgid "This invitation to join {0} has expired. You can request a new invite to be sent to your email."msgstr "Este convite para se juntar a {0} está vencido. Você pode solicitar um novo convite para ser enviado para seu email."diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.poindex 9a41b231f2..ee50814b51 100644--- a/packages/locale/locales/ru/erp.po+++ b/packages/locale/locales/ru/erp.po@@ -12056,6 +12056,9 @@ msgstr "Дата выпуска"msgid "Issues"msgstr "Проблемы"+msgid "It is coming soon. Contact Carbon to have it set up for your company."+msgstr ""+msgid "It will stop running until you publish a version again. Nothing is deleted."msgstr "Он перестанет работать, пока вы не опубликуете версию снова. Ничего не удаляется."@@ -23859,6 +23862,9 @@ msgstr "Эта информация будет видна всем пользоmsgid "this inspection plan"msgstr "этот план контроля"+msgid "This integration isn't available yet"+msgstr ""+#. placeholder {0}: company?.name ?? "Carbon"msgid "This invitation to join {0} has expired. You can request a new invite to be sent to your email."msgstr "Приглашение присоединиться к {0} истекло. Вы можете запросить отправку нового приглашения на вашу электронную почту."diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.poindex 8461494533..778cca2727 100644--- a/packages/locale/locales/tr/erp.po+++ b/packages/locale/locales/tr/erp.po@@ -12056,6 +12056,9 @@ msgstr "Düzenlenme Tarihi"msgid "Issues"msgstr "Sorunlar"+msgid "It is coming soon. Contact Carbon to have it set up for your company."+msgstr ""+msgid "It will stop running until you publish a version again. Nothing is deleted."msgstr "Yeniden bir sürüm yayınlayana kadar çalışmayı durdurur. Hiçbir şey silinmez."@@ -23859,6 +23862,9 @@ msgstr "Bu bilgi tüm kullanıcılara görünür olacak, bu nedenle paylaştığmsgid "this inspection plan"msgstr "bu kontrol planı"+msgid "This integration isn't available yet"+msgstr ""+#. placeholder {0}: company?.name ?? "Carbon"msgid "This invitation to join {0} has expired. You can request a new invite to be sent to your email."msgstr "{0} grubuna katılma davetinizin süresi doldu. Yeni bir davet talebinde bulunabilirsiniz ve bu e-postanıza gönderilir."diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.poindex ccb2010425..1106c8dc9a 100644--- a/packages/locale/locales/zh/erp.po+++ b/packages/locale/locales/zh/erp.po@@ -12056,6 +12056,9 @@ msgstr "签发日期"msgid "Issues"msgstr "问题"+msgid "It is coming soon. Contact Carbon to have it set up for your company."+msgstr ""+msgid "It will stop running until you publish a version again. Nothing is deleted."msgstr "它将停止运行,直到您再次发布版本。不会删除任何内容。"@@ -23859,6 +23862,9 @@ msgstr "此信息将对所有用户可见,请谨慎分享。"msgid "this inspection plan"msgstr "这个检验计划"+msgid "This integration isn't available yet"+msgstr ""+#. placeholder {0}: company?.name ?? "Carbon"msgid "This invitation to join {0} has expired. You can request a new invite to be sent to your email."msgstr "加入 {0} 的邀请已过期。您可以请求将新邀请发送到您的电子邮件。"