fansunited-widgets-cdn 0.0.43 → 0.0.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.
- package/fu-widgets.iife.js +1 -1
- package/package.json +1 -1
package/fu-widgets.iife.js
CHANGED
|
@@ -292,7 +292,7 @@ export default theme;`}function Gb(t={},...e){const{breakpoints:i,mixins:n={},sp
|
|
|
292
292
|
opacity: 1;
|
|
293
293
|
transform: translateY(0);
|
|
294
294
|
}
|
|
295
|
-
`,Eo={heroSection:{position:"relative",borderRadius:"sm",overflow:"hidden","& iframe":{width:"100% !important",borderRadius:"sm"}},heroImage:{objectFit:"cover",filter:"brightness(0.85)"},heroOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0,background:"linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.3) 50%, rgba(0,0,0,0.2) 80%)",display:"flex",flexDirection:"column",justifyContent:"flex-end",py:0,px:2},heroTitle:{color:"white",lineHeight:"1.2",textShadow:"0 2px 4px rgba(0,0,0,0.3)",fontSize:{xs:"xl",sm:"xl3"},mb:1},heroDescription:{color:"#fff",fontFamily:"Inter, sans-serif",fontSize:{xs:"xs",sm:"md"}},optionButton:{width:"100%",justifyContent:"flex-start",textAlign:"left",p:2,mb:1,transition:"all 0.2s","&:hover":{transform:"translateY(-1px)",boxShadow:"sm"}},resultBar:{position:"relative",height:"8px",bgcolor:"background.level2",borderRadius:"4px",overflow:"hidden",animation:`${oge} 0.5s ease-out`},resultBarFill:{position:"absolute",left:0,top:0,height:"100%",bgcolor:"primary.500",transition:"width 1s ease-out"},resultText:{display:"flex",justifyContent:"space-between",alignItems:"center",mt:.5},totalVotes:{mt:3,textAlign:"center",color:"text.secondary"}},lD=({poll:t,onVote:e})=>{const[i,n]=I.useState(null),[r,o]=I.useState(!1),a=br(),{t:s}=Ll(),u=async()=>{if(i)try{o(!0),await a.voting.voteForPoll(t.id,i);const p=t.options.map(g=>({...g,votes:g.id===i?(g.votes||0)+1:g.votes})),f={...t,options:p,totalVotes:(t.totalVotes||0)+1};e(f)}catch(p){console.error("Failed to submit vote:",p)}finally{o(!1)}};return F.jsxs(It,{spacing:2,children:[F.jsx(It,{spacing:1,children:t.options.map(p=>F.jsx(mi,{variant:i===p.id?"solid":"soft",color:i===p.id?"primary":"neutral",onClick:()=>n(p.id),sx:Eo.optionButton,disabled:r,children:p.title},p.id))}),i&&F.jsx(mi,{variant:"solid",color:"primary",onClick:u,loading:r,sx:{mt:2},children:s("polls.vote_action")})]})},cD=({poll:t})=>{const e=i=>t.totalVotes?Math.round(i/t.totalVotes*100):0;return F.jsxs(It,{spacing:3,children:[F.jsx(It,{spacing:2,children:t.options.map((i,n)=>{const r=e(i.votes);return F.jsx(pw.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:n*.1},children:F.jsxs(Me,{children:[F.jsx(Qe,{level:"body-md",fontWeight:600,sx:{mb:1},children:i.title}),F.jsx(Me,{sx:Eo.resultBar,children:F.jsx(Me,{sx:{...Eo.resultBarFill,width:`${r}%`}})}),F.jsxs(Me,{sx:Eo.resultText,children:[F.jsxs(Qe,{level:"body-sm",children:[i.votes," ",$e("polls.vote",{count:i.votes??0})]}),F.jsxs(Qe,{level:"body-sm",fontWeight:"bold",children:[r,"%"]})]})]})},i.id)})}),F.jsx(Me,{sx:Eo.totalVotes,children:F.jsxs(Qe,{level:"body-sm",startDecorator:F.jsx(Of,{size:16}),children:[t.totalVotes," ",$e("polls.total_votes")]})})]})},age=({initialPollId:t})=>{var C,P,R,B,L,b,M,K,Q,Y,J,j,G,ee,le,W;const[e,i]=I.useState(null),[n,r]=I.useState(!0),[o,a]=I.useState(null),[s,u]=I.useState(!1),[p,f]=I.useState(!1),g=br(),{t:m}=Ll(),{position:A,fields:v,campaignId:w,campaignName:k}=fT();I.useEffect(()=>{if(!e)return;const te=!!(s||!e.authRequirement||e.authRequirement!=="LEAD"||e.authRequirement==="LEAD"&&A==="after");f(te)},[e,A,s]);const T=async()=>{try{r(!0),a(null);const ne=await g.voting.getPollById(t,!0);i(ne)}catch(ne){console.error("Failed to fetch poll:",ne),a("Failed to load poll. Please try again.")}finally{r(!1)}},D=ne=>{g.voting.getMyPollVote(ne).then(te=>{u(!!te)}).catch(te=>{te.error.code===404?console.log("User has not voted yet"):te.error.code===500?console.error("Internal error:",te):console.error("Failed to check if user voted:",te)})};I.useEffect(()=>{t&&(T(),D(t))},[t]);const x=ne=>{ne&&i(ne),u(!0)},U=()=>{f(!0)};return n?F.jsx(Ry,{}):o||!e?null:F.jsx(jn,{sx:{borderColor:"divider","&:hover":{borderColor:"divider"}},children:F.jsxs(It,{spacing:2,children:[e.embedCode?F.jsxs(F.Fragment,{children:[F.jsxs(Me,{sx:{y:2},children:[F.jsx(Qe,{level:"
|
|
295
|
+
`,Eo={heroSection:{position:"relative",borderRadius:"sm",overflow:"hidden","& iframe":{width:"100% !important",borderRadius:"sm"}},heroImage:{objectFit:"cover",filter:"brightness(0.85)"},heroOverlay:{position:"absolute",top:0,left:0,right:0,bottom:0,background:"linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.3) 50%, rgba(0,0,0,0.2) 80%)",display:"flex",flexDirection:"column",justifyContent:"flex-end",py:0,px:2},heroTitle:{color:"white",lineHeight:"1.2",textShadow:"0 2px 4px rgba(0,0,0,0.3)",fontSize:{xs:"xl",sm:"xl3"},mb:1},heroDescription:{color:"#fff",fontFamily:"Inter, sans-serif",fontSize:{xs:"xs",sm:"md"}},optionButton:{width:"100%",justifyContent:"flex-start",textAlign:"left",p:2,mb:1,transition:"all 0.2s","&:hover":{transform:"translateY(-1px)",boxShadow:"sm"}},resultBar:{position:"relative",height:"8px",bgcolor:"background.level2",borderRadius:"4px",overflow:"hidden",animation:`${oge} 0.5s ease-out`},resultBarFill:{position:"absolute",left:0,top:0,height:"100%",bgcolor:"primary.500",transition:"width 1s ease-out"},resultText:{display:"flex",justifyContent:"space-between",alignItems:"center",mt:.5},totalVotes:{mt:3,textAlign:"center",color:"text.secondary"}},lD=({poll:t,onVote:e})=>{const[i,n]=I.useState(null),[r,o]=I.useState(!1),a=br(),{t:s}=Ll(),u=async()=>{if(i)try{o(!0),await a.voting.voteForPoll(t.id,i);const p=t.options.map(g=>({...g,votes:g.id===i?(g.votes||0)+1:g.votes})),f={...t,options:p,totalVotes:(t.totalVotes||0)+1};e(f)}catch(p){console.error("Failed to submit vote:",p)}finally{o(!1)}};return F.jsxs(It,{spacing:2,children:[F.jsx(It,{spacing:1,children:t.options.map(p=>F.jsx(mi,{variant:i===p.id?"solid":"soft",color:i===p.id?"primary":"neutral",onClick:()=>n(p.id),sx:Eo.optionButton,disabled:r,children:p.title},p.id))}),i&&F.jsx(mi,{variant:"solid",color:"primary",onClick:u,loading:r,sx:{mt:2},children:s("polls.vote_action")})]})},cD=({poll:t})=>{const e=i=>t.totalVotes?Math.round(i/t.totalVotes*100):0;return F.jsxs(It,{spacing:3,children:[F.jsx(It,{spacing:2,children:t.options.map((i,n)=>{const r=e(i.votes);return F.jsx(pw.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:n*.1},children:F.jsxs(Me,{children:[F.jsx(Qe,{level:"body-md",fontWeight:600,sx:{mb:1},children:i.title}),F.jsx(Me,{sx:Eo.resultBar,children:F.jsx(Me,{sx:{...Eo.resultBarFill,width:`${r}%`}})}),F.jsxs(Me,{sx:Eo.resultText,children:[F.jsxs(Qe,{level:"body-sm",children:[i.votes," ",$e("polls.vote",{count:i.votes??0})]}),F.jsxs(Qe,{level:"body-sm",fontWeight:"bold",children:[r,"%"]})]})]})},i.id)})}),F.jsx(Me,{sx:Eo.totalVotes,children:F.jsxs(Qe,{level:"body-sm",startDecorator:F.jsx(Of,{size:16}),children:[t.totalVotes," ",$e("polls.total_votes")]})})]})},age=({initialPollId:t})=>{var C,P,R,B,L,b,M,K,Q,Y,J,j,G,ee,le,W;const[e,i]=I.useState(null),[n,r]=I.useState(!0),[o,a]=I.useState(null),[s,u]=I.useState(!1),[p,f]=I.useState(!1),g=br(),{t:m}=Ll(),{position:A,fields:v,campaignId:w,campaignName:k}=fT();I.useEffect(()=>{if(!e)return;const te=!!(s||!e.authRequirement||e.authRequirement!=="LEAD"||e.authRequirement==="LEAD"&&A==="after");f(te)},[e,A,s]);const T=async()=>{try{r(!0),a(null);const ne=await g.voting.getPollById(t,!0);i(ne)}catch(ne){console.error("Failed to fetch poll:",ne),a("Failed to load poll. Please try again.")}finally{r(!1)}},D=ne=>{g.voting.getMyPollVote(ne).then(te=>{u(!!te)}).catch(te=>{te.error.code===404?console.log("User has not voted yet"):te.error.code===500?console.error("Internal error:",te):console.error("Failed to check if user voted:",te)})};I.useEffect(()=>{t&&(T(),D(t))},[t]);const x=ne=>{ne&&i(ne),u(!0)},U=()=>{f(!0)};return n?F.jsx(Ry,{}):o||!e?null:F.jsx(jn,{sx:{borderColor:"divider","&:hover":{borderColor:"divider"}},children:F.jsxs(It,{spacing:2,children:[e.embedCode?F.jsxs(F.Fragment,{children:[F.jsxs(Me,{sx:{y:2},children:[F.jsx(Qe,{level:"h3",children:e.title}),e.description&&F.jsx("div",{dangerouslySetInnerHTML:{__html:e.description},style:Eo.heroDescription})]}),F.jsx(Me,{sx:{...Eo.heroSection},children:F.jsx("div",{dangerouslySetInnerHTML:{__html:e.embedCode}})})]}):(C=e.images)!=null&&C.main||(P=e.images)!=null&&P.cover?F.jsxs(Me,{sx:Eo.heroSection,children:[F.jsx(rf,{ratio:16/9,children:F.jsx("img",{src:((R=e.images)==null?void 0:R.main)||((B=e.images)==null?void 0:B.cover),alt:e.title,style:Eo.heroImage,loading:"lazy",onError:ne=>ne.currentTarget.style.display="none"})}),F.jsx(Me,{sx:Eo.heroOverlay,children:F.jsxs(pw.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:[F.jsx(Me,{sx:{display:"flex",gap:1.5,alignItems:"center",mb:1},children:F.jsx(Qe,{level:"body-sm",startDecorator:F.jsx(Of,{size:16,color:"white"}),children:e.totalVotes})}),F.jsx(Qe,{level:"h3",sx:Eo.heroTitle,children:e.title}),F.jsx("div",{dangerouslySetInnerHTML:{__html:e.description},style:Eo.heroDescription})]})})]}):F.jsxs(Me,{sx:{y:2},children:[F.jsx(Qe,{level:"h3",children:e.title}),e.description&&F.jsx("div",{dangerouslySetInnerHTML:{__html:e.description},style:Eo.heroDescription})]}),gT(e.flags)&&F.jsx(JT,{title:((L=e.labels)==null?void 0:L.prizeCardTitle)??m("prize.title"),description:((b=e.labels)==null?void 0:b.prizeCardDescription)??m("prize.description"),cta:m("prize.cta"),rules:e.rules}),A==="before"&&e.authRequirement==="LEAD"?p?s?F.jsx(cD,{poll:e}):F.jsx(lD,{poll:e,onVote:x}):F.jsx(Wy,{onSuccess:U,contentType:"poll",contentId:e.id,contentName:e.title,campaignId:w,campaignName:k,fields:v,leadTitle:(M=e.labels)==null?void 0:M.leadTitle,leadDescription:(K=e.labels)==null?void 0:K.leadDescription,leadCta:(Q=e.labels)==null?void 0:Q.leadCta,leadSuccessTitle:(Y=e.labels)==null?void 0:Y.leadSuccessTitle,leadSuccessDescription:(J=e.labels)==null?void 0:J.leadSuccessDescription}):s?F.jsx(cD,{poll:e}):F.jsx(lD,{poll:e,onVote:x}),A==="after"&&e.authRequirement==="LEAD"&&s&&F.jsx(Wy,{contentType:"poll",contentId:e.id,contentName:e.title,fields:v,campaignId:w,campaignName:k,leadTitle:(j=e.labels)==null?void 0:j.leadTitle,leadDescription:(G=e.labels)==null?void 0:G.leadDescription,leadCta:(ee=e.labels)==null?void 0:ee.leadCta,leadSuccessTitle:(le=e.labels)==null?void 0:le.leadSuccessTitle,leadSuccessDescription:(W=e.labels)==null?void 0:W.leadSuccessDescription})]})})};var sge=Object.defineProperty,lge=(t,e,i)=>e in t?sge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ke=(t,e,i)=>lge(t,typeof e!="symbol"?e+"":e,i);function cge(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var uD={exports:{}},$f={};/**
|
|
296
296
|
* @license React
|
|
297
297
|
* react-jsx-runtime.production.js
|
|
298
298
|
*
|