| 1 |
(function(){let s=0;window.addEventListener("fluent_cart_load_payments_stripe",function(a){const i=function(t){var o;return(((o=window.fct_stripe_data)==null?void 0:o.translations)||{})[t]||t},h=++s,l=()=>h!==s;window.dispatchEvent(new CustomEvent("fluent_cart_payment_method_loading",{detail:{payment_method:"stripe"}}));const n=document.querySelector(".fluent-cart-checkout_embed_payment_container_stripe");if(n){const t=i("Loading Payment Processor...");n.innerHTML='<p id="fct_loading_payment_processor">'+t+"</p>"}fetch(a.detail.paymentInfoUrl,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":a.detail.nonce},credentials:"include"}).then(async t=>{var y,f;if(t=await t.json(),l())return;if((t==null?void 0:t.status)==="failed"){m((t==null?void 0:t.message)||i("Something went wrong")),(y=a.detail.paymentLoader)==null||y.disableCheckoutButton();return}let e=null;if(n){let c="";t!=null&&t.system_consent&&(t!=null&&t.consent_required?c=` |
| 2 |
<label style="display:flex;gap:6px;align-items:flex-start;margin-top:8px;font-size:12px;opacity:0.85;cursor:pointer;"> |
| 3 |
<input type="checkbox" name="_fct_system_consent" value="yes" style="margin-top:2px;flex-shrink:0;" /> |
| 4 |
<span>${t.system_consent}</span> |
| 5 |
</label> |
| 6 |
`:c=`<p style="margin:8px 0 0;color:#495057;font-size:12px;opacity:0.85;">${t.system_consent}</p>`);const d=` |
| 7 |
<div class="stripe-hosted-checkout-info" style="padding: 15px; background: #f8f9fa; border-radius: 4px; margin: 10px 0;"> |
| 8 |
<p style="margin: 0; color: #495057; font-size: 14px;"> |
| 9 |
${i("You will be redirected to Stripe to complete your payment securely.")} |
| 10 |
</p> |
| 11 |
${c} |
| 12 |
</div> |
| 13 |
`;n.innerHTML=d,e=n.querySelector('input[name="_fct_system_consent"]')}const o=document.getElementById("fct_loading_payment_processor");o&&o.remove(),window.dispatchEvent(new CustomEvent("fluent_cart_payment_method_loading_success",{detail:{payment_method:"stripe"}}));const r=(f=window.fluentcart_checkout_vars)==null?void 0:f.submit_button,u=a.detail.form.querySelector('input[name="_fct_pay_method"]:checked'),p=()=>{var d,_;if(l()||!u||u.value!=="stripe")return;!e||e.checked?(d=a.detail.paymentLoader)==null||d.enableCheckoutButton((r==null?void 0:r.text)||i("Place Order")):(_=a.detail.paymentLoader)==null||_.disableCheckoutButton()};e&&e.addEventListener("change",p),p()}).catch(t=>{var o;if(l())return;m(i("An error occurred while loading the payment method."));const e=document.getElementById("fct_loading_payment_processor");e&&e.remove(),(o=a.detail.paymentLoader)==null||o.disableCheckoutButton()});function m(t){if(!t||!n)return;const e=document.createElement("div");e.className="fct-error-message",e.style.color="#dc3545",e.style.fontSize="14px",e.style.padding="10px",e.textContent=t,n.innerHTML="",n.appendChild(e)}})})(); |
| 14 |
|