PageSourceSearch

https://www.digital.editorialestudio.com.ar/build/js/vue-chunks/yuno-checkout-v2-component-6dojdia3.js

js editorialestudio.com.ar collected 2026-10-08 17:11:08 UTC 9,170 bytes, 1 lines download raw bytes

1import{clearYunoContainer as e,handleSubscription as t}from"../yuno-libraries-DOrzqk7w.js";function n(e=[],t=null){return{options:e,model:t,query:``,open:!1,activeIndex:0,init(){this.$watch(`query`,()=>{this.activeIndex=0})},get selected(){return this.model?this.$wire.get(this.model):null},normalize(e){return(e??``).toString().normalize(`NFD`).replace(/\p{Diacritic}/gu,``).toLowerCase().trim()},get filtered(){let e=this.normalize(this.query);return e===``?this.options:this.options.filter(t=>this.normalize(t.search).includes(e))},get selectedOption(){return this.options.find(e=>e.value===this.selected)??null},get resultsCount(){return this.filtered.length},optionId(e){return`${this.$id(`searchable-option`)}-${e}`},isActive(e){return e===this.activeIndex},isSelected(e){return e.value===this.selected},openDropdown(){if(this.open)return;this.open=!0,this.query=``;let e=this.filtered.findIndex(e=>e.value===this.selected);this.activeIndex=e>=0?e:0,this.$nextTick(()=>{this.$refs.search?.focus(),this.scrollActiveIntoView()})},close(){this.open&&(this.open=!1,this.$refs.trigger?.focus())},toggle(){this.open?this.close():this.openDropdown()},move(e){let t=this.filtered.length;t!==0&&(this.activeIndex=(this.activeIndex+e+t)%t,this.scrollActiveIntoView())},selectActive(){let e=this.filtered[this.activeIndex];e&&this.select(e)},select(e){this.model&&this.$wire.$set(this.model,e.value),this.close()},scrollActiveIntoView(){this.$nextTick(()=>{this.$refs.listbox?.querySelector(`[data-active="true"]`)?.scrollIntoView({block:`nearest`})})}}}var r=[`[data-id="btnRemoveCoupon"]`,`[data-id="btnRemoveCartItem"]`,`[data-id="btnRemoveBundle"]`].join(`, `),i={instance:null,isMounted:!1,isInitializing:!1,currentSessionToken:null};function a(n){n.store(`yunoCheckout`,{errorMessages:{},sessionToken:null,publicApiKey:null,countryCode:null,language:null,listUuid:null,checkoutState:`idle`,error:null,showPaymentButton:!0,cardIsProcessing:!1,isRecurring:!1,get errorMessage(){return this.getErrorMessage(this.error)},init(){i.isMounted&&i.currentSessionToken&&(this.checkoutState=`mounted`,this.sessionToken=i.currentSessionToken),window.addEventListener(`yunoCheckoutReady`,e=>{this.handleCheckoutReady(e.detail)}),window.addEventListener(`yunoCheckoutReadyRecurring`,e=>{t(e.detail,this.getLivewireComponent(),n)}),window.addEventListener(`resetYunoSDK`,()=>{this.reset()});let e=()=>{this.checkoutState===`mounted`&&(this.reset(),this.checkoutState=`loading`)};document.addEventListener(`click`,t=>{if(this.checkoutState!==`mounted`)return;let n=t.target?.closest?.(r);n&&!n.disabled&&e()},!0)},async handleCheckoutReady(e){let t={sessionToken:e.session_token||e.sessionToken,publicApiKey:e.public_api_key||e.publicApiKey,countryCode:e.country_code||e.countryCode,language:e.language||`en`,listUuid:e.list_uuid||e.listUuid};if(!t.sessionToken||!t.publicApiKey){this.error=`Invalid checkout session data`,this.showErrorNotification(this.error);return}if(i.isMounted&&i.currentSessionToken!==t.sessionToken){await this.resetAndReinitialize(t);return}if(this.applySession(t),i.isMounted&&i.currentSessionToken===t.sessionToken){this.checkoutState=`mounted`;return}if(i.isInitializing){this.checkoutState=`loading`,this.waitForMount();return}await this.initializeYuno()},applySession(e){this.sessionToken=e.sessionToken,this.publicApiKey=e.publicApiKey,this.countryCode=e.countryCode,this.language=e.language,this.listUuid=e.listUuid},async resetAndReinitialize(e){this.reset(),this.applySession(e),this.checkoutState=`loading`,await this.initializeYuno()},waitForMount(){let e=0,t=setInterval(()=>{e++,i.isMounted?(this.checkoutState=`mounted`,clearInterval(t)):e>=10&&clearInterval(t)},500)},async initializeYuno(){typeof Yuno>`u`&&await this.waitForSDK(),await this.startCheckout()},waitForSDK(){return new Promise((e,t)=>{let n=setInterval(()=>{typeof Yuno<`u`&&(clearInterval(n),e())},100);setTimeout(()=>{clearInterval(n),typeof Yuno>`u`&&t(Error(`Yuno SDK failed to load`))},1e4)})},async startCheckout(){if(!(i.isMounted||i.isInitializing))try{i.isInitializing=!0,this.checkoutState=`loading`,this.error=null,e(),i.instance||=await Yuno.initialize(this.publicApiKey);let t=i.instance,n=this,r=this.countryCode||`US`,a=this.language||`en`,o={checkoutSession:this.sessionToken,elementSelector:`#yuno-checkout-inline-container`,countryCode:r,language:a,showLoading:!0,showPayButton:!0,documentEnable:!1,renderMode:{type:`element`,elementSelector:`#yuno-checkout-inline-container`},card:{cardSaveEnable:!0,type:`extends`},yunoPaymentMethodSelected:e=>{n.checkoutState===`processing`&&(n.checkoutState=`mounted`,n.showPaymentButton=!0,n.cardIsProcessing=!1),n.checkoutState===`mounted`&&!n.cardIsProcessing&&e.type===`CARD`&&!e.id&&i.instance&&typeof i.instance.getToken==`function`&&setTimeout(()=>{n.triggerPayment()},100)},yunoCreatePayment:async(e,t)=>{n.checkoutState=`processing`,n.showPaymentButton=!1;let r=t?.type||`CARD`;try{n.cardIsProcessing=!0;let t=await n.getLivewireComponent().createYunoPayment(e,n.sessionToken,r);if(n.cardIsProcessing=!1,t.error)throw Error(t.message||`Payment failed`);if(t.payment_id&&(window.yunoPaymentId=t.payment_id),t.status&&[`DECLINED`,`FAILED`,`REJECTED`].includes(t.status.toUpperCase())&&!t.sdk_action_required&&!t.redirect_url){let e={DECLINED:`card-declined`,FAILED:`payment-failed`,REJECTED:`payment-failed`}[t.status.toUpperCase()]||`payment-failed`;throw Error(n.errorMessages[e]||n.errorMessages[`generic-error`])}t.sdk_action_required||t.status===`PENDING`||t.status===`READY_TO_PAY`?i.instance&&typeof i.instance.continuePayment==`function`&&await i.instance.continuePayment({showPaymentStatus:!1}):t.status===`SUCCEEDED`&&t.redirect_url&&n.handlePaymentSuccess(t)}catch(e){n.handlePaymentError(e)}},yunoPaymentResult:async e=>{n.cardIsProcessing=!1;let t=typeof e==`string`?e:e?.status,r=(typeof e==`object`?e?.id:null)||window.yunoPaymentId;if(t===`SUCCEEDED`||t===`APPROVED`){let e=await n.getLivewireComponent().verifyPaymentAndGetRedirect(r);n.handlePaymentSuccess({redirect_url:e.redirect_url})}else n.handlePaymentError(n.errorMessages[`generic-error`],e)},yunoError:(e,t)=>
1{n.cardIsProcessing=!1;let r=typeof e==`string`?e.toLowerCase().replace(/_/g,`-`):null,i=r&&n.errorMessages[r]||n.errorMessages[`generic-error`];n.handlePaymentError(i,t)}};await t.startCheckout(o),await t.mountCheckout(),this.checkoutState=`mounted`,i.isMounted=!0,i.isInitializing=!1,i.currentSessionToken=this.sessionToken}catch(e){console.error(`[Yuno V2] Checkout initialization error:`,e),this.error=e.message||`Failed to initialize checkout`,this.checkoutState=`error`,i.isInitializing=!1,this.showErrorNotification(this.error)}},async triggerPayment(){let e=i.instance;if(!e){this.showErrorNotification(this.error);return}try{if(this.checkoutState=`processing`,this.showPaymentButton=!1,typeof e.getToken==`function`){let t=await e.getToken();if(t&&t.oneTimeToken){this.cardIsProcessing=!0;let e=t.tokenWithInformation?.type||`CARD`,n=await this.getLivewireComponent().createYunoPayment(t.oneTimeToken,this.sessionToken,e);if(n.error)throw Error(n.message||`Payment failed`);if(n.status&&[`DECLINED`,`FAILED`,`REJECTED`,`CANCELLED`,`CANCELED`].includes(n.status.toUpperCase())&&!n.sdk_action_required&&!n.redirect_url){let e={DECLINED:`card-declined`,FAILED:`payment-failed`,REJECTED:`payment-failed`}[n.status.toUpperCase()]||`payment-failed`;throw Error(this.errorMessages[e]||this.errorMessages[`generic-error`])}n.sdk_action_required||n.status===`PENDING`?i.instance&&typeof i.instance.continuePayment==`function`&&await i.instance.continuePayment({showPaymentStatus:!1}):n.status===`SUCCEEDED`&&n.redirect_url&&this.handlePaymentSuccess(n)}else throw Error(`Failed to get payment token`)}else if(typeof e.startPayment==`function`)await e.startPayment();else throw Error(`Payment methods not available`)}catch(e){this.handlePaymentError(e)}},handlePaymentSuccess(e){this.checkoutState=`completed`,this.cardIsProcessing=!1,window.location.href=e.redirect_url},handlePaymentError(e,t){console.error(`[Yuno V2] Payment error:`,e,t),this.checkoutState=`error`,this.error=e?.message||e||`Payment failed`,this.showPaymentButton=!0,this.cardIsProcessing=!1,this.showErrorNotification(this.error)},async cancel(){this.reset(),await this.getLivewireComponent().resetYunoCheckout()},reset(){this.sessionToken=null,this.publicApiKey=null,this.countryCode=null,this.language=null,this.listUuid=null,this.checkoutState=`idle`,this.error=null,this.showPaymentButton=!0,this.cardIsProcessing=!1,this.isRecurring=!1,e(),i.isMounted=!1,i.isInitializing=!1,i.instance=null,i.currentSessionToken=null},getErrorMessage(e){return(e instanceof Error?e.message:String(e||``))||this.errorMessages[`generic-error`]},showErrorNotification(e){let t=this.getErrorMessage(e);window.tipToast!==void 0&&window.tipToast.error(t,`Payment Error`,{closeButton:!0,timeOut:1e4,icon:!0})},getLivewireComponent(){let e=document.getElementById(`yuno-checkout-inline-container`);for(;e&&e!==document.body;){let t=e.getAttribute?.(`wire:id`);if(t)return window.Livewire.find(t);e=e.parentElement}throw Error(`Livewire component not found`)}})}export{n,a as t};

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.