Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(clerk-js,types,shared): Deprecate __unstable methods for organizations #1879

Merged
merged 2 commits into from
Oct 16, 2023
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
7 changes: 7 additions & 0 deletions .changeset/light-coats-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@clerk/clerk-js': patch
'@clerk/shared': patch
'@clerk/types': patch
---

Deprecate the `organization.__unstable__invitationUpdate` and `organization.__unstable__membershipUpdate` methods.
23 changes: 23 additions & 0 deletions packages/clerk-js/src/core/clerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,14 @@ export default class Clerk implements ClerkInterface {
#fapiClient: FapiClient;
#instanceType: InstanceType;
#isReady = false;

/**
* @deprecated Although this being a private field, this is a reminder to drop it with the next major release
*/
#lastOrganizationInvitation: OrganizationInvitationResource | null = null;
/**
* @deprecated Although this being a private field, this is a reminder to drop it with the next major release
*/
#lastOrganizationMember: OrganizationMembershipResource | null = null;
#listeners: Array<(emission: Resources) => void> = [];
#options: ClerkOptions = {};
Expand Down Expand Up @@ -1185,12 +1192,28 @@ export default class Clerk implements ClerkInterface {
this.#emit();
};

/**
* @deprecated This method will be dropped in the next major release.
* This method is only used in another deprecated part: `invitationList` from useOrganization
*/
__unstable__invitationUpdate(invitation: OrganizationInvitationResource) {
deprecated(
'__unstable__invitationUpdate',
'We are completely dropping this method as it was introduced for internal use only',
);
this.#lastOrganizationInvitation = invitation;
this.#emit();
}

/**
* @deprecated This method will be dropped in the next major release.
* This method is only used in another deprecated part: `membershipList` from useOrganization
*/
__unstable__membershipUpdate(membership: OrganizationMembershipResource) {
deprecated(
'__unstable__invitationUpdate',
dimkl marked this conversation as resolved.
Show resolved Hide resolved
'We are completely dropping this method as it was introduced for internal use only',
);
this.#lastOrganizationMember = membership;
this.#emit();
}
Expand Down
9 changes: 9 additions & 0 deletions packages/shared/src/hooks/contexts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,16 @@ const [SessionContext, useSessionContext] = createContextAndHook<ActiveSessionRe

type OrganizationContextProps = {
organization: OrganizationResource | null | undefined;

/**
* @deprecated This property will be dropped in the next major release.
* This property is only used in another deprecated part: `invitationList` from useOrganization
*/
lastOrganizationInvitation: OrganizationInvitationResource | null | undefined;
/**
* @deprecated This property will be dropped in the next major release.
* This property is only used in another deprecated part: `membershipList` from useOrganization
*/
lastOrganizationMember: OrganizationMembershipResource | null | undefined;
};
const [OrganizationContextInternal, useOrganizationContext] = createContextAndHook<{
Expand Down
8 changes: 8 additions & 0 deletions packages/types/src/clerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,15 @@ export interface Resources {
session?: ActiveSessionResource | null;
user?: UserResource | null;
organization?: OrganizationResource | null;
/**
* @deprecated This property will be dropped in the next major release.
* This property is only used in another deprecated part: `invitationList` from useOrganization
*/
lastOrganizationInvitation?: OrganizationInvitationResource | null;
/**
* @deprecated This property will be dropped in the next major release.
* This property is only used in another deprecated part: `membershipList` from useOrganization
*/
lastOrganizationMember?: OrganizationMembershipResource | null;
}

Expand Down
Loading