@census-ai/census-sdk 0.2.1 → 0.2.2
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.
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +54 -1
- package/dist/react/index.d.ts +54 -1
- package/dist/react/index.js +2 -2
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var xe="https://api.census.ai",Y=class{constructor(e){this.currentUserId=null;if(!e.apiKey)throw new Error("Census: apiKey is required");["cs_live_","cs_test_","op_live_","op_test_"].some(o=>e.apiKey.startsWith(o))||console.warn('Census: API key should start with "cs_live_" or "cs_test_"'),this.apiKey=e.apiKey,this.baseUrl=e.baseUrl||xe,this.debug=e.debug||false,this.log("Initialized with base URL:",this.baseUrl);}async identify(e){if(!e.userId)throw new Error("Census: userId is required for identify()");this.currentUserId=e.userId,await this.request("/api/sdk/identify","POST",{userId:e.userId,email:e.email,name:e.name,avatarUrl:e.avatarUrl,metadata:e.metadata,organizationId:e.organizationId,organizationName:e.organizationName,organizationDomain:e.organizationDomain,organizationPlan:e.organizationPlan}),this.log("User identified:",e.userId);}reset(){this.currentUserId=null,this.log("User identity reset");}async submitFeedback(e){let t=["feedback","bug_report","feature_request","article_rating"];if(!e.type||!t.includes(e.type))throw new Error(`Census: type must be one of: ${t.join(", ")}`);if(e.type==="article_rating"){if(e.rating===void 0&&e.helpful===void 0)throw new Error("Census: article_rating requires rating or helpful field")}else if(!e.message)throw new Error("Census: message is required for this feedback type");let o=await this.request("/api/sdk/feedback","POST",{type:e.type,message:e.message,rating:e.rating,helpful:e.helpful,userId:this.currentUserId,articleId:e.articleId,pageUrl:typeof window<"u"?window.location.href:void 0,metadata:e.metadata});return this.log("Feedback submitted:",o.feedbackId),{feedbackId:o.feedbackId}}async getArticles(e){let t=new URLSearchParams;e?.category&&t.set("category",e.category),e?.search&&t.set("search",e.search),e?.limit&&t.set("limit",String(e.limit)),e?.offset&&t.set("offset",String(e.offset));let o=t.toString(),s=`/api/sdk/articles${o?`?${o}`:""}`,l=await this.request(s,"GET");return this.log("Fetched articles:",l.articles.length),l}async getArticle(e){try{let t=await this.request(`/api/sdk/articles/${encodeURIComponent(e)}`,"GET");return this.log("Fetched article:",e),t.article}catch(t){if(t.status===404)return null;throw t}}async getFeatureGroups(){let e=await this.request("/api/sdk/feature-groups","GET");return this.log("Fetched feature groups:",e.feature_groups.length),e}async getRequests(e){if(!this.currentUserId)throw new Error("Census: User must be identified before fetching requests. Call identify() first.");let t=new URLSearchParams;t.set("userId",this.currentUserId),e?.status&&t.set("status",e.status),e?.type&&t.set("type",e.type),e?.limit&&t.set("limit",String(e.limit)),e?.offset&&t.set("offset",String(e.offset));let o=await this.request(`/api/sdk/requests?${t.toString()}`,"GET");return this.log("Fetched requests:",o.requests.length),o}async vote(e){if(!this.currentUserId)throw new Error("Census: User must be identified before voting. Call identify() first.");if(!e)throw new Error("Census: feedbackId is required for vote()");let t=await this.request("/api/sdk/requests/vote","POST",{feedbackId:e,userId:this.currentUserId});return this.log("Vote result:",t.action,"for feedback:",e),t}async track(e,t){if(!e)throw new Error("Census: eventType is required for track()");await this.request("/api/sdk/events","POST",{eventType:e,userId:this.currentUserId,properties:t}),this.log("Event tracked:",e);}async trackBatch(e){if(!e.events||e.events.length===0)throw new Error("Census: at least one event is required");if(e.events.length>100)throw new Error("Census: maximum 100 events per batch");let t=e.events.map(o=>({eventType:o.eventType,userId:this.currentUserId,articleId:o.articleId,featureId:o.featureId,properties:o.properties}));await this.request("/api/sdk/events","POST",{events:t}),this.log("Batch events tracked:",e.events.length);}async getGuides(){let e=new URLSearchParams;this.currentUserId&&e.set("userId",this.currentUserId);let t=e.toString(),o=`/api/sdk/guides${t?`?${t}`:""}`,s=await this.request(o,"GET");return this.log("Fetched guides:",s.guides.length),s}async getGuide(e){try{let t=new URLSearchParams;this.currentUserId&&t.set("userId",this.currentUserId);let o=t.toString(),s=`/api/sdk/guides/${encodeURIComponent(e)}${o?`?${o}`:""}`,l=await this.request(s,"GET");return this.log("Fetched guide:",e),l.guide}catch(t){if(t.status===404)return null;throw t}}async trackGuideEvent(e){if(!e.guideId||!e.eventType||!e.sessionId)throw new Error("Census: guideId, eventType, and sessionId are required for trackGuideEvent()");await this.request("/api/sdk/guides/events","POST",{guideId:e.guideId,eventType:e.eventType,stepId:e.stepId,stepIndex:e.stepIndex,pageUrl:e.pageUrl||(typeof window<"u"?window.location.href:void 0),sessionId:e.sessionId,userId:e.userId||this.currentUserId,metadata:e.metadata}),this.log("Guide event tracked:",e.eventType,e.guideId);}async markGuideCompleted(e){if(!e)throw new Error("Census: guideId is required for markGuideCompleted()");if(!this.currentUserId)throw new Error("Census: User must be identified before marking guides complete. Call identify() first.");await this.request("/api/sdk/guides/complete","POST",{guideId:e,userId:this.currentUserId}),this.log("Guide marked completed:",e);}getCurrentUserId(){return this.currentUserId}isIdentified(){return this.currentUserId!==null}async request(e,t,o){let s=`${this.baseUrl}${e}`,l={"X-Census-Key":this.apiKey};o&&(l["Content-Type"]="application/json"),this.log(`${t} ${e}`,o);let d=await fetch(s,{method:t,headers:l,body:o?JSON.stringify(o):void 0});if(!d.ok){let a=`Request failed with status ${d.status}`;try{a=(await d.json()).error||a;}catch{}throw {error:a,status:d.status}}return d.json()}log(...e){this.debug&&console.log("[Census]",...e);}};function le(r){return new Y(r)}var Q=react.createContext(null);function ke({apiKey:r,baseUrl:e,debug:t,user:o,theme:s={},children:l}){let[d,a]=react.useState(false),[n,c]=react.useState(false),i=react.useMemo(()=>le({apiKey:r,baseUrl:e,debug:t}),[r,e,t]);react.useEffect(()=>{o?i.identify(o).then(()=>{c(true),a(true);}).catch(v=>{console.error("[Census] Failed to identify user:",v),a(true);}):a(true);},[i,o]);let p=react.useMemo(()=>({client:i,theme:s,isReady:d,isIdentified:n}),[i,s,d,n]);return jsxRuntime.jsx(Q.Provider,{value:p,children:l})}function we(){let r=react.useContext(Q);if(!r)throw new Error("useCensus must be used within a CensusProvider");return r.client}function C(){let r=react.useContext(Q);if(!r)throw new Error("useCensusContext must be used within a CensusProvider");return r}function Ie(){let{client:r}=C(),[e,t]=react.useState(false),[o,s]=react.useState(null);return {identify:async a=>{t(true),s(null);try{await r.identify(a);}catch(n){throw s(n instanceof Error?n:new Error("Failed to identify user")),n}finally{t(false);}},reset:()=>{r.reset();},isIdentifying:e,isIdentified:r.isIdentified(),error:o}}function D(){let{client:r}=C(),[e,t]=react.useState(false),[o,s]=react.useState(false),[l,d]=react.useState(null),[a,n]=react.useState(null),c=react.useCallback(async p=>{t(true),s(false),d(null),n(null);try{let v=await r.submitFeedback(p);return n(v.feedbackId),s(!0),v}catch(v){let F=v instanceof Error?v:new Error("Failed to submit feedback");throw d(F),F}finally{t(false);}},[r]),i=react.useCallback(()=>{s(false),d(null),n(null);},[]);return {submitFeedback:c,reset:i,isSubmitting:e,isSuccess:o,error:l,feedbackId:a}}function J(r){let{client:e,isReady:t}=C(),[o,s]=react.useState(null),[l,d]=react.useState(true),[a,n]=react.useState(null),c=react.useCallback(async()=>{d(true),n(null);try{let i=await e.getArticles(r);s(i);}catch(i){n(i instanceof Error?i:new Error("Failed to fetch articles"));}finally{d(false);}},[e,r?.category,r?.search,r?.limit,r?.offset]);return react.useEffect(()=>{t&&c();},[t,c]),{articles:o?.articles||[],pagination:o?.pagination,isLoading:l,error:a,refetch:c}}function X(r){let{client:e,isReady:t}=C(),[o,s]=react.useState(null),[l,d]=react.useState(true),[a,n]=react.useState(null),c=react.useCallback(async()=>{if(!r){s(null),d(false);return}d(true),n(null);try{let i=await e.getArticle(r);s(i);}catch(i){n(i instanceof Error?i:new Error("Failed to fetch article"));}finally{d(false);}},[e,r]);return react.useEffect(()=>{t&&c();},[t,c]),{article:o,isLoading:l,error:a,refetch:c}}var Re={feedbackVisibility:"own",allowVoting:false,allowRequestCreation:true};function Z(r){let{client:e,isReady:t,isIdentified:o}=C(),[s,l]=react.useState(null),[d,a]=react.useState(true),[n,c]=react.useState(null),i=react.useCallback(async()=>{if(!o){l(null),a(false);return}a(true),c(null);try{let p=await e.getRequests(r);l(p);}catch(p){c(p instanceof Error?p:new Error("Failed to fetch requests"));}finally{a(false);}},[e,o,r?.status,r?.type,r?.limit,r?.offset]);return react.useEffect(()=>{t&&(o?i():a(false));},[t,o,i]),{requests:s?.requests||[],pagination:s?.pagination,settings:s?.settings||Re,isLoading:d,error:n,refetch:i}}function ee(){let{client:r}=C(),[e,t]=react.useState(false),[o,s]=react.useState(null);return {vote:react.useCallback(async d=>{t(true),s(null);try{return await r.vote(d)}catch(a){let n=a instanceof Error?a:new Error("Failed to vote");throw s(n),n}finally{t(false);}},[r]),isVoting:e,error:o}}function Se(){let{client:r}=C(),e=react.useCallback(async(o,s)=>{await r.track(o,s);},[r]),t=react.useCallback(async o=>{await r.trackBatch({events:o});},[r]);return {track:e,trackBatch:t}}function Ee(){let{client:r,isReady:e}=C(),[t,o]=react.useState([]),[s,l]=react.useState(true),[d,a]=react.useState(null),n=react.useCallback(async()=>{l(true),a(null);try{let c=await r.getFeatureGroups();o(c.feature_groups);}catch(c){a(c instanceof Error?c:new Error("Failed to fetch feature groups"));}finally{l(false);}},[r]);return react.useEffect(()=>{e&&n();},[e,n]),{featureGroups:t,isLoading:s,error:d,refetch:n}}var M={button:{position:"fixed",padding:"12px 20px",border:"none",borderRadius:"8px",cursor:"pointer",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"14px",fontWeight:"500",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",transition:"transform 0.2s, box-shadow 0.2s",zIndex:9999},modal:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e4},modalContent:{backgroundColor:"white",borderRadius:"12px",padding:"24px",width:"100%",maxWidth:"400px",margin:"16px",boxShadow:"0 20px 50px rgba(0, 0, 0, 0.2)",fontFamily:"system-ui, -apple-system, sans-serif"},textarea:{width:"100%",padding:"10px 12px",border:"1px solid #e0e0e0",borderRadius:"6px",fontSize:"14px",marginBottom:"16px",minHeight:"100px",resize:"vertical",boxSizing:"border-box",fontFamily:"inherit"},submitButton:{width:"100%",padding:"12px",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"14px",fontWeight:"500",transition:"opacity 0.2s"},typeButton:{padding:"8px 16px",border:"1px solid #e0e0e0",borderRadius:"6px",cursor:"pointer",fontSize:"13px",backgroundColor:"white",transition:"all 0.2s",marginRight:"8px",marginBottom:"8px"}},qe={"bottom-right":{bottom:"20px",right:"20px"},"bottom-left":{bottom:"20px",left:"20px"},"top-right":{top:"20px",right:"20px"},"top-left":{top:"20px",left:"20px"}},Be={feedback:"General Feedback",bug_report:"Bug Report",feature_request:"Feature Request",article_rating:"Article Rating"},Te={feedback:"\u{1F4AC}",bug_report:"\u{1F41B}",feature_request:"\u{1F4A1}",article_rating:"\u2B50"};function _e(r){return {primaryColor:r.primaryColor||"#000000",textColor:r.textColor||"#333333",backgroundColor:r.backgroundColor||"#ffffff",borderRadius:r.borderRadius||"8px",fontFamily:r.fontFamily||"system-ui, -apple-system, sans-serif"}}function Pe({position:r="bottom-right",text:e="Feedback",allowedTypes:t=["feedback","bug_report","feature_request"],theme:o,onSubmit:s,onError:l,children:d}){let{theme:a}=C(),{submitFeedback:n,isSubmitting:c,isSuccess:i,reset:p}=D(),[v,F]=react.useState(false),[y,B]=react.useState(t[0]),[R,T]=react.useState(""),S={...a,...o},A=_e(S),L=react.useCallback(()=>{F(true),p();},[p]),E=react.useCallback(()=>{F(false),T(""),B(t[0]);},[t]),V=react.useCallback(async U=>{U.preventDefault();let g={type:y,message:R};try{await n(g),s?.(g),setTimeout(E,1500);}catch(w){l?.(w instanceof Error?w:new Error("Failed to submit feedback"));}},[y,R,n,s,l,E]);return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{onClick:L,style:{cursor:"pointer"},children:d}),v&&jsxRuntime.jsx(ue,{isOpen:v,onClose:E,selectedType:y,onTypeChange:B,allowedTypes:t,message:R,onMessageChange:T,onSubmit:V,isSubmitting:c,isSuccess:i,themeStyles:A})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:L,style:{...M.button,...qe[r],backgroundColor:A.primaryColor,color:"white",borderRadius:A.borderRadius,fontFamily:A.fontFamily},"aria-label":"Open feedback form",children:e}),v&&jsxRuntime.jsx(ue,{isOpen:v,onClose:E,selectedType:y,onTypeChange:B,allowedTypes:t,message:R,onMessageChange:T,onSubmit:V,isSubmitting:c,isSuccess:i,themeStyles:A})]})}function ue({isOpen:r,onClose:e,selectedType:t,onTypeChange:o,allowedTypes:s,message:l,onMessageChange:d,onSubmit:a,isSubmitting:n,isSuccess:c,themeStyles:i}){return r?c?jsxRuntime.jsx("div",{style:M.modal,onClick:e,children:jsxRuntime.jsxs("div",{style:{...M.modalContent,textAlign:"center",fontFamily:i.fontFamily},onClick:p=>p.stopPropagation(),children:[jsxRuntime.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"\u{1F389}"}),jsxRuntime.jsx("h3",{style:{margin:"0 0 8px 0",color:i.textColor},children:"Thanks for your feedback!"}),jsxRuntime.jsx("p",{style:{margin:0,color:"#666"},children:"We appreciate you taking the time to share."})]})}):jsxRuntime.jsx("div",{style:M.modal,onClick:e,children:jsxRuntime.jsxs("div",{style:{...M.modalContent,fontFamily:i.fontFamily},onClick:p=>p.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[jsxRuntime.jsx("h3",{style:{margin:0,color:i.textColor},children:"Send Feedback"}),jsxRuntime.jsx("button",{onClick:e,style:{background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#999",padding:"0",lineHeight:"1"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("form",{onSubmit:a,children:[jsxRuntime.jsxs("div",{style:{marginBottom:"16px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"8px",fontSize:"13px",color:"#666",fontWeight:"500"},children:"What kind of feedback?"}),jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap"},children:s.map(p=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>o(p),style:{...M.typeButton,backgroundColor:t===p?i.primaryColor:"white",color:t===p?"white":i.textColor,borderColor:t===p?i.primaryColor:"#e0e0e0"},children:[Te[p]," ",Be[p]]},p))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"8px",fontSize:"13px",color:"#666",fontWeight:"500"},children:"Your message"}),jsxRuntime.jsx("textarea",{value:l,onChange:p=>d(p.target.value),placeholder:t==="bug_report"?"Describe the bug and steps to reproduce...":t==="feature_request"?"Describe the feature you would like...":"Share your thoughts...",style:M.textarea,required:true})]}),jsxRuntime.jsx("button",{type:"submit",disabled:n||!l.trim(),style:{...M.submitButton,backgroundColor:i.primaryColor,color:"white",opacity:n||!l.trim()?.6:1,cursor:n||!l.trim()?"not-allowed":"pointer"},children:n?"Sending...":"Send Feedback"})]})]})}):null}var m={container:{fontFamily:"system-ui, -apple-system, sans-serif",maxWidth:"800px"},searchInput:{width:"100%",padding:"12px 16px",border:"1px solid #e0e0e0",borderRadius:"8px",fontSize:"15px",marginBottom:"24px",boxSizing:"border-box"},categoryButton:{padding:"8px 16px",border:"1px solid #e0e0e0",borderRadius:"20px",cursor:"pointer",fontSize:"13px",backgroundColor:"white",transition:"all 0.2s",marginRight:"8px",marginBottom:"8px"},articleCard:{padding:"20px",border:"1px solid #e0e0e0",borderRadius:"8px",marginBottom:"12px",cursor:"pointer",transition:"box-shadow 0.2s, border-color 0.2s",backgroundColor:"white"},articleTitle:{margin:"0 0 8px 0",fontSize:"16px",fontWeight:"600"},articleDescription:{margin:0,fontSize:"14px",color:"#666",lineHeight:1.5},articleMeta:{display:"flex",gap:"16px",marginTop:"12px",fontSize:"12px",color:"#999"},backButton:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"8px 0",border:"none",background:"none",cursor:"pointer",fontSize:"14px",color:"#666",marginBottom:"16px"},articleContent:{lineHeight:1.7,fontSize:"15px"},loading:{textAlign:"center",padding:"40px",color:"#666"},error:{padding:"20px",backgroundColor:"#fef2f2",borderRadius:"8px",color:"#b91c1c",textAlign:"center"},empty:{textAlign:"center",padding:"40px",color:"#666"}};function Ue(r){return {primaryColor:r.primaryColor||"#000000",textColor:r.textColor||"#333333",backgroundColor:r.backgroundColor||"#ffffff",borderRadius:r.borderRadius||"8px",fontFamily:r.fontFamily||"system-ui, -apple-system, sans-serif"}}function ze({showSearch:r=true,showCategories:e=true,defaultCategory:t,theme:o,className:s,onArticleView:l}){let{theme:d}=C(),[a,n]=react.useState(""),[c,i]=react.useState(t),[p,v]=react.useState(null),F={...d,...o},y=Ue(F),{articles:B,isLoading:R,error:T}=J({category:c,search:a||void 0}),{article:S,isLoading:A,error:L}=X(p||""),E=react.useMemo(()=>{let g=new Set;return B.forEach(w=>{w.category&&g.add(w.category);}),Array.from(g).sort()},[B]),V=g=>{v(g.slug),l?.(g);},U=()=>{v(null);};return p?A?jsxRuntime.jsx("div",{style:{...m.container,fontFamily:y.fontFamily},className:s,children:jsxRuntime.jsx("div",{style:m.loading,children:"Loading article..."})}):L?jsxRuntime.jsxs("div",{style:{...m.container,fontFamily:y.fontFamily},className:s,children:[jsxRuntime.jsx("button",{onClick:U,style:m.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsx("div",{style:m.error,children:"Failed to load article. Please try again."})]}):S?jsxRuntime.jsxs("div",{style:{...m.container,fontFamily:y.fontFamily},className:s,children:[jsxRuntime.jsx("button",{onClick:U,style:m.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsxs("article",{children:[jsxRuntime.jsx("h1",{style:{margin:"0 0 16px 0",color:y.textColor},children:S.title}),S.read_time_minutes&&jsxRuntime.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"24px"},children:[S.read_time_minutes," min read"]}),S.content_html?jsxRuntime.jsx("div",{style:{...m.articleContent,color:y.textColor},dangerouslySetInnerHTML:{__html:S.content_html}}):jsxRuntime.jsx("div",{style:{...m.articleContent,color:y.textColor},children:typeof S.content=="string"?S.content:"No content available."})]})]}):jsxRuntime.jsxs("div",{style:{...m.container,fontFamily:y.fontFamily},className:s,children:[jsxRuntime.jsx("button",{onClick:U,style:m.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsx("div",{style:m.empty,children:"Article not found."})]}):jsxRuntime.jsxs("div",{style:{...m.container,fontFamily:y.fontFamily},className:s,children:[r&&jsxRuntime.jsx("input",{type:"text",placeholder:"Search articles...",value:a,onChange:g=>n(g.target.value),style:m.searchInput}),e&&E.length>0&&jsxRuntime.jsxs("div",{style:{marginBottom:"24px"},children:[jsxRuntime.jsx("button",{onClick:()=>i(void 0),style:{...m.categoryButton,backgroundColor:c?"white":y.primaryColor,color:c?y.textColor:"white",borderColor:c?"#e0e0e0":y.primaryColor},children:"All"}),E.map(g=>jsxRuntime.jsx("button",{onClick:()=>i(g),style:{...m.categoryButton,backgroundColor:c===g?y.primaryColor:"white",color:c===g?"white":y.textColor,borderColor:c===g?y.primaryColor:"#e0e0e0"},children:g},g))]}),R&&jsxRuntime.jsx("div",{style:m.loading,children:"Loading articles..."}),T&&jsxRuntime.jsx("div",{style:m.error,children:"Failed to load articles. Please try again."}),!R&&!T&&B.length===0&&jsxRuntime.jsx("div",{style:m.empty,children:a?`No articles found for "${a}"`:"No articles available yet."}),!R&&!T&&B.length>0&&jsxRuntime.jsx("div",{children:B.map(g=>jsxRuntime.jsxs("div",{onClick:()=>V(g),style:m.articleCard,role:"button",tabIndex:0,onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&V(g);},children:[jsxRuntime.jsx("h3",{style:{...m.articleTitle,color:y.textColor},children:g.title}),g.seo_description&&jsxRuntime.jsx("p",{style:m.articleDescription,children:g.seo_description}),jsxRuntime.jsxs("div",{style:m.articleMeta,children:[g.category&&jsxRuntime.jsx("span",{children:g.category}),g.read_time_minutes&&jsxRuntime.jsxs("span",{children:[g.read_time_minutes," min read"]})]})]},g.id))})]})}var f={container:{fontFamily:"system-ui, -apple-system, sans-serif"},list:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:"12px"},card:{border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s"},cardHover:{borderColor:"#d1d5db",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",marginBottom:"8px"},badges:{display:"flex",alignItems:"center",gap:"6px"},badge:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"9999px",fontSize:"12px",fontWeight:500},message:{fontSize:"14px",color:"#111827",margin:0,lineHeight:1.5},meta:{display:"flex",gap:"12px",marginTop:"8px",fontSize:"12px",color:"#6b7280"},empty:{textAlign:"center",padding:"32px 16px",color:"#6b7280"},emptyIcon:{width:"48px",height:"48px",margin:"0 auto 12px",color:"#d1d5db"},loading:{textAlign:"center",padding:"24px",color:"#6b7280"},error:{textAlign:"center",padding:"24px",color:"#dc2626"},voteButton:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"8px",borderRadius:"6px",border:"1px solid #e5e7eb",backgroundColor:"#ffffff",cursor:"pointer",minWidth:"48px",transition:"all 0.15s"},voteButtonActive:{backgroundColor:"#dbeafe",borderColor:"#2563eb",color:"#2563eb"},voteCount:{fontSize:"14px",fontWeight:600,color:"#111827"},cardWithVote:{display:"flex",gap:"12px"},cardContent:{flex:1},form:{marginBottom:"16px",padding:"16px",backgroundColor:"#f9fafb",borderRadius:"8px",border:"1px solid #e5e7eb"},formHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},formTitle:{fontSize:"14px",fontWeight:500,color:"#111827",margin:0},typeSelector:{display:"flex",gap:"8px",marginBottom:"12px"},typeButton:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #e5e7eb",backgroundColor:"#ffffff",fontSize:"13px",cursor:"pointer",transition:"all 0.15s"},typeButtonActive:{backgroundColor:"#111827",borderColor:"#111827",color:"#ffffff"},textarea:{width:"100%",padding:"10px 12px",borderRadius:"6px",border:"1px solid #e5e7eb",fontSize:"14px",resize:"vertical",minHeight:"80px",fontFamily:"inherit",marginBottom:"12px"},submitButton:{padding:"8px 16px",borderRadius:"6px",border:"none",backgroundColor:"#111827",color:"#ffffff",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"opacity 0.15s"},successMessage:{padding:"12px",backgroundColor:"#d1fae5",borderRadius:"6px",color:"#059669",fontSize:"14px",marginBottom:"16px"},ownBadge:{display:"inline-flex",alignItems:"center",padding:"2px 6px",borderRadius:"9999px",fontSize:"11px",fontWeight:500,backgroundColor:"#f3f4f6",color:"#6b7280",marginLeft:"6px"}},fe={feedback:{label:"Feedback",color:"#2563eb",bg:"#dbeafe"},bug_report:{label:"Bug Report",color:"#dc2626",bg:"#fee2e2"},feature_request:{label:"Feature Request",color:"#d97706",bg:"#fef3c7"},article_rating:{label:"Article Rating",color:"#7c3aed",bg:"#ede9fe"}},ge={new:{label:"New",color:"#6b7280",bg:"#f3f4f6"},reviewed:{label:"Reviewed",color:"#2563eb",bg:"#dbeafe"},in_progress:{label:"In Progress",color:"#d97706",bg:"#fef3c7"},resolved:{label:"Resolved",color:"#059669",bg:"#d1fae5"},closed:{label:"Closed",color:"#6b7280",bg:"#f3f4f6"}};function Ge(r){return new Date(r).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}var Le=[{value:"feedback",label:"Feedback"},{value:"bug_report",label:"Bug"},{value:"feature_request",label:"Feature"}];function Ve({status:r,type:e,limit:t=50,className:o,showEmptyState:s=true,onRequestClick:l}){let{isIdentified:d}=C(),[a,n]=react.useState(null),[c,i]=react.useState(false),[p,v]=react.useState("feedback"),[F,y]=react.useState(""),[B,R]=react.useState({}),{requests:T,isLoading:S,error:A,refetch:L,settings:E}=Z({status:r,type:e,limit:t}),{vote:V,isVoting:U}=ee(),{submitFeedback:g,isSubmitting:w,isSuccess:be,reset:ne}=D(),ie=react.useCallback(u=>{l?.(u);},[l]),ye=react.useCallback(async(u,_,W)=>{if(!U){R(O=>({...O,[u]:{count:W?_-1:_+1,hasVoted:!W}}));try{let O=await V(u);R(q=>({...q,[u]:{count:O.vote_count,hasVoted:O.user_has_voted}}));}catch{R(O=>({...O,[u]:{count:_,hasVoted:W}}));}}},[V,U]),me=react.useCallback(async u=>{if(u.preventDefault(),!(!F.trim()||w))try{await g({type:p,message:F}),y(""),i(!1),setTimeout(()=>{L(),ne();},500);}catch{}},[p,F,w,g,L,ne]),he=u=>{let _=B[u.id];return {count:_?.count??u.vote_count,hasVoted:_?.hasVoted??u.user_has_voted}};if(!d)return s?jsxRuntime.jsx("div",{style:f.empty,children:jsxRuntime.jsx("p",{children:"Please sign in to view your requests."})}):null;if(S)return jsxRuntime.jsx("div",{style:f.loading,children:jsxRuntime.jsx("p",{children:"Loading requests..."})});if(A)return jsxRuntime.jsx("div",{style:f.error,children:jsxRuntime.jsxs("p",{children:["Failed to load requests. ",jsxRuntime.jsx("button",{onClick:L,style:{color:"inherit",textDecoration:"underline",background:"none",border:"none",cursor:"pointer"},children:"Try again"})]})});let ae=()=>E.allowRequestCreation?be?jsxRuntime.jsx("div",{style:f.successMessage,children:"Thanks for your feedback! It has been submitted."}):c?jsxRuntime.jsxs("form",{onSubmit:me,style:f.form,children:[jsxRuntime.jsxs("div",{style:f.formHeader,children:[jsxRuntime.jsx("p",{style:f.formTitle,children:"Submit a request"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>i(false),style:{background:"none",border:"none",cursor:"pointer",color:"#6b7280"},children:"\u2715"})]}),jsxRuntime.jsx("div",{style:f.typeSelector,children:Le.map(u=>jsxRuntime.jsx("button",{type:"button",onClick:()=>v(u.value),style:{...f.typeButton,...p===u.value?f.typeButtonActive:{}},children:u.label},u.value))}),jsxRuntime.jsx("textarea",{value:F,onChange:u=>y(u.target.value),placeholder:"Describe your request...",style:f.textarea,required:true}),jsxRuntime.jsx("button",{type:"submit",style:{...f.submitButton,opacity:w?.6:1},disabled:w,children:w?"Submitting...":"Submit"})]}):jsxRuntime.jsxs("button",{onClick:()=>i(true),style:{...f.submitButton,marginBottom:"16px",display:"flex",alignItems:"center",gap:"6px"},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"New Request"]}):null;if(T.length===0&&s)return jsxRuntime.jsxs("div",{style:f.container,className:o,children:[ae(),jsxRuntime.jsxs("div",{style:f.empty,children:[jsxRuntime.jsx("svg",{style:f.emptyIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),jsxRuntime.jsx("p",{style:{margin:0,fontWeight:500,color:"#111827"},children:"No requests yet"}),jsxRuntime.jsx("p",{style:{margin:"8px 0 0",fontSize:"14px"},children:E.allowRequestCreation?"Submit your first request above.":"When you submit feedback, bug reports, or feature requests, they'll appear here."})]})]});let K=E.allowVoting&&E.feedbackVisibility!=="own";return jsxRuntime.jsxs("div",{style:f.container,className:o,children:[ae(),jsxRuntime.jsx("ul",{style:f.list,children:T.map(u=>{let _=fe[u.feedback_type]||fe.feedback,W=ge[u.status]||ge.new,O=a===u.id,q=he(u);return jsxRuntime.jsx("li",{style:{...f.card,...O?f.cardHover:{}},onMouseEnter:()=>n(u.id),onMouseLeave:()=>n(null),children:jsxRuntime.jsxs("div",{style:K?f.cardWithVote:void 0,children:[K&&jsxRuntime.jsxs("button",{onClick:H=>{H.stopPropagation(),ye(u.id,q.count,q.hasVoted);},disabled:U,style:{...f.voteButton,...q.hasVoted?f.voteButtonActive:{}},title:q.hasVoted?"Remove vote":"Upvote this request",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:q.hasVoted?"currentColor":"none",stroke:"currentColor",strokeWidth:2,children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}),jsxRuntime.jsx("span",{style:{...f.voteCount,...q.hasVoted?{color:"#2563eb"}:{}},children:q.count})]}),jsxRuntime.jsxs("div",{style:K?f.cardContent:void 0,onClick:()=>ie(u),role:"button",tabIndex:0,onKeyDown:H=>{(H.key==="Enter"||H.key===" ")&&ie(u);},children:[jsxRuntime.jsx("div",{style:f.header,children:jsxRuntime.jsxs("div",{style:f.badges,children:[jsxRuntime.jsx("span",{style:{...f.badge,color:_.color,backgroundColor:_.bg},children:_.label}),jsxRuntime.jsx("span",{style:{...f.badge,color:W.color,backgroundColor:W.bg},children:W.label}),u.is_own&&jsxRuntime.jsx("span",{style:f.ownBadge,children:"You"})]})}),jsxRuntime.jsx("p",{style:f.message,children:u.message||"No message provided"}),jsxRuntime.jsxs("div",{style:f.meta,children:[jsxRuntime.jsx("span",{children:Ge(u.created_at)}),!K&&q.count>0&&jsxRuntime.jsxs("span",{children:[q.count," vote",q.count!==1?"s":""]}),u.page_url&&jsxRuntime.jsxs("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"200px"},children:["From: ",u.page_url]})]})]})]})},u.id)})})]})}
|
|
2
|
-
exports.CensusProvider=
|
|
1
|
+
'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var Re="https://api.census.ai",Z=class{constructor(e){this.currentUserId=null;if(!e.apiKey)throw new Error("Census: apiKey is required");["cs_live_","cs_test_","op_live_","op_test_"].some(o=>e.apiKey.startsWith(o))||console.warn('Census: API key should start with "cs_live_" or "cs_test_"'),this.apiKey=e.apiKey,this.baseUrl=e.baseUrl||Re,this.debug=e.debug||false,this.log("Initialized with base URL:",this.baseUrl);}async identify(e){if(!e.userId)throw new Error("Census: userId is required for identify()");this.currentUserId=e.userId,await this.request("/api/sdk/identify","POST",{userId:e.userId,email:e.email,name:e.name,avatarUrl:e.avatarUrl,metadata:e.metadata,organizationId:e.organizationId,organizationName:e.organizationName,organizationDomain:e.organizationDomain,organizationPlan:e.organizationPlan}),this.log("User identified:",e.userId);}reset(){this.currentUserId=null,this.log("User identity reset");}async submitFeedback(e){let t=["feedback","bug_report","feature_request","article_rating"];if(!e.type||!t.includes(e.type))throw new Error(`Census: type must be one of: ${t.join(", ")}`);if(e.type==="article_rating"){if(e.rating===void 0&&e.helpful===void 0)throw new Error("Census: article_rating requires rating or helpful field")}else if(!e.message)throw new Error("Census: message is required for this feedback type");let o=await this.request("/api/sdk/feedback","POST",{type:e.type,message:e.message,rating:e.rating,helpful:e.helpful,userId:this.currentUserId,articleId:e.articleId,pageUrl:typeof window<"u"?window.location.href:void 0,metadata:e.metadata});return this.log("Feedback submitted:",o.feedbackId),{feedbackId:o.feedbackId}}async getArticles(e){let t=new URLSearchParams;e?.category&&t.set("category",e.category),e?.search&&t.set("search",e.search),e?.limit&&t.set("limit",String(e.limit)),e?.offset&&t.set("offset",String(e.offset));let o=t.toString(),s=`/api/sdk/articles${o?`?${o}`:""}`,l=await this.request(s,"GET");return this.log("Fetched articles:",l.articles.length),l}async getArticle(e){try{let t=await this.request(`/api/sdk/articles/${encodeURIComponent(e)}`,"GET");return this.log("Fetched article:",e),t.article}catch(t){if(t.status===404)return null;throw t}}async getFeatureGroups(){let e=await this.request("/api/sdk/feature-groups","GET");return this.log("Fetched feature groups:",e.feature_groups.length),e}async getRequests(e){if(!this.currentUserId)throw new Error("Census: User must be identified before fetching requests. Call identify() first.");let t=new URLSearchParams;t.set("userId",this.currentUserId),e?.status&&t.set("status",e.status),e?.type&&t.set("type",e.type),e?.limit&&t.set("limit",String(e.limit)),e?.offset&&t.set("offset",String(e.offset));let o=await this.request(`/api/sdk/requests?${t.toString()}`,"GET");return this.log("Fetched requests:",o.requests.length),o}async vote(e){if(!this.currentUserId)throw new Error("Census: User must be identified before voting. Call identify() first.");if(!e)throw new Error("Census: feedbackId is required for vote()");let t=await this.request("/api/sdk/requests/vote","POST",{feedbackId:e,userId:this.currentUserId});return this.log("Vote result:",t.action,"for feedback:",e),t}async track(e,t){if(!e)throw new Error("Census: eventType is required for track()");await this.request("/api/sdk/events","POST",{eventType:e,userId:this.currentUserId,properties:t}),this.log("Event tracked:",e);}async trackBatch(e){if(!e.events||e.events.length===0)throw new Error("Census: at least one event is required");if(e.events.length>100)throw new Error("Census: maximum 100 events per batch");let t=e.events.map(o=>({eventType:o.eventType,userId:this.currentUserId,articleId:o.articleId,featureId:o.featureId,properties:o.properties}));await this.request("/api/sdk/events","POST",{events:t}),this.log("Batch events tracked:",e.events.length);}async getGuides(){let e=new URLSearchParams;this.currentUserId&&e.set("userId",this.currentUserId);let t=e.toString(),o=`/api/sdk/guides${t?`?${t}`:""}`,s=await this.request(o,"GET");return this.log("Fetched guides:",s.guides.length),s}async getGuide(e){try{let t=new URLSearchParams;this.currentUserId&&t.set("userId",this.currentUserId);let o=t.toString(),s=`/api/sdk/guides/${encodeURIComponent(e)}${o?`?${o}`:""}`,l=await this.request(s,"GET");return this.log("Fetched guide:",e),l.guide}catch(t){if(t.status===404)return null;throw t}}async trackGuideEvent(e){if(!e.guideId||!e.eventType||!e.sessionId)throw new Error("Census: guideId, eventType, and sessionId are required for trackGuideEvent()");await this.request("/api/sdk/guides/events","POST",{guideId:e.guideId,eventType:e.eventType,stepId:e.stepId,stepIndex:e.stepIndex,pageUrl:e.pageUrl||(typeof window<"u"?window.location.href:void 0),sessionId:e.sessionId,userId:e.userId||this.currentUserId,metadata:e.metadata}),this.log("Guide event tracked:",e.eventType,e.guideId);}async markGuideCompleted(e){if(!e)throw new Error("Census: guideId is required for markGuideCompleted()");if(!this.currentUserId)throw new Error("Census: User must be identified before marking guides complete. Call identify() first.");await this.request("/api/sdk/guides/complete","POST",{guideId:e,userId:this.currentUserId}),this.log("Guide marked completed:",e);}getCurrentUserId(){return this.currentUserId}isIdentified(){return this.currentUserId!==null}async request(e,t,o){let s=`${this.baseUrl}${e}`,l={"X-Census-Key":this.apiKey};o&&(l["Content-Type"]="application/json"),this.log(`${t} ${e}`,o);let d=await fetch(s,{method:t,headers:l,body:o?JSON.stringify(o):void 0});if(!d.ok){let i=`Request failed with status ${d.status}`;try{i=(await d.json()).error||i;}catch{}throw {error:i,status:d.status}}return d.json()}log(...e){this.debug&&console.log("[Census]",...e);}};function pe(r){return new Z(r)}var ee=react.createContext(null);function Fe({apiKey:r,baseUrl:e,debug:t,user:o,theme:s={},children:l}){let[d,i]=react.useState(false),[n,a]=react.useState(false),c=react.useMemo(()=>pe({apiKey:r,baseUrl:e,debug:t}),[r,e,t]);react.useEffect(()=>{o?c.identify(o).then(()=>{a(true),i(true);}).catch(C=>{console.error("[Census] Failed to identify user:",C),i(true);}):i(true);},[c,o]);let p=react.useMemo(()=>({client:c,theme:s,isReady:d,isIdentified:n}),[c,s,d,n]);return jsxRuntime.jsx(ee.Provider,{value:p,children:l})}function Te(){let r=react.useContext(ee);if(!r)throw new Error("useCensus must be used within a CensusProvider");return r.client}function v(){let r=react.useContext(ee);if(!r)throw new Error("useCensusContext must be used within a CensusProvider");return r}function qe(){let{client:r}=v(),[e,t]=react.useState(false),[o,s]=react.useState(null);return {identify:async i=>{t(true),s(null);try{await r.identify(i);}catch(n){throw s(n instanceof Error?n:new Error("Failed to identify user")),n}finally{t(false);}},reset:()=>{r.reset();},isIdentifying:e,isIdentified:r.isIdentified(),error:o}}function D(){let{client:r}=v(),[e,t]=react.useState(false),[o,s]=react.useState(false),[l,d]=react.useState(null),[i,n]=react.useState(null),a=react.useCallback(async p=>{t(true),s(false),d(null),n(null);try{let C=await r.submitFeedback(p);return n(C.feedbackId),s(!0),C}catch(C){let S=C instanceof Error?C:new Error("Failed to submit feedback");throw d(S),S}finally{t(false);}},[r]),c=react.useCallback(()=>{s(false),d(null),n(null);},[]);return {submitFeedback:a,reset:c,isSubmitting:e,isSuccess:o,error:l,feedbackId:i}}function te(r){let{client:e,isReady:t}=v(),[o,s]=react.useState(null),[l,d]=react.useState(true),[i,n]=react.useState(null),a=react.useCallback(async()=>{d(true),n(null);try{let c=await e.getArticles(r);s(c);}catch(c){n(c instanceof Error?c:new Error("Failed to fetch articles"));}finally{d(false);}},[e,r?.category,r?.search,r?.limit,r?.offset]);return react.useEffect(()=>{t&&a();},[t,a]),{articles:o?.articles||[],pagination:o?.pagination,isLoading:l,error:i,refetch:a}}function re(r){let{client:e,isReady:t}=v(),[o,s]=react.useState(null),[l,d]=react.useState(true),[i,n]=react.useState(null),a=react.useCallback(async()=>{if(!r){s(null),d(false);return}d(true),n(null);try{let c=await e.getArticle(r);s(c);}catch(c){n(c instanceof Error?c:new Error("Failed to fetch article"));}finally{d(false);}},[e,r]);return react.useEffect(()=>{t&&a();},[t,a]),{article:o,isLoading:l,error:i,refetch:a}}var Be={feedbackVisibility:"own",allowVoting:false,allowRequestCreation:true};function oe(r){let{client:e,isReady:t,isIdentified:o}=v(),[s,l]=react.useState(null),[d,i]=react.useState(true),[n,a]=react.useState(null),c=react.useCallback(async()=>{if(!o){l(null),i(false);return}i(true),a(null);try{let p=await e.getRequests(r);l(p);}catch(p){a(p instanceof Error?p:new Error("Failed to fetch requests"));}finally{i(false);}},[e,o,r?.status,r?.type,r?.limit,r?.offset]);return react.useEffect(()=>{t&&(o?c():i(false));},[t,o,c]),{requests:s?.requests||[],pagination:s?.pagination,settings:s?.settings||Be,isLoading:d,error:n,refetch:c}}function se(){let{client:r}=v(),[e,t]=react.useState(false),[o,s]=react.useState(null);return {vote:react.useCallback(async d=>{t(true),s(null);try{return await r.vote(d)}catch(i){let n=i instanceof Error?i:new Error("Failed to vote");throw s(n),n}finally{t(false);}},[r]),isVoting:e,error:o}}function _e(){let{client:r}=v(),e=react.useCallback(async(o,s)=>{await r.track(o,s);},[r]),t=react.useCallback(async o=>{await r.trackBatch({events:o});},[r]);return {track:e,trackBatch:t}}function Pe(){let{client:r,isReady:e}=v(),[t,o]=react.useState([]),[s,l]=react.useState(true),[d,i]=react.useState(null),n=react.useCallback(async()=>{l(true),i(null);try{let a=await r.getFeatureGroups();o(a.feature_groups);}catch(a){i(a instanceof Error?a:new Error("Failed to fetch feature groups"));}finally{l(false);}},[r]);return react.useEffect(()=>{e&&n();},[e,n]),{featureGroups:t,isLoading:s,error:d,refetch:n}}var M={button:{position:"fixed",padding:"12px 20px",border:"none",borderRadius:"8px",cursor:"pointer",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"14px",fontWeight:"500",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",transition:"transform 0.2s, box-shadow 0.2s",zIndex:9999},modal:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e4},modalContent:{backgroundColor:"white",borderRadius:"12px",padding:"24px",width:"100%",maxWidth:"400px",margin:"16px",boxShadow:"0 20px 50px rgba(0, 0, 0, 0.2)",fontFamily:"system-ui, -apple-system, sans-serif"},textarea:{width:"100%",padding:"10px 12px",border:"1px solid #e0e0e0",borderRadius:"6px",fontSize:"14px",marginBottom:"16px",minHeight:"100px",resize:"vertical",boxSizing:"border-box",fontFamily:"inherit"},submitButton:{width:"100%",padding:"12px",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"14px",fontWeight:"500",transition:"opacity 0.2s"},typeButton:{padding:"8px 16px",border:"1px solid #e0e0e0",borderRadius:"6px",cursor:"pointer",fontSize:"13px",backgroundColor:"white",transition:"all 0.2s",marginRight:"8px",marginBottom:"8px"}},Ae={"bottom-right":{bottom:"20px",right:"20px"},"bottom-left":{bottom:"20px",left:"20px"},"top-right":{top:"20px",right:"20px"},"top-left":{top:"20px",left:"20px"}},Ue={feedback:"General Feedback",bug_report:"Bug Report",feature_request:"Feature Request",article_rating:"Article Rating"},ze={feedback:"\u{1F4AC}",bug_report:"\u{1F41B}",feature_request:"\u{1F4A1}",article_rating:"\u2B50"};function Le(r){return {primaryColor:r.primaryColor||"#000000",textColor:r.textColor||"#333333",backgroundColor:r.backgroundColor||"#ffffff",borderRadius:r.borderRadius||"8px",fontFamily:r.fontFamily||"system-ui, -apple-system, sans-serif"}}function Ge({position:r="bottom-right",text:e="Feedback",allowedTypes:t=["feedback","bug_report","feature_request"],theme:o,onSubmit:s,onError:l,children:d}){let{theme:i}=v(),{submitFeedback:n,isSubmitting:a,isSuccess:c,reset:p}=D(),[C,S]=react.useState(false),[m,E]=react.useState(t[0]),[I,B]=react.useState(""),F={...i,...o},A=Le(F),G=react.useCallback(()=>{S(true),p();},[p]),T=react.useCallback(()=>{S(false),B(""),E(t[0]);},[t]),V=react.useCallback(async U=>{U.preventDefault();let g={type:m,message:I};try{await n(g),s?.(g),setTimeout(T,1500);}catch(w){l?.(w instanceof Error?w:new Error("Failed to submit feedback"));}},[m,I,n,s,l,T]);return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{onClick:G,style:{cursor:"pointer"},children:d}),C&&jsxRuntime.jsx(be,{isOpen:C,onClose:T,selectedType:m,onTypeChange:E,allowedTypes:t,message:I,onMessageChange:B,onSubmit:V,isSubmitting:a,isSuccess:c,themeStyles:A})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:G,style:{...M.button,...Ae[r],backgroundColor:A.primaryColor,color:"white",borderRadius:A.borderRadius,fontFamily:A.fontFamily},"aria-label":"Open feedback form",children:e}),C&&jsxRuntime.jsx(be,{isOpen:C,onClose:T,selectedType:m,onTypeChange:E,allowedTypes:t,message:I,onMessageChange:B,onSubmit:V,isSubmitting:a,isSuccess:c,themeStyles:A})]})}function be({isOpen:r,onClose:e,selectedType:t,onTypeChange:o,allowedTypes:s,message:l,onMessageChange:d,onSubmit:i,isSubmitting:n,isSuccess:a,themeStyles:c}){return r?a?jsxRuntime.jsx("div",{style:M.modal,onClick:e,children:jsxRuntime.jsxs("div",{style:{...M.modalContent,textAlign:"center",fontFamily:c.fontFamily},onClick:p=>p.stopPropagation(),children:[jsxRuntime.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"\u{1F389}"}),jsxRuntime.jsx("h3",{style:{margin:"0 0 8px 0",color:c.textColor},children:"Thanks for your feedback!"}),jsxRuntime.jsx("p",{style:{margin:0,color:"#666"},children:"We appreciate you taking the time to share."})]})}):jsxRuntime.jsx("div",{style:M.modal,onClick:e,children:jsxRuntime.jsxs("div",{style:{...M.modalContent,fontFamily:c.fontFamily},onClick:p=>p.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[jsxRuntime.jsx("h3",{style:{margin:0,color:c.textColor},children:"Send Feedback"}),jsxRuntime.jsx("button",{onClick:e,style:{background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#999",padding:"0",lineHeight:"1"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("form",{onSubmit:i,children:[jsxRuntime.jsxs("div",{style:{marginBottom:"16px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"8px",fontSize:"13px",color:"#666",fontWeight:"500"},children:"What kind of feedback?"}),jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap"},children:s.map(p=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>o(p),style:{...M.typeButton,backgroundColor:t===p?c.primaryColor:"white",color:t===p?"white":c.textColor,borderColor:t===p?c.primaryColor:"#e0e0e0"},children:[ze[p]," ",Ue[p]]},p))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"8px",fontSize:"13px",color:"#666",fontWeight:"500"},children:"Your message"}),jsxRuntime.jsx("textarea",{value:l,onChange:p=>d(p.target.value),placeholder:t==="bug_report"?"Describe the bug and steps to reproduce...":t==="feature_request"?"Describe the feature you would like...":"Share your thoughts...",style:M.textarea,required:true})]}),jsxRuntime.jsx("button",{type:"submit",disabled:n||!l.trim(),style:{...M.submitButton,backgroundColor:c.primaryColor,color:"white",opacity:n||!l.trim()?.6:1,cursor:n||!l.trim()?"not-allowed":"pointer"},children:n?"Sending...":"Send Feedback"})]})]})}):null}var y={container:{fontFamily:"system-ui, -apple-system, sans-serif",maxWidth:"800px"},searchInput:{width:"100%",padding:"12px 16px",border:"1px solid #e0e0e0",borderRadius:"8px",fontSize:"15px",marginBottom:"24px",boxSizing:"border-box"},categoryButton:{padding:"8px 16px",border:"1px solid #e0e0e0",borderRadius:"20px",cursor:"pointer",fontSize:"13px",backgroundColor:"white",transition:"all 0.2s",marginRight:"8px",marginBottom:"8px"},articleCard:{padding:"20px",border:"1px solid #e0e0e0",borderRadius:"8px",marginBottom:"12px",cursor:"pointer",transition:"box-shadow 0.2s, border-color 0.2s",backgroundColor:"white"},articleTitle:{margin:"0 0 8px 0",fontSize:"16px",fontWeight:"600"},articleDescription:{margin:0,fontSize:"14px",color:"#666",lineHeight:1.5},articleMeta:{display:"flex",gap:"16px",marginTop:"12px",fontSize:"12px",color:"#999"},backButton:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"8px 0",border:"none",background:"none",cursor:"pointer",fontSize:"14px",color:"#666",marginBottom:"16px"},articleContent:{lineHeight:1.7,fontSize:"15px"},loading:{textAlign:"center",padding:"40px",color:"#666"},error:{padding:"20px",backgroundColor:"#fef2f2",borderRadius:"8px",color:"#b91c1c",textAlign:"center"},empty:{textAlign:"center",padding:"40px",color:"#666"}};function Oe(r){return {primaryColor:r.primaryColor||"#000000",textColor:r.textColor||"#333333",backgroundColor:r.backgroundColor||"#ffffff",borderRadius:r.borderRadius||"8px",fontFamily:r.fontFamily||"system-ui, -apple-system, sans-serif"}}function J({showSearch:r=true,showCategories:e=true,defaultCategory:t,theme:o,className:s,onArticleView:l}){let{theme:d}=v(),[i,n]=react.useState(""),[a,c]=react.useState(t),[p,C]=react.useState(null),S={...d,...o},m=Oe(S),{articles:E,isLoading:I,error:B}=te({category:a,search:i||void 0}),{article:F,isLoading:A,error:G}=re(p||""),T=react.useMemo(()=>{let g=new Set;return E.forEach(w=>{w.category&&g.add(w.category);}),Array.from(g).sort()},[E]),V=g=>{C(g.slug),l?.(g);},U=()=>{C(null);};return p?A?jsxRuntime.jsx("div",{style:{...y.container,fontFamily:m.fontFamily},className:s,children:jsxRuntime.jsx("div",{style:y.loading,children:"Loading article..."})}):G?jsxRuntime.jsxs("div",{style:{...y.container,fontFamily:m.fontFamily},className:s,children:[jsxRuntime.jsx("button",{onClick:U,style:y.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsx("div",{style:y.error,children:"Failed to load article. Please try again."})]}):F?jsxRuntime.jsxs("div",{style:{...y.container,fontFamily:m.fontFamily},className:s,children:[jsxRuntime.jsx("button",{onClick:U,style:y.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsxs("article",{children:[jsxRuntime.jsx("h1",{style:{margin:"0 0 16px 0",color:m.textColor},children:F.title}),F.read_time_minutes&&jsxRuntime.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"24px"},children:[F.read_time_minutes," min read"]}),F.content_html?jsxRuntime.jsx("div",{style:{...y.articleContent,color:m.textColor},dangerouslySetInnerHTML:{__html:F.content_html}}):jsxRuntime.jsx("div",{style:{...y.articleContent,color:m.textColor},children:typeof F.content=="string"?F.content:"No content available."})]})]}):jsxRuntime.jsxs("div",{style:{...y.container,fontFamily:m.fontFamily},className:s,children:[jsxRuntime.jsx("button",{onClick:U,style:y.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsx("div",{style:y.empty,children:"Article not found."})]}):jsxRuntime.jsxs("div",{style:{...y.container,fontFamily:m.fontFamily},className:s,children:[r&&jsxRuntime.jsx("input",{type:"text",placeholder:"Search articles...",value:i,onChange:g=>n(g.target.value),style:y.searchInput}),e&&T.length>0&&jsxRuntime.jsxs("div",{style:{marginBottom:"24px"},children:[jsxRuntime.jsx("button",{onClick:()=>c(void 0),style:{...y.categoryButton,backgroundColor:a?"white":m.primaryColor,color:a?m.textColor:"white",borderColor:a?"#e0e0e0":m.primaryColor},children:"All"}),T.map(g=>jsxRuntime.jsx("button",{onClick:()=>c(g),style:{...y.categoryButton,backgroundColor:a===g?m.primaryColor:"white",color:a===g?"white":m.textColor,borderColor:a===g?m.primaryColor:"#e0e0e0"},children:g},g))]}),I&&jsxRuntime.jsx("div",{style:y.loading,children:"Loading articles..."}),B&&jsxRuntime.jsx("div",{style:y.error,children:"Failed to load articles. Please try again."}),!I&&!B&&E.length===0&&jsxRuntime.jsx("div",{style:y.empty,children:i?`No articles found for "${i}"`:"No articles available yet."}),!I&&!B&&E.length>0&&jsxRuntime.jsx("div",{children:E.map(g=>jsxRuntime.jsxs("div",{onClick:()=>V(g),style:y.articleCard,role:"button",tabIndex:0,onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&V(g);},children:[jsxRuntime.jsx("h3",{style:{...y.articleTitle,color:m.textColor},children:g.title}),g.seo_description&&jsxRuntime.jsx("p",{style:y.articleDescription,children:g.seo_description}),jsxRuntime.jsxs("div",{style:y.articleMeta,children:[g.category&&jsxRuntime.jsx("span",{children:g.category}),g.read_time_minutes&&jsxRuntime.jsxs("span",{children:[g.read_time_minutes," min read"]})]})]},g.id))})]})}var f={container:{fontFamily:"system-ui, -apple-system, sans-serif"},list:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:"12px"},card:{border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s"},cardHover:{borderColor:"#d1d5db",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",marginBottom:"8px"},badges:{display:"flex",alignItems:"center",gap:"6px"},badge:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"9999px",fontSize:"12px",fontWeight:500},message:{fontSize:"14px",color:"#111827",margin:0,lineHeight:1.5},meta:{display:"flex",gap:"12px",marginTop:"8px",fontSize:"12px",color:"#6b7280"},empty:{textAlign:"center",padding:"32px 16px",color:"#6b7280"},emptyIcon:{width:"48px",height:"48px",margin:"0 auto 12px",color:"#d1d5db"},loading:{textAlign:"center",padding:"24px",color:"#6b7280"},error:{textAlign:"center",padding:"24px",color:"#dc2626"},voteButton:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"8px",borderRadius:"6px",border:"1px solid #e5e7eb",backgroundColor:"#ffffff",cursor:"pointer",minWidth:"48px",transition:"all 0.15s"},voteButtonActive:{backgroundColor:"#dbeafe",borderColor:"#2563eb",color:"#2563eb"},voteCount:{fontSize:"14px",fontWeight:600,color:"#111827"},cardWithVote:{display:"flex",gap:"12px"},cardContent:{flex:1},form:{marginBottom:"16px",padding:"16px",backgroundColor:"#f9fafb",borderRadius:"8px",border:"1px solid #e5e7eb"},formHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},formTitle:{fontSize:"14px",fontWeight:500,color:"#111827",margin:0},typeSelector:{display:"flex",gap:"8px",marginBottom:"12px"},typeButton:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #e5e7eb",backgroundColor:"#ffffff",fontSize:"13px",cursor:"pointer",transition:"all 0.15s"},typeButtonActive:{backgroundColor:"#111827",borderColor:"#111827",color:"#ffffff"},textarea:{width:"100%",padding:"10px 12px",borderRadius:"6px",border:"1px solid #e5e7eb",fontSize:"14px",resize:"vertical",minHeight:"80px",fontFamily:"inherit",marginBottom:"12px"},submitButton:{padding:"8px 16px",borderRadius:"6px",border:"none",backgroundColor:"#111827",color:"#ffffff",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"opacity 0.15s"},successMessage:{padding:"12px",backgroundColor:"#d1fae5",borderRadius:"6px",color:"#059669",fontSize:"14px",marginBottom:"16px"},ownBadge:{display:"inline-flex",alignItems:"center",padding:"2px 6px",borderRadius:"9999px",fontSize:"11px",fontWeight:500,backgroundColor:"#f3f4f6",color:"#6b7280",marginLeft:"6px"}},ye={feedback:{label:"Feedback",color:"#2563eb",bg:"#dbeafe"},bug_report:{label:"Bug Report",color:"#dc2626",bg:"#fee2e2"},feature_request:{label:"Feature Request",color:"#d97706",bg:"#fef3c7"},article_rating:{label:"Article Rating",color:"#7c3aed",bg:"#ede9fe"}},he={new:{label:"New",color:"#6b7280",bg:"#f3f4f6"},reviewed:{label:"Reviewed",color:"#2563eb",bg:"#dbeafe"},in_progress:{label:"In Progress",color:"#d97706",bg:"#fef3c7"},resolved:{label:"Resolved",color:"#059669",bg:"#d1fae5"},closed:{label:"Closed",color:"#6b7280",bg:"#f3f4f6"}};function Me(r){return new Date(r).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}var He=[{value:"feedback",label:"Feedback"},{value:"bug_report",label:"Bug"},{value:"feature_request",label:"Feature"}];function X({status:r,type:e,limit:t=50,className:o,showEmptyState:s=true,onRequestClick:l}){let{isIdentified:d}=v(),[i,n]=react.useState(null),[a,c]=react.useState(false),[p,C]=react.useState("feedback"),[S,m]=react.useState(""),[E,I]=react.useState({}),{requests:B,isLoading:F,error:A,refetch:G,settings:T}=oe({status:r,type:e,limit:t}),{vote:V,isVoting:U}=se(),{submitFeedback:g,isSubmitting:w,isSuccess:Ce,reset:de}=D(),ce=react.useCallback(u=>{l?.(u);},[l]),ve=react.useCallback(async(u,_,H)=>{if(!U){I(O=>({...O,[u]:{count:H?_-1:_+1,hasVoted:!H}}));try{let O=await V(u);I(q=>({...q,[u]:{count:O.vote_count,hasVoted:O.user_has_voted}}));}catch{I(O=>({...O,[u]:{count:_,hasVoted:H}}));}}},[V,U]),ke=react.useCallback(async u=>{if(u.preventDefault(),!(!S.trim()||w))try{await g({type:p,message:S}),m(""),c(!1),setTimeout(()=>{G(),de();},500);}catch{}},[p,S,w,g,G,de]),we=u=>{let _=E[u.id];return {count:_?.count??u.vote_count,hasVoted:_?.hasVoted??u.user_has_voted}};if(!d)return s?jsxRuntime.jsx("div",{style:f.empty,children:jsxRuntime.jsx("p",{children:"Please sign in to view your requests."})}):null;if(F)return jsxRuntime.jsx("div",{style:f.loading,children:jsxRuntime.jsx("p",{children:"Loading requests..."})});if(A)return jsxRuntime.jsx("div",{style:f.error,children:jsxRuntime.jsxs("p",{children:["Failed to load requests. ",jsxRuntime.jsx("button",{onClick:G,style:{color:"inherit",textDecoration:"underline",background:"none",border:"none",cursor:"pointer"},children:"Try again"})]})});let ue=()=>T.allowRequestCreation?Ce?jsxRuntime.jsx("div",{style:f.successMessage,children:"Thanks for your feedback! It has been submitted."}):a?jsxRuntime.jsxs("form",{onSubmit:ke,style:f.form,children:[jsxRuntime.jsxs("div",{style:f.formHeader,children:[jsxRuntime.jsx("p",{style:f.formTitle,children:"Submit a request"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>c(false),style:{background:"none",border:"none",cursor:"pointer",color:"#6b7280"},children:"\u2715"})]}),jsxRuntime.jsx("div",{style:f.typeSelector,children:He.map(u=>jsxRuntime.jsx("button",{type:"button",onClick:()=>C(u.value),style:{...f.typeButton,...p===u.value?f.typeButtonActive:{}},children:u.label},u.value))}),jsxRuntime.jsx("textarea",{value:S,onChange:u=>m(u.target.value),placeholder:"Describe your request...",style:f.textarea,required:true}),jsxRuntime.jsx("button",{type:"submit",style:{...f.submitButton,opacity:w?.6:1},disabled:w,children:w?"Submitting...":"Submit"})]}):jsxRuntime.jsxs("button",{onClick:()=>c(true),style:{...f.submitButton,marginBottom:"16px",display:"flex",alignItems:"center",gap:"6px"},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"New Request"]}):null;if(B.length===0&&s)return jsxRuntime.jsxs("div",{style:f.container,className:o,children:[ue(),jsxRuntime.jsxs("div",{style:f.empty,children:[jsxRuntime.jsx("svg",{style:f.emptyIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),jsxRuntime.jsx("p",{style:{margin:0,fontWeight:500,color:"#111827"},children:"No requests yet"}),jsxRuntime.jsx("p",{style:{margin:"8px 0 0",fontSize:"14px"},children:T.allowRequestCreation?"Submit your first request above.":"When you submit feedback, bug reports, or feature requests, they'll appear here."})]})]});let N=T.allowVoting&&T.feedbackVisibility!=="own";return jsxRuntime.jsxs("div",{style:f.container,className:o,children:[ue(),jsxRuntime.jsx("ul",{style:f.list,children:B.map(u=>{let _=ye[u.feedback_type]||ye.feedback,H=he[u.status]||he.new,O=i===u.id,q=we(u);return jsxRuntime.jsx("li",{style:{...f.card,...O?f.cardHover:{}},onMouseEnter:()=>n(u.id),onMouseLeave:()=>n(null),children:jsxRuntime.jsxs("div",{style:N?f.cardWithVote:void 0,children:[N&&jsxRuntime.jsxs("button",{onClick:j=>{j.stopPropagation(),ve(u.id,q.count,q.hasVoted);},disabled:U,style:{...f.voteButton,...q.hasVoted?f.voteButtonActive:{}},title:q.hasVoted?"Remove vote":"Upvote this request",children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:q.hasVoted?"currentColor":"none",stroke:"currentColor",strokeWidth:2,children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})}),jsxRuntime.jsx("span",{style:{...f.voteCount,...q.hasVoted?{color:"#2563eb"}:{}},children:q.count})]}),jsxRuntime.jsxs("div",{style:N?f.cardContent:void 0,onClick:()=>ce(u),role:"button",tabIndex:0,onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&ce(u);},children:[jsxRuntime.jsx("div",{style:f.header,children:jsxRuntime.jsxs("div",{style:f.badges,children:[jsxRuntime.jsx("span",{style:{...f.badge,color:_.color,backgroundColor:_.bg},children:_.label}),jsxRuntime.jsx("span",{style:{...f.badge,color:H.color,backgroundColor:H.bg},children:H.label}),u.is_own&&jsxRuntime.jsx("span",{style:f.ownBadge,children:"You"})]})}),jsxRuntime.jsx("p",{style:f.message,children:u.message||"No message provided"}),jsxRuntime.jsxs("div",{style:f.meta,children:[jsxRuntime.jsx("span",{children:Me(u.created_at)}),!N&&q.count>0&&jsxRuntime.jsxs("span",{children:[q.count," vote",q.count!==1?"s":""]}),u.page_url&&jsxRuntime.jsxs("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"200px"},children:["From: ",u.page_url]})]})]})]})},u.id)})})]})}var De={articles:"Articles",requests:"My Requests"},K={container:{fontFamily:"system-ui, -apple-system, sans-serif"},tabsContainer:{display:"flex",gap:"4px",padding:"4px",backgroundColor:"#f3f4f6",borderRadius:"8px",marginBottom:"24px"},tab:{flex:1,padding:"8px 16px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",cursor:"pointer",transition:"all 0.15s",backgroundColor:"transparent",color:"#6b7280"},tabActive:{backgroundColor:"#ffffff",color:"#111827",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.05)"}};function $e({tabs:r=["articles","requests"],defaultTab:e="articles",tabLabels:t={},showSearch:o=true,showCategories:s=true,className:l}){let[d,i]=react.useState(e),n={...De,...t};return r.length===1?jsxRuntime.jsxs("div",{style:K.container,className:l,children:[r[0]==="articles"&&jsxRuntime.jsx(J,{showSearch:o,showCategories:s}),r[0]==="requests"&&jsxRuntime.jsx(X,{})]}):jsxRuntime.jsxs("div",{style:K.container,className:l,children:[jsxRuntime.jsx("div",{style:K.tabsContainer,children:r.map(a=>jsxRuntime.jsx("button",{onClick:()=>i(a),style:{...K.tab,...d===a?K.tabActive:{}},children:n[a]},a))}),d==="articles"&&r.includes("articles")&&jsxRuntime.jsx(J,{showSearch:o,showCategories:s}),d==="requests"&&r.includes("requests")&&jsxRuntime.jsx(X,{})]})}
|
|
2
|
+
exports.CensusProvider=Fe;exports.FeedbackButton=Ge;exports.HelpCenter=$e;exports.KnowledgeBase=J;exports.Requests=X;exports.useArticle=re;exports.useArticles=te;exports.useCensus=Te;exports.useCensusContext=v;exports.useFeatureGroups=Pe;exports.useFeedback=D;exports.useIdentify=qe;exports.useRequests=oe;exports.useTrack=_e;exports.useVote=se;//# sourceMappingURL=index.cjs.map
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|