{"version":3,"sources":["webpack:///./app/javascript/src/startup/Application.js","webpack:///./app/javascript/src/utils/fetchHelpers.js","webpack:///./app/javascript/src/utils/conversionTracker.js","webpack:///./app/javascript/src/utils/nextStartDate.js"],"names":["ua","window","navigator","userAgent","indexOf","location","document","addEventListener","fetch","then","handleErrors","user","currentUser","ffk","email","console","error","query","parse","search","Object","keys","length","whitelistKeys","filter","key","includes","newReferral","_","pick","time","Date","toUTCString","landing_page","href","referrer","doucment_referrer","ffk_person_id","Cookies","get","history","getJSON","push","set","expires","discount_code","checkCookieAndRefferal","Array","prototype","forEach","call","getElementsByClassName","el","conversionTracker","dataset","event","JSON","options","footerNewsletterSignupSubmit","token","action","form","getElementById","first_name","querySelector","value","disabled","safeCredentials","method","body","stringify","tag_name","recaptcha_action","res","json","success","content_category","content_name","classList","toggle","message","alert","jsonHeader","arguments","undefined","assign","Accept","getAuthenticityToken","name","header","concat","content","authenticityHeader","credentials","mode","headers","safeCredentialsFormData","response","ok","Error","statusText","nanomajor_long_symbol","variant","last_name","start_date","terms_of_service_agreement_checked","privacy_policy_agreement_checked","payment_source","dataLayer","ecommerce","items","currency","item_id","item_name","item_category","quantity","checkout","actionField","step","user_data","em","sha256","fn","ln","email_address","address","payment_type","item_variant","price","transaction_id","id","eventCategory","eventAction","eventLabel","content_type","product_variant","isoWeek","require","advancedFormat","dayjs","extend","getFirstMondayOf","dayInThisMonth","firstDayOfTheMonth","startOf","dayOfWeek","isoWeekday","add","nextStartDate","_classCallCheck","today","firstMonday","diff","this","nMonths","futureMonth","format","subtract","Math","abs"],"mappings":"sGAQQA,E,yDAEa,MAFbA,EAAKC,OAAOC,UAAUC,WACRC,QAAQ,SAAW,GAAKJ,EAAGI,QAAQ,YAAc,KAEnEH,OAAOI,SAAW,YA+JtBC,SAASC,iBAAiB,oBAAoB,WA7E5CC,MAAM,8BACHC,KAAKC,KACLD,MAAK,SAAAE,GACAA,EAAKC,aAAeX,OAAOY,KAC7BZ,OAAOY,IAAI,SAAU,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OwF,KAAKL,aACd,GAAC,CAAA3H,IAAA,WAAAwC,MAED,WACE,OAAOwF,KAAKL,cAAcQ,OAAO,gBACnC,GAAC,CAAAnI,IAAA,SAAAwC,MAED,WACE,OAAOwF,KAAKL,cAAcQ,OAAO,qBACnC,GAAC,CAAAnI,IAAA,YAAAwC,MAED,WACE,OAAOwF,KAAKL,cAAcQ,OAAO,YACnC,GAAC,CAAAnI,IAAA,iBAAAwC,MAED,WACE,OAAOwF,KAAKL,cAAcQ,OAAO,WACnC,GAAC,CAAAnI,IAAA,OAAAwC,MAED,SAAKyF,GACH,IAAMC,EAAcF,KAAKL,cAAcS,SAASH,EAAS,SAEzD,OADAD,KAAKL,cAAgBP,EAAiBc,GAC/BF,IACT,GAAC,CAAAhI,IAAA,cAAAwC,MAED,WAEE,OADc0E,MACDiB,OAAO,qBACtB,GAAC,CAAAnI,IAAA,UAAAwC,MAED,WACE,OAAO0E,MAAQa,KAAKC,KAAKL,cAAe,OAC1C,GAAC,CAAA3H,IAAA,eAAAwC,MAED,WAGE,OAFa6F,KAAKC,IAAIN,KAAKxF,QAAQuF,KAAK,UAAW,UAEnC,EAClB,M,8EAACJ,CAAA,CA7DgB,GAgEJA,K","file":"js/application-7910fb3f6297ed47261a.chunk.js","sourcesContent":["import _ from 'underscore';\nimport Cookies from 'js-cookie';\nimport { parse } from 'query-string';\nimport nextStartDate from '@utils/nextStartDate';\nimport { safeCredentials, handleErrors } from '@utils/fetchHelpers';\nimport conversionTracker from '@utils/conversionTracker';\n\nvar checkBrowserCompatibility = function () {\n const ua = window.navigator.userAgent;\n var oldBrowser = ua.indexOf('MSIE') > -1 || ua.indexOf('Trident') > -1;\n if (oldBrowser === true) {\n window.location = '/upgrade';\n }\n}\n\ncheckBrowserCompatibility();\n\n// var injectDataToWebsite = function () {\n// var nextStartDateObj = new nextStartDate();\n// var standard = nextStartDateObj.standard()\n// var monthYear = nextStartDateObj.monthYear()\n// var shortMonthYear = nextStartDateObj.shortMonthYear()\n// var cohortNumber = nextStartDateObj.cohortNumber()\n\n// Array.prototype.forEach.call(document.getElementsByClassName(\"next_start_date-short-month-year\"), function (el) {\n// el.innerHTML = shortMonthYear;\n// });\n\n// Array.prototype.forEach.call(document.getElementsByClassName(\"next_start_date-month-year\"), function (el) {\n// el.innerHTML = monthYear;\n// });\n\n// Array.prototype.forEach.call(document.getElementsByClassName(\"next_start_date-standard\"), function (el) {\n// el.innerHTML = standard;\n// });\n\n// Array.prototype.forEach.call(document.getElementsByClassName(\"next_start_date-cohort-number\"), function (el) {\n// el.innerHTML = cohortNumber;\n// });\n// }\n\nvar addFooterNewsletterCallback = function () {\n window.footerNewsletterSignupSubmit = function (token, action) {\n\n var form = document.getElementById('footer-email-sub');\n\n var first_name = form.querySelector('input[name=\"first_name\"]').value;\n var email = form.querySelector('input[name=\"email\"]').value;\n\n if (!first_name || !email) {\n alert('please provide name and email');\n return;\n }\n\n form.querySelector('button').disabled = true;\n\n fetch('/api/v2/email_subscriptions/add_tag', safeCredentials({\n method: 'POST',\n body: JSON.stringify({\n first_name: first_name,\n email: email,\n tag_name: 'monthly_update',\n token: token,\n recaptcha_action: action,\n }),\n }))\n .then(res => res.json())\n .then(res => {\n if (res.success) {\n conversionTracker(window, 'Lead', {\n content_category: 'email_susbcriptions',\n content_name: 'monthly_update',\n first_name: first_name,\n email: email,\n });\n\n form.classList.toggle('d-none');\n document.querySelector('#footer .newsletter .success-message').classList.toggle('d-none');\n } else if (res.message) {\n form.querySelector('button').disabled = false;\n window.alert(res.message);\n }\n });\n };\n}\n\nvar grabConversionTrackerInstructions = function () {\n Array.prototype.forEach.call(document.getElementsByClassName('conversion_tracker'), function (el) {\n conversionTracker(window, el.dataset.event, JSON.parse(el.dataset.options));\n })\n}\n\nconst checkAuthAndSetFFK = function () {\n fetch('/api/v2/authenticated_user')\n .then(handleErrors)\n .then(user => {\n if (user.currentUser && window.ffk) {\n window.ffk('people', 'set', { email: user.currentUser.email });\n }\n })\n .catch(() => {\n console.error('not logged in')\n })\n}\n\nconst checkCookieAndRefferal = function () {\n const query = parse(window.location.search);\n\n if (Object.keys(query).length > 0) {\n const whitelistKeys = Object.keys(query).filter(key => key.includes('utm_') || key.includes('fbclid') || key.includes('ffk_') || key.includes('ref'));\n if (whitelistKeys.length > 0) {\n const newReferral = _.pick(query, whitelistKeys);\n newReferral.time = new Date().toUTCString();\n\n if (window && window.ffk) {\n newReferral.landing_page = window.location.href;\n\n if (document && document.referrer) {\n newReferral.doucment_referrer = document.referrer;\n }\n\n if (newReferral.ffk_person_id) {\n window.ffk('people', 'set', { email: newReferral.ffk_person_id });\n }\n window.ffk('track', 'Referral', newReferral);\n }\n\n if (Cookies.get(\"referral_history\")) {\n const history = Cookies.getJSON(\"referral_history\");\n history.push(newReferral);\n Cookies.set(\"referral_history\", history, { expires: 7300 });\n } else {\n Cookies.set(\"referral_history\", [newReferral], { expires: 7300 });\n }\n }\n if (query.discount_code && query.discount_code === 'videoask10') {\n Cookies.set(\"discount_code\", 'videoask10', { expires: 30 });\n }\n if (query.discount_code && query.discount_code === 'pro10') {\n Cookies.set(\"discount_code\", 'pro10', { expires: 30 });\n }\n if (query.discount_code && query.discount_code === 'cyber2024') {\n Cookies.set(\"discount_code\", 'cyber2024', { expires: 3 });\n }\n } else if (document.referrer && !document.referrer.includes('https://www.altcademy.com/')) {\n const newReferral = {\n time: new Date().toUTCString(),\n };\n\n if (window && window.ffk) {\n newReferral.landing_page = window.location.href;\n\n if (document && document.referrer) {\n newReferral.doucment_referrer = document.referrer;\n }\n\n window.ffk('track', 'Referral', newReferral);\n }\n\n if (Cookies.get(\"referral_history\")) {\n const history = Cookies.getJSON(\"referral_history\");\n history.push(newReferral);\n Cookies.set(\"referral_history\", history, { expires: 7300 });\n } else {\n Cookies.set(\"referral_history\", [newReferral], { expires: 7300 });\n }\n }\n}\n\n\ndocument.addEventListener('DOMContentLoaded', () => {\n checkAuthAndSetFFK();\n checkCookieAndRefferal();\n grabConversionTrackerInstructions();\n addFooterNewsletterCallback();\n // injectDataToWebsite();\n});\n","/**\n * Code by https://github.com/shakacode/react_on_rails/issues/16#issuecomment-220750318\n * A regular non-safe get request:\n * fetch('/profiles/foobar.json', jsonHeader());\n *\n * How this would look in a safe fetch request:\n * fetch('/profiles.json', safeCredentials({\n * method: 'POST',\n * body: JSON.stringify({\n * q: input,\n * thing: this.props.thing\n * })\n * }));\n *\n *\n */\n\n/**\n * For use with window.fetch\n */\nexport function jsonHeader(options = {}) {\n return Object.assign(options, {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n });\n}\n\n// Additional helper methods\n\nexport function getMetaContent(name) {\n const header = document.querySelector(`meta[name=\"${name}\"]`);\n return header && header.content;\n}\n\nexport function getAuthenticityToken() {\n return getMetaContent('csrf-token');\n}\n\nexport function authenticityHeader(options = {}) {\n return Object.assign(options, {\n 'X-CSRF-Token': getAuthenticityToken(),\n 'X-Requested-With': 'XMLHttpRequest',\n });\n}\n\n/**\n* Lets fetch include credentials in the request. This includes cookies and other possibly sensitive data.\n* Note: Never use for requests across (untrusted) domains.\n*/\nexport function safeCredentials(options = {}) {\n return Object.assign(options, {\n credentials: 'include',\n mode: 'same-origin',\n headers: Object.assign((options.headers || {}), authenticityHeader(), jsonHeader()),\n });\n}\n\nexport function safeCredentialsFormData(options = {}) {\n return Object.assign(options, {\n credentials: 'include',\n mode: 'same-origin',\n headers: Object.assign((options.headers || {}), authenticityHeader()),\n });\n}\n\nexport function handleErrors(response) {\n if (!response.ok) {\n throw Error(response.statusText);\n }\n return response.json();\n}\n","import { safeCredentials } from './fetchHelpers';\nimport { sha256 } from 'js-sha256';\n\nconst conversionTracker = (window, event, options = {}) => {\n if (process.env.NODE_ENV !== 'production') {\n console.log(event, options);\n }\n\n switch (event) {\n case 'ViewContent':\n // Google Optimize Activation\n // if (window.dataLayer) {\n // window.setTimeout(function () {\n // window.dataLayer.push({'event': 'optimize.activate'});\n // }, 0);\n // }\n break;\n case 'AddPaymentInfo':\n fetch('/api/v2/leads', safeCredentials({\n method: 'POST',\n body: JSON.stringify({\n event: 'AddPaymentInfo',\n nanomajor_long_symbol: options.nanomajor_long_symbol,\n variant: options.variant,\n first_name: options.first_name,\n last_name: options.last_name,\n email: options.email,\n start_date: options.start_date,\n discount_code: options.discount_code,\n terms_of_service_agreement_checked: options.terms_of_service_agreement_checked,\n privacy_policy_agreement_checked: options.privacy_policy_agreement_checked,\n }),\n }));\n break;\n case 'InitiatePayment':\n fetch('/api/v2/leads', safeCredentials({\n method: 'POST',\n body: JSON.stringify({\n event: 'InitiatePayment',\n nanomajor_long_symbol: options.nanomajor_long_symbol,\n variant: options.variant,\n first_name: options.first_name,\n last_name: options.last_name,\n email: options.email,\n start_date: options.start_date,\n payment_source: options.payment_source,\n discount_code: options.discount_code,\n terms_of_service_agreement_checked: options.terms_of_service_agreement_checked,\n privacy_policy_agreement_checked: options.privacy_policy_agreement_checked,\n }),\n }));\n break;\n default:\n fetch('/api/v2/activities', safeCredentials({ method: 'POST' }));\n }\n\n // GOOGLE\n // https://www.simoahava.com/analytics/facebook-conversions-api-gtm-server-side-tagging/\n if (window.dataLayer) {\n \n switch (event) {\n case 'ViewProduct':\n window.dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.\n window.dataLayer.push({\n event: 'view_item',\n ecommerce: {\n items: [{\n currency: 'USD',\n item_id: options.nanomajor_long_symbol,\n item_name: options.nanomajor_long_symbol,\n item_category: options.content_category,\n quantity: 1,\n }],\n },\n });\n break;\n case 'InitiateCheckout':\n window.dataLayer.push({\n event: 'begin_checkout',\n ecommerce: {\n checkout: {\n actionField: { step: options.step },\n },\n },\n });\n break;\n case 'PickProduct':\n window.dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.\n // Track when a NM is chosen (ex: immersive vs. personalized)\n window.dataLayer.push({\n event: 'add_to_cart',\n ecommerce: {\n items: [{\n currency: 'USD',\n item_id: options.nanomajor_long_symbol,\n item_name: options.nanomajor_long_symbol,\n item_category: options.content_category,\n quantity: 1,\n }],\n },\n });\n break;\n case 'AddToCart':\n // window.dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.\n // // Track when NM path is chosen (ex: immersive vs. personalized)\n // window.dataLayer.push({\n // event: 'add_to_cart',\n // ecommerce: {\n // items: [{\n // currency: 'USD',\n // item_id: options.nanomajor_long_symbol,\n // item_name: options.nanomajor_long_symbol,\n // item_category: options.content_category,\n // item_variant: options.variant,\n // price: options.value,\n // quantity: 1,\n // }],\n // },\n // });\n break;\n case 'AddPaymentInfo':\n window.dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.\n window.dataLayer.push({\n event: 'add_to_cart',\n user_data: {\n em: sha256(options.email),\n fn: sha256(options.first_name),\n ln: sha256(options.last_name),\n email_address: sha256(options.email),\n address: {\n first_name: sha256(options.first_name),\n last_name: sha256(options.last_name),\n },\n },\n ecommerce: {\n payment_type: 'Credit Card',\n currency: 'USD',\n value: options.value,\n items: [\n {\n item_id: options.nanomajor_long_symbol,\n item_name: options.nanomajor_long_symbol,\n item_category: options.content_category,\n item_variant: options.variant,\n price: options.value,\n quantity: 1,\n },\n ],\n },\n });\n break;\n case 'InitiatePayment':\n window.dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.\n window.dataLayer.push({\n event: 'add_payment_info',\n user_data: {\n em: sha256(options.email),\n fn: sha256(options.first_name),\n ln: sha256(options.last_name),\n email_address: sha256(options.email),\n address: {\n first_name: sha256(options.first_name),\n last_name: sha256(options.last_name),\n }\n },\n ecommerce: {\n payment_type: \"Credit Card\",\n currency: 'USD',\n value: options.value,\n items: [{\n item_id: options.nanomajor_long_symbol,\n item_name: options.nanomajor_long_symbol,\n item_category: options.content_category,\n item_variant: options.variant,\n price: options.value,\n quantity: 1,\n }],\n },\n });\n break;\n case 'Purchase':\n window.dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.\n window.dataLayer.push({\n event: 'purchase',\n user_data: {\n em: sha256(options.email),\n fn: sha256(options.first_name),\n ln: sha256(options.last_name),\n email_address: sha256(options.email),\n address: {\n first_name: sha256(options.first_name),\n last_name: sha256(options.last_name),\n }\n },\n ecommerce: {\n transaction_id: options.id,\n currency: 'USD',\n value: options.value,\n items: [{\n item_id: options.nanomajor_long_symbol,\n item_name: options.nanomajor_long_symbol,\n item_category: options.content_category,\n item_variant: options.variant,\n price: options.value,\n quantity: 1,\n }],\n },\n });\n break;\n case 'Lead':\n window.dataLayer.push({\n event: 'generate_lead',\n eventCategory: 'generate_lead',\n eventAction: options.content_category,\n eventLabel: options.content_name,\n });\n break;\n case 'ViewContent':\n window.dataLayer.push({\n event: 'view_item',\n eventCategory: 'view_item',\n eventAction: options.content_category,\n eventLabel: options.content_name,\n });\n break;\n default:\n }\n }\n\n // FACEBOOK\n /*\n if (window.fbq && process.env.NODE_ENV === 'production') {\n switch (event) {\n case 'ViewContent':\n window.fbq('track', 'ViewContent', options);\n break;\n case 'ViewProduct':\n // Track when a NM is viewed\n window.fbq('track', 'ViewContent', {\n content_category: options.content_category,\n content_name: options.nanomajor_long_symbol,\n content_ids: [options.nanomajor_long_symbol],\n content_type: 'product',\n });\n break;\n case 'Lead':\n window.fbq('track', 'Lead', {\n content_category: options.content_category,\n content_name: options.content_name,\n });\n break;\n case 'CompleteRegistration':\n window.fbq('track', 'CompleteRegistration', options);\n break;\n case 'InitiateCheckout':\n window.fbq('track', 'InitiateCheckout');\n break;\n case 'PickProduct':\n // Track when a NM is chosen\n window.fbq('track', 'PickProduct', {\n content_category: options.content_category,\n content_name: options.nanomajor_long_symbol,\n content_ids: [options.nanomajor_long_symbol],\n content_type: 'product',\n });\n break;\n case 'AddToCart':\n // Track when NM path is chosen (ex: immersive vs. personalized)\n window.fbq('track', 'AddToCart', {\n value: options.value,\n currency: 'USD',\n content_category: options.content_category,\n content_name: options.nanomajor_long_symbol,\n content_ids: [options.nanomajor_long_symbol],\n content_type: 'product',\n product_variant: options.variant,\n });\n break;\n case 'AddPaymentInfo':\n // Track when payment information is added in the checkout flow (ex: click, landing page on billing info)\n window.fbq('track', 'AddPaymentInfo', {\n value: options.value,\n currency: 'USD',\n content_category: options.content_category,\n content_name: options.nanomajor_long_symbol,\n content_ids: [options.nanomajor_long_symbol],\n content_type: 'product',\n product_variant: options.variant,\n });\n break;\n case 'InitiatePayment':\n // Track when payment button is clicked\n window.fbq('track', 'InitiatePayment', {\n value: options.value,\n currency: 'USD',\n content_category: options.content_category,\n content_name: options.nanomajor_long_symbol,\n content_ids: [options.nanomajor_long_symbol],\n content_type: 'product',\n product_variant: options.variant,\n });\n break;\n case 'Purchase':\n window.fbq('track', 'Purchase', {\n value: options.value,\n currency: 'USD',\n content_category: options.content_category,\n content_name: options.nanomajor_long_symbol,\n content_ids: [options.nanomajor_long_symbol],\n content_type: 'product',\n product_variant: options.variant,\n });\n break;\n default:\n }\n }\n */\n\n // FULFILLKIT\n if (window.ffk && process.env.NODE_ENV === 'production') {\n switch (event) {\n case 'ViewContent':\n window.ffk('track', 'ViewContent', options);\n break;\n case 'ViewProduct':\n // Track when a NM is viewed\n window.ffk('track', 'ViewContent', {\n content_category: options.content_category,\n content_name: options.nanomajor_long_symbol,\n content_type: 'product',\n });\n break;\n case 'Lead':\n window.ffk('track', 'Lead', {\n content_category: options.content_category,\n content_name: options.content_name,\n email: options.email,\n });\n if (options.email) {\n window.ffk('people', 'set', {email: options.email});\n }\n break;\n case 'CompleteRegistration':\n window.ffk('track', 'CompleteRegistration', options);\n break;\n case 'InitiateCheckout':\n window.ffk('track', 'InitiateCheckout', options);\n break;\n case 'PickProduct':\n // Track when a NM is chosen\n window.ffk('track', 'PickProduct', {\n content_category: options.content_category,\n content_name: options.nanomajor_long_symbol,\n content_type: 'product',\n });\n break;\n case 'AddToCart':\n // Track when NM path is chosen (ex: immersive vs. personalized)\n window.ffk('track', 'AddToCart', {\n value: options.value,\n currency: 'USD',\n content_category: options.content_category,\n content_name: options.nanomajor_long_symbol,\n content_type: 'product',\n product_variant: options.variant,\n });\n break;\n case 'AddPaymentInfo':\n // Track when payment information is added in the checkout flow (ex: click, landing page on billing info)\n window.ffk('track', 'AddPaymentInfo', {\n value: options.value,\n currency: 'USD',\n content_category: options.content_category,\n content_name: options.nanomajor_long_symbol,\n content_type: 'product',\n product_variant: options.variant,\n email: options.email,\n first_name: options.first_name,\n last_name: options.last_name,\n start_date: options.start_date,\n discount_code: options.discount_code,\n terms_of_service_agreement_checked: options.terms_of_service_agreement_checked,\n privacy_policy_agreement_checked: options.privacy_policy_agreement_checked,\n });\n if (options.email) {\n window.ffk('people', 'set', {email: options.email});\n }\n break;\n case 'InitiatePayment':\n // Track when payment button is clicked\n window.ffk('track', 'InitiatePayment', {\n value: options.value,\n currency: 'USD',\n content_category: options.content_category,\n content_name: options.nanomajor_long_symbol,\n content_type: 'product',\n product_variant: options.variant,\n email: options.email,\n first_name: options.first_name,\n last_name: options.last_name,\n start_date: options.start_date,\n discount_code: options.discount_code,\n payment_source: options.payment_source,\n terms_of_service_agreement_checked: options.terms_of_service_agreement_checked,\n privacy_policy_agreement_checked: options.privacy_policy_agreement_checked,\n });\n if (options.email) {\n window.ffk('people', 'set', {email: options.email});\n }\n break;\n case 'Purchase':\n window.ffk('track', 'Purchase', {\n value: options.value,\n currency: 'USD',\n content_category: options.content_category,\n content_name: options.nanomajor_long_symbol,\n content_type: 'product',\n product_variant: options.variant,\n email: options.email,\n first_name: options.first_name,\n last_name: options.last_name,\n start_date: options.start_date,\n });\n if (options.email) {\n window.ffk('people', 'set', {email: options.email});\n }\n break;\n default:\n }\n }\n};\n\nexport default conversionTracker;\n","import dayjs from 'dayjs';\nvar isoWeek = require('dayjs/plugin/isoWeek');\nvar advancedFormat = require('dayjs/plugin/advancedFormat')\n\ndayjs.extend(isoWeek);\ndayjs.extend(advancedFormat);\n\nconst getFirstMondayOf = (dayInThisMonth) => {\n const firstDayOfTheMonth = dayInThisMonth.startOf('month');\n const dayOfWeek = firstDayOfTheMonth.isoWeekday();\n\n if (dayOfWeek !== 1) {\n return firstDayOfTheMonth.add(8 - dayOfWeek, 'days');\n }\n return firstDayOfTheMonth;\n};\n\nclass nextStartDate {\n constructor() {\n const today = dayjs(); // today\n let firstMonday = getFirstMondayOf(dayjs()); // first monday of this month\n\n if (today.diff(firstMonday) > 24 * 60 * 60 * 1000) {\n // if the first monday of this month has passed, go to next month, reset to beginning of the month\n firstMonday = getFirstMondayOf(today.add(1, 'month'));\n }\n\n // set next start date\n this.nextStartDate = firstMonday;\n }\n\n forwardMonths(nMonths) {\n // add n months to next start date, reset to beginning of the month\n const futureMonth = this.nextStartDate.add(nMonths, 'month');\n // get first monday of future month, set as start date\n this.nextStartDate = getFirstMondayOf(futureMonth);\n return this;\n }\n\n value() {\n return this.nextStartDate;\n }\n\n standard() {\n return this.nextStartDate.format('MMMM Do, YYYY');\n }\n\n pretty() {\n return this.nextStartDate.format('dddd, MMMM Do YYYY');\n }\n\n monthYear() {\n return this.nextStartDate.format('MMMM YYYY');\n }\n\n shortMonthYear() {\n return this.nextStartDate.format('MMM YYYY');\n }\n\n late(nMonths) {\n const futureMonth = this.nextStartDate.subtract(nMonths, 'month');\n this.nextStartDate = getFirstMondayOf(futureMonth);\n return this;\n }\n\n immediately() {\n const today = dayjs(); // today\n return today.format('dddd, MMMM Do YYYY');\n }\n\n fromNow() {\n return dayjs().diff(this.nextStartDate, 'days');\n }\n\n cohortNumber() {\n let cohort = Math.abs(this.value().diff('2020-12', 'month'));\n \n return cohort + 48;\n }\n}\n\nexport default nextStartDate;\n"],"sourceRoot":""}