@apolitical/component-library 4.5.10 → 4.6.0-4652.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- import { CardProps } from './../cards.types';
2
- declare const Card: ({ id, card, buildCardData, cta, gtmContext, className, handleCardClick, setFocus, }: CardProps) => import("react/jsx-runtime").JSX.Element;
1
+ import { type CardProps } from './../cards.types';
2
+ declare const Card: ({ id, card, buildCardData, buildMemberData, cta, gtmContext, className, handleCardClick, setFocus, }: CardProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default Card;
@@ -75,6 +75,7 @@ export interface MockCardType extends CardType {
75
75
  cardType?: string;
76
76
  }
77
77
  export type BuildCardDataType = (card: CardType | MockCardType, isLoggedIn?: boolean) => Promise<any>;
78
+ export type BuildMemberDataType = (communitySlug: string, userId?: string) => Promise<unknown>;
78
79
  export interface CardProps {
79
80
  /** A unique key for the card, used as a dependency in `useEffect` */
80
81
  id?: string;
@@ -82,6 +83,8 @@ export interface CardProps {
82
83
  card: CardType;
83
84
  /** A function to parse and build the card data - this is especially needed in carousels to hydrate the cards */
84
85
  buildCardData: BuildCardDataType;
86
+ /** A function to parse and build the member data */
87
+ buildMemberData?: BuildMemberDataType;
85
88
  /** An optional call to action to show on the card - this can behave differently to clicking elsewhere on the card */
86
89
  cta?: CardCTAType;
87
90
  /** Context for the Google Tag Manager event */
@@ -145,3 +148,13 @@ export interface IndividualCarouselProps extends BaseCarouselProps {
145
148
  /** The types for each card, from Contentful */
146
149
  cardTypes: CardContentType[];
147
150
  }
151
+ export type MemberType = {
152
+ count: number;
153
+ isMember: boolean;
154
+ memberType: string | null;
155
+ };
156
+ export interface IMemberData {
157
+ role?: string;
158
+ membersCount: number;
159
+ }
160
+ export declare function isMemberData(data: unknown): data is IMemberData;