D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
diafdxji
/
shihty.com
/
wp-content
/
plugins
/
surecart
/
dist
/
components
/
surecart
/
Filename :
p-a4015278.entry.js
back
Copy
import{r as t,c as e,h as s,a as i}from"./p-e97fde0a.js";import{l as a,g as o}from"./p-e885ba5f.js";import{a as c}from"./p-dd3464cd.js";import{g as n}from"./p-be3a018c.js";import{c as r}from"./p-1f60f497.js";import"./p-401e165e.js";import"./p-d3366af3.js";import"./p-53e7f7d7.js";import"./p-03631502.js";import"./p-9dbc54d6.js";import"./p-830ab1a3.js";import"./p-ec182234.js";import"./p-3f6362a4.js";import"./p-95325ec5.js";import"./p-4df6e0c5.js";const d=':host{display:block}.paypal-buttons{position:relative;line-height:0;text-align:center}.paypal-buttons:not(.paypal-buttons--busy):after{content:" ";border-bottom:1px solid var(--sc-input-border-color);width:100%;height:0;top:50%;left:0;right:0;position:absolute}';const l=d;const p=class{constructor(s){t(this,s);this.scSetState=e(this,"scSetState",7);this.scPaid=e(this,"scPaid",7);this.clientId=undefined;this.busy=false;this.merchantId=undefined;this.merchantInitiated=undefined;this.mode=undefined;this.order=undefined;this.buttons=["paypal","card"];this.label="paypal";this.color="gold";this.loaded=undefined}handleOrderChange(t,e){if((t===null||t===void 0?void 0:t.updated_at)===(e===null||e===void 0?void 0:e.updated_at)){return}this.cardContainer.innerHTML="";this.paypalContainer.innerHTML="";this.loadScript()}async loadScript(){var t,e;if(!this.clientId||!this.merchantId)return;try{const s=await a(o({clientId:this.clientId,merchantId:this.merchantId,merchantInitiated:this.merchantInitiated,reusable:(t=this.order)===null||t===void 0?void 0:t.reusable_payment_method_required,currency:(e=this.order)===null||e===void 0?void 0:e.currency}));this.renderButtons(s)}catch(t){console.error("failed to load the PayPal JS SDK script",t)}}componentDidLoad(){this.loadScript()}renderButtons(t){const e=this.order.reusable_payment_method_required?"createBillingAgreement":"createOrder";const s={onClick:async(t,e)=>{const s=this.el.closest("sc-checkout");const i=await s.validate();return i?e.resolve():e.reject()},onInit:()=>{this.loaded=true},onCancel:()=>{this.scSetState.emit("REJECT")},onApprove:async()=>{var t,e,s,i;try{this.order=await n({id:(t=this.order)===null||t===void 0?void 0:t.id})}catch(t){console.error(t);r({code:"could_not_capture",message:wp.i18n.__("The payment did not process. Please try again.","surecart")});this.scSetState.emit("REJECT")}try{this.scSetState.emit("PAYING");const t=await c({method:"PATCH",path:`surecart/v1/payment_intents/${((s=(e=this.order)===null||e===void 0?void 0:e.payment_intent)===null||s===void 0?void 0:s.id)||((i=this.order)===null||i===void 0?void 0:i.payment_intent)}/capture`});if(["succeeded","processing"].includes(t===null||t===void 0?void 0:t.status)){this.scSetState.emit("PAID");this.scPaid.emit()}else{r({code:"could_not_capture",message:wp.i18n.__("Payment processing failed. Kindly attempt the transaction once more.","surecart")});this.scSetState.emit("REJECT")}}catch(t){console.error(t);r({code:"could_not_capture",message:wp.i18n.__("Payment processing failed. Kindly attempt the transaction once more.","surecart")});this.scSetState.emit("REJECT")}},onError:t=>{console.error(t);r(t);this.scSetState.emit("REJECT")}};s[e]=async()=>new Promise((async(t,e)=>{var s,i;const a=this.el.closest("sc-checkout");const o=await a.submit();if(o instanceof Error){return e(o)}if((o===null||o===void 0?void 0:o.status)!=="finalized"){return e(new Error("Something went wrong. Please try again."))}if((s=o===null||o===void 0?void 0:o.payment_intent)===null||s===void 0?void 0:s.external_intent_id){return t((i=o===null||o===void 0?void 0:o.payment_intent)===null||i===void 0?void 0:i.external_intent_id)}r({code:"missing_payment_intent",message:wp.i18n.__("Something went wrong. Please contact us for payment.","surecart")});return e()}));if(t.FUNDING.PAYPAL){const e=t.Buttons({fundingSource:t.FUNDING.PAYPAL,style:{label:this.label,color:this.color},...s});if(e.isEligible()){e.render(this.paypalContainer)}}if(t.FUNDING.CARD){const e=t.Buttons({fundingSource:t.FUNDING.CARD,style:{color:"black"},...s});if(e.isEligible()){e.render(this.cardContainer)}}}render(){return s("div",{key:"62aecdab455a07e9286f19d6f0b31298978a9efc",part:`base ${this.busy||!this.loaded&&"base--busy"}`,class:{"paypal-buttons":true,"paypal-buttons--busy":this.busy||!this.loaded}},(!this.loaded||this.busy)&&s("sc-skeleton",{key:"b4aaa11f2e3d4d7ff35f484ae3616894b804cc53",style:{height:"55px","--border-radius":"4px",cursor:"wait"}}),s("div",{key:"8e77249632ca438f4e06237da587abf2ab039652",class:"sc-paypal-button-container",hidden:!this.loaded||this.busy},s("div",{key:"e9a6a8d1cbed9ac57e94e25bea93999b785de1b0",part:"paypal-card-button",hidden:!this.buttons.includes("card"),class:"sc-paypal-card-button",ref:t=>this.cardContainer=t}),s("div",{key:"f47245d9e2c7324c82b64bdf42e6e143c6d8c609",part:"paypal-button",hidden:!this.buttons.includes("paypal"),class:"sc-paypal-button",ref:t=>this.paypalContainer=t})))}get el(){return i(this)}static get watchers(){return{order:["handleOrderChange"]}}};p.style=l;const h=":host{display:block;--sc-secure-notice-icon-color:var(--sc-color-gray-300);--sc-secure-notice-font-size:var(--sc-font-size-small);--sc-secure-notice-color:var(--sc-color-gray-500)}.notice{color:var(--sc-secure-notice-color);font-size:var(--sc-secure-notice-font-size);display:flex;align-items:center;gap:5px}.notice__text{flex:1;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap}.notice__icon{color:var(--sc-secure-notice-icon-color);margin-right:5px}";const u=h;const f=class{constructor(e){t(this,e)}render(){return s("div",{key:"a275d5ef1aa653b2f76bb8bf5a9b2fad6a93fb9e",class:"notice",part:"base"},s("svg",{key:"492ec9dd223822133a633df5ebcb53da2c6686ac",class:"notice__icon",part:"icon",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 512 512",fill:"currentColor"},s("path",{key:"2d01859df7a974d069d3e16bc950022488365950",d:"M368,192H352V112a96,96,0,1,0-192,0v80H144a64.07,64.07,0,0,0-64,64V432a64.07,64.07,0,0,0,64,64H368a64.07,64.07,0,0,0,64-64V256A64.07,64.07,0,0,0,368,192Zm-48,0H192V112a64,64,0,1,1,128,0Z"})),s("span",{key:"6b80a7c1a455edd1011798dbe06dedb00f729611",class:"notice__text",part:"text"},s("slot",{key:"449542355dfeed853f9176796db0e0bac5d1b06c",name:"prefix"}),s("slot",{key:"cef20974c2988f0143771912a29e44727557a3de"}),s("slot",{key:"0b6b0a8e901f6a6cb76f5a1de050f72368f96084",name:"suffix"})))}};f.style=u;export{p as sc_paypal_buttons,f as sc_secure_notice}; //# sourceMappingURL=p-a4015278.entry.js.map