@apollosproject/canvas-embeds 2.1.2195 → 2.1.2197
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/package.json +1 -1
- package/widget/index.js +1 -1
package/package.json
CHANGED
package/widget/index.js
CHANGED
|
@@ -868,7 +868,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
868
868
|
title
|
|
869
869
|
url
|
|
870
870
|
}
|
|
871
|
-
`);const At1=(a=[],{showUnmappedFeatures:t=!1}={})=>a?.filter(n=>(n?.features||[]).some(r=>r&&(Object.keys(r).some(l=>!["id","__typename"].includes(l))||t&&!!r.__typename)))||[],Zt1=a=>typeof a.percentComplete=="number",Ht1=a=>Zt1(a)||!!a.childContentItemsConnection?.edges?.length,Et1=({content:a,pageCount:t,enabled:n})=>{const r=fY0(),[l,i]=e.useState(null),o=e.useCallback(v=>i(v),[]),s=e.useRef(null),c=e.useRef(null),m=t>1,h=n&&!Ht1(a)&&!a.isCompleted,p=e.useCallback(()=>{!h||c.current===a.id||(c.current=a.id,r?.({contentItem:{id:a.id},action:"COMPLETE"}))},[h,a.id,r]);return e.useEffect(()=>{!n||s.current===a.id||(s.current=a.id,r?.({contentItem:{id:a.id},action:"VIEW"}),m||p())},[p,a.id,n,m,r]),e.useEffect(()=>{if(!h||!m||!l||typeof IntersectionObserver>"u")return;const v=new IntersectionObserver(A=>{A.some(Z=>Z.isIntersecting)&&(p(),v.disconnect())});return v.observe(l),()=>v.disconnect()},[h,p,m,l]),{readingEndRef:o}},Mt1=a=>!!(a&&("embedHtml"in a&&a.embedHtml||a.sources?.some(t=>!!t?.uri))),yt1=({content:a,setIsCTAOpen:t,setInteractionType:n})=>T.jsx("div",{className:"flex justify-end",children:T.jsxs("div",{className:"fixed right-0 bottom-0 mr-4 [@media(width>=56rem)]:mr-8 [@media(width>=80rem)]:-mr-72 [@media(width>=80rem)]:right-auto mt-4 mb-8 py-1 flex flex-col justify-between items-center",children:[T.jsx("div",{className:"mb-4",children:T.jsx(f2,{onClick:()=>{t(!0),n(C4.Like)},circular:!0,children:T.jsxs("div",{className:"flex flex-col px-1.5 items-center",children:[T.jsx(mA,{weight:a?.isLiked?"fill":"regular",size:20,className:`md:hidden ${a?.isLiked?"fill-action":"text-action"}`}),T.jsx(mA,{weight:a?.isLiked?"fill":"regular",size:28,className:`hidden md:flex ${a?.isLiked?"fill-action":"text-action"}`}),a.likedCount?T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"absolute -bottom-2.5 bg-white dark:bg-brand px-2 rounded-full text-xs z-9",children:T.jsx(ge,{fg:"secondary",className:"text-sm text-white dark:text-brand",children:a.likedCount})}),T.jsx("span",{className:"absolute -bottom-2.5 bg-accent/20 dark:bg-brand px-2 rounded-full text-xs z-10",children:T.jsx(ge,{fg:"secondary",className:"text-sm text-accent/100",children:a.likedCount})})]}):null]})})}),a.commentsEnabled?T.jsx("div",{className:"mb-4",children:T.jsx(f2,{onClick:()=>{t(!0),n(C4.Comment)},circular:!0,children:T.jsxs("div",{className:"flex flex-col px-1.5 items-center",children:[T.jsx(nL,{weight:"fill",size:20,className:"md:hidden text-action"}),T.jsx(nL,{weight:"fill",size:28,className:"hidden md:flex text-action"}),_l(a.comments)?null:T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"absolute -bottom-2.5 bg-white dark:bg-brand px-2 rounded-full text-xs z-9",children:T.jsx(ge,{fg:"secondary",className:"text-sm text-white dark:text-brand",children:a.comments?.length??0})}),T.jsx("span",{className:"absolute -bottom-2.5 bg-accent/20 dark:bg-brand px-2 rounded-full text-xs z-10",children:T.jsx(ge,{fg:"secondary",className:"text-sm text-accent/100",children:a.comments?.length??0})})]})]})})}):null,a.sharing?T.jsxs(gt1,{circular:!0,sharable:a.sharing,children:[T.jsx(iL,{weight:"fill",size:20,className:"mx-1.5 text-fg-secondary dark:text-fg-secondary-dark md:hidden"}),T.jsx(iL,{weight:"fill",size:28,className:"mx-2 text-fg-secondary dark:text-fg-secondary-dark hidden md:flex"})]}):T.jsx("div",{})]})}),Vt1=({content:a,currentChurch:t,isInteractionEnabled:n=!1,userCanComment:r,userProfile:l,theme:i,executedConnectFeatureId:o,guideProgressEnabled:s=!1})=>{const c=Th0(),[m,h]=e.useState(!1),[p,v]=e.useState(C4.Default),A=gL(),Z=e.useMemo(()=>At1(a.pages,{showUnmappedFeatures:A}),[a.pages,A]),{readingEndRef:E}=Et1({content:a,pageCount:Z?.length??0,enabled:s});if(!a)return null;const M=[...a?.videos??[],...a?.audios??[]].find(Mt1),S=!!M,L=M?.__typename==="AudioMedia",_=!!a?.coverImage,N=a?.childContentItemsConnection?.edges??[],V=a?.siblingContentItemsConnection?.edges??[],C="md:border md:border-system-regular md:rounded-3xl py-6 md:p-6 mb-8 border-b border-b-system-regular",P=Z?.length&&Z?.length>1;return T.jsxs(Rv0,{children:[T.jsxs("div",{className:P?C:"",children:[_&&!S?T.jsx(u5,{image:a?.coverImage??void 0,className:"h-full w-full object-cover rounded-xl"}):null,S&&L?T.jsx(jh0,{media:M,coverImage:a?.coverImage??void 0,content:a??void 0,shouldSendInteractions:!!r}):null,S&&!L?T.jsx(xb,{media:M,coverImage:a?.coverImage??void 0,content:a??void 0,shouldSendInteractions:!!r}):null,T.jsxs("div",{className:`${S||_?"mt-6 md:mt-12":""} mb-4 mx-auto [&>*]:mx-auto [&>*]:max-w-[65ch]`,children:[T.jsx("div",{className:"prose dark:prose-invert",children:T.jsx(ge,{as:"h1",children:a.title})}),T.jsx("div",{className:"h-px bg-system-thin my-8"}),a.htmlContent?T.jsx(AL,{feature:{content:a.htmlContent}}):null,Z?.length?T.jsx("div",{className:"flex flex-col gap-4",children:T.jsx(i_,{features:Z[0]?.features??[],church:t,userProfile:l,isInteractionEnabled:n,theme:i,executedConnectFeatureId:o})}):null]})]}),Z?.slice(1).map(x=>x&&x.features?.length&&x.features.length>0&&T.jsx("div",{className:C,children:T.jsx("div",{className:"flex flex-col gap-4",children:T.jsx(i_,{features:x.features??[],church:t,userProfile:l,isInteractionEnabled:n,theme:i,executedConnectFeatureId:o})})},x.id)),T.jsx("div",{ref:E,"data-testid":"content-item-reading-end"}),T.jsxs("div",{className:"mx-auto [&>*]:mx-auto [&>*]:max-w-[65ch]",children:[n?T.jsx(yt1,{content:a,setIsCTAOpen:h,setInteractionType:v}):null,N.length?T.jsx(Jm,{className:"mt-10",children:N.map(x=>{const $=(x?.node?.coverImage?.sources??[])[0]?.uri;return T.jsx(X7,{as:Bg,to:{contentId:x?.node?.id},title:x?.node?.title??void 0,subtitle:x?.node?.summary,leadingAccessory:T.jsx(o5,{src:$??void 0}),trailingAccessory:T.jsx(vn,{})},x?.node?.id)})}):null,a?.parentItem?T.jsxs("div",{className:"mt-12",children:[T.jsx(ge,{as:"h3",className:"mb-4",children:"This series"}),T.jsx(ah0,{content:a?.parentItem})]}):null,V.length?T.jsxs("div",{className:"mt-10",children:[T.jsx(ge,{as:"h3",children:"In this series"}),T.jsx(KF,{children:V.map(x=>T.jsx(ah0,{content:x?.node??void 0,tile:!0},x?.node?.id))})]}):null]}),T.jsx(Gb,{type:p,currentPageParams:c,isOpen:m,setIsOpen:h,church:t,hasComments:!_l(a.comments),hasLikes:!!(a?.likedCount??0),isInteractionEnabled:n,theme:i})]})};xe(`
|
|
871
|
+
`);const At1=(a=[],{showUnmappedFeatures:t=!1}={})=>a?.filter(n=>(n?.features||[]).some(r=>r&&(Object.keys(r).some(l=>!["id","__typename"].includes(l))||t&&!!r.__typename)))||[],Zt1=a=>typeof a.percentComplete=="number",Ht1=a=>Zt1(a)||!!a.childContentItemsConnection?.edges?.length,Et1=({content:a,pageCount:t,enabled:n})=>{const r=fY0(),[l,i]=e.useState(null),o=e.useCallback(v=>i(v),[]),s=e.useRef(null),c=e.useRef(null),m=t>1,h=n&&!Ht1(a)&&!a.isCompleted,p=e.useCallback(()=>{!h||c.current===a.id||(c.current=a.id,r?.({contentItem:{id:a.id},action:"COMPLETE"}))},[h,a.id,r]);return e.useEffect(()=>{!n||s.current===a.id||(s.current=a.id,r?.({contentItem:{id:a.id},action:"VIEW"}),m||p())},[p,a.id,n,m,r]),e.useEffect(()=>{if(!h||!m||!l||typeof IntersectionObserver>"u")return;const v=new IntersectionObserver(A=>{A.some(Z=>Z.isIntersecting)&&(p(),v.disconnect())});return v.observe(l),()=>v.disconnect()},[h,p,m,l]),{readingEndRef:o}},Mt1=a=>!!(a&&("embedHtml"in a&&a.embedHtml||a.sources?.some(t=>!!t?.uri))),yt1=({content:a,setIsCTAOpen:t,setInteractionType:n})=>T.jsx("div",{className:"flex justify-end",children:T.jsxs("div",{className:"fixed right-0 bottom-0 mr-4 [@media(width>=56rem)]:mr-8 [@media(width>=80rem)]:-mr-72 [@media(width>=80rem)]:right-auto mt-4 mb-8 py-1 flex flex-col justify-between items-center",children:[T.jsx("div",{className:"mb-4",children:T.jsx(f2,{onClick:()=>{t(!0),n(C4.Like)},circular:!0,children:T.jsxs("div",{className:"flex flex-col px-1.5 items-center",children:[T.jsx(mA,{weight:a?.isLiked?"fill":"regular",size:20,className:`md:hidden ${a?.isLiked?"fill-action":"text-action"}`}),T.jsx(mA,{weight:a?.isLiked?"fill":"regular",size:28,className:`hidden md:flex ${a?.isLiked?"fill-action":"text-action"}`}),a.likedCount?T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"absolute -bottom-2.5 bg-white dark:bg-brand px-2 rounded-full text-xs z-9",children:T.jsx(ge,{fg:"secondary",className:"text-sm text-white dark:text-brand",children:a.likedCount})}),T.jsx("span",{className:"absolute -bottom-2.5 bg-accent/20 dark:bg-brand px-2 rounded-full text-xs z-10",children:T.jsx(ge,{fg:"secondary",className:"text-sm text-accent/100",children:a.likedCount})})]}):null]})})}),a.commentsEnabled?T.jsx("div",{className:"mb-4",children:T.jsx(f2,{onClick:()=>{t(!0),n(C4.Comment)},circular:!0,children:T.jsxs("div",{className:"flex flex-col px-1.5 items-center",children:[T.jsx(nL,{weight:"fill",size:20,className:"md:hidden text-action"}),T.jsx(nL,{weight:"fill",size:28,className:"hidden md:flex text-action"}),_l(a.comments)?null:T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"absolute -bottom-2.5 bg-white dark:bg-brand px-2 rounded-full text-xs z-9",children:T.jsx(ge,{fg:"secondary",className:"text-sm text-white dark:text-brand",children:a.comments?.length??0})}),T.jsx("span",{className:"absolute -bottom-2.5 bg-accent/20 dark:bg-brand px-2 rounded-full text-xs z-10",children:T.jsx(ge,{fg:"secondary",className:"text-sm text-accent/100",children:a.comments?.length??0})})]})]})})}):null,a.sharing?T.jsxs(gt1,{circular:!0,sharable:a.sharing,children:[T.jsx(iL,{weight:"fill",size:20,className:"mx-1.5 text-fg-secondary dark:text-fg-secondary-dark md:hidden"}),T.jsx(iL,{weight:"fill",size:28,className:"mx-2 text-fg-secondary dark:text-fg-secondary-dark hidden md:flex"})]}):T.jsx("div",{})]})}),Vt1=({content:a,currentChurch:t,isInteractionEnabled:n=!1,userCanComment:r,userProfile:l,theme:i,executedConnectFeatureId:o,guideProgressEnabled:s=!1})=>{const c=Th0(),[m,h]=e.useState(!1),[p,v]=e.useState(C4.Default),A=gL(),Z=e.useMemo(()=>At1(a.pages,{showUnmappedFeatures:A}),[a.pages,A]),{readingEndRef:E}=Et1({content:a,pageCount:Z?.length??0,enabled:s});if(!a)return null;const M=[...a?.videos??[],...a?.audios??[]].find(Mt1),S=!!M,L=M?.__typename==="AudioMedia",_=!!a?.coverImage,N=a?.childContentItemsConnection?.edges??[],V=a?.siblingContentItemsConnection?.edges??[],C="md:border md:border-system-regular md:rounded-3xl py-6 md:p-6 mb-8 border-b border-b-system-regular",P=Z?.length&&Z?.length>1;return T.jsxs(Rv0,{children:[T.jsxs("div",{className:P?C:"",children:[_&&!S?T.jsx(u5,{image:a?.coverImage??void 0,className:"h-full w-full object-cover rounded-xl"}):null,S&&L?T.jsx(jh0,{media:M,coverImage:a?.coverImage??void 0,content:a??void 0,shouldSendInteractions:!!r}):null,S&&!L?T.jsx(xb,{media:M,coverImage:a?.coverImage??void 0,content:a??void 0,shouldSendInteractions:!!r}):null,T.jsxs("div",{className:`${S||_?"mt-6 md:mt-12":""} mb-4 mx-auto [&>*]:mx-auto [&>*]:max-w-[65ch]`,children:[T.jsx("div",{className:"prose dark:prose-invert",children:T.jsx(ge,{as:"h1",children:a.title})}),T.jsx("div",{className:"h-px bg-system-thin my-8"}),a.htmlContent?T.jsx(AL,{feature:{content:a.htmlContent}}):null,Z?.length?T.jsx("div",{className:"mt-8 flex flex-col gap-4",children:T.jsx(i_,{features:Z[0]?.features??[],church:t,userProfile:l,isInteractionEnabled:n,theme:i,executedConnectFeatureId:o})}):null]})]}),Z?.slice(1).map(x=>x&&x.features?.length&&x.features.length>0&&T.jsx("div",{className:C,children:T.jsx("div",{className:"flex flex-col gap-4",children:T.jsx(i_,{features:x.features??[],church:t,userProfile:l,isInteractionEnabled:n,theme:i,executedConnectFeatureId:o})})},x.id)),T.jsx("div",{ref:E,"data-testid":"content-item-reading-end"}),T.jsxs("div",{className:"mx-auto [&>*]:mx-auto [&>*]:max-w-[65ch]",children:[n?T.jsx(yt1,{content:a,setIsCTAOpen:h,setInteractionType:v}):null,N.length?T.jsx(Jm,{className:"mt-10",children:N.map(x=>{const $=(x?.node?.coverImage?.sources??[])[0]?.uri;return T.jsx(X7,{as:Bg,to:{contentId:x?.node?.id},title:x?.node?.title??void 0,subtitle:x?.node?.summary,leadingAccessory:T.jsx(o5,{src:$??void 0}),trailingAccessory:T.jsx(vn,{})},x?.node?.id)})}):null,a?.parentItem?T.jsxs("div",{className:"mt-12",children:[T.jsx(ge,{as:"h3",className:"mb-4",children:"This series"}),T.jsx(ah0,{content:a?.parentItem})]}):null,V.length?T.jsxs("div",{className:"mt-10",children:[T.jsx(ge,{as:"h3",children:"In this series"}),T.jsx(KF,{children:V.map(x=>T.jsx(ah0,{content:x?.node??void 0,tile:!0},x?.node?.id))})]}):null]}),T.jsx(Gb,{type:p,currentPageParams:c,isOpen:m,setIsOpen:h,church:t,hasComments:!_l(a.comments),hasLikes:!!(a?.likedCount??0),isInteractionEnabled:n,theme:i})]})};xe(`
|
|
872
872
|
fragment ContentItemFragment on ContentItem {
|
|
873
873
|
id
|
|
874
874
|
title
|