{"version":3,"sources":["webpack://widget-subscriptions-add-to-cart/./node_modules/mustache/mustache.js","webpack://widget-subscriptions-add-to-cart/webpack/bootstrap","webpack://widget-subscriptions-add-to-cart/./src/utils/url.ts","webpack://widget-subscriptions-add-to-cart/./src/utils/element.ts","webpack://widget-subscriptions-add-to-cart/./src/customizations/customizations.ts","webpack://widget-subscriptions-add-to-cart/./src/customizations/widget-customizations.ts","webpack://widget-subscriptions-add-to-cart/./src/render/render.ts","webpack://widget-subscriptions-add-to-cart/./src/models/shop-theme.ts","webpack://widget-subscriptions-add-to-cart/./src/render/components/widgets/price-label.ts","webpack://widget-subscriptions-add-to-cart/./src/render/components/selling-plans.ts","webpack://widget-subscriptions-add-to-cart/./src/render/components/widgets/frequency.ts","webpack://widget-subscriptions-add-to-cart/./src/render/components/widgets/radio-button.ts","webpack://widget-subscriptions-add-to-cart/./src/render/components/discount.ts","webpack://widget-subscriptions-add-to-cart/./src/models/price-adjustments.ts","webpack://widget-subscriptions-add-to-cart/./src/models/dummy-product.ts","webpack://widget-subscriptions-add-to-cart/./src/utils/ajax.ts","webpack://widget-subscriptions-add-to-cart/./src/services/shopify.ts","webpack://widget-subscriptions-add-to-cart/./src/render/components/subscription-policy.ts","webpack://widget-subscriptions-add-to-cart/./src/render/components/product.ts","webpack://widget-subscriptions-add-to-cart/./src/widget.ts","webpack://widget-subscriptions-add-to-cart/./src/container/widgets-container.ts","webpack://widget-subscriptions-add-to-cart/./src/index.ts"],"names":["module","exports","objectToString","Object","prototype","toString","isArray","Array","object","call","isFunction","escapeRegExp","string","replace","hasProperty","obj","propName","regExpTest","RegExp","test","nonSpaceRe","isWhitespace","re","testRegExp","entityMap","whiteRe","spaceRe","equalsRe","curlyRe","tagRe","Scanner","this","tail","pos","Context","view","parentContext","cache","parent","Writer","templateCache","_cache","set","key","value","get","clear","eos","scan","match","index","substring","length","scanUntil","search","push","lookup","name","primitive","hasOwnProperty","intermediateValue","names","context","lookupHit","indexOf","split","clearCache","parse","template","tags","cacheKey","mustache","join","isCacheEnabled","tokens","undefined","openingTagRe","closingTagRe","closingCurlyRe","lineHasNonSpace","sections","spaces","hasTag","nonSpace","indentation","tagIndex","stripSpace","pop","compileTags","tagsToCompile","Error","start","type","chr","token","openSection","scanner","i","valueLength","charAt","nestedTokens","collector","numTokens","nestTokens","lastToken","squashedTokens","squashTokens","parseTemplate","render","partials","config","getConfigTags","renderTokens","originalTemplate","symbol","buffer","renderSection","renderInverted","renderPartial","unescapedValue","escapedValue","rawValue","self","j","slice","indentPartial","partial","filteredIndentation","partialByNl","indentedValue","escape","getConfigEscape","String","version","defaultWriter","TypeError","s","factory","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__","buildElement","klass","attributes","element","document","createElement","setAttribute","setAttributesOnElement","keys","buildStyle","map","styles","insertHtmlElement","insertPosition","html","classElement","getHtmlElementByClassName","insertAdjacentHTML","console","log","className","getElementsByClassName","getBoolean","customizations","getBooleanWithDefault","defaultValue","getNumber","parseInt","getFontFamily","values","weight","url","getPixel","clearStyles","theme","mainElementWrapper","mainElement","addClassToParent","themeElements","getElementById","classList","add","parentElement","additionalPriceWrapperStyle","additionalPriceStyle","additionalLabelWrapperStyle","additionalLabelStyle","buildPriceValue","groupId","sellingPlans","regularPrice","regularPriceSymbol","regularPriceValue","defaultPriceAdjustment","valueType","lowestPriceAdjustment","sortPriceAdjustments","id","options","filter","priceAdjustment","calculatedDiscount","calculateStartingPriceValue","parseFloat","buildPriceWithDiscount","discountPriceType","getPriceAdjustmentValueType","discountPriceValue","getPriceAdjustmentValue","calculateDiscount","buyOnceId","getSellingPlan","sellingPlanGroup","checked","isSubscription","productPrice","getRadioButtonElement","bindSelectionToInput","event","targetElement","target","sellingPlanId","sellingPlanName","getAttribute","inputEl","querySelector","group","text","defaultSelectedPlan","defaultSelectedPlanId","defaultSelectedPlanName","initFrequency","frequency","frequencyContainer","appendChild","radioButton","initRadioButton","container","radioElementsWrapper","priceLabel","wrapperElement","containerElement","pricePrefixElement","innerHTML","prefix","priceElement","isDummy","formattedProductPrice","concat","formatProductPrice","getRegularPrice","getRegularPriceSymbol","getRegularPriceValue","buildPriceElementContent","labelElement","footer","buildSellingPlanPriceLabel","isDiscountAvailable","plan","priceAdjustments","addEventListener","salePrice","style","display","removeProperty","switchSalePriceView","displaySelectedFrequency","allFrequencies","querySelectorAll","isClickedOn","parts","newStyle","x","pickElement","allContainers","currnectClass2","sellingPlanOptionsHeader","Mustache","classString","onChange","getFrequency","label","showGetItText","labelForFrequency","innerText","getItText","checkedFn","checkedClassFn","inputAttributes","input","onSelection","getRadioButton","getRadioButtonSize","storefrontTheme","isReadOnly","isPreview","buildLineSeparator","defaultPrice","currencySymbol","calculatedDiscountPrice","Number","isInteger","getDecimalSeparator","discountType","discountValue","toFixed","trim","getDecimalType","responsePrice","getSelectedSellingPlans","sellingPlanGroups","selectedGroupId","find","renderDiscount","sellingPlan","selectedPlanId","classNames","formattedClassNames","getHtmlElementValue","getSelectedSellingPlan","subscriptionLabel","shouldShow","price","renderDiscountLabel","renderDiscountPrice","getDiscountPriceType","getDiscountPriceValue","priceWithDiscount","textDecoration","discountPriceSymbol","pillText","discountText","subscriptionText","discountLabelContainer","discountLabel","sort","plan1","plan2","getValue","getPriceAdjustment","groupName","dummyPriceAdjustment","description","position","dummyPriceAdjustment1","dummyPriceAdjustment2","dummyGroupName","dummySellingPlans","dummyProduct","title","handle","requiresSellingPlan","variants","p","checkStatus","response","status","statusText","parseJSON","json","adaptSellingPlan","sellingPlansResponse","resolvePriceAdjustments","price_adjustments","value_type","adaptSellingPlanGroup","sellingPlanGroupResponse","selling_plans","adaptVariants","variantsResponse","adaptProductResponse","requires_selling_plan","selling_plan_groups","openSubscriptionPolicies","getTextHeader","textHeader","getSelectedSellingPlanGroup","getMainText","textMain","subscriptionPolicy","getTextFooter","informationLink","defaultInformationLink","window","location","origin","textFooter","href","getStyles","fontFamily","fontSize","primary","renderProduct","product","groups","shouldShowBuyOnce","wrapper","defaultSelectedGroupIndex","autoPickOptionIndex","getSelectedGroupIndex","buyOnceElement","buyOnceSellingPlan","buyOnceText","isSelected","oneTimeAtLast","sellingPlanGroupLineSeparator","radioStyle","outerColor","innerColor","selectedRadio","borderStyle","borderSize","borderColor","backgroundColor","colors","backgroundImageUrl","setTimeout","getSellingPlansElement","main","getSubscriptionPolicyElement","renderSubscriptionPolicy","addRenderDiscountToOnChangeEvent","SubscriptionsAddToCartWidget","widgetOptions","overridenCustomizations","queryString","params","urlParams","forEach","indexQuery","indexPair","queryKey","decodeURIComponent","toLowerCase","queryValue","elementAttributes","atts","n","nodeName","nodeValue","getElementAttributes","getCustomizations","metadata","productHandle","autoInject","enabled","targetSelector","dropdownBorderColor","clearStyle","fontStyle","rel","getElementsByTagName","injectWidget","fetch","then","Shopify","designMode","interval","setInterval","yotpoWidgetsContainer","initWidgets","clearInterval","currentElement","parentNode","replaceChild","hostElements","insertAdjacentElement"],"mappings":";mCAEiEA,EAAOC,QAGhE,WAAe,aAOrB,IAAIC,EAAiBC,OAAOC,UAAUC,SAClCC,EAAUC,MAAMD,SAAW,SAA0BE,GACvD,MAAuC,mBAAhCN,EAAeO,KAAKD,IAG7B,SAASE,EAAYF,GACnB,MAAyB,mBAAXA,EAWhB,SAASG,EAAcC,GACrB,OAAOA,EAAOC,QAAQ,8BAA+B,QAOvD,SAASC,EAAaC,EAAKC,GACzB,OAAc,MAAPD,GAA8B,iBAARA,GAAqBC,KAAYD,EAkBhE,IAAIE,EAAaC,OAAOd,UAAUe,KAKlC,IAAIC,EAAa,KACjB,SAASC,EAAcT,GACrB,OANF,SAAqBU,EAAIV,GACvB,OAAOK,EAAWR,KAAKa,EAAIV,GAKnBW,CAAWH,EAAYR,GAGjC,IAAIY,EAAY,CACd,IAAK,QACL,IAAK,OACL,IAAK,OACL,IAAK,SACL,IAAK,QACL,IAAK,SACL,IAAK,SACL,IAAK,UASP,IAAIC,EAAU,MACVC,EAAU,MACVC,EAAW,OACXC,EAAU,QACVC,EAAQ,qBA0OZ,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D,KAAKsI,eAAeyR,WAAWE,eAAxE,cAGRmB,EAAaA,EAAa/Z,OAAS,GAAGga,sBAAsB,aAAclS,S,kBA7ChF,KCR4C,oBAA3B2R,sBAKfA,sBAAqB,6BCL+B,WAClD,OAAO,IAAIrC,IAGbxQ,QAAQC,IAAI,wC","file":"app.js","sourcesContent":["// This file has been generated from mustache.mjs\n(function (global, factory) {\n  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n  typeof define === 'function' && define.amd ? define(factory) :\n  (global = global || self, global.Mustache = factory());\n}(this, (function () { 'use strict';\n\n  /*!\n   * mustache.js - Logic-less {{mustache}} templates with JavaScript\n   * http://github.com/janl/mustache.js\n   */\n\n  var objectToString = Object.prototype.toString;\n  var isArray = Array.isArray || function isArrayPolyfill (object) {\n    return objectToString.call(object) === '[object Array]';\n  };\n\n  function isFunction (object) {\n    return typeof object === 'function';\n  }\n\n  /**\n   * More correct typeof string handling array\n   * which normally returns typeof 'object'\n   */\n  function typeStr (obj) {\n    return isArray(obj) ? 'array' : typeof obj;\n  }\n\n  function escapeRegExp (string) {\n    return string.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, '\\\\$&');\n  }\n\n  /**\n   * Null safe way of checking whether or not an object,\n   * including its prototype, has a given property\n   */\n  function hasProperty (obj, propName) {\n    return obj != null && typeof obj === 'object' && (propName in obj);\n  }\n\n  /**\n   * Safe way of detecting whether or not the given thing is a primitive and\n   * whether it has the given property\n   */\n  function primitiveHasOwnProperty (primitive, propName) {\n    return (\n      primitive != null\n      && typeof primitive !== 'object'\n      && primitive.hasOwnProperty\n      && primitive.hasOwnProperty(propName)\n    );\n  }\n\n  // Workaround for https://issues.apache.org/jira/browse/COUCHDB-577\n  // See https://github.com/janl/mustache.js/issues/189\n  var regExpTest = RegExp.prototype.test;\n  function testRegExp (re, string) {\n    return regExpTest.call(re, string);\n  }\n\n  var nonSpaceRe = /\\S/;\n  function isWhitespace (string) {\n    return !testRegExp(nonSpaceRe, string);\n  }\n\n  var entityMap = {\n    '&': '&amp;',\n    '<': '&lt;',\n    '>': '&gt;',\n    '\"': '&quot;',\n    \"'\": '&#39;',\n    '/': '&#x2F;',\n    '`': '&#x60;',\n    '=': '&#x3D;'\n  };\n\n  function escapeHtml (string) {\n    return String(string).replace(/[&<>\"'`=\\/]/g, function fromEntityMap (s) {\n      return entityMap[s];\n    });\n  }\n\n  var whiteRe = /\\s*/;\n  var spaceRe = /\\s+/;\n  var equalsRe = /\\s*=/;\n  var curlyRe = /\\s*\\}/;\n  var tagRe = /#|\\^|\\/|>|\\{|&|=|!/;\n\n  /**\n   * Breaks up the given `template` string into a tree of tokens. If the `tags`\n   * argument is given here it must be an array with two string values: the\n   * opening and closing tags used in the template (e.g. [ \"<%\", \"%>\" ]). Of\n   * course, the default is to use mustaches (i.e. mustache.tags).\n   *\n   * A token is an array with at least 4 elements. The first element is the\n   * mustache symbol that was used inside the tag, e.g. \"#\" or \"&\". If the tag\n   * did not contain a symbol (i.e. {{myValue}}) this element is \"name\". For\n   * all text that appears outside a symbol this element is \"text\".\n   *\n   * The second element of a token is its \"value\". For mustache tags this is\n   * whatever else was inside the tag besides the opening symbol. For text tokens\n   * this is the text itself.\n   *\n   * The third and fourth elements of the token are the start and end indices,\n   * respectively, of the token in the original template.\n   *\n   * Tokens that are the root node of a subtree contain two more elements: 1) an\n   * array of tokens in the subtree and 2) the index in the original template at\n   * which the closing tag for that section begins.\n   *\n   * Tokens for partials also contain two more elements: 1) a string value of\n   * indendation prior to that tag and 2) the index of that tag on that line -\n   * eg a value of 2 indicates the partial is the third tag on this line.\n   */\n  function parseTemplate (template, tags) {\n    if (!template)\n      return [];\n    var lineHasNonSpace = false;\n    var sections = [];     // Stack to hold section tokens\n    var tokens = [];       // Buffer to hold the tokens\n    var spaces = [];       // Indices of whitespace tokens on the current line\n    var hasTag = false;    // Is there a {{tag}} on the current line?\n    var nonSpace = false;  // Is there a non-space char on the current line?\n    var indentation = '';  // Tracks indentation for tags that use it\n    var tagIndex = 0;      // Stores a count of number of tags encountered on a line\n\n    // Strips all whitespace tokens array for the current line\n    // if there was a {{#tag}} on it and otherwise only space.\n    function stripSpace () {\n      if (hasTag && !nonSpace) {\n        while (spaces.length)\n          delete tokens[spaces.pop()];\n      } else {\n        spaces = [];\n      }\n\n      hasTag = false;\n      nonSpace = false;\n    }\n\n    var openingTagRe, closingTagRe, closingCurlyRe;\n    function compileTags (tagsToCompile) {\n      if (typeof tagsToCompile === 'string')\n        tagsToCompile = tagsToCompile.split(spaceRe, 2);\n\n      if (!isArray(tagsToCompile) || tagsToCompile.length !== 2)\n        throw new Error('Invalid tags: ' + tagsToCompile);\n\n      openingTagRe = new RegExp(escapeRegExp(tagsToCompile[0]) + '\\\\s*');\n      closingTagRe = new RegExp('\\\\s*' + escapeRegExp(tagsToCompile[1]));\n      closingCurlyRe = new RegExp('\\\\s*' + escapeRegExp('}' + tagsToCompile[1]));\n    }\n\n    compileTags(tags || mustache.tags);\n\n    var scanner = new Scanner(template);\n\n    var start, type, value, chr, token, openSection;\n    while (!scanner.eos()) {\n      start = scanner.pos;\n\n      // Match any text between tags.\n      value = scanner.scanUntil(openingTagRe);\n\n      if (value) {\n        for (var i = 0, valueLength = value.length; i < valueLength; ++i) {\n          chr = value.charAt(i);\n\n          if (isWhitespace(chr)) {\n            spaces.push(tokens.length);\n            indentation += chr;\n          } else {\n            nonSpace = true;\n            lineHasNonSpace = true;\n            indentation += ' ';\n          }\n\n          tokens.push([ 'text', chr, start, start + 1 ]);\n          start += 1;\n\n          // Check for whitespace on the current line.\n          if (chr === '\\n') {\n            stripSpace();\n            indentation = '';\n            tagIndex = 0;\n            lineHasNonSpace = false;\n          }\n        }\n      }\n\n      // Match the opening tag.\n      if (!scanner.scan(openingTagRe))\n        break;\n\n      hasTag = true;\n\n      // Get the tag type.\n      type = scanner.scan(tagRe) || 'name';\n      scanner.scan(whiteRe);\n\n      // Get the tag value.\n      if (type === '=') {\n        value = scanner.scanUntil(equalsRe);\n        scanner.scan(equalsRe);\n        scanner.scanUntil(closingTagRe);\n      } else if (type === '{') {\n        value = scanner.scanUntil(closingCurlyRe);\n        scanner.scan(curlyRe);\n        scanner.scanUntil(closingTagRe);\n        type = '&';\n      } else {\n        value = scanner.scanUntil(closingTagRe);\n      }\n\n      // Match the closing tag.\n      if (!scanner.scan(closingTagRe))\n        throw new Error('Unclosed tag at ' + scanner.pos);\n\n      if (type == '>') {\n        token = [ type, value, start, scanner.pos, indentation, tagIndex, lineHasNonSpace ];\n      } else {\n        token = [ type, value, start, scanner.pos ];\n      }\n      tagIndex++;\n      tokens.push(token);\n\n      if (type === '#' || type === '^') {\n        sections.push(token);\n      } else if (type === '/') {\n        // Check section nesting.\n        openSection = sections.pop();\n\n        if (!openSection)\n          throw new Error('Unopened section \"' + value + '\" at ' + start);\n\n        if (openSection[1] !== value)\n          throw new Error('Unclosed section \"' + openSection[1] + '\" at ' + start);\n      } else if (type === 'name' || type === '{' || type === '&') {\n        nonSpace = true;\n      } else if (type === '=') {\n        // Set the tags for the next time around.\n        compileTags(value);\n      }\n    }\n\n    stripSpace();\n\n    // Make sure there are no open sections when we're done.\n    openSection = sections.pop();\n\n    if (openSection)\n      throw new Error('Unclosed section \"' + openSection[1] + '\" at ' + scanner.pos);\n\n    return nestTokens(squashTokens(tokens));\n  }\n\n  /**\n   * Combines the values of consecutive text tokens in the given `tokens` array\n   * to a single token.\n   */\n  function squashTokens (tokens) {\n    var squashedTokens = [];\n\n    var token, lastToken;\n    for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n      token = tokens[i];\n\n      if (token) {\n        if (token[0] === 'text' && lastToken && lastToken[0] === 'text') {\n          lastToken[1] += token[1];\n          lastToken[3] = token[3];\n        } else {\n          squashedTokens.push(token);\n          lastToken = token;\n        }\n      }\n    }\n\n    return squashedTokens;\n  }\n\n  /**\n   * Forms the given array of `tokens` into a nested tree structure where\n   * tokens that represent a section have two additional items: 1) an array of\n   * all tokens that appear in that section and 2) the index in the original\n   * template that represents the end of that section.\n   */\n  function nestTokens (tokens) {\n    var nestedTokens = [];\n    var collector = nestedTokens;\n    var sections = [];\n\n    var token, section;\n    for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n      token = tokens[i];\n\n      switch (token[0]) {\n        case '#':\n        case '^':\n          collector.push(token);\n          sections.push(token);\n          collector = token[4] = [];\n          break;\n        case '/':\n          section = sections.pop();\n          section[5] = token[2];\n          collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;\n          break;\n        default:\n          collector.push(token);\n      }\n    }\n\n    return nestedTokens;\n  }\n\n  /**\n   * A simple string scanner that is used by the template parser to find\n   * tokens in template strings.\n   */\n  function Scanner (string) {\n    this.string = string;\n    this.tail = string;\n    this.pos = 0;\n  }\n\n  /**\n   * Returns `true` if the tail is empty (end of string).\n   */\n  Scanner.prototype.eos = function eos () {\n    return this.tail === '';\n  };\n\n  /**\n   * Tries to match the given regular expression at the current position.\n   * Returns the matched text if it can match, the empty string otherwise.\n   */\n  Scanner.prototype.scan = function scan (re) {\n    var match = this.tail.match(re);\n\n    if (!match || match.index !== 0)\n      return '';\n\n    var string = match[0];\n\n    this.tail = this.tail.substring(string.length);\n    this.pos += string.length;\n\n    return string;\n  };\n\n  /**\n   * Skips all text until the given regular expression can be matched. Returns\n   * the skipped string, which is the entire tail if no match can be made.\n   */\n  Scanner.prototype.scanUntil = function scanUntil (re) {\n    var index = this.tail.search(re), match;\n\n    switch (index) {\n      case -1:\n        match = this.tail;\n        this.tail = '';\n        break;\n      case 0:\n        match = '';\n        break;\n      default:\n        match = this.tail.substring(0, index);\n        this.tail = this.tail.substring(index);\n    }\n\n    this.pos += match.length;\n\n    return match;\n  };\n\n  /**\n   * Represents a rendering context by wrapping a view object and\n   * maintaining a reference to the parent context.\n   */\n  function Context (view, parentContext) {\n    this.view = view;\n    this.cache = { '.': this.view };\n    this.parent = parentContext;\n  }\n\n  /**\n   * Creates a new context using the given view with this context\n   * as the parent.\n   */\n  Context.prototype.push = function push (view) {\n    return new Context(view, this);\n  };\n\n  /**\n   * Returns the value of the given name in this context, traversing\n   * up the context hierarchy if the value is absent in this context's view.\n   */\n  Context.prototype.lookup = function lookup (name) {\n    var cache = this.cache;\n\n    var value;\n    if (cache.hasOwnProperty(name)) {\n      value = cache[name];\n    } else {\n      var context = this, intermediateValue, names, index, lookupHit = false;\n\n      while (context) {\n        if (name.indexOf('.') > 0) {\n          intermediateValue = context.view;\n          names = name.split('.');\n          index = 0;\n\n          /**\n           * Using the dot notion path in `name`, we descend through the\n           * nested objects.\n           *\n           * To be certain that the lookup has been successful, we have to\n           * check if the last object in the path actually has the property\n           * we are looking for. We store the result in `lookupHit`.\n           *\n           * This is specially necessary for when the value has been set to\n           * `undefined` and we want to avoid looking up parent contexts.\n           *\n           * In the case where dot notation is used, we consider the lookup\n           * to be successful even if the last \"object\" in the path is\n           * not actually an object but a primitive (e.g., a string, or an\n           * integer), because it is sometimes useful to access a property\n           * of an autoboxed primitive, such as the length of a string.\n           **/\n          while (intermediateValue != null && index < names.length) {\n            if (index === names.length - 1)\n              lookupHit = (\n                hasProperty(intermediateValue, names[index])\n                || primitiveHasOwnProperty(intermediateValue, names[index])\n              );\n\n            intermediateValue = intermediateValue[names[index++]];\n          }\n        } else {\n          intermediateValue = context.view[name];\n\n          /**\n           * Only checking against `hasProperty`, which always returns `false` if\n           * `context.view` is not an object. Deliberately omitting the check\n           * against `primitiveHasOwnProperty` if dot notation is not used.\n           *\n           * Consider this example:\n           * ```\n           * Mustache.render(\"The length of a football field is {{#length}}{{length}}{{/length}}.\", {length: \"100 yards\"})\n           * ```\n           *\n           * If we were to check also against `primitiveHasOwnProperty`, as we do\n           * in the dot notation case, then render call would return:\n           *\n           * \"The length of a football field is 9.\"\n           *\n           * rather than the expected:\n           *\n           * \"The length of a football field is 100 yards.\"\n           **/\n          lookupHit = hasProperty(context.view, name);\n        }\n\n        if (lookupHit) {\n          value = intermediateValue;\n          break;\n        }\n\n        context = context.parent;\n      }\n\n      cache[name] = value;\n    }\n\n    if (isFunction(value))\n      value = value.call(this.view);\n\n    return value;\n  };\n\n  /**\n   * A Writer knows how to take a stream of tokens and render them to a\n   * string, given a context. It also maintains a cache of templates to\n   * avoid the need to parse the same template twice.\n   */\n  function Writer () {\n    this.templateCache = {\n      _cache: {},\n      set: function set (key, value) {\n        this._cache[key] = value;\n      },\n      get: function get (key) {\n        return this._cache[key];\n      },\n      clear: function clear () {\n        this._cache = {};\n      }\n    };\n  }\n\n  /**\n   * Clears all cached templates in this writer.\n   */\n  Writer.prototype.clearCache = function clearCache () {\n    if (typeof this.templateCache !== 'undefined') {\n      this.templateCache.clear();\n    }\n  };\n\n  /**\n   * Parses and caches the given `template` according to the given `tags` or\n   * `mustache.tags` if `tags` is omitted,  and returns the array of tokens\n   * that is generated from the parse.\n   */\n  Writer.prototype.parse = function parse (template, tags) {\n    var cache = this.templateCache;\n    var cacheKey = template + ':' + (tags || mustache.tags).join(':');\n    var isCacheEnabled = typeof cache !== 'undefined';\n    var tokens = isCacheEnabled ? cache.get(cacheKey) : undefined;\n\n    if (tokens == undefined) {\n      tokens = parseTemplate(template, tags);\n      isCacheEnabled && cache.set(cacheKey, tokens);\n    }\n    return tokens;\n  };\n\n  /**\n   * High-level method that is used to render the given `template` with\n   * the given `view`.\n   *\n   * The optional `partials` argument may be an object that contains the\n   * names and templates of partials that are used in the template. It may\n   * also be a function that is used to load partial templates on the fly\n   * that takes a single argument: the name of the partial.\n   *\n   * If the optional `config` argument is given here, then it should be an\n   * object with a `tags` attribute or an `escape` attribute or both.\n   * If an array is passed, then it will be interpreted the same way as\n   * a `tags` attribute on a `config` object.\n   *\n   * The `tags` attribute of a `config` object must be an array with two\n   * string values: the opening and closing tags used in the template (e.g.\n   * [ \"<%\", \"%>\" ]). The default is to mustache.tags.\n   *\n   * The `escape` attribute of a `config` object must be a function which\n   * accepts a string as input and outputs a safely escaped string.\n   * If an `escape` function is not provided, then an HTML-safe string\n   * escaping function is used as the default.\n   */\n  Writer.prototype.render = function render (template, view, partials, config) {\n    var tags = this.getConfigTags(config);\n    var tokens = this.parse(template, tags);\n    var context = (view instanceof Context) ? view : new Context(view, undefined);\n    return this.renderTokens(tokens, context, partials, template, config);\n  };\n\n  /**\n   * Low-level method that renders the given array of `tokens` using\n   * the given `context` and `partials`.\n   *\n   * Note: The `originalTemplate` is only ever used to extract the portion\n   * of the original template that was contained in a higher-order section.\n   * If the template doesn't use higher-order sections, this argument may\n   * be omitted.\n   */\n  Writer.prototype.renderTokens = function renderTokens (tokens, context, partials, originalTemplate, config) {\n    var buffer = '';\n\n    var token, symbol, value;\n    for (var i = 0, numTokens = tokens.length; i < numTokens; ++i) {\n      value = undefined;\n      token = tokens[i];\n      symbol = token[0];\n\n      if (symbol === '#') value = this.renderSection(token, context, partials, originalTemplate, config);\n      else if (symbol === '^') value = this.renderInverted(token, context, partials, originalTemplate, config);\n      else if (symbol === '>') value = this.renderPartial(token, context, partials, config);\n      else if (symbol === '&') value = this.unescapedValue(token, context);\n      else if (symbol === 'name') value = this.escapedValue(token, context, config);\n      else if (symbol === 'text') value = this.rawValue(token);\n\n      if (value !== undefined)\n        buffer += value;\n    }\n\n    return buffer;\n  };\n\n  Writer.prototype.renderSection = function renderSection (token, context, partials, originalTemplate, config) {\n    var self = this;\n    var buffer = '';\n    var value = context.lookup(token[1]);\n\n    // This function is used to render an arbitrary template\n    // in the current context by higher-order sections.\n    function subRender (template) {\n      return self.render(template, context, partials, config);\n    }\n\n    if (!value) return;\n\n    if (isArray(value)) {\n      for (var j = 0, valueLength = value.length; j < valueLength; ++j) {\n        buffer += this.renderTokens(token[4], context.push(value[j]), partials, originalTemplate, config);\n      }\n    } else if (typeof value === 'object' || typeof value === 'string' || typeof value === 'number') {\n      buffer += this.renderTokens(token[4], context.push(value), partials, originalTemplate, config);\n    } else if (isFunction(value)) {\n      if (typeof originalTemplate !== 'string')\n        throw new Error('Cannot use higher-order sections without the original template');\n\n      // Extract the portion of the original template that the section contains.\n      value = value.call(context.view, originalTemplate.slice(token[3], token[5]), subRender);\n\n      if (value != null)\n        buffer += value;\n    } else {\n      buffer += this.renderTokens(token[4], context, partials, originalTemplate, config);\n    }\n    return buffer;\n  };\n\n  Writer.prototype.renderInverted = function renderInverted (token, context, partials, originalTemplate, config) {\n    var value = context.lookup(token[1]);\n\n    // Use JavaScript's definition of falsy. Include empty arrays.\n    // See https://github.com/janl/mustache.js/issues/186\n    if (!value || (isArray(value) && value.length === 0))\n      return this.renderTokens(token[4], context, partials, originalTemplate, config);\n  };\n\n  Writer.prototype.indentPartial = function indentPartial (partial, indentation, lineHasNonSpace) {\n    var filteredIndentation = indentation.replace(/[^ \\t]/g, '');\n    var partialByNl = partial.split('\\n');\n    for (var i = 0; i < partialByNl.length; i++) {\n      if (partialByNl[i].length && (i > 0 || !lineHasNonSpace)) {\n        partialByNl[i] = filteredIndentation + partialByNl[i];\n      }\n    }\n    return partialByNl.join('\\n');\n  };\n\n  Writer.prototype.renderPartial = function renderPartial (token, context, partials, config) {\n    if (!partials) return;\n    var tags = this.getConfigTags(config);\n\n    var value = isFunction(partials) ? partials(token[1]) : partials[token[1]];\n    if (value != null) {\n      var lineHasNonSpace = token[6];\n      var tagIndex = token[5];\n      var indentation = token[4];\n      var indentedValue = value;\n      if (tagIndex == 0 && indentation) {\n        indentedValue = this.indentPartial(value, indentation, lineHasNonSpace);\n      }\n      var tokens = this.parse(indentedValue, tags);\n      return this.renderTokens(tokens, context, partials, indentedValue, config);\n    }\n  };\n\n  Writer.prototype.unescapedValue = function unescapedValue (token, context) {\n    var value = context.lookup(token[1]);\n    if (value != null)\n      return value;\n  };\n\n  Writer.prototype.escapedValue = function escapedValue (token, context, config) {\n    var escape = this.getConfigEscape(config) || mustache.escape;\n    var value = context.lookup(token[1]);\n    if (value != null)\n      return (typeof value === 'number' && escape === mustache.escape) ? String(value) : escape(value);\n  };\n\n  Writer.prototype.rawValue = function rawValue (token) {\n    return token[1];\n  };\n\n  Writer.prototype.getConfigTags = function getConfigTags (config) {\n    if (isArray(config)) {\n      return config;\n    }\n    else if (config && typeof config === 'object') {\n      return config.tags;\n    }\n    else {\n      return undefined;\n    }\n  };\n\n  Writer.prototype.getConfigEscape = function getConfigEscape (config) {\n    if (config && typeof config === 'object' && !isArray(config)) {\n      return config.escape;\n    }\n    else {\n      return undefined;\n    }\n  };\n\n  var mustache = {\n    name: 'mustache.js',\n    version: '4.1.0',\n    tags: [ '{{', '}}' ],\n    clearCache: undefined,\n    escape: undefined,\n    parse: undefined,\n    render: undefined,\n    Scanner: undefined,\n    Context: undefined,\n    Writer: undefined,\n    /**\n     * Allows a user to override the default caching strategy, by providing an\n     * object with set, get and clear methods. This can also be used to disable\n     * the cache by setting it to the literal `undefined`.\n     */\n    set templateCache (cache) {\n      defaultWriter.templateCache = cache;\n    },\n    /**\n     * Gets the default or overridden caching object from the default writer.\n     */\n    get templateCache () {\n      return defaultWriter.templateCache;\n    }\n  };\n\n  // All high-level mustache.* functions use this writer.\n  var defaultWriter = new Writer();\n\n  /**\n   * Clears all cached templates in the default writer.\n   */\n  mustache.clearCache = function clearCache () {\n    return defaultWriter.clearCache();\n  };\n\n  /**\n   * Parses and caches the given template in the default writer and returns the\n   * array of tokens it contains. Doing this ahead of time avoids the need to\n   * parse templates on the fly as they are rendered.\n   */\n  mustache.parse = function parse (template, tags) {\n    return defaultWriter.parse(template, tags);\n  };\n\n  /**\n   * Renders the `template` with the given `view`, `partials`, and `config`\n   * using the default writer.\n   */\n  mustache.render = function render (template, view, partials, config) {\n    if (typeof template !== 'string') {\n      throw new TypeError('Invalid template! Template should be a \"string\" ' +\n                          'but \"' + typeStr(template) + '\" was given as the first ' +\n                          'argument for mustache#render(template, view, partials)');\n    }\n\n    return defaultWriter.render(template, view, partials, config);\n  };\n\n  // Export the escaping function so that the user may override it.\n  // See https://github.com/janl/mustache.js/issues/244\n  mustache.escape = escapeHtml;\n\n  // Export these mainly for testing, but also for advanced usage.\n  mustache.Scanner = Scanner;\n  mustache.Context = Context;\n  mustache.Writer = Writer;\n\n  return mustache;\n\n})));\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","export const getQueryParams = (): Record<string, string> => {\n  const queryString = window.location.search.substring(1)\n  const params: Record<string, string> = {}\n  const queries = queryString.split('&')\n  queries.forEach((indexQuery) => {\n    const indexPair = indexQuery.split('=')\n\n    const queryKey = decodeURIComponent(indexPair[0]).toLowerCase()\n    const queryValue = decodeURIComponent(indexPair.length > 1 ? indexPair[1] : '')\n\n    params[queryKey] = queryValue\n  })\n  return params\n}\n","export const getElementAttributes = (element: HTMLElement): Record<string, string> => {\n  const attributes: Record<string, string> = {}\n  for (let i = 0, atts = element.attributes, n = atts.length; i < n; i++) {\n    const attribueName = atts[i].nodeName\n    attributes[attribueName.toLowerCase()] = (atts[i].nodeValue || '').toString()\n  }\n  return attributes\n}\n\nexport const buildElement = (type: string, klass: string, attributes: Record<string, string|boolean|number>): HTMLElement => {\n  const element = document.createElement(type)\n  element.setAttribute('class', klass)\n  setAttributesOnElement(element, attributes)\n  return element\n}\n\nexport const setAttributesOnElement = (element: HTMLElement, attributes: Record<string, string|boolean|number>) => {\n  const keys = Object.keys(attributes)\n  for (let i = 0; i < keys.length; i++) {\n    const key = keys[i]\n    if (typeof attributes[key] !== 'undefined') {\n      element.setAttribute(key, attributes[key].toString())\n    }\n  }\n}\n\nexport const buildStyle = (map: Record<string, string>): string => {\n  const keys = Object.keys(map)\n  const styles = []\n  for (let i = 0; i < keys.length; i++) {\n    const key = keys[i]\n    styles.push(`${key}:${map[key]}`)\n  }\n  return styles.join(';')\n}\n\nexport function addAttributeToHtmlElement (element: string, attributeType: string, attributeValue: any) {\n  const classElement = getHtmlElementByClassName(element)\n  if (classElement) {\n    classElement.setAttribute(attributeType, attributeValue)\n    return\n  }\n  console.log(Error('Cannot add attributes to missing HTML element!'))\n}\n\nexport function insertHtmlElement (element: string, insertPosition: any, html: any) {\n  const classElement = getHtmlElementByClassName(element)\n  if (classElement) {\n    classElement.insertAdjacentHTML(insertPosition, html)\n    return\n  }\n  console.log(Error('Cannot insert HTML element, missing class!'))\n}\n\nexport function getHtmlElementById (id: string) {\n  const element = document.getElementById(id)\n  if (element) {\n    return element\n  }\n  return null\n}\n\nexport function getHtmlElementByClassName (className: string) {\n  const element = (<HTMLInputElement>document.getElementsByClassName(className)[0])\n  if (element) {\n    return element\n  }\n  return null\n}\n\nexport function getHtmlElementByTagName (tagName: string) {\n  const element = (<HTMLInputElement>document.getElementsByTagName(tagName)[0])\n  if (element) {\n    return element\n  }\n  return null\n}\n\nexport function getHtmlElementValue (...classNames: any[]) {\n  const formattedClassNames = classNames.toString().replace(',', ' ')\n  const querySelector = (<HTMLInputElement>document.querySelector(formattedClassNames))\n  if (querySelector) {\n    return querySelector.value\n  }\n  return null\n}\n","import { getQueryParams } from '../utils/url'\nimport { getElementAttributes } from '../utils/element'\nimport { Customizations } from './types'\n\nexport const getCustomizations = (customizations: Customizations, element: HTMLElement) => {\n  const urlParams = getQueryParams()\n  const elementAttributes = getElementAttributes(element)\n  return {\n    ...customizations,\n    ...elementAttributes,\n    ...urlParams\n  }\n}\n","import { Customizations, FontFamilyStyle, WidgetCustomizations } from './types'\n\nexport const getWidgetCustomizations = (customizations: Customizations): WidgetCustomizations => {\n  return {\n    isReadOnly: getBoolean(customizations, 'mode-read-only'),\n    isPreview: getBoolean(customizations, 'mode-preview'),\n    isDummy: getBoolean(customizations, 'mode-dummy'),\n    autoPickOptionIndex: getNumber(customizations, 'auto-pick-option-index', 0),\n    productHandle: customizations['product-handle'],\n    storefrontTheme: customizations['storefront-theme'],\n    buyOnceText: customizations['buy-once-text'] || 'Buy once',\n    oneTimeAtLast: getBooleanWithDefault(customizations, 'one-time-at-last', false),\n    showGetItText: getBoolean(customizations, 'show-get-it-text'),\n    getItText: customizations['get-it-text'] || 'Get it',\n    autoInject: {\n      enabled: getBooleanWithDefault(customizations, 'should-auto-inject', false),\n      targetSelector: customizations['auto-inject-target-selector'] || \"form[action^='/cart/add']\"\n    },\n    subscriptionLabel: {\n      shouldShow: getBooleanWithDefault(customizations, 'subscription-label-should-show', true),\n      discountText: customizations['discount-label-text'] || 'subscription • save up to ',\n      subscriptionText: customizations['discount-label-subscription-text'] || 'subscription'\n    },\n    priceLabel: {\n      prefix: customizations['price-label-prefix'] || 'From',\n      footer: customizations['price-label-footer'] || 'each'\n    },\n    subscriptionPolicy: {\n      shouldShow: getBooleanWithDefault(customizations, 'subscription-policy-should-show', true),\n      description: customizations['subscription-policy-description'] || 'You\\'re subscribing to receive this item multiple times, on a recurring basis (according to the frequency you select) with a discount on every recurring order. You may cancel or change your subscription at any time.',\n      footer: customizations['subscription-policy-footer'] || 'View subscription policy',\n      informationLink: customizations['subscription-policy-information-link']\n    },\n    sellingPlanOptionsHeader: customizations['selling-plan-options-header'] || 'Delivery Frequency',\n    styles: {\n      selectedRadio: {\n        borderStyle: customizations['styles-selected-radio-border-style'] || 'solid',\n        borderColor: customizations['styles-selected-radio-border-color'] || '#dbd9d4',\n        borderSize: getPixel(customizations, 'styles-selected-radio-border-size', '1px'),\n        backgroundColor: customizations['styles-selected-radio-background-color'] || '#f4f3f0',\n        backgroundImageUrl: customizations['styles-selected-radio-background-image-url'] || 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAdgAAAHYBTnsmCAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAALdSURBVDiNfZNNSNNxGMe//9/UOefe/G+Z868z30gTnK+JaVqEqeQoO3WIooxOehBEAukUBR0U6RDYpUt0KMt3i0QJwsq5aepEndp06Zz/uc2XOTd1/w7iNLO+p+fwfL7P88DzpXBEqan52ZERqkr6hCoxMChESgiP87hdTpt9bsI6b36mH+3THe6n9guGYQTJSXlN2TnXi8VSiXzdMQZRKAEAbLopiOk02Fmr7fu35u7FxdEKg8Hg9RswDCNITbnQVaSpKlie76DKryQhPS3+j810eiNaPxgRHqXhulvre03zulKDweDlAUBOdvHLkqvVZW5HF1VXUwqlkj56GZQRNM7nxqG3p406k3n3lMVsjJ6ZHWvhqdUFWQWXbj/ctPcL62pKQQj5C94XIRRyzyags6OLUqryo7Y3lnpIpFJVJZVIFeVlSf+FnzzvwZ0HzfBseaEpiQNNh9N0eGwlCaOZRNfqONLVcQCAwRETuGNgLXcZPsIHRwFZGYlw2vSQyZnTJIgfKhUK9hAr68DjVz9R/ykQK461Q3ARxAutaKwthDAkGAAgFHAQBIukAQDnnxiukCEvgUP/pBfDfV+QoPDhB18D8UIbGmsLIRGHHnoACts7HkK8Hpdzw3WwdHXFReTy++BWlmBIdBOi42AALheHHa/bQVjrvFEkS4FObzwwubdnIpp6cSw8MDgJmSITy8tz0wFLy+ZG56qz6F3HhEKdGgcej/hN/qWV9WhYl8yszbLUQIaHP2u1X99+jFBpuKcNnfD5fP8EAeB18wgs9khOr23p1o/26XgAQIiny2FbPJecdiumvb2TEgs5RCrlfojjOIxP/ILFHosZ80nu/ZtHvTOzAzfsdvuuP0zx8fH82JiMpvSca6VhUrl8zTEMoYDCrm8XHm8AJGFqsKyFHdK2dk9ND9w3mUxbwKE07istpTAzgomqClMwiUGBwTJQFLyeTQfLmmbYRWv90Tj/BluALmoQILjqAAAAAElFTkSuQmCC',\n        dropdownBorderColor: customizations['styles-selected-radio-dropdown-border-color'] || '#ff000040'\n      },\n      radioButton: {\n        innerColor: customizations['styles-radio-button-inner-color'] || '#272850',\n        outerColor: customizations['styles-radio-button-outer-color'] || '#9DAFDB'\n      },\n      fontFamily: getFontFamily(customizations, 'styles-font-family', 'Inter@|https://fonts.googleapis.com/css?family=Inter&display=swap'),\n      fontSize: {\n        primary: getPixel(customizations, 'style-primary-font-size', '13px'),\n        sellingPlans: {\n          name: getPixel(customizations, 'style-selling-plan-name-font-size', '13px'),\n          options: getPixel(customizations, 'style-selling-plan-options-font-size', '13px')\n        }\n      },\n      colors: {\n        text: {\n          primary: customizations['styles-colors-text-primary'] || '#272850'\n        }\n      }\n    }\n  }\n}\n\nconst getBoolean = (customizations: Customizations, key: string): boolean => {\n  const value = customizations[key] && customizations[key].toString() === 'true'\n  return value === true\n}\n\nconst getBooleanWithDefault = (customizations: Customizations, key: string, defaultValue: boolean): boolean => {\n  if (typeof customizations[key] === 'undefined') {\n    return defaultValue\n  }\n  return getBoolean(customizations, key)\n}\n\nconst getNumber = (customizations: Customizations, key: string, defaultValue: number): number => {\n  const value = customizations[key] || defaultValue\n  return parseInt(value, 10)\n}\n\nconst getFontFamily = (customizations: Customizations, key: string, defaultValue: string): FontFamilyStyle => {\n  const value = customizations[key] || defaultValue\n  const values = value.replace('|', '@').split('@')\n  return {\n    name: values[0],\n    weight: values[1],\n    url: values[2]\n  }\n}\n\nconst getPixel = (customizations: Customizations, key: string, defaultValue: string): string => {\n  const value = customizations[key] || defaultValue\n  if (value && value.toString() && value.toString().indexOf('px') < 0) {\n    return `${value}px`\n  }\n\n  return value\n}\n","import { buildElement, getHtmlElementByTagName } from '../utils/element'\nimport { WidgetCustomizations } from '../customizations/types'\n\nexport const getMainElement = (customizations: WidgetCustomizations): HTMLElement => {\n  const element = buildElement('div', 'yotpo-widget-subscriptions-add-to-cart yotpo-widget-override-css yotpo-widget-clear', {})\n  const clearStyle = buildElement('style', 'yotpo-css-clear', {})\n  const fontStyle = buildElement('link', '', {\n    href: customizations.styles.fontFamily.url,\n    rel: 'stylesheet'\n  })\n  getHtmlElementByTagName('head').appendChild(fontStyle)\n  clearStyle.innerHTML = clearStyles()\n  element.appendChild(clearStyle)\n  return element\n}\n\nconst clearStyles = () => {\n  return `\n  .yotpo-widget-clear, .yotpo-widget-clear form input, .yotpo-widget-clear button, .yotpo-widget-clear span, .yotpo-widget-clear select {\n    animation : none;\n    animation-delay : 0;\n    animation-direction : normal;\n    animation-duration : 0;\n    animation-fill-mode : none;\n    animation-iteration-count : 1;\n    animation-name : none;\n    animation-play-state : running;\n    animation-timing-function : ease;\n    backface-visibility : visible;\n    background : 0;\n    background-attachment : scroll;\n    background-clip : border-box;\n    background-color : transparent;\n    background-image : none;\n    background-origin : padding-box;\n    background-position : 0 0;\n    background-position-x : 0;\n    background-position-y : 0;\n    background-repeat : repeat;\n    background-size : auto auto;\n    border : 0;\n    border-style : none;\n    border-width : medium;\n    border-color : inherit;\n    border-bottom : 0;\n    border-bottom-color : inherit;\n    border-bottom-left-radius : 0;\n    border-bottom-right-radius : 0;\n    border-bottom-style : none;\n    border-bottom-width : medium;\n    border-collapse : separate;\n    border-image : none;\n    border-left : 0;\n    border-left-color : inherit;\n    border-left-style : none;\n    border-left-width : medium;\n    border-radius : 0;\n    border-right : 0;\n    border-right-color : inherit;\n    border-right-style : none;\n    border-right-width : medium;\n    border-spacing : 0;\n    border-top : 0;\n    border-top-color : inherit;\n    border-top-left-radius : 0;\n    border-top-right-radius : 0;\n    border-top-style : none;\n    border-top-width : medium;\n    bottom : auto;\n    box-shadow : none;\n    box-sizing : content-box;\n    caption-side : top;\n    clear : none;\n    clip : auto;\n    color : inherit;\n    columns : auto;\n    column-count : auto;\n    column-fill : balance;\n    column-gap : normal;\n    column-rule : medium none currentColor;\n    column-rule-color : currentColor;\n    column-rule-style : none;\n    column-rule-width : none;\n    column-span : 1;\n    column-width : auto;\n    content : normal;\n    counter-increment : none;\n    counter-reset : none;\n    cursor : auto;\n    direction : ltr;\n    display : inline;\n    empty-cells : show;\n    float : none;\n    font : normal;\n    font-family : inherit;\n    font-size : medium;\n    font-style : normal;\n    font-variant : normal;\n    font-weight : normal;\n    height : auto;\n    hyphens : none;\n    left : auto;\n    letter-spacing : normal;\n    line-height : normal;\n    list-style : none;\n    list-style-image : none;\n    list-style-position : outside;\n    list-style-type : disc;\n    margin : 0;\n    margin-bottom : 0;\n    margin-left : 0;\n    margin-right : 0;\n    margin-top : 0;\n    max-height : none;\n    max-width : none;\n    min-height : 0;\n    min-width : 0;\n    opacity : 1;\n    orphans : 0;\n    outline : 0;\n    outline-color : invert;\n    outline-style : none;\n    outline-width : medium;\n    overflow : visible;\n    overflow-x : visible;\n    overflow-y : visible;\n    padding : 0;\n    padding-bottom : 0;\n    padding-left : 0;\n    padding-right : 0;\n    padding-top : 0;\n    page-break-after : auto;\n    page-break-before : auto;\n    page-break-inside : auto;\n    perspective : none;\n    perspective-origin : 50% 50%;\n    position : static;\n    right : auto;\n    tab-size : 8;\n    table-layout : auto;\n    text-align : inherit;\n    text-align-last : auto;\n    text-decoration : none;\n    text-decoration-color : inherit;\n    text-decoration-line : none;\n    text-decoration-style : solid;\n    text-indent : 0;\n    text-shadow : none;\n    text-transform : none;\n    top : auto;\n    transform : none;\n    transform-style : flat;\n    transition : none;\n    transition-delay : 0s;\n    transition-duration : 0s;\n    transition-property : none;\n    transition-timing-function : ease;\n    unicode-bidi : normal;\n    vertical-align : baseline;\n    visibility : visible;\n    white-space : normal;\n    widows : 0;\n    width : auto;\n    word-spacing : normal;\n    word-break: normal;\n    z-index : auto;\n  }\n  `\n}\n","import { getHtmlElementByClassName, getHtmlElementById } from '../utils/element'\n\nexport interface ShopThemeProps {\n  mainElementWrapper: string\n  mainElement: string\n}\n\nexport interface ShopThemeStyle extends ShopThemeProps {\n  additionalPriceWrapperStyle: string\n  additionalPriceStyle: string\n  additionalLabelWrapperStyle: string\n  additionalLabelStyle: string\n}\n\nexport function theme (): ShopThemeProps {\n  if (getHtmlElementByClassName('price__regular')) {\n    return {\n      mainElementWrapper: 'price__regular',\n      mainElement: 'price-item--regular'\n    }\n  }\n  if (getHtmlElementByClassName('product-single__price')) {\n    addClassToParent('product-single__price')\n    return themeElements('product-single__price')\n  }\n  if (getHtmlElementByClassName('product__current-price')) {\n    addClassToParent('product__current-price')\n    return themeElements('product__current-price')\n  }\n  if (getHtmlElementByClassName('price-item--regular')) {\n    addClassToParent('price-item--regular')\n    return themeElements('price-item--regular')\n  }\n  if (getHtmlElementByClassName('product__price--reg')) {\n    addClassToParent('product__price--reg')\n    return themeElements('product__price--reg')\n  }\n  if (getHtmlElementById('productPrice-product-template')) {\n    getHtmlElementByClassName('visually-hidden').classList.add('product__price--regular')\n    addClassToParent('product__price--regular')\n    return themeElements('product__price--regular')\n  }\n  return <ShopThemeProps>{}\n}\n\nfunction addClassToParent (parentElement: string) {\n  const singlePriceParentElement = getHtmlElementByClassName(parentElement).parentElement\n  singlePriceParentElement.classList.add('yotpo-subscription-wrapper')\n}\n\nfunction themeElements (mainElement: string): ShopThemeStyle {\n  return {\n    mainElementWrapper: 'yotpo-subscription-wrapper',\n    mainElement: mainElement,\n    additionalPriceWrapperStyle: 'margin-bottom: 6px;',\n    additionalPriceStyle: 'display: contents; font-size: 1.55882em;',\n    additionalLabelWrapperStyle: 'margin-top: 10px;',\n    additionalLabelStyle: ''\n  }\n}\n","import {\n  DiscountType,\n  getPriceAdjustmentValue,\n  getPriceAdjustmentValueType,\n  PriceAdjustment,\n  sortPriceAdjustments\n} from '../../../models/price-adjustments'\nimport {\n  buildPriceWithDiscount,\n  calculateDiscount,\n  getRegularPrice,\n  getRegularPriceSymbol,\n  getRegularPriceValue\n} from '../discount'\nimport { SellingPlan } from '../../../models/selling-plan'\nimport { WidgetCustomizations } from '../../../customizations/types'\nimport { buildElement } from '../../../utils/element'\n\nexport const buildSellingPlanPriceLabel = (groupId: string, sellingPlans: SellingPlan[], customizations: WidgetCustomizations, isSubscription: boolean, productPrice: number): HTMLElement => {\n  const wrapperElement = buildElement('div', 'yotpo-subscription-price-label-wrapper', {})\n  const containerElement = buildElement('div', 'yotpo-subscription-price-label-container', {})\n\n  const pricePrefixElement = buildElement('div', 'yotpo-subscription-label-prefix', {})\n  pricePrefixElement.innerHTML = isSubscription === true ? customizations.priceLabel.prefix : ''\n  wrapperElement.appendChild(pricePrefixElement)\n\n  const priceElement = buildElement('div', 'yotpo-subscription-label-price', {})\n  priceElement.innerHTML = buildPriceElementContent(customizations, priceElement, isSubscription, groupId, sellingPlans, productPrice)\n  containerElement.appendChild(priceElement)\n\n  const labelElement = buildElement('div', 'yotpo-subscription-label-text', {})\n  labelElement.innerHTML = customizations.priceLabel.footer\n  containerElement.appendChild(labelElement)\n\n  wrapperElement.appendChild(containerElement)\n\n  return wrapperElement\n}\n\nfunction formatProductPrice (productPrice: string) {\n  return productPrice.substring(0, productPrice.length - 2)\n    .concat('.')\n    .concat(productPrice.substring(productPrice.length - 2))\n}\n\nconst buildPriceElementContent = (customizations: WidgetCustomizations, priceElement: HTMLElement, isSubscription: boolean, groupId: string, sellingPlans: SellingPlan[], productPrice: number) => {\n  if (customizations.isDummy) {\n    const regularPrice = '$16.99'\n    return isSubscription === false\n      ? regularPrice\n      : buildPriceValue(groupId, sellingPlans, regularPrice, '$', 16.99)\n  } else {\n    const formattedProductPrice = formatProductPrice(productPrice.toString())\n    const regularPrice = getRegularPrice('$'.concat(formattedProductPrice))\n    const regularPriceSymbol: string = getRegularPriceSymbol('$')\n    const regularPriceValue: number = getRegularPriceValue(productPrice.toString().slice(0, 2))\n\n    return isSubscription === true\n      ? buildPriceValue(groupId, sellingPlans, regularPrice, regularPriceSymbol, regularPriceValue)\n      : regularPrice\n  }\n}\n\nconst buildPriceValue = (groupId: string, sellingPlans: SellingPlan[], regularPrice: string, regularPriceSymbol: string, regularPriceValue: number) => {\n  const defaultPriceAdjustment: PriceAdjustment = { valueType: <DiscountType>'', value: 0 }\n\n  const lowestPriceAdjustment = sortPriceAdjustments([{ id: groupId, name: '', options: [], sellingPlans }], groupId, regularPriceValue)\n    .filter(priceAdjustment => {\n      defaultPriceAdjustment.valueType = priceAdjustment.valueType\n      const calculatedDiscount = calculateStartingPriceValue(priceAdjustment, regularPriceSymbol, regularPriceValue)\n      const calculatedDiscountNumber = parseFloat(calculatedDiscount)\n      return calculatedDiscountNumber > 0\n    })\n\n  if (lowestPriceAdjustment.length === 0) {\n    lowestPriceAdjustment.push(defaultPriceAdjustment)\n  }\n\n  const calculatedDiscount = calculateStartingPriceValue(lowestPriceAdjustment[0], regularPriceSymbol, regularPriceValue)\n\n  return buildPriceWithDiscount(regularPrice, regularPriceSymbol, calculatedDiscount)\n}\n\nconst calculateStartingPriceValue = (priceAdjustment: PriceAdjustment, regularPriceSymbol: string, regularPriceValue: number) => {\n  const discountPriceType: string = getPriceAdjustmentValueType(priceAdjustment, regularPriceSymbol)\n  const discountPriceValue: number = getPriceAdjustmentValue(priceAdjustment)\n\n  return calculateDiscount(\n    regularPriceValue,\n    discountPriceType,\n    discountPriceValue)\n}\n","import { WidgetCustomizations } from '../../customizations/types'\nimport { SellingPlan } from '../../models/selling-plan'\nimport { SellingPlanGroup } from '../../models/selling-plan-group'\nimport { buildElement, buildStyle, getHtmlElementByClassName } from '../../utils/element'\nimport { getRadioButton } from './widgets/radio-button'\nimport { getFrequency } from './widgets/frequency'\nimport { buildSellingPlanPriceLabel } from './widgets/price-label'\n\nconst buyOnceIndex: number = 0\nconst firstPlanGroupIndex: number = 1\n\nexport const getSellingPlansElement = (sellingPlanGroups: SellingPlanGroup[], customizations: WidgetCustomizations, shouldShowBuyOnce: boolean, productPrice: number): HTMLElement => {\n  const wrapper = buildElement('div', customizations.isReadOnly ? 'yotpo-selling-plans-wrapper yotpo-admin-preview' : 'yotpo-selling-plans-wrapper', {})\n  const element = buildElement('div', 'yotpo-selling-plans', {})\n  const defaultSelectedGroupIndex = getSelectedGroupIndex(shouldShowBuyOnce, customizations.autoPickOptionIndex)\n\n  let buyOnceElement = null\n  if (shouldShowBuyOnce) {\n    const buyOnceSellingPlan = {\n      id: buyOnceId,\n      name: customizations.buyOnceText,\n      options: [] as any[],\n      sellingPlans: [] as SellingPlan[]\n    }\n    const isSelected = customizations.autoPickOptionIndex === buyOnceIndex\n    buyOnceElement = getSellingPlan(buyOnceSellingPlan, customizations, isSelected, false, productPrice)\n    if (!customizations.oneTimeAtLast) {\n      element.appendChild(buyOnceElement)\n    }\n  }\n\n  const groups = sellingPlanGroups.map((group, index) => {\n    const isSelected = defaultSelectedGroupIndex === (firstPlanGroupIndex + index)\n    return getSellingPlan(group, customizations, isSelected, true, productPrice)\n  })\n  for (let i = 0; i < groups.length; i++) {\n    const containerElement = buildElement('div', 'selling-plan-group-line-container', {})\n    const sellingPlanGroupLineSeparator = buildLineSeparator()\n\n    if (groups.length > 1 && (!customizations.oneTimeAtLast || i > 0)) {\n      containerElement.appendChild(sellingPlanGroupLineSeparator)\n    }\n    containerElement.appendChild(groups[i])\n\n    element.appendChild(containerElement)\n  }\n  if (customizations.oneTimeAtLast && buyOnceElement) {\n    if (groups.length > 1) {\n      element.appendChild(buildLineSeparator())\n    }\n    element.appendChild(buyOnceElement)\n  }\n  wrapper.appendChild(element)\n  const radioStyle = buildElement('style', 'yotpo-radio-style', {})\n  radioStyle.innerHTML = getStyles(customizations)\n  wrapper.appendChild(radioStyle)\n  if (defaultSelectedGroupIndex >= firstPlanGroupIndex) {\n    setTimeout(\n      displaySelectedFrequency(sellingPlanGroups[defaultSelectedGroupIndex - 1].id),\n      0\n    )\n  }\n  return wrapper\n}\n\nexport const buyOnceId = 'buy-once'\n\nconst switchSalePriceView = (isSubscription: boolean, isDiscountAvailable: boolean) => {\n  const salePrice = getHtmlElementByClassName('price-item--sale')\n\n  if (!salePrice) {\n    return\n  }\n\n  if (!isSubscription || !isDiscountAvailable) {\n    salePrice.style.removeProperty('display')\n    return\n  }\n\n  salePrice.style.display = 'none'\n}\n\nconst getSelectedGroupIndex = (shouldShowBuyOnce: boolean, autoPickOptionIndex: number): number => {\n  return !shouldShowBuyOnce &&\n  autoPickOptionIndex === buyOnceIndex\n    ? firstPlanGroupIndex\n    : autoPickOptionIndex\n}\n\nconst getSellingPlan = (sellingPlanGroup: SellingPlanGroup, customizations: WidgetCustomizations, checked: boolean, isSubscription: boolean, productPrice: number): HTMLElement => {\n  return getRadioButtonElement('selling_plan', sellingPlanGroup.name, sellingPlanGroup.id, sellingPlanGroup.sellingPlans, checked, customizations, isSubscription, productPrice)\n}\n\nconst bindSelectionToInput = (groupId: string) => (event: Event) => {\n  const targetElement = <HTMLInputElement>event.target\n  const sellingPlanId = targetElement.value\n  const sellingPlanName = targetElement.getAttribute('data-label')\n  const inputEl = document.querySelector(`.yotpo-radio-container[data-seling-plan-group-id=\"${groupId}\"] .yotpo-radio-label-input`)\n  inputEl.setAttribute('value', sellingPlanId)\n  inputEl.setAttribute('data-selling-plan-name', sellingPlanName)\n}\n\nconst getRadioButtonElement = (group: string, text: string, groupId: string, sellingPlans: SellingPlan[], checked: boolean, customizations: WidgetCustomizations, isSubscription: boolean, productPrice: number) => {\n  const defaultSelectedPlan = sellingPlans.length > 0 ? sellingPlans[0] : undefined\n  const defaultSelectedPlanId = defaultSelectedPlan ? defaultSelectedPlan.id.toString() : ''\n  const defaultSelectedPlanName = defaultSelectedPlan ? defaultSelectedPlan.name.toString() : ''\n\n  const { frequency, frequencyContainer } = initFrequency(sellingPlans, groupId, customizations)\n  frequencyContainer.appendChild(frequency)\n\n  const radioButton = initRadioButton(group, defaultSelectedPlanId, defaultSelectedPlanName, text, checked, groupId)\n\n  const container = buildElement('div', `yotpo-radio-container ${checked ? 'yotpo-selected' : ''}`, {\n    'data-seling-plan-group-id': groupId\n  })\n\n  const radioElementsWrapper = buildElement('div', 'yotpo-radio-button-text-wrapper', {\n    'data-seling-plan-group-id': groupId\n  })\n\n  const priceLabel = buildSellingPlanPriceLabel(groupId, sellingPlans, customizations, isSubscription, productPrice)\n\n  radioElementsWrapper.appendChild(radioButton)\n  radioElementsWrapper.appendChild(priceLabel)\n  container.appendChild(radioElementsWrapper)\n\n  if (sellingPlans.length > 0) {\n    container.appendChild(frequencyContainer)\n  }\n\n  const isDiscountAvailable = sellingPlans\n    .map(plan => plan.priceAdjustments)\n    .filter(priceAdjustment => priceAdjustment.length > 0)\n    .length > 0\n\n  const klass = isSubscription ? 'yotpo-radio-subscription-container' : 'yotpo-radio-buy-once-container'\n  container.classList.add(klass)\n  container.addEventListener('change', () => {\n    switchSalePriceView(isSubscription, isDiscountAvailable)\n  })\n\n  return container\n}\n\nconst displaySelectedFrequency = (value: string) => () => {\n  const allFrequencies = document.querySelectorAll('[data-selling-plan-group-frequency-id]')\n  for (let i = 0; i < allFrequencies.length; i++) {\n    const isClickedOn = allFrequencies[i].getAttribute('data-selling-plan-group-frequency-id') === value\n    const style = allFrequencies[i].getAttribute('style')\n    const parts = style.split(';')\n    const display = isClickedOn ? 'block' : 'none'\n    const newStyle = parts.map(x => x.indexOf('display:') > -1 ? `display:${display}` : x).join(';')\n    allFrequencies[i].setAttribute('style', newStyle)\n\n    const inputEl = document.querySelector(`[data-seling-plan-group-id=\"${value}\"] .yotpo-radio-label-input`)\n    pickElement(inputEl as HTMLElement, isClickedOn)\n  }\n  const allContainers = document.querySelectorAll('.yotpo-radio-container[data-seling-plan-group-id]')\n  for (let i = 0; i < allContainers.length; i++) {\n    const isClickedOn = allContainers[i].getAttribute('data-seling-plan-group-id') === value\n    pickElement(allContainers[i] as HTMLElement, isClickedOn)\n  }\n}\n\nconst pickElement = (element: HTMLElement, isClickedOn: boolean): void => {\n  const currnectClass2 = element.getAttribute('class').replace('yotpo-not-selected', '').replace('yotpo-selected', '')\n  const klass = isClickedOn ? 'yotpo-selected' : 'yotpo-not-selected'\n  element.setAttribute('class', `${currnectClass2} ${klass}`)\n}\n\nconst initFrequency = (sellingPlans: SellingPlan[], groupId: string, customizations: WidgetCustomizations) => {\n  const values = sellingPlans.map((x, index) => {\n    return { label: x.name, value: x.id.toString(), checked: index === 0 }\n  })\n  const frequency = getFrequency({\n    values,\n    attributes: {\n      style: buildStyle({ display: 'table-cell' })\n    },\n    classString: 'yotpo-select-wrapper',\n    groupId,\n    onChange: bindSelectionToInput(groupId)\n  },\n  customizations\n  )\n  const frequencyContainer = buildElement('div', 'yotpo-selling-plan-select-container', {\n    style: buildStyle({ display: 'none' }),\n    'data-selling-plan-group-frequency-id': groupId\n  })\n  if (customizations.showGetItText) {\n    const labelForFrequency = buildElement('label', 'yotpo-label-for-frequency', {})\n    labelForFrequency.innerText = customizations.getItText\n    frequencyContainer.appendChild(labelForFrequency)\n  }\n  return { frequency, frequencyContainer }\n}\n\nconst initRadioButton = (group: string, defaultSelectedPlanId: string, defaultSelectedPlanName: string, text: string, checked: boolean, groupId: string) => {\n  return getRadioButton({\n    group,\n    value: defaultSelectedPlanId,\n    text,\n    checked,\n    classString: 'yotpo-radio-buttons',\n    inputAttributes: {\n      'data-selling-plan-name': defaultSelectedPlanName\n    },\n    onSelection: displaySelectedFrequency(groupId)\n  })\n}\n\nfunction getRadioButtonSize (customizations: WidgetCustomizations) {\n  return customizations.storefrontTheme === 'dawn' ||\n    customizations.isReadOnly ||\n    customizations.isDummy ||\n    customizations.isPreview\n}\n\nconst buildLineSeparator = () => {\n  return buildElement('div', 'yotpo-selling-plan-group-line-separator', {})\n}\n\nconst getStyles = (customizations: WidgetCustomizations): string => {\n  return `\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-selling-plan-radio-label:after, .yotpo-frequency-radio-label:after {\n    width: ${getRadioButtonSize(customizations) ? 7 : 11}px;\n    height: ${getRadioButtonSize(customizations) ? 7 : 11}px;\n    border-radius: 15px;\n    background-color: white;\n    content: '';\n    display: block;\n    visibility: visible;\n    border: 2px solid white;\n    box-shadow: 0px 0px 0px 1px ${customizations.styles.radioButton.outerColor};\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-selling-plan-radio-label:checked:after, .yotpo-frequency-radio-label:checked:after {\n    width: ${getRadioButtonSize(customizations) ? 7 : 11}px;\n    height: ${getRadioButtonSize(customizations) ? 7 : 11}px;\n    border-radius: 15px;\n    background-color: ${customizations.styles.radioButton.innerColor};\n    content: '';\n    display: block;\n    visibility: visible;\n    border: 2px solid white;\n    box-shadow: 0px 0px 0px 1px ${customizations.styles.radioButton.outerColor};\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-selling-plans {\n    width: 100%;\n    max-width: 400px;\n    box-shadow: 0px 2px 7px rgba(0, 0, 0, 0.09);\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-selling-plan-group-line-separator {\n    margin: auto;\n    width: 90%;\n    max-width: 360px;\n    border-bottom: solid thin #EAEAEA;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-selling-plans-wrapper {\n    display: block;\n    margin: 20px 0;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-selling-plans-wrapper.yotpo-admin-preview {\n    text-align: center;\n    min-height: auto;\n    display: block;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-admin-preview .yotpo-selling-plans {\n    text-align: left;\n    display: inline-block;\n    min-width: 150px;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-selling-plan-select-container {\n    padding-left: ${customizations.showGetItText ? '26px' : '18px'};\n    margin-top: -15px;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-label-for-frequency {\n    display: inline-block;\n    margin-right: 5px;\n  }\n  .yotpo-widget-subscriptions-add-to-cart {\n    -webkit-appearance: none;\n    -moz-appearance: none;\n    background-repeat: no-repeat;\n    background-position-x: 96%;\n    background-position-y: 50%;\n    background-size: 10%;\n    border-radius: 3px;\n    margin-right: 2rem;\n    padding: 10px;\n    padding-right: 20px;\n    display: contents;\n    border: 1px solid transparent;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-radio-container:first-child {\n    padding: 31px 10px 10px 28px;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-radio-container {\n    padding: 10px 10px 10px 28px;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-widget-subscriptions-add-to-cart .yotpo-radio-container {\n    border: 1px solid transparent;\n    border-radius: 3px;\n    min-width: 230px;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-radio-container.yotpo-selected {\n    border-style: ${customizations.styles.selectedRadio.borderStyle};\n    border-width: ${customizations.styles.selectedRadio.borderSize};\n    border-color: ${customizations.styles.selectedRadio.borderColor};\n    background-color: ${customizations.styles.selectedRadio.backgroundColor};\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-radio-label .yotpo-radio-label-text {\n    padding-left: 3px;\n    font-size: ${customizations.styles.fontSize.sellingPlans.name};\n    font-family: ${customizations.styles.fontFamily.name};\n    font-style: normal;\n    font-weight: ${customizations.styles.fontFamily.weight || 'Bold'};\n    position: relative;\n    color: ${customizations.styles.colors.text.primary};\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-radio-label-input:checked ~ .yotpo-radio-label-text:after {\n    background-size: cover;\n    background-position: center;\n    background-image: url('${customizations.styles.selectedRadio.backgroundImageUrl}');\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-radio-label-input {\n    appearance: none;\n    -webkit-appearance: none;\n    border: none;\n    background: none;\n    margin: 0;\n    width: 11px;\n    height: 11px;\n    padding: 0;\n    border-radius: 0;\n    display: inline-block;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-radio-label-text:after {\n    display: block;\n    position: absolute;\n    top: 1px;\n    left: -17px;\n    width: 16px;\n    height: 16px;\n    border-radius: 50%;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-radio-label-text:before {\n    display: block;\n    position: absolute;\n    top: ${customizations.isReadOnly ? '1px' : '2px'};\n    left: -17px;\n    width: ${customizations.isReadOnly ? '12px' : '14px'};\n    height: ${customizations.isReadOnly ? '12px' : '14px'};\n    border-radius: 50%;\n    border: 2px solid #416142;\n    background-color: #ffffff;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-frequency-options {\n    display: grid;\n    padding-left: 13px;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-frequency-header-text, span.yotpo-frequency-label {\n    padding: 10px 0 3px 3px;\n    font-style: normal;\n    font-family: ${customizations.styles.fontFamily.name};\n    font-weight: ${customizations.styles.fontFamily.weight || 500};\n    font-size: ${customizations.styles.fontSize.sellingPlans.options};\n    line-height: 20px;\n    color: ${customizations.styles.colors.text.primary};\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-frequency-option {\n    padding: 2px 0 2px 0;\n    justify-self: baseline;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-radio-button-text-wrapper {\n    display: flex;\n    align-items: baseline;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-subscription-price-label-wrapper {\n    margin-left: auto;\n    margin-right: 15px;\n    position: relative;\n    font-weight: ${customizations.styles.fontFamily.weight || 500};\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-subscription-price-label-container {\n    border: solid transparent;\n    display: inline-grid;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-subscription-label-prefix {\n    font-style: normal;\n    font-family: ${customizations.styles.fontFamily.name};\n    font-size: ${customizations.styles.fontSize.primary};\n    color: ${customizations.styles.colors.text.primary};\n    display: contents;\n    position: static;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-subscription-label-price {\n    font-style: normal;\n    font-family: ${customizations.styles.fontFamily.name};\n    font-size: ${customizations.styles.fontSize.primary};\n    color: #272850;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-subscription-label-text {\n    font-style: normal;\n    font-family: ${customizations.styles.fontFamily.name};\n    font-size: ${customizations.styles.fontSize.primary};\n    line-height: 20px;\n    color: darkgrey;\n    text-align: right;\n  }\n  `\n}\n","import * as Mustache from 'mustache'\nimport { buildElement } from '../../../utils/element'\nimport { WidgetCustomizations } from '../../../customizations/types'\n\nexport interface FrequencyOption {\n  label: string\n  value: string\n  checked: boolean\n}\n\nexport interface FrequencyOptions {\n  values: FrequencyOption[]\n  classString?: string\n  attributes?: Record<string, string>\n  groupId: string\n  onChange?: Function\n}\n\nconst defaultRadioButtonStyle = `\n  margin: auto;\n  cursor: pointer;\n  min-height: auto;\n`\n\nexport const getFrequency = (options: FrequencyOptions, customizations: WidgetCustomizations) => {\n  const template = (`\n            <div class=\"yotpo-frequency-header-text\">\n                ${customizations.sellingPlanOptionsHeader}\n            </div>\n            <div style=\"padding-top: 2px\" class=\"yotpo-frequency-options\">\n                {{#values}}\n                <label class=\"yotpo-frequency-option\">\n                    <input name=\"frequency-{{groupId}}\" style=\"${defaultRadioButtonStyle}\" class=\"yotpo-radio-label-input yotpo-frequency-radio-label\" type=\"radio\" value=\"{{value}}\" data-label=\"{{label}}\" {{#checked}} checked {{/checked}}>\n                    <span style=\"cursor: pointer\" class=\"yotpo-frequency-label\" value=\"{{value}}\">{{label}}</span>\n                </label>\n                {{/values}}\n            </div>\n`)\n  const html = Mustache.render(template, options)\n\n  const element = buildElement('div', options.classString, options.attributes || {})\n  element.innerHTML = html\n\n  if (options.onChange) {\n    const selectEl = element.querySelector('.yotpo-frequency-options')\n    selectEl.addEventListener('change', (event) => {\n      options.onChange(event)\n    })\n  }\n\n  return element\n}\n","import * as Mustache from 'mustache'\nimport { buildElement, setAttributesOnElement } from '../../../utils/element'\n\nexport interface RadionButtonOptions {\n  group: string\n  value: string\n  text: string\n  classString?: string\n  attributes?: Record<string, string>\n  inputAttributes?: Record<string, string>\n  checked?: boolean\n  onSelection: any\n}\n\nconst defaultRadioButtonStyle = `\n  margin: auto;\n  cursor:pointer;\n  min-height: auto;\n`\n\nexport const getRadioButton = (options: RadionButtonOptions) => {\n  const template = `<label class=\"yotpo-radio-label\">\n              <input style=\"${defaultRadioButtonStyle}\" class=\"yotpo-radio-label-input yotpo-selling-plan-radio-label {{checkedClassFn}}\" type=\"radio\" name=\"{{group}}\" value=\"{{value}}\" {{{checkedFn}}}>\n              <span style=\"cursor:pointer\" class=\"yotpo-radio-label-text\">{{text}}</span>\n            </label>`\n  const html = Mustache.render(template, {\n    ...options,\n    checkedFn: () => {\n      return options.checked ? 'checked=true' : ''\n    },\n    checkedClassFn: () => {\n      return options.checked ? 'yotpo-checked' : ''\n    }\n  })\n  const element = buildElement('div', options.classString, options.attributes || {})\n  element.innerHTML = html\n  if (options.inputAttributes) {\n    const input = element.querySelector('.yotpo-radio-label-input') as HTMLElement\n    setAttributesOnElement(input, options.inputAttributes)\n  }\n\n  const label = element.querySelector('.yotpo-radio-label') as HTMLElement\n  label.addEventListener('click', options.onSelection)\n  return element\n}\n","import { SellingPlanGroup } from '../../models/selling-plan-group'\nimport { SellingPlan } from '../../models/selling-plan'\nimport {\n  getPriceAdjustmentValue,\n  getPriceAdjustmentValueType,\n  PriceAdjustment,\n  sortPriceAdjustments\n} from '../../models/price-adjustments'\nimport { theme } from '../../models/shop-theme'\nimport {\n  getHtmlElementValue,\n  getHtmlElementByClassName,\n  insertHtmlElement\n} from '../../utils/element'\nimport { WidgetCustomizations } from '../../customizations/types'\nimport { buyOnceId } from './selling-plans'\n\nconst discountPriceHtml = `<div style=\"display: none\" class=\"yotpo-discount--wrapper\">\n                                <span class=\"yotpo-item--discount\"></span>\n                           </div>`\n\nconst discountLabelHtml = `<div style=\"display: none; padding-bottom: 5px\" class=\"yotpo-discount--label--container\">\n                                <div class=\"yotpo-discount--label--wrapper\">\n                                     <div class=\"yotpo-item--discount--label\" aria-hidden=\"true\"></div>\n                                </div>\n                           </div>`\n\nconst defaultPrice = '$0.00'\n\nexport const generateDiscountView = (customizations: WidgetCustomizations) => {\n  const mainElementWrapper = theme().mainElementWrapper\n\n  if (mainElementWrapper) {\n    insertHtmlElement(mainElementWrapper, 'beforebegin', discountPriceHtml)\n    insertHtmlElement(mainElementWrapper, 'beforebegin', getStyles(customizations))\n    insertHtmlElement(mainElementWrapper, 'afterend', discountLabelHtml)\n  }\n}\n\nexport const buildPriceWithDiscount = (regularPrice: string, currencySymbol: string, calculatedDiscount: string) => {\n  const isNumber = Number.isInteger(Number.parseInt(regularPrice[0]))\n\n  let calculatedDiscountPrice = currencySymbol + calculatedDiscount\n\n  if (isNumber) {\n    calculatedDiscountPrice = calculatedDiscount + currencySymbol\n  }\n\n  return calculatedDiscountPrice.replace(\n    /\\B(?=(\\d{3})+(?!\\d))/g, getDecimalSeparator())\n}\n\nexport const clearDiscount = () => {\n  const mainElement = theme().mainElement\n\n  if (mainElement) {\n    getHtmlElementByClassName(mainElement).style.removeProperty('text-decoration')\n    getHtmlElementByClassName('yotpo-discount--wrapper').style.display = 'none'\n    getHtmlElementByClassName('yotpo-discount--label--container').style.display = 'none'\n  }\n}\n\nexport const calculateDiscount = (regularPriceValue: number, discountType: string, discountValue: number) => {\n  if (discountType === '%') {\n    return (((100 - discountValue) * regularPriceValue) / 100).toFixed(2)\n  }\n\n  const calculatedDiscount = (regularPriceValue - discountValue).toFixed(2)\n\n  return calculatedDiscount\n    .substring(0, calculatedDiscount.length - 3)\n    .concat(getRegularPrice(defaultPrice).slice(-3))\n}\n\nexport const getDecimalType = () => {\n  const mainElement = theme().mainElement\n\n  if (mainElement) {\n    return getHtmlElementByClassName(mainElement).innerHTML\n      .trim()\n      .slice(-3)\n      .charAt(0)\n  }\n}\n\nexport const getDecimalSeparator = () => {\n  return getDecimalType() === '.' ? ',' : '.'\n}\n\nexport const getRegularPrice = (responsePrice: string) => {\n  const mainElement = theme().mainElement\n\n  if (mainElement) {\n    return getHtmlElementByClassName(mainElement).innerHTML\n      .trim()\n  }\n\n  return responsePrice\n}\n\nexport const getRegularPriceSymbol = (responsePrice: string) => {\n  return getRegularPrice(responsePrice).replace(/[\\d,.\\s]/g, '')\n}\n\nexport const getRegularPriceValue = (responsePrice: string) => {\n  const value = getRegularPrice(responsePrice).replace(/[^0-9.|,-]+/g, '')\n    .split(getDecimalSeparator())\n    .join('')\n  return parseFloat(value)\n}\n\nexport const getDiscountPriceType = (sellingPlan: SellingPlan, currencySymbol: string): string => {\n  return getPriceAdjustmentValueType(sellingPlan.priceAdjustments[0], currencySymbol)\n}\n\nexport const getDiscountPriceValue = (sellingPlan: SellingPlan): number => {\n  return getPriceAdjustmentValue(sellingPlan.priceAdjustments[0])\n}\n\nexport const getSelectedSellingPlan = (sellingPlanGroups: SellingPlanGroup[], selectedGroupId: string): SellingPlan => {\n  const selectedPlanId = getHtmlElementValue('.yotpo-selected', '.yotpo-radio-label-input')\n  return getSelectedSellingPlans(sellingPlanGroups, selectedGroupId).find(plan => plan.id.toString() === selectedPlanId)\n}\n\nexport const getSelectedSellingPlans = (sellingPlanGroups: SellingPlanGroup[], selectedGroupId: string): SellingPlan[] => {\n  return sellingPlanGroups.find(group => group.id === selectedGroupId).sellingPlans\n}\n\nexport const addRenderDiscountToOnChangeEvent = (sellingPlanGroups: SellingPlanGroup[], customizations: WidgetCustomizations) => {\n  getHtmlElementByClassName('yotpo-selling-plans-wrapper')\n    .addEventListener('change', () => renderDiscount(sellingPlanGroups, customizations))\n\n  const mainElement = theme().mainElement\n  if (mainElement) {\n    getHtmlElementByClassName(mainElement)\n      .addEventListener('DOMSubtreeModified', () => renderDiscount(sellingPlanGroups, customizations))\n  }\n}\n\nexport const renderDiscount = (sellingPlanGroups: SellingPlanGroup[], customizations: WidgetCustomizations) => {\n  const selectedGroupId = getHtmlElementByClassName('yotpo-selected')\n    .getAttribute('data-seling-plan-group-id')\n\n  clearDiscount()\n\n  if (selectedGroupId === buyOnceId) {\n    return\n  }\n\n  const sellingPlan = getSelectedSellingPlan(sellingPlanGroups, selectedGroupId)\n  if (customizations.subscriptionLabel.shouldShow) {\n    const price = getRegularPriceValue(defaultPrice)\n    renderDiscountLabel(sellingPlanGroups, selectedGroupId, customizations, price)\n  }\n\n  if (sellingPlan.priceAdjustments.length === 0) {\n    return\n  }\n\n  renderDiscountPrice(sellingPlan)\n}\n\nconst renderDiscountPrice = (sellingPlan: SellingPlan) => {\n  const regularPrice: string = getRegularPrice(defaultPrice)\n  const regularPriceSymbol: string = getRegularPriceSymbol(defaultPrice)\n  const regularPriceValue: number = getRegularPriceValue(defaultPrice)\n\n  const discountPriceType: string = getDiscountPriceType(sellingPlan, regularPriceSymbol)\n  const discountPriceValue: number = getDiscountPriceValue(sellingPlan)\n\n  const calculatedDiscount: string = calculateDiscount(\n    regularPriceValue,\n    discountPriceType,\n    discountPriceValue)\n  const priceWithDiscount: string = buildPriceWithDiscount(regularPrice, regularPriceSymbol, calculatedDiscount)\n\n  const mainElement = theme().mainElement\n\n  if (Number.parseFloat(calculatedDiscount) > 0) {\n    if (mainElement) {\n      getHtmlElementByClassName(mainElement).style.textDecoration = 'line-through'\n    }\n    getHtmlElementByClassName('yotpo-item--discount').innerHTML = priceWithDiscount\n    getHtmlElementByClassName('yotpo-discount--wrapper').style.removeProperty('display')\n  }\n}\n\nconst renderDiscountLabel = (\n  sellingPlanGroups: SellingPlanGroup[],\n  selectedGroupId: string,\n  customizations: WidgetCustomizations,\n  price: number) => {\n  const priceAdjustments: PriceAdjustment[] = sortPriceAdjustments(sellingPlanGroups, selectedGroupId, price)\n  if (priceAdjustments.length === 0) {\n    return\n  }\n\n  const priceAdjustment = priceAdjustments[0]\n\n  const regularPriceSymbol: string = getRegularPriceSymbol(defaultPrice)\n  const discountPriceSymbol: string = getPriceAdjustmentValueType(priceAdjustment, regularPriceSymbol)\n  const discountPriceValue: number = getPriceAdjustmentValue(priceAdjustment)\n\n  const showDiscountText = priceAdjustment.value\n  const pillText = showDiscountText\n    ? `${customizations.subscriptionLabel.discountText}${discountPriceValue}${discountPriceSymbol}`\n    : customizations.subscriptionLabel.subscriptionText\n\n  const discountLabelContainer = getHtmlElementByClassName('yotpo-discount--label--container')\n  const discountLabel = getHtmlElementByClassName('yotpo-item--discount--label')\n\n  if (discountLabelContainer && discountLabel) {\n    discountLabel.innerHTML = pillText\n    discountLabelContainer.style.removeProperty('display')\n  }\n}\n\nconst getStyles = (customizations: WidgetCustomizations): string => {\n  return `\n  <style>\n  .yotpo-discount--label--container .yotpo-item--discount--label {\n    font-style: normal;\n    font-family: ${customizations.styles.fontFamily.name};\n  }\n  .yotpo-item--discount {\n    margin-right: .625rem;\n    color: red;\n    font-weight: 700;\n    font-style: normal;\n  }\n  .yotpo-discount--label--wrapper {\n    display: inline-flex;\n    border: 1px solid red;\n    border-radius: 5px;\n    padding: 2px 7px 2px 7px;\n    margin-right: 10px;\n  }\n  .yotpo-item--discount--label {\n    font-size: 12px;\n    font-weight: bold;\n  }\n  </style>\n  `\n}\n","import { SellingPlanGroup } from './selling-plan-group'\nimport { getSelectedSellingPlans } from '../render/components/discount'\n\nexport type DiscountType = 'percentage' | 'fixed_amount'\nexport interface PriceAdjustment {\n  valueType: DiscountType\n  value: number\n}\n\nexport function getPriceAdjustmentValueType (priceAdjustment: PriceAdjustment, currencySymbol: string): string {\n  return priceAdjustment.valueType === 'fixed_amount' ? currencySymbol : '%'\n}\n\nexport function getPriceAdjustmentValue (priceAdjustment: PriceAdjustment): number {\n  return priceAdjustment.valueType === 'percentage' ? priceAdjustment.value : priceAdjustment.value * 0.01\n}\n\nexport function sortPriceAdjustments (sellingPlanGroups: SellingPlanGroup[], selectedGroupId: string, price: number): PriceAdjustment[] {\n  const priceAdjustments: PriceAdjustment[] = getSelectedSellingPlans(sellingPlanGroups, selectedGroupId)\n    .filter(plan => plan.priceAdjustments && plan.priceAdjustments.length > 0)\n    .map(plan => {\n      return plan.priceAdjustments[0]\n    })\n    .sort((plan1, plan2) => {\n      return getValue(plan2.value, plan2.valueType, price) - getValue(plan1.value, plan1.valueType, price)\n    })\n\n  if (priceAdjustments.length > 0) {\n    return priceAdjustments\n  }\n\n  return [{ valueType: 'fixed_amount', value: 0 }]\n}\n\nconst getValue = (value: number, type: DiscountType, price: number): number => {\n  if (type === 'fixed_amount') {\n    return value\n  }\n  return value * 0.01 * price * 100\n}\n","import { SellingPlan } from './selling-plan'\nimport { SellingPlanGroup } from './selling-plan-group'\nimport { DiscountType, PriceAdjustment } from './price-adjustments'\nimport { Product } from './product'\nimport { Variant } from './variant'\n\nconst getPriceAdjustment = (valueType: DiscountType, value: number): PriceAdjustment => {\n  return {\n    valueType: valueType,\n    value: value\n  }\n}\n\nconst getSellingPlan = (id: number, name: string, groupName: string, dummyPriceAdjustment: PriceAdjustment[]): SellingPlan => {\n  return {\n    id,\n    name,\n    description: '',\n    options: [\n      {\n        name: groupName,\n        position: 1,\n        value: name\n      }\n    ],\n    priceAdjustments: dummyPriceAdjustment\n  }\n}\n\nconst getSellingPlanGroup = (id: string, name: string, sellingPlans: SellingPlan[], position: number): SellingPlanGroup => {\n  return {\n    id,\n    name,\n    options: [\n      {\n        name,\n        position: position,\n        values: sellingPlans.map(p => p.name)\n      }\n    ],\n    sellingPlans: sellingPlans\n  }\n}\n\nconst getProduct = (id: string, title: string, price: number, handle: string, description: string, requiresSellingPlan: boolean, variants: Variant[], sellingPlanGroups: SellingPlanGroup[]) => {\n  return {\n    id: id,\n    title: title,\n    price: price,\n    handle: handle,\n    description: description,\n    requiresSellingPlan: requiresSellingPlan,\n    variants: variants,\n    sellingPlanGroups: sellingPlanGroups\n  }\n}\n\nconst dummyPriceAdjustment0: PriceAdjustment[] = []\n\nconst dummyPriceAdjustment1: PriceAdjustment[] = [\n  getPriceAdjustment('fixed_amount', 500)\n]\n\nconst dummyPriceAdjustment2: PriceAdjustment[] = [\n  getPriceAdjustment('fixed_amount', 800)\n]\n\nconst dummyGroupName = 'Subscribe & Save'\nconst dummySellingPlans: SellingPlan[] = [\n  getSellingPlan(111, 'Every Week', dummyGroupName, dummyPriceAdjustment0),\n  getSellingPlan(112, 'Every 2 Weeks', dummyGroupName, dummyPriceAdjustment2),\n  getSellingPlan(113, 'Every 3 Weeks', dummyGroupName, dummyPriceAdjustment2),\n  getSellingPlan(114, 'Every 4 Weeks', dummyGroupName, dummyPriceAdjustment1)\n]\nconst dummyGroup1 = getSellingPlanGroup('12345', dummyGroupName, dummySellingPlans, 1)\n\nexport const dummySellingGroups: SellingPlanGroup[] = [\n  dummyGroup1\n]\n\nexport const dummyProduct: Product = getProduct('1', 'Nike pro', 1500, 'nike', 'Nice', false, [], dummySellingGroups)\n","export const checkStatus = (response: any) => {\n  if (response.status >= 200 && response.status < 300) {\n    return response\n  } else {\n    throw new Error(response.statusText)\n  }\n}\n\nexport const parseJSON = (response: any) => {\n  return response.json()\n}\n","import { Product } from '../models/product'\nimport { SellingPlan } from '../models/selling-plan'\nimport { SellingPlanGroup } from '../models/selling-plan-group'\nimport { Variant } from '../models/variant'\nimport { checkStatus, parseJSON } from '../utils/ajax'\nimport { PriceAdjustment } from '../models/price-adjustments'\n\ndeclare const SHOPIFY_BASE_URL: string\n\nconst baseUrl = SHOPIFY_BASE_URL || ''\n\nconst adaptSellingPlan = (sellingPlansResponse: any): SellingPlan => {\n  return {\n    id: sellingPlansResponse.id,\n    description: sellingPlansResponse.description,\n    name: sellingPlansResponse.name,\n    options: sellingPlansResponse,\n    priceAdjustments: resolvePriceAdjustments(sellingPlansResponse)\n  }\n}\n\nfunction resolvePriceAdjustments (sellingPlansResponse: any): PriceAdjustment[] {\n  return sellingPlansResponse.price_adjustments.map((price: any) => {\n    return {\n      valueType: price.value_type,\n      value: price.value\n    }\n  })\n}\n\nconst adaptSellingPlanGroup = (sellingPlanGroupResponse: any): SellingPlanGroup => {\n  return {\n    id: sellingPlanGroupResponse.id,\n    name: sellingPlanGroupResponse.name,\n    sellingPlans: sellingPlanGroupResponse.selling_plans.map(adaptSellingPlan),\n    options: sellingPlanGroupResponse.options\n  }\n}\n\nconst adaptVariants = (variantsResponse: any): Variant => {\n  return {\n    id: variantsResponse.id,\n    title: variantsResponse.title,\n    price: variantsResponse.price\n  }\n}\n\nconst adaptProductResponse = (response: any): Product => {\n  return {\n    id: response.id,\n    description: response.description,\n    handle: response.handle,\n    title: response.title,\n    price: response.price,\n    requiresSellingPlan: response.requires_selling_plan,\n    sellingPlanGroups: response.selling_plan_groups.map(adaptSellingPlanGroup),\n    variants: response.variants.map(adaptVariants)\n  }\n}\n\nexport const getProductInfo = (productHandle: string): Promise<Product> => {\n  return fetch(`${baseUrl}/products/${productHandle}.js`)\n    .then(checkStatus)\n    .then(parseJSON)\n    .then(adaptProductResponse)\n}\n","import { buildElement, getHtmlElementByClassName } from '../../utils/element'\nimport { WidgetCustomizations } from '../../customizations/types'\nimport { buyOnceId } from './selling-plans'\n\nexport const renderSubscriptionPolicy = (mainElement: HTMLElement, customizations: WidgetCustomizations) => {\n  if (!customizations.subscriptionPolicy.shouldShow) {\n    return\n  }\n  const subscriptionPolicy = getSubscriptionPolicyElement(customizations)\n  mainElement.appendChild(subscriptionPolicy)\n  addOpenSubscriptionToOnChangeEvent(customizations)\n}\n\nexport const openSubscriptionPolicies = (customizations: WidgetCustomizations) => {\n  const selectedGroupId = getHtmlElementByClassName('yotpo-selected')\n    .getAttribute('data-seling-plan-group-id')\n\n  if (selectedGroupId === buyOnceId) {\n    getHtmlElementByClassName('yotpo-subscription-policy-wrapper').style.display = 'none'\n    return\n  }\n\n  getHtmlElementByClassName('yotpo-subscription-policy-wrapper').style.display = 'block'\n}\n\nconst addOpenSubscriptionToOnChangeEvent = (customizations: WidgetCustomizations) => {\n  getHtmlElementByClassName('yotpo-selling-plans-wrapper')\n    .addEventListener('change', () => openSubscriptionPolicies(customizations))\n}\n\nconst getSubscriptionPolicyElement = (customizations: WidgetCustomizations): HTMLElement => {\n  const wrapper = buildElement('div', 'yotpo-subscription-policy-wrapper', {})\n  const container = buildElement('div', `${customizations.isReadOnly ? 'yotpo-subscription-policy-container yotpo-admin-preview' : 'yotpo-subscription-policy-container'}`, {})\n  const main = buildElement('div', 'yotpo-subscription-policy', {})\n\n  const textHeader = getTextHeader()\n  main.appendChild(textHeader)\n\n  const textMain = getMainText(customizations)\n  main.appendChild(textMain)\n\n  const textFooter = getTextFooter(customizations)\n  if (textFooter) {\n    main.appendChild(textFooter)\n  }\n\n  const radioStyle = buildElement('style', 'yotpo-subscription-policy-style', {})\n  radioStyle.innerHTML = getStyles(customizations)\n\n  container.appendChild(main)\n  wrapper.appendChild(container)\n  wrapper.appendChild(radioStyle)\n\n  return wrapper\n}\n\nconst getTextHeader = () => {\n  const textHeader = buildElement('div', 'yotpo-subscription-policy-text-header', {})\n  textHeader.innerHTML = getSelectedSellingPlanGroup()\n  getHtmlElementByClassName('yotpo-selling-plans-wrapper').addEventListener('change', () => {\n    textHeader.innerHTML = getSelectedSellingPlanGroup()\n  })\n  return textHeader\n}\n\nconst getMainText = (customizations: WidgetCustomizations) => {\n  const textMain = buildElement('div', 'yotpo-subscription-policy-text-main', {})\n  textMain.innerHTML = customizations.subscriptionPolicy.description\n  return textMain\n}\n\nconst getTextFooter = (customizations: WidgetCustomizations) => {\n  const informationLink = customizations.subscriptionPolicy.informationLink\n  if (informationLink) {\n    const defaultInformationLink = `${window.location.origin}/policies/subscription-policy.html?locale=en`\n    const textFooter = buildElement('a', 'yotpo-subscription-policy-text-footer', {\n      target: '_blank',\n      href: informationLink || defaultInformationLink\n    })\n    textFooter.innerHTML = customizations.subscriptionPolicy.footer\n    return textFooter\n  }\n}\n\nconst getSelectedSellingPlanGroup = (): string => {\n  return getHtmlElementByClassName('yotpo-selected').querySelector('.yotpo-radio-label-text').innerHTML\n}\n\nconst getStyles = (customizations: WidgetCustomizations): string => {\n  return `\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-subscription-policy-wrapper {\n    display: none;\n    margin: 20px 0;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-subscription-policy-container {\n    text-align: initial;\n    width: 100%;\n    max-width: 400px;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-subscription-policy-container.yotpo-admin-preview {\n    margin: auto;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-subscription-policy {\n    box-shadow: 0px 2px 7px rgba(0, 0, 0, 0.09);\n    display: grid;\n    padding: 30px 20px 30px 20px;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-subscription-policy-text-header, .yotpo-subscription-policy-text-main, .yotpo-subscription-policy-text-footer {\n    margin: 5px;\n    font-style: normal;\n    font-family: ${customizations.styles.fontFamily.name};\n    font-weight: ${customizations.styles.fontFamily.weight || 500};\n    line-height: 20px;\n    width: 99%;\n    max-width: 350px;\n    color: #272850;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-subscription-policy-text-main, .yotpo-subscription-policy-text-footer {\n    color: #676A6C;\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-subscription-policy-text-header {\n    color: #272850;\n    font-size: ${customizations.styles.fontSize.primary};\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-subscription-policy-text-main {\n    color: #676A6C;\n    font-size: ${customizations.styles.fontSize.primary};\n  }\n  .yotpo-widget-subscriptions-add-to-cart .yotpo-subscription-policy-text-footer {\n    text-decoration: underline;\n    font-size: ${customizations.styles.fontSize.primary};\n  }\n  `\n}\n","import { WidgetCustomizations } from '../../customizations/types'\nimport { Product } from '../../models/product'\nimport { getSellingPlansElement } from './selling-plans'\nimport { addRenderDiscountToOnChangeEvent, renderDiscount } from './discount'\nimport { openSubscriptionPolicies, renderSubscriptionPolicy } from './subscription-policy'\n\nexport const renderProduct = (mainElement: HTMLElement, product: Product, customizations: WidgetCustomizations): HTMLElement => {\n  const groups = getSellingPlansElement(product.sellingPlanGroups, customizations, !product.requiresSellingPlan, product.price)\n  mainElement.appendChild(groups)\n  renderSubscriptionPolicy(mainElement, customizations)\n  addRenderDiscountToOnChangeEvent(product.sellingPlanGroups, customizations)\n  if (product.requiresSellingPlan) {\n    openSubscriptionPolicies(customizations)\n    renderDiscount(product.sellingPlanGroups, customizations)\n  }\n  return groups\n}\n","/* global Shopify */\nimport { WidgetOptions } from './types'\nimport { getCustomizations } from './customizations/customizations'\nimport { getWidgetCustomizations } from './customizations/widget-customizations'\nimport { getMainElement } from './render/render'\nimport { WidgetCustomizations } from './customizations/types'\nimport { dummyProduct } from './models/dummy-product'\nimport { getProductInfo } from './services/shopify'\nimport { Product } from './models/product'\nimport { renderProduct } from './render/components/product'\nimport { generateDiscountView } from './render/components/discount'\nimport { initWidgets } from './container/widgets-container'\nexport class SubscriptionsAddToCartWidget {\n  private element: HTMLElement\n  private customizations: WidgetCustomizations\n\n  init (widgetOptions: WidgetOptions) {\n    this.element = widgetOptions.element\n    const overridenCustomizations = getCustomizations(widgetOptions.metadata.customizations, this.element)\n    this.customizations = getWidgetCustomizations(overridenCustomizations)\n  }\n\n  run () {\n    const mainElement = getMainElement(this.customizations)\n    this.injectWidget(this.element, mainElement)\n    if (this.customizations.productHandle) {\n      getProductInfo(this.customizations.productHandle).then((product: Product) => {\n        if (product.sellingPlanGroups.length > 0) {\n          generateDiscountView(this.customizations)\n          renderProduct(mainElement, product, this.customizations)\n        }\n      })\n    } else if (this.customizations.isDummy && this.customizations.isReadOnly) {\n      renderProduct(mainElement, dummyProduct, this.customizations)\n    } else if (this.customizations.isPreview) {\n      renderProduct(mainElement, dummyProduct, this.customizations)\n    }\n\n    // @ts-ignore\n    if (typeof (Shopify) !== 'undefined' && Shopify.designMode) {\n      const interval = setInterval(() => {\n        const widgetElement = document.querySelector('.yotpo-widget-subscriptions-add-to-cart')\n        if (!widgetElement) {\n          initWidgets()\n          clearInterval(interval)\n        }\n      }, 3000)\n    }\n  }\n\n  private injectWidget (currentElement: HTMLElement, mainElement: HTMLElement): void {\n    if (!this.customizations.isReadOnly && !this.customizations.isPreview && this.customizations.autoInject.enabled) {\n      const hostElements = document.querySelectorAll(this.customizations.autoInject.targetSelector)\n      if (hostElements.length === 0) {\n        throw new Error(`could not find element with ${this.customizations.autoInject.targetSelector} selector`)\n      }\n\n      hostElements[hostElements.length - 1].insertAdjacentElement('afterbegin', mainElement)\n    } else {\n      this.element.parentNode.replaceChild(mainElement, currentElement)\n    }\n  }\n}\n","/* global yotpoWidgetsContainer */\n\nexport const isContainerDefined = (): boolean => {\n  // @ts-ignore\n  return typeof (yotpoWidgetsContainer) !== 'undefined'\n}\n\nexport const registerToContainer = (name: string, constructor: Function): void => {\n  // @ts-ignore\n  yotpoWidgetsContainer[name] = constructor\n}\n\nexport const initWidgets = () => {\n  // @ts-ignore\n  yotpoWidgetsContainer.initWidgets()\n}\n","import { SubscriptionsAddToCartWidget } from './widget'\nimport { isContainerDefined, registerToContainer } from './container/widgets-container'\n\nif (isContainerDefined()) {\n  registerToContainer('SubscriptionsAddToCartWidget', () => {\n    return new SubscriptionsAddToCartWidget()\n  })\n} else {\n  console.log('yotpoWidgetsContainer is not defined')\n}\n"],"sourceRoot":""}