PageSourceSearch

https://go.chatway.app/assets/usePlan-CoRJmU06.js

js chatway.app collected 2026-10-02 02:29:36 UTC 3,912 bytes, 2 lines download raw bytes

1(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`release-202609300849`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`982e8e03-81da-488d-9861-862bb463e759`,e._sentryDebugIdIdentifier=`sentry-dbid-982e8e03-81da-488d-9861-862bb463e759`)}catch{}})();import{O as e,Ot as t,d as n}from"./vendor-vue-core-DI5wj9bP.js";import{Ct as r}from"./utils-CL0hl12X.js";import{t as i}from"./user-TQfZ8_Hw.js";import{t as a}from"./toast-Bw7mV9qC.js";import{t as o}from"./plans-BCK5TzN3.js";import{t as s}from"./plan-service-uXiHd27w.js";import{t as c}from"./useStripeSetup-qcVDX0Fs.js";function l(){let{plans:l,invoices:u,isChangePlan:d,isDowngrading:f,isUpgradingDudaUser:p,isBuyingCredits:m,creditBalanceDetails:h,frequency:g,isFetchingPlans:_,shopifyCreditTiers:v,isFetchingCreditBalance:y,isFetchingShopifyCreditTiers:b}=n(o()),x=i(),S=t(0),C=t(!1),w=e(()=>x.marketPlaceName),T=async()=>{try{_.value=!0;let{data:e}=await new s().getPlans();l.value=e.map(e=>({id:e.id,...e.attributes,yearly_monthly_price:Math.trunc(e.attributes.yearly_price/12)})),_.value=!1}catch(e){_.value=!1,r(e)}},E=async(e,t)=>{try{let n={params:{start_date:e,end_date:t}},{data:r}=await new s().getInvoice(n);u.value=r}catch(e){r(e)}},D=async()=>{let e=o(),t=window.location!==window.parent.location;x.dudaData?.is_white_label===`true`?e.showDudaUpgradeModal=!0:t?e.showUpdateAgentModal=!0:e.showDudaUpgradeNoticeModal=!0},O=async e=>{let t=o(),n=window.location!==window.parent.location;if(x.dudaData?.is_white_label===`true`)t.showDudaUpgradeModal=!0;else if(!n)t.showDudaUpgradeNoticeModal=!0;else{let n=new FormData;n.append(`plan_identifier`,t.dudaPlanIdentifiers[e]);let r=await j(n);r!==`error`&&window.open(r,`_top`)}},k=async e=>{let t=o(),n=window.location!==window.parent.location;if(x.dudaData?.is_white_label===`true`)t.showDudaUpgradeModal=!0;else if(!n)t.showDudaUpgradeNoticeModal=!0;else{let n={type:`upgradeApp`,appId:`5e055a6a-7f43-4fdd-8ce2-821f30728049`,plansList:e?t.dudaPlanIdentifiers[e]:[o().dudaPlanList[0]]};window._dAPI.upgrade(n)}},A=async e=>{if(w.value===`duda`){await k();return}try{return f.value=!0,await new s().removeCard(e),f.value=!1,d.value=!1,`success`}catch(e){return f.value=!1,r(e),`error`}},j=async e=>{p.value=!0;try{let{data:t}=await new s().dudaUpgrade(e);return p.value=!1,t}catch(e){return p.value=!1,r(e),`error`}},M=async e=>{m.value=!0;try{let{data:t}=await new s().purchaseAiCredits(e);if(t?.attributes?.requires_action){let{confirmCardPayment:e}=c(),n=await e(t.attributes.client_secret);if(n.error)return{status:`error`,error:n.error}}return{status:`success`,data:t}}catch(e){return r(e),`error`}finally{m.value=!1}},N=async()=>{if(!y.value)try{y.value=!0;let{data:e}=await new s().getCreditBalance();h.value={id:e?.id,...e?.attributes}}catch(e){return r(e),`error`}finally{y.value=!1}};return{getPlans:T,upgradeDudaPlan:D,getInvoices:E,downgradeDudaPlan:k,removeCardDowngrade:A,upgradeDudaUser:j,purchaseCredits:M,getCreditBalance:N,updateAutoTopUp:async e=>{try{return await new s().updateAutoTopUp(e),await N(),a().set({message:`Auto Renew updated successfully`,type:`success`}),`success`}catch(e){return r(e),`error`}},updateDudaUserPlan:O,getPriceDifference:async e=>{try{C.value=!0;let{data:t}=await new s().priceDifference(e);S.value=t.attributes.price_difference,C.value=!1}catch(e){C.value=!1,console.error(e)}},getShopifyCreditTiers:async()=>{if(!b.value)try{b.value=!0;let{data:e}=await new s().getShopifyCreditTiers();v.value=e.map(e=>({id:e.id,...e.attributes}))}catch(e){r(e)}finally{b.value=!1}},isBuyingCredits:m,creditBalanceDetails:h,shopifyCreditTiers:v,frequency:g,isFetchingPriceDifference:C,isFetchingShopifyCreditTiers:b,isFetchingCreditBalance:y,priceDifference:S}}export{l as t};
2//# sourceMappingURL=usePlan-CoRJmU06.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.