Sid Gifari File Manager
🏠Root
/
home
/
genremedia08
/
musicjukebox.overlookedtracks.com
/
public
/
build
/
assets
/
Editing: checkout-routes-ac4923a4.js
import{bu as U,j as r,as as E,O as W,r as u,cW as z,U as G,T as x,N as Q,C as Y,cX as H,aw as h,ao as V,Z as k,o as B,aW as X,cY as Z,cR as J,P as K,L as y,aV as A,u as N,aQ as ee,ay as D,ax as te,f as I,m as d,cS as re,cT as w}from"./main-1406e08c.js";import{S as se,l as ne,B as M}from"./billing-redirect-message-5428f246.js";import"./TaskAlt-abcaec6b.js";function S({children:e}){const{isLoggedIn:t,isSubscribed:s}=U();return t?t&&s?r.jsx(E,{to:"/billing",replace:!0}):e||r.jsx(W,{}):r.jsx(E,{to:"/register",replace:!0})}function L({children:e}){const[t,s]=e;return u.useEffect(()=>{z("be.onboarding.selected")},[]),r.jsxs("div",{className:"flex flex-col h-full overflow-y-auto",children:[r.jsx(G,{children:r.jsx(x,{message:"Checkout"})}),r.jsx(Q,{size:"sm",color:"transparent",className:"flex-shrink-0 z-10 mb-20 md:mb-0",textColor:"text-main",logoColor:"dark",darkModeColor:"transparent",menuPosition:"checkout-page-navbar"}),r.jsxs("div",{className:"flex-auto md:flex w-full mx-auto justify-between px-20 md:px-0 md:pt-128 md:max-w-950",children:[r.jsx("div",{className:"hidden md:block fixed right-0 top-0 w-1/2 h-full bg-alt shadow-[15px_0_30px_0_rgb(0_0_0_/_18%)]"}),r.jsxs("div",{className:"md:w-400 overflow-hidden",children:[t,r.jsx(Y,{menu:"checkout-page-footer",className:"text-xs mt-50 text-muted overflow-x-auto"}),r.jsx("div",{className:"mt-40",children:r.jsx(H,{})})]}),r.jsx("div",{className:"hidden md:block w-384",children:r.jsx("div",{className:"relative z-10",children:s})})]})]})}const O=e=>`billing/products/${e}`;function ae(){var a;const{productId:e,priceId:t}=h(),s=V([O(e)],()=>ie(e),{keepPreviousData:!0,enabled:e!=null&&t!=null}),n=(a=s.data)==null?void 0:a.product,i=(n==null?void 0:n.prices.find(c=>c.id===parseInt(t)))||(n==null?void 0:n.prices[0]);return{status:s.status,product:n,price:i}}function ie(e){return k.get(O(e)).then(t=>t.data)}function C({showBillingLine:e=!0}){const{status:t,product:s,price:n}=ae();return t==="error"||t!=="loading"&&(!s||!n)?null:r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl mb-30",children:r.jsx(x,{message:"Summary"})}),t==="loading"?r.jsx(oe,{},"loading-skeleton"):r.jsx(ce,{product:s,price:n,showBillingLine:e})]})}function ce({product:e,price:t,showBillingLine:s}){return r.jsxs(B.div,{children:[r.jsx("div",{className:"text-xl font-semibold mb-6",children:e.name}),e.description&&r.jsx("div",{className:"text-sm text-muted",children:e.description}),r.jsx(X,{priceClassName:"font-bold text-4xl",periodClassName:"text-muted text-xs",variant:"separateLine",price:t,className:"mt-32"}),r.jsx(Z,{product:e}),s&&r.jsxs("div",{className:"flex items-center justify-between gap-24 border-t pt-24 mt-32 font-medium",children:[r.jsx("div",{children:r.jsx(x,{message:"Billed today"})}),r.jsx("div",{children:r.jsx(J,{value:t.amount,currency:t.currency})})]})]})}function oe(){return r.jsxs(B.div,{...K,className:"max-w-180",children:[r.jsx(y,{className:"text-xl mb-6"}),r.jsx(y,{className:"text-sm"}),r.jsx(y,{className:"text-4xl mt-32"})]})}/*! * paypal-js v5.1.4 (2022-11-29T23:08:21.847Z) * Copyright 2020-present, PayPal, Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function ue(e,t){var s=document.querySelector('script[src="'.concat(e,'"]'));if(s===null)return null;var n=q(e,t),i=s.cloneNode();if(delete i.dataset.uidAuto,Object.keys(i.dataset).length!==Object.keys(n.dataset).length)return null;var a=!0;return Object.keys(i.dataset).forEach(function(c){i.dataset[c]!==n.dataset[c]&&(a=!1)}),a?s:null}function le(e){var t=e.url,s=e.attributes,n=e.onSuccess,i=e.onError,a=q(t,s);a.onerror=i,a.onload=n,document.head.insertBefore(a,document.head.firstElementChild)}function de(e){var t="https://www.paypal.com/sdk/js";e.sdkBaseURL&&(t=e.sdkBaseURL,delete e.sdkBaseURL),me(e);var s=Object.keys(e).filter(function(a){return typeof e[a]<"u"&&e[a]!==null&&e[a]!==""}).reduce(function(a,c){var o=e[c].toString();return c.substring(0,5)==="data-"?a.dataAttributes[c]=o:a.queryParams[c]=o,a},{queryParams:{},dataAttributes:{}}),n=s.queryParams,i=s.dataAttributes;return{url:"".concat(t,"?").concat(fe(n)),dataAttributes:i}}function fe(e){var t="";return Object.keys(e).forEach(function(s){t.length!==0&&(t+="&"),t+=s+"="+e[s]}),t}function pe(e){var t=e.split("/* Original Error:")[1];return t?t.replace(/\n/g,"").replace("*/","").trim():e}function q(e,t){t===void 0&&(t={});var s=document.createElement("script");return s.src=e,Object.keys(t).forEach(function(n){s.setAttribute(n,t[n]),n==="data-csp-nonce"&&s.setAttribute("nonce",t["data-csp-nonce"])}),s}function me(e){var t=e["merchant-id"],s=e["data-merchant-id"],n="",i="";return Array.isArray(t)?t.length>1?(n="*",i=t.toString()):n=t.toString():typeof t=="string"&&t.length>0?n=t:typeof s=="string"&&s.length>0&&(n="*",i=s),e["merchant-id"]=n,e["data-merchant-id"]=i,e}function xe(e,t){if(t===void 0&&(t=T()),F(e,t),typeof window>"u")return t.resolve(null);var s=de(e),n=s.url,i=s.dataAttributes,a=i["data-namespace"]||"paypal",c=R(a);return ue(n,i)&&c?t.resolve(c):be({url:n,attributes:i},t).then(function(){var o=R(a);if(o)return o;throw new Error("The window.".concat(a," global variable is not available."))})}function be(e,t){t===void 0&&(t=T()),F(e,t);var s=e.url,n=e.attributes;if(typeof s!="string"||s.length===0)throw new Error("Invalid url.");if(typeof n<"u"&&typeof n!="object")throw new Error("Expected attributes to be an object.");return new t(function(i,a){if(typeof window>"u")return i();le({url:s,attributes:n,onSuccess:function(){return i()},onError:function(){var c=new Error('The script "'.concat(s,'" failed to load.'));return window.fetch?fetch(s).then(function(o){return o.status===200&&a(c),o.text()}).then(function(o){var f=pe(o);a(new Error(f))}).catch(function(o){a(o)}):a(c)}})})}function T(){if(typeof Promise>"u")throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function R(e){return window[e]}function F(e,t){if(typeof e!="object"||e===null)throw new Error("Expected an options object.");if(typeof t<"u"&&typeof t!="function")throw new Error("Expected PromisePonyfill to be a function.")}function he({productId:e,priceId:t}){const{data:s}=A(),n=u.useRef(!1),i=u.useRef(!1),[a,c]=u.useState(!1),o=u.useRef(null),{base_url:f,billing:{stripe:{enable:p},paypal:{enable:b,public_key:l}}}=N();return u.useEffect(()=>{!b||!l||n.current||(xe({"client-id":l,intent:"subscription",vault:!0,"disable-funding":p?"card":void 0}).then(()=>{c(!0)}),n.current=!0)},[l,b,p]),u.useEffect(()=>{var _;if(!a||!((_=window.paypal)!=null&&_.Buttons)||!o.current||!(s!=null&&s.products.length)||!e||!t||i.current)return;const g=s.products.find(m=>m.id===parseInt(e)),j=g==null?void 0:g.prices.find(m=>m.id===parseInt(t));window.paypal.Buttons({style:{label:"pay"},createSubscription:(m,v)=>v.subscription.create({application_context:{shipping_preference:"NO_SHIPPING"},plan_id:j==null?void 0:j.paypal_id}),onApprove:(m,v)=>(v.redirect(`${f}/checkout/${e}/${t}/paypal/done?subscriptionId=${m.subscriptionID}&status=success`),Promise.resolve()),onError:m=>{location.href=`${f}/checkout/${e}/${t}/paypal/done?status=error`}}).render(o.current).then(()=>{i.current=!0})},[e,t,s,a,f]),{paypalElementRef:o,stripeIsEnabled:l!=null&&b}}function ge(){var f;const{productId:e,priceId:t}=h(),s=A(),{paypalElementRef:n}=he({productId:e,priceId:t}),{base_url:i,billing:{stripe:a}}=N();if(s.isLoading)return r.jsx(ee,{});const c=(f=s.data)==null?void 0:f.products.find(p=>p.id===parseInt(e)),o=c==null?void 0:c.prices.find(p=>p.id===parseInt(t));return!c||!o||s.status==="error"?r.jsx(E,{to:"/pricing",replace:!0}):r.jsxs(L,{children:[r.jsxs(u.Fragment,{children:[r.jsx("h1",{className:"text-4xl mb-40",children:r.jsx(x,{message:"Checkout"})}),a.enable?r.jsxs(u.Fragment,{children:[r.jsx(se,{productId:e,submitLabel:r.jsx(x,{message:"Upgrade"}),type:"subscription",returnUrl:`${i}/checkout/${e}/${t}/stripe/done`}),r.jsx(je,{})]}):null,r.jsx("div",{ref:n}),r.jsx("div",{className:"text-xs text-muted mt-30",children:r.jsx(x,{message:"You’ll be charged until you cancel your subscription. Previous charges won’t be refunded when you cancel unless it’s legally required. Your payment data is encrypted and secure. By subscribing your agree to our terms of service and privacy policy."})})]}),r.jsx(C,{})]})}function je(){return r.jsx("div",{className:"relative text-center my-20 before:absolute before:left-0 before:top-1/2 before:-translate-y-1/2 before:h-1 before:w-full before:bg-divider",children:r.jsx("span",{className:"bg relative z-10 px-10 text-sm text-muted",children:r.jsx(x,{message:"or"})})})}function ve(){const{invalidateBootstrapData:e}=D(),{productId:t,priceId:s}=h(),n=te(),{billing:{stripe_public_key:i}}=N(),[a]=I(),c=a.get("payment_intent_client_secret"),[o,f]=u.useState(),p=u.useRef();return u.useEffect(()=>{p.current||(ne(i).then(async b=>{if(!b||!c){f(P());return}b.retrievePaymentIntent(c).then(({paymentIntent:l})=>{(l==null?void 0:l.status)==="succeeded"&&ye(l.id).then(()=>{e()}),f(P(l==null?void 0:l.status,t,s))})}),p.current=!0)},[i,c,s,t,e]),c?r.jsxs(L,{children:[r.jsx(M,{config:o}),r.jsx(C,{showBillingLine:!1})]}):(n("/"),null)}function P(e,t,s){switch(e){case"succeeded":return{message:d("Subscription successful!"),status:"success",buttonLabel:d("Return to site"),link:"/billing"};case"processing":return{message:d("Payment processing. We'll update you when payment is received."),status:"success",buttonLabel:d("Return to site"),link:"/billing"};case"requires_payment_method":return{message:d("Payment failed. Please try another payment method."),status:"error",buttonLabel:d("Go back"),link:$(t,s)};default:return{message:d("Something went wrong"),status:"error",buttonLabel:d("Go back"),link:$(t,s)}}}function $(e,t){return e&&t?`/buy/${e}/${t}`:"/"}function ye(e){return k.post("billing/stripe/store-subscription-details-locally",{payment_intent_id:e})}function we(){const{invalidateBootstrapData:e}=D(),{productId:t,priceId:s}=h(),[n]=I(),[i,a]=u.useState();return u.useEffect(()=>{const c=n.get("subscriptionId"),o=n.get("status");a(Se(o,t,s)),c&&o==="success"&&ke(c).then(()=>{e()})},[s,t,n,e]),r.jsxs(L,{children:[r.jsx(M,{config:i}),r.jsx(C,{showBillingLine:!1})]})}function Se(e,t,s){switch(e){case"success":return{message:d("Subscription successful!"),status:"success",buttonLabel:d("Return to site"),link:"/billing"};default:return{message:d("Something went wrong. Please try again."),status:"error",buttonLabel:d("Go back"),link:Ee(t,s)}}}function Ee(e,t){return e&&t?`/buy/${e}/${t}`:"/"}function ke(e){return k.post("billing/paypal/store-subscription-details-locally",{paypal_subscription_id:e})}function _e(){return r.jsxs(re,{children:[r.jsx(w,{path:":productId/:priceId",element:r.jsx(S,{children:r.jsx(ge,{})})}),r.jsx(w,{path:":productId/:priceId/stripe/done",element:r.jsx(S,{children:r.jsx(ve,{})})}),r.jsx(w,{path:":productId/:priceId/paypal/done",element:r.jsx(S,{children:r.jsx(we,{})})})]})}export{_e as default}; //# sourceMappingURL=checkout-routes-ac4923a4.js.map
Save
Cancel