@apollosproject/canvas-embeds 2.1.558 → 2.1.560
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 +2 -2
package/package.json
CHANGED
package/widget/index.js
CHANGED
|
@@ -1902,7 +1902,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1902
1902
|
}
|
|
1903
1903
|
}
|
|
1904
1904
|
}
|
|
1905
|
-
`;function QL(a={}){var r;const e=X3(MXt,{fetchPolicy:"cache-and-network",errorPolicy:"all",...a});return{campuses:((r=e==null?void 0:e.data)==null?void 0:r.campuses)||[],...e}}const S71=p.createContext("light"),L71=p.createContext(null),F71=()=>{const a=p.useContext(S71);if(a===void 0)throw new Error("useColorScheme must be used within a ThemeProvider");return a},VXt=()=>{const a=p.useContext(L71);if(a===void 0)throw new Error("useTheme must be used within a ThemeProvider");return a},KL=a=>{if(!a)return null;const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);return e?`${parseInt(e[1],16)} ${parseInt(e[2],16)} ${parseInt(e[3],16)}`:null},j71=()=>{if(typeof window>"u")return"light";const a=document.documentElement;return a.classList.contains("dark")?"dark":a.classList.contains("light")?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"};function P71({theme:a=Qe,...e}){const[r,n]=p.useState(j71),[l,o]=p.useState({...Qe,colors:{...Qe.colors[r],base:{...Qe.colors[r].base,primary:Qe.colors[r].base.primary,secondary:Qe.colors[r].base.secondary,tertiary:Qe.colors[r].base.tertiary},text:{...Qe.colors[r].text,action:Qe.colors[r].text.action}}}),{currentChurch:c,loading:m,error:u}=YL();return p.useEffect(()=>{if(typeof window>"u")return;const h=()=>{const E=j71();E!==r&&n(E)},g=new MutationObserver(h);g.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]});const A=window.matchMedia("(prefers-color-scheme: dark)"),y=E=>{const M=document.documentElement;!M.classList.contains("dark")&&!M.classList.contains("light")&&n(E.matches?"dark":"light")};return A.addEventListener("change",y),()=>{g.disconnect(),A.removeEventListener("change",y)}},[r]),p.useEffect(()=>{o({...Qe,colors:{...Qe.colors[r],base:{...Qe.colors[r].base,primary:Qe.colors[r].base.primary,secondary:Qe.colors[r].base.secondary,tertiary:Qe.colors[r].base.tertiary},text:{...Qe.colors[r].text,action:Qe.colors[r].text.action}}})},[r]),p.useEffect(()=>{var h,g,A,y,E,M,O;if(c&&c.theme)try{const $=JSON.parse(c==null?void 0:c.theme);o({...Qe,colors:{...Qe.colors[r],base:{...Qe.colors[r].base,primary:((h=$==null?void 0:$.colors)==null?void 0:h.primary)||Qe.colors[r].base.primary,secondary:((g=$==null?void 0:$.colors)==null?void 0:g.secondary)||Qe.colors[r].base.secondary,tertiary:((A=$==null?void 0:$.colors)==null?void 0:A.tertiary)||Qe.colors[r].base.tertiary},text:{...Qe.colors[r].text,action:((y=$==null?void 0:$.colors)==null?void 0:y.secondary)||Qe.colors[r].text.action}}});const F=document.documentElement;if((E=$==null?void 0:$.colors)!=null&&E.primary){const j=KL($.colors.primary);j&&F.style.setProperty("--color-brand-primary",j)}if((M=$==null?void 0:$.colors)!=null&&M.secondary){const j=KL($.colors.secondary);j&&F.style.setProperty("--color-brand-secondary",j)}if((O=$==null?void 0:$.colors)!=null&&O.tertiary){const j=KL($.colors.tertiary);j&&F.style.setProperty("--color-brand-tertiary",j)}}catch($){console.error("ThemeProvider - Error parsing church theme:",$),console.error("ThemeProvider - Raw theme string:",c.theme)}},[c,r]),S.jsx(Yi1,{theme:l,children:S.jsx(S71.Provider,{value:r,children:S.jsx(L71.Provider,{value:l,children:e.children})})})}P71.propTypes={children:Y0.node.isRequired,theme:Y0.object};const yZ=[{id:"Weekly",intervalUnit:"day",intervalCount:7},{id:"Every 2 Weeks",intervalUnit:"day",intervalCount:14},{id:"Monthly",intervalUnit:"month",intervalCount:1}],XL=a=>a&&a.id?a.id:!1,k71=a=>{if(!XL(a))return"one-time";const e=a.id.toLowerCase();return e==="monthly"?"monthly":e==="weekly"?"weekly":e==="every 2 weeks"?"every-2-weeks":"monthly"},OXt=a=>{switch(a){case"weekly":return"Weekly";case"every-2-weeks":return"Every 2 Weeks";case"monthly":return"Monthly";case"one-time":return null;case void 0:return null;default:return"Monthly"}},$d=a=>{if(a==="one-time")return null;const e=OXt(a);return yZ.find(r=>r.id===e)||null},$Xt=a=>{if(a==="one-time")return{interval:"off",intervalCount:1};const e=$d(a);return e?{interval:e.intervalUnit,intervalCount:e.intervalCount}:{interval:"month",intervalCount:1}};function wXt(a){return a?a.toLowerCase().replace(/[^a-z0-9\s]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,""):""}function wd(a,e){if(!a||!e)return!1;const r=wXt(e);return a===r||a===r.replace(/-/g,"_")||a===r.replace(/_/g,"-")}function SXt(a){if(typeof a!="string"||!a.length)return!1;const e=a.match(/^[0-9]{10,10}$/);return e?e.length===1:!1}const JL=({churchName:a,churchLogo:e,message:r,title:n,displayLogo:l,theme:o})=>{var u,h;const c=l!=="false"&&e,m=n&&n.trim()!==""?n:`Give to ${a}`;return S.jsxs("div",{className:"sticky top-0 z-10 px-6 py-4 bg-system-chrome dark:bg-system-chrome-dark text-center",children:[c?S.jsx("div",{className:"mb-3",children:S.jsx("div",{className:"w-20 h-20 rounded-full flex items-center justify-center mx-auto",style:{backgroundColor:((h=(u=o==null?void 0:o.colors)==null?void 0:u.base)==null?void 0:h.primary)||"#00676D"},children:S.jsx("img",{src:e,alt:`${a} logo`,className:"max-w-[60px] max-h-[60px] object-contain"})})}):null,m?S.jsx(ge,{as:"h4",className:"text-lg font-medium",children:m}):null,r&&r!==""?S.jsx(ge,{className:"text-sm mt-2",fg:"secondary",children:r}):null]})};JL.propTypes={churchName:Y0.string.isRequired,churchLogo:Y0.string,message:Y0.string,title:Y0.string,displayLogo:Y0.string};const _71=({amount:a,selectedFrequency:e,selectedCampusId:r,selectedFundId:n,onSuccess:l,onError:o,isProcessing:c=!1,onProcessingChange:m,onBack:u,userFullName:h,userEmail:g,userPhone:A,churchName:y,churchLogo:E,message:M,displayLogo:O,title:$,displayHeader:F})=>{var n0;const j=gXt(),_=dXt(),{currentChurch:N}=YL(),{campuses:k}=QL(),[I,z]=p.useState(!1),[B,e0]=p.useState(h||""),[W,i0]=p.useState(g||""),l0=F71()==="dark",o0=_0=>{const B0=_0.replace(/\D/g,"").slice(0,10);return B0.length===0?"":B0.length<=3?B0:B0.length<=6?`(${B0.slice(0,3)}) ${B0.slice(3)}`:`(${B0.slice(0,3)}) ${B0.slice(3,6)}-${B0.slice(6)}`},[G,D0]=p.useState(A?o0(A):""),S0=_0=>{const h0=o0(_0.target.value);D0(h0)},Z0=()=>typeof a=="string"?parseFloat(a):a,w0=XL(e),Q=k.find(_0=>_0.id===r),q=(n0=Q==null?void 0:Q.donationFunds)==null?void 0:n0.find(_0=>_0.id===n),t0=()=>{const _0={name:`${(Q==null?void 0:Q.name)||"Church"} Donation`,amount:Math.round(Z0()*100)};return q&&(_0.name=`${q.displayName||q.name} Donation`),[_0]},s0=()=>!w0||!e?void 0:{recurringPaymentRequest:{paymentDescription:`${y} ${e.id} donation`,managementURL:(N==null?void 0:N.givingWebUrl)||window.location.href,regularBilling:{amount:Math.round(Z0()*100),label:`${e.id} donation`,recurringPaymentIntervalUnit:e.intervalUnit,recurringPaymentIntervalCount:e.intervalCount}}},H0=async _0=>{const{error:h0,paymentIntent:B0}=_0;if(h0)throw console.error("Payment error:",h0),o(h0),new Error(h0.message);if(B0&&B0.status==="succeeded")return typeof l=="function"&&l(),!0;if(B0&&B0.status==="requires_action")console.warn("Payment requires additional action:",B0),o(new Error("Payment requires additional authentication"));else{if(B0&&B0.status==="processing")return console.warn("Payment is being processed:",B0),typeof l=="function"&&l(),!0;console.warn("Payment not successful, status:",B0==null?void 0:B0.status),o(new Error(`Payment not successful. Status: ${(B0==null?void 0:B0.status)||"unknown"}`))}return!1},b0=async(_0={})=>{if(!j||!_)throw new Error("Stripe or Elements not available");const h0={elements:_,redirect:"if_required",confirmParams:{payment_method_data:{billing_details:{name:B,email:W,phone:G},metadata:{amount:Z0().toString(),frequency:e?e.id:"one-time",campusId:r||"",fundId:n||"",isRecurring:w0&&e?"true":"false",churchSlug:(N==null?void 0:N.slug)||""}},..._0}};return await j.confirmPayment(h0)},m0=async _0=>{var h0,B0,Q0,h1;if(!j||!_)throw new Error("Stripe or Elements not available");try{const{error:_1}=await _.submit();if(_1)throw _1;const{error:H1,confirmationToken:d1}=await j.createConfirmationToken({elements:_,params:{payment_method_data:{billing_details:{email:(h0=_0.detail)==null?void 0:h0.email,phone:(B0=_0.detail)==null?void 0:B0.phone,name:(Q0=_0.detail)==null?void 0:Q0.name},metadata:{amount:Z0().toString(),frequency:e?e.id:"one-time",campusId:r||"",fundId:n||"",isRecurring:w0&&e?"true":"false",churchSlug:(N==null?void 0:N.slug)||""}},return_url:window.location.href}});if(H1)throw H1;return await j.confirmPayment({clientSecret:(h1=_._lastSubmittedOptions)==null?void 0:h1.clientSecret,confirmParams:{confirmation_token:d1.id}})}catch(_1){throw console.error("Express checkout payment error:",_1),_1}},x0=async _0=>{if(_0.preventDefault(),!j||!_)return;if(!B.trim()){o(new Error("Please enter your full name"));return}if(!W.trim()){o(new Error("Please enter your email address"));return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(W)){o(new Error("Please enter a valid email address"));return}if(!SXt(G.replace(/\D/g,""))){o(new Error("Please enter a valid 10-digit phone number"));return}m(!0);let B0=!1;try{const Q0=await b0();B0=await H0(Q0)}catch(Q0){console.error("Payment error:",Q0),o(Q0)}finally{B0||m(!1)}},X=async _0=>{if(!j)return;m(!0);let h0=!1;try{const B0=await m0(_0);h0=await H0(B0)}catch(B0){console.error("Express checkout payment error:",B0),o(B0)}finally{h0||m(!1)}},v0=()=>{z(!0)},f0=(N==null?void 0:N.givingFullPlatform)===!0?void 0:t0(),y0=(N==null?void 0:N.givingFullPlatform)===!0?void 0:s0(),g0=(N==null?void 0:N.givingFullPlatform)===!0?void 0:{emailRequired:!0,phoneNumberRequired:!0,lineItems:f0,applePay:y0,buttonType:{applePay:"donate",googlePay:"donate"},buttonTheme:{applePay:l0?"white":"black",googlePay:l0?"white":"black"},paymentMethods:{amazonPay:"never",applePay:"auto",googlePay:"auto",link:"never",paypal:"never",klarna:"never"}};return S.jsx("div",{className:"flex flex-col h-full min-h-[400px]",children:S.jsxs("form",{onSubmit:x0,className:"h-full flex flex-col",children:[S.jsx(Ge,{type:"button",onClick:u,disabled:c,surface:"tinted",circular:!0,className:"absolute top-4 left-4 z-20 w-10 h-10 flex items-center justify-center",children:S.jsx(sw,{size:20})}),F!=="false"?S.jsx(JL,{churchName:y,churchLogo:E,message:M,title:$,displayLogo:O,theme:null}):null,(N==null?void 0:N.givingFullPlatform)===!0?S.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:S.jsxs("div",{className:"space-y-4",children:[S.jsxs(hw1,{className:"space-y-2",children:[S.jsxs(lO,{className:"[&>[data-slot=label]+[data-slot=control]]:mt-1",children:[S.jsx(oO,{htmlFor:"fullName",className:"!font-normal !text-gray-700 dark:!text-gray-300",children:"Full Name"}),S.jsx(_l,{type:"text",id:"fullName",name:"fullName",value:B,onChange:_0=>e0(_0.target.value),required:!0,placeholder:"Enter your full name",className:"text-sm h-11 px-3 py-2"})]}),S.jsxs(lO,{className:"[&>[data-slot=label]+[data-slot=control]]:mt-1",children:[S.jsx(oO,{htmlFor:"email",className:"!font-normal !text-gray-700 dark:!text-gray-300",children:"Email Address"}),S.jsx(_l,{type:"email",id:"email",name:"email",value:W,onChange:_0=>i0(_0.target.value),required:!0,placeholder:"Enter your email address",className:"text-sm h-11 px-3 py-2"})]}),S.jsxs(lO,{className:"[&>[data-slot=label]+[data-slot=control]]:mt-1",children:[S.jsx(oO,{htmlFor:"phoneNumber",className:"!font-normal !text-gray-700 dark:!text-gray-300",children:"Phone Number"}),S.jsx(_l,{type:"tel",id:"phoneNumber",name:"phoneNumber",value:G,onChange:S0,required:!0,placeholder:"(555) 555-5555",className:"text-sm h-11 px-3 py-2"})]})]}),S.jsx("div",{children:S.jsx(AXt,{options:{paymentMethodOrder:["us_bank_account","card"],wallets:{applePay:"auto",googlePay:"auto",link:"never"},fields:{billingDetails:{name:"never",email:"never",phone:"never",address:"auto"}}}})})]})}):S.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:S.jsx("div",{className:"h-full flex items-center justify-center",children:S.jsxs("div",{className:"text-center space-y-2",children:[S.jsxs("div",{className:"flex items-start justify-center",children:[S.jsx("span",{className:"text-3xl leading-normal font-bold text-brand",children:"$"}),S.jsx("span",{className:"text-[60px] font-bold text-brand leading-none",children:Z0()})]}),S.jsxs("div",{className:"space-y-1",children:[S.jsxs("div",{className:"flex items-center justify-center gap-2",children:[S.jsxs(ge,{className:"text-sm",fg:"secondary",children:[w0&&e?e.id:"One-time"," ","Donation"]}),w0&&e?S.jsx(ge,{className:"text-sm",fg:"secondary",children:"Recurring payment"}):null]}),Q&&q?S.jsxs("div",{className:"flex items-center justify-center gap-2",children:[S.jsx(ge,{className:"text-sm",fg:"secondary",children:Q.name}),S.jsx(ge,{className:"text-sm",fg:"secondary",children:"•"}),S.jsx(ge,{className:"text-sm",fg:"secondary",children:q.displayName||q.name})]}):null]})]})})}),S.jsx("div",{className:"sticky bottom-0 z-10 p-4 border-t border-system-regular bg-system-chrome dark:bg-system-chrome-dark dark:border-white/5",children:(N==null?void 0:N.givingFullPlatform)===!0?S.jsxs("div",{className:"space-y-4",children:[S.jsx(Ge,{type:"submit",className:"w-full",disabled:!j||c,surface:"solid",children:c?"Processing...":`Complete $${Z0()} ${w0&&e?e.id:"one-time"} Donation`}),S.jsx(ge,{className:"text-sm text-center",fg:"secondary",children:"Your payment is secure and encrypted"})]}):S.jsxs("div",{className:"space-y-4",style:{display:I?"block":"none"},children:[S.jsx(ZXt,{options:g0,onConfirm:X,onReady:v0}),S.jsxs(Ge,{href:N==null?void 0:N.givingWebUrl,target:"_blank",rel:"noopener noreferrer",className:"w-full !rounded-[5px]",disabled:!j||c,surface:"system",children:[S.jsx(pw,{size:20}),"Other Payment Methods"]})]})})]})})};_71.propTypes={amount:Y0.oneOfType([Y0.string,Y0.number]).isRequired,selectedFrequency:Y0.object,selectedCampusId:Y0.string,selectedFundId:Y0.string,onSuccess:Y0.func.isRequired,onError:Y0.func.isRequired,isProcessing:Y0.bool,onProcessingChange:Y0.func.isRequired,onBack:Y0.func.isRequired,churchName:Y0.string.isRequired,churchLogo:Y0.string,message:Y0.string,displayLogo:Y0.string,title:Y0.string,displayHeader:Y0.string};const LXt=`
|
|
1905
|
+
`;function QL(a={}){var r;const e=X3(MXt,{fetchPolicy:"cache-and-network",errorPolicy:"all",...a});return{campuses:((r=e==null?void 0:e.data)==null?void 0:r.campuses)||[],...e}}const S71=p.createContext("light"),L71=p.createContext(null),F71=()=>{const a=p.useContext(S71);if(a===void 0)throw new Error("useColorScheme must be used within a ThemeProvider");return a},VXt=()=>{const a=p.useContext(L71);if(a===void 0)throw new Error("useTheme must be used within a ThemeProvider");return a},KL=a=>{if(!a)return null;const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);return e?`${parseInt(e[1],16)} ${parseInt(e[2],16)} ${parseInt(e[3],16)}`:null},j71=()=>{if(typeof window>"u")return"light";const a=document.documentElement;return a.classList.contains("dark")?"dark":a.classList.contains("light")?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"};function P71({theme:a=Qe,...e}){const[r,n]=p.useState(j71),[l,o]=p.useState({...Qe,colors:{...Qe.colors[r],base:{...Qe.colors[r].base,primary:Qe.colors[r].base.primary,secondary:Qe.colors[r].base.secondary,tertiary:Qe.colors[r].base.tertiary},text:{...Qe.colors[r].text,action:Qe.colors[r].text.action}}}),{currentChurch:c,loading:m,error:u}=YL();return p.useEffect(()=>{if(typeof window>"u")return;const h=()=>{const E=j71();E!==r&&n(E)},g=new MutationObserver(h);g.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]});const A=window.matchMedia("(prefers-color-scheme: dark)"),y=E=>{const M=document.documentElement;!M.classList.contains("dark")&&!M.classList.contains("light")&&n(E.matches?"dark":"light")};return A.addEventListener("change",y),()=>{g.disconnect(),A.removeEventListener("change",y)}},[r]),p.useEffect(()=>{o({...Qe,colors:{...Qe.colors[r],base:{...Qe.colors[r].base,primary:Qe.colors[r].base.primary,secondary:Qe.colors[r].base.secondary,tertiary:Qe.colors[r].base.tertiary},text:{...Qe.colors[r].text,action:Qe.colors[r].text.action}}})},[r]),p.useEffect(()=>{var h,g,A,y,E,M,O;if(c&&c.theme)try{const $=JSON.parse(c==null?void 0:c.theme);o({...Qe,colors:{...Qe.colors[r],base:{...Qe.colors[r].base,primary:((h=$==null?void 0:$.colors)==null?void 0:h.primary)||Qe.colors[r].base.primary,secondary:((g=$==null?void 0:$.colors)==null?void 0:g.secondary)||Qe.colors[r].base.secondary,tertiary:((A=$==null?void 0:$.colors)==null?void 0:A.tertiary)||Qe.colors[r].base.tertiary},text:{...Qe.colors[r].text,action:((y=$==null?void 0:$.colors)==null?void 0:y.secondary)||Qe.colors[r].text.action}}});const F=document.documentElement;if((E=$==null?void 0:$.colors)!=null&&E.primary){const j=KL($.colors.primary);j&&F.style.setProperty("--color-brand-primary",j)}if((M=$==null?void 0:$.colors)!=null&&M.secondary){const j=KL($.colors.secondary);j&&F.style.setProperty("--color-brand-secondary",j)}if((O=$==null?void 0:$.colors)!=null&&O.tertiary){const j=KL($.colors.tertiary);j&&F.style.setProperty("--color-brand-tertiary",j)}}catch($){console.error("ThemeProvider - Error parsing church theme:",$),console.error("ThemeProvider - Raw theme string:",c.theme)}},[c,r]),S.jsx(Yi1,{theme:l,children:S.jsx(S71.Provider,{value:r,children:S.jsx(L71.Provider,{value:l,children:e.children})})})}P71.propTypes={children:Y0.node.isRequired,theme:Y0.object};const yZ=[{id:"Weekly",intervalUnit:"day",intervalCount:7},{id:"Every 2 Weeks",intervalUnit:"day",intervalCount:14},{id:"Monthly",intervalUnit:"month",intervalCount:1}],XL=a=>a&&a.id?a.id:!1,k71=a=>{if(!XL(a))return"one-time";const e=a.id.toLowerCase();return e==="monthly"?"monthly":e==="weekly"?"weekly":e==="every 2 weeks"?"every-2-weeks":"monthly"},OXt=a=>{switch(a){case"weekly":return"Weekly";case"every-2-weeks":return"Every 2 Weeks";case"monthly":return"Monthly";case"one-time":return null;case void 0:return null;default:return"Monthly"}},$d=a=>{if(a==="one-time")return null;const e=OXt(a);return yZ.find(r=>r.id===e)||null},$Xt=a=>{if(a==="one-time")return{interval:"off",intervalCount:1};const e=$d(a);return e?{interval:e.intervalUnit,intervalCount:e.intervalCount}:{interval:"month",intervalCount:1}};function wXt(a){return a?a.toLowerCase().replace(/[^a-z0-9\s]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,""):""}function wd(a,e){if(!a||!e)return!1;const r=wXt(e);return a===r||a===r.replace(/-/g,"_")||a===r.replace(/_/g,"-")}function SXt(a){if(typeof a!="string"||!a.length)return!1;const e=a.match(/^[0-9]{10,10}$/);return e?e.length===1:!1}const JL=({churchName:a,churchLogo:e,message:r,title:n,displayLogo:l,theme:o})=>{var u,h;const c=l!=="false"&&e,m=n&&n.trim()!==""?n:`Give to ${a}`;return S.jsxs("div",{className:"sticky top-0 z-10 px-6 py-4 bg-system-chrome dark:bg-system-chrome-dark text-center",children:[c?S.jsx("div",{className:"mb-3",children:S.jsx("div",{className:"w-20 h-20 rounded-full flex items-center justify-center mx-auto",style:{backgroundColor:((h=(u=o==null?void 0:o.colors)==null?void 0:u.base)==null?void 0:h.primary)||"#00676D"},children:S.jsx("img",{src:e,alt:`${a} logo`,className:"max-w-[60px] max-h-[60px] object-contain"})})}):null,m?S.jsx(ge,{as:"h4",className:"text-lg font-medium",children:m}):null,r&&r!==""?S.jsx(ge,{className:"text-sm mt-2",fg:"secondary",children:r}):null]})};JL.propTypes={churchName:Y0.string.isRequired,churchLogo:Y0.string,message:Y0.string,title:Y0.string,displayLogo:Y0.string};const _71=({amount:a,selectedFrequency:e,selectedCampusId:r,selectedFundId:n,onSuccess:l,onError:o,isProcessing:c=!1,onProcessingChange:m,onBack:u,userFullName:h,userEmail:g,userPhone:A,churchName:y,churchLogo:E,message:M,displayLogo:O,title:$,displayHeader:F})=>{var n0;const j=gXt(),_=dXt(),{currentChurch:N}=YL(),{campuses:k}=QL(),[I,z]=p.useState(!1),[B,e0]=p.useState(h||""),[W,i0]=p.useState(g||""),l0=F71()==="dark",o0=_0=>{const B0=_0.replace(/\D/g,"").slice(0,10);return B0.length===0?"":B0.length<=3?B0:B0.length<=6?`(${B0.slice(0,3)}) ${B0.slice(3)}`:`(${B0.slice(0,3)}) ${B0.slice(3,6)}-${B0.slice(6)}`},[G,D0]=p.useState(A?o0(A):""),S0=_0=>{const h0=o0(_0.target.value);D0(h0)},Z0=()=>typeof a=="string"?parseFloat(a):a,w0=XL(e),Q=k.find(_0=>_0.id===r),q=(n0=Q==null?void 0:Q.donationFunds)==null?void 0:n0.find(_0=>_0.id===n),t0=()=>{const _0={name:`${(Q==null?void 0:Q.name)||"Church"} Donation`,amount:Math.round(Z0()*100)};return q&&(_0.name=`${q.displayName||q.name} Donation`),[_0]},s0=()=>!w0||!e?void 0:{recurringPaymentRequest:{paymentDescription:`${y} ${e.id} donation`,managementURL:(N==null?void 0:N.givingWebUrl)||window.location.href,regularBilling:{amount:Math.round(Z0()*100),label:`${e.id} donation`,recurringPaymentIntervalUnit:e.intervalUnit,recurringPaymentIntervalCount:e.intervalCount}}},H0=async _0=>{const{error:h0,paymentIntent:B0}=_0;if(h0)throw console.error("Payment error:",h0),o(h0),new Error(h0.message);if(B0&&B0.status==="succeeded")return typeof l=="function"&&l(),!0;if(B0&&B0.status==="requires_action")console.warn("Payment requires additional action:",B0),o(new Error("Payment requires additional authentication"));else{if(B0&&B0.status==="processing")return console.warn("Payment is being processed:",B0),typeof l=="function"&&l(),!0;console.warn("Payment not successful, status:",B0==null?void 0:B0.status),o(new Error(`Payment not successful. Status: ${(B0==null?void 0:B0.status)||"unknown"}`))}return!1},b0=async(_0={})=>{if(!j||!_)throw new Error("Stripe or Elements not available");const h0={elements:_,redirect:"if_required",confirmParams:{payment_method_data:{billing_details:{name:B,email:W,phone:G},metadata:{amount:Z0().toString(),frequency:e?e.id:"one-time",campusId:r||"",fundId:n||"",isRecurring:w0&&e?"true":"false",churchSlug:(N==null?void 0:N.slug)||""}},..._0}};return await j.confirmPayment(h0)},m0=async _0=>{var h0,B0,Q0,h1;if(!j||!_)throw new Error("Stripe or Elements not available");try{const{error:_1}=await _.submit();if(_1)throw _1;const{error:H1,confirmationToken:d1}=await j.createConfirmationToken({elements:_,params:{payment_method_data:{billing_details:{email:(h0=_0.detail)==null?void 0:h0.email,phone:(B0=_0.detail)==null?void 0:B0.phone,name:(Q0=_0.detail)==null?void 0:Q0.name},metadata:{amount:Z0().toString(),frequency:e?e.id:"one-time",campusId:r||"",fundId:n||"",isRecurring:w0&&e?"true":"false",churchSlug:(N==null?void 0:N.slug)||""}},return_url:window.location.href}});if(H1)throw H1;return await j.confirmPayment({clientSecret:(h1=_._lastSubmittedOptions)==null?void 0:h1.clientSecret,confirmParams:{confirmation_token:d1.id}})}catch(_1){throw console.error("Express checkout payment error:",_1),_1}},x0=async _0=>{if(_0.preventDefault(),!j||!_)return;if(!B.trim()){o(new Error("Please enter your full name"));return}if(!W.trim()){o(new Error("Please enter your email address"));return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(W)){o(new Error("Please enter a valid email address"));return}if(!SXt(G.replace(/\D/g,""))){o(new Error("Please enter a valid 10-digit phone number"));return}m(!0);let B0=!1;try{const Q0=await b0();B0=await H0(Q0)}catch(Q0){console.error("Payment error:",Q0),o(Q0)}finally{B0||m(!1)}},X=async _0=>{if(!j)return;m(!0);let h0=!1;try{const B0=await m0(_0);h0=await H0(B0)}catch(B0){console.error("Express checkout payment error:",B0),o(B0)}finally{h0||m(!1)}},v0=()=>{z(!0)},f0=(N==null?void 0:N.givingFullPlatform)===!0?void 0:t0(),y0=(N==null?void 0:N.givingFullPlatform)===!0?void 0:s0(),g0=(N==null?void 0:N.givingFullPlatform)===!0?void 0:{emailRequired:!0,phoneNumberRequired:!0,lineItems:f0,applePay:y0,buttonType:{applePay:"donate",googlePay:"donate"},buttonTheme:{applePay:l0?"white":"black",googlePay:l0?"white":"black"},paymentMethods:{amazonPay:"never",applePay:"auto",googlePay:"auto",link:"never",paypal:"never",klarna:"never"}};return S.jsx("div",{className:"flex flex-col h-full min-h-[400px]","data-testid":"donation-payment-form",children:S.jsxs("form",{onSubmit:x0,className:"h-full flex flex-col",children:[S.jsx(Ge,{type:"button",onClick:u,disabled:c,surface:"tinted",circular:!0,className:"absolute top-4 left-4 z-20 w-10 h-10 flex items-center justify-center",children:S.jsx(sw,{size:20})}),F!=="false"?S.jsx(JL,{churchName:y,churchLogo:E,message:M,title:$,displayLogo:O,theme:null}):null,(N==null?void 0:N.givingFullPlatform)===!0?S.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:S.jsxs("div",{className:"space-y-4",children:[S.jsxs(hw1,{className:"space-y-2",children:[S.jsxs(lO,{className:"[&>[data-slot=label]+[data-slot=control]]:mt-1",children:[S.jsx(oO,{htmlFor:"fullName",className:"!font-normal !text-gray-700 dark:!text-gray-300",children:"Full Name"}),S.jsx(_l,{type:"text",id:"fullName",name:"fullName",value:B,onChange:_0=>e0(_0.target.value),required:!0,placeholder:"Enter your full name",className:"text-sm h-11 px-3 py-2"})]}),S.jsxs(lO,{className:"[&>[data-slot=label]+[data-slot=control]]:mt-1",children:[S.jsx(oO,{htmlFor:"email",className:"!font-normal !text-gray-700 dark:!text-gray-300",children:"Email Address"}),S.jsx(_l,{type:"email",id:"email",name:"email",value:W,onChange:_0=>i0(_0.target.value),required:!0,placeholder:"Enter your email address",className:"text-sm h-11 px-3 py-2"})]}),S.jsxs(lO,{className:"[&>[data-slot=label]+[data-slot=control]]:mt-1",children:[S.jsx(oO,{htmlFor:"phoneNumber",className:"!font-normal !text-gray-700 dark:!text-gray-300",children:"Phone Number"}),S.jsx(_l,{type:"tel",id:"phoneNumber",name:"phoneNumber",value:G,onChange:S0,required:!0,placeholder:"(555) 555-5555",className:"text-sm h-11 px-3 py-2"})]})]}),S.jsx("div",{children:S.jsx(AXt,{options:{paymentMethodOrder:["us_bank_account","card"],wallets:{applePay:"auto",googlePay:"auto",link:"never"},fields:{billingDetails:{name:"never",email:"never",phone:"never",address:"auto"}}}})})]})}):S.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-4",children:S.jsx("div",{className:"h-full flex items-center justify-center",children:S.jsxs("div",{className:"text-center space-y-2",children:[S.jsxs("div",{className:"flex items-start justify-center",children:[S.jsx("span",{className:"text-3xl leading-normal font-bold text-brand",children:"$"}),S.jsx("span",{className:"text-[60px] font-bold text-brand leading-none",children:Z0()})]}),S.jsxs("div",{className:"space-y-1",children:[S.jsxs("div",{className:"flex items-center justify-center gap-2",children:[S.jsxs(ge,{className:"text-sm",fg:"secondary",children:[w0&&e?e.id:"One-time"," ","Donation"]}),w0&&e?S.jsx(ge,{className:"text-sm",fg:"secondary",children:"Recurring payment"}):null]}),Q&&q?S.jsxs("div",{className:"flex items-center justify-center gap-2",children:[S.jsx(ge,{className:"text-sm",fg:"secondary",children:Q.name}),S.jsx(ge,{className:"text-sm",fg:"secondary",children:"•"}),S.jsx(ge,{className:"text-sm",fg:"secondary",children:q.displayName||q.name})]}):null]})]})})}),S.jsx("div",{className:"sticky bottom-0 z-10 p-4 border-t border-system-regular bg-system-chrome dark:bg-system-chrome-dark dark:border-white/5",children:(N==null?void 0:N.givingFullPlatform)===!0?S.jsxs("div",{className:"space-y-4",children:[S.jsx(Ge,{type:"submit",className:"w-full",disabled:!j||c,surface:"solid",children:c?"Processing...":`Complete $${Z0()} ${w0&&e?e.id:"one-time"} Donation`}),S.jsx(ge,{className:"text-sm text-center",fg:"secondary",children:"Your payment is secure and encrypted"})]}):S.jsxs("div",{className:"space-y-4",style:{display:I?"block":"none"},children:[S.jsx(ZXt,{options:g0,onConfirm:X,onReady:v0}),S.jsxs(Ge,{href:N==null?void 0:N.givingWebUrl,target:"_blank",rel:"noopener noreferrer",className:"w-full !rounded-[5px]",disabled:!j||c,surface:"system",children:[S.jsx(pw,{size:20}),"Other Payment Methods"]})]})})]})})};_71.propTypes={amount:Y0.oneOfType([Y0.string,Y0.number]).isRequired,selectedFrequency:Y0.object,selectedCampusId:Y0.string,selectedFundId:Y0.string,onSuccess:Y0.func.isRequired,onError:Y0.func.isRequired,isProcessing:Y0.bool,onProcessingChange:Y0.func.isRequired,onBack:Y0.func.isRequired,churchName:Y0.string.isRequired,churchLogo:Y0.string,message:Y0.string,displayLogo:Y0.string,title:Y0.string,displayHeader:Y0.string};const LXt=`
|
|
1906
1906
|
/* Custom selection color using theme colors */
|
|
1907
1907
|
input::selection {
|
|
1908
1908
|
background-color: rgb(var(--color-brand-primary) / 0.3);
|
|
@@ -1912,7 +1912,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1912
1912
|
background-color: rgb(var(--color-brand-primary) / 0.3);
|
|
1913
1913
|
color: inherit;
|
|
1914
1914
|
}
|
|
1915
|
-
`,FXt=({amount:a="0",selectedFrequency:e=null,selectedCampus:r=null,selectedFund:n=null,predefinedAmounts:l="",onError:o,isProcessing:c=!1,onShowPayment:m,onAmountChange:u,onFrequencyChange:h,onCampusChange:g,onFundChange:A,churchName:y,churchLogo:E,message:M,displayLogo:O,title:$,displayHeader:F})=>{var Q;const{campuses:j,loading:_}=QL(),N=XL(e),k=p.useRef(null),I=p.useRef(null),z=p.useRef(null),B=l?l.split(",").map(q=>q.trim()).filter(q=>q):[];p.useEffect(()=>{N&&k.current&&z.current&&setTimeout(()=>{const q=z.current,t0=k.current;if(q&&t0){const s0=q.getBoundingClientRect();t0.getBoundingClientRect().bottom>s0.bottom&&t0.scrollIntoView({behavior:"smooth",block:"nearest"})}},100)},[N]),p.useEffect(()=>{r&&I.current&&z.current&&setTimeout(()=>{const q=z.current,t0=I.current;if(q&&t0){const s0=q.getBoundingClientRect();t0.getBoundingClientRect().bottom>s0.bottom&&t0.scrollIntoView({behavior:"smooth",block:"nearest"})}},100)},[r]);const[e0,W]=p.useState(80),i0=p.useRef(null);p.useLayoutEffect(()=>{i0.current&&(i0.current.textContent=a||"0",W(Math.max(i0.current.offsetWidth+16,80)))},[a]),p.useEffect(()=>{const q=setTimeout(()=>{i0.current&&(i0.current.textContent=a||"0",W(Math.max(i0.current.offsetWidth+16,80)))},10);return()=>clearTimeout(q)},[a]);const a0=q=>{const t0=parseFloat(q);return!isNaN(t0)&&t0>999999.99},l0=q=>{let t0=q.replace(/[^0-9.]/g,"");if(t0.includes(".")){const s0=t0.split(".");s0.length>2&&(t0=s0[0]+"."+s0.slice(1).join("")),s0[1]&&s0[1].length>2&&(t0=s0[0]+"."+s0[1].substring(0,2))}t0.length>1&&t0[0]==="0"&&t0[1]!=="."&&(t0=t0.substring(1)),!a0(t0)&&(t0==="."&&(t0="0."),u==null||u(t0))},o0=q=>{const t0=j.find(s0=>s0.id===q);if(t0){const s0={...t0,donationFunds:t0.donationFunds?t0.donationFunds.map(H0=>({...H0})):[]};g==null||g(s0),A==null||A(null)}else g==null||g(null),A==null||A(null)},G=q=>{var s0;if(!r)return;const t0=(s0=r.donationFunds)==null?void 0:s0.find(H0=>H0.id===q);A==null||A(t0?{...t0}:null)},D0=q=>{const t0=yZ.find(s0=>s0.id===q);h==null||h(t0||null)},S0=()=>{if(typeof a=="string"){const q=parseFloat(a);return isNaN(q)?0:q}return a||0},Z0=q=>Number(q).toFixed(2),w0=()=>{const q=S0();if(!q||q<=0){o({message:"Please enter a valid amount"});return}if(q<.5){o({message:"Please enter an amount of $0.50 or more"});return}if(!r){o({message:"Please select a campus"});return}if(!n){o({message:"Please select a fund"});return}m&&m()};return S.jsxs("div",{className:"flex flex-col h-full",children:[S.jsx("style",{children:LXt}),F!=="false"?S.jsx(JL,{churchName:y,churchLogo:E,message:M,title:$,displayLogo:O,theme:void 0}):null,S.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-6",ref:z,children:S.jsxs("div",{className:"space-y-4",children:[S.jsxs("div",{className:"",children:[S.jsxs("div",{className:"flex items-start justify-center text-[60px] font-bold leading-none min-h-[60px]",children:[S.jsx("span",{className:"text-3xl leading-normal font-bold mt-3 flex-none text-brand dark:text-white",children:"$"}),S.jsx("span",{ref:i0,className:"absolute invisible h-0 overflow-hidden whitespace-pre text-[80px] font-bold font-inherit p-0 m-0",style:{fontFamily:"inherit",position:"absolute",left:"-9999px",top:"-9999px"},children:a||"0"}),S.jsx("input",{type:"text",inputMode:"decimal",placeholder:"0",value:a,onKeyDown:q=>{if(!["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(q.key)){if(/^[0-9]$/.test(q.key)||q.key==="."||q.ctrlKey||q.metaKey){if(q.key==="."&&a.includes(".")){q.preventDefault();return}if(/^[0-9]$/.test(q.key)){const t0=q.target,s0=t0.value,H0=t0.selectionStart||0,b0=s0.substring(0,H0)+q.key+s0.substring(t0.selectionEnd||0);if(a0(b0)){q.preventDefault();return}}return}q.preventDefault()}},onChange:q=>{const t0=q.target.value;l0(t0),requestAnimationFrame(()=>{if(i0.current){i0.current.textContent=t0||"0";const s0=Math.max(i0.current.offsetWidth+16,80);W(s0)}})},onInput:q=>{const t0=q.target.value;if(i0.current){i0.current.textContent=t0||"0";const s0=Math.max(i0.current.offsetWidth+16,80);W(s0)}},onKeyUp:q=>{const t0=q.target.value;if(i0.current){i0.current.textContent=t0||"0";const s0=Math.max(i0.current.offsetWidth+16,80);W(s0)}},onFocus:q=>{setTimeout(()=>{q.target.select()},0)},onClick:q=>{q.target.select()},disabled:c||_,className:"text-[80px] font-bold border-none outline-none bg-transparent flex-none p-0 m-0 text-brand dark:text-white caret-current text-center appearance-none transition-[width] duration-100 ease-in-out",style:{width:`${e0}px`}})]}),B&&B.length>0?S.jsx("div",{className:"flex flex-wrap pt-12",style:{gap:"6px"},children:B.map(q=>S.jsxs(Ge,{onClick:()=>l0(q),disabled:c||_,surface:a===q?"solid":"material",className:"min-w-0 flex-1",style:{flexBasis:"calc(25% - 4.5px)",minWidth:"0",...a===q&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:["$",q]},q))}):null]}),S.jsx("div",{children:S.jsxs("div",{className:"flex",children:[S.jsxs(Ge,{onClick:()=>{h==null||h(yZ[2])},disabled:c||_,surface:N?"solid":"material",className:"flex-1 rounded-r-none",style:{...N&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:[S.jsx(mw,{size:24}),"Recurring"]}),S.jsxs(Ge,{onClick:()=>h==null?void 0:h(null),disabled:c||_,surface:N?"material":"solid",className:"flex-1 rounded-l-none",style:{...!N&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:[S.jsx(Hw,{size:24}),"One time"]})]})}),N?S.jsxs("div",{ref:k,children:[S.jsx(ge,{className:"mb-4 pl-4 text-sm",fg:"secondary",children:"Frequency"}),S.jsxs(mO,{value:(e==null?void 0:e.id)||"",onChange:q=>D0(q.target.value),disabled:c||_,required:!0,surface:"material",children:[S.jsx("option",{value:"",children:"Select a frequency"}),yZ.map(q=>S.jsx("option",{value:q.id,children:q.id},q.id))]})]}):null,S.jsxs("div",{children:[S.jsx(ge,{className:"mb-4 pl-4 text-sm",fg:"secondary",children:"Campus"}),S.jsxs(mO,{value:(r==null?void 0:r.id)||"",onChange:q=>o0(q.target.value),disabled:c||_,required:!0,surface:"material",children:[S.jsx("option",{value:"",children:_?"Loading...":"Select a campus"}),j.map(q=>S.jsx("option",{value:q.id,children:q.name},q.id))]})]}),r?S.jsxs("div",{ref:I,children:[S.jsx(ge,{className:"mb-4 pl-4 text-sm",fg:"secondary",children:"Fund"}),S.jsxs(mO,{value:(n==null?void 0:n.id)||"",onChange:q=>G(q.target.value),disabled:c,required:!0,surface:"material",children:[S.jsx("option",{value:"",children:"Select a fund"}),(Q=r.donationFunds)==null?void 0:Q.sort((q,t0)=>(q.displayOrder||0)-(t0.displayOrder||0)).map(q=>S.jsx("option",{value:q.id,children:q.displayName||q.name},q.id))]})]}):null]})}),S.jsxs("div",{className:"sticky bottom-0 z-10 px-6 py-4 bg-system-chrome dark:bg-system-chrome-dark",children:[S.jsxs(Ge,{type:"button",className:"w-full py-3",onClick:w0,disabled:c||_||!r||!n||S0()<=0,surface:"solid",children:["Give $",Z0(S0())," ",N&&e?e.id:""]}),S.jsx("div",{className:"text-center mt-4 px-6",children:S.jsxs(ge,{className:"text-sm",fg:"secondary",children:["By making this gift, you agree to our",S.jsx("br",{})," ",S.jsx("a",{href:"https://apollos.com/terms",target:"_blank",rel:"noopener noreferrer",className:"text-brand-primary underline",children:"Terms of Use"})," ","and"," ",S.jsx("a",{href:"https://apollos.com/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-brand-primary underline",children:"Privacy Policy"}),"."]})})]})]})},C71=({onRetry:a,theme:e})=>{var r,n;return S.jsxs("div",{className:"text-center p-6 flex flex-col items-center justify-center min-h-full",children:[S.jsx("div",{className:"mb-6",children:S.jsx(aA,{size:64,color:((n=(r=e==null?void 0:e.colors)==null?void 0:r.base)==null?void 0:n.secondary)||"#17B582",weight:"fill"})}),S.jsx(ge,{as:"h3",className:"mb-4",children:"Thank You!"}),S.jsx(ge,{fg:"secondary",className:"mb-12",children:"Your donation has been processed successfully."}),S.jsx(Ge,{surface:"solid",onClick:a,children:"Make Another Donation"})]})};C71.propTypes={onRetry:Y0.func.isRequired};const bZ=new Map,jXt=a=>typeof window>"u"?Promise.resolve(null):(bZ.has(a)||bZ.set(a,Promise.resolve().then(()=>Yea).then(({loadStripe:e})=>e(a)).catch(e=>(console.error("Failed to load Stripe.js",e),bZ.delete(a),null))),bZ.get(a)),PXt=({amount:a="0",frequency:e,message:r="",campus:n="",fund:l="",predefinedAmounts:o="",width:c="",height:m="",displayLogo:u="",title:h="",displayHeader:g="",prefilledPayment:A=null,userFirstName:y=null,userLastName:E=null,userEmail:M=null,userPhone:O=null})=>{var q0,N0,r1,T1,m1,b1;const $=W0=>typeof W0=="string"&&parseFloat(W0)>0,F=W0=>typeof W0=="string"&&W0.trim().length>0,j=W0=>W0===null||typeof W0=="string"&&W0.trim().length>0,_=W0=>W0==null||typeof W0=="object"&&!!W0.id,N=p.useCallback(W0=>W0?$(W0.amount)&&F(W0.campusId)&&j(W0.fundId||null)&&_(W0.selectedFrequency):!1,[]),[k,I]=p.useState("setup"),[z,B]=p.useState(""),[e0,W]=p.useState(null),[i0,a0]=p.useState(!1),[l0,o0]=p.useState(null),[G,D0]=p.useState(()=>A&&N(A)?{amount:A.amount,selectedFrequency:A.selectedFrequency??null,selectedCampusId:A.campusId,selectedFundId:A.fundId??null,selectedCampus:null,selectedFund:null}:{amount:$((A==null?void 0:A.amount)||"")?(A==null?void 0:A.amount)||"":a,selectedFrequency:_(A==null?void 0:A.selectedFrequency)?(A==null?void 0:A.selectedFrequency)??null:$d(e),selectedCampusId:F((A==null?void 0:A.campusId)||"")?(A==null?void 0:A.campusId)||"":n||null,selectedFundId:j((A==null?void 0:A.fundId)||null)?(A==null?void 0:A.fundId)??null:l||null,selectedCampus:null,selectedFund:null}),[S0,Z0]=p.useState(!1),w0=p.useRef({amount:a,campus:n,fund:l}),{currentChurch:Q,loading:q,error:t0}=YL(),{campuses:s0}=QL(),H0=F71(),b0=VXt(),m0=p.useMemo(()=>{var C1,x1,a1,E1,Q1,Ze,Me,s2,n2,G2,De,Le,Re,a2;const W0={light:{primary:((x1=(C1=b0==null?void 0:b0.colors)==null?void 0:C1.base)==null?void 0:x1.primary)||"#00676D",background:Qe.colors.light.fill.screen,componentBackground:Qe.colors.light.fill.paper,componentBorder:Qe.colors.light.neutral.gray5,componentDivider:Qe.colors.light.neutral.gray4,primaryText:Qe.colors.light.text.primary,secondaryText:Qe.colors.light.text.secondary,componentText:Qe.colors.light.text.primary,icon:Qe.colors.light.neutral.gray},dark:{primary:((E1=(a1=b0==null?void 0:b0.colors)==null?void 0:a1.base)==null?void 0:E1.secondary)||"#17B582",background:Qe.colors.dark.fill.screen,componentBackground:Qe.colors.dark.fill.paper,componentBorder:Qe.colors.dark.neutral.gray5,componentDivider:Qe.colors.dark.neutral.gray4,primaryText:Qe.colors.dark.text.primary,secondaryText:Qe.colors.dark.text.secondary,componentText:Qe.colors.dark.text.primary,icon:Qe.colors.dark.neutral.gray}};return{theme:H0==="dark"?"night":"stripe",variables:{colorPrimary:((Ze=(Q1=b0==null?void 0:b0.colors)==null?void 0:Q1.base)==null?void 0:Ze.primary)||"#00676D",colorBackground:H0==="dark"?W0.dark.componentBackground:W0.light.componentBackground,colorText:H0==="dark"?W0.dark.primaryText:W0.light.primaryText,colorTextSecondary:H0==="dark"?W0.dark.secondaryText:W0.light.secondaryText,colorTextPlaceholder:H0==="dark"?W0.dark.secondaryText:W0.light.secondaryText,colorDanger:((s2=(Me=b0==null?void 0:b0.colors)==null?void 0:Me.base)==null?void 0:s2.alert)||"#FF4444",colorSuccess:((G2=(n2=b0==null?void 0:b0.colors)==null?void 0:n2.base)==null?void 0:G2.success)||"#17B582",colorWarning:((Le=(De=b0==null?void 0:b0.colors)==null?void 0:De.base)==null?void 0:Le.warning)||"#FFA500",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",fontSizeBase:"16px",spacingUnit:((Re=b0==null?void 0:b0.space)==null?void 0:Re.xxxs)||"4px",borderRadius:((a2=b0==null?void 0:b0.radii)==null?void 0:a2.base)||"6px",iconColor:H0==="dark"?W0.dark.icon:W0.light.icon}}},[b0,H0]);p.useEffect(()=>{var x1;const W0=(x1=Q==null?void 0:Q.stripeConnectAccount)==null?void 0:x1.publishableKey;if(!W0){o0(null);return}const C1=jXt(W0);o0(C1)},[(q0=Q==null?void 0:Q.stripeConnectAccount)==null?void 0:q0.publishableKey]),p.useEffect(()=>{A||(((Q==null?void 0:Q.slug)==="crossroads"||(Q==null?void 0:Q.slug)==="crossroads_sandbox")&&e===void 0?D0(W0=>({...W0,selectedFrequency:$d("monthly")})):D0(W0=>({...W0,selectedFrequency:$d(e)})))},[Q==null?void 0:Q.slug,A,e]),p.useEffect(()=>{!A&&a!==w0.current.amount&&a!==G.amount&&D0(W0=>({...W0,amount:a})),w0.current.amount=a},[a,A]),p.useEffect(()=>{!A&&n!==w0.current.campus&&n!==G.selectedCampusId&&D0(W0=>({...W0,selectedCampusId:n||null,selectedCampus:null,selectedFund:null,selectedFundId:null})),w0.current.campus=n},[n,A]),p.useEffect(()=>{!A&&l!==w0.current.fund&&l!==G.selectedFundId&&D0(W0=>({...W0,selectedFundId:l||null,selectedFund:null})),w0.current.fund=l},[l,A]),p.useEffect(()=>{var W0;if(!A&&G.selectedFundId&&((W0=G.selectedCampus)!=null&&W0.donationFunds)&&!G.selectedFund){let C1=G.selectedCampus.donationFunds.find(x1=>x1.id===G.selectedFundId);C1||(C1=G.selectedCampus.donationFunds.find(x1=>wd(G.selectedFundId,x1.name)||x1.displayName&&wd(G.selectedFundId,x1.displayName))),C1&&D0(x1=>({...x1,selectedFund:{...C1}}))}},[A,G.selectedFundId,(N0=G.selectedCampus)==null?void 0:N0.donationFunds,G.selectedFund]),p.useEffect(()=>{if(s0.length>0&&G.selectedCampusId&&!G.selectedCampus){const W0=G.selectedCampusId.startsWith("Campus:")?G.selectedCampusId.substring(7):G.selectedCampusId;let C1=s0.find(x1=>x1.id===W0);if(C1||(C1=s0.find(x1=>x1.id===G.selectedCampusId)),C1||(C1=s0.find(x1=>wd(G.selectedCampusId,x1.name))),C1){const x1={...C1,donationFunds:C1.donationFunds?C1.donationFunds.map(a1=>({...a1})):[]};if(D0(a1=>({...a1,selectedCampus:x1})),G.selectedFundId&&x1.donationFunds){let a1=x1.donationFunds.find(E1=>E1.id===G.selectedFundId);a1||(a1=x1.donationFunds.find(E1=>wd(G.selectedFundId,E1.name)||E1.displayName&&wd(G.selectedFundId,E1.displayName))),a1&&D0(E1=>({...E1,selectedFund:{...a1}}))}}}},[s0,G.selectedCampusId,G.selectedFundId,G.selectedCampus]);const[x0,{loading:X}]=HXt(),v0=p.useCallback(()=>{I("success")},[]),f0=p.useCallback(W0=>{B(W0.message)},[]),y0=p.useCallback(()=>{B("")},[]),g0=p.useCallback(()=>{I("setup"),B(""),W(null),Z0(!1),D0({amount:a,selectedFrequency:$d(e),selectedCampusId:null,selectedFundId:null,selectedCampus:null,selectedFund:null}),a0(!1)},[a,e]),n0=p.useCallback(W0=>{D0(C1=>({...C1,amount:W0}))},[]),_0=p.useCallback(W0=>{D0(C1=>({...C1,selectedFrequency:W0}))},[]),h0=p.useCallback(W0=>{D0(C1=>({...C1,selectedCampus:W0,selectedCampusId:(W0==null?void 0:W0.id)||null,selectedFund:null,selectedFundId:null}))},[]),B0=p.useCallback(W0=>{D0(C1=>({...C1,selectedFund:W0,selectedFundId:(W0==null?void 0:W0.id)||null}))},[]),Q0=p.useCallback(async(W0,C1,x1,a1)=>{var E1;try{const Q1={amount:Math.round(W0*100),campusId:x1||"",fundId:a1||null};Q1.recurring=$Xt(C1);const{data:Ze,errors:Me}=await x0({variables:{input:Q1}});if(Me)throw new Error(Me[0].message);if((E1=Ze==null?void 0:Ze.createPaymentIntent)!=null&&E1.clientSecret)W(Ze.createPaymentIntent.clientSecret),I("payment");else throw new Error("No client secret received from server")}catch(Q1){f0(Q1)}},[x0,f0]),h1=p.useCallback(()=>{I("setup"),W(null)},[]),_1={width:c?isNaN(Number(c))?c:`${c}px`:"100%",height:m?isNaN(Number(m))?m:`${m}px`:"500px",maxWidth:c?void 0:"400px",margin:c?"0":"0 auto",border:"none",position:"relative",overflow:"hidden",padding:0},H1=q||!l0||X||i0;if(p.useEffect(()=>{A&&N(A)&&!q&&!X&&!S0&&k==="setup"&&(Z0(!0),D0({amount:A.amount,selectedFrequency:A.selectedFrequency??null,selectedCampusId:A.campusId,selectedFundId:A.fundId??null,selectedCampus:null,selectedFund:null}),Q0(parseFloat(A.amount),k71(A.selectedFrequency),A.campusId,A.fundId??""))},[A,q,X,S0,k,Q0,N]),t0)return S.jsx(U6,{style:_1,children:S.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:[S.jsx(ge,{className:"text-red-600",children:"Unable to load church information. Please try again later."}),S.jsx(Ge,{surface:"tinted",onClick:g0,className:"mt-2",children:"Try Again"})]})});if(!q&&!l0)return S.jsx(U6,{style:_1,children:S.jsx("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:S.jsx(ge,{className:"text-red-600",children:"Online giving is not currently available. Please contact your church for assistance."})})});if(k==="success")return S.jsx(U6,{style:_1,children:S.jsx("div",{className:"flex-1 flex flex-col justify-center items-center",children:S.jsx(C71,{onRetry:g0,theme:b0||void 0})})});const d1=y||E?`${y} ${E}`.trim():"",t1=(Q==null?void 0:Q.name)||"Your Church";return S.jsxs(U6,{style:_1,children:[H1?S.jsx("div",{className:"absolute inset-0 bg-material-screen dark:bg-material-screen-dark flex items-center justify-center z-[1000]",children:S.jsx(m5,{size:32,className:"animate-spin mx-auto mb-2"})}):null,z?S.jsxs("div",{className:"absolute top-0 left-0 right-0 z-[50] p-3 flex items-center gap-2 bg-red-50 dark:bg-red-900 rounded-xl",style:{borderColor:((T1=(r1=b0==null?void 0:b0.colors)==null?void 0:r1.base)==null?void 0:T1.alert)||"#FF4444"},children:[S.jsx(Fw,{size:20,color:((b1=(m1=b0==null?void 0:b0.colors)==null?void 0:m1.base)==null?void 0:b1.alert)||"#FF4444",weight:"fill"}),S.jsx("div",{className:"flex-1",children:S.jsx(ge,{className:"text-red-700 dark:text-red-300 font-medium text-sm",children:z})}),S.jsx(Ge,{surface:"tinted",onClick:y0,className:"p-1 min-w-0 text-red-700 dark:text-red-300 hover:bg-red-100 dark:hover:bg-red-800/30",children:S.jsx(ug,{size:16})})]}):null,S.jsx("div",{className:"flex flex-col h-full min-h-[400px]",children:k==="payment"&&e0&&l0?S.jsx($71,{stripe:l0,options:{clientSecret:e0,appearance:m0},children:S.jsx(_71,{amount:G!=null&&G.amount?parseFloat(G.amount):parseFloat(a),selectedFrequency:G==null?void 0:G.selectedFrequency,selectedCampusId:(G==null?void 0:G.selectedCampusId)||void 0,selectedFundId:(G==null?void 0:G.selectedFundId)||void 0,onSuccess:v0,onError:f0,isProcessing:i0,onProcessingChange:a0,onBack:h1,userFullName:d1,userEmail:M||void 0,userPhone:O||void 0,churchName:t1,churchLogo:Q==null?void 0:Q.logo,message:r,displayLogo:u,title:h,displayHeader:g})}):S.jsx(S.Fragment,{children:k==="setup"&&!(A&&N(A)&&!S0)?S.jsx(FXt,{amount:G.amount,selectedFrequency:G.selectedFrequency,selectedCampus:G.selectedCampus,selectedFund:G.selectedFund,predefinedAmounts:o,onError:W0=>f0(new Error(W0.message)),isProcessing:X,onAmountChange:n0,onFrequencyChange:_0,onCampusChange:h0,onFundChange:B0,onShowPayment:()=>{const W0=typeof G.amount=="string"?parseFloat(G.amount):G.amount,C1=k71(G.selectedFrequency);Q0(W0,C1,G.selectedCampusId||"",G.selectedFundId||"")},churchName:t1,churchLogo:Q==null?void 0:Q.logo,message:r,displayLogo:u,title:h,displayHeader:g}):k==="setup"&&A&&N(A)&&!S0?S.jsxs("div",{className:"flex flex-col justify-center items-center h-full min-h-[400px]",children:[S.jsx(m5,{size:32,className:"animate-spin mx-auto mb-2"}),S.jsx(ge,{children:"Preparing your donation..."})]}):null})})]})},kXt=a=>{const[e,r]=p.useState(!1);p.useEffect(()=>{r(!0)},[]);const n=()=>({width:a.width?isNaN(Number(a.width))?a.width:`${a.width}px`:"100%",height:a.height?isNaN(Number(a.height))?a.height:`${a.height}px`:"500px",maxWidth:a.width?void 0:"400px",margin:a.width?"0":"0 auto",border:"none",position:"relative",overflow:"hidden",padding:0});return S.jsx(P71,{children:e?S.jsx(PXt,{...a}):S.jsx(U6,{style:n(),children:S.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:[S.jsx(m5,{size:32,className:"animate-spin mx-auto mb-2"}),S.jsx(ge,{className:"text-center",children:"Loading donation form..."})]})})})},_Xt=p.forwardRef(function({to:e,href:r,isExternal:n,...l},o){const{navigate:c}=aZ(),m=e51(),u=t51(),h=a51(),g=$L(),A=kUt();if(n&&r||!e)return S.jsx("a",{ref:o,href:r,...l});let y;if(typeof e=="object"){if(!e.contentId)return null;y=e.contentId.split(":").join("-")}else if(e!=null&&e.includes("ContentItem"))y=e.split("/").slice(-1)[0];else return null;if(!h&&!g)return S.jsx("a",{ref:o,...l,href:`https://apollos.site/@${A}/c/${y}`,target:"_blank",rel:"noopener noreferrer"});let E=u&&g?`/ac/${y}`:`?${m?"apollosId":"id"}=${y}`;return g||(E=`${h}${r}`),S.jsx("a",{ref:o,...l,href:E,onClick:M=>{M.preventDefault(),c({id:y})}})}),CXt=({children:a})=>S.jsx(x$1,{linkComponent:_Xt,children:a});function HZ(){return HZ=Object.assign?Object.assign.bind():function(a){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(a[n]=r[n])}return a},HZ.apply(null,arguments)}function N71(a,e){if(a==null)return{};var r={};for(var n in a)if({}.hasOwnProperty.call(a,n)){if(e.indexOf(n)>=0)continue;r[n]=a[n]}return r}function eF(a,e){return eF=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},eF(a,e)}function T71(a,e){a.prototype=Object.create(e.prototype),a.prototype.constructor=a,eF(a,e)}function NXt(a,e){return a.classList?!!e&&a.classList.contains(e):(" "+(a.className.baseVal||a.className)+" ").indexOf(" "+e+" ")!==-1}function TXt(a,e){a.classList?a.classList.add(e):NXt(a,e)||(typeof a.className=="string"?a.className=a.className+" "+e:a.setAttribute("class",(a.className&&a.className.baseVal||"")+" "+e))}function I71(a,e){return a.replace(new RegExp("(^|\\s)"+e+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function IXt(a,e){a.classList?a.classList.remove(e):typeof a.className=="string"?a.className=I71(a.className,e):a.setAttribute("class",I71(a.className&&a.className.baseVal||"",e))}const x71={disabled:!1};var D71={},xXt=D71.NODE_ENV!=="production"?Y0.oneOfType([Y0.number,Y0.shape({enter:Y0.number,exit:Y0.number,appear:Y0.number}).isRequired]):null,DXt=D71.NODE_ENV!=="production"?Y0.oneOfType([Y0.string,Y0.shape({enter:Y0.string,exit:Y0.string,active:Y0.string}),Y0.shape({enter:Y0.string,enterDone:Y0.string,enterActive:Y0.string,exit:Y0.string,exitDone:Y0.string,exitActive:Y0.string})]):null;const R71=t.createContext(null);var z71=function(e){return e.scrollTop},RXt={},Sd="unmounted",P5="exited",k5="entering",b9="entered",tF="exiting",xn=function(a){T71(e,a);function e(n,l){var o;o=a.call(this,n,l)||this;var c=l,m=c&&!c.isMounting?n.enter:n.appear,u;return o.appearStatus=null,n.in?m?(u=P5,o.appearStatus=k5):u=b9:n.unmountOnExit||n.mountOnEnter?u=Sd:u=P5,o.state={status:u},o.nextCallback=null,o}e.getDerivedStateFromProps=function(l,o){var c=l.in;return c&&o.status===Sd?{status:P5}:null};var r=e.prototype;return r.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},r.componentDidUpdate=function(l){var o=null;if(l!==this.props){var c=this.state.status;this.props.in?c!==k5&&c!==b9&&(o=k5):(c===k5||c===b9)&&(o=tF)}this.updateStatus(!1,o)},r.componentWillUnmount=function(){this.cancelNextCallback()},r.getTimeouts=function(){var l=this.props.timeout,o,c,m;return o=c=m=l,l!=null&&typeof l!="number"&&(o=l.exit,c=l.enter,m=l.appear!==void 0?l.appear:c),{exit:o,enter:c,appear:m}},r.updateStatus=function(l,o){if(l===void 0&&(l=!1),o!==null)if(this.cancelNextCallback(),o===k5){if(this.props.unmountOnExit||this.props.mountOnEnter){var c=this.props.nodeRef?this.props.nodeRef.current:em.findDOMNode(this);c&&z71(c)}this.performEnter(l)}else this.performExit();else this.props.unmountOnExit&&this.state.status===P5&&this.setState({status:Sd})},r.performEnter=function(l){var o=this,c=this.props.enter,m=this.context?this.context.isMounting:l,u=this.props.nodeRef?[m]:[em.findDOMNode(this),m],h=u[0],g=u[1],A=this.getTimeouts(),y=m?A.appear:A.enter;if(!l&&!c||x71.disabled){this.safeSetState({status:b9},function(){o.props.onEntered(h)});return}this.props.onEnter(h,g),this.safeSetState({status:k5},function(){o.props.onEntering(h,g),o.onTransitionEnd(y,function(){o.safeSetState({status:b9},function(){o.props.onEntered(h,g)})})})},r.performExit=function(){var l=this,o=this.props.exit,c=this.getTimeouts(),m=this.props.nodeRef?void 0:em.findDOMNode(this);if(!o||x71.disabled){this.safeSetState({status:P5},function(){l.props.onExited(m)});return}this.props.onExit(m),this.safeSetState({status:tF},function(){l.props.onExiting(m),l.onTransitionEnd(c.exit,function(){l.safeSetState({status:P5},function(){l.props.onExited(m)})})})},r.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},r.safeSetState=function(l,o){o=this.setNextCallback(o),this.setState(l,o)},r.setNextCallback=function(l){var o=this,c=!0;return this.nextCallback=function(m){c&&(c=!1,o.nextCallback=null,l(m))},this.nextCallback.cancel=function(){c=!1},this.nextCallback},r.onTransitionEnd=function(l,o){this.setNextCallback(o);var c=this.props.nodeRef?this.props.nodeRef.current:em.findDOMNode(this),m=l==null&&!this.props.addEndListener;if(!c||m){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var u=this.props.nodeRef?[this.nextCallback]:[c,this.nextCallback],h=u[0],g=u[1];this.props.addEndListener(h,g)}l!=null&&setTimeout(this.nextCallback,l)},r.render=function(){var l=this.state.status;if(l===Sd)return null;var o=this.props,c=o.children;o.in,o.mountOnEnter,o.unmountOnExit,o.appear,o.enter,o.exit,o.timeout,o.addEndListener,o.onEnter,o.onEntering,o.onEntered,o.onExit,o.onExiting,o.onExited,o.nodeRef;var m=N71(o,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return t.createElement(R71.Provider,{value:null},typeof c=="function"?c(l,m):t.cloneElement(t.Children.only(c),m))},e}(t.Component);xn.contextType=R71,xn.propTypes=RXt.NODE_ENV!=="production"?{nodeRef:Y0.shape({current:typeof Element>"u"?Y0.any:function(a,e,r,n,l,o){var c=a[e];return Y0.instanceOf(c&&"ownerDocument"in c?c.ownerDocument.defaultView.Element:Element)(a,e,r,n,l,o)}}),children:Y0.oneOfType([Y0.func.isRequired,Y0.element.isRequired]).isRequired,in:Y0.bool,mountOnEnter:Y0.bool,unmountOnExit:Y0.bool,appear:Y0.bool,enter:Y0.bool,exit:Y0.bool,timeout:function(e){var r=xXt;e.addEndListener||(r=r.isRequired);for(var n=arguments.length,l=new Array(n>1?n-1:0),o=1;o<n;o++)l[o-1]=arguments[o];return r.apply(void 0,[e].concat(l))},addEndListener:Y0.func,onEnter:Y0.func,onEntering:Y0.func,onEntered:Y0.func,onExit:Y0.func,onExiting:Y0.func,onExited:Y0.func}:{};function H9(){}xn.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:H9,onEntering:H9,onEntered:H9,onExit:H9,onExiting:H9,onExited:H9},xn.UNMOUNTED=Sd,xn.EXITED=P5,xn.ENTERING=k5,xn.ENTERED=b9,xn.EXITING=tF;var zXt={},UXt=function(e,r){return e&&r&&r.split(" ").forEach(function(n){return TXt(e,n)})},aF=function(e,r){return e&&r&&r.split(" ").forEach(function(n){return IXt(e,n)})},rF=function(a){T71(e,a);function e(){for(var n,l=arguments.length,o=new Array(l),c=0;c<l;c++)o[c]=arguments[c];return n=a.call.apply(a,[this].concat(o))||this,n.appliedClasses={appear:{},enter:{},exit:{}},n.onEnter=function(m,u){var h=n.resolveArguments(m,u),g=h[0],A=h[1];n.removeClasses(g,"exit"),n.addClass(g,A?"appear":"enter","base"),n.props.onEnter&&n.props.onEnter(m,u)},n.onEntering=function(m,u){var h=n.resolveArguments(m,u),g=h[0],A=h[1],y=A?"appear":"enter";n.addClass(g,y,"active"),n.props.onEntering&&n.props.onEntering(m,u)},n.onEntered=function(m,u){var h=n.resolveArguments(m,u),g=h[0],A=h[1],y=A?"appear":"enter";n.removeClasses(g,y),n.addClass(g,y,"done"),n.props.onEntered&&n.props.onEntered(m,u)},n.onExit=function(m){var u=n.resolveArguments(m),h=u[0];n.removeClasses(h,"appear"),n.removeClasses(h,"enter"),n.addClass(h,"exit","base"),n.props.onExit&&n.props.onExit(m)},n.onExiting=function(m){var u=n.resolveArguments(m),h=u[0];n.addClass(h,"exit","active"),n.props.onExiting&&n.props.onExiting(m)},n.onExited=function(m){var u=n.resolveArguments(m),h=u[0];n.removeClasses(h,"exit"),n.addClass(h,"exit","done"),n.props.onExited&&n.props.onExited(m)},n.resolveArguments=function(m,u){return n.props.nodeRef?[n.props.nodeRef.current,m]:[m,u]},n.getClassNames=function(m){var u=n.props.classNames,h=typeof u=="string",g=h&&u?u+"-":"",A=h?""+g+m:u[m],y=h?A+"-active":u[m+"Active"],E=h?A+"-done":u[m+"Done"];return{baseClassName:A,activeClassName:y,doneClassName:E}},n}var r=e.prototype;return r.addClass=function(l,o,c){var m=this.getClassNames(o)[c+"ClassName"],u=this.getClassNames("enter"),h=u.doneClassName;o==="appear"&&c==="done"&&h&&(m+=" "+h),c==="active"&&l&&z71(l),m&&(this.appliedClasses[o][c]=m,UXt(l,m))},r.removeClasses=function(l,o){var c=this.appliedClasses[o],m=c.base,u=c.active,h=c.done;this.appliedClasses[o]={},m&&aF(l,m),u&&aF(l,u),h&&aF(l,h)},r.render=function(){var l=this.props;l.classNames;var o=N71(l,["classNames"]);return t.createElement(xn,HZ({},o,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},e}(t.Component);rF.defaultProps={classNames:""},rF.propTypes=zXt.NODE_ENV!=="production"?HZ({},xn.propTypes,{classNames:DXt,onEnter:Y0.func,onEntering:Y0.func,onEntered:Y0.func,onExit:Y0.func,onExiting:Y0.func,onExited:Y0.func}):{};const U71={Search:xe(rF)`
|
|
1915
|
+
`,FXt=({amount:a="0",selectedFrequency:e=null,selectedCampus:r=null,selectedFund:n=null,predefinedAmounts:l="",onError:o,isProcessing:c=!1,onShowPayment:m,onAmountChange:u,onFrequencyChange:h,onCampusChange:g,onFundChange:A,churchName:y,churchLogo:E,message:M,displayLogo:O,title:$,displayHeader:F})=>{var Q;const{campuses:j,loading:_}=QL(),N=XL(e),k=p.useRef(null),I=p.useRef(null),z=p.useRef(null),B=l?l.split(",").map(q=>q.trim()).filter(q=>q):[];p.useEffect(()=>{N&&k.current&&z.current&&setTimeout(()=>{const q=z.current,t0=k.current;if(q&&t0){const s0=q.getBoundingClientRect();t0.getBoundingClientRect().bottom>s0.bottom&&t0.scrollIntoView({behavior:"smooth",block:"nearest"})}},100)},[N]),p.useEffect(()=>{r&&I.current&&z.current&&setTimeout(()=>{const q=z.current,t0=I.current;if(q&&t0){const s0=q.getBoundingClientRect();t0.getBoundingClientRect().bottom>s0.bottom&&t0.scrollIntoView({behavior:"smooth",block:"nearest"})}},100)},[r]);const[e0,W]=p.useState(80),i0=p.useRef(null);p.useLayoutEffect(()=>{i0.current&&(i0.current.textContent=a||"0",W(Math.max(i0.current.offsetWidth+16,80)))},[a]),p.useEffect(()=>{const q=setTimeout(()=>{i0.current&&(i0.current.textContent=a||"0",W(Math.max(i0.current.offsetWidth+16,80)))},10);return()=>clearTimeout(q)},[a]);const a0=q=>{const t0=parseFloat(q);return!isNaN(t0)&&t0>999999.99},l0=q=>{let t0=q.replace(/[^0-9.]/g,"");if(t0.includes(".")){const s0=t0.split(".");s0.length>2&&(t0=s0[0]+"."+s0.slice(1).join("")),s0[1]&&s0[1].length>2&&(t0=s0[0]+"."+s0[1].substring(0,2))}t0.length>1&&t0[0]==="0"&&t0[1]!=="."&&(t0=t0.substring(1)),!a0(t0)&&(t0==="."&&(t0="0."),u==null||u(t0))},o0=q=>{const t0=j.find(s0=>s0.id===q);if(t0){const s0={...t0,donationFunds:t0.donationFunds?t0.donationFunds.map(H0=>({...H0})):[]};g==null||g(s0),A==null||A(null)}else g==null||g(null),A==null||A(null)},G=q=>{var s0;if(!r)return;const t0=(s0=r.donationFunds)==null?void 0:s0.find(H0=>H0.id===q);A==null||A(t0?{...t0}:null)},D0=q=>{const t0=yZ.find(s0=>s0.id===q);h==null||h(t0||null)},S0=()=>{if(typeof a=="string"){const q=parseFloat(a);return isNaN(q)?0:q}return a||0},Z0=q=>Number(q).toFixed(2),w0=()=>{const q=S0();if(!q||q<=0){o({message:"Please enter a valid amount"});return}if(q<.5){o({message:"Please enter an amount of $0.50 or more"});return}if(!r){o({message:"Please select a campus"});return}if(!n){o({message:"Please select a fund"});return}m&&m()};return S.jsxs("div",{className:"flex flex-col h-full","data-testid":"donation-setup-form",children:[S.jsx("style",{children:LXt}),F!=="false"?S.jsx(JL,{churchName:y,churchLogo:E,message:M,title:$,displayLogo:O,theme:void 0}):null,S.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-6",ref:z,children:S.jsxs("div",{className:"space-y-4",children:[S.jsxs("div",{className:"",children:[S.jsxs("div",{className:"flex items-start justify-center text-[60px] font-bold leading-none min-h-[60px]",children:[S.jsx("span",{className:"text-3xl leading-normal font-bold mt-3 flex-none text-brand dark:text-white",children:"$"}),S.jsx("span",{ref:i0,className:"absolute invisible h-0 overflow-hidden whitespace-pre text-[80px] font-bold font-inherit p-0 m-0",style:{fontFamily:"inherit",position:"absolute",left:"-9999px",top:"-9999px"},children:a||"0"}),S.jsx("input",{type:"text",inputMode:"decimal",placeholder:"0",value:a,onKeyDown:q=>{if(!["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(q.key)){if(/^[0-9]$/.test(q.key)||q.key==="."||q.ctrlKey||q.metaKey){if(q.key==="."&&a.includes(".")){q.preventDefault();return}if(/^[0-9]$/.test(q.key)){const t0=q.target,s0=t0.value,H0=t0.selectionStart||0,b0=s0.substring(0,H0)+q.key+s0.substring(t0.selectionEnd||0);if(a0(b0)){q.preventDefault();return}}return}q.preventDefault()}},onChange:q=>{const t0=q.target.value;l0(t0),requestAnimationFrame(()=>{if(i0.current){i0.current.textContent=t0||"0";const s0=Math.max(i0.current.offsetWidth+16,80);W(s0)}})},onInput:q=>{const t0=q.target.value;if(i0.current){i0.current.textContent=t0||"0";const s0=Math.max(i0.current.offsetWidth+16,80);W(s0)}},onKeyUp:q=>{const t0=q.target.value;if(i0.current){i0.current.textContent=t0||"0";const s0=Math.max(i0.current.offsetWidth+16,80);W(s0)}},onFocus:q=>{setTimeout(()=>{q.target.select()},0)},onClick:q=>{q.target.select()},disabled:c||_,className:"text-[80px] font-bold border-none outline-none bg-transparent flex-none p-0 m-0 text-brand dark:text-white caret-current text-center appearance-none transition-[width] duration-100 ease-in-out",style:{width:`${e0}px`}})]}),B&&B.length>0?S.jsx("div",{className:"flex flex-wrap pt-12",style:{gap:"6px"},children:B.map(q=>S.jsxs(Ge,{onClick:()=>l0(q),disabled:c||_,surface:a===q?"solid":"material",className:"min-w-0 flex-1",style:{flexBasis:"calc(25% - 4.5px)",minWidth:"0",...a===q&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:["$",q]},q))}):null]}),S.jsx("div",{children:S.jsxs("div",{className:"flex",children:[S.jsxs(Ge,{onClick:()=>{h==null||h(yZ[2])},disabled:c||_,surface:N?"solid":"material",className:"flex-1 rounded-r-none",style:{...N&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:[S.jsx(mw,{size:24}),"Recurring"]}),S.jsxs(Ge,{onClick:()=>h==null?void 0:h(null),disabled:c||_,surface:N?"material":"solid",className:"flex-1 rounded-l-none",style:{...!N&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:[S.jsx(Hw,{size:24}),"One time"]})]})}),N?S.jsxs("div",{ref:k,children:[S.jsx(ge,{className:"mb-4 pl-4 text-sm",fg:"secondary",children:"Frequency"}),S.jsxs(mO,{value:(e==null?void 0:e.id)||"",onChange:q=>D0(q.target.value),disabled:c||_,required:!0,surface:"material",children:[S.jsx("option",{value:"",children:"Select a frequency"}),yZ.map(q=>S.jsx("option",{value:q.id,children:q.id},q.id))]})]}):null,S.jsxs("div",{children:[S.jsx(ge,{className:"mb-4 pl-4 text-sm",fg:"secondary",children:"Campus"}),S.jsxs(mO,{value:(r==null?void 0:r.id)||"",onChange:q=>o0(q.target.value),disabled:c||_,required:!0,surface:"material",children:[S.jsx("option",{value:"",children:_?"Loading...":"Select a campus"}),j.map(q=>S.jsx("option",{value:q.id,children:q.name},q.id))]})]}),r?S.jsxs("div",{ref:I,children:[S.jsx(ge,{className:"mb-4 pl-4 text-sm",fg:"secondary",id:"fund-label",children:"Fund"}),S.jsxs(mO,{value:(n==null?void 0:n.id)||"",onChange:q=>G(q.target.value),disabled:c,required:!0,surface:"material","aria-labelledby":"fund-label",children:[S.jsx("option",{value:"",children:"Select a fund"}),(Q=r.donationFunds)==null?void 0:Q.sort((q,t0)=>(q.displayOrder||0)-(t0.displayOrder||0)).map(q=>S.jsx("option",{value:q.id,children:q.displayName||q.name},q.id))]})]}):null]})}),S.jsxs("div",{className:"sticky bottom-0 z-10 px-6 py-4 bg-system-chrome dark:bg-system-chrome-dark",children:[S.jsxs(Ge,{type:"button",className:"w-full py-3",onClick:w0,disabled:c||_||!r||!n||S0()<=0,surface:"solid",children:["Give $",Z0(S0())," ",N&&e?e.id:""]}),S.jsx("div",{className:"text-center mt-4 px-6",children:S.jsxs(ge,{className:"text-sm",fg:"secondary",children:["By making this gift, you agree to our",S.jsx("br",{})," ",S.jsx("a",{href:"https://apollos.com/terms",target:"_blank",rel:"noopener noreferrer",className:"text-brand-primary underline",children:"Terms of Use"})," ","and"," ",S.jsx("a",{href:"https://apollos.com/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-brand-primary underline",children:"Privacy Policy"}),"."]})})]})]})},C71=({onRetry:a,theme:e})=>{var r,n;return S.jsxs("div",{className:"text-center p-6 flex flex-col items-center justify-center min-h-full",children:[S.jsx("div",{className:"mb-6",children:S.jsx(aA,{size:64,color:((n=(r=e==null?void 0:e.colors)==null?void 0:r.base)==null?void 0:n.secondary)||"#17B582",weight:"fill"})}),S.jsx(ge,{as:"h3",className:"mb-4",children:"Thank You!"}),S.jsx(ge,{fg:"secondary",className:"mb-12",children:"Your donation has been processed successfully."}),S.jsx(Ge,{surface:"solid",onClick:a,children:"Make Another Donation"})]})};C71.propTypes={onRetry:Y0.func.isRequired};const bZ=new Map,jXt=a=>typeof window>"u"?Promise.resolve(null):(bZ.has(a)||bZ.set(a,Promise.resolve().then(()=>Yea).then(({loadStripe:e})=>e(a)).catch(e=>(console.error("Failed to load Stripe.js",e),bZ.delete(a),null))),bZ.get(a)),PXt=({amount:a="0",frequency:e,message:r="",campus:n="",fund:l="",predefinedAmounts:o="",width:c="",height:m="",displayLogo:u="",title:h="",displayHeader:g="",prefilledPayment:A=null,userFirstName:y=null,userLastName:E=null,userEmail:M=null,userPhone:O=null})=>{var q0,N0,r1,T1,m1,b1;const $=W0=>typeof W0=="string"&&parseFloat(W0)>0,F=W0=>typeof W0=="string"&&W0.trim().length>0,j=W0=>W0===null||typeof W0=="string"&&W0.trim().length>0,_=W0=>W0==null||typeof W0=="object"&&!!W0.id,N=p.useCallback(W0=>W0?$(W0.amount)&&F(W0.campusId)&&j(W0.fundId||null)&&_(W0.selectedFrequency):!1,[]),[k,I]=p.useState("setup"),[z,B]=p.useState(""),[e0,W]=p.useState(null),[i0,a0]=p.useState(!1),[l0,o0]=p.useState(null),[G,D0]=p.useState(()=>({amount:a,selectedFrequency:$d(e),selectedCampusId:n||null,selectedFundId:l||null,selectedCampus:null,selectedFund:null})),[S0,Z0]=p.useState(!1);p.useEffect(()=>{A&&A.amount&&A.campusId&&D0({amount:A.amount,selectedFrequency:A.selectedFrequency??null,selectedCampusId:A.campusId,selectedFundId:A.fundId??null,selectedCampus:null,selectedFund:null})},[A]);const w0=p.useRef({amount:a,campus:n,fund:l}),{currentChurch:Q,loading:q,error:t0}=YL(),{campuses:s0}=QL(),H0=F71(),b0=VXt(),m0=p.useMemo(()=>{var C1,x1,a1,E1,Q1,Ze,Me,s2,n2,G2,De,Le,Re,a2;const W0={light:{primary:((x1=(C1=b0==null?void 0:b0.colors)==null?void 0:C1.base)==null?void 0:x1.primary)||"#00676D",background:Qe.colors.light.fill.screen,componentBackground:Qe.colors.light.fill.paper,componentBorder:Qe.colors.light.neutral.gray5,componentDivider:Qe.colors.light.neutral.gray4,primaryText:Qe.colors.light.text.primary,secondaryText:Qe.colors.light.text.secondary,componentText:Qe.colors.light.text.primary,icon:Qe.colors.light.neutral.gray},dark:{primary:((E1=(a1=b0==null?void 0:b0.colors)==null?void 0:a1.base)==null?void 0:E1.secondary)||"#17B582",background:Qe.colors.dark.fill.screen,componentBackground:Qe.colors.dark.fill.paper,componentBorder:Qe.colors.dark.neutral.gray5,componentDivider:Qe.colors.dark.neutral.gray4,primaryText:Qe.colors.dark.text.primary,secondaryText:Qe.colors.dark.text.secondary,componentText:Qe.colors.dark.text.primary,icon:Qe.colors.dark.neutral.gray}};return{theme:H0==="dark"?"night":"stripe",variables:{colorPrimary:((Ze=(Q1=b0==null?void 0:b0.colors)==null?void 0:Q1.base)==null?void 0:Ze.primary)||"#00676D",colorBackground:H0==="dark"?W0.dark.componentBackground:W0.light.componentBackground,colorText:H0==="dark"?W0.dark.primaryText:W0.light.primaryText,colorTextSecondary:H0==="dark"?W0.dark.secondaryText:W0.light.secondaryText,colorTextPlaceholder:H0==="dark"?W0.dark.secondaryText:W0.light.secondaryText,colorDanger:((s2=(Me=b0==null?void 0:b0.colors)==null?void 0:Me.base)==null?void 0:s2.alert)||"#FF4444",colorSuccess:((G2=(n2=b0==null?void 0:b0.colors)==null?void 0:n2.base)==null?void 0:G2.success)||"#17B582",colorWarning:((Le=(De=b0==null?void 0:b0.colors)==null?void 0:De.base)==null?void 0:Le.warning)||"#FFA500",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",fontSizeBase:"16px",spacingUnit:((Re=b0==null?void 0:b0.space)==null?void 0:Re.xxxs)||"4px",borderRadius:((a2=b0==null?void 0:b0.radii)==null?void 0:a2.base)||"6px",iconColor:H0==="dark"?W0.dark.icon:W0.light.icon}}},[b0,H0]);p.useEffect(()=>{var x1;const W0=(x1=Q==null?void 0:Q.stripeConnectAccount)==null?void 0:x1.publishableKey;if(!W0){o0(null);return}const C1=jXt(W0);o0(C1)},[(q0=Q==null?void 0:Q.stripeConnectAccount)==null?void 0:q0.publishableKey]),p.useEffect(()=>{A||(((Q==null?void 0:Q.slug)==="crossroads"||(Q==null?void 0:Q.slug)==="crossroads_sandbox")&&e===void 0?D0(W0=>({...W0,selectedFrequency:$d("monthly")})):D0(W0=>({...W0,selectedFrequency:$d(e)})))},[Q==null?void 0:Q.slug,A,e]),p.useEffect(()=>{!A&&a!==w0.current.amount&&a!==G.amount&&D0(W0=>({...W0,amount:a})),w0.current.amount=a},[a,A]),p.useEffect(()=>{!A&&n!==w0.current.campus&&n!==G.selectedCampusId&&D0(W0=>({...W0,selectedCampusId:n||null,selectedCampus:null,selectedFund:null,selectedFundId:null})),w0.current.campus=n},[n,A]),p.useEffect(()=>{!A&&l!==w0.current.fund&&l!==G.selectedFundId&&D0(W0=>({...W0,selectedFundId:l||null,selectedFund:null})),w0.current.fund=l},[l,A]),p.useEffect(()=>{var W0;if(!A&&G.selectedFundId&&((W0=G.selectedCampus)!=null&&W0.donationFunds)&&!G.selectedFund){let C1=G.selectedCampus.donationFunds.find(x1=>x1.id===G.selectedFundId);C1||(C1=G.selectedCampus.donationFunds.find(x1=>wd(G.selectedFundId,x1.name)||x1.displayName&&wd(G.selectedFundId,x1.displayName))),C1&&D0(x1=>({...x1,selectedFund:{...C1}}))}},[A,G.selectedFundId,(N0=G.selectedCampus)==null?void 0:N0.donationFunds,G.selectedFund]),p.useEffect(()=>{if(s0.length>0&&G.selectedCampusId&&!G.selectedCampus){const W0=G.selectedCampusId.startsWith("Campus:")?G.selectedCampusId.substring(7):G.selectedCampusId;let C1=s0.find(x1=>x1.id===W0);if(C1||(C1=s0.find(x1=>x1.id===G.selectedCampusId)),C1||(C1=s0.find(x1=>wd(G.selectedCampusId,x1.name))),C1){const x1={...C1,donationFunds:C1.donationFunds?C1.donationFunds.map(a1=>({...a1})):[]};if(D0(a1=>({...a1,selectedCampus:x1})),G.selectedFundId&&x1.donationFunds){let a1=x1.donationFunds.find(E1=>E1.id===G.selectedFundId);a1||(a1=x1.donationFunds.find(E1=>wd(G.selectedFundId,E1.name)||E1.displayName&&wd(G.selectedFundId,E1.displayName))),a1&&D0(E1=>({...E1,selectedFund:{...a1}}))}}}},[s0,G.selectedCampusId,G.selectedFundId,G.selectedCampus]);const[x0,{loading:X}]=HXt(),v0=p.useCallback(()=>{I("success")},[]),f0=p.useCallback(W0=>{B(W0.message)},[]),y0=p.useCallback(()=>{B("")},[]),g0=p.useCallback(()=>{I("setup"),B(""),W(null),Z0(!1),D0({amount:a,selectedFrequency:$d(e),selectedCampusId:null,selectedFundId:null,selectedCampus:null,selectedFund:null}),a0(!1)},[a,e]),n0=p.useCallback(W0=>{D0(C1=>({...C1,amount:W0}))},[]),_0=p.useCallback(W0=>{D0(C1=>({...C1,selectedFrequency:W0}))},[]),h0=p.useCallback(W0=>{D0(C1=>({...C1,selectedCampus:W0,selectedCampusId:(W0==null?void 0:W0.id)||null,selectedFund:null,selectedFundId:null}))},[]),B0=p.useCallback(W0=>{D0(C1=>({...C1,selectedFund:W0,selectedFundId:(W0==null?void 0:W0.id)||null}))},[]),Q0=p.useCallback(async(W0,C1,x1,a1)=>{var E1;try{const Q1={amount:Math.round(W0*100),campusId:x1||"",fundId:a1||null};Q1.recurring=$Xt(C1);const{data:Ze,errors:Me}=await x0({variables:{input:Q1}});if(Me)throw new Error(Me[0].message);if((E1=Ze==null?void 0:Ze.createPaymentIntent)!=null&&E1.clientSecret)W(Ze.createPaymentIntent.clientSecret),I("payment");else throw new Error("No client secret received from server")}catch(Q1){f0(Q1)}},[x0,f0]),h1=p.useCallback(()=>{I("setup"),W(null)},[]),_1={width:c?isNaN(Number(c))?c:`${c}px`:"100%",height:m?isNaN(Number(m))?m:`${m}px`:"500px",maxWidth:c?void 0:"400px",margin:c?"0":"0 auto",border:"none",position:"relative",overflow:"hidden",padding:0},H1=q||!l0||X||i0;if(p.useEffect(()=>{A&&N(A)&&!q&&!X&&!S0&&k==="setup"&&(Z0(!0),D0({amount:A.amount,selectedFrequency:A.selectedFrequency??null,selectedCampusId:A.campusId,selectedFundId:A.fundId??null,selectedCampus:null,selectedFund:null}),Q0(parseFloat(A.amount),k71(A.selectedFrequency),A.campusId,A.fundId??""))},[A,q,X,S0,k,Q0,N]),t0)return S.jsx(U6,{style:_1,children:S.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:[S.jsx(ge,{className:"text-red-600",children:"Unable to load church information. Please try again later."}),S.jsx(Ge,{surface:"tinted",onClick:g0,className:"mt-2",children:"Try Again"})]})});if(!q&&!l0)return S.jsx(U6,{style:_1,children:S.jsx("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:S.jsx(ge,{className:"text-red-600",children:"Online giving is not currently available. Please contact your church for assistance."})})});if(k==="success")return S.jsx(U6,{style:_1,children:S.jsx("div",{className:"flex-1 flex flex-col justify-center items-center",children:S.jsx(C71,{onRetry:g0,theme:b0||void 0})})});const d1=y||E?`${y} ${E}`.trim():"",t1=(Q==null?void 0:Q.name)||"Your Church";return S.jsxs(U6,{style:_1,children:[H1?S.jsx("div",{className:"absolute inset-0 bg-material-screen dark:bg-material-screen-dark flex items-center justify-center z-[1000]",children:S.jsx(m5,{size:32,className:"animate-spin mx-auto mb-2"})}):null,z?S.jsxs("div",{className:"absolute top-0 left-0 right-0 z-[50] p-3 flex items-center gap-2 bg-red-50 dark:bg-red-900 rounded-xl",style:{borderColor:((T1=(r1=b0==null?void 0:b0.colors)==null?void 0:r1.base)==null?void 0:T1.alert)||"#FF4444"},children:[S.jsx(Fw,{size:20,color:((b1=(m1=b0==null?void 0:b0.colors)==null?void 0:m1.base)==null?void 0:b1.alert)||"#FF4444",weight:"fill"}),S.jsx("div",{className:"flex-1",children:S.jsx(ge,{className:"text-red-700 dark:text-red-300 font-medium text-sm",children:z})}),S.jsx(Ge,{surface:"tinted",onClick:y0,className:"p-1 min-w-0 text-red-700 dark:text-red-300 hover:bg-red-100 dark:hover:bg-red-800/30",children:S.jsx(ug,{size:16})})]}):null,S.jsx("div",{className:"flex flex-col h-full min-h-[400px]",children:k==="payment"&&e0&&l0?S.jsx($71,{stripe:l0,options:{clientSecret:e0,appearance:m0},children:S.jsx(_71,{amount:G!=null&&G.amount?parseFloat(G.amount):parseFloat(a),selectedFrequency:G==null?void 0:G.selectedFrequency,selectedCampusId:(G==null?void 0:G.selectedCampusId)||void 0,selectedFundId:(G==null?void 0:G.selectedFundId)||void 0,onSuccess:v0,onError:f0,isProcessing:i0,onProcessingChange:a0,onBack:h1,userFullName:d1,userEmail:M||void 0,userPhone:O||void 0,churchName:t1,churchLogo:Q==null?void 0:Q.logo,message:r,displayLogo:u,title:h,displayHeader:g})}):S.jsx(S.Fragment,{children:k==="setup"&&!(A&&N(A)&&!S0)?S.jsx(FXt,{amount:G.amount,selectedFrequency:G.selectedFrequency,selectedCampus:G.selectedCampus,selectedFund:G.selectedFund,predefinedAmounts:o,onError:W0=>f0(new Error(W0.message)),isProcessing:X,onAmountChange:n0,onFrequencyChange:_0,onCampusChange:h0,onFundChange:B0,onShowPayment:()=>{const W0=typeof G.amount=="string"?parseFloat(G.amount):G.amount,C1=k71(G.selectedFrequency);Q0(W0,C1,G.selectedCampusId||"",G.selectedFundId||"")},churchName:t1,churchLogo:Q==null?void 0:Q.logo,message:r,displayLogo:u,title:h,displayHeader:g}):k==="setup"&&A&&N(A)&&!S0?S.jsxs("div",{className:"flex flex-col justify-center items-center h-full min-h-[400px]",children:[S.jsx(m5,{size:32,className:"animate-spin mx-auto mb-2"}),S.jsx(ge,{children:"Preparing your donation..."})]}):null})})]})},kXt=a=>{const[e,r]=p.useState(!1);p.useEffect(()=>{r(!0)},[]);const n=()=>({width:a.width?isNaN(Number(a.width))?a.width:`${a.width}px`:"100%",height:a.height?isNaN(Number(a.height))?a.height:`${a.height}px`:"500px",maxWidth:a.width?void 0:"400px",margin:a.width?"0":"0 auto",border:"none",position:"relative",overflow:"hidden",padding:0});return S.jsx(P71,{children:e?S.jsx(PXt,{...a}):S.jsx(U6,{style:n(),children:S.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:[S.jsx(m5,{size:32,className:"animate-spin mx-auto mb-2"}),S.jsx(ge,{className:"text-center",children:"Loading donation form..."})]})})})},_Xt=p.forwardRef(function({to:e,href:r,isExternal:n,...l},o){const{navigate:c}=aZ(),m=e51(),u=t51(),h=a51(),g=$L(),A=kUt();if(n&&r||!e)return S.jsx("a",{ref:o,href:r,...l});let y;if(typeof e=="object"){if(!e.contentId)return null;y=e.contentId.split(":").join("-")}else if(e!=null&&e.includes("ContentItem"))y=e.split("/").slice(-1)[0];else return null;if(!h&&!g)return S.jsx("a",{ref:o,...l,href:`https://apollos.site/@${A}/c/${y}`,target:"_blank",rel:"noopener noreferrer"});let E=u&&g?`/ac/${y}`:`?${m?"apollosId":"id"}=${y}`;return g||(E=`${h}${r}`),S.jsx("a",{ref:o,...l,href:E,onClick:M=>{M.preventDefault(),c({id:y})}})}),CXt=({children:a})=>S.jsx(x$1,{linkComponent:_Xt,children:a});function HZ(){return HZ=Object.assign?Object.assign.bind():function(a){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(a[n]=r[n])}return a},HZ.apply(null,arguments)}function N71(a,e){if(a==null)return{};var r={};for(var n in a)if({}.hasOwnProperty.call(a,n)){if(e.indexOf(n)>=0)continue;r[n]=a[n]}return r}function eF(a,e){return eF=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},eF(a,e)}function T71(a,e){a.prototype=Object.create(e.prototype),a.prototype.constructor=a,eF(a,e)}function NXt(a,e){return a.classList?!!e&&a.classList.contains(e):(" "+(a.className.baseVal||a.className)+" ").indexOf(" "+e+" ")!==-1}function TXt(a,e){a.classList?a.classList.add(e):NXt(a,e)||(typeof a.className=="string"?a.className=a.className+" "+e:a.setAttribute("class",(a.className&&a.className.baseVal||"")+" "+e))}function I71(a,e){return a.replace(new RegExp("(^|\\s)"+e+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function IXt(a,e){a.classList?a.classList.remove(e):typeof a.className=="string"?a.className=I71(a.className,e):a.setAttribute("class",I71(a.className&&a.className.baseVal||"",e))}const x71={disabled:!1};var D71={},xXt=D71.NODE_ENV!=="production"?Y0.oneOfType([Y0.number,Y0.shape({enter:Y0.number,exit:Y0.number,appear:Y0.number}).isRequired]):null,DXt=D71.NODE_ENV!=="production"?Y0.oneOfType([Y0.string,Y0.shape({enter:Y0.string,exit:Y0.string,active:Y0.string}),Y0.shape({enter:Y0.string,enterDone:Y0.string,enterActive:Y0.string,exit:Y0.string,exitDone:Y0.string,exitActive:Y0.string})]):null;const R71=t.createContext(null);var z71=function(e){return e.scrollTop},RXt={},Sd="unmounted",P5="exited",k5="entering",b9="entered",tF="exiting",xn=function(a){T71(e,a);function e(n,l){var o;o=a.call(this,n,l)||this;var c=l,m=c&&!c.isMounting?n.enter:n.appear,u;return o.appearStatus=null,n.in?m?(u=P5,o.appearStatus=k5):u=b9:n.unmountOnExit||n.mountOnEnter?u=Sd:u=P5,o.state={status:u},o.nextCallback=null,o}e.getDerivedStateFromProps=function(l,o){var c=l.in;return c&&o.status===Sd?{status:P5}:null};var r=e.prototype;return r.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},r.componentDidUpdate=function(l){var o=null;if(l!==this.props){var c=this.state.status;this.props.in?c!==k5&&c!==b9&&(o=k5):(c===k5||c===b9)&&(o=tF)}this.updateStatus(!1,o)},r.componentWillUnmount=function(){this.cancelNextCallback()},r.getTimeouts=function(){var l=this.props.timeout,o,c,m;return o=c=m=l,l!=null&&typeof l!="number"&&(o=l.exit,c=l.enter,m=l.appear!==void 0?l.appear:c),{exit:o,enter:c,appear:m}},r.updateStatus=function(l,o){if(l===void 0&&(l=!1),o!==null)if(this.cancelNextCallback(),o===k5){if(this.props.unmountOnExit||this.props.mountOnEnter){var c=this.props.nodeRef?this.props.nodeRef.current:em.findDOMNode(this);c&&z71(c)}this.performEnter(l)}else this.performExit();else this.props.unmountOnExit&&this.state.status===P5&&this.setState({status:Sd})},r.performEnter=function(l){var o=this,c=this.props.enter,m=this.context?this.context.isMounting:l,u=this.props.nodeRef?[m]:[em.findDOMNode(this),m],h=u[0],g=u[1],A=this.getTimeouts(),y=m?A.appear:A.enter;if(!l&&!c||x71.disabled){this.safeSetState({status:b9},function(){o.props.onEntered(h)});return}this.props.onEnter(h,g),this.safeSetState({status:k5},function(){o.props.onEntering(h,g),o.onTransitionEnd(y,function(){o.safeSetState({status:b9},function(){o.props.onEntered(h,g)})})})},r.performExit=function(){var l=this,o=this.props.exit,c=this.getTimeouts(),m=this.props.nodeRef?void 0:em.findDOMNode(this);if(!o||x71.disabled){this.safeSetState({status:P5},function(){l.props.onExited(m)});return}this.props.onExit(m),this.safeSetState({status:tF},function(){l.props.onExiting(m),l.onTransitionEnd(c.exit,function(){l.safeSetState({status:P5},function(){l.props.onExited(m)})})})},r.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},r.safeSetState=function(l,o){o=this.setNextCallback(o),this.setState(l,o)},r.setNextCallback=function(l){var o=this,c=!0;return this.nextCallback=function(m){c&&(c=!1,o.nextCallback=null,l(m))},this.nextCallback.cancel=function(){c=!1},this.nextCallback},r.onTransitionEnd=function(l,o){this.setNextCallback(o);var c=this.props.nodeRef?this.props.nodeRef.current:em.findDOMNode(this),m=l==null&&!this.props.addEndListener;if(!c||m){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var u=this.props.nodeRef?[this.nextCallback]:[c,this.nextCallback],h=u[0],g=u[1];this.props.addEndListener(h,g)}l!=null&&setTimeout(this.nextCallback,l)},r.render=function(){var l=this.state.status;if(l===Sd)return null;var o=this.props,c=o.children;o.in,o.mountOnEnter,o.unmountOnExit,o.appear,o.enter,o.exit,o.timeout,o.addEndListener,o.onEnter,o.onEntering,o.onEntered,o.onExit,o.onExiting,o.onExited,o.nodeRef;var m=N71(o,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return t.createElement(R71.Provider,{value:null},typeof c=="function"?c(l,m):t.cloneElement(t.Children.only(c),m))},e}(t.Component);xn.contextType=R71,xn.propTypes=RXt.NODE_ENV!=="production"?{nodeRef:Y0.shape({current:typeof Element>"u"?Y0.any:function(a,e,r,n,l,o){var c=a[e];return Y0.instanceOf(c&&"ownerDocument"in c?c.ownerDocument.defaultView.Element:Element)(a,e,r,n,l,o)}}),children:Y0.oneOfType([Y0.func.isRequired,Y0.element.isRequired]).isRequired,in:Y0.bool,mountOnEnter:Y0.bool,unmountOnExit:Y0.bool,appear:Y0.bool,enter:Y0.bool,exit:Y0.bool,timeout:function(e){var r=xXt;e.addEndListener||(r=r.isRequired);for(var n=arguments.length,l=new Array(n>1?n-1:0),o=1;o<n;o++)l[o-1]=arguments[o];return r.apply(void 0,[e].concat(l))},addEndListener:Y0.func,onEnter:Y0.func,onEntering:Y0.func,onEntered:Y0.func,onExit:Y0.func,onExiting:Y0.func,onExited:Y0.func}:{};function H9(){}xn.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:H9,onEntering:H9,onEntered:H9,onExit:H9,onExiting:H9,onExited:H9},xn.UNMOUNTED=Sd,xn.EXITED=P5,xn.ENTERING=k5,xn.ENTERED=b9,xn.EXITING=tF;var zXt={},UXt=function(e,r){return e&&r&&r.split(" ").forEach(function(n){return TXt(e,n)})},aF=function(e,r){return e&&r&&r.split(" ").forEach(function(n){return IXt(e,n)})},rF=function(a){T71(e,a);function e(){for(var n,l=arguments.length,o=new Array(l),c=0;c<l;c++)o[c]=arguments[c];return n=a.call.apply(a,[this].concat(o))||this,n.appliedClasses={appear:{},enter:{},exit:{}},n.onEnter=function(m,u){var h=n.resolveArguments(m,u),g=h[0],A=h[1];n.removeClasses(g,"exit"),n.addClass(g,A?"appear":"enter","base"),n.props.onEnter&&n.props.onEnter(m,u)},n.onEntering=function(m,u){var h=n.resolveArguments(m,u),g=h[0],A=h[1],y=A?"appear":"enter";n.addClass(g,y,"active"),n.props.onEntering&&n.props.onEntering(m,u)},n.onEntered=function(m,u){var h=n.resolveArguments(m,u),g=h[0],A=h[1],y=A?"appear":"enter";n.removeClasses(g,y),n.addClass(g,y,"done"),n.props.onEntered&&n.props.onEntered(m,u)},n.onExit=function(m){var u=n.resolveArguments(m),h=u[0];n.removeClasses(h,"appear"),n.removeClasses(h,"enter"),n.addClass(h,"exit","base"),n.props.onExit&&n.props.onExit(m)},n.onExiting=function(m){var u=n.resolveArguments(m),h=u[0];n.addClass(h,"exit","active"),n.props.onExiting&&n.props.onExiting(m)},n.onExited=function(m){var u=n.resolveArguments(m),h=u[0];n.removeClasses(h,"exit"),n.addClass(h,"exit","done"),n.props.onExited&&n.props.onExited(m)},n.resolveArguments=function(m,u){return n.props.nodeRef?[n.props.nodeRef.current,m]:[m,u]},n.getClassNames=function(m){var u=n.props.classNames,h=typeof u=="string",g=h&&u?u+"-":"",A=h?""+g+m:u[m],y=h?A+"-active":u[m+"Active"],E=h?A+"-done":u[m+"Done"];return{baseClassName:A,activeClassName:y,doneClassName:E}},n}var r=e.prototype;return r.addClass=function(l,o,c){var m=this.getClassNames(o)[c+"ClassName"],u=this.getClassNames("enter"),h=u.doneClassName;o==="appear"&&c==="done"&&h&&(m+=" "+h),c==="active"&&l&&z71(l),m&&(this.appliedClasses[o][c]=m,UXt(l,m))},r.removeClasses=function(l,o){var c=this.appliedClasses[o],m=c.base,u=c.active,h=c.done;this.appliedClasses[o]={},m&&aF(l,m),u&&aF(l,u),h&&aF(l,h)},r.render=function(){var l=this.props;l.classNames;var o=N71(l,["classNames"]);return t.createElement(xn,HZ({},o,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},e}(t.Component);rF.defaultProps={classNames:""},rF.propTypes=zXt.NODE_ENV!=="production"?HZ({},xn.propTypes,{classNames:DXt,onEnter:Y0.func,onEntering:Y0.func,onEntered:Y0.func,onExit:Y0.func,onExiting:Y0.func,onExited:Y0.func}):{};const U71={Search:xe(rF)`
|
|
1916
1916
|
opacity: 0;
|
|
1917
1917
|
transition: opacity 0.3s ease-in-out;
|
|
1918
1918
|
|