@apollosproject/canvas-embeds 2.1.176 → 2.1.178

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/widget/index.js +1 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apollosproject/canvas-embeds",
3
3
  "description": "Apollos React embed widgets",
4
- "version": "2.1.176",
4
+ "version": "2.1.178",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.es.js",
package/widget/index.js CHANGED
@@ -655,7 +655,7 @@ Valid keys: `+JSON.stringify(Object.keys(a0),null," "));var g0=v0(Q,A0,$0,o0,R0
655
655
  title
656
656
  url
657
657
  }
658
- `);const Ok1="https://cdn.iframe.ly/api/iframely",$k1="64420707babbbe919d6fabff62b8371a",wk1=async a=>{try{const e=encodeURIComponent(a);return await(await fetch(`${Ok1}?url=${e}&key=${$k1}&theme=light`)).json()}catch(e){return console.error("Failed to fetch embed data from Iframely:",e),null}},Lk1=a=>{var n,l,o,c,m,d,h,g,Z,b,E;const e=(n=a.links.thumbnail)==null?void 0:n[0],r=e&&e.media.width>e.media.height&&Math.abs(e.media.width-e.media.height)/e.media.width<.5;return{site:a.meta.site||void 0,title:a.meta.title||void 0,description:a.meta.description||void 0,canonical:a.meta.canonical||void 0,thumbnail:r&&((e==null?void 0:e.href)||((o=(l=a.links.logo)==null?void 0:l[0])==null?void 0:o.href))||void 0,favicon:r?((m=(c=a.links.icon)==null?void 0:c[0])==null?void 0:m.href)||((h=(d=a.links.image)==null?void 0:d[0])==null?void 0:h.href)||(e==null?void 0:e.href)||void 0:((Z=(g=a.links.icon)==null?void 0:g[0])==null?void 0:Z.href)||((E=(b=a.links.image)==null?void 0:b[0])==null?void 0:E.href)||void 0}},Sk1=({src:a,title:e})=>P.jsx($v,{src:a,alt:e||"Link Preview",className:"my-0"}),jk1=({src:a})=>P.jsx("img",{className:"h-8 w-8 rounded-md m-0",src:a,alt:"Link Icon",loading:"lazy"}),Fk1=({site:a})=>a?P.jsx(F2,{as:"p",className:"text-sm text-gray-500 m-0",children:a}):null,Pk1=({site:a,title:e,canonical:r,description:n,thumbnail:l,favicon:o})=>P.jsxs(El,{children:[l?P.jsx(Sk1,{src:l,title:e}):null,P.jsxs(Ov,{children:[P.jsxs("div",{className:"flex items-center justify-start flex-row gap-2",children:[o?P.jsx(jk1,{src:o}):null,P.jsx(Fk1,{site:a})]}),e?P.jsx(F2,{as:"h3",className:"mt-4",children:e}):null,r?P.jsx(F2,{as:"p",className:"line-clamp-1 text-sm text-gray-400 my-0",children:r}):null,n?P.jsx(F2,{as:"p",className:"line-clamp-4",children:n}):null]})]}),_k1=({embedHtml:a})=>P.jsx(El,{className:"relative cursor-pointer overflow-hidden rounded-xl",children:P.jsx("div",{dangerouslySetInnerHTML:{__html:a}})}),kk1=({url:a=""})=>{const[e,r]=p.useState(null),[n,l]=p.useState(!0),[o,c]=p.useState(null);p.useEffect(()=>{a&&(async()=>{l(!0);const h=await wk1(a);if(!h){r(null),c(null),l(!1);return}r(Lk1(h)),Array.isArray(h.rel)&&["player","app","reader","survey"].some(Z=>{var b;return(b=h.rel)==null?void 0:b.includes(Z)})&&c(h.html||null),l(!1)})()},[a]);const m=()=>n?P.jsx(Ck1,{}):o?P.jsx(_k1,{embedHtml:o}):P.jsx(Pk1,{...e});return P.jsx("div",{className:"w-full min-w-96",children:m()})},Ck1=()=>P.jsx("div",{className:"text-primary-700 transition-all duration-500 flex flex-row justify-center items-center h-28",children:P.jsx(fg,{className:"h-5 w-5 animate-spin"})}),Nk1=({feature:a})=>{const{church:e,accessToken:r}=qV();if(!a.url)return null;const n=Wv({originalUrl:a.url,church:e,accessToken:r});return P.jsx("div",{className:"mt-8 mb-10",children:P.jsx(kk1,{url:n})})};E2(`
658
+ `);const Ok1="https://cdn.iframe.ly/api/iframely",$k1="64420707babbbe919d6fabff62b8371a",wk1=async a=>{try{const e=encodeURIComponent(a);return await(await fetch(`${Ok1}?url=${e}&key=${$k1}&theme=light`)).json()}catch(e){return console.error("Failed to fetch embed data from Iframely:",e),null}},Lk1=a=>{var n,l,o,c,m,d,h,g,Z,b,E;const e=(n=a.links.thumbnail)==null?void 0:n[0],r=e&&e.media.width>e.media.height&&Math.abs(e.media.width-e.media.height)/e.media.width<.5;return{site:a.meta.site||void 0,title:a.meta.title||void 0,description:a.meta.description||void 0,canonical:a.meta.canonical||void 0,thumbnail:r&&((e==null?void 0:e.href)||((o=(l=a.links.logo)==null?void 0:l[0])==null?void 0:o.href))||void 0,favicon:r?((m=(c=a.links.icon)==null?void 0:c[0])==null?void 0:m.href)||((h=(d=a.links.image)==null?void 0:d[0])==null?void 0:h.href)||(e==null?void 0:e.href)||void 0:((Z=(g=a.links.icon)==null?void 0:g[0])==null?void 0:Z.href)||((E=(b=a.links.image)==null?void 0:b[0])==null?void 0:E.href)||void 0}},Sk1=({src:a,title:e})=>P.jsx($v,{src:a,alt:e||"Link Preview",className:"my-0"}),jk1=({src:a})=>P.jsx("img",{className:"h-8 w-8 rounded-md m-0",src:a,alt:"Link Icon",loading:"lazy"}),Fk1=({site:a})=>a?P.jsx(F2,{as:"p",className:"text-sm text-gray-500 m-0",children:a}):null,Pk1=({site:a,title:e,canonical:r,description:n,thumbnail:l,favicon:o})=>P.jsxs(El,{children:[l?P.jsx(Sk1,{src:l,title:e}):null,P.jsxs(Ov,{children:[P.jsxs("div",{className:"flex items-center justify-start flex-row gap-2",children:[o?P.jsx(jk1,{src:o}):null,P.jsx(Fk1,{site:a})]}),e?P.jsx(F2,{as:"h3",className:"mt-4 mb-0",children:e}):null,r?P.jsx(F2,{as:"p",className:"line-clamp-1 text-sm text-gray-400 my-0",children:r}):null,n?P.jsx(F2,{as:"p",className:"mt-4 mb-0 line-clamp-4",children:n}):null]})]}),_k1=({embedHtml:a})=>P.jsx(El,{className:"relative cursor-pointer overflow-hidden rounded-xl",children:P.jsx("div",{dangerouslySetInnerHTML:{__html:a}})}),kk1=({url:a=""})=>{const[e,r]=p.useState(null),[n,l]=p.useState(!0),[o,c]=p.useState(null);p.useEffect(()=>{a&&(async()=>{l(!0);const h=await wk1(a);if(!h){r(null),c(null),l(!1);return}r(Lk1(h)),Array.isArray(h.rel)&&["player","app","reader","survey"].some(Z=>{var b;return(b=h.rel)==null?void 0:b.includes(Z)})&&c(h.html||null),l(!1)})()},[a]);const m=()=>n?P.jsx(Ck1,{}):o?P.jsx(_k1,{embedHtml:o}):P.jsx(Pk1,{...e});return P.jsx("div",{className:"w-full min-w-96",children:m()})},Ck1=()=>P.jsx("div",{className:"text-primary-700 transition-all duration-500 flex flex-row justify-center items-center h-28",children:P.jsx(fg,{className:"h-5 w-5 animate-spin"})}),Nk1=({feature:a})=>{const{church:e,accessToken:r}=qV();if(!a.url)return null;const n=Wv({originalUrl:a.url,church:e,accessToken:r});return P.jsx("div",{className:"mt-8 mb-10",children:P.jsx(kk1,{url:n})})};E2(`
659
659
  fragment WebviewFeatureFragment on WebviewFeature {
660
660
  id
661
661
  title