@apollosproject/canvas-embeds 2.1.489 → 2.1.491
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/widget/index.js +1 -1
package/package.json
CHANGED
package/widget/index.js
CHANGED
|
@@ -1277,7 +1277,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1277
1277
|
clientSecret
|
|
1278
1278
|
}
|
|
1279
1279
|
}
|
|
1280
|
-
`;function x2e(a={}){return W3(D2e,a)}const rL=a=>a&&a.id?a.id:!1,OX=a=>{if(!rL(a))return"one-time";const e=a.id.toLowerCase();return e==="monthly"?"monthly":e==="weekly"?"weekly":e==="every 2 weeks"?"every-2-weeks":"monthly"},$X=({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 w.jsxs(d1,{className:"sticky top-0 z-10 px-6 py-4 bg-system-chrome dark:bg-system-chrome-dark text-center",children:[c?w.jsx(d1,{mb:3,children:w.jsx(d1,{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:w.jsx("img",{src:e,alt:`${a} logo`,className:"max-w-[60px] max-h-[60px] object-contain"})})}):null,m?w.jsx(Z9,{children:m}):null,r&&r!==""?w.jsx(xl,{color:"text.secondary",mt:2,children:r}):null]})};$X.propTypes={churchName:j0.string.isRequired,churchLogo:j0.string,message:j0.string,title:j0.string,displayLogo:j0.string};const wX=Te($X),SX=({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:S,displayHeader:F})=>{var A0;const j=S2e(),k=M2e(),{currentChurch:N}=Dc(),{campuses:C}=QS(),[I,z]=p.useState(!1),[q,t0]=p.useState(h),[W,o0]=p.useState(g),e0=zQ()==="dark",l0=x0=>{const W0=x0.replace(/\D/g,"").slice(0,10);return W0.length===0?"":W0.length<=3?W0:W0.length<=6?`(${W0.slice(0,3)}) ${W0.slice(3)}`:`(${W0.slice(0,3)}) ${W0.slice(3,6)}-${W0.slice(6)}`},[J,G0]=p.useState(A?l0(A):""),y0=x0=>{const k0=l0(x0.target.value);G0(k0)},g0=()=>typeof a=="string"?parseFloat(a):a,L0=rL(e),B=C.find(x0=>x0.id===r),Y=(A0=B==null?void 0:B.donationFunds)==null?void 0:A0.find(x0=>x0.id===n),n0=()=>{const x0={name:`${(B==null?void 0:B.name)||"Church"} Donation`,amount:Math.round(g0()*100)};return Y&&(x0.name=`${Y.displayName||Y.name} Donation`),[x0]},d0=()=>!L0||!e?void 0:{recurringPaymentRequest:{paymentDescription:`${y} ${e.id} donation`,managementURL:(N==null?void 0:N.givingWebUrl)||window.location.href,regularBilling:{amount:Math.round(g0()*100),label:`${e.id} donation`,recurringPaymentIntervalUnit:e.id==="yearly"?"year":"month",recurringPaymentIntervalCount:1}}},O0=async x0=>{const{error:k0,paymentIntent:W0}=x0;if(k0)throw console.error("Payment error:",k0),o(k0),new Error(k0.message);
|
|
1280
|
+
`;function x2e(a={}){return W3(D2e,a)}const rL=a=>a&&a.id?a.id:!1,OX=a=>{if(!rL(a))return"one-time";const e=a.id.toLowerCase();return e==="monthly"?"monthly":e==="weekly"?"weekly":e==="every 2 weeks"?"every-2-weeks":"monthly"},$X=({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 w.jsxs(d1,{className:"sticky top-0 z-10 px-6 py-4 bg-system-chrome dark:bg-system-chrome-dark text-center",children:[c?w.jsx(d1,{mb:3,children:w.jsx(d1,{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:w.jsx("img",{src:e,alt:`${a} logo`,className:"max-w-[60px] max-h-[60px] object-contain"})})}):null,m?w.jsx(Z9,{children:m}):null,r&&r!==""?w.jsx(xl,{color:"text.secondary",mt:2,children:r}):null]})};$X.propTypes={churchName:j0.string.isRequired,churchLogo:j0.string,message:j0.string,title:j0.string,displayLogo:j0.string};const wX=Te($X),SX=({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:S,displayHeader:F})=>{var A0;const j=S2e(),k=M2e(),{currentChurch:N}=Dc(),{campuses:C}=QS(),[I,z]=p.useState(!1),[q,t0]=p.useState(h),[W,o0]=p.useState(g),e0=zQ()==="dark",l0=x0=>{const W0=x0.replace(/\D/g,"").slice(0,10);return W0.length===0?"":W0.length<=3?W0:W0.length<=6?`(${W0.slice(0,3)}) ${W0.slice(3)}`:`(${W0.slice(0,3)}) ${W0.slice(3,6)}-${W0.slice(6)}`},[J,G0]=p.useState(A?l0(A):""),y0=x0=>{const k0=l0(x0.target.value);G0(k0)},g0=()=>typeof a=="string"?parseFloat(a):a,L0=rL(e),B=C.find(x0=>x0.id===r),Y=(A0=B==null?void 0:B.donationFunds)==null?void 0:A0.find(x0=>x0.id===n),n0=()=>{const x0={name:`${(B==null?void 0:B.name)||"Church"} Donation`,amount:Math.round(g0()*100)};return Y&&(x0.name=`${Y.displayName||Y.name} Donation`),[x0]},d0=()=>!L0||!e?void 0:{recurringPaymentRequest:{paymentDescription:`${y} ${e.id} donation`,managementURL:(N==null?void 0:N.givingWebUrl)||window.location.href,regularBilling:{amount:Math.round(g0()*100),label:`${e.id} donation`,recurringPaymentIntervalUnit:e.id==="yearly"?"year":"month",recurringPaymentIntervalCount:1}}},O0=async x0=>{const{error:k0,paymentIntent:W0}=x0;if(k0)throw console.error("Payment error:",k0),o(k0),new Error(k0.message);if(W0&&W0.status==="succeeded")return typeof l=="function"&&l(),!0;if(W0&&W0.status==="requires_action")console.warn("Payment requires additional action:",W0),o(new Error("Payment requires additional authentication"));else{if(W0&&W0.status==="processing")return console.warn("Payment is being processed:",W0),typeof l=="function"&&l(),!0;console.warn("Payment not successful, status:",W0==null?void 0:W0.status),o(new Error(`Payment not successful. Status: ${(W0==null?void 0:W0.status)||"unknown"}`))}return!1},S0=async(x0={})=>{if(!j||!k)throw new Error("Stripe or Elements not available");const k0={elements:k,redirect:"if_required",confirmParams:{payment_method_data:{billing_details:{name:q,email:W,phone:J},metadata:{amount:g0().toString(),frequency:e?e.id:"one-time",campusId:r||"",fundId:n||"",isRecurring:L0&&e?"true":"false",churchSlug:(N==null?void 0:N.slug)||""}},...x0}};return await j.confirmPayment(k0)},c0=async x0=>{var k0,W0,t1,A1;if(!j||!k)throw new Error("Stripe or Elements not available");try{const{error:T1}=await k.submit();if(T1)throw T1;const{error:H1,confirmationToken:u1}=await j.createConfirmationToken({elements:k,params:{payment_method_data:{billing_details:{email:(k0=x0.detail)==null?void 0:k0.email,phone:(W0=x0.detail)==null?void 0:W0.phone,name:(t1=x0.detail)==null?void 0:t1.name},metadata:{amount:g0().toString(),frequency:e?e.id:"one-time",campusId:r||"",fundId:n||"",isRecurring:L0&&e?"true":"false",churchSlug:(N==null?void 0:N.slug)||""}},return_url:window.location.href}});if(H1)throw H1;return await j.confirmPayment({clientSecret:(A1=k._lastSubmittedOptions)==null?void 0:A1.clientSecret,confirmParams:{confirmation_token:u1.id}})}catch(T1){throw console.error("Express checkout payment error:",T1),T1}},z0=async x0=>{if(x0.preventDefault(),!j||!k)return;if(!q.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(!tK(J.replace(/\D/g,""))){o(new Error("Please enter a valid 10-digit phone number"));return}m(!0);let W0=!1;try{const t1=await S0();W0=await O0(t1)}catch(t1){console.error("Payment error:",t1),o(t1)}finally{W0||m(!1)}},K=async x0=>{if(!j)return;m(!0);let k0=!1;try{const W0=await c0(x0);k0=await O0(W0)}catch(W0){console.error("Express checkout payment error:",W0),o(W0)}finally{k0||m(!1)}},h0=()=>{z(!0)},f0=(N==null?void 0:N.givingFullPlatform)===!0?void 0:n0(),Z0=(N==null?void 0:N.givingFullPlatform)===!0?void 0:d0(),v0=(N==null?void 0:N.givingFullPlatform)===!0?void 0:{emailRequired:!0,phoneNumberRequired:!0,lineItems:f0,applePay:Z0,buttonType:{applePay:"donate",googlePay:"donate"},buttonTheme:{applePay:e0?"white":"black",googlePay:e0?"white":"black"},paymentMethods:{amazonPay:"never",applePay:"auto",googlePay:"auto",link:"never",paypal:"never",klarna:"never"}};return w.jsx(d1,{display:"flex",flexDirection:"column",className:"h-full min-h-[400px]",children:w.jsxs(d1,{as:"form",onSubmit:z0,className:"h-full flex flex-col",children:[w.jsx(We,{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:w.jsx(KS,{size:20})}),F!=="false"?w.jsx(wX,{churchName:y,churchLogo:E,message:M,title:S,displayLogo:O}):null,(N==null?void 0:N.givingFullPlatform)===!0?w.jsx(d1,{flex:1,className:"min-h-0 overflow-y-auto p-4",children:w.jsxs(d1,{className:"space-y-4",children:[w.jsxs(hw1,{className:"space-y-2",children:[w.jsxs(KV,{className:"[&>[data-slot=label]+[data-slot=control]]:mt-1",children:[w.jsx(XV,{htmlFor:"fullName",className:"!font-normal !text-gray-700 dark:!text-gray-300",children:"Full Name"}),w.jsx(Sl,{type:"text",id:"fullName",name:"fullName",value:q,onChange:x0=>t0(x0.target.value),required:!0,placeholder:"Enter your full name",className:"text-sm h-11 px-3 py-2"})]}),w.jsxs(KV,{className:"[&>[data-slot=label]+[data-slot=control]]:mt-1",children:[w.jsx(XV,{htmlFor:"email",className:"!font-normal !text-gray-700 dark:!text-gray-300",children:"Email Address"}),w.jsx(Sl,{type:"email",id:"email",name:"email",value:W,onChange:x0=>o0(x0.target.value),required:!0,placeholder:"Enter your email address",className:"text-sm h-11 px-3 py-2"})]}),w.jsxs(KV,{className:"[&>[data-slot=label]+[data-slot=control]]:mt-1",children:[w.jsx(XV,{htmlFor:"phoneNumber",className:"!font-normal !text-gray-700 dark:!text-gray-300",children:"Phone Number"}),w.jsx(Sl,{type:"tel",id:"phoneNumber",name:"phoneNumber",value:J,onChange:y0,required:!0,placeholder:"(555) 555-5555",className:"text-sm h-11 px-3 py-2"})]})]}),w.jsx(d1,{children:w.jsx(L2e,{options:{wallets:{applePay:"auto",googlePay:"auto",link:"never"},fields:{billingDetails:{name:"never",email:"never",phone:"never",address:"auto"}}}})})]})}):w.jsx(d1,{flex:1,className:"min-h-0 overflow-y-auto p-4",children:w.jsx(d1,{className:"h-full flex items-center justify-center",children:w.jsxs(d1,{className:"text-center space-y-2",children:[w.jsxs(d1,{className:"flex items-start justify-center",children:[w.jsx("span",{className:"text-3xl leading-normal font-bold text-brand",children:"$"}),w.jsx("span",{className:"text-[60px] font-bold text-brand leading-none",children:g0()})]}),w.jsxs(d1,{className:"space-y-1",children:[w.jsxs(d1,{className:"flex items-center justify-center gap-2",children:[w.jsxs(xl,{color:"text.secondary",children:[L0&&e?e.id:"One-time"," ","Donation"]}),L0&&e?w.jsx(xl,{color:"text.secondary",children:"Recurring payment"}):null]}),B&&Y?w.jsxs(d1,{className:"flex items-center justify-center gap-2",children:[w.jsx(xl,{color:"text.secondary",children:B.name}),w.jsx(xl,{color:"text.secondary",children:"•"}),w.jsx(xl,{color:"text.secondary",children:Y.displayName||Y.name})]}):null]})]})})}),w.jsx(d1,{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?w.jsxs(d1,{className:"space-y-4",children:[w.jsx(We,{type:"submit",className:"w-full",disabled:!j||c,surface:"solid",children:c?"Processing...":`Complete $${g0()} ${L0&&e?e.id:"one-time"} Donation`}),w.jsx(xl,{color:"text.secondary",textAlign:"center",children:"Your payment is secure and encrypted"})]}):w.jsxs(d1,{className:"space-y-4",style:{display:I?"block":"none"},children:[w.jsx(F2e,{options:v0,onConfirm:K,onReady:h0}),w.jsxs(We,{href:N==null?void 0:N.givingWebUrl,target:"_blank",rel:"noopener noreferrer",className:"w-full !rounded-[5px]",disabled:!j||c,surface:"system",children:[w.jsx(xK,{size:20}),"Other Payment Methods"]})]})})]})})};SX.propTypes={amount:j0.oneOfType([j0.string,j0.number]).isRequired,selectedFrequency:j0.object,selectedCampusId:j0.string,selectedFundId:j0.string,onSuccess:j0.func.isRequired,onError:j0.func.isRequired,isProcessing:j0.bool,onProcessingChange:j0.func.isRequired,onBack:j0.func.isRequired,churchName:j0.string.isRequired,churchLogo:j0.string,message:j0.string,displayLogo:j0.string,title:j0.string,displayHeader:j0.string};const R2e=`
|
|
1281
1281
|
/* Custom selection color using theme colors */
|
|
1282
1282
|
input::selection {
|
|
1283
1283
|
background-color: rgb(var(--color-brand-primary) / 0.3);
|