{ "version": 3, "sources": ["img:assets/peeps-challenge.svg", "../pages/gifts.imba"], "sourcesContent": ["import {asset} from 'imba';\nimport url from './peeps-challenge.svg';\nexport default asset({\n\turl: url,\n\ttype: 'svg',\n\tmeta: {\"attributes\":{\"width\":\"110\",\"height\":\"110\",\"fill\":\"none\"},\"flags\":[],\"content\":\"\"},\n\ttoString: function(){ return this.url;}\n})", "import Pricing from '../shared/pricing/pricing'\nimport {Zendesk} from '../services/zendesk'\n\ntag gifts-page\n\tprop authFormVisible = no\n\tprop payButtons = no\n\tprop cardError = \"\"\n\tprop paymentRequest\n\tprop stripe\n\tprop storeReady = no\n\tprop card\n\tprop use-usd\n\n\tprop loading = no\n\tcss mb:50px\n\tcss .table\n\t\t.row d:hflex lh:1.8 fs:lg\n\t\t.row .desc fl:1\n\t\t.neg c:orange8\n\t\t.totals,.coupon\n\t\t\tbdt:1px solid gray6/30 fw:700 mt:2 pt:2\n\t\t.coupon .desc c:orange8\n\n\tcss .button-group\n\t\td:hgrid bg:blue2/10 rd:md bxs:inset 0 0 0 1px blue5\n\t\t.item d:hflex ja:center p:3 rd:inherit fw:bold c:blue7\n\t\t.checked bg:blue5 c:white\n\n\tcss .mark-yellow pos:relative zi:2 c:orange8 fs:lg py:2px px:4px \n\t\t@before pos:absolute inset:0 my:1 bg:yellow4 content:\" \" d:block zi:-1 rotate:-2deg scale-x:1.1\n\n\tcss .plan-options\n\t\td:hflex rd:lg bg:gray3 # bxs:inset 0 0 0 1px gray4 \n\t\t.option\n\t\t\tw:30% fl:1 ta:center p:2 d:vflex ja:center rd:inherit\n\t\t\tbd:1px solid clear\n\t\t\t.name fs:xl mb:-1\n\t\t\t.price fs:lg\n\t\t\t\t@after\n\t\t\t\t\tcontent: \"/month\" o:0.5 ml:0.2 fs:xs\n\t\t\t&.checked bg:blue5 c:white my:-1 py:3 bc:blue7\n\t\t\t\t.name fw:bold\n\n\tcss .tab-group\n\t\td:hflex bdb:1px solid gray6/30 pos:relative\n\t\t.item d:hflex ja:center py:2 fw:bold c:gray6 mb:-1px rdt:md bdb:1px solid clear mr:4\n\t\t.checked2 bg:blue5 c:white bc:blue7\n\t\t.checked bc:blue7 c:blue7 pe:none\n\t\t@after d:block content:\" \" pos:absolute \n\n\tcss .field\n\t\tw:100% py:3 px:3 rd:md bd:1px solid bc:gray4 fs:md outline:none\n\t\tff:inherit font-style:inherit fw:inherit bg:white\n\t\t@focus bxs:glow bc:blue4\n\n\tcss .usps\n\t\tli py:2 ta:center\n\t\th4 mb:0 font-style:italic fs@lt-lg:1.25rem\n\t\tp c:gray7\n\n\tcss fieldset \n\t\tlabel fs:sm mb:1\n\t\tinput p:2\n\t\tp:0 mb:3 mx:0\n\n\tcss .foot\n\t\td:vflex ai:flex-end mt:6\n\t\tbutton mb:15px\n\n\tcss .card-form\n\t\td:none\n\n\tcss .hide-element\n\t\td:none\n\t\n\tcss .show-element\n\t\td:block\n\n\tcss form.busy\n\t\to:0.5 pe:none\n\t\n\tcss $box\n\t\tbxs:xl rd:xl bg:white d:hflex ai:stretch p:0 of:hidden\n\t\n\tcss self header\n\t\tpos:absolute w:100% t:0 h:100px ta:center zi:4 d:none @400:vflex ja:center\n\t\th3 ta:center rotate:-1deg c:orange8 ls:-1px mt:8\n\t\t\n\tcss .section w:100% d:vflex ja:center p:10 pos:relative fl: 1 1 auto pt:25px max-width:500px min-height:480px\n\t\t@after content:\" \" d:block max-height:120px fl:1 1 auto\n\n\tcss .usp bg:indigo2/80 c:indigo9 rd:md p:4 ta:center font-style:italic d:hflex j:center a:center\n\tcss .payment d:grid gtc:1fr @sm:1fr 1fr @lg:1fr 1fr 1fr 1fr grid-gap:15px mt:8 tween: all 0.2s linear\n\tcss .payment.methods gtc:1fr @sm:1fr 1fr\n\n\tpricing = new Pricing({pricing: store.me..pricing, coupons: store.me..coupons, subscription: store.subscription})\n\n\tprop authFormVisible = no\n\tprop stripe\n\tprop use-usd = no\n\t\n\tget default-plan do 'annual'\n\tprop selected-plan-id = default-plan\n\n\tget selected-plan do pricing[selected-plan-id]\n\t\n\tprop gift-coupons = []\n\t\n\tprop pricing = new Pricing({\n\t\tpricing: store.me..pricing\n\t\tcountry: store.me..country\n\t\tcoupons: gift-coupons # Remove free trial coupons\n\t\tsubscription: store.subscription})\n\t\n\tget price-type do use-usd ? 'usd' : 'local'\n\tget currency do price-type == 'usd' ? 'usd' : pricing.currency\n\n\tget plan-price-usd do selected-plan.price.usd.plan\n\tget plan-price do price-type == 'usd' ? plan-price-usd : selected-plan.price.plan\n\tget coupon do selected-plan..coupon\n\n\tget cid\n\t\ttry\n\t\t\tlet gaTrackers = window.ga.getAll!\n\t\t\tgaTrackers[0].get('clientId') if gaTrackers\n\t\tcatch err\n\t\t\t''\n\n\tcss .grid d: grid\n\n\tdef toggleAuthForm sum\n\t\tif authFormVisible == no and window.location.hostname == 'scrimba.com'\n\t\t\tlet url = window.location.href.indexOf('#') > -1 ? window.location.href.split('#')[0] : window.location.href\n\t\t\tapi.track('Subscriptions', 'GoToPayment Clicked', url)\n\t\tauthFormVisible = !authFormVisible\n\n\tdef payWithStripeCheckout\n\t\tlet params =\n\t\t\tproduct_name: selected-plan.id\n\t\t\tpurchase_url: window.location.href.indexOf('#') > -1 ? window.location.href.split('#')[0] : window.location.href\n\t\t\tcoupon_code: coupon ? coupon.code : no\n\t\t\tuse_usd: use-usd\n\t\t\tcid: cid\n\t\t\tgift: true\n\n\t\tlet res = await api.post(\"/stripe/subscription/gift\", params)\n\t\tif res.message\n\t\t\timba.mount \n\n\t\tif res.code == 200\n\t\t\treturn stripe.redirectToCheckout(sessionId: res.session)\n\n\tdef authenticate e\n\t\tlet action = signin ? '/auth/login' : '/auth/signup'\n\t\tlet params = Object.fromEntries(new FormData($form))\n\n\t\tlet res = await api.post(action,params)\n\t\tif res\n\t\t\tif res.message\n\t\t\t\timba.mount \n\n\t\t\tif res.code < 400\n\t\t\t\tawait window.reloadUserData!\n\n\t\t\treturn res\n\n\tdef hydrate\n\t\tinnerHTML = ''\n\t\tschedule!\n\t\tif store..me..coupons\n\t\t\tgift-coupons = store.me.coupons.filter do !$1.plans.includes('trialweek') \n\t\tuse-usd = window.location.href.indexOf('use_usd') > -1 ? yes : no\n\n\t\tpricing = new Pricing\n\t\t\tpricing: store.me..pricing\n\t\t\tcountry: store.me..country\n\t\t\tcoupons: gift-coupons # Remove free trial coupons\n\t\t\tsubscription: store.subscription\n\t\t\tusd: use-usd\n\t\twindow.$once('stripe').then do stripe = Stripe(store.stripeKey)\n\t\twindow.zendesk ||= new Zendesk \n\t\trender!\n\n\tget header-promo-text\n\t\tif selected-plan.discounted?\n\t\t\t<>\n\t\t\t\t\"Limited discount: \"\n\t\t\t\t selected-plan.reference.plan_text\n\t\t\t\t \" {selected-plan.price.plan_text} for {selected-plan.duration}!\"\n\t\telse\n\t\t\t<>\n\t\t\t\t\"Go pro for only \"\n\t\t\t\t \" {selected-plan.price.plan_text} for {selected-plan.duration}!\"\n\n\tdef render\n\t\treturn if $node$\n\t\treturn if pricing.loading?\n\n\t\t\n\t\t\t \"Buy Scrimba subscriptions as a gift \uD83C\uDF81\"\n\t\t\t\n\t\t\t\t

header-promo-text\n\t\t\t<.content[d:vflex @700:hflex jc:center ai:center my:6 mt:120px]>\n\t\t\t\t<.section.copy>\n\t\t\t\t\t\n\t\t\t\t\t\t
  • \n\t\t\t\t\t\t\t \"One-time purchase\"\n\t\t\t\t\t\t\t

    \"Give a membership without worrying about future payments\"\n\t\t\t\t\t\t

  • \n\t\t\t\t\t\t\t \"30-day money-back guarantee\"\n\t\t\t\t\t\t\t

    \"No questions asked, full refund within 24 hours\"\n\t\t\t\t\t\t

  • \n\t\t\t\t\t\t\t \"Does not expire\"\n\t\t\t\t\t\t\t

    \"Our gift vouchers do not expire\"\n\t\t\t\t\t\t

  • \n\t\t\t\t\t\t\t \"Access ALL our content\"\n\t\t\t\t\t\t\t

    \"Take all our courses, including the Frontend Developer Career Path\"\n\t\t\t\t\t\t

  • \n\t\t\t\t\t\t\t \"Easy to use\"\n\t\t\t\t\t\t\t

    \"Just send a link and your recipient is good to go!\"\n\t\t\t\t\t\t\n\t\t\t\t<.section[bg:purple2]>\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t<.hide-element=(authFormVisible)>\n\t\t\t\t\t\t\t \"Choose your plan\"\n\t\t\t\t\t\t\t for item in pricing.available-plans\n\t\t\t\t\t\t\t\t