@yoast/ai-insights-client 1.4.43 → 1.4.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -24,7 +24,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24
24
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function x6(e,t){if(e){if(typeof e=="string")return T0(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?T0(e,t):void 0}}function T0(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function w6(e,t){var n=e==null?null:typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}function S6(e){if(Array.isArray(e))return e}var C6=function(t){var n,r,i=t.className,s=Gt(),o=dn(),a=z.useState(!1),l=v6(a,2),u=l[0],c=l[1],d=Vi({query:{select:function(O){var x=O.data;return x==null?void 0:x.brands}}}),f=d.data,h=r2({mutation:{onSettled:function(){s.invalidateQueries({queryKey:[Yn()]})}}}),g=h.mutateAsync,m=h.isPending,p=(n=f==null?void 0:f.filter(function(w){var O;return((O=w.settings)===null||O===void 0?void 0:O.showAutomaticAnalysisDisabledNotification)===!0}))!==null&&n!==void 0?n:[],v=function(){c(!1)},b=function(){var w=p6(jd().m(function O(){var x;return jd().w(function(_){for(;;)switch(_.n){case 0:if(p.length!==0){_.n=1;break}return _.a(2);case 1:return x=p.map(function(k){return g({brandId:String(k.id),data:{showAutomaticAnalysisDisabledNotification:!1}})}),_.n=2,Promise.all(x);case 2:o("/settings"),v();case 3:return _.a(2)}},O)}));return function(){return w.apply(this,arguments)}}();z.useEffect(function(){f&&f.some(function(w){var O;return((O=w.settings)===null||O===void 0?void 0:O.showAutomaticAnalysisDisabledNotification)===!0})&&c(!0)},[f]);var S=p.length===1?"One brand has been deactivated":"Multiple brands have been deactivated",C=p.length===1?y.jsxs(y.Fragment,{children:[y.jsx("p",{children:"You recently lost a subscription. Because of this, we could not analyze all your active brands."}),y.jsxs("p",{children:["The brand ",y.jsx("b",{children:p==null||(r=p[0])===null||r===void 0?void 0:r.name})," was deactivated, since it was the most recently analyzed."]}),y.jsxs("p",{children:["If you prefer, you can go to ",y.jsx("b",{children:"Settings"})," and deactivate a different brand instead."]})]}):y.jsxs(y.Fragment,{children:[y.jsx("p",{children:"You recently lost a subscription. Because of this, we could not analyze all your active brands."}),y.jsx("p",{children:"The following brands were deactivated, since they were the most recently analyzed:"}),y.jsx("ul",{children:p.map(function(w){return y.jsx("li",{children:y.jsx("b",{children:w.name})},w.id)})}),y.jsxs("p",{children:["If you prefer, you can go to ",y.jsx("b",{children:"Settings"})," and deactivate different brand(s) instead."]})]});return u?y.jsx(T.Modal,{isOpen:u,onClose:b,position:"center",as:"div",className:i,children:y.jsxs(T.Modal.Panel,{children:[y.jsx("div",{className:"yst-flex yst-items-start yst-justify-stretch yst-gap-4",children:y.jsxs("div",{className:"yst-flex-1",children:[y.jsx(T.Modal.Container.Header,{className:"yst-mb-3 yst-w-full",children:y.jsx(T.Modal.Title,{as:"h3",className:"yst-text-lg yst-font-medium",children:S})}),y.jsx(T.Modal.Container.Content,{className:"yst-mb-4 yst-space-y-3",children:C})]})}),y.jsxs(T.Modal.Container.Footer,{className:"yst-mt-3 yst-flex yst-justify-end yst-gap-2",children:[y.jsx(T.Button,{variant:"secondary",onClick:b,children:"Close"}),y.jsx(T.Button,{variant:"primary",onClick:b,isLoading:m,disabled:p.length===0,children:"Go to settings"})]})]})}):null},Ru=function(){return y.jsx("div",{className:"yst-flex yst-min-h-screen yst-items-center yst-justify-center",children:y.jsxs("div",{className:"yst-flex yst-items-center yst-gap-3 yst-text-center",children:[y.jsx(T.Spinner,{variant:"primary"}),y.jsx("span",{className:"yst-italic",children:"Just a moment while we get things ready for you..."})]})})},_6={HOME:"/"},k6=function(t){var n=t.hideNav,r=n===void 0?!1:n,i=t.disableLayout,s=i===void 0?!1:i,o=t.DebugInfo,a=Ut(),l=dn(),u={disable:s,hideNav:r},c=Rn(),d=c.brandId,f=Fa(),h=f.setBrandId,g=Vi({query:{refetchOnReconnect:!1,refetchOnWindowFocus:!1,select:function(x){var _;return x==null||(_=x.data)===null||_===void 0?void 0:_.brands}}}),m=g.data,p=g.isLoading,v=g.error,b=g.refetch,S=z.useRef(!1),C=z.useMemo(function(){return m==null?void 0:m.find(function(O){return O.id===d})},[m,d]);z.useEffect(function(){var O;if(!(m===void 0||d)){var x=(O=m[0])===null||O===void 0?void 0:O.id;x&&h(x)}},[m,d,h,l,a.pathname]),z.useEffect(function(){!d||S.current||(S.current=!0)},[C,d,l,a.pathname,m]);var w=z.useCallback(function(){b()},[b]);return a.pathname!==_6.HOME&&p?y.jsx(vc,{...u,children:y.jsx(Ru,{})}):v?y.jsx(vc,{...u,children:y.jsx("div",{className:"yst-flex yst-min-h-screen yst-items-center yst-justify-center",children:y.jsxs("div",{className:"yst-space-y-4 yst-text-center",children:[y.jsx("div",{className:"yst-mb-4 yst-text-6xl yst-text-red-600",children:"⚠️"}),y.jsx("h2",{className:"yst-text-xl yst-font-semibold yst-text-slate-900",children:"Something went wrong"}),y.jsx("p",{className:"yst-text-slate-600",children:"We couldn't load your Brand Analysis. Please try again shortly."}),y.jsx(T.Button,{variant:"primary",onClick:w,children:"Retry"})]})})}):y.jsxs(vc,{DebugInfo:o,...u,children:[y.jsx(Bs,{}),y.jsx(C6,{})]})},O6=function(){var t=xu(),n=t.brandId,r=t.analysisId,i=t2(n,{query:{enabled:!!n,select:function(d){var f=d.data;return(f==null?void 0:f.analyses)||[]}}}),s=i.data,o=i.isLoading,a=i.error;if(o)return y.jsx(Ru,{});if(a)return console.error("Error fetching analyses for validation:",a),y.jsx(mi,{to:"/brands/".concat(n),replace:!0});if(!r||r.trim()==="")return y.jsx(mi,{to:"/brands/".concat(n),replace:!0});if(r==="latest")return y.jsx(Bs,{});var l=parseInt(r,10);if(isNaN(l))return y.jsx(mi,{to:"/brands/".concat(n),replace:!0});var u=s==null?void 0:s.some(function(c){return c.id===l});return u?y.jsx(Bs,{}):y.jsx(mi,{to:"/brands/".concat(n),replace:!0})},P0=function(){var t=xu(),n=t.brandId,r=Vi({query:{select:function(f){var h=f.data;return h}}}),i=r.data,s=r.isLoading,o=r.error,a=r.isFetched,l=(i==null?void 0:i.brands)||[];if(s||!a)return y.jsx(Ru,{});if(o)return y.jsx(mi,{to:"/",replace:!0});if(!n||n.trim()==="")return y.jsx(mi,{to:"/",replace:!0});var u=parseInt(n,10),c=l.length>0&&l.some(function(d){var f=String(d.id),h=typeof d.id=="number"?d.id:parseInt(String(d.id),10);return f===n||h===u||d.id===n});return a&&!c?y.jsx(mi,{to:"/",replace:!0}):y.jsx(Bs,{})},E6={openai:"openai",perplexity:"perplexity",anthropic:"anthropic"},A6={updating:"updating"},di={pending:"pending",processing:"processing",completed:"completed",failed:"failed",cancelled:"cancelled"},T6=function(t){return typeof t=="string"&&t!=="latest"&&t.trim().length>0};function P6(e,t){return I.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),I.createElement("path",{fillRule:"evenodd",d:"M14.707 12.293a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 111.414-1.414L9 14.586V3a1 1 0 012 0v11.586l2.293-2.293a1 1 0 011.414 0z",clipRule:"evenodd"}))}const c2=I.forwardRef(P6);function j6(e,t){return I.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),I.createElement("path",{fillRule:"evenodd",d:"M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z",clipRule:"evenodd"}))}const M6=I.forwardRef(j6);function $6(e,t){return I.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),I.createElement("path",{fillRule:"evenodd",d:"M5.293 7.707a1 1 0 010-1.414l4-4a1 1 0 011.414 0l4 4a1 1 0 01-1.414 1.414L11 5.414V17a1 1 0 11-2 0V5.414L6.707 7.707a1 1 0 01-1.414 0z",clipRule:"evenodd"}))}const d2=I.forwardRef($6);function L6(e,t){return I.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),I.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"}))}const f2=I.forwardRef(L6);function D6(e,t){return I.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),I.createElement("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"}))}const I6=I.forwardRef(D6);function R6(e,t){return I.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),I.createElement("path",{fillRule:"evenodd",d:"M14.707 12.707a1 1 0 01-1.414 0L10 9.414l-3.293 3.293a1 1 0 01-1.414-1.414l4-4a1 1 0 011.414 0l4 4a1 1 0 010 1.414z",clipRule:"evenodd"}))}const N6=I.forwardRef(R6);function F6(e,t){return I.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),I.createElement("path",{d:"M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z"}))}const j0=I.forwardRef(F6);function B6(e,t){return I.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),I.createElement("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),I.createElement("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"}))}const h2=I.forwardRef(B6);function q6(e,t){return I.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),I.createElement("path",{fillRule:"evenodd",d:"M2 5a2 2 0 012-2h12a2 2 0 012 2v2a2 2 0 01-2 2H4a2 2 0 01-2-2V5zm14 1a1 1 0 11-2 0 1 1 0 012 0zM2 13a2 2 0 012-2h12a2 2 0 012 2v2a2 2 0 01-2 2H4a2 2 0 01-2-2v-2zm14 1a1 1 0 11-2 0 1 1 0 012 0z",clipRule:"evenodd"}))}const z6=I.forwardRef(q6);function H6(e,t){return I.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),I.createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))}const g2=I.forwardRef(H6);function na(e){"@babel/helpers - typeof";return na=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},na(e)}var U6=["children","as","startColor","endColor","angle","disabled","style","className"];function M0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function $0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?M0(Object(n),!0).forEach(function(r){G6(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M0(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function G6(e,t,n){return(t=V6(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function V6(e){var t=K6(e,"string");return na(t)=="symbol"?t:t+""}function K6(e,t){if(na(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(na(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function W6(e,t){if(e==null)return{};var n,r,i=Q6(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Q6(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Nu=function(t){var n=t.children,r=t.as,i=r===void 0?"span":r,s=t.startColor,o=s===void 0?"#A61E69":s,a=t.endColor,l=a===void 0?"#6366F1":a,u=t.angle,c=u===void 0?102:u,d=t.disabled,f=d===void 0?!1:d,h=t.style,g=h===void 0?{}:h,m=t.className,p=m===void 0?"":m,v=W6(t,U6),b=$0(f?{display:"inline-block"}:{background:"linear-gradient(".concat(c,"deg, ").concat(o,", ").concat(l,")"),WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text",display:"inline-block"},g);return y.jsx(i,{className:p,style:b,...v,children:n})};function Mf(e){var t=e.children,n=e.nestedInPaperContent,r=n===void 0?!1:n,i=e.className;return y.jsx("div",{className:Oe("yst-mt-8 yst-flex yst-items-center yst-justify-end yst-gap-6 yst-rounded-bl-lg yst-rounded-br-lg yst-border-t yst-border-slate-200 yst-bg-slate-50 yst-px-8 yst-py-6",{"yst-mb-[-2rem] yst-ml-[-2rem] yst-mr-[-2rem]":r},i),children:t})}var Y6=function(){var t=dn();return y.jsx("form",{onSubmit:function(){return t("/setup")},children:y.jsxs(T.Paper,{className:"yst-mx-auto yst-flex yst-max-w-2xl",children:[y.jsx(T.Paper.Header,{children:y.jsxs(T.Title,{size:"1",children:["Welcome to ",y.jsx(Nu,{children:"Yoast AI Brand Insights"}),"!"]})}),y.jsxs(T.Paper.Content,{className:"yst-space-y-8",children:[y.jsxs("div",{className:"yst-space-y-4 *:yst-text-tiny",children:[y.jsx("p",{children:"See how your brand is represented in AI answers."}),y.jsxs("p",{children:[y.jsx("b",{className:"yst-font-medium yst-text-slate-800",children:"Yoast AI Brand Insights"})," ","shows how often your brand appears, how it's described, and how it compares to competitors in tools like ChatGPT."]}),y.jsx("p",{children:"It only takes three simple steps to get your brand insights:"})]}),y.jsx("div",{className:"yst-flex yst-flex-col yst-items-stretch yst-justify-stretch yst-gap-4 yst-pb-8",children:[{title:"1. ADD BRAND INFO",description:"Tell us about your brand and where it's active so we can customize your analysis."},{title:"2. REVIEW QUERIES",description:"Edit or approve the queries generated from your input."},{title:"3. RUN ANALYSIS",description:"Run your queries through relevant AI models to see how your brand shows up."}].map(function(n,r,i){return y.jsxs("div",{className:"yst-relative yst-flex yst-flex-col yst-items-stretch",children:[y.jsxs("div",{className:"yst-flex yst-flex-row yst-items-center yst-justify-stretch yst-gap-6",children:[y.jsx(T.Stepper.Step,{isActive:!0,isComplete:!1,children:y.jsx("span",{className:"yst-hidden",children:r+1})}),y.jsxs("div",{className:"yst-flex yst-flex-1 yst-flex-col yst-gap-2 yst-rounded yst-border yst-border-slate-200 yst-p-6",children:[y.jsx(T.Title,{size:"3",className:"yst-font-semibold yst-uppercase",children:n.title}),y.jsx("p",{className:"yst-my-0 yst-py-0",children:n.description})]})]}),r<i.length-1&&y.jsx("div",{className:"yst-absolute yst-left-[-2px] yst-top-1/2 yst-my-0 yst-ml-[13px] yst-h-full yst-border-l-2 yst-border-l-primary-600"})]},n.title)})})]}),y.jsx(Mf,{className:"yst-justify-end",children:y.jsxs(T.Button,{variant:"primary",onClick:function(){return t("/setup")},className:"yst-gap-1.5",children:["Start your first analysis ",y.jsx(M6,{})]})})]})})};function ra(e){return typeof e!="number"?{}:{"yst-text-green-600":e>0,"yst-text-red-600":e<0,"yst-text-gray-400":e===0}}function Ba(e){var t=e.score,n=e.total,r=e.suffix,i=e.isLoading,s=i===void 0?!1:i,o=e.className,a=e.hideTotal,l=a===void 0?!1:a,u=e.delta,c=e.deltaFormat,d=c===void 0?"absolute":c,f=e.deltaSuffix,h=e.scoreFormat,g=h===void 0?"absolute":h;return y.jsxs("div",{className:Oe(o,"yst-font-medium"),children:[y.jsxs("span",{className:"yst-mr-1 yst-text-xl yst-font-bold yst-text-slate-900",children:[s||t===void 0||t===null?"—":t,!s&&t!==void 0&&t!==null&&g==="percentage"?"%":""]}),!l&&n&&n!==0&&n!=="0"&&y.jsxs("span",{className:"yst-text-slate-500",children:["/ ",s?"—":n]}),r&&y.jsxs("span",{className:"yst-text-slate-500",children:[" ",r]}),typeof u=="number"&&!isNaN(u)&&y.jsxs("span",{className:Oe("yst-ml-2",ra(u)),children:[u>-1&&"+",u,d==="percentage"&&"%"," ",f]})]})}var X6=["Icon","className","children","position","id"];function Z6(e,t){return n_(e)||t_(e,t)||e_(e,t)||J6()}function J6(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
25
25
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e_(e,t){if(e){if(typeof e=="string")return L0(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?L0(e,t):void 0}}function L0(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t_(e,t){var n=e==null?null:typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}function n_(e){if(Array.isArray(e))return e}function r_(e,t){if(e==null)return{};var n,r,i=i_(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function i_(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function $f(e){var t=e.Icon,n=t===void 0?Y4:t,r=e.className,i=r===void 0?"":r,s=e.children,o=e.position,a=o===void 0?"left":o,l=e.id,u=l===void 0?"":l,c=r_(e,X6),d=z.useState(!1),f=Z6(d,2),h=f[0],g=f[1];return s?y.jsxs("div",{className:i||"yst-relative",onMouseEnter:function(){return g(!0)},onMouseLeave:function(){return g(!1)},"aria-describedby":u?"tooltip-button-id":"tooltip-button",...c,children:[y.jsx(n,{className:"yst-relative yst-h-6 yst-w-6 yst-text-slate-400"}),h&&y.jsx(T.Tooltip,{position:a,id:u||"tooltip-button",children:s})]}):null}var qa=function(t){var n=t.title,r=t.tooltip,i=t.size,s=i===void 0?"3":i,o=t.className,a=o===void 0?"":o,l=function(d){var f=typeof d=="string"?d:"tooltip";return"tooltip-".concat(f.toLowerCase().replace(/\s+/g,"-"))},u=l(n);return y.jsxs("div",{className:"yst-flex yst-items-center yst-justify-between ".concat(a),children:[y.jsx(T.Title,{size:s,children:n}),y.jsx($f,{id:u,children:r})]})},D0=function(t){var n=t.keywords,r=t.badgeClassName;return y.jsx("div",{className:"yst-flex yst-flex-wrap yst-gap-2",children:n.map(function(i,s){return i&&y.jsx(T.Badge,{className:r,children:i},s)})})},y2=function(t){var n,r,i,s,o=t.title,a=o===void 0?"Sentiment":o,l=t.tooltip,u=l===void 0?"":l,c=t.data,d=c==null?void 0:c.brandName,f=c==null||(n=c.positivityPercentage)===null||n===void 0?void 0:n.value,h=c==null||(r=c.positivityPercentage)===null||r===void 0||(r=r.previous)===null||r===void 0?void 0:r.difference,g=c==null||(i=c.keywords)===null||i===void 0?void 0:i.positive,m=c==null||(s=c.keywords)===null||s===void 0?void 0:s.negative,p=!c||f===void 0&&h===void 0;return y.jsx(T.Card,{className:"yst-overflow-visible",children:y.jsxs(T.Card.Content,{className:"yst-space-y-8",children:[y.jsx(qa,{title:a,tooltip:u}),y.jsx("div",{className:"yst-space-y-3",children:!p&&y.jsxs(y.Fragment,{children:[y.jsx("p",{children:d||y.jsx(T.SkeletonLoader,{className:"yst-h-6 yst-w-20"})}),y.jsxs("div",{children:[y.jsx("div",{className:"yst-inline-flex",children:y.jsx(Ba,{className:"yst-mb-1.5",score:f,scoreFormat:"percentage",suffix:"positive",delta:h})}),y.jsx(T.ProgressBar,{max:100,min:0,progress:f||0,className:Oe({"yst-bg-red-500":f},"[&>*]:yst-bg-green-500")})]})]})}),p&&y.jsx(T.Alert,{variant:"info",children:"The selected AI model returned no brand sentiment data for your queries. This can happen with some queries or models."}),!!g&&y.jsxs("div",{className:"yst-space-y-2",children:[y.jsx(T.Title,{as:"h5",size:"5",children:"Positive keywords"}),y.jsx(D0,{keywords:g,badgeClassName:"yst-bg-green-100 yst-text-green-800"})]}),!!m&&y.jsxs("div",{className:"yst-space-y-2",children:[y.jsx(T.Title,{as:"h5",size:"5",children:"Negative keywords"}),y.jsx(D0,{keywords:m,badgeClassName:"yst-bg-red-100 yst-text-red-800"})]})]})})};function ia(e){"@babel/helpers - typeof";return ia=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ia(e)}var s_=["data"];function I0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function o_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?I0(Object(n),!0).forEach(function(r){a_(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I0(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function a_(e,t,n){return(t=l_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l_(e){var t=u_(e,"string");return ia(t)=="symbol"?t:t+""}function u_(e,t){if(ia(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ia(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function c_(e,t){if(e==null)return{};var n,r,i=d_(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function d_(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var ri=function(t,n,r){var i=Rn(),s=i.brandId,o=i.analysisId,a=i.model,l=s,u=o,c=a,d=Lu(l,u,{query:{enabled:!!l&&!!u,select:function(p){var v=p.data;return v==null?void 0:v.analysis}}}),f=d.data,h=c_(d,s_),g=z.useMemo(function(){if(!f||!c)return null;var m=f.scans||[];return m.find(function(p){return String(p.aiProvider)===String(c)})||null},[f,c]);return o_({data:g},h)};function f_(){var e,t=ri(),n=t.data;return y.jsx(y2,{title:"Brand Sentiment",data:n==null||(e=n.sentiment)===null||e===void 0?void 0:e.own,tooltip:"Percentage of positive versus negative keywords in your query results related to your brand."})}var h_=["children","as","className"];function g_(e,t){if(e==null)return{};var n,r,i=y_(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function y_(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var za=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var s=t.reduce(function(o,a,l){return o+a+(r[l]||"")},"");return function(o){var a=o.children,l=o.as,u=l===void 0?"div":l,c=o.className,d=c===void 0?"":c,f=g_(o,h_);return y.jsx(u,{className:Oe(String(s).trim(),d),...f,children:a})}},bc=[{bg:"yst-bg-blue-200",text:"yst-text-blue-900"},{bg:"yst-bg-green-200",text:"yst-text-green-900"},{bg:"yst-bg-purple-200",text:"yst-text-purple-900"},{bg:"yst-bg-pink-200",text:"yst-text-pink-900"},{bg:"yst-bg-yellow-200",text:"yst-text-yellow-900"},{bg:"yst-bg-indigo-200",text:"yst-text-indigo-900"},{bg:"yst-bg-red-200",text:"yst-text-red-900"},{bg:"yst-bg-orange-200",text:"yst-text-orange-900"},{bg:"yst-bg-teal-200",text:"yst-text-teal-900"},{bg:"yst-bg-cyan-200",text:"yst-text-cyan-900"},{bg:"yst-bg-lime-200",text:"yst-text-lime-900"},{bg:"yst-bg-emerald-200",text:"yst-text-emerald-900"},{bg:"yst-bg-sky-200",text:"yst-text-sky-900"},{bg:"yst-bg-violet-200",text:"yst-text-violet-900"},{bg:"yst-bg-fuchsia-200",text:"yst-text-fuchsia-900"},{bg:"yst-bg-rose-200",text:"yst-text-rose-900"},{bg:"yst-bg-amber-200",text:"yst-text-amber-900"}],R0=function(t){if(!t)return bc[0];if(t.toLowerCase()==="other")return{bg:"yst-bg-slate-200",text:"yst-text-slate-900"};for(var n=0,r=0;r<t.length;r++){var i=t.charCodeAt(r);n=(n<<5)-n+i,n=n&n}var s=Math.abs(n)%bc.length;return bc[s]};function sa(e){"@babel/helpers - typeof";return sa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sa(e)}var N0;function F0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function B0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?F0(Object(n),!0).forEach(function(r){m_(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F0(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function m_(e,t,n){return(t=p_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p_(e){var t=v_(e,"string");return sa(t)=="symbol"?t:t+""}function v_(e,t){if(sa(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(sa(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function b_(e){return S_(e)||w_(e)||m2(e)||x_()}function x_(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
26
26
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w_(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function S_(e){if(Array.isArray(e))return Md(e)}function q0(e,t){return k_(e)||__(e,t)||m2(e,t)||C_()}function C_(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
27
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function m2(e,t){if(e){if(typeof e=="string")return Md(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Md(e,t):void 0}}function Md(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function __(e,t){var n=e==null?null:typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}function k_(e){if(Array.isArray(e))return e}function O_(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var yo=za(N0||(N0=O_(["md:yst-hidden yst-mr-2 yst-font-medium yst-text-slate-400 yst-inline-flex yst-w-20"]))),z0=function(t){var n=t.data,r=t.totalQueries,i=t.isLoading,s=i===void 0?!1:i,o=t.isFirstScan,a=o===void 0?!1:o,l=t.enableCategories,u=l===void 0?!1:l,c=s||!n,d=n||{},f=d.rank,h=d.url,g=d.rootDomain,m=d.category,p=d.impact,v=d.numberOfMentions,b=v==null?void 0:v.value,S=v==null?void 0:v.previous,C=typeof(S==null?void 0:S.difference)=="number"?S.difference:b;return y.jsxs("tr",{className:"yst-flex yst-flex-col md:yst-table-row",children:[y.jsxs(T.Table.Cell,{className:"yst-ml-2 yst-py-1 md:yst-ml-0 md:yst-p-2",children:[y.jsx(yo,{as:"span",children:"Rank:"}),c?y.jsx(T.SkeletonLoader,{className:"yst-h-6 yst-w-24"}):y.jsx("span",{className:"yst-font-medium yst-text-slate-900",children:f!=null?f:"—"})]}),y.jsx(T.Table.Cell,{className:"yst-ml-2 yst-py-1 md:yst-ml-0 md:yst-p-2",children:c?y.jsx(T.SkeletonLoader,{className:"yst-h-6 yst-w-full"}):y.jsx("div",{className:"yst-flex yst-items-center yst-gap-2",children:y.jsxs(T.Link,{className:"yst-flex yst-items-center yst-gap-1 yst-font-medium",href:h||"#",rel:"nofollow noreferrer",target:"_blank",children:[y.jsx("span",{children:h!=null?h:"—"})," ",y.jsx(h2,{})]})})}),y.jsxs(T.Table.Cell,{className:"yst-ml-2 yst-py-1 yst-font-medium md:yst-ml-0 md:yst-p-2",children:[y.jsx(yo,{as:"span",children:"Domain:"}),c?y.jsx(T.SkeletonLoader,{className:"yst-h-6 yst-w-24"}):y.jsx("span",{className:"yst-font-medium yst-text-slate-900",children:g!=null?g:"—"})]}),u&&y.jsxs(T.Table.Cell,{className:"yst-ml-2 yst-py-1 md:yst-ml-0 md:yst-p-2",children:[y.jsx(yo,{as:"span",children:"Category:"}),c?y.jsx(T.SkeletonLoader,{className:"yst-h-6 yst-w-16"}):y.jsx(T.Badge,{className:Oe(R0(m||"").bg,R0(m||"").text),children:m!=null?m:"—"})]}),y.jsxs(T.Table.Cell,{className:Oe("yst-ml-2 yst-py-0 md:yst-ml-0 md:yst-p-2","yst-font-medium",{"yst-text-green-600":p==="High","yst-text-yellow-600":p==="Medium","yst-text-red-600":p==="Low"}),children:[y.jsx(yo,{as:"span",children:"Impact:"}),c?y.jsx(T.SkeletonLoader,{className:"yst-h-6 yst-w-12"}):p!=null?p:"—"]}),y.jsxs(T.Table.Cell,{className:"yst-ml-2 yst-pt-1 md:yst-ml-0 md:yst-p-2 md:yst-text-right",children:[y.jsx(yo,{as:"span",children:"Mentions:"}),c?y.jsx(T.SkeletonLoader,{className:"yst-h-6 yst-w-8"}):b?y.jsxs("span",{className:"yst-flex yst-justify-end yst-gap-4",children:[y.jsxs("span",{className:"yst-flex yst-flex-nowrap yst-gap-1 yst-font-medium",children:[y.jsx("span",{className:"yst-text-slate-500",children:b}),y.jsxs("span",{className:"yst-text-slate-900",children:["/ ",r]})]}),!a&&y.jsxs("span",{className:Oe("yst-ml-auto",ra(C)),children:[C>-1&&"+",C]})]}):"—"]})]},c?void 0:h)},E_=function(t){var n,r,i,s,o,a=t.enableCategories,l=a===void 0?!1:a,u=z.useState("all"),c=q0(u,2),d=c[0],f=c[1],h=z.useState(1),g=q0(h,2),m=g[0],p=g[1],v=ri(),b=v.data,S=v.isLoading,C=v.isRefetching,w=b==null?void 0:b.citations,O=(b==null||(n=b.scores)===null||n===void 0||(n=n.standardized)===null||n===void 0?void 0:n.citations)||{},x=Object.hasOwn(O,"previous"),_=w==null||(r=w.list)===null||r===void 0?void 0:r.filter(function(A){return d==="all"?!0:A.category===d}),k=10,E=(_==null?void 0:_.length)||0,P=Math.ceil(E/k),M=(m-1)*k,B=M+k,R=_==null?void 0:_.slice(M,B);return z.useEffect(function(){m>P&&P>0&&p(1)},[P,m,p,d]),y.jsx(T.Card,{className:"yst-overflow-visible md:yst-col-span-2",children:y.jsxs(T.Card.Content,{className:"yst-flex yst-flex-col yst-gap-6",children:[y.jsxs("div",{className:"yst-space-y-4",children:[y.jsx(qa,{title:"Citations",tooltip:"Sources the AI used to support brand mentions in the results."}),y.jsx("p",{children:"This table highlights the most important sources where your brand was cited."}),y.jsx(Ba,{score:w==null||(i=w.total)===null||i===void 0?void 0:i.value,suffix:"citations",delta:w==null||(s=w.total)===null||s===void 0||(s=s.previous)===null||s===void 0?void 0:s.difference,deltaSuffix:"since last analysis",isLoading:S,hideTotal:!0})]}),(w==null||(o=w.list)===null||o===void 0?void 0:o.length)===0&&!S&&!C?y.jsx(T.Alert,{children:"The selected AI model returned no citations for your queries. This can happen with some queries or models."}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{children:[l&&y.jsx(T.Select,{className:"yst-mb-4 md:yst-max-w-sm",label:"Filter categories",value:d,onChange:function(A){f(A)},id:"citation-category-filter",options:[{value:"all",label:"All categories"}].concat(b_(w!=null&&w.categories?w.categories.map(function(A){return{value:A,label:A}}):[]))}),y.jsxs(T.Table,{variant:"minimal",children:[y.jsx(T.Table.Head,{className:"yst-font-semibold",children:y.jsxs(T.Table.Row,{children:[y.jsx(T.Table.Cell,{className:"yst-hidden yst-text-slate-900 md:yst-table-cell md:yst-pl-2",children:"#"}),y.jsx(T.Table.Cell,{className:"yst yst-hidden yst-text-slate-900 md:yst-table-cell md:yst-px-2",children:"URL"}),y.jsx(T.Table.Cell,{className:"yst-hidden yst-text-slate-900 md:yst-table-cell md:yst-px-2",children:"Root domain"}),l&&y.jsx(T.Table.Cell,{className:"yst-hidden yst-text-slate-900 md:yst-table-cell",children:"Category"}),y.jsx(T.Table.Cell,{className:"yst-hidden yst-text-slate-900 md:yst-table-cell md:yst-px-2",children:"Impact"}),y.jsx(T.Table.Cell,{className:"yst-hidden yst-text-right yst-text-slate-900 md:yst-table-cell",children:"Mentions"})]})}),y.jsx(T.Table.Body,{children:S||C?Array.from({length:5}).map(function(A,j){return y.jsx(z0,{isLoading:!0,enableCategories:l},"skeleton-".concat(j))}):R&&R.length>0?R.map(function(A,j){return y.jsx(z0,{data:B0(B0({},A),{},{rank:M+j+1}),totalQueries:b==null?void 0:b.numberOfQueries,isFirstScan:!x,enableCategories:l},"citation-table-row-".concat(A.url,"-").concat(j))}):y.jsx(T.Table.Row,{children:y.jsxs(T.Table.Cell,{colSpan:l?6:5,className:"yst-py-8 yst-text-center yst-text-slate-500",children:[d==="all"?"No citations found.":'No citations found for the "'.concat(d,'" category.')," ",y.jsx(T.Link,{onClick:function(){return f("all")},children:"Show all categories."})]})},"no-results")})]})]}),_&&_.length>k&&y.jsxs("div",{className:"yst-flex yst-items-center yst-justify-end yst-gap-4",children:[y.jsxs("p",{className:"yst-mb-0",children:["Showing ",M+1," to"," ",B>E?E:B," of"," ",E," results"]}),y.jsx(T.Pagination,{variant:"text",className:"yst-flex-row yst-gap-0",current:m,total:P,onNavigate:p,screenReaderTextPrevious:"Previous page",screenReaderTextNext:"Next page"})]})]})]})})};function A_(e,t){return M_(e)||j_(e,t)||P_(e,t)||T_()}function T_(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
27
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function m2(e,t){if(e){if(typeof e=="string")return Md(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Md(e,t):void 0}}function Md(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function __(e,t){var n=e==null?null:typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}function k_(e){if(Array.isArray(e))return e}function O_(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var yo=za(N0||(N0=O_(["md:yst-hidden yst-mr-2 yst-font-medium yst-text-slate-400 yst-inline-flex yst-w-20"]))),z0=function(t){var n=t.data,r=t.totalQueries,i=t.isLoading,s=i===void 0?!1:i,o=t.isFirstScan,a=o===void 0?!1:o,l=t.enableCategories,u=l===void 0?!1:l,c=s||!n,d=n||{},f=d.rank,h=d.url,g=d.rootDomain,m=d.category,p=d.impact,v=d.numberOfMentions,b=v==null?void 0:v.value,S=v==null?void 0:v.previous,C=typeof(S==null?void 0:S.difference)=="number"?S.difference:b;return y.jsxs("tr",{className:"yst-flex yst-flex-col md:yst-table-row",children:[y.jsxs(T.Table.Cell,{className:"yst-ml-2 yst-py-1 md:yst-ml-0 md:yst-p-2",children:[y.jsx(yo,{as:"span",children:"Rank:"}),c?y.jsx(T.SkeletonLoader,{className:"yst-h-6 yst-w-24"}):y.jsx("span",{className:"yst-font-medium yst-text-slate-900",children:f!=null?f:"—"})]}),y.jsx(T.Table.Cell,{className:"yst-ml-2 yst-py-1 md:yst-ml-0 md:yst-p-2 yst-break-all",children:c?y.jsx(T.SkeletonLoader,{className:"yst-h-6 yst-w-full"}):y.jsx("div",{className:"yst-flex yst-items-center yst-gap-2",children:y.jsxs(T.Link,{className:"yst-flex yst-items-center yst-gap-1 yst-font-medium",href:h||"#",rel:"nofollow noreferrer",target:"_blank",children:[y.jsx("span",{children:h!=null?h:"—"})," ",y.jsx(h2,{})]})})}),y.jsxs(T.Table.Cell,{className:"yst-ml-2 yst-py-1 yst-font-medium md:yst-ml-0 md:yst-p-2",children:[y.jsx(yo,{as:"span",children:"Domain:"}),c?y.jsx(T.SkeletonLoader,{className:"yst-h-6 yst-w-24"}):y.jsx("span",{className:"yst-font-medium yst-text-slate-900",children:g!=null?g:"—"})]}),u&&y.jsxs(T.Table.Cell,{className:"yst-ml-2 yst-py-1 md:yst-ml-0 md:yst-p-2",children:[y.jsx(yo,{as:"span",children:"Category:"}),c?y.jsx(T.SkeletonLoader,{className:"yst-h-6 yst-w-16"}):y.jsx(T.Badge,{className:Oe(R0(m||"").bg,R0(m||"").text),children:m!=null?m:"—"})]}),y.jsxs(T.Table.Cell,{className:Oe("yst-ml-2 yst-py-0 md:yst-ml-0 md:yst-p-2","yst-font-medium",{"yst-text-green-600":p==="High","yst-text-yellow-600":p==="Medium","yst-text-red-600":p==="Low"}),children:[y.jsx(yo,{as:"span",children:"Impact:"}),c?y.jsx(T.SkeletonLoader,{className:"yst-h-6 yst-w-12"}):p!=null?p:"—"]}),y.jsxs(T.Table.Cell,{className:"yst-ml-2 yst-pt-1 md:yst-ml-0 md:yst-p-2 md:yst-text-right",children:[y.jsx(yo,{as:"span",children:"Mentions:"}),c?y.jsx(T.SkeletonLoader,{className:"yst-h-6 yst-w-8"}):b?y.jsxs("span",{className:"yst-flex yst-justify-end yst-gap-4",children:[y.jsxs("span",{className:"yst-flex yst-flex-nowrap yst-gap-1 yst-font-medium",children:[y.jsx("span",{className:"yst-text-slate-500",children:b}),y.jsxs("span",{className:"yst-text-slate-900",children:["/ ",r]})]}),!a&&y.jsxs("span",{className:Oe("yst-ml-auto",ra(C)),children:[C>-1&&"+",C]})]}):"—"]})]},c?void 0:h)},E_=function(t){var n,r,i,s,o,a=t.enableCategories,l=a===void 0?!1:a,u=z.useState("all"),c=q0(u,2),d=c[0],f=c[1],h=z.useState(1),g=q0(h,2),m=g[0],p=g[1],v=ri(),b=v.data,S=v.isLoading,C=v.isRefetching,w=b==null?void 0:b.citations,O=(b==null||(n=b.scores)===null||n===void 0||(n=n.standardized)===null||n===void 0?void 0:n.citations)||{},x=Object.hasOwn(O,"previous"),_=w==null||(r=w.list)===null||r===void 0?void 0:r.filter(function(A){return d==="all"?!0:A.category===d}),k=10,E=(_==null?void 0:_.length)||0,P=Math.ceil(E/k),M=(m-1)*k,B=M+k,R=_==null?void 0:_.slice(M,B);return z.useEffect(function(){m>P&&P>0&&p(1)},[P,m,p,d]),y.jsx(T.Card,{className:"yst-overflow-visible md:yst-col-span-2",children:y.jsxs(T.Card.Content,{className:"yst-flex yst-flex-col yst-gap-6",children:[y.jsxs("div",{className:"yst-space-y-4",children:[y.jsx(qa,{title:"Citations",tooltip:"Sources the AI used to support brand mentions in the results."}),y.jsx("p",{children:"This table highlights the most important sources where your brand was cited."}),y.jsx(Ba,{score:w==null||(i=w.total)===null||i===void 0?void 0:i.value,suffix:"citations",delta:w==null||(s=w.total)===null||s===void 0||(s=s.previous)===null||s===void 0?void 0:s.difference,deltaSuffix:"since last analysis",isLoading:S,hideTotal:!0})]}),(w==null||(o=w.list)===null||o===void 0?void 0:o.length)===0&&!S&&!C?y.jsx(T.Alert,{children:"The selected AI model returned no citations for your queries. This can happen with some queries or models."}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{children:[l&&y.jsx(T.Select,{className:"yst-mb-4 md:yst-max-w-sm",label:"Filter categories",value:d,onChange:function(A){f(A)},id:"citation-category-filter",options:[{value:"all",label:"All categories"}].concat(b_(w!=null&&w.categories?w.categories.map(function(A){return{value:A,label:A}}):[]))}),y.jsxs(T.Table,{variant:"minimal",children:[y.jsx(T.Table.Head,{className:"yst-font-semibold",children:y.jsxs(T.Table.Row,{children:[y.jsx(T.Table.Cell,{className:"yst-hidden yst-text-slate-900 md:yst-table-cell md:yst-pl-2",children:"#"}),y.jsx(T.Table.Cell,{className:"yst yst-hidden yst-text-slate-900 md:yst-table-cell md:yst-px-2",children:"URL"}),y.jsx(T.Table.Cell,{className:"yst-hidden yst-text-slate-900 md:yst-table-cell md:yst-px-2",children:"Root domain"}),l&&y.jsx(T.Table.Cell,{className:"yst-hidden yst-text-slate-900 md:yst-table-cell",children:"Category"}),y.jsx(T.Table.Cell,{className:"yst-hidden yst-text-slate-900 md:yst-table-cell md:yst-px-2",children:"Impact"}),y.jsx(T.Table.Cell,{className:"yst-hidden yst-text-right yst-text-slate-900 md:yst-table-cell",children:"Mentions"})]})}),y.jsx(T.Table.Body,{children:S||C?Array.from({length:5}).map(function(A,j){return y.jsx(z0,{isLoading:!0,enableCategories:l},"skeleton-".concat(j))}):R&&R.length>0?R.map(function(A,j){return y.jsx(z0,{data:B0(B0({},A),{},{rank:M+j+1}),totalQueries:b==null?void 0:b.numberOfQueries,isFirstScan:!x,enableCategories:l},"citation-table-row-".concat(A.url,"-").concat(j))}):y.jsx(T.Table.Row,{children:y.jsxs(T.Table.Cell,{colSpan:l?6:5,className:"yst-py-8 yst-text-center yst-text-slate-500",children:[d==="all"?"No citations found.":'No citations found for the "'.concat(d,'" category.')," ",y.jsx(T.Link,{onClick:function(){return f("all")},children:"Show all categories."})]})},"no-results")})]})]}),_&&_.length>k&&y.jsxs("div",{className:"yst-flex yst-items-center yst-justify-end yst-gap-4",children:[y.jsxs("p",{className:"yst-mb-0",children:["Showing ",M+1," to"," ",B>E?E:B," of"," ",E," results"]}),y.jsx(T.Pagination,{variant:"text",className:"yst-flex-row yst-gap-0",current:m,total:P,onNavigate:p,screenReaderTextPrevious:"Previous page",screenReaderTextNext:"Next page"})]})]})]})})};function A_(e,t){return M_(e)||j_(e,t)||P_(e,t)||T_()}function T_(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
28
28
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function P_(e,t){if(e){if(typeof e=="string")return H0(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?H0(e,t):void 0}}function H0(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function j_(e,t){var n=e==null?null:typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,s,o,a=[],l=!0,u=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}function M_(e){if(Array.isArray(e))return e}var U0=function(t){var n,r=t.data,i=t.totalQueries,s=t.isFirstScan,o=s===void 0?!0:s,a=t.isLoading,l=a===void 0?!1:a,u=l||!r,c=r||{},d=c.rank,f=c.brand,h=d==null?void 0:d.previous,g=typeof(h==null?void 0:h.difference)=="number"?h.difference*-1:void 0,m=f==null?void 0:f.numberOfMentions,p=m==null?void 0:m.previous,v=typeof(p==null?void 0:p.difference)=="number"?p.difference:void 0;return y.jsxs(T.Table.Row,{children:[y.jsx(T.Table.Cell,{children:u?y.jsx(T.SkeletonLoader,{className:"yst-h-6 yst-w-8"}):y.jsxs("span",{className:"yst-flex yst-justify-between yst-gap-4",children:[y.jsxs("span",{className:"yst-flex yst-flex-nowrap yst-gap-2 yst-font-medium",children:[y.jsx("span",{className:"yst-text-slate-500",children:"#"}),y.jsx("span",{className:"yst-text-slate-900",children:d==null?void 0:d.value})]}),!o&&y.jsx("span",{className:Oe("yst-inline-flex yst-items-center yst-justify-end",ra(h&&typeof g=="number"?g:0)),children:h&&typeof g=="number"?y.jsxs(y.Fragment,{children:[Math.abs(g),g>0?y.jsx(N6,{className:"yst-h-4 yst-w-4"}):y.jsx(I6,{className:"yst-h-4 yst-w-4"})]}):y.jsx(j0,{className:"yst-mx-1 yst-h-4 yst-w-4"})})]})}),y.jsx(T.Table.Cell,{children:u?y.jsx(T.SkeletonLoader,{className:"yst-h-6 yst-w-24"}):y.jsx("span",{className:"yst-font-medium",children:f!=null&&f.isSelf?y.jsx(Nu,{children:f==null?void 0:f.name}):(n=f==null?void 0:f.name)!==null&&n!==void 0?n:"—"})}),y.jsx(T.Table.Cell,{children:u?y.jsx(T.SkeletonLoader,{className:"yst-h-6 yst-w-8"}):y.jsxs("span",{className:"yst-flex yst-justify-end yst-gap-4",children:[y.jsxs("span",{className:"yst-flex yst-flex-nowrap yst-gap-1 yst-font-medium",children:[y.jsx("span",{className:"yst-text-slate-500",children:m==null?void 0:m.value}),y.jsxs("span",{className:"yst-text-slate-900",children:["/ ",i]})]}),!o&&y.jsx("span",{className:Oe("yst-ml-auto",ra(p&&typeof v=="number"?v:0)),children:p&&typeof v=="number"?y.jsxs(y.Fragment,{children:[v>-1&&"+",v]}):y.jsx(j0,{className:"yst-h-4 yst-w-4"})})]})})]},u||d==null?void 0:d.value)},$_=function(t){var n,r,i=t.className,s=z.useRef(null),o=z.useState(1),a=A_(o,2),l=a[0],u=a[1],c=ri(),d=c.data,f=c.isLoading,h=c.isRefetching,g=d==null||(n=d.rankings)===null||n===void 0?void 0:n.list,m=(d==null||(r=d.scores)===null||r===void 0||(r=r.standardized)===null||r===void 0?void 0:r.ranking)||{},p=Object.hasOwn(m,"previous"),v=5,b=(g==null?void 0:g.length)||0,S=Math.ceil(b/v),C=(l-1)*v,w=C+v,O=g==null?void 0:g.slice(C,w);return z.useEffect(function(){l>S&&S>0&&u(1)},[S,l,u]),y.jsx(T.Card,{ref:s,className:Oe("yst-overflow-visible",i),children:y.jsxs(T.Card.Content,{className:"yst-mt-0 yst-space-y-6",children:[y.jsxs("div",{className:"yst-space-y-2",children:[y.jsx(qa,{title:"Competitor ranking",tooltip:"How often competitors are mentioned in your submitted queries."}),y.jsx("p",{children:"Brands with the most mentions for your prompts."})]}),!f&&!h&&(!g||g.length===0)?y.jsx(T.Alert,{variant:"info",children:"The selected AI model returned no brands for your queries. This can happen with some queries or models."}):y.jsxs(T.Table,{variant:"minimal",children:[y.jsx(T.Table.Head,{children:y.jsxs(T.Table.Row,{children:[y.jsx(T.Table.Cell,{className:"yst-w-20 yst-font-semibold",children:"Rank"}),y.jsx(T.Table.Cell,{className:"yst-font-semibold",children:"Brand"}),y.jsx(T.Table.Cell,{className:"yst-w-20 yst-text-right yst-font-semibold",children:"Mentions"})]})}),y.jsx(T.Table.Body,{children:O&&Array.isArray(O)&&O.length>0?O.map(function(x){var _;return y.jsx(U0,{data:x,totalQueries:d==null?void 0:d.numberOfQueries,isFirstScan:!p},"rank-row-".concat((_=x.rank)===null||_===void 0?void 0:_.value))}):f||h?Array.from({length:v}).map(function(x,_){return y.jsx(U0,{isLoading:!0},"skeleton-".concat(_))}):null})]}),!f&&!h&&g&&g.length>v&&y.jsx(T.Pagination,{current:l,total:S,className:"yst-flex-row",onNavigate:u,screenReaderTextNext:"Next",screenReaderTextPrevious:"Previous",variant:"text"})]})})},L_=function(){var t,n=ri(),r=n.data,i=r==null||(t=r.sentiment)===null||t===void 0?void 0:t.topCompetitor;return y.jsx(y2,{title:"Competitor sentiment",data:i,tooltip:"Percentage of positive versus negative keywords in your query results related to your competitor's brand."})},D_=function(t){var n=t.brand,r=dn(),i=Fa(),s=i.setBrandId;return(n==null?void 0:n.setupStatus)==="pendingQuerySelection"?y.jsx(T.Alert,{className:"yst-mt-0",children:y.jsxs("div",{className:"yst-max-w-xl yst-space-y-4",children:[y.jsxs("div",{className:"yst-space-y-2",children:[y.jsxs("h3",{className:"yst-font-medium",children:["Finish your analysis for ",(n==null?void 0:n.name)||"Brand ".concat(n==null?void 0:n.id)]}),y.jsx("p",{children:"Your brand is saved, but you haven’t completed the analysis yet. Review your queries and run the analysis to get your brand insights!"})]}),y.jsx("div",{className:"yst-flex yst-justify-start yst-gap-6",children:y.jsx(T.Link,{onClick:function(){n.id?(s(n.id),r("/setup/".concat(n.id,"/queries"))):console.error("Brand ID is missing.")},children:"Review queries"})})]})}):null},Fu=function(t){var n=t.isOpen,r=t.onClose,i=t.onConfirm,s=t.isLoading,o=s===void 0?!1:s,a=t.title,l=t.description,u=t.disabled,c=u===void 0?!1:u,d=t.confirmText,f=d===void 0?"Yes, delete":d,h=t.cancelText,g=h===void 0?"No, go back":h,m=t.className;return y.jsx(T.Modal,{isOpen:n,onClose:r,position:"center",as:"div",className:m,children:y.jsxs(T.Modal.Panel,{children:[y.jsxs("div",{className:"yst-flex yst-items-start yst-justify-stretch yst-gap-4",children:[y.jsx("div",{children:y.jsx("span",{className:"yst-inline-flex yst-h-10 yst-w-10 yst-items-center yst-justify-center yst-rounded-full yst-bg-red-100",children:y.jsx(o2,{className:"yst-h-6 yst-w-6 yst-text-red-600"})})}),y.jsxs("div",{className:"yst-flex-1",children:[y.jsx(T.Modal.Container.Header,{className:"yst-mb-3 yst-w-full",children:y.jsx(T.Modal.Title,{as:"h3",className:"yst-text-lg yst-font-medium",children:a})}),y.jsx(T.Modal.Container.Content,{className:"yst-mb-4 yst-space-y-3",children:typeof l=="string"?y.jsx("p",{children:l}):l})]})]}),y.jsxs(T.Modal.Container.Footer,{className:"yst-mt-3 yst-flex yst-justify-end yst-gap-2",children:[y.jsx(T.Button,{variant:"secondary",onClick:r,children:g}),y.jsx(T.Button,{variant:"error",onClick:i,isLoading:o,disabled:c,children:f})]})]})})},sl={exports:{}},ol={exports:{}},Ue={};/** @license React v16.13.1
|
|
29
29
|
* react-is.production.min.js
|
|
30
30
|
*
|