PageSourceSearch

https://opensnow.com/_nuxt/PKRGbsEr.js

js opensnow.com collected 2026-10-01 10:32:07 UTC 10,035 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:`f764f49567e6b0ecf4d75f5cc38e95bb992eec2e`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`4e3f57dc-9f73-4aee-9e39-561110b3999d`,e._sentryDebugIdIdentifier=`sentry-dbid-4e3f57dc-9f73-4aee-9e39-561110b3999d`)}catch{}})();import{a as e}from"./5pVCgjj7.js";import{a as t,t as n}from"./NBzTq55f.js";import{l as r}from"./CE-KODid.js";import"./DxhnfhdF.js";import{at as i}from"./CsmHvC2J.js";import{t as a}from"./Bem1y1hc.js";import{t as o}from"./CaKFNo63.js";var s={create:0,login:1},c={choose:{key:`choose`,label:`Choose`,isComplete(e){return e.selectedPlanId>0}},account:{key:`account`,label:`Account`,isComplete(e){return c.choose.isComplete(e)&&!n().isGuest}},purchase:{key:`purchase`,label:`Purchase`,isComplete(e){let t=n();return e.purchaseComplete||t.isPayingCustomer}}},l=`buy-store`,u=t(`buy`,{state:()=>({selectedPlanId:0,planType:`individual`,filteredPlans:[],step:c.choose.key,stateStep:0,loading:!1,accountMode:s.create,coupon:null,promoCode:null,planDiscounts:null,stripeLibraryLoaded:!1,stripePromoCodeId:null,stripeCheckoutSessionId:null,
1stripeCheckoutSessionClientSecret:null,stripeCheckoutSessionKey:null,stripeCheckoutInstance:null,stripeCheckoutSessionMessage:null,purchaseComplete:!1,childAccountAcknowledged:!1,groupChildrenCount:0,switchOfferAccepted:!1,upgradeOfferAccepted:!1,upgradeConfirmation:null,userSubscriptionSettings:null,returnTo:`/user/favorites/locations/snow-summary`}),actions:{async init(){let e=n(),{query:t}=r(),{plans:o}=a().pricing;e.user&&await this.onUserChange(),this.allowPromoCodeUsage&&(t.promocode?this.promoCode=t.promocode:new Date<new Date(`2026-10-01T06:00:00.000Z`)?this.promoCode=`fall2630`:this.promoCode=null,await this.checkCoupon());let l=Number.isNaN(+t.step)?null:+t.step;if(l!==null&&this.hasStateStep(l)){this.activateStateStep({index:l});return}let u=t.selected_plan_id?+t.selected_plan_id:null,d=t.plan,f=u||d?o.find(e=>e.id===u||e.slug===d):null;f?(this.selectedPlanId=f.id,f.is_active||(this.selectedPlanId=this.closestActivePlan?.id??o.find(e=>e.is_default)?.id),e.user?this.step=c.purchase.key:t.email&&(this.step=c.account.key,this.accountMode=s.login)):e.isPayingCustomer?(this.selectedPlanId=this.closestUpgradePlan?.id??this.closestActivePlan?.id,this.step=c.purchase.key):this.selectedPlanId=o.find(e=>e.is_default)?.id??0,t.return_to&&(this.returnTo=i(t.return_to)),this.setStateStep({index:0})},async initStripeCheckoutSession(){let{$api:t}=e(),n={plan_id:this.selectedPlanId};this.planDiscounts?.[this.selectedPlanId]&&(n.promo_code=this.promoCode,n.stripe_promo_code_id=this.stripePromoCodeId);let r=await t.post(`/subscription/stripe/checkout-session`,void 0,n);return this.stripeCheckoutSessionId=r.session.id,this.stripeCheckoutSessionClientSecret=r.session.client_secret,this.stripeCheckoutSessionKey=this.genStripeCheckoutSessionKey(),this.stripeCheckoutSessionMessage=r.message,this.stripeSessionClientSecret},async checkStripeCheckoutSession(){if(!this.stripeCheckoutSessionId)return null;let{$api:t}=e();(await t.get(`/subscription/stripe/checkout-session/${this.stripeCheckoutSessionId}`)).session.is_complete&&(this.purchaseComplete=!0,await n().fetchUser())},async checkCoupon(){if(!this.promoCode||!this.allowPromoCodeUsage)return;let{$api:t}=e();try{let{coupon:e}=await t.get(`/subscription/stripe/coupon/${this.promoCode}`);this.coupon=e,this.stripePromoCodeId=e.stripe_promo_code_id,this.planDiscounts=Object.fromEntries(Object.values(e.applies_to_plans).map(t=>[t.plan_id,{discount_amount:e.discount_amount,discount_percent:e.discount_percent*100,expires_at:e.expires_at,label:e.promo_code,discount_difference:t.discount_difference,discount_price:t.discount_price}]))}catch{}},async createUpgradeInvoice(){let{$api:t}=e(),n={plan_id:this.selectedPlanId};return t.post(`/subscription/stripe/upgrade/preview`,void 0,n)},async confirmUpgrade(t={}){let{$api:n}=e();return n.post(`/subscription/stripe/upgrade/confirm`,void 0,t)},async onUserChange(){let e=n();if(e.user){let t=await e.getSubscriptionSettings();this.userSubscriptionSettings={manage:t.manage_subscription,members:t.members},this.groupChildrenCount=t.members?.length??0}else this.userSubscriptionSettings=null,this.groupChildrenCount=0;this.validatePlanDiscounts()},async navigateToManageSubscription(e={},t=3e3,n=null){this.loading=!0,o({...e,onComplete(){setTimeout(()=>{this.loading=!1},t)},onError(e){n&&n.open({message:e.message,dismissible:!0,duration:3e4,type:`error`})}})},validatePlanDiscounts(){let e=n();this.planDiscounts&&e.isPayingCustomer&&(this.planDiscounts=null,this.coupon=null,this.stripePromoCodeId=null)},planBySlug(e){return this.subscriptionPlans.find(t=>t.slug===e)},activeStep(e=null){return e&&(this.step=e.key),c[this.step]},nextStep(){this.purchaseComplete?this.activeStep(c.purchase):this.step===c.choose.key?this.activeStep(n().isGuest?c.account:c.purchase):this.step===c.account.key&&this.activeStep(c.purchase)},filterPlans(){let e=n(),{subscriptionPlans:t}=this,r=this.planType===`family`,i=t.filter(e=>e.is_group===r).filter(t=>!e.isPayingCustomer||t.is_recurring);i.sort((e,t)=>e.sort_weight-t.sort_weight),this.filteredPlans=i},genStripeCheckoutSessionKey(){return[n().user.id,this.selectedPlanId].join(`-`)},isStripeCheckoutSessionStillValid(){return this.stripeCheckoutSessionKey===this.genStripeCheckoutSessionKey()}
1,async invalidateStripeCheckoutSession(){let t=this.stripeCheckoutSessionId,n=this.purchaseComplete;if(this.stripeCheckoutSessionId=null,this.stripeCheckoutSessionClientSecret=null,this.stripeCheckoutSessionKey=null,this.stripeCheckoutSessionMessage=null,this.stripeCheckoutInstance=null,this.purchaseComplete=!1,!t||n)return;let{$api:r}=e();try{await r.delete(`/subscription/stripe/checkout-session/${t}`)}catch{}},_setHistory(e){try{window.localStorage.setItem(l,JSON.stringify(e))}catch{this.history=e}return e},_getHistory(){try{return JSON.parse(window.localStorage.getItem(l)??`[]`)}catch{return this.history??[]}},setStateStep({reset:e=!1,index:t=0}={}){let n=e?this._setHistory([]):this._getHistory(),r=[`selectedPlanId`,`step`,`childAccountAcknowledged`,`switchOfferAccepted`];if(this.selectedPlanId===0)return;let i=Math.max(t>n.length?n.length:t,0);n.length=i,n[i]=Object.fromEntries(r.map(e=>[e,this[e]])),this._setHistory(n),this.stateStep=i},activateStateStep({index:e=0}={}){let t=this._getHistory();this.stateStep=Math.max(e>=t.length?t.length-1:e,0);let n=t[this.stateStep];n&&Object.entries(n).forEach(([e,t])=>{this[e]=t})},hasStateStep(e=0){return!!this._getHistory()[e]},planUpgradeOffer(e){let{userCurrentPlan:t}=this;if(!t||!e||!this.upgradeOfferAllowed)return null;let n=t.upgrade_offers?.find(t=>t.plan_ids.includes(e.id));return n?{discount_amount:n.discount_amount,discount_percent:n.discount_percent*100,discount_price:n.discount_amount?Math.max(0,e.price-n.discount_amount):e.price*(1-n.discount_percent),label:n.label,expires_at:n.expires_at}:null}},getters:{subscriptionPlans(){return a().pricing.plans.filter(e=>e.is_active)},allowPromoCodeUsage(){let{isPayingCustomer:e}=n();return!e},upgradeOfferAllowed(){return this.userSubscriptionSettings?.manage?.upgrade_discount_offer_allowed},displaySwitchOffer(){let e=n();if(this.switchOfferAccepted||e.isStripeCustomer)return!1;let t=a().pricing.provider_switch_offer;if(!(t&&t.is_active))return!1;let r=t.applies_to.includes(`apple`),i=t.applies_to.includes(`google`),o=t.applies_to.includes(`test`);return r&&e.isAppleCustomer||i&&e.isGoogleCustomer||o&&e.isTestCustomer},displaySwitchAndUpgradeOffer(){if(!this.displaySwitchOffer||!this.upgradeOfferAllowed)return!1;let{userCurrentPlan:e,targetPlan:t}=this;return t?.plan_level>e?.plan_level},switchDiscountPercent(){return a().pricing.provider_switch_offer.discount_percent*100},upgradeDiscount(){return this.planUpgradeOffer(this.targetPlan)},userCurrentPlan(){let e=a(),t=n();return e.pricing.plans.find(e=>e.id===t.user?.membership?.plan_id)},closestActivePlan(){let{userCurrentPlan:e}=this;if(!e)return null;if(e.is_active)return e;let t=this.subscriptionPlans,n=this.groupChildrenCount>0;return t.find(t=>(n?t.is_group:!t.is_group)&&e.days===t.days&&e.plan_level===t.plan_level)},closestUpgradePlan(){let{userCurrentPlan:e}=this;if(!e)return null;let t=this.subscriptionPlans.filter(e=>!e.is_preview),n=this.groupChildrenCount>0;return e.slug===`trial`?t.find(e=>e.is_active&&!e.is_group&&e.is_default)??t.find(e=>e.slug===`base`):t.find(t=>t.is_active&&(n?t.is_group:!t.is_group)&&e.plan_level<t.plan_level)||(e.is_group?null:t.find(t=>t.is_active&&t.is_group&&e.plan_level===t.plan_level))},targetPlan(){return this.subscriptionPlans.find(e=>e.id===this.selectedPlanId)??null},targetPlanIsUpgrade(){let{isPayingCustomer:e}=n(),{userCurrentPlan:t,targetPlan:r,upgradeConfirmation:i}=this;return!e||!t||!r||i?!1:r.plan_level>t.plan_level||r.plan_level===t.plan_level&&r.is_group&&!t.is_group},displayNonRecurringUpgradeOffer(){let{isPayingCustomer:e}=n();return this.upgradeOfferAllowed?!!(e&&!this.userCurrentPlan.is_recurring&&this.userCurrentPlan.upgrade_offers.length):!1},displayRecurringUpgradeOffer(){let{isPayingCustomer:e}=n();return this.upgradeOfferAllowed?!!(e&&this.userCurrentPlan.is_recurring&&this.userCurrentPlan.upgrade_offers.length):!1},paymentProviderName(){let e=n();return e.isAppleCustomer?`Apple`:e.isGoogleCustomer?`Google`:`Test Provider`},appStoreName(){let e=n();return e.isAppleCustomer?`Apple App Store`:e.isGoogleCustomer?`Google Play Store`:`Test Provider Store`},purchaseAllowedForOtherPlatforms(){return this.switchOfferAccepted},purchaseAllowed(){let e=n();return!e.isGuest&&(e.isTrialing||this.purchaseComplete||this.purchaseAllowedForOtherPlatforms||!e.isAllAccess||e.isChild&&this.childAccountAcknowledged||e.isPayingCustomer&&this.userCurrentPlan&&!this.userCurrentPlan.is_recurring)}}});
1export{c as n,u as r,s as t};
2//# sourceMappingURL=PKRGbsEr.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.