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
15 changes: 15 additions & 0 deletions .changeset/lazy-frogs-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"@clerk/astro": patch
---

Export `<CreateOrganization />` Astro component

Usage:

```astro
---
import { CreateOrganization } from '@clerk/astro/components'
---

<CreateOrganization />
```
1 change: 1 addition & 0 deletions packages/astro/src/astro-components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export { UserProfile } from './interactive/UserProfile';
export { OrganizationProfile } from './interactive/OrganizationProfile';
export { OrganizationSwitcher } from './interactive/OrganizationSwitcher';
export { default as OrganizationList } from './interactive/OrganizationList.astro';
export { default as CreateOrganization } from './interactive/CreateOrganization.astro';
export { default as GoogleOneTap } from './interactive/GoogleOneTap.astro';
export { default as Waitlist } from './interactive/Waitlist.astro';
export { default as PricingTable } from './interactive/PricingTable.astro';
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
import type { CreateOrganizationProps } from "@clerk/types";
type Props = CreateOrganizationProps

import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro'
---

<InternalUIComponentRenderer {...Astro.props} component="create-organization" />
10 changes: 6 additions & 4 deletions packages/astro/src/internal/mount-clerk-astro-js-components.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { Clerk } from '@clerk/types';

import { $clerk } from '../stores/internal';
import type { InternalUIComponentId } from '../types';

Expand All @@ -6,6 +8,7 @@ import type { InternalUIComponentId } from '../types';
*/
const mountAllClerkAstroJSComponents = () => {
const mountFns = {
'create-organization': 'mountCreateOrganization',
'organization-list': 'mountOrganizationList',
'organization-profile': 'mountOrganizationProfile',
'organization-switcher': 'mountOrganizationSwitcher',
Expand All @@ -16,14 +19,13 @@ const mountAllClerkAstroJSComponents = () => {
'google-one-tap': 'openGoogleOneTap',
waitlist: 'mountWaitlist',
'pricing-table': 'mountPricingTable',
} as const satisfies Record<InternalUIComponentId, string>;
} as const satisfies Record<InternalUIComponentId, keyof Clerk>;

Object.entries(mountFns).forEach(([category, mountFn]) => {
const elementsOfCategory = document.querySelectorAll(`[data-clerk-id^="clerk-${category}"]`);
elementsOfCategory.forEach(el => {
const clerkId = el.getAttribute('data-clerk-id');
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const props = window.__astro_clerk_component_props?.get(category)?.get(clerkId!);
const clerkId = el.getAttribute('data-clerk-id') as string;
const props = window.__astro_clerk_component_props?.get(category)?.get(clerkId);
if (el) {
$clerk.get()?.[mountFn](el as HTMLDivElement, props);
}
Expand Down
1 change: 1 addition & 0 deletions packages/astro/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export type ButtonProps<Tag> = {
export type InternalUIComponentId =
| 'sign-in'
| 'sign-up'
| 'create-organization'
| 'organization-list'
| 'organization-profile'
| 'organization-switcher'
Expand Down