From f86d8890bb51665d4873c87ead43b948fced80b8 Mon Sep 17 00:00:00 2001 From: panteliselef Date: Fri, 13 Oct 2023 18:48:25 +0300 Subject: [PATCH] chore(clerk-js,types,shared): Deprecate `__unstable` methods for organizations --- .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..b07c692564 --- /dev/null +++ b/.changeset/light-coats-brush.md @@ -0,0 +1,7 @@ +--- +'@clerk/clerk-js': patch +'@clerk/shared': patch +'@clerk/types': patch +--- + +Deprecate `__unstable` methods for organizations. 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