Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/calm-maps-work.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
---
'@clerk/localizations': minor
'@clerk/clerk-js': minor
'@clerk/shared': minor
'@clerk/ui': minor
---

Surface organization creation defaults with prefilled form fields and advisory warnings
4 changes: 2 additions & 2 deletions packages/clerk-js/bundlewatch.config.json
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
{
"files": [
{ "path": "./dist/clerk.js", "maxSize": "538KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "63KB" },
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "63KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "66KB" },
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "66KB" },
{ "path": "./dist/clerk.legacy.browser.js", "maxSize": "105KB" },
{ "path": "./dist/clerk.no-rhc.js", "maxSize": "305KB" },
{ "path": "./dist/clerk.headless*.js", "maxSize": "65KB" },
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
import type {
OrganizationCreationAdvisorySeverity,
OrganizationCreationAdvisoryType,
OrganizationCreationDefaultsJSON,
OrganizationCreationDefaultsJSONSnapshot,
OrganizationCreationDefaultsResource,
} from '@clerk/shared/types';

import { BaseResource } from './internal';

export class OrganizationCreationDefaults extends BaseResource implements OrganizationCreationDefaultsResource {
advisory: {
code: OrganizationCreationAdvisoryType;
severity: OrganizationCreationAdvisorySeverity;
meta: Record<string, string>;
} | null = null;
form: {
name: string;
slug: string;
logo: string | null;
blurHash: string | null;
} = {
name: '',
slug: '',
logo: null,
blurHash: null,
};

public constructor(data: OrganizationCreationDefaultsJSON | OrganizationCreationDefaultsJSONSnapshot | null = null) {
super();
this.fromJSON(data);
}

protected fromJSON(data: OrganizationCreationDefaultsJSON | OrganizationCreationDefaultsJSONSnapshot | null): this {
if (!data) {
return this;
}

if (data.advisory) {
this.advisory = this.withDefault(data.advisory, this.advisory ?? null);
}

if (data.form) {
this.form.name = this.withDefault(data.form.name, this.form.name);
this.form.slug = this.withDefault(data.form.slug, this.form.slug);
this.form.logo = this.withDefault(data.form.logo, this.form.logo);
this.form.blurHash = this.withDefault(data.form.blur_hash, this.form.blurHash);
}

return this;
}

static async retrieve(): Promise<OrganizationCreationDefaultsResource> {
return await BaseResource._fetch({
path: '/me/organization_creation_defaults',
method: 'GET',
}).then(res => {
const data = res?.response as unknown as OrganizationCreationDefaultsJSON;
return new OrganizationCreationDefaults(data);
});
}
Comment on lines +53 to +61

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Unsafe type casting bypasses validation and could cause runtime errors.

Line 55 uses as unknown as OrganizationCreationDefaultsJSON to force-cast the API response without any validation. If the API returns malformed data or the response structure changes, this will bypass type safety and could cause runtime errors when the resource properties are accessed.

🔎 Proposed fix with runtime validation
 static async retrieve(): Promise<OrganizationCreationDefaultsResource> {
return await BaseResource._fetch({
path: '/me/organization_creation_defaults',
method: 'GET',
}).then(res => {
- const data = res?.response as unknown as OrganizationCreationDefaultsJSON;+ const data = res?.response;+ // Basic runtime validation+ if (!data || typeof data !== 'object') {+ throw new Error('Invalid organization creation defaults response');+ }
return new OrganizationCreationDefaults(data);
});
}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts around
lines 50 to 58, the code force-casts the API response using "as unknown as
OrganizationCreationDefaultsJSON" which bypasses runtime validation; replace the
cast with a proper runtime check: extract res.response, validate required fields
and types (either with a small type-guard function or an existing JSON/schema
validator), throw or return a clear error if validation fails, and only then
construct and return new OrganizationCreationDefaults(validatedData); do not use
"as unknown as" to silence type checking.


public __internal_toSnapshot(): OrganizationCreationDefaultsJSONSnapshot {
return {
advisory: this.advisory
? {
code: this.advisory.code,
meta: this.advisory.meta,
severity: this.advisory.severity,
}
: null,
form: {
name: this.form.name,
slug: this.form.slug,
logo: this.form.logo,
blur_hash: this.form.blurHash,
},
} as unknown as OrganizationCreationDefaultsJSONSnapshot;
}
Comment thread
LauraBeatris marked this conversation as resolved.
}
12 changes: 12 additions & 0 deletions packages/clerk-js/src/core/resources/OrganizationSettings.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,6 +23,11 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe
} = {
disabled: false,
};
organizationCreationDefaults: {
enabled: boolean;
} = {
enabled: false,
};
enabled: boolean = false;
maxAllowedMemberships: number = 1;
forceOrganizationSelection!: boolean;
Expand DownExpand Up@@ -51,6 +56,13 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe
this.slug.disabled = this.withDefault(data.slug.disabled, this.slug.disabled);
}

if (data.organization_creation_defaults) {
this.organizationCreationDefaults.enabled = this.withDefault(
data.organization_creation_defaults.enabled,
this.organizationCreationDefaults.enabled,
);
}

this.enabled = this.withDefault(data.enabled, this.enabled);
this.maxAllowedMemberships = this.withDefault(data.max_allowed_memberships, this.maxAllowedMemberships);
this.forceOrganizationSelection = this.withDefault(
Expand Down
3 changes: 3 additions & 0 deletions packages/clerk-js/src/core/resources/User.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,6 +53,7 @@ import {
UserOrganizationInvitation,
Web3Wallet,
} from './internal';
import { OrganizationCreationDefaults } from './OrganizationCreationDefaults';

export class User extends BaseResource implements UserResource {
pathRoot = '/me';
Expand DownExpand Up@@ -275,6 +276,8 @@ export class User extends BaseResource implements UserResource {
getOrganizationMemberships: GetOrganizationMemberships = retrieveMembership =>
OrganizationMembership.retrieve(retrieveMembership);

getOrganizationCreationDefaults = () => OrganizationCreationDefaults.retrieve();

leaveOrganization = async (organizationId: string): Promise<DeletedObjectResource> => {
const json = (
await BaseResource._fetch<DeletedObjectJSON>({
Expand Down
4 changes: 4 additions & 0 deletions packages/clerk-js/src/test/fixture-helpers.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -344,6 +344,9 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON)
const withOrganizationSlug = (enabled = false) => {
os.slug.disabled = !enabled;
};
const withOrganizationCreationDefaults = (enabled = false) => {
os.organization_creation_defaults.enabled = enabled;
};

const withOrganizationDomains = (modes?: OrganizationEnrollmentMode[], defaultRole?: string) => {
os.domains.enabled = true;
Expand All@@ -356,6 +359,7 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON)
withOrganizationDomains,
withForceOrganizationSelection,
withOrganizationSlug,
withOrganizationCreationDefaults,
};
};

Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/ar-SA.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -882,6 +882,10 @@ export const arSA: LocalizationResource = {
actionLink: 'تسجيل الخروج',
actionText: 'تم تسجيل الدخول كـ {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'توجد منظمة بالفعل لاسم الشركة المكتشف ({{organizationName}}) و {{organizationDomain}}. انضم عن طريق الدعوة.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/be-BY.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,10 @@ export const beBY: LocalizationResource = {
actionLink: 'Выйсці',
actionText: 'Увайшлі як {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Арганізацыя ўжо існуе для выяўленай назвы кампаніі ({{organizationName}}) і {{organizationDomain}}. Далучайцеся па запрашэнні.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/bg-BG.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -886,6 +886,10 @@ export const bgBG: LocalizationResource = {
actionLink: 'Изход',
actionText: 'Влязъл като {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Организация вече съществува за откритото име на компанията ({{organizationName}}) и {{organizationDomain}}. Присъединете се чрез покана.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/bn-IN.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,10 @@ export const bnIN: LocalizationResource = {
actionLink: 'সাইন আউট',
actionText: '{{identifier}} হিসাবে সাইন ইন করা হয়েছে',
},
alerts: {
organizationAlreadyExists:
'শনাক্ত করা কোম্পানির নাম ({{organizationName}}) এবং {{organizationDomain}}-এর জন্য একটি সংস্থা ইতিমধ্যেই বিদ্যমান। আমন্ত্রণের মাধ্যমে যোগ দিন।',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/ca-ES.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -885,6 +885,10 @@ export const caES: LocalizationResource = {
actionLink: 'Tancar sessió',
actionText: 'Sessió iniciada com a {{identifier}}',
},
alerts: {
organizationAlreadyExists:
"Ja existeix una organització per al nom d'empresa detectat ({{organizationName}}) i {{organizationDomain}}. Uneix-te per invitació.",
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/cs-CZ.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -896,6 +896,10 @@ export const csCZ: LocalizationResource = {
actionLink: 'Odhlásit se',
actionText: 'Přihlášen jako {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organizace již existuje pro detekovaný název společnosti ({{organizationName}}) a {{organizationDomain}}. Připojte se prostřednictvím pozvánky.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/da-DK.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -883,6 +883,10 @@ export const daDK: LocalizationResource = {
actionLink: 'Log ud',
actionText: 'Logget ind som {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Der findes allerede en organisation for det registrerede firmanavn ({{organizationName}}) og {{organizationDomain}}. Tilmeld dig via invitation.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/de-DE.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -901,6 +901,10 @@ export const deDE: LocalizationResource = {
actionLink: 'Abmelden',
actionText: 'Angemeldet als {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Für den erkannten Firmennamen ({{organizationName}}) und {{organizationDomain}} existiert bereits eine Organisation. Treten Sie per Einladung bei.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/el-GR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -888,6 +888,10 @@ export const elGR: LocalizationResource = {
actionLink: 'Αποσύνδεση',
actionText: 'Συνδεδεμένος ως {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Υπάρχει ήδη οργανισμός για το ανιχνευμένο όνομα εταιρείας ({{organizationName}}) και {{organizationDomain}}. Εγγραφείτε μέσω πρόσκλησης.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/en-GB.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const enGB: LocalizationResource = {
actionLink: 'Sign out',
actionText: 'Signed in as {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'An organisation already exists for the detected company name ({{organizationName}}) and {{organizationDomain}}. Join by invitation.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/en-US.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -884,6 +884,10 @@ export const enUS: LocalizationResource = {
actionLink: 'Sign out',
actionText: 'Signed in as {{identifier}}',
},
alerts: {
organizationAlreadyExists:
Comment thread
LauraBeatris marked this conversation as resolved.
'An organization already exists for the detected company name ({{organizationName}}) and {{organizationDomain}}. Join by invitation.',
},
},
taskResetPassword: {
formButtonPrimary: 'Reset Password',
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-CR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -893,6 +893,10 @@ export const esCR: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Conectado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-ES.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const esES: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Sesión iniciada como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-MX.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -894,6 +894,10 @@ export const esMX: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Registrado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-UY.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -893,6 +893,10 @@ export const esUY: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Logueado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fa-IR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -897,6 +897,10 @@ export const faIR: LocalizationResource = {
actionLink: 'خروج از همه حساب‌ها',
actionText: 'می‌خواهید خارج شوید؟',
},
alerts: {
organizationAlreadyExists:
'سازمانی برای نام شرکت شناسایی شده ({{organizationName}}) و {{organizationDomain}} از قبل وجود دارد. از طریق دعوتنامه بپیوندید.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fi-FI.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -886,6 +886,10 @@ export const fiFI: LocalizationResource = {
actionLink: 'Kirjaudu ulos',
actionText: 'Kirjautuneena käyttäjänä {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organisaatio on jo olemassa havaitulle yrityksen nimelle ({{organizationName}}) ja {{organizationDomain}}. Liity kutsulla.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fr-FR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -902,6 +902,10 @@ export const frFR: LocalizationResource = {
actionLink: 'Se déconnecter',
actionText: 'Connecté en tant que {{identifier}}',
},
alerts: {
organizationAlreadyExists:
"Une organisation existe déjà pour le nom d'entreprise détecté ({{organizationName}}) et {{organizationDomain}}. Rejoignez par invitation.",
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/he-IL.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -876,6 +876,10 @@ export const heIL: LocalizationResource = {
actionLink: 'התנתק',
actionText: 'מחובר כ-{{identifier}}',
},
alerts: {
organizationAlreadyExists:
'ארגון כבר קיים עבור שם החברה שזוהה ({{organizationName}}) ו-{{organizationDomain}}. הצטרף באמצעות הזמנה.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/hi-IN.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -891,6 +891,10 @@ export const hiIN: LocalizationResource = {
actionLink: 'साइन आउट',
actionText: '{{identifier}} के रूप में साइन इन किया गया',
},
alerts: {
organizationAlreadyExists:
'पता लगाई गई कंपनी के नाम ({{organizationName}}) और {{organizationDomain}} के लिए एक संगठन पहले से मौजूद है। आमंत्रण द्वारा शामिल हों।',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/hr-HR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const hrHR: LocalizationResource = {
actionLink: 'Odjavi se',
actionText: 'Prijavljen kao {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organizacija već postoji za otkriveni naziv tvrtke ({{organizationName}}) i {{organizationDomain}}. Pridružite se putem pozivnice.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/calm-maps-work.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
---
'@clerk/localizations': minor
'@clerk/clerk-js': minor
'@clerk/shared': minor
'@clerk/ui': minor
---

Surface organization creation defaults with prefilled form fields and advisory warnings
4 changes: 2 additions & 2 deletions packages/clerk-js/bundlewatch.config.json
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
{
"files": [
{ "path": "./dist/clerk.js", "maxSize": "538KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "63KB" },
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "63KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "66KB" },
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "66KB" },
{ "path": "./dist/clerk.legacy.browser.js", "maxSize": "105KB" },
{ "path": "./dist/clerk.no-rhc.js", "maxSize": "305KB" },
{ "path": "./dist/clerk.headless*.js", "maxSize": "65KB" },
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
import type {
OrganizationCreationAdvisorySeverity,
OrganizationCreationAdvisoryType,
OrganizationCreationDefaultsJSON,
OrganizationCreationDefaultsJSONSnapshot,
OrganizationCreationDefaultsResource,
} from '@clerk/shared/types';

import { BaseResource } from './internal';

export class OrganizationCreationDefaults extends BaseResource implements OrganizationCreationDefaultsResource {
advisory: {
code: OrganizationCreationAdvisoryType;
severity: OrganizationCreationAdvisorySeverity;
meta: Record<string, string>;
} | null = null;
form: {
name: string;
slug: string;
logo: string | null;
blurHash: string | null;
} = {
name: '',
slug: '',
logo: null,
blurHash: null,
};

public constructor(data: OrganizationCreationDefaultsJSON | OrganizationCreationDefaultsJSONSnapshot | null = null) {
super();
this.fromJSON(data);
}

protected fromJSON(data: OrganizationCreationDefaultsJSON | OrganizationCreationDefaultsJSONSnapshot | null): this {
if (!data) {
return this;
}

if (data.advisory) {
this.advisory = this.withDefault(data.advisory, this.advisory ?? null);
}

if (data.form) {
this.form.name = this.withDefault(data.form.name, this.form.name);
this.form.slug = this.withDefault(data.form.slug, this.form.slug);
this.form.logo = this.withDefault(data.form.logo, this.form.logo);
this.form.blurHash = this.withDefault(data.form.blur_hash, this.form.blurHash);
}

return this;
}

static async retrieve(): Promise<OrganizationCreationDefaultsResource> {
return await BaseResource._fetch({
path: '/me/organization_creation_defaults',
method: 'GET',
}).then(res => {
const data = res?.response as unknown as OrganizationCreationDefaultsJSON;
return new OrganizationCreationDefaults(data);
});
}
Comment on lines +53 to +61

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Unsafe type casting bypasses validation and could cause runtime errors.

Line 55 uses as unknown as OrganizationCreationDefaultsJSON to force-cast the API response without any validation. If the API returns malformed data or the response structure changes, this will bypass type safety and could cause runtime errors when the resource properties are accessed.

🔎 Proposed fix with runtime validation
 static async retrieve(): Promise<OrganizationCreationDefaultsResource> {
return await BaseResource._fetch({
path: '/me/organization_creation_defaults',
method: 'GET',
}).then(res => {
- const data = res?.response as unknown as OrganizationCreationDefaultsJSON;+ const data = res?.response;+ // Basic runtime validation+ if (!data || typeof data !== 'object') {+ throw new Error('Invalid organization creation defaults response');+ }
return new OrganizationCreationDefaults(data);
});
}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts around
lines 50 to 58, the code force-casts the API response using "as unknown as
OrganizationCreationDefaultsJSON" which bypasses runtime validation; replace the
cast with a proper runtime check: extract res.response, validate required fields
and types (either with a small type-guard function or an existing JSON/schema
validator), throw or return a clear error if validation fails, and only then
construct and return new OrganizationCreationDefaults(validatedData); do not use
"as unknown as" to silence type checking.


public __internal_toSnapshot(): OrganizationCreationDefaultsJSONSnapshot {
return {
advisory: this.advisory
? {
code: this.advisory.code,
meta: this.advisory.meta,
severity: this.advisory.severity,
}
: null,
form: {
name: this.form.name,
slug: this.form.slug,
logo: this.form.logo,
blur_hash: this.form.blurHash,
},
} as unknown as OrganizationCreationDefaultsJSONSnapshot;
}
Comment thread
LauraBeatris marked this conversation as resolved.
}
12 changes: 12 additions & 0 deletions packages/clerk-js/src/core/resources/OrganizationSettings.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,6 +23,11 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe
} = {
disabled: false,
};
organizationCreationDefaults: {
enabled: boolean;
} = {
enabled: false,
};
enabled: boolean = false;
maxAllowedMemberships: number = 1;
forceOrganizationSelection!: boolean;
Expand DownExpand Up@@ -51,6 +56,13 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe
this.slug.disabled = this.withDefault(data.slug.disabled, this.slug.disabled);
}

if (data.organization_creation_defaults) {
this.organizationCreationDefaults.enabled = this.withDefault(
data.organization_creation_defaults.enabled,
this.organizationCreationDefaults.enabled,
);
}

this.enabled = this.withDefault(data.enabled, this.enabled);
this.maxAllowedMemberships = this.withDefault(data.max_allowed_memberships, this.maxAllowedMemberships);
this.forceOrganizationSelection = this.withDefault(
Expand Down
3 changes: 3 additions & 0 deletions packages/clerk-js/src/core/resources/User.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,6 +53,7 @@ import {
UserOrganizationInvitation,
Web3Wallet,
} from './internal';
import { OrganizationCreationDefaults } from './OrganizationCreationDefaults';

export class User extends BaseResource implements UserResource {
pathRoot = '/me';
Expand DownExpand Up@@ -275,6 +276,8 @@ export class User extends BaseResource implements UserResource {
getOrganizationMemberships: GetOrganizationMemberships = retrieveMembership =>
OrganizationMembership.retrieve(retrieveMembership);

getOrganizationCreationDefaults = () => OrganizationCreationDefaults.retrieve();

leaveOrganization = async (organizationId: string): Promise<DeletedObjectResource> => {
const json = (
await BaseResource._fetch<DeletedObjectJSON>({
Expand Down
4 changes: 4 additions & 0 deletions packages/clerk-js/src/test/fixture-helpers.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -344,6 +344,9 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON)
const withOrganizationSlug = (enabled = false) => {
os.slug.disabled = !enabled;
};
const withOrganizationCreationDefaults = (enabled = false) => {
os.organization_creation_defaults.enabled = enabled;
};

const withOrganizationDomains = (modes?: OrganizationEnrollmentMode[], defaultRole?: string) => {
os.domains.enabled = true;
Expand All@@ -356,6 +359,7 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON)
withOrganizationDomains,
withForceOrganizationSelection,
withOrganizationSlug,
withOrganizationCreationDefaults,
};
};

Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/ar-SA.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -882,6 +882,10 @@ export const arSA: LocalizationResource = {
actionLink: 'تسجيل الخروج',
actionText: 'تم تسجيل الدخول كـ {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'توجد منظمة بالفعل لاسم الشركة المكتشف ({{organizationName}}) و {{organizationDomain}}. انضم عن طريق الدعوة.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/be-BY.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,10 @@ export const beBY: LocalizationResource = {
actionLink: 'Выйсці',
actionText: 'Увайшлі як {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Арганізацыя ўжо існуе для выяўленай назвы кампаніі ({{organizationName}}) і {{organizationDomain}}. Далучайцеся па запрашэнні.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/bg-BG.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -886,6 +886,10 @@ export const bgBG: LocalizationResource = {
actionLink: 'Изход',
actionText: 'Влязъл като {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Организация вече съществува за откритото име на компанията ({{organizationName}}) и {{organizationDomain}}. Присъединете се чрез покана.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/bn-IN.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,10 @@ export const bnIN: LocalizationResource = {
actionLink: 'সাইন আউট',
actionText: '{{identifier}} হিসাবে সাইন ইন করা হয়েছে',
},
alerts: {
organizationAlreadyExists:
'শনাক্ত করা কোম্পানির নাম ({{organizationName}}) এবং {{organizationDomain}}-এর জন্য একটি সংস্থা ইতিমধ্যেই বিদ্যমান। আমন্ত্রণের মাধ্যমে যোগ দিন।',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/ca-ES.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -885,6 +885,10 @@ export const caES: LocalizationResource = {
actionLink: 'Tancar sessió',
actionText: 'Sessió iniciada com a {{identifier}}',
},
alerts: {
organizationAlreadyExists:
"Ja existeix una organització per al nom d'empresa detectat ({{organizationName}}) i {{organizationDomain}}. Uneix-te per invitació.",
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/cs-CZ.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -896,6 +896,10 @@ export const csCZ: LocalizationResource = {
actionLink: 'Odhlásit se',
actionText: 'Přihlášen jako {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organizace již existuje pro detekovaný název společnosti ({{organizationName}}) a {{organizationDomain}}. Připojte se prostřednictvím pozvánky.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/da-DK.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -883,6 +883,10 @@ export const daDK: LocalizationResource = {
actionLink: 'Log ud',
actionText: 'Logget ind som {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Der findes allerede en organisation for det registrerede firmanavn ({{organizationName}}) og {{organizationDomain}}. Tilmeld dig via invitation.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/de-DE.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -901,6 +901,10 @@ export const deDE: LocalizationResource = {
actionLink: 'Abmelden',
actionText: 'Angemeldet als {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Für den erkannten Firmennamen ({{organizationName}}) und {{organizationDomain}} existiert bereits eine Organisation. Treten Sie per Einladung bei.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/el-GR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -888,6 +888,10 @@ export const elGR: LocalizationResource = {
actionLink: 'Αποσύνδεση',
actionText: 'Συνδεδεμένος ως {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Υπάρχει ήδη οργανισμός για το ανιχνευμένο όνομα εταιρείας ({{organizationName}}) και {{organizationDomain}}. Εγγραφείτε μέσω πρόσκλησης.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/en-GB.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const enGB: LocalizationResource = {
actionLink: 'Sign out',
actionText: 'Signed in as {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'An organisation already exists for the detected company name ({{organizationName}}) and {{organizationDomain}}. Join by invitation.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/en-US.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -884,6 +884,10 @@ export const enUS: LocalizationResource = {
actionLink: 'Sign out',
actionText: 'Signed in as {{identifier}}',
},
alerts: {
organizationAlreadyExists:
Comment thread
LauraBeatris marked this conversation as resolved.
'An organization already exists for the detected company name ({{organizationName}}) and {{organizationDomain}}. Join by invitation.',
},
},
taskResetPassword: {
formButtonPrimary: 'Reset Password',
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-CR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -893,6 +893,10 @@ export const esCR: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Conectado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-ES.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const esES: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Sesión iniciada como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-MX.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -894,6 +894,10 @@ export const esMX: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Registrado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-UY.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -893,6 +893,10 @@ export const esUY: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Logueado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fa-IR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -897,6 +897,10 @@ export const faIR: LocalizationResource = {
actionLink: 'خروج از همه حساب‌ها',
actionText: 'می‌خواهید خارج شوید؟',
},
alerts: {
organizationAlreadyExists:
'سازمانی برای نام شرکت شناسایی شده ({{organizationName}}) و {{organizationDomain}} از قبل وجود دارد. از طریق دعوتنامه بپیوندید.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fi-FI.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -886,6 +886,10 @@ export const fiFI: LocalizationResource = {
actionLink: 'Kirjaudu ulos',
actionText: 'Kirjautuneena käyttäjänä {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organisaatio on jo olemassa havaitulle yrityksen nimelle ({{organizationName}}) ja {{organizationDomain}}. Liity kutsulla.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fr-FR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -902,6 +902,10 @@ export const frFR: LocalizationResource = {
actionLink: 'Se déconnecter',
actionText: 'Connecté en tant que {{identifier}}',
},
alerts: {
organizationAlreadyExists:
"Une organisation existe déjà pour le nom d'entreprise détecté ({{organizationName}}) et {{organizationDomain}}. Rejoignez par invitation.",
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/he-IL.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -876,6 +876,10 @@ export const heIL: LocalizationResource = {
actionLink: 'התנתק',
actionText: 'מחובר כ-{{identifier}}',
},
alerts: {
organizationAlreadyExists:
'ארגון כבר קיים עבור שם החברה שזוהה ({{organizationName}}) ו-{{organizationDomain}}. הצטרף באמצעות הזמנה.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/hi-IN.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -891,6 +891,10 @@ export const hiIN: LocalizationResource = {
actionLink: 'साइन आउट',
actionText: '{{identifier}} के रूप में साइन इन किया गया',
},
alerts: {
organizationAlreadyExists:
'पता लगाई गई कंपनी के नाम ({{organizationName}}) और {{organizationDomain}} के लिए एक संगठन पहले से मौजूद है। आमंत्रण द्वारा शामिल हों।',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/hr-HR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const hrHR: LocalizationResource = {
actionLink: 'Odjavi se',
actionText: 'Prijavljen kao {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organizacija već postoji za otkriveni naziv tvrtke ({{organizationName}}) i {{organizationDomain}}. Pridružite se putem pozivnice.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/calm-maps-work.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
---
'@clerk/localizations': minor
'@clerk/clerk-js': minor
'@clerk/shared': minor
'@clerk/ui': minor
---

Surface organization creation defaults with prefilled form fields and advisory warnings
4 changes: 2 additions & 2 deletions packages/clerk-js/bundlewatch.config.json
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
{
"files": [
{ "path": "./dist/clerk.js", "maxSize": "538KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "63KB" },
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "63KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "66KB" },
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "66KB" },
{ "path": "./dist/clerk.legacy.browser.js", "maxSize": "105KB" },
{ "path": "./dist/clerk.no-rhc.js", "maxSize": "305KB" },
{ "path": "./dist/clerk.headless*.js", "maxSize": "65KB" },
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
import type {
OrganizationCreationAdvisorySeverity,
OrganizationCreationAdvisoryType,
OrganizationCreationDefaultsJSON,
OrganizationCreationDefaultsJSONSnapshot,
OrganizationCreationDefaultsResource,
} from '@clerk/shared/types';

import { BaseResource } from './internal';

export class OrganizationCreationDefaults extends BaseResource implements OrganizationCreationDefaultsResource {
advisory: {
code: OrganizationCreationAdvisoryType;
severity: OrganizationCreationAdvisorySeverity;
meta: Record<string, string>;
} | null = null;
form: {
name: string;
slug: string;
logo: string | null;
blurHash: string | null;
} = {
name: '',
slug: '',
logo: null,
blurHash: null,
};

public constructor(data: OrganizationCreationDefaultsJSON | OrganizationCreationDefaultsJSONSnapshot | null = null) {
super();
this.fromJSON(data);
}

protected fromJSON(data: OrganizationCreationDefaultsJSON | OrganizationCreationDefaultsJSONSnapshot | null): this {
if (!data) {
return this;
}

if (data.advisory) {
this.advisory = this.withDefault(data.advisory, this.advisory ?? null);
}

if (data.form) {
this.form.name = this.withDefault(data.form.name, this.form.name);
this.form.slug = this.withDefault(data.form.slug, this.form.slug);
this.form.logo = this.withDefault(data.form.logo, this.form.logo);
this.form.blurHash = this.withDefault(data.form.blur_hash, this.form.blurHash);
}

return this;
}

static async retrieve(): Promise<OrganizationCreationDefaultsResource> {
return await BaseResource._fetch({
path: '/me/organization_creation_defaults',
method: 'GET',
}).then(res => {
const data = res?.response as unknown as OrganizationCreationDefaultsJSON;
return new OrganizationCreationDefaults(data);
});
}
Comment on lines +53 to +61

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Unsafe type casting bypasses validation and could cause runtime errors.

Line 55 uses as unknown as OrganizationCreationDefaultsJSON to force-cast the API response without any validation. If the API returns malformed data or the response structure changes, this will bypass type safety and could cause runtime errors when the resource properties are accessed.

🔎 Proposed fix with runtime validation
 static async retrieve(): Promise<OrganizationCreationDefaultsResource> {
return await BaseResource._fetch({
path: '/me/organization_creation_defaults',
method: 'GET',
}).then(res => {
- const data = res?.response as unknown as OrganizationCreationDefaultsJSON;+ const data = res?.response;+ // Basic runtime validation+ if (!data || typeof data !== 'object') {+ throw new Error('Invalid organization creation defaults response');+ }
return new OrganizationCreationDefaults(data);
});
}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts around
lines 50 to 58, the code force-casts the API response using "as unknown as
OrganizationCreationDefaultsJSON" which bypasses runtime validation; replace the
cast with a proper runtime check: extract res.response, validate required fields
and types (either with a small type-guard function or an existing JSON/schema
validator), throw or return a clear error if validation fails, and only then
construct and return new OrganizationCreationDefaults(validatedData); do not use
"as unknown as" to silence type checking.


public __internal_toSnapshot(): OrganizationCreationDefaultsJSONSnapshot {
return {
advisory: this.advisory
? {
code: this.advisory.code,
meta: this.advisory.meta,
severity: this.advisory.severity,
}
: null,
form: {
name: this.form.name,
slug: this.form.slug,
logo: this.form.logo,
blur_hash: this.form.blurHash,
},
} as unknown as OrganizationCreationDefaultsJSONSnapshot;
}
Comment thread
LauraBeatris marked this conversation as resolved.
}
12 changes: 12 additions & 0 deletions packages/clerk-js/src/core/resources/OrganizationSettings.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,6 +23,11 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe
} = {
disabled: false,
};
organizationCreationDefaults: {
enabled: boolean;
} = {
enabled: false,
};
enabled: boolean = false;
maxAllowedMemberships: number = 1;
forceOrganizationSelection!: boolean;
Expand DownExpand Up@@ -51,6 +56,13 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe
this.slug.disabled = this.withDefault(data.slug.disabled, this.slug.disabled);
}

if (data.organization_creation_defaults) {
this.organizationCreationDefaults.enabled = this.withDefault(
data.organization_creation_defaults.enabled,
this.organizationCreationDefaults.enabled,
);
}

this.enabled = this.withDefault(data.enabled, this.enabled);
this.maxAllowedMemberships = this.withDefault(data.max_allowed_memberships, this.maxAllowedMemberships);
this.forceOrganizationSelection = this.withDefault(
Expand Down
3 changes: 3 additions & 0 deletions packages/clerk-js/src/core/resources/User.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,6 +53,7 @@ import {
UserOrganizationInvitation,
Web3Wallet,
} from './internal';
import { OrganizationCreationDefaults } from './OrganizationCreationDefaults';

export class User extends BaseResource implements UserResource {
pathRoot = '/me';
Expand DownExpand Up@@ -275,6 +276,8 @@ export class User extends BaseResource implements UserResource {
getOrganizationMemberships: GetOrganizationMemberships = retrieveMembership =>
OrganizationMembership.retrieve(retrieveMembership);

getOrganizationCreationDefaults = () => OrganizationCreationDefaults.retrieve();

leaveOrganization = async (organizationId: string): Promise<DeletedObjectResource> => {
const json = (
await BaseResource._fetch<DeletedObjectJSON>({
Expand Down
4 changes: 4 additions & 0 deletions packages/clerk-js/src/test/fixture-helpers.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -344,6 +344,9 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON)
const withOrganizationSlug = (enabled = false) => {
os.slug.disabled = !enabled;
};
const withOrganizationCreationDefaults = (enabled = false) => {
os.organization_creation_defaults.enabled = enabled;
};

const withOrganizationDomains = (modes?: OrganizationEnrollmentMode[], defaultRole?: string) => {
os.domains.enabled = true;
Expand All@@ -356,6 +359,7 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON)
withOrganizationDomains,
withForceOrganizationSelection,
withOrganizationSlug,
withOrganizationCreationDefaults,
};
};

Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/ar-SA.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -882,6 +882,10 @@ export const arSA: LocalizationResource = {
actionLink: 'تسجيل الخروج',
actionText: 'تم تسجيل الدخول كـ {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'توجد منظمة بالفعل لاسم الشركة المكتشف ({{organizationName}}) و {{organizationDomain}}. انضم عن طريق الدعوة.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/be-BY.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,10 @@ export const beBY: LocalizationResource = {
actionLink: 'Выйсці',
actionText: 'Увайшлі як {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Арганізацыя ўжо існуе для выяўленай назвы кампаніі ({{organizationName}}) і {{organizationDomain}}. Далучайцеся па запрашэнні.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/bg-BG.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -886,6 +886,10 @@ export const bgBG: LocalizationResource = {
actionLink: 'Изход',
actionText: 'Влязъл като {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Организация вече съществува за откритото име на компанията ({{organizationName}}) и {{organizationDomain}}. Присъединете се чрез покана.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/bn-IN.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,10 @@ export const bnIN: LocalizationResource = {
actionLink: 'সাইন আউট',
actionText: '{{identifier}} হিসাবে সাইন ইন করা হয়েছে',
},
alerts: {
organizationAlreadyExists:
'শনাক্ত করা কোম্পানির নাম ({{organizationName}}) এবং {{organizationDomain}}-এর জন্য একটি সংস্থা ইতিমধ্যেই বিদ্যমান। আমন্ত্রণের মাধ্যমে যোগ দিন।',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/ca-ES.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -885,6 +885,10 @@ export const caES: LocalizationResource = {
actionLink: 'Tancar sessió',
actionText: 'Sessió iniciada com a {{identifier}}',
},
alerts: {
organizationAlreadyExists:
"Ja existeix una organització per al nom d'empresa detectat ({{organizationName}}) i {{organizationDomain}}. Uneix-te per invitació.",
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/cs-CZ.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -896,6 +896,10 @@ export const csCZ: LocalizationResource = {
actionLink: 'Odhlásit se',
actionText: 'Přihlášen jako {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organizace již existuje pro detekovaný název společnosti ({{organizationName}}) a {{organizationDomain}}. Připojte se prostřednictvím pozvánky.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/da-DK.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -883,6 +883,10 @@ export const daDK: LocalizationResource = {
actionLink: 'Log ud',
actionText: 'Logget ind som {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Der findes allerede en organisation for det registrerede firmanavn ({{organizationName}}) og {{organizationDomain}}. Tilmeld dig via invitation.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/de-DE.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -901,6 +901,10 @@ export const deDE: LocalizationResource = {
actionLink: 'Abmelden',
actionText: 'Angemeldet als {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Für den erkannten Firmennamen ({{organizationName}}) und {{organizationDomain}} existiert bereits eine Organisation. Treten Sie per Einladung bei.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/el-GR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -888,6 +888,10 @@ export const elGR: LocalizationResource = {
actionLink: 'Αποσύνδεση',
actionText: 'Συνδεδεμένος ως {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Υπάρχει ήδη οργανισμός για το ανιχνευμένο όνομα εταιρείας ({{organizationName}}) και {{organizationDomain}}. Εγγραφείτε μέσω πρόσκλησης.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/en-GB.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const enGB: LocalizationResource = {
actionLink: 'Sign out',
actionText: 'Signed in as {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'An organisation already exists for the detected company name ({{organizationName}}) and {{organizationDomain}}. Join by invitation.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/en-US.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -884,6 +884,10 @@ export const enUS: LocalizationResource = {
actionLink: 'Sign out',
actionText: 'Signed in as {{identifier}}',
},
alerts: {
organizationAlreadyExists:
Comment thread
LauraBeatris marked this conversation as resolved.
'An organization already exists for the detected company name ({{organizationName}}) and {{organizationDomain}}. Join by invitation.',
},
},
taskResetPassword: {
formButtonPrimary: 'Reset Password',
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-CR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -893,6 +893,10 @@ export const esCR: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Conectado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-ES.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const esES: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Sesión iniciada como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-MX.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -894,6 +894,10 @@ export const esMX: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Registrado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-UY.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -893,6 +893,10 @@ export const esUY: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Logueado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fa-IR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -897,6 +897,10 @@ export const faIR: LocalizationResource = {
actionLink: 'خروج از همه حساب‌ها',
actionText: 'می‌خواهید خارج شوید؟',
},
alerts: {
organizationAlreadyExists:
'سازمانی برای نام شرکت شناسایی شده ({{organizationName}}) و {{organizationDomain}} از قبل وجود دارد. از طریق دعوتنامه بپیوندید.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fi-FI.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -886,6 +886,10 @@ export const fiFI: LocalizationResource = {
actionLink: 'Kirjaudu ulos',
actionText: 'Kirjautuneena käyttäjänä {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organisaatio on jo olemassa havaitulle yrityksen nimelle ({{organizationName}}) ja {{organizationDomain}}. Liity kutsulla.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fr-FR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -902,6 +902,10 @@ export const frFR: LocalizationResource = {
actionLink: 'Se déconnecter',
actionText: 'Connecté en tant que {{identifier}}',
},
alerts: {
organizationAlreadyExists:
"Une organisation existe déjà pour le nom d'entreprise détecté ({{organizationName}}) et {{organizationDomain}}. Rejoignez par invitation.",
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/he-IL.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -876,6 +876,10 @@ export const heIL: LocalizationResource = {
actionLink: 'התנתק',
actionText: 'מחובר כ-{{identifier}}',
},
alerts: {
organizationAlreadyExists:
'ארגון כבר קיים עבור שם החברה שזוהה ({{organizationName}}) ו-{{organizationDomain}}. הצטרף באמצעות הזמנה.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/hi-IN.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -891,6 +891,10 @@ export const hiIN: LocalizationResource = {
actionLink: 'साइन आउट',
actionText: '{{identifier}} के रूप में साइन इन किया गया',
},
alerts: {
organizationAlreadyExists:
'पता लगाई गई कंपनी के नाम ({{organizationName}}) और {{organizationDomain}} के लिए एक संगठन पहले से मौजूद है। आमंत्रण द्वारा शामिल हों।',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/hr-HR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const hrHR: LocalizationResource = {
actionLink: 'Odjavi se',
actionText: 'Prijavljen kao {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organizacija već postoji za otkriveni naziv tvrtke ({{organizationName}}) i {{organizationDomain}}. Pridružite se putem pozivnice.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/calm-maps-work.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
---
'@clerk/localizations': minor
'@clerk/clerk-js': minor
'@clerk/shared': minor
'@clerk/ui': minor
---

Surface organization creation defaults with prefilled form fields and advisory warnings
4 changes: 2 additions & 2 deletions packages/clerk-js/bundlewatch.config.json
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
{
"files": [
{ "path": "./dist/clerk.js", "maxSize": "538KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "63KB" },
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "63KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "66KB" },
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "66KB" },
{ "path": "./dist/clerk.legacy.browser.js", "maxSize": "105KB" },
{ "path": "./dist/clerk.no-rhc.js", "maxSize": "305KB" },
{ "path": "./dist/clerk.headless*.js", "maxSize": "65KB" },
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
import type {
OrganizationCreationAdvisorySeverity,
OrganizationCreationAdvisoryType,
OrganizationCreationDefaultsJSON,
OrganizationCreationDefaultsJSONSnapshot,
OrganizationCreationDefaultsResource,
} from '@clerk/shared/types';

import { BaseResource } from './internal';

export class OrganizationCreationDefaults extends BaseResource implements OrganizationCreationDefaultsResource {
advisory: {
code: OrganizationCreationAdvisoryType;
severity: OrganizationCreationAdvisorySeverity;
meta: Record<string, string>;
} | null = null;
form: {
name: string;
slug: string;
logo: string | null;
blurHash: string | null;
} = {
name: '',
slug: '',
logo: null,
blurHash: null,
};

public constructor(data: OrganizationCreationDefaultsJSON | OrganizationCreationDefaultsJSONSnapshot | null = null) {
super();
this.fromJSON(data);
}

protected fromJSON(data: OrganizationCreationDefaultsJSON | OrganizationCreationDefaultsJSONSnapshot | null): this {
if (!data) {
return this;
}

if (data.advisory) {
this.advisory = this.withDefault(data.advisory, this.advisory ?? null);
}

if (data.form) {
this.form.name = this.withDefault(data.form.name, this.form.name);
this.form.slug = this.withDefault(data.form.slug, this.form.slug);
this.form.logo = this.withDefault(data.form.logo, this.form.logo);
this.form.blurHash = this.withDefault(data.form.blur_hash, this.form.blurHash);
}

return this;
}

static async retrieve(): Promise<OrganizationCreationDefaultsResource> {
return await BaseResource._fetch({
path: '/me/organization_creation_defaults',
method: 'GET',
}).then(res => {
const data = res?.response as unknown as OrganizationCreationDefaultsJSON;
return new OrganizationCreationDefaults(data);
});
}
Comment on lines +53 to +61

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Unsafe type casting bypasses validation and could cause runtime errors.

Line 55 uses as unknown as OrganizationCreationDefaultsJSON to force-cast the API response without any validation. If the API returns malformed data or the response structure changes, this will bypass type safety and could cause runtime errors when the resource properties are accessed.

🔎 Proposed fix with runtime validation
 static async retrieve(): Promise<OrganizationCreationDefaultsResource> {
return await BaseResource._fetch({
path: '/me/organization_creation_defaults',
method: 'GET',
}).then(res => {
- const data = res?.response as unknown as OrganizationCreationDefaultsJSON;+ const data = res?.response;+ // Basic runtime validation+ if (!data || typeof data !== 'object') {+ throw new Error('Invalid organization creation defaults response');+ }
return new OrganizationCreationDefaults(data);
});
}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts around
lines 50 to 58, the code force-casts the API response using "as unknown as
OrganizationCreationDefaultsJSON" which bypasses runtime validation; replace the
cast with a proper runtime check: extract res.response, validate required fields
and types (either with a small type-guard function or an existing JSON/schema
validator), throw or return a clear error if validation fails, and only then
construct and return new OrganizationCreationDefaults(validatedData); do not use
"as unknown as" to silence type checking.


public __internal_toSnapshot(): OrganizationCreationDefaultsJSONSnapshot {
return {
advisory: this.advisory
? {
code: this.advisory.code,
meta: this.advisory.meta,
severity: this.advisory.severity,
}
: null,
form: {
name: this.form.name,
slug: this.form.slug,
logo: this.form.logo,
blur_hash: this.form.blurHash,
},
} as unknown as OrganizationCreationDefaultsJSONSnapshot;
}
Comment thread
LauraBeatris marked this conversation as resolved.
}
12 changes: 12 additions & 0 deletions packages/clerk-js/src/core/resources/OrganizationSettings.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,6 +23,11 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe
} = {
disabled: false,
};
organizationCreationDefaults: {
enabled: boolean;
} = {
enabled: false,
};
enabled: boolean = false;
maxAllowedMemberships: number = 1;
forceOrganizationSelection!: boolean;
Expand DownExpand Up@@ -51,6 +56,13 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe
this.slug.disabled = this.withDefault(data.slug.disabled, this.slug.disabled);
}

if (data.organization_creation_defaults) {
this.organizationCreationDefaults.enabled = this.withDefault(
data.organization_creation_defaults.enabled,
this.organizationCreationDefaults.enabled,
);
}

this.enabled = this.withDefault(data.enabled, this.enabled);
this.maxAllowedMemberships = this.withDefault(data.max_allowed_memberships, this.maxAllowedMemberships);
this.forceOrganizationSelection = this.withDefault(
Expand Down
3 changes: 3 additions & 0 deletions packages/clerk-js/src/core/resources/User.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,6 +53,7 @@ import {
UserOrganizationInvitation,
Web3Wallet,
} from './internal';
import { OrganizationCreationDefaults } from './OrganizationCreationDefaults';

export class User extends BaseResource implements UserResource {
pathRoot = '/me';
Expand DownExpand Up@@ -275,6 +276,8 @@ export class User extends BaseResource implements UserResource {
getOrganizationMemberships: GetOrganizationMemberships = retrieveMembership =>
OrganizationMembership.retrieve(retrieveMembership);

getOrganizationCreationDefaults = () => OrganizationCreationDefaults.retrieve();

leaveOrganization = async (organizationId: string): Promise<DeletedObjectResource> => {
const json = (
await BaseResource._fetch<DeletedObjectJSON>({
Expand Down
4 changes: 4 additions & 0 deletions packages/clerk-js/src/test/fixture-helpers.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -344,6 +344,9 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON)
const withOrganizationSlug = (enabled = false) => {
os.slug.disabled = !enabled;
};
const withOrganizationCreationDefaults = (enabled = false) => {
os.organization_creation_defaults.enabled = enabled;
};

const withOrganizationDomains = (modes?: OrganizationEnrollmentMode[], defaultRole?: string) => {
os.domains.enabled = true;
Expand All@@ -356,6 +359,7 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON)
withOrganizationDomains,
withForceOrganizationSelection,
withOrganizationSlug,
withOrganizationCreationDefaults,
};
};

Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/ar-SA.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -882,6 +882,10 @@ export const arSA: LocalizationResource = {
actionLink: 'تسجيل الخروج',
actionText: 'تم تسجيل الدخول كـ {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'توجد منظمة بالفعل لاسم الشركة المكتشف ({{organizationName}}) و {{organizationDomain}}. انضم عن طريق الدعوة.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/be-BY.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,10 @@ export const beBY: LocalizationResource = {
actionLink: 'Выйсці',
actionText: 'Увайшлі як {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Арганізацыя ўжо існуе для выяўленай назвы кампаніі ({{organizationName}}) і {{organizationDomain}}. Далучайцеся па запрашэнні.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/bg-BG.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -886,6 +886,10 @@ export const bgBG: LocalizationResource = {
actionLink: 'Изход',
actionText: 'Влязъл като {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Организация вече съществува за откритото име на компанията ({{organizationName}}) и {{organizationDomain}}. Присъединете се чрез покана.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/bn-IN.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,10 @@ export const bnIN: LocalizationResource = {
actionLink: 'সাইন আউট',
actionText: '{{identifier}} হিসাবে সাইন ইন করা হয়েছে',
},
alerts: {
organizationAlreadyExists:
'শনাক্ত করা কোম্পানির নাম ({{organizationName}}) এবং {{organizationDomain}}-এর জন্য একটি সংস্থা ইতিমধ্যেই বিদ্যমান। আমন্ত্রণের মাধ্যমে যোগ দিন।',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/ca-ES.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -885,6 +885,10 @@ export const caES: LocalizationResource = {
actionLink: 'Tancar sessió',
actionText: 'Sessió iniciada com a {{identifier}}',
},
alerts: {
organizationAlreadyExists:
"Ja existeix una organització per al nom d'empresa detectat ({{organizationName}}) i {{organizationDomain}}. Uneix-te per invitació.",
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/cs-CZ.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -896,6 +896,10 @@ export const csCZ: LocalizationResource = {
actionLink: 'Odhlásit se',
actionText: 'Přihlášen jako {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organizace již existuje pro detekovaný název společnosti ({{organizationName}}) a {{organizationDomain}}. Připojte se prostřednictvím pozvánky.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/da-DK.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -883,6 +883,10 @@ export const daDK: LocalizationResource = {
actionLink: 'Log ud',
actionText: 'Logget ind som {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Der findes allerede en organisation for det registrerede firmanavn ({{organizationName}}) og {{organizationDomain}}. Tilmeld dig via invitation.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/de-DE.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -901,6 +901,10 @@ export const deDE: LocalizationResource = {
actionLink: 'Abmelden',
actionText: 'Angemeldet als {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Für den erkannten Firmennamen ({{organizationName}}) und {{organizationDomain}} existiert bereits eine Organisation. Treten Sie per Einladung bei.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/el-GR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -888,6 +888,10 @@ export const elGR: LocalizationResource = {
actionLink: 'Αποσύνδεση',
actionText: 'Συνδεδεμένος ως {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Υπάρχει ήδη οργανισμός για το ανιχνευμένο όνομα εταιρείας ({{organizationName}}) και {{organizationDomain}}. Εγγραφείτε μέσω πρόσκλησης.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/en-GB.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const enGB: LocalizationResource = {
actionLink: 'Sign out',
actionText: 'Signed in as {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'An organisation already exists for the detected company name ({{organizationName}}) and {{organizationDomain}}. Join by invitation.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/en-US.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -884,6 +884,10 @@ export const enUS: LocalizationResource = {
actionLink: 'Sign out',
actionText: 'Signed in as {{identifier}}',
},
alerts: {
organizationAlreadyExists:
Comment thread
LauraBeatris marked this conversation as resolved.
'An organization already exists for the detected company name ({{organizationName}}) and {{organizationDomain}}. Join by invitation.',
},
},
taskResetPassword: {
formButtonPrimary: 'Reset Password',
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-CR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -893,6 +893,10 @@ export const esCR: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Conectado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-ES.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const esES: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Sesión iniciada como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-MX.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -894,6 +894,10 @@ export const esMX: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Registrado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-UY.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -893,6 +893,10 @@ export const esUY: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Logueado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fa-IR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -897,6 +897,10 @@ export const faIR: LocalizationResource = {
actionLink: 'خروج از همه حساب‌ها',
actionText: 'می‌خواهید خارج شوید؟',
},
alerts: {
organizationAlreadyExists:
'سازمانی برای نام شرکت شناسایی شده ({{organizationName}}) و {{organizationDomain}} از قبل وجود دارد. از طریق دعوتنامه بپیوندید.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fi-FI.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -886,6 +886,10 @@ export const fiFI: LocalizationResource = {
actionLink: 'Kirjaudu ulos',
actionText: 'Kirjautuneena käyttäjänä {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organisaatio on jo olemassa havaitulle yrityksen nimelle ({{organizationName}}) ja {{organizationDomain}}. Liity kutsulla.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fr-FR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -902,6 +902,10 @@ export const frFR: LocalizationResource = {
actionLink: 'Se déconnecter',
actionText: 'Connecté en tant que {{identifier}}',
},
alerts: {
organizationAlreadyExists:
"Une organisation existe déjà pour le nom d'entreprise détecté ({{organizationName}}) et {{organizationDomain}}. Rejoignez par invitation.",
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/he-IL.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -876,6 +876,10 @@ export const heIL: LocalizationResource = {
actionLink: 'התנתק',
actionText: 'מחובר כ-{{identifier}}',
},
alerts: {
organizationAlreadyExists:
'ארגון כבר קיים עבור שם החברה שזוהה ({{organizationName}}) ו-{{organizationDomain}}. הצטרף באמצעות הזמנה.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/hi-IN.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -891,6 +891,10 @@ export const hiIN: LocalizationResource = {
actionLink: 'साइन आउट',
actionText: '{{identifier}} के रूप में साइन इन किया गया',
},
alerts: {
organizationAlreadyExists:
'पता लगाई गई कंपनी के नाम ({{organizationName}}) और {{organizationDomain}} के लिए एक संगठन पहले से मौजूद है। आमंत्रण द्वारा शामिल हों।',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/hr-HR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const hrHR: LocalizationResource = {
actionLink: 'Odjavi se',
actionText: 'Prijavljen kao {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organizacija već postoji za otkriveni naziv tvrtke ({{organizationName}}) i {{organizationDomain}}. Pridružite se putem pozivnice.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/calm-maps-work.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
---
'@clerk/localizations': minor
'@clerk/clerk-js': minor
'@clerk/shared': minor
'@clerk/ui': minor
---

Surface organization creation defaults with prefilled form fields and advisory warnings
4 changes: 2 additions & 2 deletions packages/clerk-js/bundlewatch.config.json
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
{
"files": [
{ "path": "./dist/clerk.js", "maxSize": "538KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "63KB" },
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "63KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "66KB" },
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "66KB" },
{ "path": "./dist/clerk.legacy.browser.js", "maxSize": "105KB" },
{ "path": "./dist/clerk.no-rhc.js", "maxSize": "305KB" },
{ "path": "./dist/clerk.headless*.js", "maxSize": "65KB" },
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
import type {
OrganizationCreationAdvisorySeverity,
OrganizationCreationAdvisoryType,
OrganizationCreationDefaultsJSON,
OrganizationCreationDefaultsJSONSnapshot,
OrganizationCreationDefaultsResource,
} from '@clerk/shared/types';

import { BaseResource } from './internal';

export class OrganizationCreationDefaults extends BaseResource implements OrganizationCreationDefaultsResource {
advisory: {
code: OrganizationCreationAdvisoryType;
severity: OrganizationCreationAdvisorySeverity;
meta: Record<string, string>;
} | null = null;
form: {
name: string;
slug: string;
logo: string | null;
blurHash: string | null;
} = {
name: '',
slug: '',
logo: null,
blurHash: null,
};

public constructor(data: OrganizationCreationDefaultsJSON | OrganizationCreationDefaultsJSONSnapshot | null = null) {
super();
this.fromJSON(data);
}

protected fromJSON(data: OrganizationCreationDefaultsJSON | OrganizationCreationDefaultsJSONSnapshot | null): this {
if (!data) {
return this;
}

if (data.advisory) {
this.advisory = this.withDefault(data.advisory, this.advisory ?? null);
}

if (data.form) {
this.form.name = this.withDefault(data.form.name, this.form.name);
this.form.slug = this.withDefault(data.form.slug, this.form.slug);
this.form.logo = this.withDefault(data.form.logo, this.form.logo);
this.form.blurHash = this.withDefault(data.form.blur_hash, this.form.blurHash);
}

return this;
}

static async retrieve(): Promise<OrganizationCreationDefaultsResource> {
return await BaseResource._fetch({
path: '/me/organization_creation_defaults',
method: 'GET',
}).then(res => {
const data = res?.response as unknown as OrganizationCreationDefaultsJSON;
return new OrganizationCreationDefaults(data);
});
}
Comment on lines +53 to +61

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Unsafe type casting bypasses validation and could cause runtime errors.

Line 55 uses as unknown as OrganizationCreationDefaultsJSON to force-cast the API response without any validation. If the API returns malformed data or the response structure changes, this will bypass type safety and could cause runtime errors when the resource properties are accessed.

🔎 Proposed fix with runtime validation
 static async retrieve(): Promise<OrganizationCreationDefaultsResource> {
return await BaseResource._fetch({
path: '/me/organization_creation_defaults',
method: 'GET',
}).then(res => {
- const data = res?.response as unknown as OrganizationCreationDefaultsJSON;+ const data = res?.response;+ // Basic runtime validation+ if (!data || typeof data !== 'object') {+ throw new Error('Invalid organization creation defaults response');+ }
return new OrganizationCreationDefaults(data);
});
}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts around
lines 50 to 58, the code force-casts the API response using "as unknown as
OrganizationCreationDefaultsJSON" which bypasses runtime validation; replace the
cast with a proper runtime check: extract res.response, validate required fields
and types (either with a small type-guard function or an existing JSON/schema
validator), throw or return a clear error if validation fails, and only then
construct and return new OrganizationCreationDefaults(validatedData); do not use
"as unknown as" to silence type checking.


public __internal_toSnapshot(): OrganizationCreationDefaultsJSONSnapshot {
return {
advisory: this.advisory
? {
code: this.advisory.code,
meta: this.advisory.meta,
severity: this.advisory.severity,
}
: null,
form: {
name: this.form.name,
slug: this.form.slug,
logo: this.form.logo,
blur_hash: this.form.blurHash,
},
} as unknown as OrganizationCreationDefaultsJSONSnapshot;
}
Comment thread
LauraBeatris marked this conversation as resolved.
}
12 changes: 12 additions & 0 deletions packages/clerk-js/src/core/resources/OrganizationSettings.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,6 +23,11 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe
} = {
disabled: false,
};
organizationCreationDefaults: {
enabled: boolean;
} = {
enabled: false,
};
enabled: boolean = false;
maxAllowedMemberships: number = 1;
forceOrganizationSelection!: boolean;
Expand DownExpand Up@@ -51,6 +56,13 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe
this.slug.disabled = this.withDefault(data.slug.disabled, this.slug.disabled);
}

if (data.organization_creation_defaults) {
this.organizationCreationDefaults.enabled = this.withDefault(
data.organization_creation_defaults.enabled,
this.organizationCreationDefaults.enabled,
);
}

this.enabled = this.withDefault(data.enabled, this.enabled);
this.maxAllowedMemberships = this.withDefault(data.max_allowed_memberships, this.maxAllowedMemberships);
this.forceOrganizationSelection = this.withDefault(
Expand Down
3 changes: 3 additions & 0 deletions packages/clerk-js/src/core/resources/User.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,6 +53,7 @@ import {
UserOrganizationInvitation,
Web3Wallet,
} from './internal';
import { OrganizationCreationDefaults } from './OrganizationCreationDefaults';

export class User extends BaseResource implements UserResource {
pathRoot = '/me';
Expand DownExpand Up@@ -275,6 +276,8 @@ export class User extends BaseResource implements UserResource {
getOrganizationMemberships: GetOrganizationMemberships = retrieveMembership =>
OrganizationMembership.retrieve(retrieveMembership);

getOrganizationCreationDefaults = () => OrganizationCreationDefaults.retrieve();

leaveOrganization = async (organizationId: string): Promise<DeletedObjectResource> => {
const json = (
await BaseResource._fetch<DeletedObjectJSON>({
Expand Down
4 changes: 4 additions & 0 deletions packages/clerk-js/src/test/fixture-helpers.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -344,6 +344,9 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON)
const withOrganizationSlug = (enabled = false) => {
os.slug.disabled = !enabled;
};
const withOrganizationCreationDefaults = (enabled = false) => {
os.organization_creation_defaults.enabled = enabled;
};

const withOrganizationDomains = (modes?: OrganizationEnrollmentMode[], defaultRole?: string) => {
os.domains.enabled = true;
Expand All@@ -356,6 +359,7 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON)
withOrganizationDomains,
withForceOrganizationSelection,
withOrganizationSlug,
withOrganizationCreationDefaults,
};
};

Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/ar-SA.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -882,6 +882,10 @@ export const arSA: LocalizationResource = {
actionLink: 'تسجيل الخروج',
actionText: 'تم تسجيل الدخول كـ {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'توجد منظمة بالفعل لاسم الشركة المكتشف ({{organizationName}}) و {{organizationDomain}}. انضم عن طريق الدعوة.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/be-BY.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,10 @@ export const beBY: LocalizationResource = {
actionLink: 'Выйсці',
actionText: 'Увайшлі як {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Арганізацыя ўжо існуе для выяўленай назвы кампаніі ({{organizationName}}) і {{organizationDomain}}. Далучайцеся па запрашэнні.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/bg-BG.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -886,6 +886,10 @@ export const bgBG: LocalizationResource = {
actionLink: 'Изход',
actionText: 'Влязъл като {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Организация вече съществува за откритото име на компанията ({{organizationName}}) и {{organizationDomain}}. Присъединете се чрез покана.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/bn-IN.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,10 @@ export const bnIN: LocalizationResource = {
actionLink: 'সাইন আউট',
actionText: '{{identifier}} হিসাবে সাইন ইন করা হয়েছে',
},
alerts: {
organizationAlreadyExists:
'শনাক্ত করা কোম্পানির নাম ({{organizationName}}) এবং {{organizationDomain}}-এর জন্য একটি সংস্থা ইতিমধ্যেই বিদ্যমান। আমন্ত্রণের মাধ্যমে যোগ দিন।',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/ca-ES.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -885,6 +885,10 @@ export const caES: LocalizationResource = {
actionLink: 'Tancar sessió',
actionText: 'Sessió iniciada com a {{identifier}}',
},
alerts: {
organizationAlreadyExists:
"Ja existeix una organització per al nom d'empresa detectat ({{organizationName}}) i {{organizationDomain}}. Uneix-te per invitació.",
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/cs-CZ.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -896,6 +896,10 @@ export const csCZ: LocalizationResource = {
actionLink: 'Odhlásit se',
actionText: 'Přihlášen jako {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organizace již existuje pro detekovaný název společnosti ({{organizationName}}) a {{organizationDomain}}. Připojte se prostřednictvím pozvánky.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/da-DK.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -883,6 +883,10 @@ export const daDK: LocalizationResource = {
actionLink: 'Log ud',
actionText: 'Logget ind som {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Der findes allerede en organisation for det registrerede firmanavn ({{organizationName}}) og {{organizationDomain}}. Tilmeld dig via invitation.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/de-DE.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -901,6 +901,10 @@ export const deDE: LocalizationResource = {
actionLink: 'Abmelden',
actionText: 'Angemeldet als {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Für den erkannten Firmennamen ({{organizationName}}) und {{organizationDomain}} existiert bereits eine Organisation. Treten Sie per Einladung bei.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/el-GR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -888,6 +888,10 @@ export const elGR: LocalizationResource = {
actionLink: 'Αποσύνδεση',
actionText: 'Συνδεδεμένος ως {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Υπάρχει ήδη οργανισμός για το ανιχνευμένο όνομα εταιρείας ({{organizationName}}) και {{organizationDomain}}. Εγγραφείτε μέσω πρόσκλησης.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/en-GB.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const enGB: LocalizationResource = {
actionLink: 'Sign out',
actionText: 'Signed in as {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'An organisation already exists for the detected company name ({{organizationName}}) and {{organizationDomain}}. Join by invitation.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/en-US.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -884,6 +884,10 @@ export const enUS: LocalizationResource = {
actionLink: 'Sign out',
actionText: 'Signed in as {{identifier}}',
},
alerts: {
organizationAlreadyExists:
Comment thread
LauraBeatris marked this conversation as resolved.
'An organization already exists for the detected company name ({{organizationName}}) and {{organizationDomain}}. Join by invitation.',
},
},
taskResetPassword: {
formButtonPrimary: 'Reset Password',
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-CR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -893,6 +893,10 @@ export const esCR: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Conectado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-ES.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const esES: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Sesión iniciada como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-MX.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -894,6 +894,10 @@ export const esMX: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Registrado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-UY.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -893,6 +893,10 @@ export const esUY: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Logueado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fa-IR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -897,6 +897,10 @@ export const faIR: LocalizationResource = {
actionLink: 'خروج از همه حساب‌ها',
actionText: 'می‌خواهید خارج شوید؟',
},
alerts: {
organizationAlreadyExists:
'سازمانی برای نام شرکت شناسایی شده ({{organizationName}}) و {{organizationDomain}} از قبل وجود دارد. از طریق دعوتنامه بپیوندید.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fi-FI.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -886,6 +886,10 @@ export const fiFI: LocalizationResource = {
actionLink: 'Kirjaudu ulos',
actionText: 'Kirjautuneena käyttäjänä {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organisaatio on jo olemassa havaitulle yrityksen nimelle ({{organizationName}}) ja {{organizationDomain}}. Liity kutsulla.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fr-FR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -902,6 +902,10 @@ export const frFR: LocalizationResource = {
actionLink: 'Se déconnecter',
actionText: 'Connecté en tant que {{identifier}}',
},
alerts: {
organizationAlreadyExists:
"Une organisation existe déjà pour le nom d'entreprise détecté ({{organizationName}}) et {{organizationDomain}}. Rejoignez par invitation.",
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/he-IL.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -876,6 +876,10 @@ export const heIL: LocalizationResource = {
actionLink: 'התנתק',
actionText: 'מחובר כ-{{identifier}}',
},
alerts: {
organizationAlreadyExists:
'ארגון כבר קיים עבור שם החברה שזוהה ({{organizationName}}) ו-{{organizationDomain}}. הצטרף באמצעות הזמנה.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/hi-IN.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -891,6 +891,10 @@ export const hiIN: LocalizationResource = {
actionLink: 'साइन आउट',
actionText: '{{identifier}} के रूप में साइन इन किया गया',
},
alerts: {
organizationAlreadyExists:
'पता लगाई गई कंपनी के नाम ({{organizationName}}) और {{organizationDomain}} के लिए एक संगठन पहले से मौजूद है। आमंत्रण द्वारा शामिल हों।',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/hr-HR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const hrHR: LocalizationResource = {
actionLink: 'Odjavi se',
actionText: 'Prijavljen kao {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organizacija već postoji za otkriveni naziv tvrtke ({{organizationName}}) i {{organizationDomain}}. Pridružite se putem pozivnice.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/calm-maps-work.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
---
'@clerk/localizations': minor
'@clerk/clerk-js': minor
'@clerk/shared': minor
'@clerk/ui': minor
---

Surface organization creation defaults with prefilled form fields and advisory warnings
4 changes: 2 additions & 2 deletions packages/clerk-js/bundlewatch.config.json
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
{
"files": [
{ "path": "./dist/clerk.js", "maxSize": "538KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "63KB" },
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "63KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "66KB" },
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "66KB" },
{ "path": "./dist/clerk.legacy.browser.js", "maxSize": "105KB" },
{ "path": "./dist/clerk.no-rhc.js", "maxSize": "305KB" },
{ "path": "./dist/clerk.headless*.js", "maxSize": "65KB" },
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
import type {
OrganizationCreationAdvisorySeverity,
OrganizationCreationAdvisoryType,
OrganizationCreationDefaultsJSON,
OrganizationCreationDefaultsJSONSnapshot,
OrganizationCreationDefaultsResource,
} from '@clerk/shared/types';

import { BaseResource } from './internal';

export class OrganizationCreationDefaults extends BaseResource implements OrganizationCreationDefaultsResource {
advisory: {
code: OrganizationCreationAdvisoryType;
severity: OrganizationCreationAdvisorySeverity;
meta: Record<string, string>;
} | null = null;
form: {
name: string;
slug: string;
logo: string | null;
blurHash: string | null;
} = {
name: '',
slug: '',
logo: null,
blurHash: null,
};

public constructor(data: OrganizationCreationDefaultsJSON | OrganizationCreationDefaultsJSONSnapshot | null = null) {
super();
this.fromJSON(data);
}

protected fromJSON(data: OrganizationCreationDefaultsJSON | OrganizationCreationDefaultsJSONSnapshot | null): this {
if (!data) {
return this;
}

if (data.advisory) {
this.advisory = this.withDefault(data.advisory, this.advisory ?? null);
}

if (data.form) {
this.form.name = this.withDefault(data.form.name, this.form.name);
this.form.slug = this.withDefault(data.form.slug, this.form.slug);
this.form.logo = this.withDefault(data.form.logo, this.form.logo);
this.form.blurHash = this.withDefault(data.form.blur_hash, this.form.blurHash);
}

return this;
}

static async retrieve(): Promise<OrganizationCreationDefaultsResource> {
return await BaseResource._fetch({
path: '/me/organization_creation_defaults',
method: 'GET',
}).then(res => {
const data = res?.response as unknown as OrganizationCreationDefaultsJSON;
return new OrganizationCreationDefaults(data);
});
}
Comment on lines +53 to +61

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Unsafe type casting bypasses validation and could cause runtime errors.

Line 55 uses as unknown as OrganizationCreationDefaultsJSON to force-cast the API response without any validation. If the API returns malformed data or the response structure changes, this will bypass type safety and could cause runtime errors when the resource properties are accessed.

🔎 Proposed fix with runtime validation
 static async retrieve(): Promise<OrganizationCreationDefaultsResource> {
return await BaseResource._fetch({
path: '/me/organization_creation_defaults',
method: 'GET',
}).then(res => {
- const data = res?.response as unknown as OrganizationCreationDefaultsJSON;+ const data = res?.response;+ // Basic runtime validation+ if (!data || typeof data !== 'object') {+ throw new Error('Invalid organization creation defaults response');+ }
return new OrganizationCreationDefaults(data);
});
}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts around
lines 50 to 58, the code force-casts the API response using "as unknown as
OrganizationCreationDefaultsJSON" which bypasses runtime validation; replace the
cast with a proper runtime check: extract res.response, validate required fields
and types (either with a small type-guard function or an existing JSON/schema
validator), throw or return a clear error if validation fails, and only then
construct and return new OrganizationCreationDefaults(validatedData); do not use
"as unknown as" to silence type checking.


public __internal_toSnapshot(): OrganizationCreationDefaultsJSONSnapshot {
return {
advisory: this.advisory
? {
code: this.advisory.code,
meta: this.advisory.meta,
severity: this.advisory.severity,
}
: null,
form: {
name: this.form.name,
slug: this.form.slug,
logo: this.form.logo,
blur_hash: this.form.blurHash,
},
} as unknown as OrganizationCreationDefaultsJSONSnapshot;
}
Comment thread
LauraBeatris marked this conversation as resolved.
}
12 changes: 12 additions & 0 deletions packages/clerk-js/src/core/resources/OrganizationSettings.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,6 +23,11 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe
} = {
disabled: false,
};
organizationCreationDefaults: {
enabled: boolean;
} = {
enabled: false,
};
enabled: boolean = false;
maxAllowedMemberships: number = 1;
forceOrganizationSelection!: boolean;
Expand DownExpand Up@@ -51,6 +56,13 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe
this.slug.disabled = this.withDefault(data.slug.disabled, this.slug.disabled);
}

if (data.organization_creation_defaults) {
this.organizationCreationDefaults.enabled = this.withDefault(
data.organization_creation_defaults.enabled,
this.organizationCreationDefaults.enabled,
);
}

this.enabled = this.withDefault(data.enabled, this.enabled);
this.maxAllowedMemberships = this.withDefault(data.max_allowed_memberships, this.maxAllowedMemberships);
this.forceOrganizationSelection = this.withDefault(
Expand Down
3 changes: 3 additions & 0 deletions packages/clerk-js/src/core/resources/User.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,6 +53,7 @@ import {
UserOrganizationInvitation,
Web3Wallet,
} from './internal';
import { OrganizationCreationDefaults } from './OrganizationCreationDefaults';

export class User extends BaseResource implements UserResource {
pathRoot = '/me';
Expand DownExpand Up@@ -275,6 +276,8 @@ export class User extends BaseResource implements UserResource {
getOrganizationMemberships: GetOrganizationMemberships = retrieveMembership =>
OrganizationMembership.retrieve(retrieveMembership);

getOrganizationCreationDefaults = () => OrganizationCreationDefaults.retrieve();

leaveOrganization = async (organizationId: string): Promise<DeletedObjectResource> => {
const json = (
await BaseResource._fetch<DeletedObjectJSON>({
Expand Down
4 changes: 4 additions & 0 deletions packages/clerk-js/src/test/fixture-helpers.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -344,6 +344,9 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON)
const withOrganizationSlug = (enabled = false) => {
os.slug.disabled = !enabled;
};
const withOrganizationCreationDefaults = (enabled = false) => {
os.organization_creation_defaults.enabled = enabled;
};

const withOrganizationDomains = (modes?: OrganizationEnrollmentMode[], defaultRole?: string) => {
os.domains.enabled = true;
Expand All@@ -356,6 +359,7 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON)
withOrganizationDomains,
withForceOrganizationSelection,
withOrganizationSlug,
withOrganizationCreationDefaults,
};
};

Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/ar-SA.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -882,6 +882,10 @@ export const arSA: LocalizationResource = {
actionLink: 'تسجيل الخروج',
actionText: 'تم تسجيل الدخول كـ {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'توجد منظمة بالفعل لاسم الشركة المكتشف ({{organizationName}}) و {{organizationDomain}}. انضم عن طريق الدعوة.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/be-BY.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,10 @@ export const beBY: LocalizationResource = {
actionLink: 'Выйсці',
actionText: 'Увайшлі як {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Арганізацыя ўжо існуе для выяўленай назвы кампаніі ({{organizationName}}) і {{organizationDomain}}. Далучайцеся па запрашэнні.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/bg-BG.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -886,6 +886,10 @@ export const bgBG: LocalizationResource = {
actionLink: 'Изход',
actionText: 'Влязъл като {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Организация вече съществува за откритото име на компанията ({{organizationName}}) и {{organizationDomain}}. Присъединете се чрез покана.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/bn-IN.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,10 @@ export const bnIN: LocalizationResource = {
actionLink: 'সাইন আউট',
actionText: '{{identifier}} হিসাবে সাইন ইন করা হয়েছে',
},
alerts: {
organizationAlreadyExists:
'শনাক্ত করা কোম্পানির নাম ({{organizationName}}) এবং {{organizationDomain}}-এর জন্য একটি সংস্থা ইতিমধ্যেই বিদ্যমান। আমন্ত্রণের মাধ্যমে যোগ দিন।',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/ca-ES.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -885,6 +885,10 @@ export const caES: LocalizationResource = {
actionLink: 'Tancar sessió',
actionText: 'Sessió iniciada com a {{identifier}}',
},
alerts: {
organizationAlreadyExists:
"Ja existeix una organització per al nom d'empresa detectat ({{organizationName}}) i {{organizationDomain}}. Uneix-te per invitació.",
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/cs-CZ.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -896,6 +896,10 @@ export const csCZ: LocalizationResource = {
actionLink: 'Odhlásit se',
actionText: 'Přihlášen jako {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organizace již existuje pro detekovaný název společnosti ({{organizationName}}) a {{organizationDomain}}. Připojte se prostřednictvím pozvánky.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/da-DK.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -883,6 +883,10 @@ export const daDK: LocalizationResource = {
actionLink: 'Log ud',
actionText: 'Logget ind som {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Der findes allerede en organisation for det registrerede firmanavn ({{organizationName}}) og {{organizationDomain}}. Tilmeld dig via invitation.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/de-DE.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -901,6 +901,10 @@ export const deDE: LocalizationResource = {
actionLink: 'Abmelden',
actionText: 'Angemeldet als {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Für den erkannten Firmennamen ({{organizationName}}) und {{organizationDomain}} existiert bereits eine Organisation. Treten Sie per Einladung bei.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/el-GR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -888,6 +888,10 @@ export const elGR: LocalizationResource = {
actionLink: 'Αποσύνδεση',
actionText: 'Συνδεδεμένος ως {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Υπάρχει ήδη οργανισμός για το ανιχνευμένο όνομα εταιρείας ({{organizationName}}) και {{organizationDomain}}. Εγγραφείτε μέσω πρόσκλησης.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/en-GB.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const enGB: LocalizationResource = {
actionLink: 'Sign out',
actionText: 'Signed in as {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'An organisation already exists for the detected company name ({{organizationName}}) and {{organizationDomain}}. Join by invitation.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/en-US.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -884,6 +884,10 @@ export const enUS: LocalizationResource = {
actionLink: 'Sign out',
actionText: 'Signed in as {{identifier}}',
},
alerts: {
organizationAlreadyExists:
Comment thread
LauraBeatris marked this conversation as resolved.
'An organization already exists for the detected company name ({{organizationName}}) and {{organizationDomain}}. Join by invitation.',
},
},
taskResetPassword: {
formButtonPrimary: 'Reset Password',
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-CR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -893,6 +893,10 @@ export const esCR: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Conectado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-ES.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const esES: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Sesión iniciada como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-MX.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -894,6 +894,10 @@ export const esMX: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Registrado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-UY.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -893,6 +893,10 @@ export const esUY: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Logueado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fa-IR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -897,6 +897,10 @@ export const faIR: LocalizationResource = {
actionLink: 'خروج از همه حساب‌ها',
actionText: 'می‌خواهید خارج شوید؟',
},
alerts: {
organizationAlreadyExists:
'سازمانی برای نام شرکت شناسایی شده ({{organizationName}}) و {{organizationDomain}} از قبل وجود دارد. از طریق دعوتنامه بپیوندید.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fi-FI.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -886,6 +886,10 @@ export const fiFI: LocalizationResource = {
actionLink: 'Kirjaudu ulos',
actionText: 'Kirjautuneena käyttäjänä {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organisaatio on jo olemassa havaitulle yrityksen nimelle ({{organizationName}}) ja {{organizationDomain}}. Liity kutsulla.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fr-FR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -902,6 +902,10 @@ export const frFR: LocalizationResource = {
actionLink: 'Se déconnecter',
actionText: 'Connecté en tant que {{identifier}}',
},
alerts: {
organizationAlreadyExists:
"Une organisation existe déjà pour le nom d'entreprise détecté ({{organizationName}}) et {{organizationDomain}}. Rejoignez par invitation.",
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/he-IL.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -876,6 +876,10 @@ export const heIL: LocalizationResource = {
actionLink: 'התנתק',
actionText: 'מחובר כ-{{identifier}}',
},
alerts: {
organizationAlreadyExists:
'ארגון כבר קיים עבור שם החברה שזוהה ({{organizationName}}) ו-{{organizationDomain}}. הצטרף באמצעות הזמנה.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/hi-IN.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -891,6 +891,10 @@ export const hiIN: LocalizationResource = {
actionLink: 'साइन आउट',
actionText: '{{identifier}} के रूप में साइन इन किया गया',
},
alerts: {
organizationAlreadyExists:
'पता लगाई गई कंपनी के नाम ({{organizationName}}) और {{organizationDomain}} के लिए एक संगठन पहले से मौजूद है। आमंत्रण द्वारा शामिल हों।',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/hr-HR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const hrHR: LocalizationResource = {
actionLink: 'Odjavi se',
actionText: 'Prijavljen kao {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organizacija već postoji za otkriveni naziv tvrtke ({{organizationName}}) i {{organizationDomain}}. Pridružite se putem pozivnice.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/calm-maps-work.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
---
'@clerk/localizations': minor
'@clerk/clerk-js': minor
'@clerk/shared': minor
'@clerk/ui': minor
---

Surface organization creation defaults with prefilled form fields and advisory warnings
4 changes: 2 additions & 2 deletions packages/clerk-js/bundlewatch.config.json
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
{
"files": [
{ "path": "./dist/clerk.js", "maxSize": "538KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "63KB" },
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "63KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "66KB" },
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "66KB" },
{ "path": "./dist/clerk.legacy.browser.js", "maxSize": "105KB" },
{ "path": "./dist/clerk.no-rhc.js", "maxSize": "305KB" },
{ "path": "./dist/clerk.headless*.js", "maxSize": "65KB" },
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
import type {
OrganizationCreationAdvisorySeverity,
OrganizationCreationAdvisoryType,
OrganizationCreationDefaultsJSON,
OrganizationCreationDefaultsJSONSnapshot,
OrganizationCreationDefaultsResource,
} from '@clerk/shared/types';

import { BaseResource } from './internal';

export class OrganizationCreationDefaults extends BaseResource implements OrganizationCreationDefaultsResource {
advisory: {
code: OrganizationCreationAdvisoryType;
severity: OrganizationCreationAdvisorySeverity;
meta: Record<string, string>;
} | null = null;
form: {
name: string;
slug: string;
logo: string | null;
blurHash: string | null;
} = {
name: '',
slug: '',
logo: null,
blurHash: null,
};

public constructor(data: OrganizationCreationDefaultsJSON | OrganizationCreationDefaultsJSONSnapshot | null = null) {
super();
this.fromJSON(data);
}

protected fromJSON(data: OrganizationCreationDefaultsJSON | OrganizationCreationDefaultsJSONSnapshot | null): this {
if (!data) {
return this;
}

if (data.advisory) {
this.advisory = this.withDefault(data.advisory, this.advisory ?? null);
}

if (data.form) {
this.form.name = this.withDefault(data.form.name, this.form.name);
this.form.slug = this.withDefault(data.form.slug, this.form.slug);
this.form.logo = this.withDefault(data.form.logo, this.form.logo);
this.form.blurHash = this.withDefault(data.form.blur_hash, this.form.blurHash);
}

return this;
}

static async retrieve(): Promise<OrganizationCreationDefaultsResource> {
return await BaseResource._fetch({
path: '/me/organization_creation_defaults',
method: 'GET',
}).then(res => {
const data = res?.response as unknown as OrganizationCreationDefaultsJSON;
return new OrganizationCreationDefaults(data);
});
}
Comment on lines +53 to +61

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Unsafe type casting bypasses validation and could cause runtime errors.

Line 55 uses as unknown as OrganizationCreationDefaultsJSON to force-cast the API response without any validation. If the API returns malformed data or the response structure changes, this will bypass type safety and could cause runtime errors when the resource properties are accessed.

🔎 Proposed fix with runtime validation
 static async retrieve(): Promise<OrganizationCreationDefaultsResource> {
return await BaseResource._fetch({
path: '/me/organization_creation_defaults',
method: 'GET',
}).then(res => {
- const data = res?.response as unknown as OrganizationCreationDefaultsJSON;+ const data = res?.response;+ // Basic runtime validation+ if (!data || typeof data !== 'object') {+ throw new Error('Invalid organization creation defaults response');+ }
return new OrganizationCreationDefaults(data);
});
}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts around
lines 50 to 58, the code force-casts the API response using "as unknown as
OrganizationCreationDefaultsJSON" which bypasses runtime validation; replace the
cast with a proper runtime check: extract res.response, validate required fields
and types (either with a small type-guard function or an existing JSON/schema
validator), throw or return a clear error if validation fails, and only then
construct and return new OrganizationCreationDefaults(validatedData); do not use
"as unknown as" to silence type checking.


public __internal_toSnapshot(): OrganizationCreationDefaultsJSONSnapshot {
return {
advisory: this.advisory
? {
code: this.advisory.code,
meta: this.advisory.meta,
severity: this.advisory.severity,
}
: null,
form: {
name: this.form.name,
slug: this.form.slug,
logo: this.form.logo,
blur_hash: this.form.blurHash,
},
} as unknown as OrganizationCreationDefaultsJSONSnapshot;
}
Comment thread
LauraBeatris marked this conversation as resolved.
}
12 changes: 12 additions & 0 deletions packages/clerk-js/src/core/resources/OrganizationSettings.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,6 +23,11 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe
} = {
disabled: false,
};
organizationCreationDefaults: {
enabled: boolean;
} = {
enabled: false,
};
enabled: boolean = false;
maxAllowedMemberships: number = 1;
forceOrganizationSelection!: boolean;
Expand DownExpand Up@@ -51,6 +56,13 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe
this.slug.disabled = this.withDefault(data.slug.disabled, this.slug.disabled);
}

if (data.organization_creation_defaults) {
this.organizationCreationDefaults.enabled = this.withDefault(
data.organization_creation_defaults.enabled,
this.organizationCreationDefaults.enabled,
);
}

this.enabled = this.withDefault(data.enabled, this.enabled);
this.maxAllowedMemberships = this.withDefault(data.max_allowed_memberships, this.maxAllowedMemberships);
this.forceOrganizationSelection = this.withDefault(
Expand Down
3 changes: 3 additions & 0 deletions packages/clerk-js/src/core/resources/User.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,6 +53,7 @@ import {
UserOrganizationInvitation,
Web3Wallet,
} from './internal';
import { OrganizationCreationDefaults } from './OrganizationCreationDefaults';

export class User extends BaseResource implements UserResource {
pathRoot = '/me';
Expand DownExpand Up@@ -275,6 +276,8 @@ export class User extends BaseResource implements UserResource {
getOrganizationMemberships: GetOrganizationMemberships = retrieveMembership =>
OrganizationMembership.retrieve(retrieveMembership);

getOrganizationCreationDefaults = () => OrganizationCreationDefaults.retrieve();

leaveOrganization = async (organizationId: string): Promise<DeletedObjectResource> => {
const json = (
await BaseResource._fetch<DeletedObjectJSON>({
Expand Down
4 changes: 4 additions & 0 deletions packages/clerk-js/src/test/fixture-helpers.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -344,6 +344,9 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON)
const withOrganizationSlug = (enabled = false) => {
os.slug.disabled = !enabled;
};
const withOrganizationCreationDefaults = (enabled = false) => {
os.organization_creation_defaults.enabled = enabled;
};

const withOrganizationDomains = (modes?: OrganizationEnrollmentMode[], defaultRole?: string) => {
os.domains.enabled = true;
Expand All@@ -356,6 +359,7 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON)
withOrganizationDomains,
withForceOrganizationSelection,
withOrganizationSlug,
withOrganizationCreationDefaults,
};
};

Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/ar-SA.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -882,6 +882,10 @@ export const arSA: LocalizationResource = {
actionLink: 'تسجيل الخروج',
actionText: 'تم تسجيل الدخول كـ {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'توجد منظمة بالفعل لاسم الشركة المكتشف ({{organizationName}}) و {{organizationDomain}}. انضم عن طريق الدعوة.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/be-BY.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,10 @@ export const beBY: LocalizationResource = {
actionLink: 'Выйсці',
actionText: 'Увайшлі як {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Арганізацыя ўжо існуе для выяўленай назвы кампаніі ({{organizationName}}) і {{organizationDomain}}. Далучайцеся па запрашэнні.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/bg-BG.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -886,6 +886,10 @@ export const bgBG: LocalizationResource = {
actionLink: 'Изход',
actionText: 'Влязъл като {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Организация вече съществува за откритото име на компанията ({{organizationName}}) и {{organizationDomain}}. Присъединете се чрез покана.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/bn-IN.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,10 @@ export const bnIN: LocalizationResource = {
actionLink: 'সাইন আউট',
actionText: '{{identifier}} হিসাবে সাইন ইন করা হয়েছে',
},
alerts: {
organizationAlreadyExists:
'শনাক্ত করা কোম্পানির নাম ({{organizationName}}) এবং {{organizationDomain}}-এর জন্য একটি সংস্থা ইতিমধ্যেই বিদ্যমান। আমন্ত্রণের মাধ্যমে যোগ দিন।',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/ca-ES.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -885,6 +885,10 @@ export const caES: LocalizationResource = {
actionLink: 'Tancar sessió',
actionText: 'Sessió iniciada com a {{identifier}}',
},
alerts: {
organizationAlreadyExists:
"Ja existeix una organització per al nom d'empresa detectat ({{organizationName}}) i {{organizationDomain}}. Uneix-te per invitació.",
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/cs-CZ.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -896,6 +896,10 @@ export const csCZ: LocalizationResource = {
actionLink: 'Odhlásit se',
actionText: 'Přihlášen jako {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organizace již existuje pro detekovaný název společnosti ({{organizationName}}) a {{organizationDomain}}. Připojte se prostřednictvím pozvánky.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/da-DK.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -883,6 +883,10 @@ export const daDK: LocalizationResource = {
actionLink: 'Log ud',
actionText: 'Logget ind som {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Der findes allerede en organisation for det registrerede firmanavn ({{organizationName}}) og {{organizationDomain}}. Tilmeld dig via invitation.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/de-DE.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -901,6 +901,10 @@ export const deDE: LocalizationResource = {
actionLink: 'Abmelden',
actionText: 'Angemeldet als {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Für den erkannten Firmennamen ({{organizationName}}) und {{organizationDomain}} existiert bereits eine Organisation. Treten Sie per Einladung bei.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/el-GR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -888,6 +888,10 @@ export const elGR: LocalizationResource = {
actionLink: 'Αποσύνδεση',
actionText: 'Συνδεδεμένος ως {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Υπάρχει ήδη οργανισμός για το ανιχνευμένο όνομα εταιρείας ({{organizationName}}) και {{organizationDomain}}. Εγγραφείτε μέσω πρόσκλησης.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/en-GB.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const enGB: LocalizationResource = {
actionLink: 'Sign out',
actionText: 'Signed in as {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'An organisation already exists for the detected company name ({{organizationName}}) and {{organizationDomain}}. Join by invitation.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/en-US.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -884,6 +884,10 @@ export const enUS: LocalizationResource = {
actionLink: 'Sign out',
actionText: 'Signed in as {{identifier}}',
},
alerts: {
organizationAlreadyExists:
Comment thread
LauraBeatris marked this conversation as resolved.
'An organization already exists for the detected company name ({{organizationName}}) and {{organizationDomain}}. Join by invitation.',
},
},
taskResetPassword: {
formButtonPrimary: 'Reset Password',
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-CR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -893,6 +893,10 @@ export const esCR: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Conectado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-ES.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const esES: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Sesión iniciada como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-MX.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -894,6 +894,10 @@ export const esMX: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Registrado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-UY.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -893,6 +893,10 @@ export const esUY: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Logueado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fa-IR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -897,6 +897,10 @@ export const faIR: LocalizationResource = {
actionLink: 'خروج از همه حساب‌ها',
actionText: 'می‌خواهید خارج شوید؟',
},
alerts: {
organizationAlreadyExists:
'سازمانی برای نام شرکت شناسایی شده ({{organizationName}}) و {{organizationDomain}} از قبل وجود دارد. از طریق دعوتنامه بپیوندید.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fi-FI.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -886,6 +886,10 @@ export const fiFI: LocalizationResource = {
actionLink: 'Kirjaudu ulos',
actionText: 'Kirjautuneena käyttäjänä {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organisaatio on jo olemassa havaitulle yrityksen nimelle ({{organizationName}}) ja {{organizationDomain}}. Liity kutsulla.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fr-FR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -902,6 +902,10 @@ export const frFR: LocalizationResource = {
actionLink: 'Se déconnecter',
actionText: 'Connecté en tant que {{identifier}}',
},
alerts: {
organizationAlreadyExists:
"Une organisation existe déjà pour le nom d'entreprise détecté ({{organizationName}}) et {{organizationDomain}}. Rejoignez par invitation.",
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/he-IL.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -876,6 +876,10 @@ export const heIL: LocalizationResource = {
actionLink: 'התנתק',
actionText: 'מחובר כ-{{identifier}}',
},
alerts: {
organizationAlreadyExists:
'ארגון כבר קיים עבור שם החברה שזוהה ({{organizationName}}) ו-{{organizationDomain}}. הצטרף באמצעות הזמנה.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/hi-IN.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -891,6 +891,10 @@ export const hiIN: LocalizationResource = {
actionLink: 'साइन आउट',
actionText: '{{identifier}} के रूप में साइन इन किया गया',
},
alerts: {
organizationAlreadyExists:
'पता लगाई गई कंपनी के नाम ({{organizationName}}) और {{organizationDomain}} के लिए एक संगठन पहले से मौजूद है। आमंत्रण द्वारा शामिल हों।',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/hr-HR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const hrHR: LocalizationResource = {
actionLink: 'Odjavi se',
actionText: 'Prijavljen kao {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organizacija već postoji za otkriveni naziv tvrtke ({{organizationName}}) i {{organizationDomain}}. Pridružite se putem pozivnice.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
Loading
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/calm-maps-work.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
---
'@clerk/localizations': minor
'@clerk/clerk-js': minor
'@clerk/shared': minor
'@clerk/ui': minor
---

Surface organization creation defaults with prefilled form fields and advisory warnings
4 changes: 2 additions & 2 deletions packages/clerk-js/bundlewatch.config.json
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
{
"files": [
{ "path": "./dist/clerk.js", "maxSize": "538KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "63KB" },
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "63KB" },
{ "path": "./dist/clerk.browser.js", "maxSize": "66KB" },
{ "path": "./dist/clerk.chips.browser.js", "maxSize": "66KB" },
{ "path": "./dist/clerk.legacy.browser.js", "maxSize": "105KB" },
{ "path": "./dist/clerk.no-rhc.js", "maxSize": "305KB" },
{ "path": "./dist/clerk.headless*.js", "maxSize": "65KB" },
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
import type {
OrganizationCreationAdvisorySeverity,
OrganizationCreationAdvisoryType,
OrganizationCreationDefaultsJSON,
OrganizationCreationDefaultsJSONSnapshot,
OrganizationCreationDefaultsResource,
} from '@clerk/shared/types';

import { BaseResource } from './internal';

export class OrganizationCreationDefaults extends BaseResource implements OrganizationCreationDefaultsResource {
advisory: {
code: OrganizationCreationAdvisoryType;
severity: OrganizationCreationAdvisorySeverity;
meta: Record<string, string>;
} | null = null;
form: {
name: string;
slug: string;
logo: string | null;
blurHash: string | null;
} = {
name: '',
slug: '',
logo: null,
blurHash: null,
};

public constructor(data: OrganizationCreationDefaultsJSON | OrganizationCreationDefaultsJSONSnapshot | null = null) {
super();
this.fromJSON(data);
}

protected fromJSON(data: OrganizationCreationDefaultsJSON | OrganizationCreationDefaultsJSONSnapshot | null): this {
if (!data) {
return this;
}

if (data.advisory) {
this.advisory = this.withDefault(data.advisory, this.advisory ?? null);
}

if (data.form) {
this.form.name = this.withDefault(data.form.name, this.form.name);
this.form.slug = this.withDefault(data.form.slug, this.form.slug);
this.form.logo = this.withDefault(data.form.logo, this.form.logo);
this.form.blurHash = this.withDefault(data.form.blur_hash, this.form.blurHash);
}

return this;
}

static async retrieve(): Promise<OrganizationCreationDefaultsResource> {
return await BaseResource._fetch({
path: '/me/organization_creation_defaults',
method: 'GET',
}).then(res => {
const data = res?.response as unknown as OrganizationCreationDefaultsJSON;
return new OrganizationCreationDefaults(data);
});
}
Comment on lines +53 to +61

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Unsafe type casting bypasses validation and could cause runtime errors.

Line 55 uses as unknown as OrganizationCreationDefaultsJSON to force-cast the API response without any validation. If the API returns malformed data or the response structure changes, this will bypass type safety and could cause runtime errors when the resource properties are accessed.

🔎 Proposed fix with runtime validation
 static async retrieve(): Promise<OrganizationCreationDefaultsResource> {
return await BaseResource._fetch({
path: '/me/organization_creation_defaults',
method: 'GET',
}).then(res => {
- const data = res?.response as unknown as OrganizationCreationDefaultsJSON;+ const data = res?.response;+ // Basic runtime validation+ if (!data || typeof data !== 'object') {+ throw new Error('Invalid organization creation defaults response');+ }
return new OrganizationCreationDefaults(data);
});
}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts around
lines 50 to 58, the code force-casts the API response using "as unknown as
OrganizationCreationDefaultsJSON" which bypasses runtime validation; replace the
cast with a proper runtime check: extract res.response, validate required fields
and types (either with a small type-guard function or an existing JSON/schema
validator), throw or return a clear error if validation fails, and only then
construct and return new OrganizationCreationDefaults(validatedData); do not use
"as unknown as" to silence type checking.


public __internal_toSnapshot(): OrganizationCreationDefaultsJSONSnapshot {
return {
advisory: this.advisory
? {
code: this.advisory.code,
meta: this.advisory.meta,
severity: this.advisory.severity,
}
: null,
form: {
name: this.form.name,
slug: this.form.slug,
logo: this.form.logo,
blur_hash: this.form.blurHash,
},
} as unknown as OrganizationCreationDefaultsJSONSnapshot;
}
Comment thread
LauraBeatris marked this conversation as resolved.
}
12 changes: 12 additions & 0 deletions packages/clerk-js/src/core/resources/OrganizationSettings.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,6 +23,11 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe
} = {
disabled: false,
};
organizationCreationDefaults: {
enabled: boolean;
} = {
enabled: false,
};
enabled: boolean = false;
maxAllowedMemberships: number = 1;
forceOrganizationSelection!: boolean;
Expand DownExpand Up@@ -51,6 +56,13 @@ export class OrganizationSettings extends BaseResource implements OrganizationSe
this.slug.disabled = this.withDefault(data.slug.disabled, this.slug.disabled);
}

if (data.organization_creation_defaults) {
this.organizationCreationDefaults.enabled = this.withDefault(
data.organization_creation_defaults.enabled,
this.organizationCreationDefaults.enabled,
);
}

this.enabled = this.withDefault(data.enabled, this.enabled);
this.maxAllowedMemberships = this.withDefault(data.max_allowed_memberships, this.maxAllowedMemberships);
this.forceOrganizationSelection = this.withDefault(
Expand Down
3 changes: 3 additions & 0 deletions packages/clerk-js/src/core/resources/User.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,6 +53,7 @@ import {
UserOrganizationInvitation,
Web3Wallet,
} from './internal';
import { OrganizationCreationDefaults } from './OrganizationCreationDefaults';

export class User extends BaseResource implements UserResource {
pathRoot = '/me';
Expand DownExpand Up@@ -275,6 +276,8 @@ export class User extends BaseResource implements UserResource {
getOrganizationMemberships: GetOrganizationMemberships = retrieveMembership =>
OrganizationMembership.retrieve(retrieveMembership);

getOrganizationCreationDefaults = () => OrganizationCreationDefaults.retrieve();

leaveOrganization = async (organizationId: string): Promise<DeletedObjectResource> => {
const json = (
await BaseResource._fetch<DeletedObjectJSON>({
Expand Down
4 changes: 4 additions & 0 deletions packages/clerk-js/src/test/fixture-helpers.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -344,6 +344,9 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON)
const withOrganizationSlug = (enabled = false) => {
os.slug.disabled = !enabled;
};
const withOrganizationCreationDefaults = (enabled = false) => {
os.organization_creation_defaults.enabled = enabled;
};

const withOrganizationDomains = (modes?: OrganizationEnrollmentMode[], defaultRole?: string) => {
os.domains.enabled = true;
Expand All@@ -356,6 +359,7 @@ const createOrganizationSettingsFixtureHelpers = (environment: EnvironmentJSON)
withOrganizationDomains,
withForceOrganizationSelection,
withOrganizationSlug,
withOrganizationCreationDefaults,
};
};

Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/ar-SA.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -882,6 +882,10 @@ export const arSA: LocalizationResource = {
actionLink: 'تسجيل الخروج',
actionText: 'تم تسجيل الدخول كـ {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'توجد منظمة بالفعل لاسم الشركة المكتشف ({{organizationName}}) و {{organizationDomain}}. انضم عن طريق الدعوة.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/be-BY.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,10 @@ export const beBY: LocalizationResource = {
actionLink: 'Выйсці',
actionText: 'Увайшлі як {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Арганізацыя ўжо існуе для выяўленай назвы кампаніі ({{organizationName}}) і {{organizationDomain}}. Далучайцеся па запрашэнні.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/bg-BG.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -886,6 +886,10 @@ export const bgBG: LocalizationResource = {
actionLink: 'Изход',
actionText: 'Влязъл като {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Организация вече съществува за откритото име на компанията ({{organizationName}}) и {{organizationDomain}}. Присъединете се чрез покана.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/bn-IN.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,6 +890,10 @@ export const bnIN: LocalizationResource = {
actionLink: 'সাইন আউট',
actionText: '{{identifier}} হিসাবে সাইন ইন করা হয়েছে',
},
alerts: {
organizationAlreadyExists:
'শনাক্ত করা কোম্পানির নাম ({{organizationName}}) এবং {{organizationDomain}}-এর জন্য একটি সংস্থা ইতিমধ্যেই বিদ্যমান। আমন্ত্রণের মাধ্যমে যোগ দিন।',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/ca-ES.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -885,6 +885,10 @@ export const caES: LocalizationResource = {
actionLink: 'Tancar sessió',
actionText: 'Sessió iniciada com a {{identifier}}',
},
alerts: {
organizationAlreadyExists:
"Ja existeix una organització per al nom d'empresa detectat ({{organizationName}}) i {{organizationDomain}}. Uneix-te per invitació.",
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/cs-CZ.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -896,6 +896,10 @@ export const csCZ: LocalizationResource = {
actionLink: 'Odhlásit se',
actionText: 'Přihlášen jako {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organizace již existuje pro detekovaný název společnosti ({{organizationName}}) a {{organizationDomain}}. Připojte se prostřednictvím pozvánky.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/da-DK.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -883,6 +883,10 @@ export const daDK: LocalizationResource = {
actionLink: 'Log ud',
actionText: 'Logget ind som {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Der findes allerede en organisation for det registrerede firmanavn ({{organizationName}}) og {{organizationDomain}}. Tilmeld dig via invitation.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/de-DE.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -901,6 +901,10 @@ export const deDE: LocalizationResource = {
actionLink: 'Abmelden',
actionText: 'Angemeldet als {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Für den erkannten Firmennamen ({{organizationName}}) und {{organizationDomain}} existiert bereits eine Organisation. Treten Sie per Einladung bei.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/el-GR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -888,6 +888,10 @@ export const elGR: LocalizationResource = {
actionLink: 'Αποσύνδεση',
actionText: 'Συνδεδεμένος ως {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Υπάρχει ήδη οργανισμός για το ανιχνευμένο όνομα εταιρείας ({{organizationName}}) και {{organizationDomain}}. Εγγραφείτε μέσω πρόσκλησης.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/en-GB.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const enGB: LocalizationResource = {
actionLink: 'Sign out',
actionText: 'Signed in as {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'An organisation already exists for the detected company name ({{organizationName}}) and {{organizationDomain}}. Join by invitation.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/en-US.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -884,6 +884,10 @@ export const enUS: LocalizationResource = {
actionLink: 'Sign out',
actionText: 'Signed in as {{identifier}}',
},
alerts: {
organizationAlreadyExists:
Comment thread
LauraBeatris marked this conversation as resolved.
'An organization already exists for the detected company name ({{organizationName}}) and {{organizationDomain}}. Join by invitation.',
},
},
taskResetPassword: {
formButtonPrimary: 'Reset Password',
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-CR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -893,6 +893,10 @@ export const esCR: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Conectado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-ES.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const esES: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Sesión iniciada como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-MX.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -894,6 +894,10 @@ export const esMX: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Registrado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/es-UY.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -893,6 +893,10 @@ export const esUY: LocalizationResource = {
actionLink: 'Cerrar sesión',
actionText: 'Logueado como {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Ya existe una organización para el nombre de empresa detectado ({{organizationName}}) y {{organizationDomain}}. Únete por invitación.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fa-IR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -897,6 +897,10 @@ export const faIR: LocalizationResource = {
actionLink: 'خروج از همه حساب‌ها',
actionText: 'می‌خواهید خارج شوید؟',
},
alerts: {
organizationAlreadyExists:
'سازمانی برای نام شرکت شناسایی شده ({{organizationName}}) و {{organizationDomain}} از قبل وجود دارد. از طریق دعوتنامه بپیوندید.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fi-FI.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -886,6 +886,10 @@ export const fiFI: LocalizationResource = {
actionLink: 'Kirjaudu ulos',
actionText: 'Kirjautuneena käyttäjänä {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organisaatio on jo olemassa havaitulle yrityksen nimelle ({{organizationName}}) ja {{organizationDomain}}. Liity kutsulla.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/fr-FR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -902,6 +902,10 @@ export const frFR: LocalizationResource = {
actionLink: 'Se déconnecter',
actionText: 'Connecté en tant que {{identifier}}',
},
alerts: {
organizationAlreadyExists:
"Une organisation existe déjà pour le nom d'entreprise détecté ({{organizationName}}) et {{organizationDomain}}. Rejoignez par invitation.",
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/he-IL.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -876,6 +876,10 @@ export const heIL: LocalizationResource = {
actionLink: 'התנתק',
actionText: 'מחובר כ-{{identifier}}',
},
alerts: {
organizationAlreadyExists:
'ארגון כבר קיים עבור שם החברה שזוהה ({{organizationName}}) ו-{{organizationDomain}}. הצטרף באמצעות הזמנה.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/hi-IN.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -891,6 +891,10 @@ export const hiIN: LocalizationResource = {
actionLink: 'साइन आउट',
actionText: '{{identifier}} के रूप में साइन इन किया गया',
},
alerts: {
organizationAlreadyExists:
'पता लगाई गई कंपनी के नाम ({{organizationName}}) और {{organizationDomain}} के लिए एक संगठन पहले से मौजूद है। आमंत्रण द्वारा शामिल हों।',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
4 changes: 4 additions & 0 deletions packages/localizations/src/hr-HR.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,6 +887,10 @@ export const hrHR: LocalizationResource = {
actionLink: 'Odjavi se',
actionText: 'Prijavljen kao {{identifier}}',
},
alerts: {
organizationAlreadyExists:
'Organizacija već postoji za otkriveni naziv tvrtke ({{organizationName}}) i {{organizationDomain}}. Pridružite se putem pozivnice.',
},
},
taskResetPassword: {
formButtonPrimary: undefined,
Expand Down
Loading
Loading