New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-linkedinbadge

Package Overview
Dependencies
Maintainers
0
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-linkedinbadge - npm Package Compare versions

Comparing version 5.26.2025 to 5.27.2025

33

lib/index.d.ts

@@ -1,2 +0,2 @@

import React, { FC } from "react";
import React from "react";
/**

@@ -86,2 +86,6 @@ * @param {string} [locale="en_US"] - The locale to use for the badge. Defaults to `"en_US"`.

/**
* Only implemented for the self-rendering method (e.g. when pure is set to `false`), will useQuery instead of a default fetch call to get the profile data.
*/
useQueryToFetch: boolean;
/**
* Optional, the script that is used to render the badge. This is only used when `useLinkedInApiUrlPure` is set to `true`, which uses linkedin's rendering method.

@@ -115,27 +119,4 @@ */

};
/**
* React component that renders a LinkedIn badge on a website.
* @param {LinkedInBadgeProps} props - The props for the LinkedIn badge component, such as the locale, size, theme, type, entity, vanity, version, className, style, children, id, script_src, useLinkedInApiUrlPure, name, debug, and generateUidWithoutApi. See LinkedInBadgeProps for more details.
* @returns {React.ReactElement} The rendered LinkedIn badge component.
* @description This implementation uses two React components - LinkedInBadge and LIRenderAll.
* LinkedInBadge is the parent component responsible for
* rendering the container and basic structure of the LinkedIn badge,
* while LIRenderAll is a child component that handles
* the rendering and management of the actual badge content.
* @argument The reason for this separation is that the badge content needs to be loaded asynchronously from a server, and the LIRenderAll component is responsible for making the necessary requests and handling the responses. By separating the concerns, the parent component can render the initial structure, and the child component can take care of the dynamic badge content.
* @example
* ```tsx
* <LinkedInBadge
* locale="en_US"
* size="medium"
* theme="light"
* type="VERTICAL"
* entity="PROFILE"
* vanity="☯liu"
* version="v1"
* />
* ```
*/
declare const LinkedInBadge: FC<Partial<LinkedInBadgeProps>>;
export default LinkedInBadge;
declare const _default: React.NamedExoticComponent<Partial<LinkedInBadgeProps>>;
export default _default;
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,2 @@

import React from "react";
import React, { memo } from "react";
import LinkedInBadgeSelfRender from "./LinkedInBadgeSelfRender";

@@ -40,2 +40,3 @@ import LIRender from "./LIRender";

const noCache = props.noCache || false;
const useQueryToFetch = props?.useQueryToFetch ?? false;
const url = `https://www.linkedin.com/in/${vanityEncoded}?trk=profile-badge`;

@@ -61,4 +62,4 @@ const [componentDidMount, setComponentDidMount] = React.useState(false);

React.createElement("a", { className: "badge-base__link LI-simple-link", target: "_blank", rel: "noopener noreferrer", href: url }, name),
componentDidMount && (React.createElement(LIRender, { vanity: vanity, locale: locale, size: size, theme: theme, type: type, entity: entity, version: version, isCreatePage: false, debug: props.debug, cleanUp: props.cleanUp })))) : (React.createElement(LinkedInBadgeSelfRender, { locale: locale, size: size, style: props.style, entity: entity, theme: theme, type: type, vanity: vanity, noCache: noCache, version: version, className: props.className, generateUidWithoutApi: generateUidWithoutApi, hideViewProfileButton: props.hideViewProfileButton, id: props.id, debug: props.debug, name: name, isCreatePage: false }, props.children));
componentDidMount && (React.createElement(LIRender, { vanity: vanity, locale: locale, size: size, theme: theme, type: type, entity: entity, version: version, isCreatePage: false, debug: props.debug, cleanUp: props.cleanUp })))) : (React.createElement(LinkedInBadgeSelfRender, { locale: locale, size: size, style: props.style, entity: entity, theme: theme, type: type, vanity: vanity, noCache: noCache, version: version, className: props.className, generateUidWithoutApi: generateUidWithoutApi, hideViewProfileButton: props.hideViewProfileButton, id: props.id, debug: props.debug, name: name, fetchViaReactQuery: useQueryToFetch, isCreatePage: false }, props.children));
};
export default LinkedInBadge;
export default memo(LinkedInBadge);
/* react-linkedinbadge */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactScriptTag={},e.React)}(this,(function(e,t){"use strict";async function n(e,t=!1){const n=Object.keys(e),o=window.location.hostname,a=window.location.pathname,i=window.location.search;let r=0;for(let t=0;t<n.length;t++){const o=e[n[t]];if(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.charCodeAt(e)}if(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.charCodeAt(e);if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)r=(r<<5)-r+a.charCodeAt(e);if(i&&"string"==typeof i)for(let e=0;e<i.length;e++)r=(r<<5)-r+i.charCodeAt(e);if(!1===t){const e=await(async()=>new Promise(((e,t)=>{fetch("https://api.ipify.org?format=json").then((e=>e.json())).then((t=>e(t.ip))).catch((t=>e(null)))})))();if(e&&"string"==typeof e)for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t)}return r=(r<<5)-r+Date.now(),r>>>=0,r.toString()}const o=({theme:e="light",style:n})=>t.createElement("i",{className:"profile-badge__header-logo-icon profile-badge__header-logo-icon--"+("light"===e?"light":"dark"),style:{width:"84px",height:"21px",display:"inline-block",fill:"light"===e?"#0a66c2":"#fff",color:"light"===e?"#0a66c2":"#fff",...n},"aria-hidden":"true"},t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 84 21",preserveAspectRatio:"xMinYMin meet",version:"1.1",focusable:"false"},t.createElement("g",{className:"inbug",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd"},t.createElement("path",{d:"M19.479,0 L1.583,0 C0.727,0 0,0.677 0,1.511 L0,19.488 C0,20.323 0.477,21 1.333,21 L19.229,21 C20.086,21 21,20.323 21,19.488 L21,1.511 C21,0.677 20.336,0 19.479,0",className:"bug-text-color",transform:"translate(63.000000, 0.000000)"}),t.createElement("path",{d:"M82.479,0 L64.583,0 C63.727,0 63,0.677 63,1.511 L63,19.488 C63,20.323 63.477,21 64.333,21 L82.229,21 C83.086,21 84,20.323 84,19.488 L84,1.511 C84,0.677 83.336,0 82.479,0 Z M71,8 L73.827,8 L73.827,9.441 L73.858,9.441 C74.289,8.664 75.562,7.875 77.136,7.875 C80.157,7.875 81,9.479 81,12.45 L81,18 L78,18 L78,12.997 C78,11.667 77.469,10.5 76.227,10.5 C74.719,10.5 74,11.521 74,13.197 L74,18 L71,18 L71,8 Z M66,18 L69,18 L69,8 L66,8 L66,18 Z M69.375,4.5 C69.375,5.536 68.536,6.375 67.5,6.375 C66.464,6.375 65.625,5.536 65.625,4.5 C65.625,3.464 66.464,2.625 67.5,2.625 C68.536,2.625 69.375,3.464 69.375,4.5 Z",className:"background",fill:"currentColor"})),t.createElement("g",{className:"linkedin-text"},t.createElement("path",{d:"M60,18 L57.2,18 L57.2,16.809 L57.17,16.809 C56.547,17.531 55.465,18.125 53.631,18.125 C51.131,18.125 48.978,16.244 48.978,13.011 C48.978,9.931 51.1,7.875 53.725,7.875 C55.35,7.875 56.359,8.453 56.97,9.191 L57,9.191 L57,3 L60,3 L60,18 Z M54.479,10.125 C52.764,10.125 51.8,11.348 51.8,12.974 C51.8,14.601 52.764,15.875 54.479,15.875 C56.196,15.875 57.2,14.634 57.2,12.974 C57.2,11.268 56.196,10.125 54.479,10.125 L54.479,10.125 Z",fill:"currentColor"}),t.createElement("path",{d:"M47.6611,16.3889 C46.9531,17.3059 45.4951,18.1249 43.1411,18.1249 C40.0001,18.1249 38.0001,16.0459 38.0001,12.7779 C38.0001,9.8749 39.8121,7.8749 43.2291,7.8749 C46.1801,7.8749 48.0001,9.8129 48.0001,13.2219 C48.0001,13.5629 47.9451,13.8999 47.9451,13.8999 L40.8311,13.8999 L40.8481,14.2089 C41.0451,15.0709 41.6961,16.1249 43.1901,16.1249 C44.4941,16.1249 45.3881,15.4239 45.7921,14.8749 L47.6611,16.3889 Z M45.1131,11.9999 C45.1331,10.9449 44.3591,9.8749 43.1391,9.8749 C41.6871,9.8749 40.9121,11.0089 40.8311,11.9999 L45.1131,11.9999 Z",fill:"currentColor"}),t.createElement("polygon",{fill:"currentColor",points:"38 8 34.5 8 31 12 31 3 28 3 28 18 31 18 31 13 34.699 18 38.241 18 34 12.533"}),t.createElement("path",{d:"M16,8 L18.827,8 L18.827,9.441 L18.858,9.441 C19.289,8.664 20.562,7.875 22.136,7.875 C25.157,7.875 26,9.792 26,12.45 L26,18 L23,18 L23,12.997 C23,11.525 22.469,10.5 21.227,10.5 C19.719,10.5 19,11.694 19,13.197 L19,18 L16,18 L16,8 Z",fill:"currentColor"}),t.createElement("path",{d:"M11,18 L14,18 L14,8 L11,8 L11,18 Z M12.501,6.3 C13.495,6.3 14.3,5.494 14.3,4.5 C14.3,3.506 13.495,2.7 12.501,2.7 C11.508,2.7 10.7,3.506 10.7,4.5 C10.7,5.494 11.508,6.3 12.501,6.3 Z",fill:"currentColor"}),t.createElement("polygon",{fill:"currentColor",points:"3 3 0 3 0 18 9 18 9 15 3 15"}))));var a=t.memo((({locale:e="en_US",size:a="medium",style:i,theme:r="light",vanity:l="☯liu",version:c="v1",className:d,type:s="VERTICAL",entity:p="PROFILE",children:f,generateUidWithoutApi:m=!1,hideViewProfileButton:g=!1,id:h,TRACKING_PARAM:u="public-profile-badge",isCreatePage:b=!1,name:y="",noCache:C=!1,debug:w=!1})=>{const[$,v]=t.useState(null),[L,k]=t.useState(null);t.useEffect((()=>{const t=()=>{n({locale:e,size:a,theme:r,type:s,vanity:l,version:c,entity:p,generateUidWithoutApi:m,hideViewProfileButton:g,TRACKING_PARAM:u,isCreatePage:b}).then((t=>{t!==L&&null!==t&&k(t);const n={badgetype:encodeURIComponent(s||"VERTICAL"),badgetheme:encodeURIComponent(r||"light"),locale:e||"en_US",uid:t||`${f||(new Date).getTime()}`,version:encodeURIComponent(c||"v1")};"v2"===c?(n.badgesize=a||"medium",n.entity=p||"PROFILE"):(n.maxsize=encodeURIComponent(a||"medium"),n.trk=u,n.vanityname=encodeURIComponent(l||"☯liu")),b&&(n.fromCreate="true"),b&&(n.fromCreate="true");const o=new XMLHttpRequest,i="https://ziping.liu.academy/api/v2/linkedin/profile/";console.info(`profileData: ${$}, uidNew: ${t}`),null===$&&null!==t&&(o.open("POST",i,!0),o.setRequestHeader("Content-Type","application/json"),o.onreadystatechange=function(){if(4===o.readyState&&200===o.status){console.info(`xmlnew.responseText: ${o.responseText}`);const t=JSON.parse(o.responseText);let n=t.profileHeadline;n=n.replace(/\\u([\dA-Fa-f]{4})/g,((e,t)=>String.fromCodePoint(parseInt(t,16)))),n=n.replace(/&amp;/g,"&"),console.info(`new headlineText: ${n}`),console.info(`old headlineText: ${t.profileHeadline}`),t.profileHeadline=n,w&&console.info(`Retrieved profile badge info for vanity ${l} via API and saving to local storage: `,`'cachedProfileData-${l}-${e}-${a}-${r}-${s}-${p}'`,"profile data",`${Object.keys(t).toString()}`),v(t),localStorage.setItem(`cachedProfileData-${l}-${e}-${a}-${r}-${s}-${p}`,JSON.stringify(t)),localStorage.setItem(`cachedProfileData-${l}-${e}-${a}-${r}-${s}-${p}-lastUpdated`,(new Date).getTime().toString())}},w&&console.info(`Fetching profile badge info now for vanity ${l} via API: `,`'${i}'`,"payloadBodyParams",`${Object.keys(n).toString()}`),o.send(JSON.stringify(n)))}))},o=localStorage.getItem(`cachedProfileData-${l}-${e}-${a}-${r}-${s}-${p}`),i=localStorage.getItem(`cachedProfileData-${l}-${e}-${a}-${r}-${s}-${p}-lastUpdated`),d=(new Date).getTime(),f=parseInt(i||"0",10),h=(d-f)/36e5,y=o&&!o.includes("profileName")||!o||!i||h>48;w&&console.info("cachedProfileData",o,"lastUpdated",i,"isOutDatedOrNotThere",y,"timeDiffInHours",h),C||y?(w&&console.info("Fetching data from API","cachProfileData",o,"lastUpdated",i,"cachedProfileData",o),t()):(w&&console.info("Fetching data from cache linkedinbadge","cachProfileData",o,"lastUpdated",i),v(JSON.parse(o)))}),[e,a,r,s,l,c,p,m,g,u,b,C,w]);const E=t.useMemo((()=>({medium:{VERTICAL:"250",HORIZONTAL:"280"},large:{VERTICAL:"300",HORIZONTAL:"330"}}[a][s])),[a,s]);return t.createElement("div",{id:h,style:i,className:"profile-badge-reacted"+(d?` ${d}`:"")},t.createElement("div",{className:`profile-badge profile-badge--width-${E} profile-badge--`+("light"===r?"light":"dark"),lang:e?.replace(/_[A-Za-z]+$/,"")||"en",dir:"ltr"},t.createElement("div",{className:"profile-badge__header profile-badge__header--"+("light"===r?"light":"dark")},t.createElement("span",{className:"sr-only"},"LinkedIn"),t.createElement(o,{theme:r})),t.createElement("div",{className:"profile-badge__content"},$?.profileImageSrc?t.createElement("img",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",title:$?.profileName,alt:$?.profileName,src:$?.profileImageSrc}):t.createElement("figure",{title:$?.profileName},t.createElement("svg",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 128 128",id:"person-accent-4"},t.createElement("path",{fill:"#e7e2dc",d:"M0 0h128v128H0z"}),t.createElement("path",{d:"M88.41 84.67a32 32 0 10-48.82 0 66.13 66.13 0 0148.82 0z",fill:"#788fa5"}),t.createElement("path",{d:"M88.41 84.67a32 32 0 01-48.82 0A66.79 66.79 0 000 128h128a66.79 66.79 0 00-39.59-43.33z",fill:"#9db3c8"}),t.createElement("path",{d:"M64 96a31.93 31.93 0 0024.41-11.33 66.13 66.13 0 00-48.82 0A31.93 31.93 0 0064 96z",fill:"#56687a"}))),t.createElement("h3",{className:"profile-badge__content-profile-name",itemProp:"name"},$?.profileName&&t.createElement("a",{className:"profile-badge__content-profile-name-link profile-badge__content-profile-name-link--"+("light"===r?"light":"dark"),href:$?.profileNameLink||"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name","data-tracking-control-name":"public-profile-badge-profile-badge-profile-name","data-tracking-will-navigate":""},$?.profileName&&t.createElement(t.Fragment,null,$?.profileName))),$?.profileHeadline&&t.createElement("h4",{className:"profile-badge__content-profile-headline"},$?.profileHeadline),$?.profileCompanyOrSchool&&t.createElement("h4",{className:"profile-badge__content-profile-company-school-info"},$?.profileCompanyOrSchool&&Array.isArray($?.profileCompanyOrSchool)&&$?.profileCompanyOrSchool.map(((e,n)=>t.createElement("span",{key:`${L}-company-school-${n}`},t.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:e.href,className:"profile-badge__content-profile-company-school-info-link profile-badge__content-profile-company-school-info-link--"+("light"===r?"light":"dark"),"data-tracking-control-name":"public-profile-badge-profile-badge_school-name","data-tracking-will-navigate":"true"},e.text)," ",n!==$?.profileCompanyOrSchool.length-1?" | ":""," "))))),f,!1===g&&null!==$&&t.createElement("a",{className:"profile-badge__cta-btn profile-badge__cta-btn--"+("light"===r?"light":"dark"),rel:"noopener noreferrer",href:$?.profileViewLink||`https://www.linkedin.com/in/${encodeURIComponent(l||"☯liu")}?trk=public-profile-badge-profile-badge-profile-cta`,target:"_blank","data-tracking-control-name":"public-profile-badge-profile-badge-view-profile-cta","data-tracking-will-navigate":""},"View profile"),null===$&&t.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",key:`${L}-view-profile-no-data`,href:""+(l?`https://www.linkedin.com/in/${l}?trk=profile-badge`:"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name")},y)))}));var i=t.memo((({CALLBACK_NAME:e="LIBadgeCallback",BADGE_NAMES:n=".LI-profile-badge, .LI-entity-badge",TRACKING_PARAM:o="profile-badge",size:a="medium",locale:i="en_US",type:r="vertical",theme:l="light",vanity:c="ziping-liu-1932a029a",version:d="v2",entity:s="profile",isEI:p=!1,isCreatePage:f=!1,debug:m=!0,cleanUp:g=!1})=>{const h=`${n}${[{type:r},{theme:l},{size:a},{locale:i},{version:d},{entity:s},{vanity:c}].map((e=>Object.entries(e).map((([e,t])=>`[data-${e}="${t}"]`)).join(""))).join("")}`,u=document.querySelector(h),b=t.useRef(u);return t.useEffect((()=>{b.current=u}),[u]),t.useEffect((()=>{let t=0,n=0;const b=[],y={};m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`Using query selector: ${h} to find badge element for badge with type: ${r}, theme: ${l}, size: ${a}, locale: ${i}, version: ${d}, entity: ${s}`);const C=(e,t)=>{if(((e,t)=>w(e)&&!y[e.src]&&(!t||t&&!e.getAttribute("data-isartdeco")))(e,t))e.parentNode&&e.parentNode.replaceChild&&e.parentNode.replaceChild($(e),e),y[e.src]=!0;else{const n=Array.from(e.childNodes);for(let e=0;e<n.length;e++)C(n[e],t)}},w=e=>"SCRIPT"===e.tagName,$=e=>{const t=document.createElement("script"),n=Array.from(e.attributes);for(const e of n)t.setAttribute(e.name,e.value);return t},v=(e=!1)=>{const t=e?"https://badges.linkedin-ei":"https://badges.linkedin";return(()=>{if("undefined"!=typeof window){const e=window.location?.hostname||"";return/linkedin(-ei)?.cn$/.test(e)}return!1})()?t+".cn/":t+".com/"},L=(e,t="medium",n="en_US",o="vertical",a="light",i="ziping-liu-1932a029a",r="v2",l="profile",c=!1,d=!1,s="profile-badge",p=!1)=>{const f=e=>{let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t},m=(new Date).getTime()+f(n)+f(o)+f(a)+f(i)+f(r)+f(l)+f(c?"ei":"")+f(d?"create":"")+f(t);let g=v(c),h=["locale="+encodeURIComponent(n),"badgetype="+encodeURIComponent(o),"badgetheme="+encodeURIComponent(a),"uid="+encodeURIComponent(m),"version="+encodeURIComponent(r)];"v2"===r?(g+="view",h.push("badgesize="+encodeURIComponent(t)),h.push("entity="+encodeURIComponent(l)),h=h.concat((e=>Array.from(e.attributes).filter((e=>e.name.startsWith("data-key-"))).map((e=>encodeURIComponent(e.name.replace("data-","").toLowerCase())+"="+encodeURIComponent(e.value))))(e))):(g+="profile",h.push("maxsize="+encodeURIComponent(t)),h.push("trk="+encodeURIComponent(s)),h.push("vanityname="+encodeURIComponent(i))),d&&h.push("fromCreate=true");const u=g+"?"+h.join("&");e.setAttribute("data-uid",String(m)),(e=>{const t=document.createElement("script");t.src=e,b.push(t),document.body.appendChild(t)})(u)};u&&(t++,u.setAttribute("data-rendered","true"),L(u,a,i,r,l,c,d,s,p,f,o,g));const k=e=>{n++;const t=`<body>${e}</body>`,o=document.createElement("iframe"),a=e.match(/class="profile-badge__cta-btn profile-badge__cta-btn--light" href="([^"]*)"/);m&&console.info("%cresponseHandler - matching for url:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`match: ${a?.[1]}`);const i=a?.[1].match(/\/in\/([^\/]*)\?.*/),r=document.querySelector(`[data-vanity="${i?.[1]}"]`);m&&(console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`matchVanityInUrl: ${i?.[1]}`),console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`matchVanityInUrl: ${i?.[1]}`),console.info("%cresponseHandler - matching for badge query:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`badgeVanityQuery: ${r?.innerHTML}`)),o.onload=function(){if(o.contentWindow){const e=o.contentWindow.document.body;o.setAttribute("height",`${(e.scrollHeight||300)+5}`),o.setAttribute("width",`${(e.scrollWidth||330)+5}`)}},o.setAttribute("frameBorder","0"),o.style.display="block",r?(m&&console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`vanity found in query: ${r?.getAttribute("data-vanity")}`),r?.appendChild(o)):u?.appendChild(o),o.contentWindow&&(o.contentWindow.document.open(),o.contentWindow.document.write(t),o.contentWindow.document.close()),C(u,f),m&&console.info("%cresponseHandler - LIRenderAll:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`appending badge to iframe: ${t}, badge: ${u?.getAttribute("data-vanity")}, badge:\n`,u),E()};window[e]=k;const E=()=>{m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`at tryClean: expectedResponses: ${t}, responsesReceived: ${n}`),g&&t>0&&(n>=t||n>=1)?(m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;","cleaning up due to responses check passed, expectedResponses > 0 && (responsesReceived >= expectedResponses || responsesReceived >= 1)"),delete window[e],b.forEach((e=>document.body.removeChild(e)))):m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`not cleaning up due to responses check failed, expectedResponses > 0 && (responsesReceived >= expectedResponses || responsesReceived >= 1), cleanUp = ${g}`)};return()=>{b.forEach((e=>{document.body.contains(e)&&document.body.removeChild(e)})),window[e]===k&&delete window[e]}}),[e,n,o,a,i,r,l,c,d,s,p,f,m,g]),null}));e.default=e=>{const n=e.locale||"en_US",o=e.size||"medium",r=e.theme||"light",l=e.generateUidWithoutApi||!1,c=e.type||"VERTICAL",d=e.entity||"PROFILE",s=e.vanity||"☯liu",p=e.version||"v1",f=e.useLinkedInApiUrlPure||!1,m=encodeURIComponent(s),g=e.name||"",h=e.noCache||!1,u=`https://www.linkedin.com/in/${m}?trk=profile-badge`,[b,y]=t.useState(!1);return t.useEffect((()=>{b||(((t,n,o)=>{if(e.debug){const e=(new Date).toLocaleTimeString();console.log(`[${e}] ${n} - ${o}: ${t}`)}})("checking if div is rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),!1===b&&y(!0))}),[b,e.debug]),!0===f?t.createElement("div",{className:"badge-base LI-profile-badge"+(e.className?` ${e.className}`:""),style:e.style,"data-locale":n,"data-size":o,"data-theme":r,"data-type":c,"data-vanity":s,"data-version":p,"data-rendered":"false",id:e.id},t.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:u},g),b&&t.createElement(i,{vanity:s,locale:n,size:o,theme:r,type:c,entity:d,version:p,isCreatePage:!1,debug:e.debug,cleanUp:e.cleanUp})):t.createElement(a,{locale:n,size:o,style:e.style,entity:d,theme:r,type:c,vanity:s,noCache:h,version:p,className:e.className,generateUidWithoutApi:l,hideViewProfileButton:e.hideViewProfileButton,id:e.id,debug:e.debug,name:g,isCreatePage:!1},e.children)},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-query")):"function"==typeof define&&define.amd?define(["exports","react","react-query"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactScriptTag={},e.React,e.reactQuery)}(this,(function(e,t,n){"use strict";async function o(e,t=!1){const n=Object.keys(e),o=window.location.hostname,a=window.location.pathname,i=window.location.search;let r=0;for(let t=0;t<n.length;t++){const o=e[n[t]];if(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.charCodeAt(e)}if(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.charCodeAt(e);if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)r=(r<<5)-r+a.charCodeAt(e);if(i&&"string"==typeof i)for(let e=0;e<i.length;e++)r=(r<<5)-r+i.charCodeAt(e);if(!1===t){const e=await(async()=>new Promise(((e,t)=>{fetch("https://api.ipify.org?format=json").then((e=>e.json())).then((t=>e(t.ip))).catch((t=>e(null)))})))();if(e&&"string"==typeof e)for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t)}return r=(r<<5)-r+Date.now(),r>>>=0,r.toString()}const a=({theme:e="light",style:n})=>t.createElement("i",{className:"profile-badge__header-logo-icon profile-badge__header-logo-icon--"+("light"===e?"light":"dark"),style:{width:"84px",height:"21px",display:"inline-block",fill:"light"===e?"#0a66c2":"#fff",color:"light"===e?"#0a66c2":"#fff",...n},"aria-hidden":"true","aria-label":"LinkedIn"},t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 84 21",preserveAspectRatio:"xMinYMin meet",version:"1.1",focusable:"false"},t.createElement("g",{className:"inbug",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd"},t.createElement("path",{d:"M19.479,0 L1.583,0 C0.727,0 0,0.677 0,1.511 L0,19.488 C0,20.323 0.477,21 1.333,21 L19.229,21 C20.086,21 21,20.323 21,19.488 L21,1.511 C21,0.677 20.336,0 19.479,0",className:"bug-text-color",transform:"translate(63.000000, 0.000000)"}),t.createElement("path",{d:"M82.479,0 L64.583,0 C63.727,0 63,0.677 63,1.511 L63,19.488 C63,20.323 63.477,21 64.333,21 L82.229,21 C83.086,21 84,20.323 84,19.488 L84,1.511 C84,0.677 83.336,0 82.479,0 Z M71,8 L73.827,8 L73.827,9.441 L73.858,9.441 C74.289,8.664 75.562,7.875 77.136,7.875 C80.157,7.875 81,9.479 81,12.45 L81,18 L78,18 L78,12.997 C78,11.667 77.469,10.5 76.227,10.5 C74.719,10.5 74,11.521 74,13.197 L74,18 L71,18 L71,8 Z M66,18 L69,18 L69,8 L66,8 L66,18 Z M69.375,4.5 C69.375,5.536 68.536,6.375 67.5,6.375 C66.464,6.375 65.625,5.536 65.625,4.5 C65.625,3.464 66.464,2.625 67.5,2.625 C68.536,2.625 69.375,3.464 69.375,4.5 Z",className:"background",fill:"currentColor"})),t.createElement("g",{className:"linkedin-text"},t.createElement("path",{d:"M60,18 L57.2,18 L57.2,16.809 L57.17,16.809 C56.547,17.531 55.465,18.125 53.631,18.125 C51.131,18.125 48.978,16.244 48.978,13.011 C48.978,9.931 51.1,7.875 53.725,7.875 C55.35,7.875 56.359,8.453 56.97,9.191 L57,9.191 L57,3 L60,3 L60,18 Z M54.479,10.125 C52.764,10.125 51.8,11.348 51.8,12.974 C51.8,14.601 52.764,15.875 54.479,15.875 C56.196,15.875 57.2,14.634 57.2,12.974 C57.2,11.268 56.196,10.125 54.479,10.125 L54.479,10.125 Z",fill:"currentColor"}),t.createElement("path",{d:"M47.6611,16.3889 C46.9531,17.3059 45.4951,18.1249 43.1411,18.1249 C40.0001,18.1249 38.0001,16.0459 38.0001,12.7779 C38.0001,9.8749 39.8121,7.8749 43.2291,7.8749 C46.1801,7.8749 48.0001,9.8129 48.0001,13.2219 C48.0001,13.5629 47.9451,13.8999 47.9451,13.8999 L40.8311,13.8999 L40.8481,14.2089 C41.0451,15.0709 41.6961,16.1249 43.1901,16.1249 C44.4941,16.1249 45.3881,15.4239 45.7921,14.8749 L47.6611,16.3889 Z M45.1131,11.9999 C45.1331,10.9449 44.3591,9.8749 43.1391,9.8749 C41.6871,9.8749 40.9121,11.0089 40.8311,11.9999 L45.1131,11.9999 Z",fill:"currentColor"}),t.createElement("polygon",{fill:"currentColor",points:"38 8 34.5 8 31 12 31 3 28 3 28 18 31 18 31 13 34.699 18 38.241 18 34 12.533"}),t.createElement("path",{d:"M16,8 L18.827,8 L18.827,9.441 L18.858,9.441 C19.289,8.664 20.562,7.875 22.136,7.875 C25.157,7.875 26,9.792 26,12.45 L26,18 L23,18 L23,12.997 C23,11.525 22.469,10.5 21.227,10.5 C19.719,10.5 19,11.694 19,13.197 L19,18 L16,18 L16,8 Z",fill:"currentColor"}),t.createElement("path",{d:"M11,18 L14,18 L14,8 L11,8 L11,18 Z M12.501,6.3 C13.495,6.3 14.3,5.494 14.3,4.5 C14.3,3.506 13.495,2.7 12.501,2.7 C11.508,2.7 10.7,3.506 10.7,4.5 C10.7,5.494 11.508,6.3 12.501,6.3 Z",fill:"currentColor"}),t.createElement("polygon",{fill:"currentColor",points:"3 3 0 3 0 18 9 18 9 15 3 15"}))));var i=t.memo((({locale:e="en_US",size:i="medium",style:r,theme:l="light",vanity:c="☯liu",version:d="v1",className:s,type:p="VERTICAL",entity:f="PROFILE",children:m,generateUidWithoutApi:g=!1,hideViewProfileButton:u=!1,id:h,TRACKING_PARAM:b="public-profile-badge",isCreatePage:y=!1,name:C="",noCache:w=!1,debug:L=!1,fetchViaReactQuery:k=!1})=>{const[v,E]=t.useState(null),[R,I]=t.useState(null),_=t.useCallback((e=>e.replace(/\\u([\dA-Fa-f]{4})/g,((e,t)=>String.fromCodePoint(parseInt(t,16))))),[]),A=t.useCallback(((t,n)=>{const o={badgetype:encodeURIComponent(p||"VERTICAL"),badgetheme:encodeURIComponent(l||"light"),locale:e||"en_US",uid:t||`${n||(new Date).getTime()}`,version:encodeURIComponent(d||"v1")};return"v2"===d?(o.badgesize=i||"medium",o.entity=f||"PROFILE"):(o.maxsize=encodeURIComponent(i||"medium"),o.trk=b,o.vanityname=encodeURIComponent(c||"☯liu")),y&&(o.fromCreate="true"),o}),[p,l,e,d,i,f,b,c,y]),{isLoading:x,error:N}=n.useQuery(["linkedInProfile",c,R],(()=>async function(e,t){const n=await fetch(`https://ziping.liu.academy/api/v2/linkedin/profile/?vanity=${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error("Failed to fetch LinkedIn profile data with vanity: "+e);return n.json()}(c,A(R))),{enabled:!!R&&k,onSuccess:e=>{L&&console.info("Fetched profile data via React Query:",e);let t=_(e.profileHeadline||"");t=t.replace(/&amp;/g,"&"),e.profileHeadline=t,E(e)}});t.useEffect((()=>{o({locale:e,size:i,theme:l,type:p,vanity:c,version:d,entity:f,generateUidWithoutApi:g,hideViewProfileButton:u,TRACKING_PARAM:b,isCreatePage:y}).then((t=>{if(t!==R&&null!==t&&I(t),k)return;const n=`cachedProfileData-${c}-${e}-${i}-${l}-${p}-${f}`,o=`${n}-lastUpdated`,a=localStorage.getItem(n),r=localStorage.getItem(o),d=(new Date).getTime(),s=parseInt(r||"0",10),m=(d-s)/36e5,g=a&&!a.includes("profileName")||!a||!r||m>48;if(L&&console.info("Local cache check:",{cachedProfileData:a,lastUpdated:r,isCacheOutdatedOrMissing:g,timeDiffInHours:m}),w||g){if(L&&console.info("Using XHR approach to fetch fresh data from API"),null===v&&null!==t){const e=A(t,s),a=new XMLHttpRequest;a.open("POST","https://ziping.liu.academy/api/v2/linkedin/profile/",!0),a.setRequestHeader("Content-Type","application/json"),a.onreadystatechange=function(){if(4===a.readyState&&200===a.status){const e=JSON.parse(a.responseText);let t=_(e.profileHeadline);t=t.replace(/&amp;/g,"&"),e.profileHeadline=t,L&&console.info("XHR success, storing data in state and localStorage:",e),E(e),localStorage.setItem(n,JSON.stringify(e)),localStorage.setItem(o,(new Date).getTime().toString())}},L&&console.info("XHR sending payload:",e),a.send(JSON.stringify(e))}}else L&&console.info("Loading from cache for LinkedIn profile data"),a&&E(JSON.parse(a))}))}),[e,i,l,p,c,d,f,g,u,b,y,w,L,k,A]);const $=t.useMemo((()=>({medium:{VERTICAL:"250",HORIZONTAL:"280"},large:{VERTICAL:"300",HORIZONTAL:"330"}}[i][p])),[i,p]);if(k&&(x||N)){if(x)return t.createElement("div",null,"Loading...");if(N)return t.createElement("div",null,"Error: ",N?.message)}return t.createElement("div",{id:h,style:r,className:"profile-badge-reacted"+(s?` ${s}`:"")},t.createElement("div",{className:`profile-badge profile-badge--width-${$} profile-badge--`+("light"===l?"light":"dark"),lang:e?.replace(/_[A-Za-z]+$/,"")||"en",dir:"ltr"},t.createElement("div",{className:"profile-badge__header profile-badge__header--"+("light"===l?"light":"dark")},t.createElement("span",{className:"sr-only"},"LinkedIn"),t.createElement(a,{theme:l})),t.createElement("div",{className:"profile-badge__content"},v?.profileImageSrc?t.createElement("img",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",title:v?.profileName,alt:v?.profileName,src:v?.profileImageSrc}):t.createElement("figure",{title:v?.profileName},t.createElement("svg",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 128 128",id:"person-accent-4"},t.createElement("path",{fill:"#e7e2dc",d:"M0 0h128v128H0z"}),t.createElement("path",{d:"M88.41 84.67a32 32 0 10-48.82 0 66.13 66.13 0 0148.82 0z",fill:"#788fa5"}),t.createElement("path",{d:"M88.41 84.67a32 32 0 01-48.82 0A66.79 66.79 0 000 128h128a66.79 66.79 0 00-39.59-43.33z",fill:"#9db3c8"}),t.createElement("path",{d:"M64 96a31.93 31.93 0 0024.41-11.33 66.13 66.13 0 00-48.82 0A31.93 31.93 0 0064 96z",fill:"#56687a"}))),t.createElement("h3",{className:"profile-badge__content-profile-name",itemProp:"name"},v?.profileName&&t.createElement("a",{className:"profile-badge__content-profile-name-link profile-badge__content-profile-name-link--"+("light"===l?"light":"dark"),href:v?.profileNameLink||"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name","data-tracking-control-name":"public-profile-badge-profile-badge-profile-name","data-tracking-will-navigate":""},v?.profileName)),v?.profileHeadline&&t.createElement("h4",{className:"profile-badge__content-profile-headline"},v?.profileHeadline),v?.profileCompanyOrSchool&&t.createElement("h4",{className:"profile-badge__content-profile-company-school-info"},Array.isArray(v?.profileCompanyOrSchool)&&v?.profileCompanyOrSchool.map(((e,n)=>t.createElement("span",{key:`${R}-company-school-${n}`},t.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:e.href,className:"profile-badge__content-profile-company-school-info-link profile-badge__content-profile-company-school-info-link--"+("light"===l?"light":"dark"),"data-tracking-control-name":"public-profile-badge-profile-badge_school-name","data-tracking-will-navigate":"true"},e.text)," ",n!==v?.profileCompanyOrSchool.length-1?" | ":""," "," "))))),m,!1===u&&null!==v&&t.createElement("a",{className:"profile-badge__cta-btn profile-badge__cta-btn--"+("light"===l?"light":"dark"),rel:"noopener noreferrer",href:v?.profileViewLink||`https://www.linkedin.com/in/${encodeURIComponent(c||"☯liu")}?trk=public-profile-badge-profile-badge-profile-cta`,target:"_blank","data-tracking-control-name":"public-profile-badge-profile-badge-view-profile-cta","data-tracking-will-navigate":""},"View profile"),null===v&&t.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",key:`${R}-view-profile-no-data`,href:c?`https://www.linkedin.com/in/${c}?trk=profile-badge`:"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name"},C)))}));var r=t.memo((({CALLBACK_NAME:e="LIBadgeCallback",BADGE_NAMES:n=".LI-profile-badge, .LI-entity-badge",TRACKING_PARAM:o="profile-badge",size:a="medium",locale:i="en_US",type:r="vertical",theme:l="light",vanity:c="ziping-liu-1932a029a",version:d="v2",entity:s="profile",isEI:p=!1,isCreatePage:f=!1,debug:m=!0,cleanUp:g=!1})=>{const u=`${n}${[{type:r},{theme:l},{size:a},{locale:i},{version:d},{entity:s},{vanity:c}].map((e=>Object.entries(e).map((([e,t])=>`[data-${e}="${t}"]`)).join(""))).join("")}`,h=document.querySelector(u),b=t.useRef(h);return t.useEffect((()=>{b.current=h}),[h]),t.useEffect((()=>{let t=0,n=0;const b=[],y={};m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`Using query selector: ${u} to find badge element for badge with type: ${r}, theme: ${l}, size: ${a}, locale: ${i}, version: ${d}, entity: ${s}`);const C=(e,t)=>{if(((e,t)=>w(e)&&!y[e.src]&&(!t||t&&!e.getAttribute("data-isartdeco")))(e,t))e.parentNode&&e.parentNode.replaceChild&&e.parentNode.replaceChild(L(e),e),y[e.src]=!0;else{const n=Array.from(e.childNodes);for(let e=0;e<n.length;e++)C(n[e],t)}},w=e=>"SCRIPT"===e.tagName,L=e=>{const t=document.createElement("script"),n=Array.from(e.attributes);for(const e of n)t.setAttribute(e.name,e.value);return t},k=(e=!1)=>{const t=e?"https://badges.linkedin-ei":"https://badges.linkedin";return(()=>{if("undefined"!=typeof window){const e=window.location?.hostname||"";return/linkedin(-ei)?.cn$/.test(e)}return!1})()?t+".cn/":t+".com/"},v=(e,t="medium",n="en_US",o="vertical",a="light",i="ziping-liu-1932a029a",r="v2",l="profile",c=!1,d=!1,s="profile-badge",p=!1)=>{const f=e=>{let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t},m=(new Date).getTime()+f(n)+f(o)+f(a)+f(i)+f(r)+f(l)+f(c?"ei":"")+f(d?"create":"")+f(t);let g=k(c),u=["locale="+encodeURIComponent(n),"badgetype="+encodeURIComponent(o),"badgetheme="+encodeURIComponent(a),"uid="+encodeURIComponent(m),"version="+encodeURIComponent(r)];"v2"===r?(g+="view",u.push("badgesize="+encodeURIComponent(t)),u.push("entity="+encodeURIComponent(l)),u=u.concat((e=>Array.from(e.attributes).filter((e=>e.name.startsWith("data-key-"))).map((e=>encodeURIComponent(e.name.replace("data-","").toLowerCase())+"="+encodeURIComponent(e.value))))(e))):(g+="profile",u.push("maxsize="+encodeURIComponent(t)),u.push("trk="+encodeURIComponent(s)),u.push("vanityname="+encodeURIComponent(i))),d&&u.push("fromCreate=true");const h=g+"?"+u.join("&");e.setAttribute("data-uid",String(m)),(e=>{const t=document.createElement("script");t.src=e,b.push(t),document.body.appendChild(t)})(h)};h&&(t++,h.setAttribute("data-rendered","true"),v(h,a,i,r,l,c,d,s,p,f,o,g));const E=e=>{n++;const t=`<body>${e}</body>`,o=document.createElement("iframe"),a=e.match(/class="profile-badge__cta-btn profile-badge__cta-btn--light" href="([^"]*)"/);m&&console.info("%cresponseHandler - matching for url:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`match: ${a?.[1]}`);const i=a?.[1].match(/\/in\/([^\/]*)\?.*/),r=document.querySelector(`[data-vanity="${i?.[1]}"]`);m&&(console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`matchVanityInUrl: ${i?.[1]}`),console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`matchVanityInUrl: ${i?.[1]}`),console.info("%cresponseHandler - matching for badge query:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`badgeVanityQuery: ${r?.innerHTML}`)),o.onload=function(){if(o.contentWindow){const e=o.contentWindow.document.body;o.setAttribute("height",`${(e.scrollHeight||300)+5}`),o.setAttribute("width",`${(e.scrollWidth||330)+5}`)}},o.setAttribute("frameBorder","0"),o.style.display="block",r?(m&&console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`vanity found in query: ${r?.getAttribute("data-vanity")}`),r?.appendChild(o)):h?.appendChild(o),o.contentWindow&&(o.contentWindow.document.open(),o.contentWindow.document.write(t),o.contentWindow.document.close()),C(h,f),m&&console.info("%cresponseHandler - LIRenderAll:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`appending badge to iframe: ${t}, badge: ${h?.getAttribute("data-vanity")}, badge:\n`,h),R()};window[e]=E;const R=()=>{m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`at tryClean: expectedResponses: ${t}, responsesReceived: ${n}`),g&&t>0&&(n>=t||n>=1)?(m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;","cleaning up due to responses check passed, expectedResponses > 0 && (responsesReceived >= expectedResponses || responsesReceived >= 1)"),delete window[e],b.forEach((e=>document.body.removeChild(e)))):m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`not cleaning up due to responses check failed, expectedResponses > 0 && (responsesReceived >= expectedResponses || responsesReceived >= 1), cleanUp = ${g}`)};return()=>{b.forEach((e=>{document.body.contains(e)&&document.body.removeChild(e)})),window[e]===E&&delete window[e]}}),[e,n,o,a,i,r,l,c,d,s,p,f,m,g]),null}));var l=t.memo((e=>{const n=e.locale||"en_US",o=e.size||"medium",a=e.theme||"light",l=e.generateUidWithoutApi||!1,c=e.type||"VERTICAL",d=e.entity||"PROFILE",s=e.vanity||"☯liu",p=e.version||"v1",f=e.useLinkedInApiUrlPure||!1,m=encodeURIComponent(s),g=e.name||"",u=e.noCache||!1,h=e?.useQueryToFetch??!1,b=`https://www.linkedin.com/in/${m}?trk=profile-badge`,[y,C]=t.useState(!1);return t.useEffect((()=>{y||(((t,n,o)=>{if(e.debug){const e=(new Date).toLocaleTimeString();console.log(`[${e}] ${n} - ${o}: ${t}`)}})("checking if div is rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),!1===y&&C(!0))}),[y,e.debug]),!0===f?t.createElement("div",{className:"badge-base LI-profile-badge"+(e.className?` ${e.className}`:""),style:e.style,"data-locale":n,"data-size":o,"data-theme":a,"data-type":c,"data-vanity":s,"data-version":p,"data-rendered":"false",id:e.id},t.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:b},g),y&&t.createElement(r,{vanity:s,locale:n,size:o,theme:a,type:c,entity:d,version:p,isCreatePage:!1,debug:e.debug,cleanUp:e.cleanUp})):t.createElement(i,{locale:n,size:o,style:e.style,entity:d,theme:a,type:c,vanity:s,noCache:u,version:p,className:e.className,generateUidWithoutApi:l,hideViewProfileButton:e.hideViewProfileButton,id:e.id,debug:e.debug,name:g,fetchViaReactQuery:h,isCreatePage:!1},e.children)}));e.default=l,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlua2VkaW5iYWRnZS5idW5kbGUuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOyJ9
/* react-linkedinbadge */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");async function t(e,t=!1){const n=Object.keys(e),o=window.location.hostname,a=window.location.pathname,i=window.location.search;let r=0;for(let t=0;t<n.length;t++){const o=e[n[t]];if(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.charCodeAt(e)}if(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.charCodeAt(e);if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)r=(r<<5)-r+a.charCodeAt(e);if(i&&"string"==typeof i)for(let e=0;e<i.length;e++)r=(r<<5)-r+i.charCodeAt(e);if(!1===t){const e=await(async()=>new Promise(((e,t)=>{fetch("https://api.ipify.org?format=json").then((e=>e.json())).then((t=>e(t.ip))).catch((t=>e(null)))})))();if(e&&"string"==typeof e)for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t)}return r=(r<<5)-r+Date.now(),r>>>=0,r.toString()}const n=({theme:t="light",style:n})=>e.createElement("i",{className:"profile-badge__header-logo-icon profile-badge__header-logo-icon--"+("light"===t?"light":"dark"),style:{width:"84px",height:"21px",display:"inline-block",fill:"light"===t?"#0a66c2":"#fff",color:"light"===t?"#0a66c2":"#fff",...n},"aria-hidden":"true"},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 84 21",preserveAspectRatio:"xMinYMin meet",version:"1.1",focusable:"false"},e.createElement("g",{className:"inbug",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd"},e.createElement("path",{d:"M19.479,0 L1.583,0 C0.727,0 0,0.677 0,1.511 L0,19.488 C0,20.323 0.477,21 1.333,21 L19.229,21 C20.086,21 21,20.323 21,19.488 L21,1.511 C21,0.677 20.336,0 19.479,0",className:"bug-text-color",transform:"translate(63.000000, 0.000000)"}),e.createElement("path",{d:"M82.479,0 L64.583,0 C63.727,0 63,0.677 63,1.511 L63,19.488 C63,20.323 63.477,21 64.333,21 L82.229,21 C83.086,21 84,20.323 84,19.488 L84,1.511 C84,0.677 83.336,0 82.479,0 Z M71,8 L73.827,8 L73.827,9.441 L73.858,9.441 C74.289,8.664 75.562,7.875 77.136,7.875 C80.157,7.875 81,9.479 81,12.45 L81,18 L78,18 L78,12.997 C78,11.667 77.469,10.5 76.227,10.5 C74.719,10.5 74,11.521 74,13.197 L74,18 L71,18 L71,8 Z M66,18 L69,18 L69,8 L66,8 L66,18 Z M69.375,4.5 C69.375,5.536 68.536,6.375 67.5,6.375 C66.464,6.375 65.625,5.536 65.625,4.5 C65.625,3.464 66.464,2.625 67.5,2.625 C68.536,2.625 69.375,3.464 69.375,4.5 Z",className:"background",fill:"currentColor"})),e.createElement("g",{className:"linkedin-text"},e.createElement("path",{d:"M60,18 L57.2,18 L57.2,16.809 L57.17,16.809 C56.547,17.531 55.465,18.125 53.631,18.125 C51.131,18.125 48.978,16.244 48.978,13.011 C48.978,9.931 51.1,7.875 53.725,7.875 C55.35,7.875 56.359,8.453 56.97,9.191 L57,9.191 L57,3 L60,3 L60,18 Z M54.479,10.125 C52.764,10.125 51.8,11.348 51.8,12.974 C51.8,14.601 52.764,15.875 54.479,15.875 C56.196,15.875 57.2,14.634 57.2,12.974 C57.2,11.268 56.196,10.125 54.479,10.125 L54.479,10.125 Z",fill:"currentColor"}),e.createElement("path",{d:"M47.6611,16.3889 C46.9531,17.3059 45.4951,18.1249 43.1411,18.1249 C40.0001,18.1249 38.0001,16.0459 38.0001,12.7779 C38.0001,9.8749 39.8121,7.8749 43.2291,7.8749 C46.1801,7.8749 48.0001,9.8129 48.0001,13.2219 C48.0001,13.5629 47.9451,13.8999 47.9451,13.8999 L40.8311,13.8999 L40.8481,14.2089 C41.0451,15.0709 41.6961,16.1249 43.1901,16.1249 C44.4941,16.1249 45.3881,15.4239 45.7921,14.8749 L47.6611,16.3889 Z M45.1131,11.9999 C45.1331,10.9449 44.3591,9.8749 43.1391,9.8749 C41.6871,9.8749 40.9121,11.0089 40.8311,11.9999 L45.1131,11.9999 Z",fill:"currentColor"}),e.createElement("polygon",{fill:"currentColor",points:"38 8 34.5 8 31 12 31 3 28 3 28 18 31 18 31 13 34.699 18 38.241 18 34 12.533"}),e.createElement("path",{d:"M16,8 L18.827,8 L18.827,9.441 L18.858,9.441 C19.289,8.664 20.562,7.875 22.136,7.875 C25.157,7.875 26,9.792 26,12.45 L26,18 L23,18 L23,12.997 C23,11.525 22.469,10.5 21.227,10.5 C19.719,10.5 19,11.694 19,13.197 L19,18 L16,18 L16,8 Z",fill:"currentColor"}),e.createElement("path",{d:"M11,18 L14,18 L14,8 L11,8 L11,18 Z M12.501,6.3 C13.495,6.3 14.3,5.494 14.3,4.5 C14.3,3.506 13.495,2.7 12.501,2.7 C11.508,2.7 10.7,3.506 10.7,4.5 C10.7,5.494 11.508,6.3 12.501,6.3 Z",fill:"currentColor"}),e.createElement("polygon",{fill:"currentColor",points:"3 3 0 3 0 18 9 18 9 15 3 15"}))));var o=e.memo((({locale:o="en_US",size:a="medium",style:i,theme:r="light",vanity:l="☯liu",version:c="v1",className:d,type:s="VERTICAL",entity:p="PROFILE",children:f,generateUidWithoutApi:m=!1,hideViewProfileButton:g=!1,id:h,TRACKING_PARAM:u="public-profile-badge",isCreatePage:b=!1,name:y="",noCache:C=!1,debug:w=!1})=>{const[$,v]=e.useState(null),[L,k]=e.useState(null);e.useEffect((()=>{const e=()=>{t({locale:o,size:a,theme:r,type:s,vanity:l,version:c,entity:p,generateUidWithoutApi:m,hideViewProfileButton:g,TRACKING_PARAM:u,isCreatePage:b}).then((e=>{e!==L&&null!==e&&k(e);const t={badgetype:encodeURIComponent(s||"VERTICAL"),badgetheme:encodeURIComponent(r||"light"),locale:o||"en_US",uid:e||`${f||(new Date).getTime()}`,version:encodeURIComponent(c||"v1")};"v2"===c?(t.badgesize=a||"medium",t.entity=p||"PROFILE"):(t.maxsize=encodeURIComponent(a||"medium"),t.trk=u,t.vanityname=encodeURIComponent(l||"☯liu")),b&&(t.fromCreate="true"),b&&(t.fromCreate="true");const n=new XMLHttpRequest,i="https://ziping.liu.academy/api/v2/linkedin/profile/";console.info(`profileData: ${$}, uidNew: ${e}`),null===$&&null!==e&&(n.open("POST",i,!0),n.setRequestHeader("Content-Type","application/json"),n.onreadystatechange=function(){if(4===n.readyState&&200===n.status){console.info(`xmlnew.responseText: ${n.responseText}`);const e=JSON.parse(n.responseText);let t=e.profileHeadline;t=t.replace(/\\u([\dA-Fa-f]{4})/g,((e,t)=>String.fromCodePoint(parseInt(t,16)))),t=t.replace(/&amp;/g,"&"),console.info(`new headlineText: ${t}`),console.info(`old headlineText: ${e.profileHeadline}`),e.profileHeadline=t,w&&console.info(`Retrieved profile badge info for vanity ${l} via API and saving to local storage: `,`'cachedProfileData-${l}-${o}-${a}-${r}-${s}-${p}'`,"profile data",`${Object.keys(e).toString()}`),v(e),localStorage.setItem(`cachedProfileData-${l}-${o}-${a}-${r}-${s}-${p}`,JSON.stringify(e)),localStorage.setItem(`cachedProfileData-${l}-${o}-${a}-${r}-${s}-${p}-lastUpdated`,(new Date).getTime().toString())}},w&&console.info(`Fetching profile badge info now for vanity ${l} via API: `,`'${i}'`,"payloadBodyParams",`${Object.keys(t).toString()}`),n.send(JSON.stringify(t)))}))},n=localStorage.getItem(`cachedProfileData-${l}-${o}-${a}-${r}-${s}-${p}`),i=localStorage.getItem(`cachedProfileData-${l}-${o}-${a}-${r}-${s}-${p}-lastUpdated`),d=(new Date).getTime(),f=parseInt(i||"0",10),h=(d-f)/36e5,y=n&&!n.includes("profileName")||!n||!i||h>48;w&&console.info("cachedProfileData",n,"lastUpdated",i,"isOutDatedOrNotThere",y,"timeDiffInHours",h),C||y?(w&&console.info("Fetching data from API","cachProfileData",n,"lastUpdated",i,"cachedProfileData",n),e()):(w&&console.info("Fetching data from cache linkedinbadge","cachProfileData",n,"lastUpdated",i),v(JSON.parse(n)))}),[o,a,r,s,l,c,p,m,g,u,b,C,w]);const E=e.useMemo((()=>({medium:{VERTICAL:"250",HORIZONTAL:"280"},large:{VERTICAL:"300",HORIZONTAL:"330"}}[a][s])),[a,s]);return e.createElement("div",{id:h,style:i,className:"profile-badge-reacted"+(d?` ${d}`:"")},e.createElement("div",{className:`profile-badge profile-badge--width-${E} profile-badge--`+("light"===r?"light":"dark"),lang:o?.replace(/_[A-Za-z]+$/,"")||"en",dir:"ltr"},e.createElement("div",{className:"profile-badge__header profile-badge__header--"+("light"===r?"light":"dark")},e.createElement("span",{className:"sr-only"},"LinkedIn"),e.createElement(n,{theme:r})),e.createElement("div",{className:"profile-badge__content"},$?.profileImageSrc?e.createElement("img",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",title:$?.profileName,alt:$?.profileName,src:$?.profileImageSrc}):e.createElement("figure",{title:$?.profileName},e.createElement("svg",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 128 128",id:"person-accent-4"},e.createElement("path",{fill:"#e7e2dc",d:"M0 0h128v128H0z"}),e.createElement("path",{d:"M88.41 84.67a32 32 0 10-48.82 0 66.13 66.13 0 0148.82 0z",fill:"#788fa5"}),e.createElement("path",{d:"M88.41 84.67a32 32 0 01-48.82 0A66.79 66.79 0 000 128h128a66.79 66.79 0 00-39.59-43.33z",fill:"#9db3c8"}),e.createElement("path",{d:"M64 96a31.93 31.93 0 0024.41-11.33 66.13 66.13 0 00-48.82 0A31.93 31.93 0 0064 96z",fill:"#56687a"}))),e.createElement("h3",{className:"profile-badge__content-profile-name",itemProp:"name"},$?.profileName&&e.createElement("a",{className:"profile-badge__content-profile-name-link profile-badge__content-profile-name-link--"+("light"===r?"light":"dark"),href:$?.profileNameLink||"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name","data-tracking-control-name":"public-profile-badge-profile-badge-profile-name","data-tracking-will-navigate":""},$?.profileName&&e.createElement(e.Fragment,null,$?.profileName))),$?.profileHeadline&&e.createElement("h4",{className:"profile-badge__content-profile-headline"},$?.profileHeadline),$?.profileCompanyOrSchool&&e.createElement("h4",{className:"profile-badge__content-profile-company-school-info"},$?.profileCompanyOrSchool&&Array.isArray($?.profileCompanyOrSchool)&&$?.profileCompanyOrSchool.map(((t,n)=>e.createElement("span",{key:`${L}-company-school-${n}`},e.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:t.href,className:"profile-badge__content-profile-company-school-info-link profile-badge__content-profile-company-school-info-link--"+("light"===r?"light":"dark"),"data-tracking-control-name":"public-profile-badge-profile-badge_school-name","data-tracking-will-navigate":"true"},t.text)," ",n!==$?.profileCompanyOrSchool.length-1?" | ":""," "))))),f,!1===g&&null!==$&&e.createElement("a",{className:"profile-badge__cta-btn profile-badge__cta-btn--"+("light"===r?"light":"dark"),rel:"noopener noreferrer",href:$?.profileViewLink||`https://www.linkedin.com/in/${encodeURIComponent(l||"☯liu")}?trk=public-profile-badge-profile-badge-profile-cta`,target:"_blank","data-tracking-control-name":"public-profile-badge-profile-badge-view-profile-cta","data-tracking-will-navigate":""},"View profile"),null===$&&e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",key:`${L}-view-profile-no-data`,href:""+(l?`https://www.linkedin.com/in/${l}?trk=profile-badge`:"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name")},y)))}));var a=e.memo((({CALLBACK_NAME:t="LIBadgeCallback",BADGE_NAMES:n=".LI-profile-badge, .LI-entity-badge",TRACKING_PARAM:o="profile-badge",size:a="medium",locale:i="en_US",type:r="vertical",theme:l="light",vanity:c="ziping-liu-1932a029a",version:d="v2",entity:s="profile",isEI:p=!1,isCreatePage:f=!1,debug:m=!0,cleanUp:g=!1})=>{const h=`${n}${[{type:r},{theme:l},{size:a},{locale:i},{version:d},{entity:s},{vanity:c}].map((e=>Object.entries(e).map((([e,t])=>`[data-${e}="${t}"]`)).join(""))).join("")}`,u=document.querySelector(h),b=e.useRef(u);return e.useEffect((()=>{b.current=u}),[u]),e.useEffect((()=>{let e=0,n=0;const b=[],y={};m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`Using query selector: ${h} to find badge element for badge with type: ${r}, theme: ${l}, size: ${a}, locale: ${i}, version: ${d}, entity: ${s}`);const C=(e,t)=>{if(((e,t)=>w(e)&&!y[e.src]&&(!t||t&&!e.getAttribute("data-isartdeco")))(e,t))e.parentNode&&e.parentNode.replaceChild&&e.parentNode.replaceChild($(e),e),y[e.src]=!0;else{const n=Array.from(e.childNodes);for(let e=0;e<n.length;e++)C(n[e],t)}},w=e=>"SCRIPT"===e.tagName,$=e=>{const t=document.createElement("script"),n=Array.from(e.attributes);for(const e of n)t.setAttribute(e.name,e.value);return t},v=(e=!1)=>{const t=e?"https://badges.linkedin-ei":"https://badges.linkedin";return(()=>{if("undefined"!=typeof window){const e=window.location?.hostname||"";return/linkedin(-ei)?.cn$/.test(e)}return!1})()?t+".cn/":t+".com/"},L=(e,t="medium",n="en_US",o="vertical",a="light",i="ziping-liu-1932a029a",r="v2",l="profile",c=!1,d=!1,s="profile-badge",p=!1)=>{const f=e=>{let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t},m=(new Date).getTime()+f(n)+f(o)+f(a)+f(i)+f(r)+f(l)+f(c?"ei":"")+f(d?"create":"")+f(t);let g=v(c),h=["locale="+encodeURIComponent(n),"badgetype="+encodeURIComponent(o),"badgetheme="+encodeURIComponent(a),"uid="+encodeURIComponent(m),"version="+encodeURIComponent(r)];"v2"===r?(g+="view",h.push("badgesize="+encodeURIComponent(t)),h.push("entity="+encodeURIComponent(l)),h=h.concat((e=>Array.from(e.attributes).filter((e=>e.name.startsWith("data-key-"))).map((e=>encodeURIComponent(e.name.replace("data-","").toLowerCase())+"="+encodeURIComponent(e.value))))(e))):(g+="profile",h.push("maxsize="+encodeURIComponent(t)),h.push("trk="+encodeURIComponent(s)),h.push("vanityname="+encodeURIComponent(i))),d&&h.push("fromCreate=true");const u=g+"?"+h.join("&");e.setAttribute("data-uid",String(m)),(e=>{const t=document.createElement("script");t.src=e,b.push(t),document.body.appendChild(t)})(u)};u&&(e++,u.setAttribute("data-rendered","true"),L(u,a,i,r,l,c,d,s,p,f,o,g));const k=e=>{n++;const t=`<body>${e}</body>`,o=document.createElement("iframe"),a=e.match(/class="profile-badge__cta-btn profile-badge__cta-btn--light" href="([^"]*)"/);m&&console.info("%cresponseHandler - matching for url:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`match: ${a?.[1]}`);const i=a?.[1].match(/\/in\/([^\/]*)\?.*/),r=document.querySelector(`[data-vanity="${i?.[1]}"]`);m&&(console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`matchVanityInUrl: ${i?.[1]}`),console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`matchVanityInUrl: ${i?.[1]}`),console.info("%cresponseHandler - matching for badge query:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`badgeVanityQuery: ${r?.innerHTML}`)),o.onload=function(){if(o.contentWindow){const e=o.contentWindow.document.body;o.setAttribute("height",`${(e.scrollHeight||300)+5}`),o.setAttribute("width",`${(e.scrollWidth||330)+5}`)}},o.setAttribute("frameBorder","0"),o.style.display="block",r?(m&&console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`vanity found in query: ${r?.getAttribute("data-vanity")}`),r?.appendChild(o)):u?.appendChild(o),o.contentWindow&&(o.contentWindow.document.open(),o.contentWindow.document.write(t),o.contentWindow.document.close()),C(u,f),m&&console.info("%cresponseHandler - LIRenderAll:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`appending badge to iframe: ${t}, badge: ${u?.getAttribute("data-vanity")}, badge:\n`,u),E()};window[t]=k;const E=()=>{m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`at tryClean: expectedResponses: ${e}, responsesReceived: ${n}`),g&&e>0&&(n>=e||n>=1)?(m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;","cleaning up due to responses check passed, expectedResponses > 0 && (responsesReceived >= expectedResponses || responsesReceived >= 1)"),delete window[t],b.forEach((e=>document.body.removeChild(e)))):m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`not cleaning up due to responses check failed, expectedResponses > 0 && (responsesReceived >= expectedResponses || responsesReceived >= 1), cleanUp = ${g}`)};return()=>{b.forEach((e=>{document.body.contains(e)&&document.body.removeChild(e)})),window[t]===k&&delete window[t]}}),[t,n,o,a,i,r,l,c,d,s,p,f,m,g]),null}));exports.default=t=>{const n=t.locale||"en_US",i=t.size||"medium",r=t.theme||"light",l=t.generateUidWithoutApi||!1,c=t.type||"VERTICAL",d=t.entity||"PROFILE",s=t.vanity||"☯liu",p=t.version||"v1",f=t.useLinkedInApiUrlPure||!1,m=encodeURIComponent(s),g=t.name||"",h=t.noCache||!1,u=`https://www.linkedin.com/in/${m}?trk=profile-badge`,[b,y]=e.useState(!1);return e.useEffect((()=>{b||(((e,n,o)=>{if(t.debug){const t=(new Date).toLocaleTimeString();console.log(`[${t}] ${n} - ${o}: ${e}`)}})("checking if div is rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),!1===b&&y(!0))}),[b,t.debug]),!0===f?e.createElement("div",{className:"badge-base LI-profile-badge"+(t.className?` ${t.className}`:""),style:t.style,"data-locale":n,"data-size":i,"data-theme":r,"data-type":c,"data-vanity":s,"data-version":p,"data-rendered":"false",id:t.id},e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:u},g),b&&e.createElement(a,{vanity:s,locale:n,size:i,theme:r,type:c,entity:d,version:p,isCreatePage:!1,debug:t.debug,cleanUp:t.cleanUp})):e.createElement(o,{locale:n,size:i,style:t.style,entity:d,theme:r,type:c,vanity:s,noCache:h,version:p,className:t.className,generateUidWithoutApi:l,hideViewProfileButton:t.hideViewProfileButton,id:t.id,debug:t.debug,name:g,isCreatePage:!1},t.children)};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react-query");async function n(e,t=!1){const n=Object.keys(e),o=window.location.hostname,a=window.location.pathname,i=window.location.search;let r=0;for(let t=0;t<n.length;t++){const o=e[n[t]];if(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.charCodeAt(e)}if(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.charCodeAt(e);if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)r=(r<<5)-r+a.charCodeAt(e);if(i&&"string"==typeof i)for(let e=0;e<i.length;e++)r=(r<<5)-r+i.charCodeAt(e);if(!1===t){const e=await(async()=>new Promise(((e,t)=>{fetch("https://api.ipify.org?format=json").then((e=>e.json())).then((t=>e(t.ip))).catch((t=>e(null)))})))();if(e&&"string"==typeof e)for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t)}return r=(r<<5)-r+Date.now(),r>>>=0,r.toString()}const o=({theme:t="light",style:n})=>e.createElement("i",{className:"profile-badge__header-logo-icon profile-badge__header-logo-icon--"+("light"===t?"light":"dark"),style:{width:"84px",height:"21px",display:"inline-block",fill:"light"===t?"#0a66c2":"#fff",color:"light"===t?"#0a66c2":"#fff",...n},"aria-hidden":"true","aria-label":"LinkedIn"},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 84 21",preserveAspectRatio:"xMinYMin meet",version:"1.1",focusable:"false"},e.createElement("g",{className:"inbug",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd"},e.createElement("path",{d:"M19.479,0 L1.583,0 C0.727,0 0,0.677 0,1.511 L0,19.488 C0,20.323 0.477,21 1.333,21 L19.229,21 C20.086,21 21,20.323 21,19.488 L21,1.511 C21,0.677 20.336,0 19.479,0",className:"bug-text-color",transform:"translate(63.000000, 0.000000)"}),e.createElement("path",{d:"M82.479,0 L64.583,0 C63.727,0 63,0.677 63,1.511 L63,19.488 C63,20.323 63.477,21 64.333,21 L82.229,21 C83.086,21 84,20.323 84,19.488 L84,1.511 C84,0.677 83.336,0 82.479,0 Z M71,8 L73.827,8 L73.827,9.441 L73.858,9.441 C74.289,8.664 75.562,7.875 77.136,7.875 C80.157,7.875 81,9.479 81,12.45 L81,18 L78,18 L78,12.997 C78,11.667 77.469,10.5 76.227,10.5 C74.719,10.5 74,11.521 74,13.197 L74,18 L71,18 L71,8 Z M66,18 L69,18 L69,8 L66,8 L66,18 Z M69.375,4.5 C69.375,5.536 68.536,6.375 67.5,6.375 C66.464,6.375 65.625,5.536 65.625,4.5 C65.625,3.464 66.464,2.625 67.5,2.625 C68.536,2.625 69.375,3.464 69.375,4.5 Z",className:"background",fill:"currentColor"})),e.createElement("g",{className:"linkedin-text"},e.createElement("path",{d:"M60,18 L57.2,18 L57.2,16.809 L57.17,16.809 C56.547,17.531 55.465,18.125 53.631,18.125 C51.131,18.125 48.978,16.244 48.978,13.011 C48.978,9.931 51.1,7.875 53.725,7.875 C55.35,7.875 56.359,8.453 56.97,9.191 L57,9.191 L57,3 L60,3 L60,18 Z M54.479,10.125 C52.764,10.125 51.8,11.348 51.8,12.974 C51.8,14.601 52.764,15.875 54.479,15.875 C56.196,15.875 57.2,14.634 57.2,12.974 C57.2,11.268 56.196,10.125 54.479,10.125 L54.479,10.125 Z",fill:"currentColor"}),e.createElement("path",{d:"M47.6611,16.3889 C46.9531,17.3059 45.4951,18.1249 43.1411,18.1249 C40.0001,18.1249 38.0001,16.0459 38.0001,12.7779 C38.0001,9.8749 39.8121,7.8749 43.2291,7.8749 C46.1801,7.8749 48.0001,9.8129 48.0001,13.2219 C48.0001,13.5629 47.9451,13.8999 47.9451,13.8999 L40.8311,13.8999 L40.8481,14.2089 C41.0451,15.0709 41.6961,16.1249 43.1901,16.1249 C44.4941,16.1249 45.3881,15.4239 45.7921,14.8749 L47.6611,16.3889 Z M45.1131,11.9999 C45.1331,10.9449 44.3591,9.8749 43.1391,9.8749 C41.6871,9.8749 40.9121,11.0089 40.8311,11.9999 L45.1131,11.9999 Z",fill:"currentColor"}),e.createElement("polygon",{fill:"currentColor",points:"38 8 34.5 8 31 12 31 3 28 3 28 18 31 18 31 13 34.699 18 38.241 18 34 12.533"}),e.createElement("path",{d:"M16,8 L18.827,8 L18.827,9.441 L18.858,9.441 C19.289,8.664 20.562,7.875 22.136,7.875 C25.157,7.875 26,9.792 26,12.45 L26,18 L23,18 L23,12.997 C23,11.525 22.469,10.5 21.227,10.5 C19.719,10.5 19,11.694 19,13.197 L19,18 L16,18 L16,8 Z",fill:"currentColor"}),e.createElement("path",{d:"M11,18 L14,18 L14,8 L11,8 L11,18 Z M12.501,6.3 C13.495,6.3 14.3,5.494 14.3,4.5 C14.3,3.506 13.495,2.7 12.501,2.7 C11.508,2.7 10.7,3.506 10.7,4.5 C10.7,5.494 11.508,6.3 12.501,6.3 Z",fill:"currentColor"}),e.createElement("polygon",{fill:"currentColor",points:"3 3 0 3 0 18 9 18 9 15 3 15"}))));var a=e.memo((({locale:a="en_US",size:i="medium",style:r,theme:l="light",vanity:c="☯liu",version:d="v1",className:s,type:p="VERTICAL",entity:f="PROFILE",children:m,generateUidWithoutApi:g=!1,hideViewProfileButton:u=!1,id:h,TRACKING_PARAM:b="public-profile-badge",isCreatePage:y=!1,name:C="",noCache:w=!1,debug:L=!1,fetchViaReactQuery:k=!1})=>{const[v,E]=e.useState(null),[I,R]=e.useState(null),_=e.useCallback((e=>e.replace(/\\u([\dA-Fa-f]{4})/g,((e,t)=>String.fromCodePoint(parseInt(t,16))))),[]),A=e.useCallback(((e,t)=>{const n={badgetype:encodeURIComponent(p||"VERTICAL"),badgetheme:encodeURIComponent(l||"light"),locale:a||"en_US",uid:e||`${t||(new Date).getTime()}`,version:encodeURIComponent(d||"v1")};return"v2"===d?(n.badgesize=i||"medium",n.entity=f||"PROFILE"):(n.maxsize=encodeURIComponent(i||"medium"),n.trk=b,n.vanityname=encodeURIComponent(c||"☯liu")),y&&(n.fromCreate="true"),n}),[p,l,a,d,i,f,b,c,y]),{isLoading:x,error:N}=t.useQuery(["linkedInProfile",c,I],(()=>async function(e,t){const n=await fetch(`https://ziping.liu.academy/api/v2/linkedin/profile/?vanity=${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error("Failed to fetch LinkedIn profile data with vanity: "+e);return n.json()}(c,A(I))),{enabled:!!I&&k,onSuccess:e=>{L&&console.info("Fetched profile data via React Query:",e);let t=_(e.profileHeadline||"");t=t.replace(/&amp;/g,"&"),e.profileHeadline=t,E(e)}});e.useEffect((()=>{n({locale:a,size:i,theme:l,type:p,vanity:c,version:d,entity:f,generateUidWithoutApi:g,hideViewProfileButton:u,TRACKING_PARAM:b,isCreatePage:y}).then((e=>{if(e!==I&&null!==e&&R(e),k)return;const t=`cachedProfileData-${c}-${a}-${i}-${l}-${p}-${f}`,n=`${t}-lastUpdated`,o=localStorage.getItem(t),r=localStorage.getItem(n),d=(new Date).getTime(),s=parseInt(r||"0",10),m=(d-s)/36e5,g=o&&!o.includes("profileName")||!o||!r||m>48;if(L&&console.info("Local cache check:",{cachedProfileData:o,lastUpdated:r,isCacheOutdatedOrMissing:g,timeDiffInHours:m}),w||g){if(L&&console.info("Using XHR approach to fetch fresh data from API"),null===v&&null!==e){const o=A(e,s),a=new XMLHttpRequest;a.open("POST","https://ziping.liu.academy/api/v2/linkedin/profile/",!0),a.setRequestHeader("Content-Type","application/json"),a.onreadystatechange=function(){if(4===a.readyState&&200===a.status){const e=JSON.parse(a.responseText);let o=_(e.profileHeadline);o=o.replace(/&amp;/g,"&"),e.profileHeadline=o,L&&console.info("XHR success, storing data in state and localStorage:",e),E(e),localStorage.setItem(t,JSON.stringify(e)),localStorage.setItem(n,(new Date).getTime().toString())}},L&&console.info("XHR sending payload:",o),a.send(JSON.stringify(o))}}else L&&console.info("Loading from cache for LinkedIn profile data"),o&&E(JSON.parse(o))}))}),[a,i,l,p,c,d,f,g,u,b,y,w,L,k,A]);const $=e.useMemo((()=>({medium:{VERTICAL:"250",HORIZONTAL:"280"},large:{VERTICAL:"300",HORIZONTAL:"330"}}[i][p])),[i,p]);if(k&&(x||N)){if(x)return e.createElement("div",null,"Loading...");if(N)return e.createElement("div",null,"Error: ",N?.message)}return e.createElement("div",{id:h,style:r,className:"profile-badge-reacted"+(s?` ${s}`:"")},e.createElement("div",{className:`profile-badge profile-badge--width-${$} profile-badge--`+("light"===l?"light":"dark"),lang:a?.replace(/_[A-Za-z]+$/,"")||"en",dir:"ltr"},e.createElement("div",{className:"profile-badge__header profile-badge__header--"+("light"===l?"light":"dark")},e.createElement("span",{className:"sr-only"},"LinkedIn"),e.createElement(o,{theme:l})),e.createElement("div",{className:"profile-badge__content"},v?.profileImageSrc?e.createElement("img",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",title:v?.profileName,alt:v?.profileName,src:v?.profileImageSrc}):e.createElement("figure",{title:v?.profileName},e.createElement("svg",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 128 128",id:"person-accent-4"},e.createElement("path",{fill:"#e7e2dc",d:"M0 0h128v128H0z"}),e.createElement("path",{d:"M88.41 84.67a32 32 0 10-48.82 0 66.13 66.13 0 0148.82 0z",fill:"#788fa5"}),e.createElement("path",{d:"M88.41 84.67a32 32 0 01-48.82 0A66.79 66.79 0 000 128h128a66.79 66.79 0 00-39.59-43.33z",fill:"#9db3c8"}),e.createElement("path",{d:"M64 96a31.93 31.93 0 0024.41-11.33 66.13 66.13 0 00-48.82 0A31.93 31.93 0 0064 96z",fill:"#56687a"}))),e.createElement("h3",{className:"profile-badge__content-profile-name",itemProp:"name"},v?.profileName&&e.createElement("a",{className:"profile-badge__content-profile-name-link profile-badge__content-profile-name-link--"+("light"===l?"light":"dark"),href:v?.profileNameLink||"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name","data-tracking-control-name":"public-profile-badge-profile-badge-profile-name","data-tracking-will-navigate":""},v?.profileName)),v?.profileHeadline&&e.createElement("h4",{className:"profile-badge__content-profile-headline"},v?.profileHeadline),v?.profileCompanyOrSchool&&e.createElement("h4",{className:"profile-badge__content-profile-company-school-info"},Array.isArray(v?.profileCompanyOrSchool)&&v?.profileCompanyOrSchool.map(((t,n)=>e.createElement("span",{key:`${I}-company-school-${n}`},e.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:t.href,className:"profile-badge__content-profile-company-school-info-link profile-badge__content-profile-company-school-info-link--"+("light"===l?"light":"dark"),"data-tracking-control-name":"public-profile-badge-profile-badge_school-name","data-tracking-will-navigate":"true"},t.text)," ",n!==v?.profileCompanyOrSchool.length-1?" | ":""," "," "))))),m,!1===u&&null!==v&&e.createElement("a",{className:"profile-badge__cta-btn profile-badge__cta-btn--"+("light"===l?"light":"dark"),rel:"noopener noreferrer",href:v?.profileViewLink||`https://www.linkedin.com/in/${encodeURIComponent(c||"☯liu")}?trk=public-profile-badge-profile-badge-profile-cta`,target:"_blank","data-tracking-control-name":"public-profile-badge-profile-badge-view-profile-cta","data-tracking-will-navigate":""},"View profile"),null===v&&e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",key:`${I}-view-profile-no-data`,href:c?`https://www.linkedin.com/in/${c}?trk=profile-badge`:"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name"},C)))}));var i=e.memo((({CALLBACK_NAME:t="LIBadgeCallback",BADGE_NAMES:n=".LI-profile-badge, .LI-entity-badge",TRACKING_PARAM:o="profile-badge",size:a="medium",locale:i="en_US",type:r="vertical",theme:l="light",vanity:c="ziping-liu-1932a029a",version:d="v2",entity:s="profile",isEI:p=!1,isCreatePage:f=!1,debug:m=!0,cleanUp:g=!1})=>{const u=`${n}${[{type:r},{theme:l},{size:a},{locale:i},{version:d},{entity:s},{vanity:c}].map((e=>Object.entries(e).map((([e,t])=>`[data-${e}="${t}"]`)).join(""))).join("")}`,h=document.querySelector(u),b=e.useRef(h);return e.useEffect((()=>{b.current=h}),[h]),e.useEffect((()=>{let e=0,n=0;const b=[],y={};m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`Using query selector: ${u} to find badge element for badge with type: ${r}, theme: ${l}, size: ${a}, locale: ${i}, version: ${d}, entity: ${s}`);const C=(e,t)=>{if(((e,t)=>w(e)&&!y[e.src]&&(!t||t&&!e.getAttribute("data-isartdeco")))(e,t))e.parentNode&&e.parentNode.replaceChild&&e.parentNode.replaceChild(L(e),e),y[e.src]=!0;else{const n=Array.from(e.childNodes);for(let e=0;e<n.length;e++)C(n[e],t)}},w=e=>"SCRIPT"===e.tagName,L=e=>{const t=document.createElement("script"),n=Array.from(e.attributes);for(const e of n)t.setAttribute(e.name,e.value);return t},k=(e=!1)=>{const t=e?"https://badges.linkedin-ei":"https://badges.linkedin";return(()=>{if("undefined"!=typeof window){const e=window.location?.hostname||"";return/linkedin(-ei)?.cn$/.test(e)}return!1})()?t+".cn/":t+".com/"},v=(e,t="medium",n="en_US",o="vertical",a="light",i="ziping-liu-1932a029a",r="v2",l="profile",c=!1,d=!1,s="profile-badge",p=!1)=>{const f=e=>{let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t},m=(new Date).getTime()+f(n)+f(o)+f(a)+f(i)+f(r)+f(l)+f(c?"ei":"")+f(d?"create":"")+f(t);let g=k(c),u=["locale="+encodeURIComponent(n),"badgetype="+encodeURIComponent(o),"badgetheme="+encodeURIComponent(a),"uid="+encodeURIComponent(m),"version="+encodeURIComponent(r)];"v2"===r?(g+="view",u.push("badgesize="+encodeURIComponent(t)),u.push("entity="+encodeURIComponent(l)),u=u.concat((e=>Array.from(e.attributes).filter((e=>e.name.startsWith("data-key-"))).map((e=>encodeURIComponent(e.name.replace("data-","").toLowerCase())+"="+encodeURIComponent(e.value))))(e))):(g+="profile",u.push("maxsize="+encodeURIComponent(t)),u.push("trk="+encodeURIComponent(s)),u.push("vanityname="+encodeURIComponent(i))),d&&u.push("fromCreate=true");const h=g+"?"+u.join("&");e.setAttribute("data-uid",String(m)),(e=>{const t=document.createElement("script");t.src=e,b.push(t),document.body.appendChild(t)})(h)};h&&(e++,h.setAttribute("data-rendered","true"),v(h,a,i,r,l,c,d,s,p,f,o,g));const E=e=>{n++;const t=`<body>${e}</body>`,o=document.createElement("iframe"),a=e.match(/class="profile-badge__cta-btn profile-badge__cta-btn--light" href="([^"]*)"/);m&&console.info("%cresponseHandler - matching for url:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`match: ${a?.[1]}`);const i=a?.[1].match(/\/in\/([^\/]*)\?.*/),r=document.querySelector(`[data-vanity="${i?.[1]}"]`);m&&(console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`matchVanityInUrl: ${i?.[1]}`),console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`matchVanityInUrl: ${i?.[1]}`),console.info("%cresponseHandler - matching for badge query:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`badgeVanityQuery: ${r?.innerHTML}`)),o.onload=function(){if(o.contentWindow){const e=o.contentWindow.document.body;o.setAttribute("height",`${(e.scrollHeight||300)+5}`),o.setAttribute("width",`${(e.scrollWidth||330)+5}`)}},o.setAttribute("frameBorder","0"),o.style.display="block",r?(m&&console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`vanity found in query: ${r?.getAttribute("data-vanity")}`),r?.appendChild(o)):h?.appendChild(o),o.contentWindow&&(o.contentWindow.document.open(),o.contentWindow.document.write(t),o.contentWindow.document.close()),C(h,f),m&&console.info("%cresponseHandler - LIRenderAll:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`appending badge to iframe: ${t}, badge: ${h?.getAttribute("data-vanity")}, badge:\n`,h),I()};window[t]=E;const I=()=>{m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`at tryClean: expectedResponses: ${e}, responsesReceived: ${n}`),g&&e>0&&(n>=e||n>=1)?(m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;","cleaning up due to responses check passed, expectedResponses > 0 && (responsesReceived >= expectedResponses || responsesReceived >= 1)"),delete window[t],b.forEach((e=>document.body.removeChild(e)))):m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`not cleaning up due to responses check failed, expectedResponses > 0 && (responsesReceived >= expectedResponses || responsesReceived >= 1), cleanUp = ${g}`)};return()=>{b.forEach((e=>{document.body.contains(e)&&document.body.removeChild(e)})),window[t]===E&&delete window[t]}}),[t,n,o,a,i,r,l,c,d,s,p,f,m,g]),null}));var r=e.memo((t=>{const n=t.locale||"en_US",o=t.size||"medium",r=t.theme||"light",l=t.generateUidWithoutApi||!1,c=t.type||"VERTICAL",d=t.entity||"PROFILE",s=t.vanity||"☯liu",p=t.version||"v1",f=t.useLinkedInApiUrlPure||!1,m=encodeURIComponent(s),g=t.name||"",u=t.noCache||!1,h=t?.useQueryToFetch??!1,b=`https://www.linkedin.com/in/${m}?trk=profile-badge`,[y,C]=e.useState(!1);return e.useEffect((()=>{y||(((e,n,o)=>{if(t.debug){const t=(new Date).toLocaleTimeString();console.log(`[${t}] ${n} - ${o}: ${e}`)}})("checking if div is rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),!1===y&&C(!0))}),[y,t.debug]),!0===f?e.createElement("div",{className:"badge-base LI-profile-badge"+(t.className?` ${t.className}`:""),style:t.style,"data-locale":n,"data-size":o,"data-theme":r,"data-type":c,"data-vanity":s,"data-version":p,"data-rendered":"false",id:t.id},e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:b},g),y&&e.createElement(i,{vanity:s,locale:n,size:o,theme:r,type:c,entity:d,version:p,isCreatePage:!1,debug:t.debug,cleanUp:t.cleanUp})):e.createElement(a,{locale:n,size:o,style:t.style,entity:d,theme:r,type:c,vanity:s,noCache:u,version:p,className:t.className,generateUidWithoutApi:l,hideViewProfileButton:t.hideViewProfileButton,id:t.id,debug:t.debug,name:g,fetchViaReactQuery:h,isCreatePage:!1},t.children)}));exports.default=r;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlua2VkaW5iYWRnZS5janMuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOyJ9
/* react-linkedinbadge */
import e,{memo as t,useEffect as n}from"react";async function o(e,t=!1){const n=Object.keys(e),o=window.location.hostname,a=window.location.pathname,i=window.location.search;let r=0;for(let t=0;t<n.length;t++){const o=e[n[t]];if(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.charCodeAt(e)}if(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.charCodeAt(e);if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)r=(r<<5)-r+a.charCodeAt(e);if(i&&"string"==typeof i)for(let e=0;e<i.length;e++)r=(r<<5)-r+i.charCodeAt(e);if(!1===t){const e=await(async()=>new Promise(((e,t)=>{fetch("https://api.ipify.org?format=json").then((e=>e.json())).then((t=>e(t.ip))).catch((t=>e(null)))})))();if(e&&"string"==typeof e)for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t)}return r=(r<<5)-r+Date.now(),r>>>=0,r.toString()}const a=({theme:t="light",style:n})=>e.createElement("i",{className:"profile-badge__header-logo-icon profile-badge__header-logo-icon--"+("light"===t?"light":"dark"),style:{width:"84px",height:"21px",display:"inline-block",fill:"light"===t?"#0a66c2":"#fff",color:"light"===t?"#0a66c2":"#fff",...n},"aria-hidden":"true"},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 84 21",preserveAspectRatio:"xMinYMin meet",version:"1.1",focusable:"false"},e.createElement("g",{className:"inbug",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd"},e.createElement("path",{d:"M19.479,0 L1.583,0 C0.727,0 0,0.677 0,1.511 L0,19.488 C0,20.323 0.477,21 1.333,21 L19.229,21 C20.086,21 21,20.323 21,19.488 L21,1.511 C21,0.677 20.336,0 19.479,0",className:"bug-text-color",transform:"translate(63.000000, 0.000000)"}),e.createElement("path",{d:"M82.479,0 L64.583,0 C63.727,0 63,0.677 63,1.511 L63,19.488 C63,20.323 63.477,21 64.333,21 L82.229,21 C83.086,21 84,20.323 84,19.488 L84,1.511 C84,0.677 83.336,0 82.479,0 Z M71,8 L73.827,8 L73.827,9.441 L73.858,9.441 C74.289,8.664 75.562,7.875 77.136,7.875 C80.157,7.875 81,9.479 81,12.45 L81,18 L78,18 L78,12.997 C78,11.667 77.469,10.5 76.227,10.5 C74.719,10.5 74,11.521 74,13.197 L74,18 L71,18 L71,8 Z M66,18 L69,18 L69,8 L66,8 L66,18 Z M69.375,4.5 C69.375,5.536 68.536,6.375 67.5,6.375 C66.464,6.375 65.625,5.536 65.625,4.5 C65.625,3.464 66.464,2.625 67.5,2.625 C68.536,2.625 69.375,3.464 69.375,4.5 Z",className:"background",fill:"currentColor"})),e.createElement("g",{className:"linkedin-text"},e.createElement("path",{d:"M60,18 L57.2,18 L57.2,16.809 L57.17,16.809 C56.547,17.531 55.465,18.125 53.631,18.125 C51.131,18.125 48.978,16.244 48.978,13.011 C48.978,9.931 51.1,7.875 53.725,7.875 C55.35,7.875 56.359,8.453 56.97,9.191 L57,9.191 L57,3 L60,3 L60,18 Z M54.479,10.125 C52.764,10.125 51.8,11.348 51.8,12.974 C51.8,14.601 52.764,15.875 54.479,15.875 C56.196,15.875 57.2,14.634 57.2,12.974 C57.2,11.268 56.196,10.125 54.479,10.125 L54.479,10.125 Z",fill:"currentColor"}),e.createElement("path",{d:"M47.6611,16.3889 C46.9531,17.3059 45.4951,18.1249 43.1411,18.1249 C40.0001,18.1249 38.0001,16.0459 38.0001,12.7779 C38.0001,9.8749 39.8121,7.8749 43.2291,7.8749 C46.1801,7.8749 48.0001,9.8129 48.0001,13.2219 C48.0001,13.5629 47.9451,13.8999 47.9451,13.8999 L40.8311,13.8999 L40.8481,14.2089 C41.0451,15.0709 41.6961,16.1249 43.1901,16.1249 C44.4941,16.1249 45.3881,15.4239 45.7921,14.8749 L47.6611,16.3889 Z M45.1131,11.9999 C45.1331,10.9449 44.3591,9.8749 43.1391,9.8749 C41.6871,9.8749 40.9121,11.0089 40.8311,11.9999 L45.1131,11.9999 Z",fill:"currentColor"}),e.createElement("polygon",{fill:"currentColor",points:"38 8 34.5 8 31 12 31 3 28 3 28 18 31 18 31 13 34.699 18 38.241 18 34 12.533"}),e.createElement("path",{d:"M16,8 L18.827,8 L18.827,9.441 L18.858,9.441 C19.289,8.664 20.562,7.875 22.136,7.875 C25.157,7.875 26,9.792 26,12.45 L26,18 L23,18 L23,12.997 C23,11.525 22.469,10.5 21.227,10.5 C19.719,10.5 19,11.694 19,13.197 L19,18 L16,18 L16,8 Z",fill:"currentColor"}),e.createElement("path",{d:"M11,18 L14,18 L14,8 L11,8 L11,18 Z M12.501,6.3 C13.495,6.3 14.3,5.494 14.3,4.5 C14.3,3.506 13.495,2.7 12.501,2.7 C11.508,2.7 10.7,3.506 10.7,4.5 C10.7,5.494 11.508,6.3 12.501,6.3 Z",fill:"currentColor"}),e.createElement("polygon",{fill:"currentColor",points:"3 3 0 3 0 18 9 18 9 15 3 15"}))));var i=t((({locale:t="en_US",size:n="medium",style:i,theme:r="light",vanity:l="☯liu",version:c="v1",className:d,type:s="VERTICAL",entity:p="PROFILE",children:f,generateUidWithoutApi:m=!1,hideViewProfileButton:g=!1,id:h,TRACKING_PARAM:u="public-profile-badge",isCreatePage:b=!1,name:y="",noCache:C=!1,debug:w=!1})=>{const[$,L]=e.useState(null),[v,k]=e.useState(null);e.useEffect((()=>{const e=()=>{o({locale:t,size:n,theme:r,type:s,vanity:l,version:c,entity:p,generateUidWithoutApi:m,hideViewProfileButton:g,TRACKING_PARAM:u,isCreatePage:b}).then((e=>{e!==v&&null!==e&&k(e);const o={badgetype:encodeURIComponent(s||"VERTICAL"),badgetheme:encodeURIComponent(r||"light"),locale:t||"en_US",uid:e||`${f||(new Date).getTime()}`,version:encodeURIComponent(c||"v1")};"v2"===c?(o.badgesize=n||"medium",o.entity=p||"PROFILE"):(o.maxsize=encodeURIComponent(n||"medium"),o.trk=u,o.vanityname=encodeURIComponent(l||"☯liu")),b&&(o.fromCreate="true"),b&&(o.fromCreate="true");const a=new XMLHttpRequest,i="https://ziping.liu.academy/api/v2/linkedin/profile/";console.info(`profileData: ${$}, uidNew: ${e}`),null===$&&null!==e&&(a.open("POST",i,!0),a.setRequestHeader("Content-Type","application/json"),a.onreadystatechange=function(){if(4===a.readyState&&200===a.status){console.info(`xmlnew.responseText: ${a.responseText}`);const e=JSON.parse(a.responseText);let o=e.profileHeadline;o=o.replace(/\\u([\dA-Fa-f]{4})/g,((e,t)=>String.fromCodePoint(parseInt(t,16)))),o=o.replace(/&amp;/g,"&"),console.info(`new headlineText: ${o}`),console.info(`old headlineText: ${e.profileHeadline}`),e.profileHeadline=o,w&&console.info(`Retrieved profile badge info for vanity ${l} via API and saving to local storage: `,`'cachedProfileData-${l}-${t}-${n}-${r}-${s}-${p}'`,"profile data",`${Object.keys(e).toString()}`),L(e),localStorage.setItem(`cachedProfileData-${l}-${t}-${n}-${r}-${s}-${p}`,JSON.stringify(e)),localStorage.setItem(`cachedProfileData-${l}-${t}-${n}-${r}-${s}-${p}-lastUpdated`,(new Date).getTime().toString())}},w&&console.info(`Fetching profile badge info now for vanity ${l} via API: `,`'${i}'`,"payloadBodyParams",`${Object.keys(o).toString()}`),a.send(JSON.stringify(o)))}))},a=localStorage.getItem(`cachedProfileData-${l}-${t}-${n}-${r}-${s}-${p}`),i=localStorage.getItem(`cachedProfileData-${l}-${t}-${n}-${r}-${s}-${p}-lastUpdated`),d=(new Date).getTime(),f=parseInt(i||"0",10),h=(d-f)/36e5,y=a&&!a.includes("profileName")||!a||!i||h>48;w&&console.info("cachedProfileData",a,"lastUpdated",i,"isOutDatedOrNotThere",y,"timeDiffInHours",h),C||y?(w&&console.info("Fetching data from API","cachProfileData",a,"lastUpdated",i,"cachedProfileData",a),e()):(w&&console.info("Fetching data from cache linkedinbadge","cachProfileData",a,"lastUpdated",i),L(JSON.parse(a)))}),[t,n,r,s,l,c,p,m,g,u,b,C,w]);const I=e.useMemo((()=>({medium:{VERTICAL:"250",HORIZONTAL:"280"},large:{VERTICAL:"300",HORIZONTAL:"330"}}[n][s])),[n,s]);return e.createElement("div",{id:h,style:i,className:"profile-badge-reacted"+(d?` ${d}`:"")},e.createElement("div",{className:`profile-badge profile-badge--width-${I} profile-badge--`+("light"===r?"light":"dark"),lang:t?.replace(/_[A-Za-z]+$/,"")||"en",dir:"ltr"},e.createElement("div",{className:"profile-badge__header profile-badge__header--"+("light"===r?"light":"dark")},e.createElement("span",{className:"sr-only"},"LinkedIn"),e.createElement(a,{theme:r})),e.createElement("div",{className:"profile-badge__content"},$?.profileImageSrc?e.createElement("img",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",title:$?.profileName,alt:$?.profileName,src:$?.profileImageSrc}):e.createElement("figure",{title:$?.profileName},e.createElement("svg",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 128 128",id:"person-accent-4"},e.createElement("path",{fill:"#e7e2dc",d:"M0 0h128v128H0z"}),e.createElement("path",{d:"M88.41 84.67a32 32 0 10-48.82 0 66.13 66.13 0 0148.82 0z",fill:"#788fa5"}),e.createElement("path",{d:"M88.41 84.67a32 32 0 01-48.82 0A66.79 66.79 0 000 128h128a66.79 66.79 0 00-39.59-43.33z",fill:"#9db3c8"}),e.createElement("path",{d:"M64 96a31.93 31.93 0 0024.41-11.33 66.13 66.13 0 00-48.82 0A31.93 31.93 0 0064 96z",fill:"#56687a"}))),e.createElement("h3",{className:"profile-badge__content-profile-name",itemProp:"name"},$?.profileName&&e.createElement("a",{className:"profile-badge__content-profile-name-link profile-badge__content-profile-name-link--"+("light"===r?"light":"dark"),href:$?.profileNameLink||"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name","data-tracking-control-name":"public-profile-badge-profile-badge-profile-name","data-tracking-will-navigate":""},$?.profileName&&e.createElement(e.Fragment,null,$?.profileName))),$?.profileHeadline&&e.createElement("h4",{className:"profile-badge__content-profile-headline"},$?.profileHeadline),$?.profileCompanyOrSchool&&e.createElement("h4",{className:"profile-badge__content-profile-company-school-info"},$?.profileCompanyOrSchool&&Array.isArray($?.profileCompanyOrSchool)&&$?.profileCompanyOrSchool.map(((t,n)=>e.createElement("span",{key:`${v}-company-school-${n}`},e.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:t.href,className:"profile-badge__content-profile-company-school-info-link profile-badge__content-profile-company-school-info-link--"+("light"===r?"light":"dark"),"data-tracking-control-name":"public-profile-badge-profile-badge_school-name","data-tracking-will-navigate":"true"},t.text)," ",n!==$?.profileCompanyOrSchool.length-1?" | ":""," "))))),f,!1===g&&null!==$&&e.createElement("a",{className:"profile-badge__cta-btn profile-badge__cta-btn--"+("light"===r?"light":"dark"),rel:"noopener noreferrer",href:$?.profileViewLink||`https://www.linkedin.com/in/${encodeURIComponent(l||"☯liu")}?trk=public-profile-badge-profile-badge-profile-cta`,target:"_blank","data-tracking-control-name":"public-profile-badge-profile-badge-view-profile-cta","data-tracking-will-navigate":""},"View profile"),null===$&&e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",key:`${v}-view-profile-no-data`,href:""+(l?`https://www.linkedin.com/in/${l}?trk=profile-badge`:"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name")},y)))}));var r=t((({CALLBACK_NAME:t="LIBadgeCallback",BADGE_NAMES:o=".LI-profile-badge, .LI-entity-badge",TRACKING_PARAM:a="profile-badge",size:i="medium",locale:r="en_US",type:l="vertical",theme:c="light",vanity:d="ziping-liu-1932a029a",version:s="v2",entity:p="profile",isEI:f=!1,isCreatePage:m=!1,debug:g=!0,cleanUp:h=!1})=>{const u=`${o}${[{type:l},{theme:c},{size:i},{locale:r},{version:s},{entity:p},{vanity:d}].map((e=>Object.entries(e).map((([e,t])=>`[data-${e}="${t}"]`)).join(""))).join("")}`,b=document.querySelector(u),y=e.useRef(b);return n((()=>{y.current=b}),[b]),n((()=>{let e=0,n=0;const o=[],y={};g&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`Using query selector: ${u} to find badge element for badge with type: ${l}, theme: ${c}, size: ${i}, locale: ${r}, version: ${s}, entity: ${p}`);const C=(e,t)=>{if(((e,t)=>w(e)&&!y[e.src]&&(!t||t&&!e.getAttribute("data-isartdeco")))(e,t))e.parentNode&&e.parentNode.replaceChild&&e.parentNode.replaceChild($(e),e),y[e.src]=!0;else{const n=Array.from(e.childNodes);for(let e=0;e<n.length;e++)C(n[e],t)}},w=e=>"SCRIPT"===e.tagName,$=e=>{const t=document.createElement("script"),n=Array.from(e.attributes);for(const e of n)t.setAttribute(e.name,e.value);return t},L=(e=!1)=>{const t=e?"https://badges.linkedin-ei":"https://badges.linkedin";return(()=>{if("undefined"!=typeof window){const e=window.location?.hostname||"";return/linkedin(-ei)?.cn$/.test(e)}return!1})()?t+".cn/":t+".com/"},v=(e,t="medium",n="en_US",a="vertical",i="light",r="ziping-liu-1932a029a",l="v2",c="profile",d=!1,s=!1,p="profile-badge",f=!1)=>{const m=e=>{let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t},g=(new Date).getTime()+m(n)+m(a)+m(i)+m(r)+m(l)+m(c)+m(d?"ei":"")+m(s?"create":"")+m(t);let h=L(d),u=["locale="+encodeURIComponent(n),"badgetype="+encodeURIComponent(a),"badgetheme="+encodeURIComponent(i),"uid="+encodeURIComponent(g),"version="+encodeURIComponent(l)];"v2"===l?(h+="view",u.push("badgesize="+encodeURIComponent(t)),u.push("entity="+encodeURIComponent(c)),u=u.concat((e=>Array.from(e.attributes).filter((e=>e.name.startsWith("data-key-"))).map((e=>encodeURIComponent(e.name.replace("data-","").toLowerCase())+"="+encodeURIComponent(e.value))))(e))):(h+="profile",u.push("maxsize="+encodeURIComponent(t)),u.push("trk="+encodeURIComponent(p)),u.push("vanityname="+encodeURIComponent(r))),s&&u.push("fromCreate=true");const b=h+"?"+u.join("&");e.setAttribute("data-uid",String(g)),(e=>{const t=document.createElement("script");t.src=e,o.push(t),document.body.appendChild(t)})(b)};b&&(e++,b.setAttribute("data-rendered","true"),v(b,i,r,l,c,d,s,p,f,m,a,h));const k=e=>{n++;const t=`<body>${e}</body>`,o=document.createElement("iframe"),a=e.match(/class="profile-badge__cta-btn profile-badge__cta-btn--light" href="([^"]*)"/);g&&console.info("%cresponseHandler - matching for url:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`match: ${a?.[1]}`);const i=a?.[1].match(/\/in\/([^\/]*)\?.*/),r=document.querySelector(`[data-vanity="${i?.[1]}"]`);g&&(console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`matchVanityInUrl: ${i?.[1]}`),console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`matchVanityInUrl: ${i?.[1]}`),console.info("%cresponseHandler - matching for badge query:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`badgeVanityQuery: ${r?.innerHTML}`)),o.onload=function(){if(o.contentWindow){const e=o.contentWindow.document.body;o.setAttribute("height",`${(e.scrollHeight||300)+5}`),o.setAttribute("width",`${(e.scrollWidth||330)+5}`)}},o.setAttribute("frameBorder","0"),o.style.display="block",r?(g&&console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`vanity found in query: ${r?.getAttribute("data-vanity")}`),r?.appendChild(o)):b?.appendChild(o),o.contentWindow&&(o.contentWindow.document.open(),o.contentWindow.document.write(t),o.contentWindow.document.close()),C(b,m),g&&console.info("%cresponseHandler - LIRenderAll:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`appending badge to iframe: ${t}, badge: ${b?.getAttribute("data-vanity")}, badge:\n`,b),I()};window[t]=k;const I=()=>{g&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`at tryClean: expectedResponses: ${e}, responsesReceived: ${n}`),h&&e>0&&(n>=e||n>=1)?(g&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;","cleaning up due to responses check passed, expectedResponses > 0 && (responsesReceived >= expectedResponses || responsesReceived >= 1)"),delete window[t],o.forEach((e=>document.body.removeChild(e)))):g&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`not cleaning up due to responses check failed, expectedResponses > 0 && (responsesReceived >= expectedResponses || responsesReceived >= 1), cleanUp = ${h}`)};return()=>{o.forEach((e=>{document.body.contains(e)&&document.body.removeChild(e)})),window[t]===k&&delete window[t]}}),[t,o,a,i,r,l,c,d,s,p,f,m,g,h]),null}));const l=t=>{const n=t.locale||"en_US",o=t.size||"medium",a=t.theme||"light",l=t.generateUidWithoutApi||!1,c=t.type||"VERTICAL",d=t.entity||"PROFILE",s=t.vanity||"☯liu",p=t.version||"v1",f=t.useLinkedInApiUrlPure||!1,m=encodeURIComponent(s),g=t.name||"",h=t.noCache||!1,u=`https://www.linkedin.com/in/${m}?trk=profile-badge`,[b,y]=e.useState(!1);return e.useEffect((()=>{b||(((e,n,o)=>{if(t.debug){const t=(new Date).toLocaleTimeString();console.log(`[${t}] ${n} - ${o}: ${e}`)}})("checking if div is rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),!1===b&&y(!0))}),[b,t.debug]),!0===f?e.createElement("div",{className:"badge-base LI-profile-badge"+(t.className?` ${t.className}`:""),style:t.style,"data-locale":n,"data-size":o,"data-theme":a,"data-type":c,"data-vanity":s,"data-version":p,"data-rendered":"false",id:t.id},e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:u},g),b&&e.createElement(r,{vanity:s,locale:n,size:o,theme:a,type:c,entity:d,version:p,isCreatePage:!1,debug:t.debug,cleanUp:t.cleanUp})):e.createElement(i,{locale:n,size:o,style:t.style,entity:d,theme:a,type:c,vanity:s,noCache:h,version:p,className:t.className,generateUidWithoutApi:l,hideViewProfileButton:t.hideViewProfileButton,id:t.id,debug:t.debug,name:g,isCreatePage:!1},t.children)};export{l as default};
import e,{memo as t,useEffect as n}from"react";import{useQuery as o}from"react-query";async function a(e,t=!1){const n=Object.keys(e),o=window.location.hostname,a=window.location.pathname,i=window.location.search;let r=0;for(let t=0;t<n.length;t++){const o=e[n[t]];if(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.charCodeAt(e)}if(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.charCodeAt(e);if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)r=(r<<5)-r+a.charCodeAt(e);if(i&&"string"==typeof i)for(let e=0;e<i.length;e++)r=(r<<5)-r+i.charCodeAt(e);if(!1===t){const e=await(async()=>new Promise(((e,t)=>{fetch("https://api.ipify.org?format=json").then((e=>e.json())).then((t=>e(t.ip))).catch((t=>e(null)))})))();if(e&&"string"==typeof e)for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t)}return r=(r<<5)-r+Date.now(),r>>>=0,r.toString()}const i=({theme:t="light",style:n})=>e.createElement("i",{className:"profile-badge__header-logo-icon profile-badge__header-logo-icon--"+("light"===t?"light":"dark"),style:{width:"84px",height:"21px",display:"inline-block",fill:"light"===t?"#0a66c2":"#fff",color:"light"===t?"#0a66c2":"#fff",...n},"aria-hidden":"true","aria-label":"LinkedIn"},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 84 21",preserveAspectRatio:"xMinYMin meet",version:"1.1",focusable:"false"},e.createElement("g",{className:"inbug",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd"},e.createElement("path",{d:"M19.479,0 L1.583,0 C0.727,0 0,0.677 0,1.511 L0,19.488 C0,20.323 0.477,21 1.333,21 L19.229,21 C20.086,21 21,20.323 21,19.488 L21,1.511 C21,0.677 20.336,0 19.479,0",className:"bug-text-color",transform:"translate(63.000000, 0.000000)"}),e.createElement("path",{d:"M82.479,0 L64.583,0 C63.727,0 63,0.677 63,1.511 L63,19.488 C63,20.323 63.477,21 64.333,21 L82.229,21 C83.086,21 84,20.323 84,19.488 L84,1.511 C84,0.677 83.336,0 82.479,0 Z M71,8 L73.827,8 L73.827,9.441 L73.858,9.441 C74.289,8.664 75.562,7.875 77.136,7.875 C80.157,7.875 81,9.479 81,12.45 L81,18 L78,18 L78,12.997 C78,11.667 77.469,10.5 76.227,10.5 C74.719,10.5 74,11.521 74,13.197 L74,18 L71,18 L71,8 Z M66,18 L69,18 L69,8 L66,8 L66,18 Z M69.375,4.5 C69.375,5.536 68.536,6.375 67.5,6.375 C66.464,6.375 65.625,5.536 65.625,4.5 C65.625,3.464 66.464,2.625 67.5,2.625 C68.536,2.625 69.375,3.464 69.375,4.5 Z",className:"background",fill:"currentColor"})),e.createElement("g",{className:"linkedin-text"},e.createElement("path",{d:"M60,18 L57.2,18 L57.2,16.809 L57.17,16.809 C56.547,17.531 55.465,18.125 53.631,18.125 C51.131,18.125 48.978,16.244 48.978,13.011 C48.978,9.931 51.1,7.875 53.725,7.875 C55.35,7.875 56.359,8.453 56.97,9.191 L57,9.191 L57,3 L60,3 L60,18 Z M54.479,10.125 C52.764,10.125 51.8,11.348 51.8,12.974 C51.8,14.601 52.764,15.875 54.479,15.875 C56.196,15.875 57.2,14.634 57.2,12.974 C57.2,11.268 56.196,10.125 54.479,10.125 L54.479,10.125 Z",fill:"currentColor"}),e.createElement("path",{d:"M47.6611,16.3889 C46.9531,17.3059 45.4951,18.1249 43.1411,18.1249 C40.0001,18.1249 38.0001,16.0459 38.0001,12.7779 C38.0001,9.8749 39.8121,7.8749 43.2291,7.8749 C46.1801,7.8749 48.0001,9.8129 48.0001,13.2219 C48.0001,13.5629 47.9451,13.8999 47.9451,13.8999 L40.8311,13.8999 L40.8481,14.2089 C41.0451,15.0709 41.6961,16.1249 43.1901,16.1249 C44.4941,16.1249 45.3881,15.4239 45.7921,14.8749 L47.6611,16.3889 Z M45.1131,11.9999 C45.1331,10.9449 44.3591,9.8749 43.1391,9.8749 C41.6871,9.8749 40.9121,11.0089 40.8311,11.9999 L45.1131,11.9999 Z",fill:"currentColor"}),e.createElement("polygon",{fill:"currentColor",points:"38 8 34.5 8 31 12 31 3 28 3 28 18 31 18 31 13 34.699 18 38.241 18 34 12.533"}),e.createElement("path",{d:"M16,8 L18.827,8 L18.827,9.441 L18.858,9.441 C19.289,8.664 20.562,7.875 22.136,7.875 C25.157,7.875 26,9.792 26,12.45 L26,18 L23,18 L23,12.997 C23,11.525 22.469,10.5 21.227,10.5 C19.719,10.5 19,11.694 19,13.197 L19,18 L16,18 L16,8 Z",fill:"currentColor"}),e.createElement("path",{d:"M11,18 L14,18 L14,8 L11,8 L11,18 Z M12.501,6.3 C13.495,6.3 14.3,5.494 14.3,4.5 C14.3,3.506 13.495,2.7 12.501,2.7 C11.508,2.7 10.7,3.506 10.7,4.5 C10.7,5.494 11.508,6.3 12.501,6.3 Z",fill:"currentColor"}),e.createElement("polygon",{fill:"currentColor",points:"3 3 0 3 0 18 9 18 9 15 3 15"}))));var r=t((({locale:t="en_US",size:n="medium",style:r,theme:l="light",vanity:c="☯liu",version:d="v1",className:s,type:p="VERTICAL",entity:f="PROFILE",children:m,generateUidWithoutApi:g=!1,hideViewProfileButton:h=!1,id:u,TRACKING_PARAM:b="public-profile-badge",isCreatePage:y=!1,name:C="",noCache:w=!1,debug:L=!1,fetchViaReactQuery:k=!1})=>{const[v,I]=e.useState(null),[E,R]=e.useState(null),_=e.useCallback((e=>e.replace(/\\u([\dA-Fa-f]{4})/g,((e,t)=>String.fromCodePoint(parseInt(t,16))))),[]),A=e.useCallback(((e,o)=>{const a={badgetype:encodeURIComponent(p||"VERTICAL"),badgetheme:encodeURIComponent(l||"light"),locale:t||"en_US",uid:e||`${o||(new Date).getTime()}`,version:encodeURIComponent(d||"v1")};return"v2"===d?(a.badgesize=n||"medium",a.entity=f||"PROFILE"):(a.maxsize=encodeURIComponent(n||"medium"),a.trk=b,a.vanityname=encodeURIComponent(c||"☯liu")),y&&(a.fromCreate="true"),a}),[p,l,t,d,n,f,b,c,y]),{isLoading:x,error:N}=o(["linkedInProfile",c,E],(()=>async function(e,t){const n=await fetch(`https://ziping.liu.academy/api/v2/linkedin/profile/?vanity=${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error("Failed to fetch LinkedIn profile data with vanity: "+e);return n.json()}(c,A(E))),{enabled:!!E&&k,onSuccess:e=>{L&&console.info("Fetched profile data via React Query:",e);let t=_(e.profileHeadline||"");t=t.replace(/&amp;/g,"&"),e.profileHeadline=t,I(e)}});e.useEffect((()=>{a({locale:t,size:n,theme:l,type:p,vanity:c,version:d,entity:f,generateUidWithoutApi:g,hideViewProfileButton:h,TRACKING_PARAM:b,isCreatePage:y}).then((e=>{if(e!==E&&null!==e&&R(e),k)return;const o=`cachedProfileData-${c}-${t}-${n}-${l}-${p}-${f}`,a=`${o}-lastUpdated`,i=localStorage.getItem(o),r=localStorage.getItem(a),d=(new Date).getTime(),s=parseInt(r||"0",10),m=(d-s)/36e5,g=i&&!i.includes("profileName")||!i||!r||m>48;if(L&&console.info("Local cache check:",{cachedProfileData:i,lastUpdated:r,isCacheOutdatedOrMissing:g,timeDiffInHours:m}),w||g){if(L&&console.info("Using XHR approach to fetch fresh data from API"),null===v&&null!==e){const t=A(e,s),n=new XMLHttpRequest;n.open("POST","https://ziping.liu.academy/api/v2/linkedin/profile/",!0),n.setRequestHeader("Content-Type","application/json"),n.onreadystatechange=function(){if(4===n.readyState&&200===n.status){const e=JSON.parse(n.responseText);let t=_(e.profileHeadline);t=t.replace(/&amp;/g,"&"),e.profileHeadline=t,L&&console.info("XHR success, storing data in state and localStorage:",e),I(e),localStorage.setItem(o,JSON.stringify(e)),localStorage.setItem(a,(new Date).getTime().toString())}},L&&console.info("XHR sending payload:",t),n.send(JSON.stringify(t))}}else L&&console.info("Loading from cache for LinkedIn profile data"),i&&I(JSON.parse(i))}))}),[t,n,l,p,c,d,f,g,h,b,y,w,L,k,A]);const $=e.useMemo((()=>({medium:{VERTICAL:"250",HORIZONTAL:"280"},large:{VERTICAL:"300",HORIZONTAL:"330"}}[n][p])),[n,p]);if(k&&(x||N)){if(x)return e.createElement("div",null,"Loading...");if(N)return e.createElement("div",null,"Error: ",N?.message)}return e.createElement("div",{id:u,style:r,className:"profile-badge-reacted"+(s?` ${s}`:"")},e.createElement("div",{className:`profile-badge profile-badge--width-${$} profile-badge--`+("light"===l?"light":"dark"),lang:t?.replace(/_[A-Za-z]+$/,"")||"en",dir:"ltr"},e.createElement("div",{className:"profile-badge__header profile-badge__header--"+("light"===l?"light":"dark")},e.createElement("span",{className:"sr-only"},"LinkedIn"),e.createElement(i,{theme:l})),e.createElement("div",{className:"profile-badge__content"},v?.profileImageSrc?e.createElement("img",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",title:v?.profileName,alt:v?.profileName,src:v?.profileImageSrc}):e.createElement("figure",{title:v?.profileName},e.createElement("svg",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 128 128",id:"person-accent-4"},e.createElement("path",{fill:"#e7e2dc",d:"M0 0h128v128H0z"}),e.createElement("path",{d:"M88.41 84.67a32 32 0 10-48.82 0 66.13 66.13 0 0148.82 0z",fill:"#788fa5"}),e.createElement("path",{d:"M88.41 84.67a32 32 0 01-48.82 0A66.79 66.79 0 000 128h128a66.79 66.79 0 00-39.59-43.33z",fill:"#9db3c8"}),e.createElement("path",{d:"M64 96a31.93 31.93 0 0024.41-11.33 66.13 66.13 0 00-48.82 0A31.93 31.93 0 0064 96z",fill:"#56687a"}))),e.createElement("h3",{className:"profile-badge__content-profile-name",itemProp:"name"},v?.profileName&&e.createElement("a",{className:"profile-badge__content-profile-name-link profile-badge__content-profile-name-link--"+("light"===l?"light":"dark"),href:v?.profileNameLink||"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name","data-tracking-control-name":"public-profile-badge-profile-badge-profile-name","data-tracking-will-navigate":""},v?.profileName)),v?.profileHeadline&&e.createElement("h4",{className:"profile-badge__content-profile-headline"},v?.profileHeadline),v?.profileCompanyOrSchool&&e.createElement("h4",{className:"profile-badge__content-profile-company-school-info"},Array.isArray(v?.profileCompanyOrSchool)&&v?.profileCompanyOrSchool.map(((t,n)=>e.createElement("span",{key:`${E}-company-school-${n}`},e.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:t.href,className:"profile-badge__content-profile-company-school-info-link profile-badge__content-profile-company-school-info-link--"+("light"===l?"light":"dark"),"data-tracking-control-name":"public-profile-badge-profile-badge_school-name","data-tracking-will-navigate":"true"},t.text)," ",n!==v?.profileCompanyOrSchool.length-1?" | ":""," "," "))))),m,!1===h&&null!==v&&e.createElement("a",{className:"profile-badge__cta-btn profile-badge__cta-btn--"+("light"===l?"light":"dark"),rel:"noopener noreferrer",href:v?.profileViewLink||`https://www.linkedin.com/in/${encodeURIComponent(c||"☯liu")}?trk=public-profile-badge-profile-badge-profile-cta`,target:"_blank","data-tracking-control-name":"public-profile-badge-profile-badge-view-profile-cta","data-tracking-will-navigate":""},"View profile"),null===v&&e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",key:`${E}-view-profile-no-data`,href:c?`https://www.linkedin.com/in/${c}?trk=profile-badge`:"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name"},C)))}));var l=t((({CALLBACK_NAME:t="LIBadgeCallback",BADGE_NAMES:o=".LI-profile-badge, .LI-entity-badge",TRACKING_PARAM:a="profile-badge",size:i="medium",locale:r="en_US",type:l="vertical",theme:c="light",vanity:d="ziping-liu-1932a029a",version:s="v2",entity:p="profile",isEI:f=!1,isCreatePage:m=!1,debug:g=!0,cleanUp:h=!1})=>{const u=`${o}${[{type:l},{theme:c},{size:i},{locale:r},{version:s},{entity:p},{vanity:d}].map((e=>Object.entries(e).map((([e,t])=>`[data-${e}="${t}"]`)).join(""))).join("")}`,b=document.querySelector(u),y=e.useRef(b);return n((()=>{y.current=b}),[b]),n((()=>{let e=0,n=0;const o=[],y={};g&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`Using query selector: ${u} to find badge element for badge with type: ${l}, theme: ${c}, size: ${i}, locale: ${r}, version: ${s}, entity: ${p}`);const C=(e,t)=>{if(((e,t)=>w(e)&&!y[e.src]&&(!t||t&&!e.getAttribute("data-isartdeco")))(e,t))e.parentNode&&e.parentNode.replaceChild&&e.parentNode.replaceChild(L(e),e),y[e.src]=!0;else{const n=Array.from(e.childNodes);for(let e=0;e<n.length;e++)C(n[e],t)}},w=e=>"SCRIPT"===e.tagName,L=e=>{const t=document.createElement("script"),n=Array.from(e.attributes);for(const e of n)t.setAttribute(e.name,e.value);return t},k=(e=!1)=>{const t=e?"https://badges.linkedin-ei":"https://badges.linkedin";return(()=>{if("undefined"!=typeof window){const e=window.location?.hostname||"";return/linkedin(-ei)?.cn$/.test(e)}return!1})()?t+".cn/":t+".com/"},v=(e,t="medium",n="en_US",a="vertical",i="light",r="ziping-liu-1932a029a",l="v2",c="profile",d=!1,s=!1,p="profile-badge",f=!1)=>{const m=e=>{let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t},g=(new Date).getTime()+m(n)+m(a)+m(i)+m(r)+m(l)+m(c)+m(d?"ei":"")+m(s?"create":"")+m(t);let h=k(d),u=["locale="+encodeURIComponent(n),"badgetype="+encodeURIComponent(a),"badgetheme="+encodeURIComponent(i),"uid="+encodeURIComponent(g),"version="+encodeURIComponent(l)];"v2"===l?(h+="view",u.push("badgesize="+encodeURIComponent(t)),u.push("entity="+encodeURIComponent(c)),u=u.concat((e=>Array.from(e.attributes).filter((e=>e.name.startsWith("data-key-"))).map((e=>encodeURIComponent(e.name.replace("data-","").toLowerCase())+"="+encodeURIComponent(e.value))))(e))):(h+="profile",u.push("maxsize="+encodeURIComponent(t)),u.push("trk="+encodeURIComponent(p)),u.push("vanityname="+encodeURIComponent(r))),s&&u.push("fromCreate=true");const b=h+"?"+u.join("&");e.setAttribute("data-uid",String(g)),(e=>{const t=document.createElement("script");t.src=e,o.push(t),document.body.appendChild(t)})(b)};b&&(e++,b.setAttribute("data-rendered","true"),v(b,i,r,l,c,d,s,p,f,m,a,h));const I=e=>{n++;const t=`<body>${e}</body>`,o=document.createElement("iframe"),a=e.match(/class="profile-badge__cta-btn profile-badge__cta-btn--light" href="([^"]*)"/);g&&console.info("%cresponseHandler - matching for url:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`match: ${a?.[1]}`);const i=a?.[1].match(/\/in\/([^\/]*)\?.*/),r=document.querySelector(`[data-vanity="${i?.[1]}"]`);g&&(console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`matchVanityInUrl: ${i?.[1]}`),console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`matchVanityInUrl: ${i?.[1]}`),console.info("%cresponseHandler - matching for badge query:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`badgeVanityQuery: ${r?.innerHTML}`)),o.onload=function(){if(o.contentWindow){const e=o.contentWindow.document.body;o.setAttribute("height",`${(e.scrollHeight||300)+5}`),o.setAttribute("width",`${(e.scrollWidth||330)+5}`)}},o.setAttribute("frameBorder","0"),o.style.display="block",r?(g&&console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`vanity found in query: ${r?.getAttribute("data-vanity")}`),r?.appendChild(o)):b?.appendChild(o),o.contentWindow&&(o.contentWindow.document.open(),o.contentWindow.document.write(t),o.contentWindow.document.close()),C(b,m),g&&console.info("%cresponseHandler - LIRenderAll:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`appending badge to iframe: ${t}, badge: ${b?.getAttribute("data-vanity")}, badge:\n`,b),E()};window[t]=I;const E=()=>{g&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`at tryClean: expectedResponses: ${e}, responsesReceived: ${n}`),h&&e>0&&(n>=e||n>=1)?(g&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;","cleaning up due to responses check passed, expectedResponses > 0 && (responsesReceived >= expectedResponses || responsesReceived >= 1)"),delete window[t],o.forEach((e=>document.body.removeChild(e)))):g&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`not cleaning up due to responses check failed, expectedResponses > 0 && (responsesReceived >= expectedResponses || responsesReceived >= 1), cleanUp = ${h}`)};return()=>{o.forEach((e=>{document.body.contains(e)&&document.body.removeChild(e)})),window[t]===I&&delete window[t]}}),[t,o,a,i,r,l,c,d,s,p,f,m,g,h]),null}));var c=t((t=>{const n=t.locale||"en_US",o=t.size||"medium",a=t.theme||"light",i=t.generateUidWithoutApi||!1,c=t.type||"VERTICAL",d=t.entity||"PROFILE",s=t.vanity||"☯liu",p=t.version||"v1",f=t.useLinkedInApiUrlPure||!1,m=encodeURIComponent(s),g=t.name||"",h=t.noCache||!1,u=t?.useQueryToFetch??!1,b=`https://www.linkedin.com/in/${m}?trk=profile-badge`,[y,C]=e.useState(!1);return e.useEffect((()=>{y||(((e,n,o)=>{if(t.debug){const t=(new Date).toLocaleTimeString();console.log(`[${t}] ${n} - ${o}: ${e}`)}})("checking if div is rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),!1===y&&C(!0))}),[y,t.debug]),!0===f?e.createElement("div",{className:"badge-base LI-profile-badge"+(t.className?` ${t.className}`:""),style:t.style,"data-locale":n,"data-size":o,"data-theme":a,"data-type":c,"data-vanity":s,"data-version":p,"data-rendered":"false",id:t.id},e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:b},g),y&&e.createElement(l,{vanity:s,locale:n,size:o,theme:a,type:c,entity:d,version:p,isCreatePage:!1,debug:t.debug,cleanUp:t.cleanUp})):e.createElement(r,{locale:n,size:o,style:t.style,entity:d,theme:a,type:c,vanity:s,noCache:h,version:p,className:t.className,generateUidWithoutApi:i,hideViewProfileButton:t.hideViewProfileButton,id:t.id,debug:t.debug,name:g,fetchViaReactQuery:u,isCreatePage:!1},t.children)}));export{c as default};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlua2VkaW5iYWRnZS5lc20uanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOyJ9
/* LinkedInBadge */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).React)}(this,(function(e){"use strict";
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("react"),require("react-query")):"function"==typeof define&&define.amd?define(["react","react-query"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).React,e.reactQuery)}(this,(function(e,t){"use strict";
/**

@@ -9,15 +9,56 @@ *

* @returns {Promise<string>} The generated UID, which is an unsigned 32-bit integer in string format.
*/async function t(e,t=!1){const n=Object.keys(e),o=window.location.hostname,a=window.location.pathname,i=window.location.search;
*/async function n(e,t=!1){const n=Object.keys(e),o=window.location.hostname,a=window.location.pathname,i=window.location.search;
// create hash from the keys, values, hostname, pathname, search, and ip address, hash
// should be a number, created via bitwise operations
let r=0;for(let t=0;t<n.length;t++){const o=e[n[t]];if(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.charCodeAt(e)}if(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.charCodeAt(e);if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)r=(r<<5)-r+a.charCodeAt(e);if(i&&"string"==typeof i)for(let e=0;e<i.length;e++)r=(r<<5)-r+i.charCodeAt(e);if(!1===t){const e=await(async()=>new Promise(((e,t)=>{fetch("https://api.ipify.org?format=json").then((e=>e.json())).then((t=>e(t.ip))).catch((t=>e(null)))})))();if(e&&"string"==typeof e)for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t)}return r=(r<<5)-r+Date.now(),r>>>=0,r.toString()}const n=({theme:t="light",style:n})=>e.createElement("i",{className:"profile-badge__header-logo-icon profile-badge__header-logo-icon--"+("light"===t?"light":"dark"),style:{width:"84px",height:"21px",display:"inline-block",fill:"light"===t?"#0a66c2":"#fff",color:"light"===t?"#0a66c2":"#fff",...n},"aria-hidden":"true"},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 84 21",preserveAspectRatio:"xMinYMin meet",version:"1.1",focusable:"false"},e.createElement("g",{className:"inbug",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd"},e.createElement("path",{d:"M19.479,0 L1.583,0 C0.727,0 0,0.677 0,1.511 L0,19.488 C0,20.323 0.477,21 1.333,21 L19.229,21 C20.086,21 21,20.323 21,19.488 L21,1.511 C21,0.677 20.336,0 19.479,0",className:"bug-text-color",transform:"translate(63.000000, 0.000000)"}),e.createElement("path",{d:"M82.479,0 L64.583,0 C63.727,0 63,0.677 63,1.511 L63,19.488 C63,20.323 63.477,21 64.333,21 L82.229,21 C83.086,21 84,20.323 84,19.488 L84,1.511 C84,0.677 83.336,0 82.479,0 Z M71,8 L73.827,8 L73.827,9.441 L73.858,9.441 C74.289,8.664 75.562,7.875 77.136,7.875 C80.157,7.875 81,9.479 81,12.45 L81,18 L78,18 L78,12.997 C78,11.667 77.469,10.5 76.227,10.5 C74.719,10.5 74,11.521 74,13.197 L74,18 L71,18 L71,8 Z M66,18 L69,18 L69,8 L66,8 L66,18 Z M69.375,4.5 C69.375,5.536 68.536,6.375 67.5,6.375 C66.464,6.375 65.625,5.536 65.625,4.5 C65.625,3.464 66.464,2.625 67.5,2.625 C68.536,2.625 69.375,3.464 69.375,4.5 Z",className:"background",fill:"currentColor"})),e.createElement("g",{className:"linkedin-text"},e.createElement("path",{d:"M60,18 L57.2,18 L57.2,16.809 L57.17,16.809 C56.547,17.531 55.465,18.125 53.631,18.125 C51.131,18.125 48.978,16.244 48.978,13.011 C48.978,9.931 51.1,7.875 53.725,7.875 C55.35,7.875 56.359,8.453 56.97,9.191 L57,9.191 L57,3 L60,3 L60,18 Z M54.479,10.125 C52.764,10.125 51.8,11.348 51.8,12.974 C51.8,14.601 52.764,15.875 54.479,15.875 C56.196,15.875 57.2,14.634 57.2,12.974 C57.2,11.268 56.196,10.125 54.479,10.125 L54.479,10.125 Z",fill:"currentColor"}),e.createElement("path",{d:"M47.6611,16.3889 C46.9531,17.3059 45.4951,18.1249 43.1411,18.1249 C40.0001,18.1249 38.0001,16.0459 38.0001,12.7779 C38.0001,9.8749 39.8121,7.8749 43.2291,7.8749 C46.1801,7.8749 48.0001,9.8129 48.0001,13.2219 C48.0001,13.5629 47.9451,13.8999 47.9451,13.8999 L40.8311,13.8999 L40.8481,14.2089 C41.0451,15.0709 41.6961,16.1249 43.1901,16.1249 C44.4941,16.1249 45.3881,15.4239 45.7921,14.8749 L47.6611,16.3889 Z M45.1131,11.9999 C45.1331,10.9449 44.3591,9.8749 43.1391,9.8749 C41.6871,9.8749 40.9121,11.0089 40.8311,11.9999 L45.1131,11.9999 Z",fill:"currentColor"}),e.createElement("polygon",{fill:"currentColor",points:"38 8 34.5 8 31 12 31 3 28 3 28 18 31 18 31 13 34.699 18 38.241 18 34 12.533"}),e.createElement("path",{d:"M16,8 L18.827,8 L18.827,9.441 L18.858,9.441 C19.289,8.664 20.562,7.875 22.136,7.875 C25.157,7.875 26,9.792 26,12.45 L26,18 L23,18 L23,12.997 C23,11.525 22.469,10.5 21.227,10.5 C19.719,10.5 19,11.694 19,13.197 L19,18 L16,18 L16,8 Z",fill:"currentColor"}),e.createElement("path",{d:"M11,18 L14,18 L14,8 L11,8 L11,18 Z M12.501,6.3 C13.495,6.3 14.3,5.494 14.3,4.5 C14.3,3.506 13.495,2.7 12.501,2.7 C11.508,2.7 10.7,3.506 10.7,4.5 C10.7,5.494 11.508,6.3 12.501,6.3 Z",fill:"currentColor"}),e.createElement("polygon",{fill:"currentColor",points:"3 3 0 3 0 18 9 18 9 15 3 15"}))));var o=e.memo((({locale:o="en_US",size:a="medium",style:i,theme:r="light",vanity:l="☯liu",version:d="v1",className:c,type:s="VERTICAL",entity:p="PROFILE",children:f,generateUidWithoutApi:m=!1,hideViewProfileButton:g=!1,id:h,TRACKING_PARAM:u="public-profile-badge",isCreatePage:b=!1,name:y="",noCache:C=!1,debug:w=!1})=>{const[$,L]=e.useState(null),[v,k]=e.useState(null);e.useEffect((()=>{const e=()=>{t({locale:o,size:a,theme:r,type:s,vanity:l,version:d,entity:p,generateUidWithoutApi:m,hideViewProfileButton:g,TRACKING_PARAM:u,isCreatePage:b}).then((e=>{e!==v&&null!==e&&k(e);const t={badgetype:encodeURIComponent(s||"VERTICAL"),badgetheme:encodeURIComponent(r||"light"),locale:o||"en_US",uid:e||`${f||(new Date).getTime()}`,version:encodeURIComponent(d||"v1")};"v2"===d?(t.badgesize=a||"medium",t.entity=p||"PROFILE"):(t.maxsize=encodeURIComponent(a||"medium"),t.trk=u,t.vanityname=encodeURIComponent(l||"☯liu")),b&&(t.fromCreate="true"),b&&(t.fromCreate="true");const n=new XMLHttpRequest,i="https://ziping.liu.academy/api/v2/linkedin/profile/";console.info(`profileData: ${$}, uidNew: ${e}`),null===$&&null!==e&&(n.open("POST",i,!0),n.setRequestHeader("Content-Type","application/json"),n.onreadystatechange=function(){if(4===n.readyState&&200===n.status){console.info(`xmlnew.responseText: ${n.responseText}`);const e=JSON.parse(n.responseText);let t=e.profileHeadline;t=t.replace(/\\u([\dA-Fa-f]{4})/g,((e,t)=>String.fromCodePoint(parseInt(t,16)))),t=t.replace(/&amp;/g,"&"),
// No need for captureUnicodeEscapes and JSON.parse anymore.
console.info(`new headlineText: ${t}`),console.info(`old headlineText: ${e.profileHeadline}`),e.profileHeadline=t,w&&console.info(`Retrieved profile badge info for vanity ${l} via API and saving to local storage: `,`'cachedProfileData-${l}-${o}-${a}-${r}-${s}-${p}'`,"profile data",`${Object.keys(e).toString()}`),L(e),localStorage.setItem(`cachedProfileData-${l}-${o}-${a}-${r}-${s}-${p}`,JSON.stringify(e)),localStorage.setItem(`cachedProfileData-${l}-${o}-${a}-${r}-${s}-${p}-lastUpdated`,(new Date).getTime().toString())}},w&&console.info(`Fetching profile badge info now for vanity ${l} via API: `,`'${i}'`,"payloadBodyParams",`${Object.keys(t).toString()}`),n.send(JSON.stringify(t)))}))},n=localStorage.getItem(`cachedProfileData-${l}-${o}-${a}-${r}-${s}-${p}`),i=localStorage.getItem(`cachedProfileData-${l}-${o}-${a}-${r}-${s}-${p}-lastUpdated`),c=(new Date).getTime(),f=parseInt(i||"0",10),h=(c-f)/36e5,y=n&&!n.includes("profileName")||!n||!i||h>48;w&&console.info("cachedProfileData",n,"lastUpdated",i,"isOutDatedOrNotThere",y,"timeDiffInHours",h),C||y?(w&&console.info("Fetching data from API","cachProfileData",n,"lastUpdated",i,"cachedProfileData",n),e()):(w&&console.info("Fetching data from cache linkedinbadge","cachProfileData",n,"lastUpdated",i),L(JSON.parse(n)))}),[o,a,r,s,l,d,p,m,g,u,b,C,w]);const I=e.useMemo((()=>({medium:{VERTICAL:"250",HORIZONTAL:"280"},large:{VERTICAL:"300",HORIZONTAL:"330"}}[a][s])),[a,s]);return e.createElement("div",{id:h,style:i,className:"profile-badge-reacted"+(c?` ${c}`:"")},e.createElement("div",{className:`profile-badge profile-badge--width-${I} profile-badge--`+("light"===r?"light":"dark"),lang:o?.replace(/_[A-Za-z]+$/,"")||"en",dir:"ltr"},e.createElement("div",{className:"profile-badge__header profile-badge__header--"+("light"===r?"light":"dark")},e.createElement("span",{className:"sr-only"},"LinkedIn"),e.createElement(n,{theme:r})),e.createElement("div",{className:"profile-badge__content"},$?.profileImageSrc?e.createElement("img",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",title:$?.profileName,alt:$?.profileName,src:$?.profileImageSrc}):e.createElement("figure",{title:$?.profileName},e.createElement("svg",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 128 128",id:"person-accent-4"},e.createElement("path",{fill:"#e7e2dc",d:"M0 0h128v128H0z"}),e.createElement("path",{d:"M88.41 84.67a32 32 0 10-48.82 0 66.13 66.13 0 0148.82 0z",fill:"#788fa5"}),e.createElement("path",{d:"M88.41 84.67a32 32 0 01-48.82 0A66.79 66.79 0 000 128h128a66.79 66.79 0 00-39.59-43.33z",fill:"#9db3c8"}),e.createElement("path",{d:"M64 96a31.93 31.93 0 0024.41-11.33 66.13 66.13 0 00-48.82 0A31.93 31.93 0 0064 96z",fill:"#56687a"}))),e.createElement("h3",{className:"profile-badge__content-profile-name",itemProp:"name"},$?.profileName&&e.createElement("a",{className:"profile-badge__content-profile-name-link profile-badge__content-profile-name-link--"+("light"===r?"light":"dark"),href:$?.profileNameLink||"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name","data-tracking-control-name":"public-profile-badge-profile-badge-profile-name","data-tracking-will-navigate":""},$?.profileName&&e.createElement(e.Fragment,null,$?.profileName))),$?.profileHeadline&&e.createElement("h4",{className:"profile-badge__content-profile-headline"},$?.profileHeadline),$?.profileCompanyOrSchool&&e.createElement("h4",{className:"profile-badge__content-profile-company-school-info"},$?.profileCompanyOrSchool&&Array.isArray($?.profileCompanyOrSchool)&&$?.profileCompanyOrSchool.map(((t,n)=>e.createElement("span",{key:`${v}-company-school-${n}`},e.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:t.href,className:"profile-badge__content-profile-company-school-info-link profile-badge__content-profile-company-school-info-link--"+("light"===r?"light":"dark"),"data-tracking-control-name":"public-profile-badge-profile-badge_school-name","data-tracking-will-navigate":"true"},t.text)," ",n!==$?.profileCompanyOrSchool.length-1?" | ":""," "))))),f,!1===g&&null!==$&&e.createElement("a",{className:"profile-badge__cta-btn profile-badge__cta-btn--"+("light"===r?"light":"dark"),rel:"noopener noreferrer",href:$?.profileViewLink||`https://www.linkedin.com/in/${encodeURIComponent(l||"☯liu")}?trk=public-profile-badge-profile-badge-profile-cta`,target:"_blank","data-tracking-control-name":"public-profile-badge-profile-badge-view-profile-cta","data-tracking-will-navigate":""},"View profile"),null===$&&e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",key:`${v}-view-profile-no-data`,href:""+(l?`https://www.linkedin.com/in/${l}?trk=profile-badge`:"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name")},y)))}));var a=e.memo((({CALLBACK_NAME:t="LIBadgeCallback",BADGE_NAMES:n=".LI-profile-badge, .LI-entity-badge",TRACKING_PARAM:o="profile-badge",size:a="medium",locale:i="en_US",type:r="vertical",theme:l="light",vanity:d="ziping-liu-1932a029a",version:c="v2",entity:s="profile",isEI:p=!1,isCreatePage:f=!1,debug:m=!0,cleanUp:g=!1})=>{const h=`${n}${[{type:r},{theme:l},{size:a},{locale:i},{version:c},{entity:s},{vanity:d}].map((e=>Object.entries(e).map((([e,t])=>`[data-${e}="${t}"]`)).join(""))).join("")}`,u=document.querySelector(h),b=e.useRef(u);
let r=0;for(let t=0;t<n.length;t++){const o=e[n[t]];if(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.charCodeAt(e)}if(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.charCodeAt(e);if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)r=(r<<5)-r+a.charCodeAt(e);if(i&&"string"==typeof i)for(let e=0;e<i.length;e++)r=(r<<5)-r+i.charCodeAt(e);if(!1===t){const e=await(async()=>new Promise(((e,t)=>{fetch("https://api.ipify.org?format=json").then((e=>e.json())).then((t=>e(t.ip))).catch((t=>e(null)))})))();if(e&&"string"==typeof e)for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t)}return r=(r<<5)-r+Date.now(),r>>>=0,r.toString()}const o=({theme:t="light",style:n})=>e.createElement("i",{className:"profile-badge__header-logo-icon profile-badge__header-logo-icon--"+("light"===t?"light":"dark"),style:{width:"84px",height:"21px",display:"inline-block",fill:"light"===t?"#0a66c2":"#fff",color:"light"===t?"#0a66c2":"#fff",...n},"aria-hidden":"true","aria-label":"LinkedIn"},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 84 21",preserveAspectRatio:"xMinYMin meet",version:"1.1",focusable:"false"},e.createElement("g",{className:"inbug",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd"},e.createElement("path",{d:"M19.479,0 L1.583,0 C0.727,0 0,0.677 0,1.511 L0,19.488 C0,20.323 0.477,21 1.333,21 L19.229,21 C20.086,21 21,20.323 21,19.488 L21,1.511 C21,0.677 20.336,0 19.479,0",className:"bug-text-color",transform:"translate(63.000000, 0.000000)"}),e.createElement("path",{d:"M82.479,0 L64.583,0 C63.727,0 63,0.677 63,1.511 L63,19.488 C63,20.323 63.477,21 64.333,21 L82.229,21 C83.086,21 84,20.323 84,19.488 L84,1.511 C84,0.677 83.336,0 82.479,0 Z M71,8 L73.827,8 L73.827,9.441 L73.858,9.441 C74.289,8.664 75.562,7.875 77.136,7.875 C80.157,7.875 81,9.479 81,12.45 L81,18 L78,18 L78,12.997 C78,11.667 77.469,10.5 76.227,10.5 C74.719,10.5 74,11.521 74,13.197 L74,18 L71,18 L71,8 Z M66,18 L69,18 L69,8 L66,8 L66,18 Z M69.375,4.5 C69.375,5.536 68.536,6.375 67.5,6.375 C66.464,6.375 65.625,5.536 65.625,4.5 C65.625,3.464 66.464,2.625 67.5,2.625 C68.536,2.625 69.375,3.464 69.375,4.5 Z",className:"background",fill:"currentColor"})),e.createElement("g",{className:"linkedin-text"},e.createElement("path",{d:"M60,18 L57.2,18 L57.2,16.809 L57.17,16.809 C56.547,17.531 55.465,18.125 53.631,18.125 C51.131,18.125 48.978,16.244 48.978,13.011 C48.978,9.931 51.1,7.875 53.725,7.875 C55.35,7.875 56.359,8.453 56.97,9.191 L57,9.191 L57,3 L60,3 L60,18 Z M54.479,10.125 C52.764,10.125 51.8,11.348 51.8,12.974 C51.8,14.601 52.764,15.875 54.479,15.875 C56.196,15.875 57.2,14.634 57.2,12.974 C57.2,11.268 56.196,10.125 54.479,10.125 L54.479,10.125 Z",fill:"currentColor"}),e.createElement("path",{d:"M47.6611,16.3889 C46.9531,17.3059 45.4951,18.1249 43.1411,18.1249 C40.0001,18.1249 38.0001,16.0459 38.0001,12.7779 C38.0001,9.8749 39.8121,7.8749 43.2291,7.8749 C46.1801,7.8749 48.0001,9.8129 48.0001,13.2219 C48.0001,13.5629 47.9451,13.8999 47.9451,13.8999 L40.8311,13.8999 L40.8481,14.2089 C41.0451,15.0709 41.6961,16.1249 43.1901,16.1249 C44.4941,16.1249 45.3881,15.4239 45.7921,14.8749 L47.6611,16.3889 Z M45.1131,11.9999 C45.1331,10.9449 44.3591,9.8749 43.1391,9.8749 C41.6871,9.8749 40.9121,11.0089 40.8311,11.9999 L45.1131,11.9999 Z",fill:"currentColor"}),e.createElement("polygon",{fill:"currentColor",points:"38 8 34.5 8 31 12 31 3 28 3 28 18 31 18 31 13 34.699 18 38.241 18 34 12.533"}),e.createElement("path",{d:"M16,8 L18.827,8 L18.827,9.441 L18.858,9.441 C19.289,8.664 20.562,7.875 22.136,7.875 C25.157,7.875 26,9.792 26,12.45 L26,18 L23,18 L23,12.997 C23,11.525 22.469,10.5 21.227,10.5 C19.719,10.5 19,11.694 19,13.197 L19,18 L16,18 L16,8 Z",fill:"currentColor"}),e.createElement("path",{d:"M11,18 L14,18 L14,8 L11,8 L11,18 Z M12.501,6.3 C13.495,6.3 14.3,5.494 14.3,4.5 C14.3,3.506 13.495,2.7 12.501,2.7 C11.508,2.7 10.7,3.506 10.7,4.5 C10.7,5.494 11.508,6.3 12.501,6.3 Z",fill:"currentColor"}),e.createElement("polygon",{fill:"currentColor",points:"3 3 0 3 0 18 9 18 9 15 3 15"}))));
/**
* Helper function to POST a payload to /api/v2/linkedin/profile/ for React Query usage.
*/var a=e.memo((({locale:a="en_US",size:i="medium",style:r,theme:l="light",vanity:c="☯liu",version:d="v1",className:s,type:p="VERTICAL",entity:f="PROFILE",children:m,generateUidWithoutApi:g=!1,hideViewProfileButton:u=!1,id:h,TRACKING_PARAM:b="public-profile-badge",isCreatePage:y=!1,name:C="",noCache:w=!1,debug:L=!1,fetchViaReactQuery:k=!1})=>{
// Local state for storing the fetched LinkedIn profile data
const[v,I]=e.useState(null),[E,R]=e.useState(null),_=e.useCallback((e=>e.replace(/\\u([\dA-Fa-f]{4})/g,((e,t)=>String.fromCodePoint(parseInt(t,16))))),[]),A=e.useCallback(((e,t)=>{const n={badgetype:encodeURIComponent(p||"VERTICAL"),badgetheme:encodeURIComponent(l||"light"),locale:a||"en_US",uid:e||`${t||(new Date).getTime()}`,version:encodeURIComponent(d||"v1")};
// Depending on v1 or v2, different fields are required
return"v2"===d?(n.badgesize=i||"medium",n.entity=f||"PROFILE"):(n.maxsize=encodeURIComponent(i||"medium"),n.trk=b,n.vanityname=encodeURIComponent(c||"☯liu")),y&&(n.fromCreate="true"),n}),[p,l,a,d,i,f,b,c,y]),{isLoading:x,error:N}=t.useQuery(["linkedInProfile",c,E],(()=>async function(e,t){const n=await fetch(`https://ziping.liu.academy/api/v2/linkedin/profile/?vanity=${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error("Failed to fetch LinkedIn profile data with vanity: "+e);return n.json()}(c,A(E))),{
// Only enabled if we have a UID (we've generated it) AND the user wants React Query
enabled:!!E&&k,onSuccess:e=>{L&&console.info("Fetched profile data via React Query:",e);
// Convert headline’s \u-escapes and &amp;
let t=_(e.profileHeadline||"");t=t.replace(/&amp;/g,"&"),e.profileHeadline=t,I(e)}
// Optionally store in localStorage if you wish to keep consistent caching
// localStorage.setItem("...", JSON.stringify(dataFetched));
});
// Local state for storing the unique badge ID
/**
* Effect: (1) Generate the UID, (2) either use React Query or the legacy XHR approach
* to fetch data if needed, (3) handle local storage caching logic if XHR-based approach is used.
*/
e.useEffect((()=>{
// First step: Generate a unique ID for the badge
n({locale:a,size:i,theme:l,type:p,vanity:c,version:d,entity:f,generateUidWithoutApi:g,hideViewProfileButton:u,TRACKING_PARAM:b,isCreatePage:y}).then((e=>{
// If React Query is requested, we skip the legacy XHR because useQuery() above handles it.
if(e!==E&&null!==e&&R(e),k)return;
// *********************** Legacy XHR-based Approach ***********************
// The following logic is the same as the older code: checks local storage and last-updated time
const t=`cachedProfileData-${c}-${a}-${i}-${l}-${p}-${f}`,n=`${t}-lastUpdated`,o=localStorage.getItem(t),r=localStorage.getItem(n),d=(new Date).getTime(),s=parseInt(r||"0",10),m=(d-s)/36e5,g=o&&!o.includes("profileName")||!o||!r||m>48;
// If cache is missing or noCache is explicitly set, fetch from server
if(L&&console.info("Local cache check:",{cachedProfileData:o,lastUpdated:r,isCacheOutdatedOrMissing:g,timeDiffInHours:m}),w||g){
// Only fetch if we haven’t already fetched profile data and have a valid UID
if(L&&console.info("Using XHR approach to fetch fresh data from API"),null===v&&null!==e){const o=A(e,s),a=new XMLHttpRequest;a.open("POST","https://ziping.liu.academy/api/v2/linkedin/profile/",!0),a.setRequestHeader("Content-Type","application/json"),a.onreadystatechange=function(){
// If request is done and status is OK, parse and decode the response
if(4===a.readyState&&200===a.status){const e=JSON.parse(a.responseText);let o=_(e.profileHeadline);o=o.replace(/&amp;/g,"&"),e.profileHeadline=o,L&&console.info("XHR success, storing data in state and localStorage:",e),I(e),localStorage.setItem(t,JSON.stringify(e)),localStorage.setItem(n,(new Date).getTime().toString())}},L&&console.info("XHR sending payload:",o),a.send(JSON.stringify(o))}}else
// Otherwise, load from cache
L&&console.info("Loading from cache for LinkedIn profile data"),o&&I(JSON.parse(o))}))}),[
// Dependencies for effect
a,i,l,p,c,d,f,g,u,b,y,w,L,k,A]);
/**
* Compute width for the badge container based on size and orientation
*/
const $=e.useMemo((()=>({medium:{VERTICAL:"250",HORIZONTAL:"280"},large:{VERTICAL:"300",HORIZONTAL:"330"}}[i][p])),[i,p]);if(k&&(x||N)){if(x)return e.createElement("div",null,"Loading...");if(N)return e.createElement("div",null,"Error: ",N?.message)}return e.createElement("div",{id:h,style:r,className:"profile-badge-reacted"+(s?` ${s}`:"")},e.createElement("div",{className:`profile-badge profile-badge--width-${$} profile-badge--`+("light"===l?"light":"dark"),lang:a?.replace(/_[A-Za-z]+$/,"")||"en",dir:"ltr"},e.createElement("div",{className:"profile-badge__header profile-badge__header--"+("light"===l?"light":"dark")},e.createElement("span",{className:"sr-only"},"LinkedIn"),e.createElement(o,{theme:l})),e.createElement("div",{className:"profile-badge__content"},v?.profileImageSrc?e.createElement("img",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",title:v?.profileName,alt:v?.profileName,src:v?.profileImageSrc}):
// If no image, show a default SVG
e.createElement("figure",{title:v?.profileName},e.createElement("svg",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 128 128",id:"person-accent-4"},e.createElement("path",{fill:"#e7e2dc",d:"M0 0h128v128H0z"}),e.createElement("path",{d:"M88.41 84.67a32 32 0 10-48.82 0 66.13 66.13 0 0148.82 0z",fill:"#788fa5"}),e.createElement("path",{d:"M88.41 84.67a32 32 0 01-48.82 0A66.79 66.79 0 000 128h128a66.79 66.79 0 00-39.59-43.33z",fill:"#9db3c8"}),e.createElement("path",{d:"M64 96a31.93 31.93 0 0024.41-11.33 66.13 66.13 0 00-48.82 0A31.93 31.93 0 0064 96z",fill:"#56687a"}))),e.createElement("h3",{className:"profile-badge__content-profile-name",itemProp:"name"},v?.profileName&&e.createElement("a",{className:"profile-badge__content-profile-name-link profile-badge__content-profile-name-link--"+("light"===l?"light":"dark"),href:v?.profileNameLink||"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name","data-tracking-control-name":"public-profile-badge-profile-badge-profile-name","data-tracking-will-navigate":""},v?.profileName)),v?.profileHeadline&&e.createElement("h4",{className:"profile-badge__content-profile-headline"},v?.profileHeadline),v?.profileCompanyOrSchool&&e.createElement("h4",{className:"profile-badge__content-profile-company-school-info"},Array.isArray(v?.profileCompanyOrSchool)&&v?.profileCompanyOrSchool.map(((t,n)=>e.createElement("span",{key:`${E}-company-school-${n}`},e.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:t.href,className:"profile-badge__content-profile-company-school-info-link profile-badge__content-profile-company-school-info-link--"+("light"===l?"light":"dark"),"data-tracking-control-name":"public-profile-badge-profile-badge_school-name","data-tracking-will-navigate":"true"},t.text)," ",n!==v?.profileCompanyOrSchool.length-1?" | ":""," "," "))))),m,!1===u&&null!==v&&e.createElement("a",{className:"profile-badge__cta-btn profile-badge__cta-btn--"+("light"===l?"light":"dark"),rel:"noopener noreferrer",href:v?.profileViewLink||`https://www.linkedin.com/in/${encodeURIComponent(c||"☯liu")}?trk=public-profile-badge-profile-badge-profile-cta`,target:"_blank","data-tracking-control-name":"public-profile-badge-profile-badge-view-profile-cta","data-tracking-will-navigate":""},"View profile"),null===v&&e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",key:`${E}-view-profile-no-data`,href:c?`https://www.linkedin.com/in/${c}?trk=profile-badge`:"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name"},C)))}));var i=e.memo((({CALLBACK_NAME:t="LIBadgeCallback",BADGE_NAMES:n=".LI-profile-badge, .LI-entity-badge",TRACKING_PARAM:o="profile-badge",size:a="medium",locale:i="en_US",type:r="vertical",theme:l="light",vanity:c="ziping-liu-1932a029a",version:d="v2",entity:s="profile",isEI:p=!1,isCreatePage:f=!1,debug:m=!0,cleanUp:g=!1})=>{const u=`${n}${[{type:r},{theme:l},{size:a},{locale:i},{version:d},{entity:s},{vanity:c}].map((e=>Object.entries(e).map((([e,t])=>`[data-${e}="${t}"]`)).join(""))).join("")}`,h=document.querySelector(u),b=e.useRef(h);
// badge needs to be unique to this instance of the component, so use a ref and set it in the useEffect
return e.useEffect((()=>{b.current=u}),[u]),
return e.useEffect((()=>{b.current=h}),[h]),
// this need to be done so check if ref to badge has changed
e.useEffect((()=>{let e=0,n=0;const b=[],y={};
m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`Using query selector: ${h} to find badge element for badge with type: ${r}, theme: ${l}, size: ${a}, locale: ${i}, version: ${c}, entity: ${s}`);const C=(e,t)=>{if(((e,t)=>w(e)&&!y[e.src]&&(!t||t&&!e.getAttribute("data-isartdeco")))(e,t))e.parentNode&&e.parentNode.replaceChild&&e.parentNode.replaceChild($(e),e),y[e.src]=!0;else{const n=Array.from(e.childNodes);for(let e=0;e<n.length;e++)C(n[e],t)}},w=e=>"SCRIPT"===e.tagName,$=e=>{const t=document.createElement("script"),n=Array.from(e.attributes);for(const e of n)t.setAttribute(e.name,e.value);return t},L=(e=!1)=>{const t=e?"https://badges.linkedin-ei":"https://badges.linkedin";return(()=>{if("undefined"!=typeof window){const e=window.location?.hostname||"";return/linkedin(-ei)?.cn$/.test(e)}return!1})()?t+".cn/":t+".com/"},v=(e,t="medium",n="en_US",o="vertical",a="light",i="ziping-liu-1932a029a",r="v2",l="profile",d=!1,c=!1,s="profile-badge",p=!1)=>{const f=e=>{let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t},m=(new Date).getTime()+f(n)+f(o)+f(a)+f(i)+f(r)+f(l)+f(d?"ei":"")+f(c?"create":"")+f(t);let g=L(d),h=["locale="+encodeURIComponent(n),"badgetype="+encodeURIComponent(o),"badgetheme="+encodeURIComponent(a),"uid="+encodeURIComponent(m),"version="+encodeURIComponent(r)];"v2"===r?(g+="view",h.push("badgesize="+encodeURIComponent(t)),h.push("entity="+encodeURIComponent(l)),h=h.concat((e=>Array.from(e.attributes).filter((e=>e.name.startsWith("data-key-"))).map((e=>encodeURIComponent(e.name.replace("data-","").toLowerCase())+"="+encodeURIComponent(e.value))))(e))):(g+="profile",h.push("maxsize="+encodeURIComponent(t)),h.push("trk="+encodeURIComponent(s)),h.push("vanityname="+encodeURIComponent(i))),c&&h.push("fromCreate=true");const u=g+"?"+h.join("&");e.setAttribute("data-uid",String(m)),(e=>{const t=document.createElement("script");t.src=e,b.push(t),document.body.appendChild(t)})(u)};u&&(e++,u.setAttribute("data-rendered","true"),v(u,a,i,r,l,d,c,s,p,f,o,g));const k=e=>{n++;const t=`<body>${e}</body>`,o=document.createElement("iframe"),a=e.match(/class="profile-badge__cta-btn profile-badge__cta-btn--light" href="([^"]*)"/);m&&console.info("%cresponseHandler - matching for url:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`match: ${a?.[1]}`);const i=a?.[1].match(/\/in\/([^\/]*)\?.*/),r=document.querySelector(`[data-vanity="${i?.[1]}"]`);m&&(console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`matchVanityInUrl: ${i?.[1]}`),console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`matchVanityInUrl: ${i?.[1]}`),console.info("%cresponseHandler - matching for badge query:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`badgeVanityQuery: ${r?.innerHTML}`)),o.onload=function(){if(o.contentWindow){const e=o.contentWindow.document.body;o.setAttribute("height",`${(e.scrollHeight||300)+5}`),o.setAttribute("width",`${(e.scrollWidth||330)+5}`)}},o.setAttribute("frameBorder","0"),o.style.display="block",r?(m&&console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`vanity found in query: ${r?.getAttribute("data-vanity")}`),r?.appendChild(o)):u?.appendChild(o),o.contentWindow&&(o.contentWindow.document.open(),o.contentWindow.document.write(t),o.contentWindow.document.close()),C(u,f),
m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`Using query selector: ${u} to find badge element for badge with type: ${r}, theme: ${l}, size: ${a}, locale: ${i}, version: ${d}, entity: ${s}`);const C=(e,t)=>{if(((e,t)=>w(e)&&!y[e.src]&&(!t||t&&!e.getAttribute("data-isartdeco")))(e,t))e.parentNode&&e.parentNode.replaceChild&&e.parentNode.replaceChild(L(e),e),y[e.src]=!0;else{const n=Array.from(e.childNodes);for(let e=0;e<n.length;e++)C(n[e],t)}},w=e=>"SCRIPT"===e.tagName,L=e=>{const t=document.createElement("script"),n=Array.from(e.attributes);for(const e of n)t.setAttribute(e.name,e.value);return t},k=(e=!1)=>{const t=e?"https://badges.linkedin-ei":"https://badges.linkedin";return(()=>{if("undefined"!=typeof window){const e=window.location?.hostname||"";return/linkedin(-ei)?.cn$/.test(e)}return!1})()?t+".cn/":t+".com/"},v=(e,t="medium",n="en_US",o="vertical",a="light",i="ziping-liu-1932a029a",r="v2",l="profile",c=!1,d=!1,s="profile-badge",p=!1)=>{const f=e=>{let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t},m=(new Date).getTime()+f(n)+f(o)+f(a)+f(i)+f(r)+f(l)+f(c?"ei":"")+f(d?"create":"")+f(t);let g=k(c),u=["locale="+encodeURIComponent(n),"badgetype="+encodeURIComponent(o),"badgetheme="+encodeURIComponent(a),"uid="+encodeURIComponent(m),"version="+encodeURIComponent(r)];"v2"===r?(g+="view",u.push("badgesize="+encodeURIComponent(t)),u.push("entity="+encodeURIComponent(l)),u=u.concat((e=>Array.from(e.attributes).filter((e=>e.name.startsWith("data-key-"))).map((e=>encodeURIComponent(e.name.replace("data-","").toLowerCase())+"="+encodeURIComponent(e.value))))(e))):(g+="profile",u.push("maxsize="+encodeURIComponent(t)),u.push("trk="+encodeURIComponent(s)),u.push("vanityname="+encodeURIComponent(i))),d&&u.push("fromCreate=true");const h=g+"?"+u.join("&");e.setAttribute("data-uid",String(m)),(e=>{const t=document.createElement("script");t.src=e,b.push(t),document.body.appendChild(t)})(h)};h&&(e++,h.setAttribute("data-rendered","true"),v(h,a,i,r,l,c,d,s,p,f,o,g));const I=e=>{n++;const t=`<body>${e}</body>`,o=document.createElement("iframe"),a=e.match(/class="profile-badge__cta-btn profile-badge__cta-btn--light" href="([^"]*)"/);m&&console.info("%cresponseHandler - matching for url:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`match: ${a?.[1]}`);const i=a?.[1].match(/\/in\/([^\/]*)\?.*/),r=document.querySelector(`[data-vanity="${i?.[1]}"]`);m&&(console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`matchVanityInUrl: ${i?.[1]}`),console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`matchVanityInUrl: ${i?.[1]}`),console.info("%cresponseHandler - matching for badge query:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`badgeVanityQuery: ${r?.innerHTML}`)),o.onload=function(){if(o.contentWindow){const e=o.contentWindow.document.body;o.setAttribute("height",`${(e.scrollHeight||300)+5}`),o.setAttribute("width",`${(e.scrollWidth||330)+5}`)}},o.setAttribute("frameBorder","0"),o.style.display="block",r?(m&&console.info("%cresponseHandler - matching for vanity:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`vanity found in query: ${r?.getAttribute("data-vanity")}`),r?.appendChild(o)):h?.appendChild(o),o.contentWindow&&(o.contentWindow.document.open(),o.contentWindow.document.write(t),o.contentWindow.document.close()),C(h,f),
// appending badge
m&&console.info("%cresponseHandler - LIRenderAll:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`appending badge to iframe: ${t}, badge: ${u?.getAttribute("data-vanity")}, badge:\n`,u),I()};window[t]=k;const I=()=>{m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`at tryClean: expectedResponses: ${e}, responsesReceived: ${n}`),g&&e>0&&(n>=e||n>=1)?(m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;","cleaning up due to responses check passed, expectedResponses > 0 && (responsesReceived >= expectedResponses || responsesReceived >= 1)"),delete window[t],b.forEach((e=>document.body.removeChild(e)))):m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`not cleaning up due to responses check failed, expectedResponses > 0 && (responsesReceived >= expectedResponses || responsesReceived >= 1), cleanUp = ${g}`)};return()=>{b.forEach((e=>{document.body.contains(e)&&document.body.removeChild(e)})),window[t]===k&&delete window[t]}}),[t,n,o,a,i,r,l,d,c,s,p,f,m,g]),null}));
m&&console.info("%cresponseHandler - LIRenderAll:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`appending badge to iframe: ${t}, badge: ${h?.getAttribute("data-vanity")}, badge:\n`,h),E()};window[t]=I;const E=()=>{m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`at tryClean: expectedResponses: ${e}, responsesReceived: ${n}`),g&&e>0&&(n>=e||n>=1)?(m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;","cleaning up due to responses check passed, expectedResponses > 0 && (responsesReceived >= expectedResponses || responsesReceived >= 1)"),delete window[t],b.forEach((e=>document.body.removeChild(e)))):m&&console.info("%cLIRender:","background: #0077b5; color: #fff; padding: 5px; border-radius: 5px; font-weight: bold; font-size: 14px;",`not cleaning up due to responses check failed, expectedResponses > 0 && (responsesReceived >= expectedResponses || responsesReceived >= 1), cleanUp = ${g}`)};return()=>{b.forEach((e=>{document.body.contains(e)&&document.body.removeChild(e)})),window[t]===I&&delete window[t]}}),[t,n,o,a,i,r,l,c,d,s,p,f,m,g]),null}));
/**

@@ -45,5 +86,5 @@ * React component that renders a LinkedIn badge on a website.

* ```
*/const i=t=>{const n=t.locale||"en_US",i=t.size||"medium",r=t.theme||"light",l=t.generateUidWithoutApi||!1,d=t.type||"VERTICAL",c=t.entity||"PROFILE",s=t.vanity||"☯liu",p=t.version||"v1",f=t.useLinkedInApiUrlPure||!1,m=encodeURIComponent(s),g=t.name||"",h=t.noCache||!1,u=`https://www.linkedin.com/in/${m}?trk=profile-badge`,[b,y]=e.useState(!1);return e.useEffect((()=>{
*/var r=e.memo((t=>{const n=t.locale||"en_US",o=t.size||"medium",r=t.theme||"light",l=t.generateUidWithoutApi||!1,c=t.type||"VERTICAL",d=t.entity||"PROFILE",s=t.vanity||"☯liu",p=t.version||"v1",f=t.useLinkedInApiUrlPure||!1,m=encodeURIComponent(s),g=t.name||"",u=t.noCache||!1,h=t?.useQueryToFetch??!1,b=`https://www.linkedin.com/in/${m}?trk=profile-badge`,[y,C]=e.useState(!1);return e.useEffect((()=>{
// check if div is rendered via ref
b||(((e,n,o)=>{if(t.debug){const t=(new Date).toLocaleTimeString();console.log(`[${t}] ${n} - ${o}: ${e}`)}})("checking if div is rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),!1===b&&y(!0))}),[b,t.debug]),!0===f?e.createElement("div",{className:"badge-base LI-profile-badge"+(t.className?` ${t.className}`:""),style:t.style,"data-locale":n,"data-size":i,"data-theme":r,"data-type":d,"data-vanity":s,"data-version":p,"data-rendered":"false",id:t.id},e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:u},g),b&&e.createElement(a,{vanity:s,locale:n,size:i,theme:r,type:d,entity:c,version:p,isCreatePage:!1,debug:t.debug,cleanUp:t.cleanUp})):e.createElement(o,{locale:n,size:i,style:t.style,entity:c,theme:r,type:d,vanity:s,noCache:h,version:p,className:t.className,generateUidWithoutApi:l,hideViewProfileButton:t.hideViewProfileButton,id:t.id,debug:t.debug,name:g,isCreatePage:!1},t.children)};"undefined"!=typeof window&&void 0===window.LinkedInBadge&&(window.LinkedInBadge=i)}));
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlua2VkaW5iYWRnZS5qcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ==
y||(((e,n,o)=>{if(t.debug){const t=(new Date).toLocaleTimeString();console.log(`[${t}] ${n} - ${o}: ${e}`)}})("checking if div is rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),!1===y&&C(!0))}),[y,t.debug]),!0===f?e.createElement("div",{className:"badge-base LI-profile-badge"+(t.className?` ${t.className}`:""),style:t.style,"data-locale":n,"data-size":o,"data-theme":r,"data-type":c,"data-vanity":s,"data-version":p,"data-rendered":"false",id:t.id},e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:b},g),y&&e.createElement(i,{vanity:s,locale:n,size:o,theme:r,type:c,entity:d,version:p,isCreatePage:!1,debug:t.debug,cleanUp:t.cleanUp})):e.createElement(a,{locale:n,size:o,style:t.style,entity:d,theme:r,type:c,vanity:s,noCache:u,version:p,className:t.className,generateUidWithoutApi:l,hideViewProfileButton:t.hideViewProfileButton,id:t.id,debug:t.debug,name:g,fetchViaReactQuery:h,isCreatePage:!1},t.children)}));"undefined"!=typeof window&&void 0===window.LinkedInBadge&&(window.LinkedInBadge=r)}));
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlua2VkaW5iYWRnZS5qcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9
import React from "react";
declare const _default: React.MemoExoticComponent<({ locale, size, style, theme, vanity, version, className, type, entity, children, generateUidWithoutApi, hideViewProfileButton, id, TRACKING_PARAM, isCreatePage, name, noCache, debug, }: {
locale?: string | undefined;
size?: "medium" | "large" | undefined;
theme?: "light" | "dark" | undefined;
entity?: "PROFILE" | "COMPANY" | "GROUP" | undefined;
type?: "VERTICAL" | "HORIZONTAL" | undefined;
vanity?: string | undefined;
version?: "v1" | "v2" | undefined;
className?: string | undefined;
style?: React.CSSProperties | undefined;
interface LinkedInBadgeSelfRenderProps {
locale?: string;
size?: "medium" | "large";
theme?: "light" | "dark";
entity?: "PROFILE" | "COMPANY" | "GROUP";
type?: "VERTICAL" | "HORIZONTAL";
vanity?: string;
version?: "v1" | "v2";
className?: string;
style?: React.CSSProperties;
children?: React.ReactNode;
generateUidWithoutApi?: boolean | undefined;
hideViewProfileButton?: boolean | undefined;
id?: string | undefined;
TRACKING_PARAM?: string | undefined;
isCreatePage?: boolean | undefined;
name?: string | undefined;
noCache?: boolean | undefined;
debug?: boolean | undefined;
}) => React.JSX.Element>;
generateUidWithoutApi?: boolean;
hideViewProfileButton?: boolean;
id?: string;
TRACKING_PARAM?: string;
isCreatePage?: boolean;
name?: string;
noCache?: boolean;
debug?: boolean;
/**
* If `true`, we fetch LinkedIn profile data via React Query instead of the legacy XHR approach.
* Make sure React Query is configured in your app if you plan to use this feature.
*/
fetchViaReactQuery?: boolean;
}
declare const _default: React.MemoExoticComponent<({ locale, size, style, theme, vanity, version, className, type, entity, children, generateUidWithoutApi, hideViewProfileButton, id, TRACKING_PARAM, isCreatePage, name, noCache, debug, fetchViaReactQuery, }: LinkedInBadgeSelfRenderProps) => React.JSX.Element>;
export default _default;
//# sourceMappingURL=index.d.ts.map
import React, { memo } from "react";
import { useQuery } from "react-query"; // Optionally installed, so declare as a peer or optional dependency
import { generateUidFromProps } from "src/utils";
import LinkedInIcon from "./LinkedInIcon";
const LinkedInBadgeSelfRender = ({ locale = "en_US", size = "medium", style, theme = "light", vanity = "☯liu", version = "v1", className, type = "VERTICAL", entity = "PROFILE", children, generateUidWithoutApi = false, hideViewProfileButton = false, id, TRACKING_PARAM = "public-profile-badge", isCreatePage = false, name = "", noCache = false, debug = false, }) => {
/**
* Helper function to POST a payload to /api/v2/linkedin/profile/ for React Query usage.
*/
async function fetchLinkedInData(vanity, payloadBodyParams) {
const response = await fetch(`https://ziping.liu.academy/api/v2/linkedin/profile/?vanity=${vanity}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payloadBodyParams),
});
if (!response.ok) {
throw new Error("Failed to fetch LinkedIn profile data with vanity: " + vanity);
}
return response.json();
}
const LinkedInBadgeSelfRender = ({ locale = "en_US", size = "medium", style, theme = "light", vanity = "☯liu", version = "v1", className, type = "VERTICAL", entity = "PROFILE", children, generateUidWithoutApi = false, hideViewProfileButton = false, id, TRACKING_PARAM = "public-profile-badge", isCreatePage = false, name = "", noCache = false, debug = false, fetchViaReactQuery = false, // New prop for optional React Query usage
}) => {
// Local state for storing the fetched LinkedIn profile data
const [profileData, setProfileData] = React.useState(null);
// Local state for storing the unique badge ID
const [uid, setUid] = React.useState(null);
/**
* Decodes \uXXXX strings into the actual Unicode characters.
* Also used to correct &amp; references in the retrieved data.
*/
const decodeUnicodeEscapes = React.useCallback((input) => {
const unicodeEscapeRegex = /\\u([\dA-Fa-f]{4})/g;
return input.replace(unicodeEscapeRegex, (_match, grp) => String.fromCodePoint(parseInt(grp, 16)));
}, []);
/**
* Helper that builds the payload body params for both XHR or React Query requests.
* Depends on version, theme, locale, etc.
*/
const buildPayloadBodyParams = React.useCallback((uidParam, lastUpdatedTime) => {
const payloadBodyParams = {
badgetype: encodeURIComponent(type || "VERTICAL"),
badgetheme: encodeURIComponent(theme || "light"),
locale: locale || "en_US",
uid: uidParam || `${lastUpdatedTime ? lastUpdatedTime : new Date().getTime()}`,
version: encodeURIComponent(version || "v1"),
};
// Depending on v1 or v2, different fields are required
if (version === "v2") {
payloadBodyParams.badgesize = size || "medium";
payloadBodyParams.entity = entity || "PROFILE";
}
else {
payloadBodyParams.maxsize = encodeURIComponent(size || "medium");
payloadBodyParams.trk = TRACKING_PARAM;
payloadBodyParams.vanityname = encodeURIComponent(vanity || "☯liu");
}
if (isCreatePage) {
payloadBodyParams.fromCreate = "true";
}
return payloadBodyParams;
}, [type, theme, locale, version, size, entity, TRACKING_PARAM, vanity, isCreatePage]);
/**
* Optional: If `fetchViaReactQuery` is true, we rely on React Query
* to fetch data from `/api/v2/linkedin/profile/`.
*/
const { isLoading, error } = useQuery(["linkedInProfile", vanity, uid], () => fetchLinkedInData(vanity, buildPayloadBodyParams(uid)), {
// Only enabled if we have a UID (we've generated it) AND the user wants React Query
enabled: !!uid && fetchViaReactQuery,
onSuccess: (dataFetched) => {
if (debug) {
console.info("Fetched profile data via React Query:", dataFetched);
}
// Convert headline’s \u-escapes and &amp;
let newHeadline = decodeUnicodeEscapes(dataFetched.profileHeadline || "");
newHeadline = newHeadline.replace(/&amp;/g, "&");
dataFetched.profileHeadline = newHeadline;
setProfileData(dataFetched);
// Optionally store in localStorage if you wish to keep consistent caching
// localStorage.setItem("...", JSON.stringify(dataFetched));
},
});
/**
* Effect: (1) Generate the UID, (2) either use React Query or the legacy XHR approach
* to fetch data if needed, (3) handle local storage caching logic if XHR-based approach is used.
*/
React.useEffect(() => {
const decodeUnicodeEscapes = (input) => {
const unicodeEscapeRegex = /\\u([\dA-Fa-f]{4})/g;
return input.replace(unicodeEscapeRegex, (match, grp) => {
return String.fromCodePoint(parseInt(grp, 16));
});
};
const fetchData = () => {
generateUidFromProps({
locale,
size,
theme,
type,
vanity,
version,
entity,
generateUidWithoutApi,
hideViewProfileButton,
TRACKING_PARAM,
isCreatePage,
}).then((uidNew) => {
if (uidNew !== uid && uidNew !== null) {
setUid(uidNew);
// First step: Generate a unique ID for the badge
generateUidFromProps({
locale,
size,
theme,
type,
vanity,
version,
entity,
generateUidWithoutApi,
hideViewProfileButton,
TRACKING_PARAM,
isCreatePage,
}).then((uidNew) => {
if (uidNew !== uid && uidNew !== null) {
setUid(uidNew);
}
// If React Query is requested, we skip the legacy XHR because useQuery() above handles it.
if (fetchViaReactQuery) {
return;
}
// *********************** Legacy XHR-based Approach ***********************
// The following logic is the same as the older code: checks local storage and last-updated time
const cachedKey = `cachedProfileData-${vanity}-${locale}-${size}-${theme}-${type}-${entity}`;
const cachedTimeKey = `${cachedKey}-lastUpdated`;
const cachedProfileData = localStorage.getItem(cachedKey);
const lastUpdated = localStorage.getItem(cachedTimeKey);
const now = new Date().getTime();
const lastUpdatedTime = parseInt(lastUpdated || "0", 10);
const timeDiff = now - lastUpdatedTime;
const timeDiffInHours = timeDiff / (1000 * 60 * 60);
const isCorruptCache = cachedProfileData && !cachedProfileData.includes("profileName");
const isCacheOutdatedOrMissing = isCorruptCache || !cachedProfileData || !lastUpdated || timeDiffInHours > 48;
if (debug) {
console.info("Local cache check:", {
cachedProfileData,
lastUpdated,
isCacheOutdatedOrMissing,
timeDiffInHours,
});
}
// If cache is missing or noCache is explicitly set, fetch from server
if (noCache || isCacheOutdatedOrMissing) {
if (debug) {
console.info("Using XHR approach to fetch fresh data from API");
}
const payloadBodyParams = {
badgetype: encodeURIComponent(type || "VERTICAL"),
badgetheme: encodeURIComponent(theme || "light"),
locale: locale || "en_US",
uid: uidNew ||
`${lastUpdatedTime ? lastUpdatedTime : new Date().getTime()}`,
version: encodeURIComponent(version || "v1"),
};
if (version === "v2") {
payloadBodyParams.badgesize = size || "medium";
payloadBodyParams.entity = entity || "PROFILE";
}
else {
payloadBodyParams.maxsize = encodeURIComponent(size || "medium");
payloadBodyParams.trk = TRACKING_PARAM;
payloadBodyParams.vanityname = encodeURIComponent(vanity || "☯liu");
}
if (isCreatePage) {
payloadBodyParams.fromCreate = "true";
}
if (isCreatePage) {
payloadBodyParams.fromCreate = "true";
}
const xmlnew = new XMLHttpRequest();
const baseUrl = "https://ziping.liu.academy/api/v2/linkedin/profile/";
console.info(`profileData: ${profileData}, uidNew: ${uidNew}`);
// Only fetch if we haven’t already fetched profile data and have a valid UID
if (profileData === null && uidNew !== null) {
xmlnew.open("POST", baseUrl, true);
xmlnew.setRequestHeader("Content-Type", "application/json");
xmlnew.onreadystatechange = function () {
if (xmlnew.readyState === 4 && xmlnew.status === 200) {
console.info(`xmlnew.responseText: ${xmlnew.responseText}`);
const data = JSON.parse(xmlnew.responseText);
let headlineText = data.profileHeadline;
headlineText = decodeUnicodeEscapes(headlineText);
const payloadBodyParams = buildPayloadBodyParams(uidNew, lastUpdatedTime);
const xhr = new XMLHttpRequest();
xhr.open("POST", "https://ziping.liu.academy/api/v2/linkedin/profile/", true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function () {
// If request is done and status is OK, parse and decode the response
if (xhr.readyState === 4 && xhr.status === 200) {
const dataParsed = JSON.parse(xhr.responseText);
let headlineText = decodeUnicodeEscapes(dataParsed.profileHeadline);
headlineText = headlineText.replace(/&amp;/g, "&");
// No need for captureUnicodeEscapes and JSON.parse anymore.
console.info(`new headlineText: ${headlineText}`);
console.info(`old headlineText: ${data.profileHeadline}`);
data.profileHeadline = headlineText;
dataParsed.profileHeadline = headlineText;
if (debug) {
console.info(`Retrieved profile badge info for vanity ${vanity} via API and saving to local storage: `, `'cachedProfileData-${vanity}-${locale}-${size}-${theme}-${type}-${entity}'`, "profile data", `${Object.keys(data).toString()}`);
console.info("XHR success, storing data in state and localStorage:", dataParsed);
}
setProfileData(data);
localStorage.setItem(`cachedProfileData-${vanity}-${locale}-${size}-${theme}-${type}-${entity}`, JSON.stringify(data));
localStorage.setItem(`cachedProfileData-${vanity}-${locale}-${size}-${theme}-${type}-${entity}-lastUpdated`, new Date().getTime().toString());
setProfileData(dataParsed);
localStorage.setItem(cachedKey, JSON.stringify(dataParsed));
localStorage.setItem(cachedTimeKey, new Date().getTime().toString());
}
};
if (debug) {
console.info(`Fetching profile badge info now for vanity ${vanity} via API: `, `'${baseUrl}'`, "payloadBodyParams", `${Object.keys(payloadBodyParams).toString()}`);
console.info("XHR sending payload:", payloadBodyParams);
}
xmlnew.send(JSON.stringify(payloadBodyParams));
xhr.send(JSON.stringify(payloadBodyParams));
}
});
};
const cachedProfileData = localStorage.getItem(`cachedProfileData-${vanity}-${locale}-${size}-${theme}-${type}-${entity}`);
const lastUpdated = localStorage.getItem(`cachedProfileData-${vanity}-${locale}-${size}-${theme}-${type}-${entity}-lastUpdated`);
const now = new Date().getTime();
const lastUpdatedTime = parseInt(lastUpdated || "0", 10);
const timeDiff = now - lastUpdatedTime;
const timeDiffInHours = timeDiff / (1000 * 60 * 60);
const isCacheDataMissingRequiredFieldsOrCorrupt = cachedProfileData && !cachedProfileData.includes("profileName");
const isOutDatedOrNotThere = isCacheDataMissingRequiredFieldsOrCorrupt ||
!cachedProfileData ||
!lastUpdated ||
timeDiffInHours > 48;
if (debug) {
console.info("cachedProfileData", cachedProfileData, "lastUpdated", lastUpdated, "isOutDatedOrNotThere", isOutDatedOrNotThere, "timeDiffInHours", timeDiffInHours);
}
if (noCache || isOutDatedOrNotThere) {
if (debug) {
console.info("Fetching data from API", "cachProfileData", cachedProfileData, "lastUpdated", lastUpdated, "cachedProfileData", cachedProfileData);
}
fetchData();
}
else {
if (debug) {
console.info("Fetching data from cache linkedinbadge", "cachProfileData", cachedProfileData, "lastUpdated", lastUpdated);
else {
// Otherwise, load from cache
if (debug) {
console.info("Loading from cache for LinkedIn profile data");
}
if (cachedProfileData) {
setProfileData(JSON.parse(cachedProfileData));
}
}
setProfileData(JSON.parse(cachedProfileData));
}
});
}, [
// Dependencies for effect
locale,

@@ -126,16 +183,25 @@ size,

debug,
fetchViaReactQuery,
buildPayloadBodyParams,
]);
/**
* Compute width for the badge container based on size and orientation
*/
const widthSet = React.useMemo(() => {
const sizeTypeToValueMap = {
medium: {
VERTICAL: "250",
HORIZONTAL: "280",
},
large: {
VERTICAL: "300",
HORIZONTAL: "330",
},
medium: { VERTICAL: "250", HORIZONTAL: "280" },
large: { VERTICAL: "300", HORIZONTAL: "330" },
};
return sizeTypeToValueMap[size][type];
}, [size, type]);
if (fetchViaReactQuery && (isLoading || error)) {
if (isLoading) {
return React.createElement("div", null, "Loading...");
}
if (error) {
return React.createElement("div", null,
"Error: ",
error?.message);
}
}
return (React.createElement("div", { id: id, style: style, className: "profile-badge-reacted" + (className ? ` ${className}` : "") },

@@ -151,3 +217,5 @@ React.createElement("div", { className: `profile-badge profile-badge--width-${widthSet} ` +

`artdeco-entity-image--circle-4 ` +
`profile-badge__content-profile-image`, title: profileData?.profileName, alt: profileData?.profileName, src: profileData?.profileImageSrc })) : (React.createElement("figure", { title: profileData?.profileName },
`profile-badge__content-profile-image`, title: profileData?.profileName, alt: profileData?.profileName, src: profileData?.profileImageSrc })) : (
// If no image, show a default SVG
React.createElement("figure", { title: profileData?.profileName },
React.createElement("svg", { className: `artdeco-entity-image ` +

@@ -162,17 +230,14 @@ `artdeco-entity-image--circle-4 ` +

`profile-badge__content-profile-name-link--${theme === "light" ? "light" : "dark"}`, href: profileData?.profileNameLink ||
"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name", "data-tracking-control-name": "public-profile-badge-profile-badge-profile-name", "data-tracking-will-navigate": "" }, profileData?.profileName && React.createElement(React.Fragment, null, profileData?.profileName)))),
"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name", "data-tracking-control-name": "public-profile-badge-profile-badge-profile-name", "data-tracking-will-navigate": "" }, profileData?.profileName))),
profileData?.profileHeadline && (React.createElement("h4", { className: "profile-badge__content-profile-headline" }, profileData?.profileHeadline)),
profileData?.profileCompanyOrSchool && (React.createElement("h4", { className: "profile-badge__content-profile-company-school-info" }, profileData?.profileCompanyOrSchool &&
Array.isArray(profileData?.profileCompanyOrSchool) &&
profileData?.profileCompanyOrSchool.map((companyOrSchool, index) => {
return (React.createElement("span", { key: `${uid}-company-school-${index}` },
React.createElement("a", { target: "_blank", rel: "noopener noreferrer", href: companyOrSchool.href, className: `profile-badge__content-profile-company-school-info-link ` +
`profile-badge__content-profile-company-school-info-link--${theme === "light" ? "light" : "dark"}`, "data-tracking-control-name": "public-profile-badge-profile-badge_school-name", "data-tracking-will-navigate": "true" }, companyOrSchool.text),
"\u00A0",
index !==
profileData?.profileCompanyOrSchool.length - 1
? " | "
: "",
"\u00A0"));
})))),
profileData?.profileCompanyOrSchool && (React.createElement("h4", { className: "profile-badge__content-profile-company-school-info" }, Array.isArray(profileData?.profileCompanyOrSchool) &&
profileData?.profileCompanyOrSchool.map((companyOrSchool, index) => (React.createElement("span", { key: `${uid}-company-school-${index}` },
React.createElement("a", { target: "_blank", rel: "noopener noreferrer", href: companyOrSchool.href, className: `profile-badge__content-profile-company-school-info-link ` +
`profile-badge__content-profile-company-school-info-link--${theme === "light" ? "light" : "dark"}`, "data-tracking-control-name": "public-profile-badge-profile-badge_school-name", "data-tracking-will-navigate": "true" }, companyOrSchool.text),
"\u00A0",
index !== profileData?.profileCompanyOrSchool.length - 1
? " | "
: "",
" ",
"\u00A0")))))),
children,

@@ -182,6 +247,6 @@ hideViewProfileButton === false && profileData !== null && (React.createElement("a", { className: `profile-badge__cta-btn ` +

`https://www.linkedin.com/in/${encodeURIComponent(vanity || "☯liu")}?trk=public-profile-badge-profile-badge-profile-cta`, target: "_blank", "data-tracking-control-name": "public-profile-badge-profile-badge-view-profile-cta", "data-tracking-will-navigate": "" }, "View profile")),
profileData === null && (React.createElement("a", { className: "badge-base__link LI-simple-link", target: "_blank", rel: "noopener noreferrer", key: `${uid}-view-profile-no-data`, href: `${vanity
profileData === null && (React.createElement("a", { className: "badge-base__link LI-simple-link", target: "_blank", rel: "noopener noreferrer", key: `${uid}-view-profile-no-data`, href: vanity
? `https://www.linkedin.com/in/${vanity}?trk=profile-badge`
: "https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name"}` }, name)))));
: "https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name" }, name)))));
};
export default memo(LinkedInBadgeSelfRender);

@@ -11,3 +11,3 @@ import React from 'react';

...style,
}, "aria-hidden": "true" },
}, "aria-hidden": "true", "aria-label": "LinkedIn" },
React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: "0 0 84 21", preserveAspectRatio: "xMinYMin meet", version: "1.1", focusable: "false" },

@@ -14,0 +14,0 @@ React.createElement("g", { className: "inbug", stroke: "none", strokeWidth: 1, fill: "none", fillRule: "evenodd" },

{
"name": "react-linkedinbadge",
"version": "5.26.2025",
"version": "5.27.2025",
"description": "The LinkedIn Badge Rendering React Component is a powerful tool for displaying LinkedIn badges on websites. With customizable options and support for both profile and entity badges, this component offers improved features over LinkedIn's basic implementation. It enhances code organization by separating badge container rendering from dynamic content rendering and efficiently handles asynchronous loading of content from LinkedIn servers. This component also allows for easy management of multiple badges on a page and provides a callback function for tracking badge rendering completion. Make sure to review the licensing information for proper usage.",

@@ -142,2 +142,8 @@ "repository": {

},
"peerDependencies": {
"react-query": "*"
},
"optionalDependencies": {
"react-query": "*"
},
"bugs": {

@@ -144,0 +150,0 @@ "url": "https://github.com/ZIPING-LIU-CORPORATION/react-linkedin/issues"

@@ -1,2 +0,2 @@

import React, { FC } from "react";
import React from "react";
/**

@@ -86,2 +86,6 @@ * @param {string} [locale="en_US"] - The locale to use for the badge. Defaults to `"en_US"`.

/**
* Only implemented for the self-rendering method (e.g. when pure is set to `false`), will useQuery instead of a default fetch call to get the profile data.
*/
useQueryToFetch: boolean;
/**
* Optional, the script that is used to render the badge. This is only used when `useLinkedInApiUrlPure` is set to `true`, which uses linkedin's rendering method.

@@ -115,27 +119,4 @@ */

};
/**
* React component that renders a LinkedIn badge on a website.
* @param {LinkedInBadgeProps} props - The props for the LinkedIn badge component, such as the locale, size, theme, type, entity, vanity, version, className, style, children, id, script_src, useLinkedInApiUrlPure, name, debug, and generateUidWithoutApi. See LinkedInBadgeProps for more details.
* @returns {React.ReactElement} The rendered LinkedIn badge component.
* @description This implementation uses two React components - LinkedInBadge and LIRenderAll.
* LinkedInBadge is the parent component responsible for
* rendering the container and basic structure of the LinkedIn badge,
* while LIRenderAll is a child component that handles
* the rendering and management of the actual badge content.
* @argument The reason for this separation is that the badge content needs to be loaded asynchronously from a server, and the LIRenderAll component is responsible for making the necessary requests and handling the responses. By separating the concerns, the parent component can render the initial structure, and the child component can take care of the dynamic badge content.
* @example
* ```tsx
* <LinkedInBadge
* locale="en_US"
* size="medium"
* theme="light"
* type="VERTICAL"
* entity="PROFILE"
* vanity="☯liu"
* version="v1"
* />
* ```
*/
declare const LinkedInBadge: FC<Partial<LinkedInBadgeProps>>;
export default LinkedInBadge;
declare const _default: React.NamedExoticComponent<Partial<LinkedInBadgeProps>>;
export default _default;
//# sourceMappingURL=index.d.ts.map
import React from "react";
declare const _default: React.MemoExoticComponent<({ locale, size, style, theme, vanity, version, className, type, entity, children, generateUidWithoutApi, hideViewProfileButton, id, TRACKING_PARAM, isCreatePage, name, noCache, debug, }: {
locale?: string | undefined;
size?: "medium" | "large" | undefined;
theme?: "light" | "dark" | undefined;
entity?: "PROFILE" | "COMPANY" | "GROUP" | undefined;
type?: "VERTICAL" | "HORIZONTAL" | undefined;
vanity?: string | undefined;
version?: "v1" | "v2" | undefined;
className?: string | undefined;
style?: React.CSSProperties | undefined;
interface LinkedInBadgeSelfRenderProps {
locale?: string;
size?: "medium" | "large";
theme?: "light" | "dark";
entity?: "PROFILE" | "COMPANY" | "GROUP";
type?: "VERTICAL" | "HORIZONTAL";
vanity?: string;
version?: "v1" | "v2";
className?: string;
style?: React.CSSProperties;
children?: React.ReactNode;
generateUidWithoutApi?: boolean | undefined;
hideViewProfileButton?: boolean | undefined;
id?: string | undefined;
TRACKING_PARAM?: string | undefined;
isCreatePage?: boolean | undefined;
name?: string | undefined;
noCache?: boolean | undefined;
debug?: boolean | undefined;
}) => React.JSX.Element>;
generateUidWithoutApi?: boolean;
hideViewProfileButton?: boolean;
id?: string;
TRACKING_PARAM?: string;
isCreatePage?: boolean;
name?: string;
noCache?: boolean;
debug?: boolean;
/**
* If `true`, we fetch LinkedIn profile data via React Query instead of the legacy XHR approach.
* Make sure React Query is configured in your app if you plan to use this feature.
*/
fetchViaReactQuery?: boolean;
}
declare const _default: React.MemoExoticComponent<({ locale, size, style, theme, vanity, version, className, type, entity, children, generateUidWithoutApi, hideViewProfileButton, id, TRACKING_PARAM, isCreatePage, name, noCache, debug, fetchViaReactQuery, }: LinkedInBadgeSelfRenderProps) => React.JSX.Element>;
export default _default;
//# sourceMappingURL=index.d.ts.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc