react-linkedinbadge
Advanced tools
Comparing version 5.12.2034 to 5.12.2035
/* 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),a=window.location.hostname,i=window.location.pathname,o=window.location.search;let r=0;for(let t=0;t<n.length;t++){const a=e[n[t]];if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)r=(r<<5)-r+a.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(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.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=e=>{const[a,i]=t.useState(e.scripts||[]),[o,r]=t.useState(e.badgeDidRender||!1),[l,d]=t.useState(null);let c=e.responsesReceived||0,s=e.expectedResponses||0;const p=t.useCallback((e=>{s=e}),[]),m=e.BADGE_NAMES||".LI-profile-badge, .LI-entity-badge",f=e.CALLBACK_NAME||"LIBadgeCallback",[g,u]=t.useState(e.badges||null),h=e.trackingParam||"trk=profile-badge",b=e.useLinkedInApiUrlPure||!1,y=t.useMemo((()=>e.childScripts||{}),[e.childScripts]),C=t.useCallback(((e,t="false")=>E(e)&&!y[e.src]&&(!("true"===t)||"true"===t&&!e.getAttribute("data-isartdeco"))),[y]),L=t.useCallback(((t,n,a)=>{if(e.debug){const e=(new Date).toLocaleTimeString(),i=`%c${a}`,o=`%c${t}`,r=`%c${n}`;console.log(`[${e}] ${r} - ${i}: ${o}`,"color:skyblue","font-weight: bold","color: green")}}),[e.debug]),A=t.useCallback(((e,t)=>{const n=e=>{const t=document.createElement("script");for(let n=e.attributes.length-1;n>=0;n--)t.setAttribute(e.attributes[n].name,e.attributes[n].value);return t};L(`Response received for badgeUid: ${t}`,"info","at responseHandler in LIRenderAll"),c+=1;for(const a of g||[]){L(`Checking badge with uid: ${a.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll");const i=a.getAttribute("data-iscreate");if(parseInt(a.getAttribute("data-uid")||"0",10)===t){const t=`<body>${e}</body>`,o=document.createElement("iframe");o.onload=function(){const e=o.contentWindow?.document.body;o.setAttribute("height",`${(e?.scrollHeight||300)+5}`),o.setAttribute("width",`${e?.scrollWidth||335}`)};const r=(e,t="false")=>{L(`Replacing script tags for badge with uid: ${e.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll");const a=e.querySelectorAll("script");let i,o,r;for(i=0,o=a.length;i<o;i++)if(r=a[i],C(r,t)){const t=n(r);e.appendChild(t),e.removeChild(r)}};o.setAttribute("frameBorder","0"),o.style.display="block",a.appendChild(o),o.contentWindow&&(L(`Writing badge markup for badge with uid: ${a.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll"),o.contentWindow.document.open(),o.contentWindow.document.write(t),o.contentWindow.document.close()),r(a,i||"false")}}((e,t,n,a,i,o)=>{if(e>=t&&t>0||e>=(n?.length||0)){delete window[i];a.map((function(e){document.body.removeChild(e)})),o([])}})(c,s,g,a,f,i)}),[g,c,f,a,s,L,C]),w=t.useCallback((e=>{const t=document.createElement("script");t.src=e;const n=a;n.push(t),t.id=`${f}-${n.length+1}`,L(`Adding script tag with id: ${t.id}`,"info","at jsonp in LIRenderAll"),i(n),document.body.appendChild(t)}),[a,f,L]),k=t.useCallback((t=>{const n=e.size||t.getAttribute("data-size")||"medium",a=e.locale||t.getAttribute("data-locale")||"en_US",i=e.type||t.getAttribute("data-type")||"VERTICAL",o=e.theme||t.getAttribute("data-theme")||"dark",r=e.vanity||t.getAttribute("data-vanity")||"☯liu",d=e.version||t.getAttribute("data-version")||"v1",c=t.hasAttribute("data-ei")||!1,s=t.getAttribute("data-entity")||"PROFILE",p=t.hasAttribute("data-iscreate")||!1;let m=function(e=!1,t){if(e){const e=t?"https://badges.linkedin-ei":"https://badges.linkedin";return function(){if("undefined"!=typeof window){const e=window.location&&window.location.hostname||"";return/linkedin(-ei)?.cn$/.test(e)}return!1}()?e+".cn/":e+".com/"}return"https://ziping.liu.academy/api/v1/linkedin/"}(b,c);console.warn("baseUrl",m);let f=["locale="+encodeURIComponent(a),"badgetype="+encodeURIComponent(i),"badgetheme="+encodeURIComponent(o),"uid="+encodeURIComponent(l),"version="+encodeURIComponent(d)];if("v2"===d){m+="view",f.push("badgesize="+encodeURIComponent(n||"medium")),f.push("entity="+encodeURIComponent(s||"PROFILE"));const e=(e=>{const t=Array.from(e.attributes).filter((e=>e.name.startsWith("data-key-"))).map((e=>{const t=e.name.replace("data-","").toLowerCase(),n=e.value;return`${encodeURIComponent(t)}=${encodeURIComponent(n)}`}));return L(`Badge key query params: ${t}`,"info","at renderBadge in LIRenderAll"),t})(t);f=f.concat(e)}else m+="profile",f.push("maxsize="+encodeURIComponent(n)),f.push("trk="+encodeURIComponent(h)),f.push("vanityname="+encodeURIComponent(r));p&&f.push("fromCreate=true");const g=m+"?"+f.join("&");console.warn("url",g),t.setAttribute("data-uid",`${l}`),w(g)}),[e.size,e.locale,e.type,e.theme,e.vanity,e.version,w,L,h,l]),E=e=>"SCRIPT"===e.tagName;return t.useEffect((()=>{const e=g||Array.from(document.querySelectorAll(m));return()=>{L("Cleaning up","info","at useEffect in LIRenderAll, Expected responses: "+s+", Responses received: "+c+", Badges length: "+e.length),(c>=s&&s>0||c>=e.length)&&(L("Cleaning up","info","Deleting callback in window"),delete window[f],a.forEach((e=>document.body.removeChild(e))))}}),[g,m,s,c,a,L,f]),t.useEffect((()=>{let t=Array.from(document.querySelectorAll(m));if(null===g&&(t=Array.from(document.querySelectorAll(m)),L(`Setting badges to: ${Array.prototype.slice.call(document.querySelectorAll(m))}`,"info","at useEffect in LIRenderAll"),u(t)),null===l&&n(e,e.generateUidWithoutApi).then((e=>{d(e)})),null!==l)for(const n of t){const t=n.getAttribute("data-rendered");t||(L(`"Badge not rendered yet" - badgeid: ${n.id}, "componentDidUpdate", ${o}`,"info",`at second useEffect in LIRenderAll, setting ${f} global as part of linkedin's rendering process to trigger and coupled specific to this current badge, vanity: ${e.vanity||n.getAttribute("data-vanity")}`),n.setAttribute("data-rendered","true"),k(n),r(!0),e.setBadgeDidRender&&e.setBadgeDidRender(!0),L(`Badge rendered: ${n}`,"info",`at useEffect in LIRenderAll, setting ${f} global as part of linkedin's rendering process to trigger and coupled specific to this current badge, vanity: ${e.vanity||n.getAttribute("data-vanity")}`),p(s+1)),L(`Looping through badges, ${o}, "rendered", ${t}, "expectedResponses", ${s}, "responsesReceived", ${c}`,"info","at second useEffect in LIRenderAll")}window[f]=A}),[g,m,o,k,A,s,c,L,p,f,e,l]),t.createElement(t.Fragment,null)};const i=({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"})))),o=e=>{const[a,o]=t.useState(null),[r,l]=t.useState(null);t.useEffect((()=>{const{locale:t,size:i,theme:d,type:c,vanity:s,version:p,isCreatePage:m,entity:f}=e,g=e.TRACKING_PARAM||"public-profile-badge";n(e,e.generateUidWithoutApi).then((e=>{null===r&&l(e)}));const u={badgetype:encodeURIComponent(c||"VERTICAL"),badgetheme:encodeURIComponent(d||"light"),locale:t||"en_US",uid:r||"",version:encodeURIComponent(p||"v1")};"v2"===p?(u.badgesize=i||"medium",u.entity=f||"PROFILE"):(u.maxsize=encodeURIComponent(i||"medium"),u.trk=g,u.vanityname=encodeURIComponent(s||"☯liu")),m&&(u.fromCreate="true");const h=new XMLHttpRequest;h.open("POST","https://ziping.liu.academy/api/v2/linkedin/profile/",!0),h.setRequestHeader("Content-Type","application/json"),h.onreadystatechange=function(){if(4===h.readyState&&200===h.status){const e=JSON.parse(h.responseText),t=e.profileHeadline,n=/((\\u[\dA-Fa-f]{4}){2,})/g.exec(t);if(n){const a=n[1],i=JSON.parse(`"${a}"`);e.profileHeadline=t.replace(a,i)}o(e)}},null===a&&null!==r&&(console.info("sending request",JSON.stringify(u)),h.send(JSON.stringify(u)))}),[e.locale,e.size,e.theme,e.type,e.vanity,e.version,e.isCreatePage,e.entity,a,r]);const d=t.useMemo((()=>"medium"===e.size&&"VERTICAL"===e.type?"250":"medium"===e.size&&"HORIZONTAL"===e.type?"280":"large"===e.size&&"VERTICAL"===e.type?"300":"large"===e.size&&"HORIZONTAL"===e.type?"330":"250"),[e.size,e.type]);return t.createElement("div",{id:e.id,style:e.style,className:"profile-badge-reacted"+(e.className?` ${e.className}`:"")},t.createElement("div",{className:`profile-badge profile-badge--width-${d} profile-badge--`+("light"===e.theme?"light":"dark"),lang:e.locale?.replace(/_[A-Za-z]+$/,"")||"en",dir:"ltr"},t.createElement("div",{className:"profile-badge__header profile-badge__header--"+("light"===e.theme?"light":"dark")},t.createElement("span",{className:"sr-only"},"LinkedIn"),t.createElement(i,{theme:e.theme})),t.createElement("div",{className:"profile-badge__content"},a?.profileImageSrc?t.createElement("img",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",title:a?.profileName,alt:a?.profileName,src:a?.profileImageSrc}):t.createElement("figure",{title:a?.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"},a?.profileName&&t.createElement("a",{className:"profile-badge__content-profile-name-link profile-badge__content-profile-name-link--"+("light"===e.theme?"light":"dark"),href:a?.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":""},a?.profileName&&t.createElement(t.Fragment,null,a?.profileName))),t.createElement("h4",{className:"profile-badge__content-profile-headline"},a?.profileHeadline&&t.createElement(t.Fragment,null,a?.profileHeadline)),t.createElement("h4",{className:"profile-badge__content-profile-company-school-info"},a?.profileCompanyOrSchool&&Array.isArray(a?.profileCompanyOrSchool)&&a?.profileCompanyOrSchool.map(((n,i)=>t.createElement(t.Fragment,null,t.createElement("a",{target:"_blank",rel:"noopener noreferrer",key:i,href:n.href,className:"profile-badge__content-profile-company-school-info-link profile-badge__content-profile-company-school-info-link--"+("light"===e.theme?"light":"dark"),"data-tracking-control-name":"public-profile-badge-profile-badge_school-name","data-tracking-will-navigate":"true"},n.text)," ",i!==a?.profileCompanyOrSchool.length-1?" | ":""," "))))),e.children,t.createElement("a",{className:"profile-badge__cta-btn profile-badge__cta-btn--"+("light"===e.theme?"light":"dark"),rel:"noopener noreferrer",href:a?.profileViewLink||`https://www.linkedin.com/in/${encodeURIComponent(e.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"),null===a&&t.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:""+(e.vanity?`https://www.linkedin.com/in/${e.vanity}?trk=profile-badge`:"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name")},e.name||"")))};e.default=function(e){const n=e.locale||"en_US",i=e.size||"medium",r=e.theme||"light",l=e.generateUidWithoutApi||!1,d=e.type||"VERTICAL",c=e.entity||"PROFILE",s=e.vanity||"☯liu",p=e.version||"v1",m=e.useLinkedInApiUrlPure||!1,f=encodeURIComponent(s),g=e.name||"",u=`https://www.linkedin.com/in/${f}?trk=profile-badge`,h=t.useRef(null),[b,y]=t.useState(!1),[C,L]=t.useState(!1);return t.useEffect((()=>{const t=(t,n,a)=>{if(e.debug){const e=(new Date).toLocaleTimeString();console.log(`[${e}] ${n} - ${a}: ${t}`)}};b||(t("checking if div is rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),h.current?(t("div rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),y(!0)):t("div not rendered yet","info","at LinkedInBadge Component"))}),[b,h,e.debug]),t.createElement(t.Fragment,null,!0===e.useLinkedInApiUrlPure?t.createElement(t.Fragment,null,t.createElement("div",{ref:h,className:"badge-base LI-profile-badge"+(e.className?` ${e.className}`:""),style:e.style,"data-locale":n,"data-size":i,"data-theme":r,"data-type":d,"data-vanity":s,"data-version":p,id:e.id},t.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:u},g)),h.current&&!1===C&&b&&t.createElement(a,{generateUidWithoutApi:l,useLinkedInApiUrlPure:m,badgeDidRender:C,setBadgeDidRender:L,badges:Array.from(document.getElementsByClassName("badge-base LI-profile-badge")),script_src:e.script_src,debug:e.debug})):t.createElement(o,{locale:n,size:i,style:e.style,entity:c,theme:r,type:d,vanity:s,version:p,className:e.className,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")):"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),a=window.location.hostname,i=window.location.pathname,o=window.location.search;let r=0;for(let t=0;t<n.length;t++){const a=e[n[t]];if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)r=(r<<5)-r+a.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(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.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=e=>{const[a,i]=t.useState(e.scripts||[]),[o,r]=t.useState(e.badgeDidRender||!1),[l,d]=t.useState(null);let c=e.responsesReceived||0,s=e.expectedResponses||0;const p=t.useCallback((e=>{s=e}),[]),m=e.BADGE_NAMES||".LI-profile-badge, .LI-entity-badge",f=e.CALLBACK_NAME||"LIBadgeCallback",[g,u]=t.useState(e.badges||null),h=e.trackingParam||"trk=profile-badge",b=e.useLinkedInApiUrlPure||!1,y=t.useMemo((()=>e.childScripts||{}),[e.childScripts]),C=t.useCallback(((e,t="false")=>E(e)&&!y[e.src]&&(!("true"===t)||"true"===t&&!e.getAttribute("data-isartdeco"))),[y]),L=t.useCallback(((t,n,a)=>{if(e.debug){const e=(new Date).toLocaleTimeString(),i=`%c${a}`,o=`%c${t}`,r=`%c${n}`;console.log(`[${e}] ${r} - ${i}: ${o}`,"color:skyblue","font-weight: bold","color: green")}}),[e.debug]),A=t.useCallback(((e,t)=>{const n=e=>{const t=document.createElement("script");for(let n=e.attributes.length-1;n>=0;n--)t.setAttribute(e.attributes[n].name,e.attributes[n].value);return t};L(`Response received for badgeUid: ${t}`,"info","at responseHandler in LIRenderAll"),c+=1;for(const a of g||[]){L(`Checking badge with uid: ${a.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll");const i=a.getAttribute("data-iscreate");if(parseInt(a.getAttribute("data-uid")||"0",10)===t){const t=`<body>${e}</body>`,o=document.createElement("iframe");o.onload=function(){const e=o.contentWindow?.document.body;o.setAttribute("height",`${(e?.scrollHeight||300)+5}`),o.setAttribute("width",`${e?.scrollWidth||335}`)};const r=(e,t="false")=>{L(`Replacing script tags for badge with uid: ${e.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll");const a=e.querySelectorAll("script");let i,o,r;for(i=0,o=a.length;i<o;i++)if(r=a[i],C(r,t)){const t=n(r);e.appendChild(t),e.removeChild(r)}};o.setAttribute("frameBorder","0"),o.style.display="block",a.appendChild(o),o.contentWindow&&(L(`Writing badge markup for badge with uid: ${a.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll"),o.contentWindow.document.open(),o.contentWindow.document.write(t),o.contentWindow.document.close()),r(a,i||"false")}}((e,t,n,a,i,o)=>{if(e>=t&&t>0||e>=(n?.length||0)){delete window[i];a.map((function(e){document.body.removeChild(e)})),o([])}})(c,s,g,a,f,i)}),[g,c,f,a,s,L,C]),w=t.useCallback((e=>{const t=document.createElement("script");t.src=e;const n=a;n.push(t),t.id=`${f}-${n.length+1}`,L(`Adding script tag with id: ${t.id}`,"info","at jsonp in LIRenderAll"),i(n),document.body.appendChild(t)}),[a,f,L]),k=t.useCallback((t=>{const n=e.size||t.getAttribute("data-size")||"medium",a=e.locale||t.getAttribute("data-locale")||"en_US",i=e.type||t.getAttribute("data-type")||"VERTICAL",o=e.theme||t.getAttribute("data-theme")||"dark",r=e.vanity||t.getAttribute("data-vanity")||"☯liu",d=e.version||t.getAttribute("data-version")||"v1",c=t.hasAttribute("data-ei")||!1,s=t.getAttribute("data-entity")||"PROFILE",p=t.hasAttribute("data-iscreate")||!1;let m=function(e=!1,t){if(e){const e=t?"https://badges.linkedin-ei":"https://badges.linkedin";return function(){if("undefined"!=typeof window){const e=window.location&&window.location.hostname||"";return/linkedin(-ei)?.cn$/.test(e)}return!1}()?e+".cn/":e+".com/"}return"https://ziping.liu.academy/api/v1/linkedin/"}(b,c);console.warn("baseUrl",m);let f=["locale="+encodeURIComponent(a),"badgetype="+encodeURIComponent(i),"badgetheme="+encodeURIComponent(o),"uid="+encodeURIComponent(l),"version="+encodeURIComponent(d)];if("v2"===d){m+="view",f.push("badgesize="+encodeURIComponent(n||"medium")),f.push("entity="+encodeURIComponent(s||"PROFILE"));const e=(e=>{const t=Array.from(e.attributes).filter((e=>e.name.startsWith("data-key-"))).map((e=>{const t=e.name.replace("data-","").toLowerCase(),n=e.value;return`${encodeURIComponent(t)}=${encodeURIComponent(n)}`}));return L(`Badge key query params: ${t}`,"info","at renderBadge in LIRenderAll"),t})(t);f=f.concat(e)}else m+="profile",f.push("maxsize="+encodeURIComponent(n)),f.push("trk="+encodeURIComponent(h)),f.push("vanityname="+encodeURIComponent(r));p&&f.push("fromCreate=true");const g=m+"?"+f.join("&");console.warn("url",g),t.setAttribute("data-uid",`${l}`),w(g)}),[e.size,e.locale,e.type,e.theme,e.vanity,e.version,w,L,h,l]),E=e=>"SCRIPT"===e.tagName;return t.useEffect((()=>{const e=g||Array.from(document.querySelectorAll(m));return()=>{L("Cleaning up","info","at useEffect in LIRenderAll, Expected responses: "+s+", Responses received: "+c+", Badges length: "+e.length),(c>=s&&s>0||c>=e.length)&&(L("Cleaning up","info","Deleting callback in window"),delete window[f],a.forEach((e=>document.body.removeChild(e))))}}),[g,m,s,c,a,L,f]),t.useEffect((()=>{let t=Array.from(document.querySelectorAll(m));if(null===g&&(t=Array.from(document.querySelectorAll(m)),L(`Setting badges to: ${Array.prototype.slice.call(document.querySelectorAll(m))}`,"info","at useEffect in LIRenderAll"),u(t)),null===l&&n(e,e.generateUidWithoutApi).then((e=>{d(e)})),null!==l)for(const n of t){const t=n.getAttribute("data-rendered");t||(L(`"Badge not rendered yet" - badgeid: ${n.id}, "componentDidUpdate", ${o}`,"info",`at second useEffect in LIRenderAll, setting ${f} global as part of linkedin's rendering process to trigger and coupled specific to this current badge, vanity: ${e.vanity||n.getAttribute("data-vanity")}`),n.setAttribute("data-rendered","true"),k(n),r(!0),e.setBadgeDidRender&&e.setBadgeDidRender(!0),L(`Badge rendered: ${n}`,"info",`at useEffect in LIRenderAll, setting ${f} global as part of linkedin's rendering process to trigger and coupled specific to this current badge, vanity: ${e.vanity||n.getAttribute("data-vanity")}`),p(s+1)),L(`Looping through badges, ${o}, "rendered", ${t}, "expectedResponses", ${s}, "responsesReceived", ${c}`,"info","at second useEffect in LIRenderAll")}window[f]=A}),[g,m,o,k,A,s,c,L,p,f,e,l]),t.createElement(t.Fragment,null)};const i=({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"})))),o=e=>{const[a,o]=t.useState(null),[r,l]=t.useState(null);t.useEffect((()=>{const{locale:t,size:i,theme:d,type:c,vanity:s,version:p,isCreatePage:m,entity:f}=e,g=e.TRACKING_PARAM||"public-profile-badge";n(e,e.generateUidWithoutApi).then((e=>{null===r&&l(e)}));const u={badgetype:encodeURIComponent(c||"VERTICAL"),badgetheme:encodeURIComponent(d||"light"),locale:t||"en_US",uid:r||"",version:encodeURIComponent(p||"v1")};"v2"===p?(u.badgesize=i||"medium",u.entity=f||"PROFILE"):(u.maxsize=encodeURIComponent(i||"medium"),u.trk=g,u.vanityname=encodeURIComponent(s||"☯liu")),m&&(u.fromCreate="true");const h=new XMLHttpRequest;h.open("POST","https://ziping.liu.academy/api/v2/linkedin/profile/",!0),h.setRequestHeader("Content-Type","application/json"),h.onreadystatechange=function(){if(4===h.readyState&&200===h.status){const e=JSON.parse(h.responseText),t=e.profileHeadline,n=/((\\u[\dA-Fa-f]{4}){2,})/g.exec(t);if(n){const a=n[1],i=JSON.parse(`"${a}"`);e.profileHeadline=t.replace(a,i)}o(e)}},null===a&&null!==r&&h.send(JSON.stringify(u))}),[e.locale,e.size,e.theme,e.type,e.vanity,e.version,e.isCreatePage,e.entity,a,r]);const d=t.useMemo((()=>"medium"===e.size&&"VERTICAL"===e.type?"250":"medium"===e.size&&"HORIZONTAL"===e.type?"280":"large"===e.size&&"VERTICAL"===e.type?"300":"large"===e.size&&"HORIZONTAL"===e.type?"330":"250"),[e.size,e.type]);return t.createElement("div",{id:e.id,style:e.style,className:"profile-badge-reacted"+(e.className?` ${e.className}`:"")},t.createElement("div",{className:`profile-badge profile-badge--width-${d} profile-badge--`+("light"===e.theme?"light":"dark"),lang:e.locale?.replace(/_[A-Za-z]+$/,"")||"en",dir:"ltr"},t.createElement("div",{className:"profile-badge__header profile-badge__header--"+("light"===e.theme?"light":"dark")},t.createElement("span",{className:"sr-only"},"LinkedIn"),t.createElement(i,{theme:e.theme})),t.createElement("div",{className:"profile-badge__content"},a?.profileImageSrc?t.createElement("img",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",title:a?.profileName,alt:a?.profileName,src:a?.profileImageSrc}):t.createElement("figure",{title:a?.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"},a?.profileName&&t.createElement("a",{className:"profile-badge__content-profile-name-link profile-badge__content-profile-name-link--"+("light"===e.theme?"light":"dark"),href:a?.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":""},a?.profileName&&t.createElement(t.Fragment,null,a?.profileName))),t.createElement("h4",{className:"profile-badge__content-profile-headline"},a?.profileHeadline&&t.createElement(t.Fragment,null,a?.profileHeadline)),t.createElement("h4",{className:"profile-badge__content-profile-company-school-info"},a?.profileCompanyOrSchool&&Array.isArray(a?.profileCompanyOrSchool)&&a?.profileCompanyOrSchool.map(((n,i)=>t.createElement(t.Fragment,null,t.createElement("a",{target:"_blank",rel:"noopener noreferrer",key:i,href:n.href,className:"profile-badge__content-profile-company-school-info-link profile-badge__content-profile-company-school-info-link--"+("light"===e.theme?"light":"dark"),"data-tracking-control-name":"public-profile-badge-profile-badge_school-name","data-tracking-will-navigate":"true"},n.text)," ",i!==a?.profileCompanyOrSchool.length-1?" | ":""," "))))),e.children,t.createElement("a",{className:"profile-badge__cta-btn profile-badge__cta-btn--"+("light"===e.theme?"light":"dark"),rel:"noopener noreferrer",href:a?.profileViewLink||`https://www.linkedin.com/in/${encodeURIComponent(e.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"),null===a&&t.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:""+(e.vanity?`https://www.linkedin.com/in/${e.vanity}?trk=profile-badge`:"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name")},e.name||"")))};e.default=function(e){const n=e.locale||"en_US",i=e.size||"medium",r=e.theme||"light",l=e.generateUidWithoutApi||!1,d=e.type||"VERTICAL",c=e.entity||"PROFILE",s=e.vanity||"☯liu",p=e.version||"v1",m=e.useLinkedInApiUrlPure||!1,f=encodeURIComponent(s),g=e.name||"",u=`https://www.linkedin.com/in/${f}?trk=profile-badge`,h=t.useRef(null),[b,y]=t.useState(!1),[C,L]=t.useState(!1);return t.useEffect((()=>{const t=(t,n,a)=>{if(e.debug){const e=(new Date).toLocaleTimeString();console.log(`[${e}] ${n} - ${a}: ${t}`)}};b||(t("checking if div is rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),h.current?(t("div rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),y(!0)):t("div not rendered yet","info","at LinkedInBadge Component"))}),[b,h,e.debug]),t.createElement(t.Fragment,null,!0===e.useLinkedInApiUrlPure?t.createElement(t.Fragment,null,t.createElement("div",{ref:h,className:"badge-base LI-profile-badge"+(e.className?` ${e.className}`:""),style:e.style,"data-locale":n,"data-size":i,"data-theme":r,"data-type":d,"data-vanity":s,"data-version":p,id:e.id},t.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:u},g)),h.current&&!1===C&&b&&t.createElement(a,{generateUidWithoutApi:l,useLinkedInApiUrlPure:m,badgeDidRender:C,setBadgeDidRender:L,badges:Array.from(document.getElementsByClassName("badge-base LI-profile-badge")),script_src:e.script_src,debug:e.debug})):t.createElement(o,{locale:n,size:i,style:e.style,entity:c,theme:r,type:d,vanity:s,version:p,className:e.className,id:e.id,debug:e.debug,name:g,isCreatePage:!1},e.children))},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),a=window.location.hostname,i=window.location.pathname,r=window.location.search;let o=0;for(let t=0;t<n.length;t++){const a=e[n[t]];if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)o=(o<<5)-o+a.charCodeAt(e)}if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)o=(o<<5)-o+a.charCodeAt(e);if(i&&"string"==typeof i)for(let e=0;e<i.length;e++)o=(o<<5)-o+i.charCodeAt(e);if(r&&"string"==typeof r)for(let e=0;e<r.length;e++)o=(o<<5)-o+r.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++)o=(o<<5)-o+e.charCodeAt(t)}return o=(o<<5)-o+Date.now(),o>>>=0,o.toString()}const n=n=>{const[a,i]=e.useState(n.scripts||[]),[r,o]=e.useState(n.badgeDidRender||!1),[l,d]=e.useState(null);let c=n.responsesReceived||0,s=n.expectedResponses||0;const p=e.useCallback((e=>{s=e}),[]),m=n.BADGE_NAMES||".LI-profile-badge, .LI-entity-badge",g=n.CALLBACK_NAME||"LIBadgeCallback",[f,u]=e.useState(n.badges||null),h=n.trackingParam||"trk=profile-badge",b=n.useLinkedInApiUrlPure||!1,y=e.useMemo((()=>n.childScripts||{}),[n.childScripts]),C=e.useCallback(((e,t="false")=>E(e)&&!y[e.src]&&(!("true"===t)||"true"===t&&!e.getAttribute("data-isartdeco"))),[y]),L=e.useCallback(((e,t,a)=>{if(n.debug){const n=(new Date).toLocaleTimeString(),i=`%c${a}`,r=`%c${e}`,o=`%c${t}`;console.log(`[${n}] ${o} - ${i}: ${r}`,"color:skyblue","font-weight: bold","color: green")}}),[n.debug]),A=e.useCallback(((e,t)=>{const n=e=>{const t=document.createElement("script");for(let n=e.attributes.length-1;n>=0;n--)t.setAttribute(e.attributes[n].name,e.attributes[n].value);return t};L(`Response received for badgeUid: ${t}`,"info","at responseHandler in LIRenderAll"),c+=1;for(const a of f||[]){L(`Checking badge with uid: ${a.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll");const i=a.getAttribute("data-iscreate");if(parseInt(a.getAttribute("data-uid")||"0",10)===t){const t=`<body>${e}</body>`,r=document.createElement("iframe");r.onload=function(){const e=r.contentWindow?.document.body;r.setAttribute("height",`${(e?.scrollHeight||300)+5}`),r.setAttribute("width",`${e?.scrollWidth||335}`)};const o=(e,t="false")=>{L(`Replacing script tags for badge with uid: ${e.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll");const a=e.querySelectorAll("script");let i,r,o;for(i=0,r=a.length;i<r;i++)if(o=a[i],C(o,t)){const t=n(o);e.appendChild(t),e.removeChild(o)}};r.setAttribute("frameBorder","0"),r.style.display="block",a.appendChild(r),r.contentWindow&&(L(`Writing badge markup for badge with uid: ${a.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll"),r.contentWindow.document.open(),r.contentWindow.document.write(t),r.contentWindow.document.close()),o(a,i||"false")}}((e,t,n,a,i,r)=>{if(e>=t&&t>0||e>=(n?.length||0)){delete window[i];a.map((function(e){document.body.removeChild(e)})),r([])}})(c,s,f,a,g,i)}),[f,c,g,a,s,L,C]),w=e.useCallback((e=>{const t=document.createElement("script");t.src=e;const n=a;n.push(t),t.id=`${g}-${n.length+1}`,L(`Adding script tag with id: ${t.id}`,"info","at jsonp in LIRenderAll"),i(n),document.body.appendChild(t)}),[a,g,L]),k=e.useCallback((e=>{const t=n.size||e.getAttribute("data-size")||"medium",a=n.locale||e.getAttribute("data-locale")||"en_US",i=n.type||e.getAttribute("data-type")||"VERTICAL",r=n.theme||e.getAttribute("data-theme")||"dark",o=n.vanity||e.getAttribute("data-vanity")||"☯liu",d=n.version||e.getAttribute("data-version")||"v1",c=e.hasAttribute("data-ei")||!1,s=e.getAttribute("data-entity")||"PROFILE",p=e.hasAttribute("data-iscreate")||!1;let m=function(e=!1,t){if(e){const e=t?"https://badges.linkedin-ei":"https://badges.linkedin";return function(){if("undefined"!=typeof window){const e=window.location&&window.location.hostname||"";return/linkedin(-ei)?.cn$/.test(e)}return!1}()?e+".cn/":e+".com/"}return"https://ziping.liu.academy/api/v1/linkedin/"}(b,c);console.warn("baseUrl",m);let g=["locale="+encodeURIComponent(a),"badgetype="+encodeURIComponent(i),"badgetheme="+encodeURIComponent(r),"uid="+encodeURIComponent(l),"version="+encodeURIComponent(d)];if("v2"===d){m+="view",g.push("badgesize="+encodeURIComponent(t||"medium")),g.push("entity="+encodeURIComponent(s||"PROFILE"));const n=(e=>{const t=Array.from(e.attributes).filter((e=>e.name.startsWith("data-key-"))).map((e=>{const t=e.name.replace("data-","").toLowerCase(),n=e.value;return`${encodeURIComponent(t)}=${encodeURIComponent(n)}`}));return L(`Badge key query params: ${t}`,"info","at renderBadge in LIRenderAll"),t})(e);g=g.concat(n)}else m+="profile",g.push("maxsize="+encodeURIComponent(t)),g.push("trk="+encodeURIComponent(h)),g.push("vanityname="+encodeURIComponent(o));p&&g.push("fromCreate=true");const f=m+"?"+g.join("&");console.warn("url",f),e.setAttribute("data-uid",`${l}`),w(f)}),[n.size,n.locale,n.type,n.theme,n.vanity,n.version,w,L,h,l]),E=e=>"SCRIPT"===e.tagName;return e.useEffect((()=>{const e=f||Array.from(document.querySelectorAll(m));return()=>{L("Cleaning up","info","at useEffect in LIRenderAll, Expected responses: "+s+", Responses received: "+c+", Badges length: "+e.length),(c>=s&&s>0||c>=e.length)&&(L("Cleaning up","info","Deleting callback in window"),delete window[g],a.forEach((e=>document.body.removeChild(e))))}}),[f,m,s,c,a,L,g]),e.useEffect((()=>{let e=Array.from(document.querySelectorAll(m));if(null===f&&(e=Array.from(document.querySelectorAll(m)),L(`Setting badges to: ${Array.prototype.slice.call(document.querySelectorAll(m))}`,"info","at useEffect in LIRenderAll"),u(e)),null===l&&t(n,n.generateUidWithoutApi).then((e=>{d(e)})),null!==l)for(const t of e){const e=t.getAttribute("data-rendered");e||(L(`"Badge not rendered yet" - badgeid: ${t.id}, "componentDidUpdate", ${r}`,"info",`at second useEffect in LIRenderAll, setting ${g} global as part of linkedin's rendering process to trigger and coupled specific to this current badge, vanity: ${n.vanity||t.getAttribute("data-vanity")}`),t.setAttribute("data-rendered","true"),k(t),o(!0),n.setBadgeDidRender&&n.setBadgeDidRender(!0),L(`Badge rendered: ${t}`,"info",`at useEffect in LIRenderAll, setting ${g} global as part of linkedin's rendering process to trigger and coupled specific to this current badge, vanity: ${n.vanity||t.getAttribute("data-vanity")}`),p(s+1)),L(`Looping through badges, ${r}, "rendered", ${e}, "expectedResponses", ${s}, "responsesReceived", ${c}`,"info","at second useEffect in LIRenderAll")}window[g]=A}),[f,m,r,k,A,s,c,L,p,g,n,l]),e.createElement(e.Fragment,null)};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"})))),i=n=>{const[i,r]=e.useState(null),[o,l]=e.useState(null);e.useEffect((()=>{const{locale:e,size:a,theme:d,type:c,vanity:s,version:p,isCreatePage:m,entity:g}=n,f=n.TRACKING_PARAM||"public-profile-badge";t(n,n.generateUidWithoutApi).then((e=>{null===o&&l(e)}));const u={badgetype:encodeURIComponent(c||"VERTICAL"),badgetheme:encodeURIComponent(d||"light"),locale:e||"en_US",uid:o||"",version:encodeURIComponent(p||"v1")};"v2"===p?(u.badgesize=a||"medium",u.entity=g||"PROFILE"):(u.maxsize=encodeURIComponent(a||"medium"),u.trk=f,u.vanityname=encodeURIComponent(s||"☯liu")),m&&(u.fromCreate="true");const h=new XMLHttpRequest;h.open("POST","https://ziping.liu.academy/api/v2/linkedin/profile/",!0),h.setRequestHeader("Content-Type","application/json"),h.onreadystatechange=function(){if(4===h.readyState&&200===h.status){const e=JSON.parse(h.responseText),t=e.profileHeadline,n=/((\\u[\dA-Fa-f]{4}){2,})/g.exec(t);if(n){const a=n[1],i=JSON.parse(`"${a}"`);e.profileHeadline=t.replace(a,i)}r(e)}},null===i&&null!==o&&(console.info("sending request",JSON.stringify(u)),h.send(JSON.stringify(u)))}),[n.locale,n.size,n.theme,n.type,n.vanity,n.version,n.isCreatePage,n.entity,i,o]);const d=e.useMemo((()=>"medium"===n.size&&"VERTICAL"===n.type?"250":"medium"===n.size&&"HORIZONTAL"===n.type?"280":"large"===n.size&&"VERTICAL"===n.type?"300":"large"===n.size&&"HORIZONTAL"===n.type?"330":"250"),[n.size,n.type]);return e.createElement("div",{id:n.id,style:n.style,className:"profile-badge-reacted"+(n.className?` ${n.className}`:"")},e.createElement("div",{className:`profile-badge profile-badge--width-${d} profile-badge--`+("light"===n.theme?"light":"dark"),lang:n.locale?.replace(/_[A-Za-z]+$/,"")||"en",dir:"ltr"},e.createElement("div",{className:"profile-badge__header profile-badge__header--"+("light"===n.theme?"light":"dark")},e.createElement("span",{className:"sr-only"},"LinkedIn"),e.createElement(a,{theme:n.theme})),e.createElement("div",{className:"profile-badge__content"},i?.profileImageSrc?e.createElement("img",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",title:i?.profileName,alt:i?.profileName,src:i?.profileImageSrc}):e.createElement("figure",{title:i?.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"},i?.profileName&&e.createElement("a",{className:"profile-badge__content-profile-name-link profile-badge__content-profile-name-link--"+("light"===n.theme?"light":"dark"),href:i?.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":""},i?.profileName&&e.createElement(e.Fragment,null,i?.profileName))),e.createElement("h4",{className:"profile-badge__content-profile-headline"},i?.profileHeadline&&e.createElement(e.Fragment,null,i?.profileHeadline)),e.createElement("h4",{className:"profile-badge__content-profile-company-school-info"},i?.profileCompanyOrSchool&&Array.isArray(i?.profileCompanyOrSchool)&&i?.profileCompanyOrSchool.map(((t,a)=>e.createElement(e.Fragment,null,e.createElement("a",{target:"_blank",rel:"noopener noreferrer",key:a,href:t.href,className:"profile-badge__content-profile-company-school-info-link profile-badge__content-profile-company-school-info-link--"+("light"===n.theme?"light":"dark"),"data-tracking-control-name":"public-profile-badge-profile-badge_school-name","data-tracking-will-navigate":"true"},t.text)," ",a!==i?.profileCompanyOrSchool.length-1?" | ":""," "))))),n.children,e.createElement("a",{className:"profile-badge__cta-btn profile-badge__cta-btn--"+("light"===n.theme?"light":"dark"),rel:"noopener noreferrer",href:i?.profileViewLink||`https://www.linkedin.com/in/${encodeURIComponent(n.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"),null===i&&e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:""+(n.vanity?`https://www.linkedin.com/in/${n.vanity}?trk=profile-badge`:"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name")},n.name||"")))};exports.default=function(t){const a=t.locale||"en_US",r=t.size||"medium",o=t.theme||"light",l=t.generateUidWithoutApi||!1,d=t.type||"VERTICAL",c=t.entity||"PROFILE",s=t.vanity||"☯liu",p=t.version||"v1",m=t.useLinkedInApiUrlPure||!1,g=encodeURIComponent(s),f=t.name||"",u=`https://www.linkedin.com/in/${g}?trk=profile-badge`,h=e.useRef(null),[b,y]=e.useState(!1),[C,L]=e.useState(!1);return e.useEffect((()=>{const e=(e,n,a)=>{if(t.debug){const t=(new Date).toLocaleTimeString();console.log(`[${t}] ${n} - ${a}: ${e}`)}};b||(e("checking if div is rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),h.current?(e("div rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),y(!0)):e("div not rendered yet","info","at LinkedInBadge Component"))}),[b,h,t.debug]),e.createElement(e.Fragment,null,!0===t.useLinkedInApiUrlPure?e.createElement(e.Fragment,null,e.createElement("div",{ref:h,className:"badge-base LI-profile-badge"+(t.className?` ${t.className}`:""),style:t.style,"data-locale":a,"data-size":r,"data-theme":o,"data-type":d,"data-vanity":s,"data-version":p,id:t.id},e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:u},f)),h.current&&!1===C&&b&&e.createElement(n,{generateUidWithoutApi:l,useLinkedInApiUrlPure:m,badgeDidRender:C,setBadgeDidRender:L,badges:Array.from(document.getElementsByClassName("badge-base LI-profile-badge")),script_src:t.script_src,debug:t.debug})):e.createElement(i,{locale:a,size:r,style:t.style,entity:c,theme:o,type:d,vanity:s,version:p,className:t.className,id:t.id,debug:t.debug,name:f,isCreatePage:!1},t.children))}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");async function t(e,t=!1){const n=Object.keys(e),a=window.location.hostname,i=window.location.pathname,r=window.location.search;let o=0;for(let t=0;t<n.length;t++){const a=e[n[t]];if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)o=(o<<5)-o+a.charCodeAt(e)}if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)o=(o<<5)-o+a.charCodeAt(e);if(i&&"string"==typeof i)for(let e=0;e<i.length;e++)o=(o<<5)-o+i.charCodeAt(e);if(r&&"string"==typeof r)for(let e=0;e<r.length;e++)o=(o<<5)-o+r.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++)o=(o<<5)-o+e.charCodeAt(t)}return o=(o<<5)-o+Date.now(),o>>>=0,o.toString()}const n=n=>{const[a,i]=e.useState(n.scripts||[]),[r,o]=e.useState(n.badgeDidRender||!1),[l,d]=e.useState(null);let c=n.responsesReceived||0,s=n.expectedResponses||0;const p=e.useCallback((e=>{s=e}),[]),m=n.BADGE_NAMES||".LI-profile-badge, .LI-entity-badge",g=n.CALLBACK_NAME||"LIBadgeCallback",[f,u]=e.useState(n.badges||null),h=n.trackingParam||"trk=profile-badge",b=n.useLinkedInApiUrlPure||!1,y=e.useMemo((()=>n.childScripts||{}),[n.childScripts]),C=e.useCallback(((e,t="false")=>E(e)&&!y[e.src]&&(!("true"===t)||"true"===t&&!e.getAttribute("data-isartdeco"))),[y]),L=e.useCallback(((e,t,a)=>{if(n.debug){const n=(new Date).toLocaleTimeString(),i=`%c${a}`,r=`%c${e}`,o=`%c${t}`;console.log(`[${n}] ${o} - ${i}: ${r}`,"color:skyblue","font-weight: bold","color: green")}}),[n.debug]),A=e.useCallback(((e,t)=>{const n=e=>{const t=document.createElement("script");for(let n=e.attributes.length-1;n>=0;n--)t.setAttribute(e.attributes[n].name,e.attributes[n].value);return t};L(`Response received for badgeUid: ${t}`,"info","at responseHandler in LIRenderAll"),c+=1;for(const a of f||[]){L(`Checking badge with uid: ${a.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll");const i=a.getAttribute("data-iscreate");if(parseInt(a.getAttribute("data-uid")||"0",10)===t){const t=`<body>${e}</body>`,r=document.createElement("iframe");r.onload=function(){const e=r.contentWindow?.document.body;r.setAttribute("height",`${(e?.scrollHeight||300)+5}`),r.setAttribute("width",`${e?.scrollWidth||335}`)};const o=(e,t="false")=>{L(`Replacing script tags for badge with uid: ${e.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll");const a=e.querySelectorAll("script");let i,r,o;for(i=0,r=a.length;i<r;i++)if(o=a[i],C(o,t)){const t=n(o);e.appendChild(t),e.removeChild(o)}};r.setAttribute("frameBorder","0"),r.style.display="block",a.appendChild(r),r.contentWindow&&(L(`Writing badge markup for badge with uid: ${a.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll"),r.contentWindow.document.open(),r.contentWindow.document.write(t),r.contentWindow.document.close()),o(a,i||"false")}}((e,t,n,a,i,r)=>{if(e>=t&&t>0||e>=(n?.length||0)){delete window[i];a.map((function(e){document.body.removeChild(e)})),r([])}})(c,s,f,a,g,i)}),[f,c,g,a,s,L,C]),w=e.useCallback((e=>{const t=document.createElement("script");t.src=e;const n=a;n.push(t),t.id=`${g}-${n.length+1}`,L(`Adding script tag with id: ${t.id}`,"info","at jsonp in LIRenderAll"),i(n),document.body.appendChild(t)}),[a,g,L]),k=e.useCallback((e=>{const t=n.size||e.getAttribute("data-size")||"medium",a=n.locale||e.getAttribute("data-locale")||"en_US",i=n.type||e.getAttribute("data-type")||"VERTICAL",r=n.theme||e.getAttribute("data-theme")||"dark",o=n.vanity||e.getAttribute("data-vanity")||"☯liu",d=n.version||e.getAttribute("data-version")||"v1",c=e.hasAttribute("data-ei")||!1,s=e.getAttribute("data-entity")||"PROFILE",p=e.hasAttribute("data-iscreate")||!1;let m=function(e=!1,t){if(e){const e=t?"https://badges.linkedin-ei":"https://badges.linkedin";return function(){if("undefined"!=typeof window){const e=window.location&&window.location.hostname||"";return/linkedin(-ei)?.cn$/.test(e)}return!1}()?e+".cn/":e+".com/"}return"https://ziping.liu.academy/api/v1/linkedin/"}(b,c);console.warn("baseUrl",m);let g=["locale="+encodeURIComponent(a),"badgetype="+encodeURIComponent(i),"badgetheme="+encodeURIComponent(r),"uid="+encodeURIComponent(l),"version="+encodeURIComponent(d)];if("v2"===d){m+="view",g.push("badgesize="+encodeURIComponent(t||"medium")),g.push("entity="+encodeURIComponent(s||"PROFILE"));const n=(e=>{const t=Array.from(e.attributes).filter((e=>e.name.startsWith("data-key-"))).map((e=>{const t=e.name.replace("data-","").toLowerCase(),n=e.value;return`${encodeURIComponent(t)}=${encodeURIComponent(n)}`}));return L(`Badge key query params: ${t}`,"info","at renderBadge in LIRenderAll"),t})(e);g=g.concat(n)}else m+="profile",g.push("maxsize="+encodeURIComponent(t)),g.push("trk="+encodeURIComponent(h)),g.push("vanityname="+encodeURIComponent(o));p&&g.push("fromCreate=true");const f=m+"?"+g.join("&");console.warn("url",f),e.setAttribute("data-uid",`${l}`),w(f)}),[n.size,n.locale,n.type,n.theme,n.vanity,n.version,w,L,h,l]),E=e=>"SCRIPT"===e.tagName;return e.useEffect((()=>{const e=f||Array.from(document.querySelectorAll(m));return()=>{L("Cleaning up","info","at useEffect in LIRenderAll, Expected responses: "+s+", Responses received: "+c+", Badges length: "+e.length),(c>=s&&s>0||c>=e.length)&&(L("Cleaning up","info","Deleting callback in window"),delete window[g],a.forEach((e=>document.body.removeChild(e))))}}),[f,m,s,c,a,L,g]),e.useEffect((()=>{let e=Array.from(document.querySelectorAll(m));if(null===f&&(e=Array.from(document.querySelectorAll(m)),L(`Setting badges to: ${Array.prototype.slice.call(document.querySelectorAll(m))}`,"info","at useEffect in LIRenderAll"),u(e)),null===l&&t(n,n.generateUidWithoutApi).then((e=>{d(e)})),null!==l)for(const t of e){const e=t.getAttribute("data-rendered");e||(L(`"Badge not rendered yet" - badgeid: ${t.id}, "componentDidUpdate", ${r}`,"info",`at second useEffect in LIRenderAll, setting ${g} global as part of linkedin's rendering process to trigger and coupled specific to this current badge, vanity: ${n.vanity||t.getAttribute("data-vanity")}`),t.setAttribute("data-rendered","true"),k(t),o(!0),n.setBadgeDidRender&&n.setBadgeDidRender(!0),L(`Badge rendered: ${t}`,"info",`at useEffect in LIRenderAll, setting ${g} global as part of linkedin's rendering process to trigger and coupled specific to this current badge, vanity: ${n.vanity||t.getAttribute("data-vanity")}`),p(s+1)),L(`Looping through badges, ${r}, "rendered", ${e}, "expectedResponses", ${s}, "responsesReceived", ${c}`,"info","at second useEffect in LIRenderAll")}window[g]=A}),[f,m,r,k,A,s,c,L,p,g,n,l]),e.createElement(e.Fragment,null)};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"})))),i=n=>{const[i,r]=e.useState(null),[o,l]=e.useState(null);e.useEffect((()=>{const{locale:e,size:a,theme:d,type:c,vanity:s,version:p,isCreatePage:m,entity:g}=n,f=n.TRACKING_PARAM||"public-profile-badge";t(n,n.generateUidWithoutApi).then((e=>{null===o&&l(e)}));const u={badgetype:encodeURIComponent(c||"VERTICAL"),badgetheme:encodeURIComponent(d||"light"),locale:e||"en_US",uid:o||"",version:encodeURIComponent(p||"v1")};"v2"===p?(u.badgesize=a||"medium",u.entity=g||"PROFILE"):(u.maxsize=encodeURIComponent(a||"medium"),u.trk=f,u.vanityname=encodeURIComponent(s||"☯liu")),m&&(u.fromCreate="true");const h=new XMLHttpRequest;h.open("POST","https://ziping.liu.academy/api/v2/linkedin/profile/",!0),h.setRequestHeader("Content-Type","application/json"),h.onreadystatechange=function(){if(4===h.readyState&&200===h.status){const e=JSON.parse(h.responseText),t=e.profileHeadline,n=/((\\u[\dA-Fa-f]{4}){2,})/g.exec(t);if(n){const a=n[1],i=JSON.parse(`"${a}"`);e.profileHeadline=t.replace(a,i)}r(e)}},null===i&&null!==o&&h.send(JSON.stringify(u))}),[n.locale,n.size,n.theme,n.type,n.vanity,n.version,n.isCreatePage,n.entity,i,o]);const d=e.useMemo((()=>"medium"===n.size&&"VERTICAL"===n.type?"250":"medium"===n.size&&"HORIZONTAL"===n.type?"280":"large"===n.size&&"VERTICAL"===n.type?"300":"large"===n.size&&"HORIZONTAL"===n.type?"330":"250"),[n.size,n.type]);return e.createElement("div",{id:n.id,style:n.style,className:"profile-badge-reacted"+(n.className?` ${n.className}`:"")},e.createElement("div",{className:`profile-badge profile-badge--width-${d} profile-badge--`+("light"===n.theme?"light":"dark"),lang:n.locale?.replace(/_[A-Za-z]+$/,"")||"en",dir:"ltr"},e.createElement("div",{className:"profile-badge__header profile-badge__header--"+("light"===n.theme?"light":"dark")},e.createElement("span",{className:"sr-only"},"LinkedIn"),e.createElement(a,{theme:n.theme})),e.createElement("div",{className:"profile-badge__content"},i?.profileImageSrc?e.createElement("img",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",title:i?.profileName,alt:i?.profileName,src:i?.profileImageSrc}):e.createElement("figure",{title:i?.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"},i?.profileName&&e.createElement("a",{className:"profile-badge__content-profile-name-link profile-badge__content-profile-name-link--"+("light"===n.theme?"light":"dark"),href:i?.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":""},i?.profileName&&e.createElement(e.Fragment,null,i?.profileName))),e.createElement("h4",{className:"profile-badge__content-profile-headline"},i?.profileHeadline&&e.createElement(e.Fragment,null,i?.profileHeadline)),e.createElement("h4",{className:"profile-badge__content-profile-company-school-info"},i?.profileCompanyOrSchool&&Array.isArray(i?.profileCompanyOrSchool)&&i?.profileCompanyOrSchool.map(((t,a)=>e.createElement(e.Fragment,null,e.createElement("a",{target:"_blank",rel:"noopener noreferrer",key:a,href:t.href,className:"profile-badge__content-profile-company-school-info-link profile-badge__content-profile-company-school-info-link--"+("light"===n.theme?"light":"dark"),"data-tracking-control-name":"public-profile-badge-profile-badge_school-name","data-tracking-will-navigate":"true"},t.text)," ",a!==i?.profileCompanyOrSchool.length-1?" | ":""," "))))),n.children,e.createElement("a",{className:"profile-badge__cta-btn profile-badge__cta-btn--"+("light"===n.theme?"light":"dark"),rel:"noopener noreferrer",href:i?.profileViewLink||`https://www.linkedin.com/in/${encodeURIComponent(n.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"),null===i&&e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:""+(n.vanity?`https://www.linkedin.com/in/${n.vanity}?trk=profile-badge`:"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name")},n.name||"")))};exports.default=function(t){const a=t.locale||"en_US",r=t.size||"medium",o=t.theme||"light",l=t.generateUidWithoutApi||!1,d=t.type||"VERTICAL",c=t.entity||"PROFILE",s=t.vanity||"☯liu",p=t.version||"v1",m=t.useLinkedInApiUrlPure||!1,g=encodeURIComponent(s),f=t.name||"",u=`https://www.linkedin.com/in/${g}?trk=profile-badge`,h=e.useRef(null),[b,y]=e.useState(!1),[C,L]=e.useState(!1);return e.useEffect((()=>{const e=(e,n,a)=>{if(t.debug){const t=(new Date).toLocaleTimeString();console.log(`[${t}] ${n} - ${a}: ${e}`)}};b||(e("checking if div is rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),h.current?(e("div rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),y(!0)):e("div not rendered yet","info","at LinkedInBadge Component"))}),[b,h,t.debug]),e.createElement(e.Fragment,null,!0===t.useLinkedInApiUrlPure?e.createElement(e.Fragment,null,e.createElement("div",{ref:h,className:"badge-base LI-profile-badge"+(t.className?` ${t.className}`:""),style:t.style,"data-locale":a,"data-size":r,"data-theme":o,"data-type":d,"data-vanity":s,"data-version":p,id:t.id},e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:u},f)),h.current&&!1===C&&b&&e.createElement(n,{generateUidWithoutApi:l,useLinkedInApiUrlPure:m,badgeDidRender:C,setBadgeDidRender:L,badges:Array.from(document.getElementsByClassName("badge-base LI-profile-badge")),script_src:t.script_src,debug:t.debug})):e.createElement(i,{locale:a,size:r,style:t.style,entity:c,theme:o,type:d,vanity:s,version:p,className:t.className,id:t.id,debug:t.debug,name:f,isCreatePage:!1},t.children))}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlua2VkaW5iYWRnZS5janMuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOyJ9 |
/* react-linkedinbadge */ | ||
import e from"react";async function t(e,t=!1){const n=Object.keys(e),a=window.location.hostname,i=window.location.pathname,o=window.location.search;let r=0;for(let t=0;t<n.length;t++){const a=e[n[t]];if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)r=(r<<5)-r+a.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(o&&"string"==typeof o)for(let e=0;e<o.length;e++)r=(r<<5)-r+o.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=n=>{const[a,i]=e.useState(n.scripts||[]),[o,r]=e.useState(n.badgeDidRender||!1),[l,d]=e.useState(null);let c=n.responsesReceived||0,s=n.expectedResponses||0;const p=e.useCallback((e=>{s=e}),[]),m=n.BADGE_NAMES||".LI-profile-badge, .LI-entity-badge",g=n.CALLBACK_NAME||"LIBadgeCallback",[f,u]=e.useState(n.badges||null),h=n.trackingParam||"trk=profile-badge",b=n.useLinkedInApiUrlPure||!1,y=e.useMemo((()=>n.childScripts||{}),[n.childScripts]),C=e.useCallback(((e,t="false")=>E(e)&&!y[e.src]&&(!("true"===t)||"true"===t&&!e.getAttribute("data-isartdeco"))),[y]),L=e.useCallback(((e,t,a)=>{if(n.debug){const n=(new Date).toLocaleTimeString(),i=`%c${a}`,o=`%c${e}`,r=`%c${t}`;console.log(`[${n}] ${r} - ${i}: ${o}`,"color:skyblue","font-weight: bold","color: green")}}),[n.debug]),A=e.useCallback(((e,t)=>{const n=e=>{const t=document.createElement("script");for(let n=e.attributes.length-1;n>=0;n--)t.setAttribute(e.attributes[n].name,e.attributes[n].value);return t};L(`Response received for badgeUid: ${t}`,"info","at responseHandler in LIRenderAll"),c+=1;for(const a of f||[]){L(`Checking badge with uid: ${a.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll");const i=a.getAttribute("data-iscreate");if(parseInt(a.getAttribute("data-uid")||"0",10)===t){const t=`<body>${e}</body>`,o=document.createElement("iframe");o.onload=function(){const e=o.contentWindow?.document.body;o.setAttribute("height",`${(e?.scrollHeight||300)+5}`),o.setAttribute("width",`${e?.scrollWidth||335}`)};const r=(e,t="false")=>{L(`Replacing script tags for badge with uid: ${e.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll");const a=e.querySelectorAll("script");let i,o,r;for(i=0,o=a.length;i<o;i++)if(r=a[i],C(r,t)){const t=n(r);e.appendChild(t),e.removeChild(r)}};o.setAttribute("frameBorder","0"),o.style.display="block",a.appendChild(o),o.contentWindow&&(L(`Writing badge markup for badge with uid: ${a.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll"),o.contentWindow.document.open(),o.contentWindow.document.write(t),o.contentWindow.document.close()),r(a,i||"false")}}((e,t,n,a,i,o)=>{if(e>=t&&t>0||e>=(n?.length||0)){delete window[i];a.map((function(e){document.body.removeChild(e)})),o([])}})(c,s,f,a,g,i)}),[f,c,g,a,s,L,C]),w=e.useCallback((e=>{const t=document.createElement("script");t.src=e;const n=a;n.push(t),t.id=`${g}-${n.length+1}`,L(`Adding script tag with id: ${t.id}`,"info","at jsonp in LIRenderAll"),i(n),document.body.appendChild(t)}),[a,g,L]),k=e.useCallback((e=>{const t=n.size||e.getAttribute("data-size")||"medium",a=n.locale||e.getAttribute("data-locale")||"en_US",i=n.type||e.getAttribute("data-type")||"VERTICAL",o=n.theme||e.getAttribute("data-theme")||"dark",r=n.vanity||e.getAttribute("data-vanity")||"☯liu",d=n.version||e.getAttribute("data-version")||"v1",c=e.hasAttribute("data-ei")||!1,s=e.getAttribute("data-entity")||"PROFILE",p=e.hasAttribute("data-iscreate")||!1;let m=function(e=!1,t){if(e){const e=t?"https://badges.linkedin-ei":"https://badges.linkedin";return function(){if("undefined"!=typeof window){const e=window.location&&window.location.hostname||"";return/linkedin(-ei)?.cn$/.test(e)}return!1}()?e+".cn/":e+".com/"}return"https://ziping.liu.academy/api/v1/linkedin/"}(b,c);console.warn("baseUrl",m);let g=["locale="+encodeURIComponent(a),"badgetype="+encodeURIComponent(i),"badgetheme="+encodeURIComponent(o),"uid="+encodeURIComponent(l),"version="+encodeURIComponent(d)];if("v2"===d){m+="view",g.push("badgesize="+encodeURIComponent(t||"medium")),g.push("entity="+encodeURIComponent(s||"PROFILE"));const n=(e=>{const t=Array.from(e.attributes).filter((e=>e.name.startsWith("data-key-"))).map((e=>{const t=e.name.replace("data-","").toLowerCase(),n=e.value;return`${encodeURIComponent(t)}=${encodeURIComponent(n)}`}));return L(`Badge key query params: ${t}`,"info","at renderBadge in LIRenderAll"),t})(e);g=g.concat(n)}else m+="profile",g.push("maxsize="+encodeURIComponent(t)),g.push("trk="+encodeURIComponent(h)),g.push("vanityname="+encodeURIComponent(r));p&&g.push("fromCreate=true");const f=m+"?"+g.join("&");console.warn("url",f),e.setAttribute("data-uid",`${l}`),w(f)}),[n.size,n.locale,n.type,n.theme,n.vanity,n.version,w,L,h,l]),E=e=>"SCRIPT"===e.tagName;return e.useEffect((()=>{const e=f||Array.from(document.querySelectorAll(m));return()=>{L("Cleaning up","info","at useEffect in LIRenderAll, Expected responses: "+s+", Responses received: "+c+", Badges length: "+e.length),(c>=s&&s>0||c>=e.length)&&(L("Cleaning up","info","Deleting callback in window"),delete window[g],a.forEach((e=>document.body.removeChild(e))))}}),[f,m,s,c,a,L,g]),e.useEffect((()=>{let e=Array.from(document.querySelectorAll(m));if(null===f&&(e=Array.from(document.querySelectorAll(m)),L(`Setting badges to: ${Array.prototype.slice.call(document.querySelectorAll(m))}`,"info","at useEffect in LIRenderAll"),u(e)),null===l&&t(n,n.generateUidWithoutApi).then((e=>{d(e)})),null!==l)for(const t of e){const e=t.getAttribute("data-rendered");e||(L(`"Badge not rendered yet" - badgeid: ${t.id}, "componentDidUpdate", ${o}`,"info",`at second useEffect in LIRenderAll, setting ${g} global as part of linkedin's rendering process to trigger and coupled specific to this current badge, vanity: ${n.vanity||t.getAttribute("data-vanity")}`),t.setAttribute("data-rendered","true"),k(t),r(!0),n.setBadgeDidRender&&n.setBadgeDidRender(!0),L(`Badge rendered: ${t}`,"info",`at useEffect in LIRenderAll, setting ${g} global as part of linkedin's rendering process to trigger and coupled specific to this current badge, vanity: ${n.vanity||t.getAttribute("data-vanity")}`),p(s+1)),L(`Looping through badges, ${o}, "rendered", ${e}, "expectedResponses", ${s}, "responsesReceived", ${c}`,"info","at second useEffect in LIRenderAll")}window[g]=A}),[f,m,o,k,A,s,c,L,p,g,n,l]),e.createElement(e.Fragment,null)};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"})))),i=n=>{const[i,o]=e.useState(null),[r,l]=e.useState(null);e.useEffect((()=>{const{locale:e,size:a,theme:d,type:c,vanity:s,version:p,isCreatePage:m,entity:g}=n,f=n.TRACKING_PARAM||"public-profile-badge";t(n,n.generateUidWithoutApi).then((e=>{null===r&&l(e)}));const u={badgetype:encodeURIComponent(c||"VERTICAL"),badgetheme:encodeURIComponent(d||"light"),locale:e||"en_US",uid:r||"",version:encodeURIComponent(p||"v1")};"v2"===p?(u.badgesize=a||"medium",u.entity=g||"PROFILE"):(u.maxsize=encodeURIComponent(a||"medium"),u.trk=f,u.vanityname=encodeURIComponent(s||"☯liu")),m&&(u.fromCreate="true");const h=new XMLHttpRequest;h.open("POST","https://ziping.liu.academy/api/v2/linkedin/profile/",!0),h.setRequestHeader("Content-Type","application/json"),h.onreadystatechange=function(){if(4===h.readyState&&200===h.status){const e=JSON.parse(h.responseText),t=e.profileHeadline,n=/((\\u[\dA-Fa-f]{4}){2,})/g.exec(t);if(n){const a=n[1],i=JSON.parse(`"${a}"`);e.profileHeadline=t.replace(a,i)}o(e)}},null===i&&null!==r&&(console.info("sending request",JSON.stringify(u)),h.send(JSON.stringify(u)))}),[n.locale,n.size,n.theme,n.type,n.vanity,n.version,n.isCreatePage,n.entity,i,r]);const d=e.useMemo((()=>"medium"===n.size&&"VERTICAL"===n.type?"250":"medium"===n.size&&"HORIZONTAL"===n.type?"280":"large"===n.size&&"VERTICAL"===n.type?"300":"large"===n.size&&"HORIZONTAL"===n.type?"330":"250"),[n.size,n.type]);return e.createElement("div",{id:n.id,style:n.style,className:"profile-badge-reacted"+(n.className?` ${n.className}`:"")},e.createElement("div",{className:`profile-badge profile-badge--width-${d} profile-badge--`+("light"===n.theme?"light":"dark"),lang:n.locale?.replace(/_[A-Za-z]+$/,"")||"en",dir:"ltr"},e.createElement("div",{className:"profile-badge__header profile-badge__header--"+("light"===n.theme?"light":"dark")},e.createElement("span",{className:"sr-only"},"LinkedIn"),e.createElement(a,{theme:n.theme})),e.createElement("div",{className:"profile-badge__content"},i?.profileImageSrc?e.createElement("img",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",title:i?.profileName,alt:i?.profileName,src:i?.profileImageSrc}):e.createElement("figure",{title:i?.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"},i?.profileName&&e.createElement("a",{className:"profile-badge__content-profile-name-link profile-badge__content-profile-name-link--"+("light"===n.theme?"light":"dark"),href:i?.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":""},i?.profileName&&e.createElement(e.Fragment,null,i?.profileName))),e.createElement("h4",{className:"profile-badge__content-profile-headline"},i?.profileHeadline&&e.createElement(e.Fragment,null,i?.profileHeadline)),e.createElement("h4",{className:"profile-badge__content-profile-company-school-info"},i?.profileCompanyOrSchool&&Array.isArray(i?.profileCompanyOrSchool)&&i?.profileCompanyOrSchool.map(((t,a)=>e.createElement(e.Fragment,null,e.createElement("a",{target:"_blank",rel:"noopener noreferrer",key:a,href:t.href,className:"profile-badge__content-profile-company-school-info-link profile-badge__content-profile-company-school-info-link--"+("light"===n.theme?"light":"dark"),"data-tracking-control-name":"public-profile-badge-profile-badge_school-name","data-tracking-will-navigate":"true"},t.text)," ",a!==i?.profileCompanyOrSchool.length-1?" | ":""," "))))),n.children,e.createElement("a",{className:"profile-badge__cta-btn profile-badge__cta-btn--"+("light"===n.theme?"light":"dark"),rel:"noopener noreferrer",href:i?.profileViewLink||`https://www.linkedin.com/in/${encodeURIComponent(n.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"),null===i&&e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:""+(n.vanity?`https://www.linkedin.com/in/${n.vanity}?trk=profile-badge`:"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name")},n.name||"")))};function o(t){const a=t.locale||"en_US",o=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",m=t.useLinkedInApiUrlPure||!1,g=encodeURIComponent(s),f=t.name||"",u=`https://www.linkedin.com/in/${g}?trk=profile-badge`,h=e.useRef(null),[b,y]=e.useState(!1),[C,L]=e.useState(!1);return e.useEffect((()=>{const e=(e,n,a)=>{if(t.debug){const t=(new Date).toLocaleTimeString();console.log(`[${t}] ${n} - ${a}: ${e}`)}};b||(e("checking if div is rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),h.current?(e("div rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),y(!0)):e("div not rendered yet","info","at LinkedInBadge Component"))}),[b,h,t.debug]),e.createElement(e.Fragment,null,!0===t.useLinkedInApiUrlPure?e.createElement(e.Fragment,null,e.createElement("div",{ref:h,className:"badge-base LI-profile-badge"+(t.className?` ${t.className}`:""),style:t.style,"data-locale":a,"data-size":o,"data-theme":r,"data-type":d,"data-vanity":s,"data-version":p,id:t.id},e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:u},f)),h.current&&!1===C&&b&&e.createElement(n,{generateUidWithoutApi:l,useLinkedInApiUrlPure:m,badgeDidRender:C,setBadgeDidRender:L,badges:Array.from(document.getElementsByClassName("badge-base LI-profile-badge")),script_src:t.script_src,debug:t.debug})):e.createElement(i,{locale:a,size:o,style:t.style,entity:c,theme:r,type:d,vanity:s,version:p,className:t.className,id:t.id,debug:t.debug,name:f,isCreatePage:!1},t.children))}export{o as default}; | ||
import e from"react";async function t(e,t=!1){const n=Object.keys(e),a=window.location.hostname,i=window.location.pathname,r=window.location.search;let o=0;for(let t=0;t<n.length;t++){const a=e[n[t]];if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)o=(o<<5)-o+a.charCodeAt(e)}if(a&&"string"==typeof a)for(let e=0;e<a.length;e++)o=(o<<5)-o+a.charCodeAt(e);if(i&&"string"==typeof i)for(let e=0;e<i.length;e++)o=(o<<5)-o+i.charCodeAt(e);if(r&&"string"==typeof r)for(let e=0;e<r.length;e++)o=(o<<5)-o+r.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++)o=(o<<5)-o+e.charCodeAt(t)}return o=(o<<5)-o+Date.now(),o>>>=0,o.toString()}const n=n=>{const[a,i]=e.useState(n.scripts||[]),[r,o]=e.useState(n.badgeDidRender||!1),[l,d]=e.useState(null);let c=n.responsesReceived||0,s=n.expectedResponses||0;const p=e.useCallback((e=>{s=e}),[]),m=n.BADGE_NAMES||".LI-profile-badge, .LI-entity-badge",g=n.CALLBACK_NAME||"LIBadgeCallback",[f,u]=e.useState(n.badges||null),h=n.trackingParam||"trk=profile-badge",b=n.useLinkedInApiUrlPure||!1,C=e.useMemo((()=>n.childScripts||{}),[n.childScripts]),y=e.useCallback(((e,t="false")=>E(e)&&!C[e.src]&&(!("true"===t)||"true"===t&&!e.getAttribute("data-isartdeco"))),[C]),L=e.useCallback(((e,t,a)=>{if(n.debug){const n=(new Date).toLocaleTimeString(),i=`%c${a}`,r=`%c${e}`,o=`%c${t}`;console.log(`[${n}] ${o} - ${i}: ${r}`,"color:skyblue","font-weight: bold","color: green")}}),[n.debug]),A=e.useCallback(((e,t)=>{const n=e=>{const t=document.createElement("script");for(let n=e.attributes.length-1;n>=0;n--)t.setAttribute(e.attributes[n].name,e.attributes[n].value);return t};L(`Response received for badgeUid: ${t}`,"info","at responseHandler in LIRenderAll"),c+=1;for(const a of f||[]){L(`Checking badge with uid: ${a.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll");const i=a.getAttribute("data-iscreate");if(parseInt(a.getAttribute("data-uid")||"0",10)===t){const t=`<body>${e}</body>`,r=document.createElement("iframe");r.onload=function(){const e=r.contentWindow?.document.body;r.setAttribute("height",`${(e?.scrollHeight||300)+5}`),r.setAttribute("width",`${e?.scrollWidth||335}`)};const o=(e,t="false")=>{L(`Replacing script tags for badge with uid: ${e.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll");const a=e.querySelectorAll("script");let i,r,o;for(i=0,r=a.length;i<r;i++)if(o=a[i],y(o,t)){const t=n(o);e.appendChild(t),e.removeChild(o)}};r.setAttribute("frameBorder","0"),r.style.display="block",a.appendChild(r),r.contentWindow&&(L(`Writing badge markup for badge with uid: ${a.getAttribute("data-uid")}`,"info","at responseHandler in LIRenderAll"),r.contentWindow.document.open(),r.contentWindow.document.write(t),r.contentWindow.document.close()),o(a,i||"false")}}((e,t,n,a,i,r)=>{if(e>=t&&t>0||e>=(n?.length||0)){delete window[i];a.map((function(e){document.body.removeChild(e)})),r([])}})(c,s,f,a,g,i)}),[f,c,g,a,s,L,y]),w=e.useCallback((e=>{const t=document.createElement("script");t.src=e;const n=a;n.push(t),t.id=`${g}-${n.length+1}`,L(`Adding script tag with id: ${t.id}`,"info","at jsonp in LIRenderAll"),i(n),document.body.appendChild(t)}),[a,g,L]),k=e.useCallback((e=>{const t=n.size||e.getAttribute("data-size")||"medium",a=n.locale||e.getAttribute("data-locale")||"en_US",i=n.type||e.getAttribute("data-type")||"VERTICAL",r=n.theme||e.getAttribute("data-theme")||"dark",o=n.vanity||e.getAttribute("data-vanity")||"☯liu",d=n.version||e.getAttribute("data-version")||"v1",c=e.hasAttribute("data-ei")||!1,s=e.getAttribute("data-entity")||"PROFILE",p=e.hasAttribute("data-iscreate")||!1;let m=function(e=!1,t){if(e){const e=t?"https://badges.linkedin-ei":"https://badges.linkedin";return function(){if("undefined"!=typeof window){const e=window.location&&window.location.hostname||"";return/linkedin(-ei)?.cn$/.test(e)}return!1}()?e+".cn/":e+".com/"}return"https://ziping.liu.academy/api/v1/linkedin/"}(b,c);console.warn("baseUrl",m);let g=["locale="+encodeURIComponent(a),"badgetype="+encodeURIComponent(i),"badgetheme="+encodeURIComponent(r),"uid="+encodeURIComponent(l),"version="+encodeURIComponent(d)];if("v2"===d){m+="view",g.push("badgesize="+encodeURIComponent(t||"medium")),g.push("entity="+encodeURIComponent(s||"PROFILE"));const n=(e=>{const t=Array.from(e.attributes).filter((e=>e.name.startsWith("data-key-"))).map((e=>{const t=e.name.replace("data-","").toLowerCase(),n=e.value;return`${encodeURIComponent(t)}=${encodeURIComponent(n)}`}));return L(`Badge key query params: ${t}`,"info","at renderBadge in LIRenderAll"),t})(e);g=g.concat(n)}else m+="profile",g.push("maxsize="+encodeURIComponent(t)),g.push("trk="+encodeURIComponent(h)),g.push("vanityname="+encodeURIComponent(o));p&&g.push("fromCreate=true");const f=m+"?"+g.join("&");console.warn("url",f),e.setAttribute("data-uid",`${l}`),w(f)}),[n.size,n.locale,n.type,n.theme,n.vanity,n.version,w,L,h,l]),E=e=>"SCRIPT"===e.tagName;return e.useEffect((()=>{const e=f||Array.from(document.querySelectorAll(m));return()=>{L("Cleaning up","info","at useEffect in LIRenderAll, Expected responses: "+s+", Responses received: "+c+", Badges length: "+e.length),(c>=s&&s>0||c>=e.length)&&(L("Cleaning up","info","Deleting callback in window"),delete window[g],a.forEach((e=>document.body.removeChild(e))))}}),[f,m,s,c,a,L,g]),e.useEffect((()=>{let e=Array.from(document.querySelectorAll(m));if(null===f&&(e=Array.from(document.querySelectorAll(m)),L(`Setting badges to: ${Array.prototype.slice.call(document.querySelectorAll(m))}`,"info","at useEffect in LIRenderAll"),u(e)),null===l&&t(n,n.generateUidWithoutApi).then((e=>{d(e)})),null!==l)for(const t of e){const e=t.getAttribute("data-rendered");e||(L(`"Badge not rendered yet" - badgeid: ${t.id}, "componentDidUpdate", ${r}`,"info",`at second useEffect in LIRenderAll, setting ${g} global as part of linkedin's rendering process to trigger and coupled specific to this current badge, vanity: ${n.vanity||t.getAttribute("data-vanity")}`),t.setAttribute("data-rendered","true"),k(t),o(!0),n.setBadgeDidRender&&n.setBadgeDidRender(!0),L(`Badge rendered: ${t}`,"info",`at useEffect in LIRenderAll, setting ${g} global as part of linkedin's rendering process to trigger and coupled specific to this current badge, vanity: ${n.vanity||t.getAttribute("data-vanity")}`),p(s+1)),L(`Looping through badges, ${r}, "rendered", ${e}, "expectedResponses", ${s}, "responsesReceived", ${c}`,"info","at second useEffect in LIRenderAll")}window[g]=A}),[f,m,r,k,A,s,c,L,p,g,n,l]),e.createElement(e.Fragment,null)};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"})))),i=n=>{const[i,r]=e.useState(null),[o,l]=e.useState(null);e.useEffect((()=>{const{locale:e,size:a,theme:d,type:c,vanity:s,version:p,isCreatePage:m,entity:g}=n,f=n.TRACKING_PARAM||"public-profile-badge";t(n,n.generateUidWithoutApi).then((e=>{null===o&&l(e)}));const u={badgetype:encodeURIComponent(c||"VERTICAL"),badgetheme:encodeURIComponent(d||"light"),locale:e||"en_US",uid:o||"",version:encodeURIComponent(p||"v1")};"v2"===p?(u.badgesize=a||"medium",u.entity=g||"PROFILE"):(u.maxsize=encodeURIComponent(a||"medium"),u.trk=f,u.vanityname=encodeURIComponent(s||"☯liu")),m&&(u.fromCreate="true");const h=new XMLHttpRequest;h.open("POST","https://ziping.liu.academy/api/v2/linkedin/profile/",!0),h.setRequestHeader("Content-Type","application/json"),h.onreadystatechange=function(){if(4===h.readyState&&200===h.status){const e=JSON.parse(h.responseText),t=e.profileHeadline,n=/((\\u[\dA-Fa-f]{4}){2,})/g.exec(t);if(n){const a=n[1],i=JSON.parse(`"${a}"`);e.profileHeadline=t.replace(a,i)}r(e)}},null===i&&null!==o&&h.send(JSON.stringify(u))}),[n.locale,n.size,n.theme,n.type,n.vanity,n.version,n.isCreatePage,n.entity,i,o]);const d=e.useMemo((()=>"medium"===n.size&&"VERTICAL"===n.type?"250":"medium"===n.size&&"HORIZONTAL"===n.type?"280":"large"===n.size&&"VERTICAL"===n.type?"300":"large"===n.size&&"HORIZONTAL"===n.type?"330":"250"),[n.size,n.type]);return e.createElement("div",{id:n.id,style:n.style,className:"profile-badge-reacted"+(n.className?` ${n.className}`:"")},e.createElement("div",{className:`profile-badge profile-badge--width-${d} profile-badge--`+("light"===n.theme?"light":"dark"),lang:n.locale?.replace(/_[A-Za-z]+$/,"")||"en",dir:"ltr"},e.createElement("div",{className:"profile-badge__header profile-badge__header--"+("light"===n.theme?"light":"dark")},e.createElement("span",{className:"sr-only"},"LinkedIn"),e.createElement(a,{theme:n.theme})),e.createElement("div",{className:"profile-badge__content"},i?.profileImageSrc?e.createElement("img",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",title:i?.profileName,alt:i?.profileName,src:i?.profileImageSrc}):e.createElement("figure",{title:i?.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"},i?.profileName&&e.createElement("a",{className:"profile-badge__content-profile-name-link profile-badge__content-profile-name-link--"+("light"===n.theme?"light":"dark"),href:i?.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":""},i?.profileName&&e.createElement(e.Fragment,null,i?.profileName))),e.createElement("h4",{className:"profile-badge__content-profile-headline"},i?.profileHeadline&&e.createElement(e.Fragment,null,i?.profileHeadline)),e.createElement("h4",{className:"profile-badge__content-profile-company-school-info"},i?.profileCompanyOrSchool&&Array.isArray(i?.profileCompanyOrSchool)&&i?.profileCompanyOrSchool.map(((t,a)=>e.createElement(e.Fragment,null,e.createElement("a",{target:"_blank",rel:"noopener noreferrer",key:a,href:t.href,className:"profile-badge__content-profile-company-school-info-link profile-badge__content-profile-company-school-info-link--"+("light"===n.theme?"light":"dark"),"data-tracking-control-name":"public-profile-badge-profile-badge_school-name","data-tracking-will-navigate":"true"},t.text)," ",a!==i?.profileCompanyOrSchool.length-1?" | ":""," "))))),n.children,e.createElement("a",{className:"profile-badge__cta-btn profile-badge__cta-btn--"+("light"===n.theme?"light":"dark"),rel:"noopener noreferrer",href:i?.profileViewLink||`https://www.linkedin.com/in/${encodeURIComponent(n.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"),null===i&&e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:""+(n.vanity?`https://www.linkedin.com/in/${n.vanity}?trk=profile-badge`:"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name")},n.name||"")))};function r(t){const a=t.locale||"en_US",r=t.size||"medium",o=t.theme||"light",l=t.generateUidWithoutApi||!1,d=t.type||"VERTICAL",c=t.entity||"PROFILE",s=t.vanity||"☯liu",p=t.version||"v1",m=t.useLinkedInApiUrlPure||!1,g=encodeURIComponent(s),f=t.name||"",u=`https://www.linkedin.com/in/${g}?trk=profile-badge`,h=e.useRef(null),[b,C]=e.useState(!1),[y,L]=e.useState(!1);return e.useEffect((()=>{const e=(e,n,a)=>{if(t.debug){const t=(new Date).toLocaleTimeString();console.log(`[${t}] ${n} - ${a}: ${e}`)}};b||(e("checking if div is rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),h.current?(e("div rendered","info","at LinkedInBadge Component React.useEffect with componentDidMount: false"),C(!0)):e("div not rendered yet","info","at LinkedInBadge Component"))}),[b,h,t.debug]),e.createElement(e.Fragment,null,!0===t.useLinkedInApiUrlPure?e.createElement(e.Fragment,null,e.createElement("div",{ref:h,className:"badge-base LI-profile-badge"+(t.className?` ${t.className}`:""),style:t.style,"data-locale":a,"data-size":r,"data-theme":o,"data-type":d,"data-vanity":s,"data-version":p,id:t.id},e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:u},f)),h.current&&!1===y&&b&&e.createElement(n,{generateUidWithoutApi:l,useLinkedInApiUrlPure:m,badgeDidRender:y,setBadgeDidRender:L,badges:Array.from(document.getElementsByClassName("badge-base LI-profile-badge")),script_src:t.script_src,debug:t.debug})):e.createElement(i,{locale:a,size:r,style:t.style,entity:c,theme:o,type:d,vanity:s,version:p,className:t.className,id:t.id,debug:t.debug,name:f,isCreatePage:!1},t.children))}export{r as default}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlua2VkaW5iYWRnZS5lc20uanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOyJ9 |
@@ -65,3 +65,3 @@ /* LinkedInBadge */ | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
window[f]=w}),[g,m,o,k,w,s,c,L,p,f,n,l]),e.createElement(e.Fragment,null)};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"})))),i=n=>{const[i,o]=e.useState(null),[r,l]=e.useState(null);e.useEffect((()=>{const{locale:e,size:a,theme:d,type:c,vanity:s,version:p,isCreatePage:m,entity:f}=n,g=n.TRACKING_PARAM||"public-profile-badge";t(n,n.generateUidWithoutApi).then((e=>{null===r&&l(e)}));const u={badgetype:encodeURIComponent(c||"VERTICAL"),badgetheme:encodeURIComponent(d||"light"),locale:e||"en_US",uid:r||"",version:encodeURIComponent(p||"v1")};"v2"===p?(u.badgesize=a||"medium",u.entity=f||"PROFILE"):(u.maxsize=encodeURIComponent(a||"medium"),u.trk=g,u.vanityname=encodeURIComponent(s||"☯liu")),m&&(u.fromCreate="true");const h=new XMLHttpRequest;h.open("POST","https://ziping.liu.academy/api/v2/linkedin/profile/",!0),h.setRequestHeader("Content-Type","application/json"),h.onreadystatechange=function(){if(4===h.readyState&&200===h.status){const e=JSON.parse(h.responseText),t=e.profileHeadline,n=/((\\u[\dA-Fa-f]{4}){2,})/g.exec(t);if(n){const a=n[1],i=JSON.parse(`"${a}"`);e.profileHeadline=t.replace(a,i)}o(e)}},null===i&&null!==r&&(console.info("sending request",JSON.stringify(u)),h.send(JSON.stringify(u)))}),[n.locale,n.size,n.theme,n.type,n.vanity,n.version,n.isCreatePage,n.entity,i,r]);const d=e.useMemo((()=>"medium"===n.size&&"VERTICAL"===n.type?"250":"medium"===n.size&&"HORIZONTAL"===n.type?"280":"large"===n.size&&"VERTICAL"===n.type?"300":"large"===n.size&&"HORIZONTAL"===n.type?"330":"250"),[n.size,n.type]);return e.createElement("div",{id:n.id,style:n.style,className:"profile-badge-reacted"+(n.className?` ${n.className}`:"")},e.createElement("div",{className:`profile-badge profile-badge--width-${d} profile-badge--`+("light"===n.theme?"light":"dark"),lang:n.locale?.replace(/_[A-Za-z]+$/,"")||"en",dir:"ltr"},e.createElement("div",{className:"profile-badge__header profile-badge__header--"+("light"===n.theme?"light":"dark")},e.createElement("span",{className:"sr-only"},"LinkedIn"),e.createElement(a,{theme:n.theme})),e.createElement("div",{className:"profile-badge__content"},i?.profileImageSrc?e.createElement("img",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",title:i?.profileName,alt:i?.profileName,src:i?.profileImageSrc}):e.createElement("figure",{title:i?.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"},i?.profileName&&e.createElement("a",{className:"profile-badge__content-profile-name-link profile-badge__content-profile-name-link--"+("light"===n.theme?"light":"dark"),href:i?.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":""},i?.profileName&&e.createElement(e.Fragment,null,i?.profileName))),e.createElement("h4",{className:"profile-badge__content-profile-headline"},i?.profileHeadline&&e.createElement(e.Fragment,null,i?.profileHeadline)),e.createElement("h4",{className:"profile-badge__content-profile-company-school-info"},i?.profileCompanyOrSchool&&Array.isArray(i?.profileCompanyOrSchool)&&i?.profileCompanyOrSchool.map(((t,a)=>e.createElement(e.Fragment,null,e.createElement("a",{target:"_blank",rel:"noopener noreferrer",key:a,href:t.href,className:"profile-badge__content-profile-company-school-info-link profile-badge__content-profile-company-school-info-link--"+("light"===n.theme?"light":"dark"),"data-tracking-control-name":"public-profile-badge-profile-badge_school-name","data-tracking-will-navigate":"true"},t.text)," ",a!==i?.profileCompanyOrSchool.length-1?" | ":""," "))))),n.children,e.createElement("a",{className:"profile-badge__cta-btn profile-badge__cta-btn--"+("light"===n.theme?"light":"dark"),rel:"noopener noreferrer",href:i?.profileViewLink||`https://www.linkedin.com/in/${encodeURIComponent(n.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"),null===i&&e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:""+(n.vanity?`https://www.linkedin.com/in/${n.vanity}?trk=profile-badge`:"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name")},n.name||"")))}; | ||
window[f]=w}),[g,m,o,k,w,s,c,L,p,f,n,l]),e.createElement(e.Fragment,null)};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"})))),i=n=>{const[i,o]=e.useState(null),[r,l]=e.useState(null);e.useEffect((()=>{const{locale:e,size:a,theme:d,type:c,vanity:s,version:p,isCreatePage:m,entity:f}=n,g=n.TRACKING_PARAM||"public-profile-badge";t(n,n.generateUidWithoutApi).then((e=>{null===r&&l(e)}));const u={badgetype:encodeURIComponent(c||"VERTICAL"),badgetheme:encodeURIComponent(d||"light"),locale:e||"en_US",uid:r||"",version:encodeURIComponent(p||"v1")};"v2"===p?(u.badgesize=a||"medium",u.entity=f||"PROFILE"):(u.maxsize=encodeURIComponent(a||"medium"),u.trk=g,u.vanityname=encodeURIComponent(s||"☯liu")),m&&(u.fromCreate="true");const h=new XMLHttpRequest;h.open("POST","https://ziping.liu.academy/api/v2/linkedin/profile/",!0),h.setRequestHeader("Content-Type","application/json"),h.onreadystatechange=function(){if(4===h.readyState&&200===h.status){const e=JSON.parse(h.responseText),t=e.profileHeadline,n=/((\\u[\dA-Fa-f]{4}){2,})/g.exec(t);if(n){const a=n[1],i=JSON.parse(`"${a}"`);e.profileHeadline=t.replace(a,i)}o(e)}},null===i&&null!==r&&h.send(JSON.stringify(u))}),[n.locale,n.size,n.theme,n.type,n.vanity,n.version,n.isCreatePage,n.entity,i,r]);const d=e.useMemo((()=>"medium"===n.size&&"VERTICAL"===n.type?"250":"medium"===n.size&&"HORIZONTAL"===n.type?"280":"large"===n.size&&"VERTICAL"===n.type?"300":"large"===n.size&&"HORIZONTAL"===n.type?"330":"250"),[n.size,n.type]);return e.createElement("div",{id:n.id,style:n.style,className:"profile-badge-reacted"+(n.className?` ${n.className}`:"")},e.createElement("div",{className:`profile-badge profile-badge--width-${d} profile-badge--`+("light"===n.theme?"light":"dark"),lang:n.locale?.replace(/_[A-Za-z]+$/,"")||"en",dir:"ltr"},e.createElement("div",{className:"profile-badge__header profile-badge__header--"+("light"===n.theme?"light":"dark")},e.createElement("span",{className:"sr-only"},"LinkedIn"),e.createElement(a,{theme:n.theme})),e.createElement("div",{className:"profile-badge__content"},i?.profileImageSrc?e.createElement("img",{className:"artdeco-entity-image artdeco-entity-image--circle-4 profile-badge__content-profile-image",title:i?.profileName,alt:i?.profileName,src:i?.profileImageSrc}):e.createElement("figure",{title:i?.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"},i?.profileName&&e.createElement("a",{className:"profile-badge__content-profile-name-link profile-badge__content-profile-name-link--"+("light"===n.theme?"light":"dark"),href:i?.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":""},i?.profileName&&e.createElement(e.Fragment,null,i?.profileName))),e.createElement("h4",{className:"profile-badge__content-profile-headline"},i?.profileHeadline&&e.createElement(e.Fragment,null,i?.profileHeadline)),e.createElement("h4",{className:"profile-badge__content-profile-company-school-info"},i?.profileCompanyOrSchool&&Array.isArray(i?.profileCompanyOrSchool)&&i?.profileCompanyOrSchool.map(((t,a)=>e.createElement(e.Fragment,null,e.createElement("a",{target:"_blank",rel:"noopener noreferrer",key:a,href:t.href,className:"profile-badge__content-profile-company-school-info-link profile-badge__content-profile-company-school-info-link--"+("light"===n.theme?"light":"dark"),"data-tracking-control-name":"public-profile-badge-profile-badge_school-name","data-tracking-will-navigate":"true"},t.text)," ",a!==i?.profileCompanyOrSchool.length-1?" | ":""," "))))),n.children,e.createElement("a",{className:"profile-badge__cta-btn profile-badge__cta-btn--"+("light"===n.theme?"light":"dark"),rel:"noopener noreferrer",href:i?.profileViewLink||`https://www.linkedin.com/in/${encodeURIComponent(n.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"),null===i&&e.createElement("a",{className:"badge-base__link LI-simple-link",target:"_blank",rel:"noopener noreferrer",href:""+(n.vanity?`https://www.linkedin.com/in/${n.vanity}?trk=profile-badge`:"https://www.linkedin.com/in/%E2%98%AFliu?trk=public-profile-badge-profile-badge-profile-name")},n.name||"")))}; | ||
/** | ||
@@ -68,0 +68,0 @@ * React component that renders a LinkedIn badge on a website. |
@@ -77,3 +77,2 @@ import React from "react"; | ||
if (profileData === null && uid !== null) { | ||
console.info("sending request", JSON.stringify(payloadBodyParams)); | ||
xmlnew.send(JSON.stringify(payloadBodyParams)); | ||
@@ -91,3 +90,3 @@ } | ||
profileData, | ||
uid, | ||
uid | ||
]); | ||
@@ -94,0 +93,0 @@ const widthSet = React.useMemo(() => { |
{ | ||
"name": "react-linkedinbadge", | ||
"version": "5.12.2034", | ||
"version": "5.12.2035", | ||
"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.", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
710485
12604