{% from "/macros/profile/profile-details.html" import profileDetails %} {% from "/macros/profile/profile-cost.html" import profileAddonProductCost %} {% from "/macros/profile/profile-fee.html" import profileFee %} {% from "/macros/profile/profile-action-button.html" import productActionButton %} {% from "/macros/profile/configure/profile-added-button.html" import productAddButton %} {% macro addonProductsContent(addonProducts, selectedEdition, isConfigure) %}

{{ addonProducts.i18n.addons }}

{% set addonProductsUniqueItems = _.uniqBy(addonProducts.items, 'name') %} {% for addonProduct in addonProductsUniqueItems %} {% for edition in addonProduct.edition %}

{{ addonProduct.name }}

    {% for plan in edition.plans %} {% if plan.costs and plan.costs.flatPrice %} {{ profileAddonProductCost(plan.costs.flatPrice, true) }} {% endif %} {% if plan.costs and plan.costs.unitPrice %} {% for unitPrice in plan.costs.unitPrice %} {% set unitPriceIndex = loop.index %} {% for usageRange in unitPrice.usageRange %} {{ profileAddonProductCost(usageRange, unitPriceIndex === 1 and not plan.costs.flatPrice) }} {% endfor %} {% endfor %} {% endif %} {% if plan.contractLength %}
  • {{ plan.formattedContract }}
  • {% endif %} {% if plan.setupFees.length or plan.contractFees.length %} {{ profileFee(plan.setupFees, plan.contractFees) }} {% endif %} {% if loop.index < edition.plans.length %}
  • {{ addonProducts.i18n.tierSeparator }}
  • {% endif %} {% endfor %}
{% if edition.callToAction.label.length %} {% set editionOptions = { buttonSize: 'fullWidth', isAddToCartStyle: false } %} {{ productActionButton(edition.callToAction, editionOptions) }} {% endif %} {% if isConfigure %}
{% set editionOptions = { isFullWidth: true } %} {{ productAddButton(edition.callToAction, addonProducts.i18n, edition.id, editionOptions) }}
{% endif %}
{% if edition.audience.length %}
{{ profileDetails(edition.audience, application.addonProducts.i18n.audience) }}
{% endif %} {% if edition.items %}
{{ profileDetails(edition.items, application.addonProducts.i18n.inclusions) }}
{% endif %} {% if edition.bullets.length %}
{{ profileDetails(edition.bullets) }} {% if edition.bullets.length > 7 %} {% endif %}
{% endif %}
{% endfor %} {% endfor %}
{% endmacro %}