diff --git a/web/packages/hovercards/package.json b/web/packages/hovercards/package.json index d46f02b..a962b84 100644 --- a/web/packages/hovercards/package.json +++ b/web/packages/hovercards/package.json @@ -1,6 +1,6 @@ { "name": "@gravatar-com/hovercards", - "version": "0.10.0", + "version": "0.9.3", "description": "Add profile hovercards to Gravatar images.", "homepage": "https://github.com/Automattic/gravatar/blob/trunk/web/packages/hovercards#readme", "bugs": "https://github.com/Automattic/gravatar/issues", diff --git a/web/packages/hovercards/src/core.ts b/web/packages/hovercards/src/core.ts index f6aeadc..29892af 100644 --- a/web/packages/hovercards/src/core.ts +++ b/web/packages/hovercards/src/core.ts @@ -20,14 +20,14 @@ export interface VerifiedAccount { isHidden: boolean; } -export interface ContactInfo { - home_phone?: string; - work_phone?: string; - cell_phone?: string; - email?: string; - contact_form?: string; - calendar?: string; -} +export type ContactInfo = Partial< { + home_phone: string; + work_phone: string; + cell_phone: string; + email: string; + contact_form: string; + calendar: string; +} >; export interface PaymentLink { label: string; @@ -381,9 +381,7 @@ export default class Hovercards { href="${ isEditProfile ? 'https://gravatar.com/profiles/edit?utm_source=hovercard' : trackedProfileUrl }" target="_blank" > - - ${ isEditProfile ? __( i18n, 'Edit your profile →' ) : __( i18n, 'View profile →' ) } - + ${ isEditProfile ? __( i18n, 'Edit your profile →' ) : __( i18n, 'View profile →' ) } ${ contactsDrawer } @@ -392,9 +390,9 @@ export default class Hovercards { `; - const hovercardInner = hovercard.querySelector( '.gravatar-hovercard__inner' ); - const headerImageEl = hovercardInner.querySelector< HTMLElement >( '.gravatar-hovercard__header-image' ); - const profileColorEl = hovercardInner.querySelector< HTMLElement >( '.gravatar-hovercard__profile-color' ); + const hovercardInner = hovercard.querySelector< HTMLElement >( '.gravatar-hovercard__inner' ); + const headerImageEl = hovercardInner.querySelector< HTMLDivElement >( '.gravatar-hovercard__header-image' ); + const profileColorEl = hovercardInner.querySelector< HTMLDivElement >( '.gravatar-hovercard__profile-color' ); if ( headerImage && headerImageEl ) { headerImageEl.style.background = headerImage; @@ -434,10 +432,10 @@ export default class Hovercards { /** * Creates a hovercard drawer. * - * @param {string} id - The drawer id - * @param {string} titleText - The title shown at the drawer's header - * @param {string} content - The drawer inner content - * @return {string} - The drawer HTML string + * @param {string} id - The drawer id. + * @param {string} titleText - The title shown at the drawer's header. + * @param {string} content - The drawer inner content. + * @return {string} - The drawer HTML string. */ private static _createDrawer( id: string, titleText: string, content: string ): string { return ` @@ -445,7 +443,7 @@ export default class Hovercards {
-

${ titleText }

+

${ titleText }