Skip to content

Commit

Permalink
chore(clerk-js,types,shared): Deprecate __unstable methods for orga…
Browse files Browse the repository at this point in the history
…nizations (#1879)

* chore(clerk-js,types,shared): Deprecate `__unstable` methods for organizations

* Update light-coats-brush.md

---------

Co-authored-by: Nikos Douvlis <nikosdouvlis@gmail.com>
  • Loading branch information
panteliselef and nikosdouvlis committed Oct 16, 2023
1 parent cc9c483 commit a9894b4
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .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.
23 changes: 23 additions & 0 deletions packages/clerk-js/src/core/clerk.ts
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',
'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
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
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

0 comments on commit a9894b4

Please sign in to comment.