{"version":3,"names":[],"mappings":"","sources":["experiment/ProhibitAnnualBucketRenewal.js"],"sourcesContent":["/*jshint multistr: true*/\nwindow.Experiments = window.Experiments || {};\nwindow.Experiments.ProhibitAnnualBucketRenewal = (function (\n options, account, user, _, mercury\n) {\n 'use strict';\n\n options = options || {};\n _ = _ || window._;\n mercury = mercury || window.mercury || {};\n\n // Variations\n const CONTROL = 'control'; // eslint-disable-line no-unused-vars\n const TREATMENT = 'treatment'; // eslint-disable-line no-unused-vars\n const NONE = 'none'; // eslint-disable-line no-unused-vars\n\n // Actions\n const ASSIGNED = 'assigned';\n const CLICKED = 'clicked';\n const MODAL_SHOWN = 'modalShown';\n const MODAL_CLOSED = 'modalClosed';\n const CONTACT_US_CLICKED = 'contactUsClicked';\n const CONTACT_US_TO_RENEW_CLICKED = 'contactUsToRenewClicked';\n const LEARN_MORE_CLICKED = 'learnMoreClicked';\n\n var service = {\n 'id': 'GROW-2257',\n 'account': null,\n 'launchDarklyFlag': 'grow-2257-prohibit-annual-bucket-renewal',\n 'mercuryAssignmentEventId': 'experiment::assignments',\n 'mercuryEventId': 'growth::g2257SurfaceTieredFeaturesToBucketPlans',\n 'name': 'Prohibit Annual Bucket Renewal',\n 'options': {},\n 'user': null,\n 'variation': null,\n 'version': '1',\n };\n\n const defaultOptions = {\n 'variation': null,\n };\n\n const ProhibitAnnualRenewalDialog = MinimalDialogView.extend({\n tagName: \"div\",\n className: \"dialog-kit grow-2257-prohibit-annual-bucket-renewal contact-us-dialog\",\n events: {\n 'click .contact-us': 'handleContactUsClicked',\n 'click .button-learn-more': 'handleLearnMoreClicked',\n 'click .close': 'close',\n },\n template: Handlebars.compile('\\\n
\\\n
\\\n
\\\n

Update your Plan

\\\n
\\\n You are on a plan that is being retired. In order to renew, we will need to update your plan.\\\n
\\\n \"pick\\\n
\\\n Upon updating your plan, you will be able to gain access to new features.\\\n
\\\n \\\n Contact Us To Renew\\\n \\\n
\\\n Selecting Contact Us to Renew will allow you to set up an appointment with a \\\n When I Work representative to update your plan.\\\n
\\\n
\\\n
\\\n \\\n
\\\n
\\\n

Unlock more great features when you update:

\\\n
    \\\n
  • Document Storage
  • \\\n
  • OpenShift Requests
  • \\\n
  • Reporting
  • \\\n
  • Team Tasks
  • \\\n
  • Auto Scheduling
  • \\\n
\\\n
\\\n
\\\n

Coming Soon:

\\\n
    \\\n
  • Shift Tasks
  • \\\n
  • Overtime Visibility
  • \\\n
  • Labor Forecasting
  • \\\n
\\\n
\\\n
\\\n \\\n Learn More\\\n \\\n
\\\n
\\\n
\\\n '),\n render: function () {\n const data = {};\n this.$el.html(this.template(data));\n return this;\n },\n show: function () {\n DialogView.prototype.show.apply(this, arguments);\n this.$el.center();\n service.track(MODAL_SHOWN, { target: 'prohibitAnnualRenewalDialog' });\n },\n handleContactUsClicked: function () {\n service.track(CONTACT_US_TO_RENEW_CLICKED, { target: 'prohibitAnnualRenewalDialog' });\n DialogView.prototype.close.apply(this, arguments);\n },\n handleLearnMoreClicked: function () {\n service.track(LEARN_MORE_CLICKED, { target: 'prohibitAnnualRenewalDialog' });\n },\n close: function (e) {\n if (e) {\n e.preventDefault();\n }\n service.track(MODAL_CLOSED, { target: 'prohibitAnnualRenewalDialog' });\n DialogView.prototype.close.apply(this, arguments);\n },\n });\n\n function construct(account, user, options) {\n $.extend(true, service.options, defaultOptions, options);\n service.account = account || Current.Account;\n service.user = user || Current.User;\n\n service.variation = options.variation;\n\n return service;\n }\n\n function shouldProhibitRenewal() {\n if (service.isVariation()) {\n if (\n window.location.hash.includes('allow-annual-renewal') ||\n service.getAccount().isMonthlyBilling() // should not need this, but just in case LD rules are wrong\n ) {\n return false;\n }\n\n return service.getAccount().isAnnualBilling();\n }\n\n return false;\n }\n\n function showContactUsModal() {\n service.track(CONTACT_US_CLICKED, { target: 'accountPage' });\n service.modal = new ProhibitAnnualRenewalDialog();\n service.modal.render();\n service.modal.show({ modal: true });\n }\n\n function getAccount() {\n return service.account;\n }\n\n function setAccount(account) {\n service.account = account;\n return service;\n }\n\n function getUser() {\n return service.user;\n }\n\n function setUser(user) {\n service.user = user;\n return service;\n }\n\n function getOptions() {\n return service.options;\n }\n\n function init() {\n if (inAudience()) {\n service.trackAssignment();\n }\n }\n\n function isControl() {\n return service.getVariation() === CONTROL;\n }\n\n function isNone() {\n return service.getVariation() === NONE;\n }\n\n function isVariation(variation) {\n if (!variation) {\n return !service.isControl() && !service.isNone();\n }\n return variation === service.getVariation();\n }\n\n function getVariation() {\n // there is already a variation set, use that\n if (service.variation) {\n return service.variation;\n }\n\n // Get variation from launch darkly flags\n if (Current && Current.Flags) {\n service.setVariation(Current.Flags[service.launchDarklyFlag]);\n }\n\n return service.variation;\n }\n\n function setVariation(variation) {\n service.variation = variation;\n return service;\n }\n\n function inAudience() {\n return !!service.getVariation() && !service.isNone();\n }\n\n function track(action, attributes, shouldTrackAssignment) {\n attributes = attributes || {};\n shouldTrackAssignment = shouldTrackAssignment === undefined ? true : shouldTrackAssignment;\n\n const fields = _.extend({\n action: action,\n target: attributes.target ? $.camelCase(attributes.target) : null,\n }, attributes);\n\n if (fields.variation !== NONE && service.inAudience()) { // don't track if excluded from experiment\n if (shouldTrackAssignment) {\n service.trackAssignment(attributes);\n }\n\n if (mercury) {\n mercury.track(service.mercuryEventId, fields);\n }\n\n if (window.LogRocket) {\n window.LogRocket.track([service.mercuryEventId, fields.getVariation(), action].join('::'));\n }\n }\n }\n\n function assignmentRememberKey(salt, key) {\n return [\n (key || service.mercuryEventId),\n salt,\n ASSIGNED,\n ].join('::');\n }\n\n function trackAssignment(attributes, remember = true) {\n attributes = attributes || {};\n\n const account = service.getAccount();\n const rememberKey = service.assignmentRememberKey((account && account.id));\n\n if (!remember || (remember && !localStorage.getItem(rememberKey))) {\n const fields = _.extend({\n eventNames: _.compact([service.mercuryEventId]),\n experimentId: service.id,\n variation: service.getVariation(),\n }, attributes);\n\n // make sure eventNames is a json string\n fields.eventNames = JSON.stringify(fields.eventNames);\n\n if (fields.variation !== NONE && service.inAudience()) { // don't track if excluded from experiment\n if (mercury) {\n mercury.track(service.mercuryAssignmentEventId, fields);\n // also track assign as experiment event\n service.track(ASSIGNED, attributes, false);\n }\n\n if (window.LogRocket) {\n LogRocket.track([service.mercuryEventId, fields.variation, ASSIGNED].join('::'));\n }\n\n if (remember) {\n localStorage.setItem(rememberKey, '1');\n }\n }\n }\n }\n\n // Newable experiment\n // remove `.construct(account, user, options)` if you don't want\n // constructor to run when creating a new instance\n return _.extend(service, {\n 'assignmentRememberKey': assignmentRememberKey,\n 'construct': construct,\n 'getAccount': getAccount,\n 'getOptions': getOptions,\n 'getUser': getUser,\n 'getVariation': getVariation,\n 'inAudience': inAudience,\n 'init': init,\n 'isControl': isControl,\n 'isNone': isNone,\n 'isVariation': isVariation,\n 'showContactUsModal': showContactUsModal,\n 'setAccount': setAccount,\n 'setUser': setUser,\n 'setVariation': setVariation,\n 'shouldProhibitRenewal': shouldProhibitRenewal,\n 'track': track,\n 'trackAssignment': trackAssignment,\n }).construct(account, user, options);\n});\n\n$(() => {\n window.Experiments = window.Experiments || {};\n window.Experiments.instances = window.Experiments.instances || {};\n\n try {\n const experiment = new window.Experiments.ProhibitAnnualBucketRenewal();\n\n window.Experiments.instances.prohibitAnnualBucketRenewal = experiment;\n experiment.init();\n } catch (e) {\n setTimeout(() => {\n // Don't prevent jQuery.ready from firing other functions\n throw e;\n }, 0);\n }\n});\n"],"file":"experiment/ProhibitAnnualBucketRenewal-8ef52dd226.js","sourceRoot":"/dist/js"}