PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.3.21
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.3.21
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
fluent-cart / assets / stripe-hosted-checkout.js

stripe-hosted-checkout.js in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.3.21, at assets/stripe-hosted-checkout.js

8 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 window.addEventListener("fluent_cart_load_payments_stripe",function(o){const i=window.fluentcart.$t||(t=>t);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(o.detail.paymentInfoUrl,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":o.detail.nonce},credentials:"include"}).then(async t=>{var r,l,s;if(t=await t.json(),(t==null?void 0:t.status)==="failed"){c((t==null?void 0:t.message)||i("Something went wrong")),(r=o.detail.paymentLoader)==null||r.disableCheckoutButton();return}if(n){const m=`
2 <div class="stripe-hosted-checkout-info" style="padding: 15px; background: #f8f9fa; border-radius: 4px; margin: 10px 0;">
3 <p style="margin: 0; color: #495057; font-size: 14px;">
4 ${i("You will be redirected to Stripe to complete your payment securely.")}
5 </p>
6 </div>
7 `;n.innerHTML=m}const e=document.getElementById("fct_loading_payment_processor");e&&e.remove(),window.dispatchEvent(new CustomEvent("fluent_cart_payment_method_loading_success",{detail:{payment_method:"stripe"}}));const a=(l=window.fluentcart_checkout_vars)==null?void 0:l.submit_button,d=o.detail.form.querySelector('input[name="_fct_pay_method"]:checked');d&&d.value==="stripe"&&((s=o.detail.paymentLoader)==null||s.enableCheckoutButton((a==null?void 0:a.text)||i("Place Order")))}).catch(t=>{var a;console.error("Stripe hosted checkout error:",t),c(i("An error occurred while loading the payment method."));const e=document.getElementById("fct_loading_payment_processor");e&&e.remove(),(a=o.detail.paymentLoader)==null||a.disableCheckoutButton()});function c(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)}});
8