From a9894b445bf1e463176b0442fb73c48f89d9fed8 Mon Sep 17 00:00:00 2001 From: panteliselef Date: Mon, 16 Oct 2023 09:29:00 +0100 Subject: [PATCH] chore(clerk-js,types,shared): Deprecate `__unstable` methods for organizations (#1879) * chore(clerk-js,types,shared): Deprecate `__unstable` methods for organizations * Update light-coats-brush.md --------- Co-authored-by: Nikos Douvlis --- .changeset/light-coats-brush.md | 7 +++++++ packages/clerk-js/src/core/clerk.ts | 23 +++++++++++++++++++++++ packages/shared/src/hooks/contexts.tsx | 9 +++++++++ packages/types/src/clerk.ts | 8 ++++++++ 4 files changed, 47 insertions(+) create mode 100644 .changeset/light-coats-brush.md diff --git a/.changeset/light-coats-brush.md b/.changeset/light-coats-brush.md new file mode 100644 index 0000000000..210bc27e38 --- /dev/null +++ b/.changeset/light-coats-brush.md @@ -0,0 +1,7 @@ +--- +'@clerk/clerk-js': patch +'@clerk/shared': patch +'@clerk/types': patch +--- + +Deprecate the `organization.__unstable__invitationUpdate` and `organization.__unstable__membershipUpdate` methods. diff --git a/packages/clerk-js/src/core/clerk.ts b/packages/clerk-js/src/core/clerk.ts index 0668c314d6..ba89e68754 100644 --- a/packages/clerk-js/src/core/clerk.ts +++ b/packages/clerk-js/src/core/clerk.ts @@ -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 = {}; @@ -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', + 'We are completely dropping this method as it was introduced for internal use only', + ); this.#lastOrganizationMember = membership; this.#emit(); } diff --git a/packages/shared/src/hooks/contexts.tsx b/packages/shared/src/hooks/contexts.tsx index d70c53f3e0..74c0aeb90a 100644 --- a/packages/shared/src/hooks/contexts.tsx +++ b/packages/shared/src/hooks/contexts.tsx @@ -25,7 +25,16 @@ const [SessionContext, useSessionContext] = createContextAndHook