{% sw_extends '@Storefront/storefront/base.html.twig' %}
{% block base_script_hmr_mode %}
{{ parent() }}
{% if page.extensions.NetiNextGoogleCustomerReviewsFrontend
or page.extensions.netiNextGoogleCustomerReviewsFinish %}
<script src="https://apis.google.com/js/platform.js?onload=netiPlatformLoaded" async defer></script>
<script type="text/javascript">
window.netiPlatformLoaded = function() {
{% if page.extensions.NetiNextGoogleCustomerReviewsFrontend %}
{% set struct = page.extensions.NetiNextGoogleCustomerReviewsFrontend %}
var ratingBadgeContainer = document.createElement('div');
document.body.appendChild(ratingBadgeContainer);
window.gapi.load('ratingbadge', function() {
window.gapi.ratingbadge.render(
ratingBadgeContainer,
{
merchant_id: "{{ struct.merchantId }}",
position: "{{ struct.position }}"
}
);
});
{% endif %}
{% if page.extensions.netiNextGoogleCustomerReviewsFinish %}
{% set struct = page.extensions.netiNextGoogleCustomerReviewsFinish %}
window.gapi.load('surveyoptin', function() {
window.gapi.surveyoptin.render(
{
merchant_id: "{{ struct.merchantId }}",
order_id: "{{ struct.orderId }}",
email: "{{ struct.email }}",
delivery_country: "{{ struct.deliveryCountry }}",
estimated_delivery_date: "{{ struct.estimatedDeliveryDate|date("Y-m-d") }}",
{% if struct.optionalFields %}
{{ struct.optionalFields }}
{% endif %}
{% if struct.products|length > 0 %}
products: {{ struct.products|json_encode|raw }}
{% endif %}
}
);
});
{% endif %}
};
</script>
{% endif %}
{% endblock %}