PageSourceSearch

https://movellefitness.com/_nuxt/BAwWGvDA.js

js movellefitness.com collected 2026-10-02 01:36:57 UTC 11,088 bytes, 1 lines download raw bytes

1import{a8 as ee,d as A,aM as te,z as ae,q as v,a as re,u as ne,b as ce,aA as d,aV as k,H as f,I as y,m as se,b9 as ie,a2 as P,aN as M,F as oe}from"./CU33Wv7L.js";import{u as le}from"./DA5P3-py.js";import{s as W}from"./DPz026HA.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="2aa75c95-1769-471c-8543-f81b9a83114f",e._sentryDebugIdIdentifier="sentry-dbid-2aa75c95-1769-471c-8543-f81b9a83114f")}catch{}})();{var _=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};_._sentryModuleMetadata=_._sentryModuleMetadata||{},_._sentryModuleMetadata[new _.Error().stack]=Object.assign({},_._sentryModuleMetadata[new _.Error().stack],{"_sentryBundlerPluginAppKey:pwa-fitness":!0})}const Y=[10,20,30,40,50,60,70],ue=100,S=Y.length,he=24*60*60*1e3,de=e=>Y[e-1]??0,fe=e=>de(e)+(e===S?ue:0),x=e=>e%S+1,N=()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}},ye=e=>{const a={year:"numeric",month:"2-digit",day:"2-digit"};try{return new Intl.DateTimeFormat("en-CA",{timeZone:e,...a})}catch{return new Intl.DateTimeFormat("en-CA",a)}},E=(e=new Date,a=N())=>ye(a).format(e),pe=(e=new Date,a=N())=>{let r;try{r=new Intl.DateTimeFormat("en-GB",{timeZone:a,hourCycle:"h23",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(e)}catch{r=new Intl.DateTimeFormat("en-GB",{hourCycle:"h23",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(e)}const n=w=>Number(r.find(h=>h.type===w)?.value??0),m=((n("hour")*60+n("minute"))*60+n("second"))*1e3+e.getMilliseconds();return Math.max(1e3,he-m)},ge=e=>!e||e.success===!1||e.degraded===!0,F=(e,{today:a=E(),tz:r=N()}={})=>{if(ge(e)){const h=e?.last_checkin_iso||e?.last_checkin||null,p=h?new Date(h):null;return{degraded:!0,claimedToday:!!p&&!Number.isNaN(p.getTime())&&E(p,r)===a,cycleDay:null,nextDay:null,streak:null,reward:null,weeklyBonus:0,cycleComplete:!1,calendarDate:a,lastCheckin:h}}const n=Math.min(Math.max(Number(e.cycle_day)||1,1),S),m=!!e.claimed_today,w=e.reward==null?NaN:Number(e.reward);return{degraded:!1,claimedToday:m,cycleDay:n,nextDay:m?x(n):n,streak:Number(e.streak)||0,reward:Number.isFinite(w)?w:fe(n),weeklyBonus:Number(e.weekly_bonus)||0,cycleComplete:!!e.cycle_complete,calendarDate:e.calendar_date||a,lastCheckin:e.last_checkin_iso||e.last_checkin||null}};let T=null,I=null;const ke=ee("coins",{state:()=>({coins:null,unlockStatus:null,checkin:null,checkinFetchedOn:null,checkinUserId:null,checkinLoading:!1,checkinError:null,today:null}),getters:{balance:e=>e.coins?.balance||0,unlocks:e=>e.unlockStatus?.unlocks||[],isCheckinFresh:e=>!!e.checkin&&e.checkinFetchedOn===e.today&&e.checkinUserId===(A().userData?._id??null),canClaimDaily(){return this.isCheckinFresh&&!this.checkin.claimedToday},checkinDay:e=>e.checkin?.cycleDay??null,checkinNextDay:e=>e.checkin?.nextDay??null,checkinReward:e=>e.checkin?.reward??null,checkinStreak:e=>e.checkin?.streak??null,checkinDegraded:e=>!!e.checkin?.degraded},actions:{async fetchBalance({refresh:e=!1}={}){return this.coins&&!e?this.coins:(this.coins=await getCoinsBalance(),this.coins)},addCoins(e){if(!this.coins)return this.fetchBalance({refresh:!0});this.coins.balance+=e},removeCoins(e){this.coins&&(this.coins.balance-=e)},async fetchUnlocks(){return this.unlockStatus?this.unlockStatus:(this.unlockStatus=await getUnlockStatus(),this.unlockStatus)},addUnlock(e){this.unlockStatus.unlocks?.push(e)},setToday(e=E()){this.today=e},async fetchCheckinStatus({refresh:e=!1}={}){const a=A().userData?._id??null;return a?(this.setToday(),!e&&this.isCheckinFresh?this.checkin:T||(this.checkinLoading=!0,this.checkinError=null,T=(async()=>{try{const r=await getDailyCheckinStatus(),n=E();return this.checkin=F(r,{today:n}),this.checkinFetchedOn=n,this.checkinUserId=a,this.today=n,this.armMidnightTimer(),this.checkin}catch(r){throw this.checkinError=r,r}finally{this.checkinLoading=!1,T=null}})(),T)):(this.resetCheckin(),null)},applyCheckinClaim(e){if(!e?.ok&&!e?.alreadyClaimed)return;const a=E(),r=this.checkin??F(null,{today:a}),n=e.ok?e.cycleDay??r.cycleDay:r.cycleDay;this.checkin={...r,degraded:e.ok?!1:r.degraded,claimedToday:!0,cycleDay:n,nextDay:n?x(n):null,streak:e.ok?e.streak??r.streak:r.streak,reward:e.ok?e.coins:r.reward,weeklyBonus:e.ok?e.weeklyBonus:r.weeklyBonus,cycleComplete:e.ok?e.cycleComplete:r.cycleComplete,calendarDate:a,lastCheckin:new Date().toISOString()},this.checkinFetchedOn=a,this.checkinUserId=A().userData?._id??null,this.today=a},resetCheckin(){this.checkin=null,this.checkinFetchedOn=null,this.checkinUserId=null,this.checkinError=null},armMidnightTimer(){typeof window>"u"||(I&&clearTimeout(I),I=setTimeout(()=>{if(I=null,E()===this.today){this.armMidnightTimer();return}this.setToday(),A().userData?._id&&this.fetchCheckinStatus({refresh:!0}).catch(()=>{})},pe()))}}}),Pe=()=>{const e=te("PAYWALL"),{$busEvent:a,$rcPurchases:r,$toast:n,$rcRetrieveCoreUserSubscription:m,$rcSetCustomerInfo:w}=ae(),h=v(null),p=v(null),g=v(0),B=re(),$=ne(),{theme:H}=A(),V=ce(),{handleRevenueCatPurchaseError:X}=le(),C=v(!1),b=v(null),G=async({hash:t,userId:s,successRoute:i})=>{try{H==="fitness_app"&&await oe().reconcileProfileAfterLogin(s,{hash:t}),await B.replace({path:i||V($.path),query:{hash:t}}
1),w()}catch(u){e.error("Login with hash failed:",u),d(u)}},K=async t=>new Promise((u,o)=>{const c=W(async()=>{try{if(g.value>10){clearInterval(c),o(new Error(`Polling core api timed out after ${g.value} attempts`));return}const{attributes:l}=await m(t);if(l){clearInterval(c),u(l);return}g.value++}catch(l){clearInterval(c),o(l)}},2e3)}),Z=async t=>new Promise((u,o)=>{const c=W(async()=>{try{if(g.value>10){clearInterval(c),o(new Error(`Polling transaction status timed out after ${g.value} attempts`));return}e.init("Polling transaction status for:",t);const l=await getRevCatTransactionStatus(t);if(l?.success){clearInterval(c),u(l);return}g.value++}catch(l){clearInterval(c),o(l)}},2e3)}),q=async()=>{if(M.isNativePlatform())try{const t=await r.getOfferings();return p.value=t.all,h.value=t.current,t}catch(t){e.error("Failed to retrieve offerings:",t),d(t),a("trackEvent",{category:y.PAYWALL,action:f.ERROR,name:"error_retrieving_mobile_offerings"})}},O=async t=>{if(M.isNativePlatform())try{const s=await r.getOfferings();return p.value=s.all,h.value=s.current,t?p.value[t]:h.value}catch(s){e.error("Failed to retrieve offerings:",s),d(s),a("trackEvent",{category:y.PAYWALL,action:f.ERROR,name:"error_retrieving_mobile_offerings"})}},z=({result:t})=>{switch(e.state("Paywall result:",t),t){case P.NOT_PRESENTED:return{success:!1,canContinue:!0};case P.ERROR:return a("trackEvent",{category:y.PAYWALL,action:f.ERROR,name:`paywall_result_error_${t}`}),{success:!1,canContinue:!1};case P.CANCELLED:return a("trackEvent",{category:y.PAYWALL,action:f.ABANDON,name:"paywall_abandon",screen:k.PAYWALL}),{success:!1,canContinue:!1};case P.PURCHASED:case P.RESTORED:return a("trackEvent",{category:y.PAYWALL,action:f.PURCHASED,name:"paywall_purchased_success",screen:k.PAYWALL}),{success:!0,canContinue:!0};default:return{success:!1,canContinue:!1}}},J=async t=>{try{C.value=!0,b.value=t;const s=b.value?.offering;if(await r.syncPurchases(),await r.syncAttributesAndOfferingsIfNeeded(),(await O(s))?.metadata?.skip_paywall===!0){const{public:D}=se(),R=A();try{await $fetch(`${D.CORE_API}/auth/subscriptions/revenue-cat`,{method:"POST",body:{event:{original_app_user_id:R.uid,product_id:"movelle_free_trial_experiment",country_code:R.country_code,price_in_purchased_currency:0,currency:"",app_id:"app2f05c79f38",type:"CUSTOM_EXPERIMENT_FREE_PACKAGE"}},headers:{Authorization:`bearer ${R.jwt}`}})}catch(L){e.error("Experiment: CORE_API error while granting free access:",L),d(L)}e.event("Experiment: skip_paywall metadata detected - granting free access"),a("trackEvent",{category:y.PAYWALL,action:f.CTA_CLICKED,name:"experiment_free_access_granted",screen:k.PAYWALL});try{await r.syncPurchases(),await U()}catch(L){e.error("Experiment: error while granting free access:",L),d(L)}return C.value=!1,!0}const{canMakePayments:o}=await r.canMakePayments();if(!o){n.error({title:"Error",body:"Unable to make app store purchases. Please verify that you have a appstore account and that you are logged in."}),a("trackEvent",{category:y.PAYWALL,action:f.ERROR,name:"user_not_eligible_for_app_store_purchases",screen:k.PAYWALL});return}a("trackEvent",{category:y.PAYWALL,action:f.VIEW,name:"paywall_view",screen:k.PAYWALL});let c;try{c=await ie.presentPaywallIfNeeded({requiredEntitlementIdentifier:"comprehensive-subscription",displayCloseButton:!0}),e.state("presentPaywallIfNeeded result:",c)}catch(D){e.error("Paywall presentation failed:",D),d(D),a("trackEvent",{category:y.PAYWALL,action:f.ERROR,name:"paywall_error_not_presented",screen:k.PAYWALL}),n.info({title:"Could not show paywall",body:"There was an issue showing the paywall. This could be due to a network error or the subscription was not loaded.",timeout:1e4}),c={result:P.NOT_PRESENTED}}e.state("presentPaywallIfNeeded result:",c);const{success:l,canContinue:Q}=z(c);return l&&(await r.syncPurchases(),await U()),C.value=!1,Q}catch(s){return C.value=!1,e.error("showPaywall failed:",s),d(s),n.error({title:"Error",body:"There was an error with the paywall. Please contact support for assistance."}),s}},j=async t=>{const{fetchBalance:s}=ke();if(!t)return e.error("purchaseCoinPackage called without a package"),n.error({title:"Error",body:"That coin pack is unavailable right now. Please try again later."}),{success:!1,cancelled:!1};try{e.init("Purchasing package:",t.identifier);const i=JSON.parse(JSON.stringify(t)),{customerInfo:u}=await r.purchasePackage({aPackage:i});e.success("Purchase completed for",t.product?.identifier);const o=u?.nonSubscriptionTransactions?.sort((c,l)=>l.purchaseDateMillis-c.purchaseDateMillis)?.[0];if(o?.transactionIdentifier)try{const c=await Z(o);e.state("transactionStatus:",c)}catch(c){e.warn("Transaction status poll did not confirm:",c),d(c)}else e.warn("No transaction ID found in nonSubscriptionTransactions");return await s({refresh:!0}),a("trackEvent",{category:y.PAYWALL,action:f.PURCHASED,name:"paywall_purchase_success",screen:k.PAYWALL}),{success:!0,cancelled:!1}}catch(i){const{isCancelled:u,message:o}=X(i);return u?(e.state("Coin purchase cancelled by user"),{success:!1,cancelled:!0}):(e.error("Coin purchase failed:",i),d(i),n.error({title:"Purchase failed",body:o}),{success:!1,cancelled:!1,message:o})}},U=async()=>{try{const{customerInfo:t}=await r.getCustomerInfo(),s=t.originalAppUserId,i=await K(s);return e.state("Core user response:",i),await G({hash:i.hash,userId:i.user_id,successRoute:b.value?.successPurchaseRoute}),!0}catch(t){return e.error("loginUser failed:",t),d(t),n.error({title:"Error",body:"There was an error with the paywall. Please contact support for assistance."}),t}};
1return{currentOffering:h,allOfferings:p,paywallIsProcessing:C,getOffering:O,getOfferings:q,showPaywall:J,purchaseCoinPackage:j}};export{Pe as u};

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.