PageSourceSearch

https://gavinwren.com/wp-content/plugins/surecart/dist/components/surecart/p-6c5eaccf.entry.js

js gavinwren.com collected 2026-10-10 02:25:12 UTC 9,564 bytes, 2 lines download raw bytes

1import{r as i,c as o,h as t,a as d}from"./p-9add63ef.js";import{p as l}from"./p-9ef0f73f.js";import{s,o as e}from"./p-22f50d49.js";import{c as n,f as a}from"./p-6fb86bf6.js";import{c as v}from"./p-78468e45.js";import{o as u}from"./p-4773325d.js";import"./p-2b28ea49.js";import"./p-dd24e53c.js";import"./p-d3366af3.js";import"./p-401e165e.js";import"./p-830ab1a3.js";import"./p-d15c4b50.js";import"./p-3f6362a4.js";import"./p-31faf2b8.js";import"./p-610295e2.js";import"./p-8dccb656.js";import"./p-259c3935.js";const r=":host{display:block}.or{display:none;margin:var(--sc-form-section-spacing) 0}.request--loaded .or{display:block}";const h=r;const c=class{constructor(t){i(this,t);this.scFormSubmit=o(this,"scFormSubmit",7);this.scPaid=o(this,"scPaid",7);this.scPayError=o(this,"scPayError",7);this.scSetState=o(this,"scSetState",7);this.scPaymentRequestLoaded=o(this,"scPaymentRequestLoaded",7);this.scUpdateOrderState=o(this,"scUpdateOrderState",7);this.stripeAccountId=undefined;this.publishableKey=undefined;this.country="US";this.prices=undefined;this.label="total";this.amount=0;this.theme="dark";this.error=undefined;this.debug=false;this.loaded=false;this.debugError=undefined}async componentWillLoad(){if(!(this===null||this===void 0?void 0:this.publishableKey)||!(this===null||this===void 0?void 0:this.stripeAccountId)){return true}try{this.stripe=await l.loadStripe(this.publishableKey,{stripeAccount:this.stripeAccountId});this.elements=this.stripe.elements();this.paymentRequest=this.stripe.paymentRequest({country:this.country,requestShipping:true,requestPayerEmail:true,shippingOptions:[{id:"free",label:"Free Shipping",detail:"No shipping required",amount:0}],...this.getRequestObject(s===null||s===void 0?void 0:s.checkout)})}catch(i){console.log((i===null||i===void 0?void 0:i.message)||wp.i18n.__("Stripe could not be loaded","surecart"))}}handleOrderChange(){if(!this.paymentRequest)return;if(this.pendingEvent)return;this.paymentRequest.update(this.getRequestObject(s===null||s===void 0?void 0:s.checkout))}handleLoaded(){this.scPaymentRequestLoaded.emit(true)}handleErrorChange(){if(this.pendingEvent){this.pendingEvent.complete("error")}}async handleShippingChange(i){var o,t,d,l,e;const{shippingAddress:a,updateWith:v}=i;try{const i=await n({id:(o=s===null||s===void 0?void 0:s.checkout)===null||o===void 0?void 0:o.id,data:{shipping_address:{...(a===null||a===void 0?void 0:a.name)?{name:a===null||a===void 0?void 0:a.name}:{},...((t=a===null||a===void 0?void 0:a.addressLine)===null||t===void 0?void 0:t[0])?{line_1:(d=a===null||a===void 0?void 0:a.addressLine)===null||d===void 0?void 0:d[0]}:{},...((l=a===null||a===void 0?void 0:a.addressLine)===null||l===void 0?void 0:l[1])?{line_2:(e=a===null||a===void 0?void 0:a.addressLine)===null||e===void 0?void 0:e[1]}:{},...(a===null||a===void 0?void 0:a.city)?{city:a===null||a===void 0?void 0:a.city}:{},...(a===null||a===void 0?void 0:a.country)?{country:a===null||a===void 0?void 0:a.country}:{},...(a===null||a===void 0?void 0:a.postalCode)?{postal_code:a===null||a===void 0?void 0:a.postalCode}:{},...(a===null||a===void 0?void 0:a.region)?{state:a===null||a===void 0?void 0:a.region}:{}}}});v({status:"success",total:{amount:(i===null||i===void 0?void 0:i.amount_due)||0,label:wp.i18n.__("Total","surecart")}})}catch(i){i.updateWith({status:"invalid_shipping_address"})}}getName(i){var o,t,d,l,s;const e=Object.keys(this.prices||{}).filter((o=>{const t=this.prices[o];return t.product===i.price.product.id}));let n="";if(e.length>1){n=`${(t=(o=i===null||i===void 0?void 0:i.price)===null||o===void 0?void 0:o.product)===null||t===void 0?void 0:t.name} – ${(d=i===null||i===void 0?void 0:i.price)===null||d===void 0?void 0:d.name}`}else{n=(s=(l=i===null||i===void 0?void 0:i.price)===null||l===void 0?void 0:l.product)===null||s===void 0?void 0:s.name}return n}getRequestObject(i){var o;const t=(((o=i===null||i===void 0?void 0:i.line_items)===null||o===void 0?void 0:o.data)||[]).map((i=>({label:this.getName(i),amount:i.ad_hoc_amount!==null?i.ad_hoc_amount:i.subtotal_amount})));return{currency:s.currencyCode,total:{amount:(i===null||i===void 0?void 0:i.amount_due)||0,label:wp.i18n.__("Total","surecart")},displayItems:t}}componentDidLoad(){this.handleOrderChange();this.removeCheckoutListener=e("checkout",(()=>this.handleOrderChange()));if(!this.elements){return}const i=this.elements.create("paymentRequestButton",{paymentRequest:this.paymentRequest,style:{paymentRequestButton:{theme:this.theme}}});this.paymentRequest.on("paymentmethod",(i=>this.handlePaymentMethod(i)));this.paymentRequest.on("shippingaddresschange",(async i=>await this.handleShippingChange(i)));this.paymentRequest.canMakePayment().then((o=>
1{if(!o){if(location.protocol!=="https:"){if(this.debug){this.debugError=wp.i18n.__("You must serve this page over HTTPS to display express payment buttons.","surecart")}console.log("SSL needed to display payment buttons.")}else{if(this.debug){this.debugError=wp.i18n.__("You do not have any wallets set up in your browser.","surecart")}console.log("No wallets available.")}return}i.mount(this.request);this.loaded=true})).catch((i=>{console.error(i)}))}async handlePaymentMethod(i){var o,t,d,l,e;const{billing_details:u}=i===null||i===void 0?void 0:i.paymentMethod;const{shippingAddress:r}=i;try{this.scSetState.emit("FINALIZE");await n({id:(o=s===null||s===void 0?void 0:s.checkout)===null||o===void 0?void 0:o.id,data:{email:u===null||u===void 0?void 0:u.email,name:u===null||u===void 0?void 0:u.name,shipping_address:{...(r===null||r===void 0?void 0:r.name)?{name:r===null||r===void 0?void 0:r.name}:{},...((t=r===null||r===void 0?void 0:r.addressLine)===null||t===void 0?void 0:t[0])?{line_1:(d=r===null||r===void 0?void 0:r.addressLine)===null||d===void 0?void 0:d[0]}:{},...((l=r===null||r===void 0?void 0:r.addressLine)===null||l===void 0?void 0:l[1])?{line_2:(e=r===null||r===void 0?void 0:r.addressLine)===null||e===void 0?void 0:e[1]}:{},...(r===null||r===void 0?void 0:r.city)?{city:r===null||r===void 0?void 0:r.city}:{},...(r===null||r===void 0?void 0:r.country)?{country:r===null||r===void 0?void 0:r.country}:{},...(r===null||r===void 0?void 0:r.postalCode)?{postal_code:r===null||r===void 0?void 0:r.postalCode}:{},...(r===null||r===void 0?void 0:r.region)?{state:r===null||r===void 0?void 0:r.region}:{}}}});const v=await a({id:s===null||s===void 0?void 0:s.checkout.id,query:{form_id:s.formId},processor:{id:"stripe",manual:false}});this.scSetState.emit("PAYING");await this.confirmPayment(v,i);this.scSetState.emit("PAID");this.scPaid.emit();i.complete("success")}catch(o){console.error(o);this.scPayError.emit(o);v(o);i.complete("fail")}finally{this.confirming=false}}async confirmPayment(i,o){var t,d,l,s,e,n,a,v,u,r,h,c,p,f,m,y,b,g;if((i===null||i===void 0?void 0:i.status)!=="finalized")return;if(!((l=(d=(t=i===null||i===void 0?void 0:i.payment_intent)===null||t===void 0?void 0:t.processor_data)===null||d===void 0?void 0:d.stripe)===null||l===void 0?void 0:l.client_secret))return;if(!((n=(e=(s=i===null||i===void 0?void 0:i.payment_intent)===null||s===void 0?void 0:s.processor_data)===null||e===void 0?void 0:e.stripe)===null||n===void 0?void 0:n.type))return;if(!((a=i===null||i===void 0?void 0:i.payment_intent)===null||a===void 0?void 0:a.external_intent_id))return;if(this.confirming)return;this.confirming=true;let w;if(((r=(u=(v=i===null||i===void 0?void 0:i.payment_intent)===null||v===void 0?void 0:v.processor_data)===null||u===void 0?void 0:u.stripe)===null||r===void 0?void 0:r.type)=="setup"){w=await this.confirmCardSetup((c=(h=i===null||i===void 0?void 0:i.payment_intent)===null||h===void 0?void 0:h.processor_data)===null||c===void 0?void 0:c.stripe.client_secret,o)}else{w=await this.confirmCardPayment((f=(p=i===null||i===void 0?void 0:i.payment_intent)===null||p===void 0?void 0:p.processor_data)===null||f===void 0?void 0:f.stripe.client_secret,o)}if(w===null||w===void 0?void 0:w.error){throw w.error}if(((m=w===null||w===void 0?void 0:w.paymentIntent)===null||m===void 0?void 0:m.status)==="requires_action"||((y=w===null||w===void 0?void 0:w.paymentIntent)===null||y===void 0?void 0:y.status)==="requires_source_action"){const o=await this.stripe.confirmCardPayment((g=(b=i===null||i===void 0?void 0:i.payment_intent)===null||b===void 0?void 0:b.processor_data)===null||g===void 0?void 0:g.stripe.client_secret);if(o.error){throw o.error}return o}return w}confirmCardPayment(i,o){return this.stripe.confirmCardPayment(i,{payment_method:o.paymentMethod.id},{handleActions:false})}confirmCardSetup(i,o){return this.stripe.confirmCardSetup(i,{payment_method:o.paymentMethod.id},{handleActions:false})}disconnectedCallback(){this.removeCheckoutListener()}render(){return t("div",{key:"9f29630a1a8b7625d672d5033485d748452e9b60",class:{request:true,"request--loaded":this.loaded}},this.debug&&this.debugError&&t("div",{key:"3a3666278b55cdd431e03db7e6bfec90b27eeabc"},t("slot",{key:"14736b120870b919215565e81d951b727f1c5771",name:"debug-fallback"}),t("sc-alert",{key:"8f6367c78bf6f729c5358eb7ac8c2a7a9dd2c96a",type:"info",open:true},t("span",{key:"a7eab183f1670523e5a1a9b3772786398aad4ca9",slot:"title"},wp.i18n.__("Express Payment","surecart")),this.debugError)),t("div",{key:"d24cf916a8d4d82ad96eeec37d2fb2ae1fabe70f",class:"sc-payment-request-button",part:"button",ref:i=>this.request=i}))}get el(){return d(this)}static get watchers(){return{loaded:["handleLoaded"],error:["handleErrorChange"]}}};u(c,["prices"],false);c.style=h;
1export{c as sc_stripe_payment_request};
2//# sourceMappingURL=p-6c5eaccf.entry.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.