{"version":3,"sources":["webpack:///./resources/js/src/app/mixins/buttonSizeProperty.mixin.js","webpack:///./resources/js/src/app/components/newsletter/NewsletterInput.vue","webpack:///./resources/js/src/app/components/newsletter/NewsletterInput.vue?2253","webpack:///resources/js/src/app/components/newsletter/NewsletterInput.vue","webpack:///./resources/js/src/app/components/newsletter/NewsletterInput.vue?f1b2"],"names":["BUTTON_SIZES","LEGACY_CLASS_MAP","ButtonSizePropertyMixin","props","buttonSize","type","String","default","validator","value","concat","_toConsumableArray","Object","keys","indexOf","computed","buttonSizeClass","hasOwnProperty","this","render","_vm","_c","_self","ref","attrs","id","_uid","method","on","submit","$event","preventDefault","validateData","apply","arguments","staticClass","showNameInputs","for","_v","_s","$translate","directives","name","rawName","firstName","expression","domProps","input","target","composing","_e","lastName","email","autocomplete","focus","loadRecaptcha","honeypot","tabindex","showPrivacyPolicyCheckbox","privacyPolicyValue","checked","Array","isArray","_i","change","$$a","$$el","$$c","$$i","slice","innerHTML","privacyPolicyText","class","disabled","isDisabled","click","icon","loading","$ceres","config","global","googleRecaptchaApiKey","_withStripped","mixins","Boolean","emailFolder","Number","data","link","App","urls","privacyPolicy","methods","_this","ValidationService","validate","$","done","save","fail","invalidFields","markInvalidFields","filter","field","dataset","map","innerText","forEach","NotificationService","error","_this2","recaptchaEl","$el","querySelector","window","grecaptcha","executeReCaptcha","then","recaptchaToken","ApiService","post","recaptcha","containsHoneypot","warn","success","closeAfter","resetInputs","always","resetRecaptcha","googleRecaptchaVersion","recaptchaId","reset","component"],"mappings":"46BAAA,IAAMA,EAAe,CAAC,SAAU,UAE1BC,EAAmB,CACrB,GAAM,SACN,GAAM,GACN,GAAM,UAGGC,EACb,CACIC,MAAO,CACHC,WACA,CACIC,KAAM,CAACC,OAAQ,MACfC,QAAS,KACTC,UAAW,SAAAC,GAEP,OAIsB,IAJf,CACH,IAAEC,OACCV,EAAYW,EACZC,OAAOC,KAAKZ,KACjBa,QAAQL,MAKtBM,SAAU,CACNC,gBAAe,WAEX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pB,EACA,KACA,KACA,MAIa,UAAAiH,E","file":"chunks/ceres-12.min.js","sourcesContent":["const BUTTON_SIZES = [\"btn-sm\", \"btn-lg\"];\n\nconst LEGACY_CLASS_MAP = {\n    \"sm\": \"btn-sm\",\n    \"md\": \"\",\n    \"lg\": \"btn-lg\"\n};\n\nexport const ButtonSizePropertyMixin =\n{\n    props: {\n        buttonSize:\n        {\n            type: [String, null],\n            default: null,\n            validator: value =>\n            {\n                return [\n                    \"\",\n                    ...BUTTON_SIZES,\n                    ...Object.keys(LEGACY_CLASS_MAP)\n                ].indexOf(value) !== -1;\n            }\n        }\n    },\n\n    computed: {\n        buttonSizeClass()\n        {\n            if (LEGACY_CLASS_MAP.hasOwnProperty(this.buttonSize))\n            {\n                return LEGACY_CLASS_MAP[this.buttonSize];\n            }\n\n            return this.buttonSize;\n        }\n    }\n};\n","var render = function render() {\n  var _vm = this,\n    _c = _vm._self._c\n  return _c(\n    \"form\",\n    {\n      ref: \"newsletterForm\",\n      attrs: { id: \"newsletter-input-form_\" + _vm._uid, method: \"post\" },\n      on: {\n        submit: function ($event) {\n          $event.preventDefault()\n          return _vm.validateData.apply(null, arguments)\n        },\n      },\n    },\n    [\n      _c(\"div\", { staticClass: \"row\" }, [\n        _vm.showNameInputs\n          ? _c(\"div\", { staticClass: \"col-6\" }, [\n              _c(\n                \"div\",\n                {\n                  staticClass: \"input-unit\",\n                  attrs: { \"data-validate\": \"!regex\" },\n                },\n                [\n                  _c(\n                    \"label\",\n                    { attrs: { for: \"first-name-input_\" + _vm._uid } },\n                    [\n                      _vm._v(\n                        _vm._s(\n                          _vm.$translate(\"Ceres::Template.newsletterFirstName\")\n                        )\n                      ),\n                    ]\n                  ),\n                  _vm._v(\" \"),\n                  _c(\"input\", {\n                    directives: [\n                      {\n                        name: \"model\",\n                        rawName: \"v-model\",\n                        value: _vm.firstName,\n                        expression: \"firstName\",\n                      },\n                    ],\n                    attrs: {\n                      type: \"text\",\n                      \"data-validate-ref\": \"/[.:\\\\/\\\\d]/g\",\n                      id: \"first-name-input_\" + _vm._uid,\n                      \"data-testing\": \"nl-first-name\",\n                    },\n                    domProps: { value: _vm.firstName },\n                    on: {\n                      input: function ($event) {\n                        if ($event.target.composing) return\n                        _vm.firstName = $event.target.value\n                      },\n                    },\n                  }),\n                ]\n              ),\n            ])\n          : _vm._e(),\n        _vm._v(\" \"),\n        _vm.showNameInputs\n          ? _c(\"div\", { staticClass: \"col-6 pl-0\" }, [\n              _c(\n                \"div\",\n                {\n                  staticClass: \"input-unit\",\n                  attrs: { \"data-validate\": \"!regex\" },\n                },\n                [\n                  _c(\n                    \"label\",\n                    { attrs: { for: \"last-name-input_\" + _vm._uid } },\n                    [\n                      _vm._v(\n                        _vm._s(\n                          _vm.$translate(\"Ceres::Template.newsletterLastName\")\n                        )\n                      ),\n                    ]\n                  ),\n                  _vm._v(\" \"),\n                  _c(\"input\", {\n                    directives: [\n                      {\n                        name: \"model\",\n                        rawName: \"v-model\",\n                        value: _vm.lastName,\n                        expression: \"lastName\",\n                      },\n                    ],\n                    attrs: {\n                      type: \"text\",\n                      \"data-validate-ref\": \"/[.:\\\\/\\\\d]/g\",\n                      id: \"last-name-input_\" + _vm._uid,\n                      \"data-testing\": \"nl-last-name\",\n                    },\n                    domProps: { value: _vm.lastName },\n                    on: {\n                      input: function ($event) {\n                        if ($event.target.composing) return\n                        _vm.lastName = $event.target.value\n                      },\n                    },\n                  }),\n                ]\n              ),\n            ])\n          : _vm._e(),\n        _vm._v(\" \"),\n        _c(\"div\", { staticClass: \"col-12\" }, [\n          _c(\"div\", { staticClass: \"input-group\" }, [\n            _c(\n              \"div\",\n              { staticClass: \"input-unit\", attrs: { \"data-validate\": \"mail\" } },\n              [\n                _c(\"label\", { attrs: { for: \"email-input-id_\" + _vm._uid } }, [\n                  _vm._v(\n                    _vm._s(_vm.$translate(\"Ceres::Template.newsletterEmail\")) +\n                      \" \" +\n                      _vm._s(\n                        _vm.$translate(\n                          \"Ceres::Template.newsletterIsRequiredFootnote\"\n                        )\n                      )\n                  ),\n                ]),\n                _vm._v(\" \"),\n                _c(\"input\", {\n                  directives: [\n                    {\n                      name: \"model\",\n                      rawName: \"v-model\",\n                      value: _vm.email,\n                      expression: \"email\",\n                    },\n                  ],\n                  attrs: {\n                    type: \"email\",\n                    autocomplete: \"email\",\n                    id: \"email-input-id_\" + _vm._uid,\n                    \"data-testing\": \"nl-mail\",\n                  },\n                  domProps: { value: _vm.email },\n                  on: {\n                    focus: function ($event) {\n                      _vm.loadRecaptcha = true\n                    },\n                    input: function ($event) {\n                      if ($event.target.composing) return\n                      _vm.email = $event.target.value\n                    },\n                  },\n                }),\n              ]\n            ),\n            _vm._v(\" \"),\n            _c(\"input\", {\n              directives: [\n                {\n                  name: \"model\",\n                  rawName: \"v-model\",\n                  value: _vm.honeypot,\n                  expression: \"honeypot\",\n                },\n              ],\n              staticClass: \"honey\",\n              attrs: {\n                autocomplete: \"none\",\n                type: \"text\",\n                name: \"username\",\n                tabindex: \"-1\",\n              },\n              domProps: { value: _vm.honeypot },\n              on: {\n                input: function ($event) {\n                  if ($event.target.composing) return\n                  _vm.honeypot = $event.target.value\n                },\n              },\n            }),\n          ]),\n        ]),\n        _vm._v(\" \"),\n        _vm.showPrivacyPolicyCheckbox\n          ? _c(\"div\", { staticClass: \"col-12\" }, [\n              _c(\n                \"div\",\n                {\n                  staticClass: \"form-check small\",\n                  attrs: { \"data-validate\": \"\" },\n                },\n                [\n                  _c(\"input\", {\n                    directives: [\n                      {\n                        name: \"model\",\n                        rawName: \"v-model\",\n                        value: _vm.privacyPolicyValue,\n                        expression: \"privacyPolicyValue\",\n                      },\n                    ],\n                    staticClass: \"form-check-input\",\n                    attrs: {\n                      type: \"checkbox\",\n                      id: \"privacy-policy-accept-id_\" + _vm._uid,\n                      name: \"privacy-policy-accept\",\n                      \"data-testing\": \"nl-policy\",\n                    },\n                    domProps: {\n                      checked: Array.isArray(_vm.privacyPolicyValue)\n                        ? _vm._i(_vm.privacyPolicyValue, null) > -1\n                        : _vm.privacyPolicyValue,\n                    },\n                    on: {\n                      change: function ($event) {\n                        var $$a = _vm.privacyPolicyValue,\n                          $$el = $event.target,\n                          $$c = $$el.checked ? true : false\n                        if (Array.isArray($$a)) {\n                          var $$v = null,\n                            $$i = _vm._i($$a, $$v)\n                          if ($$el.checked) {\n                            $$i < 0 &&\n                              (_vm.privacyPolicyValue = $$a.concat([$$v]))\n                          } else {\n                            $$i > -1 &&\n                              (_vm.privacyPolicyValue = $$a\n                                .slice(0, $$i)\n                                .concat($$a.slice($$i + 1)))\n                          }\n                        } else {\n                          _vm.privacyPolicyValue = $$c\n                        }\n                      },\n                    },\n                  }),\n                  _vm._v(\" \"),\n                  _c(\"label\", {\n                    staticClass: \"form-check-label\",\n                    attrs: { for: \"privacy-policy-accept-id_\" + _vm._uid },\n                    domProps: { innerHTML: _vm._s(_vm.privacyPolicyText) },\n                  }),\n                ]\n              ),\n            ])\n          : _vm._e(),\n        _vm._v(\" \"),\n        _c(\"div\", { staticClass: \"col-12 mt-3\" }, [\n          _c(\"div\", { staticClass: \"input-group-btn\" }, [\n            _c(\n              \"button\",\n              {\n                staticClass: \"btn btn-block btn-primary btn-appearance\",\n                class: _vm.buttonSizeClass,\n                attrs: {\n                  type: \"button\",\n                  disabled: _vm.isDisabled,\n                  \"data-testing\": \"nl-send\",\n                },\n                on: { click: _vm.validateData },\n              },\n              [\n                _c(\"icon\", {\n                  attrs: { icon: \"paper-plane-o\", loading: _vm.isDisabled },\n                }),\n                _vm._v(\n                  \"\\n                    \" +\n                    _vm._s(\n                      _vm.$translate(\n                        \"Ceres::Template.newsletterSubscribeButtonLabel\"\n                      )\n                    ) +\n                    \"\\n                \"\n                ),\n              ],\n              1\n            ),\n          ]),\n        ]),\n        _vm._v(\" \"),\n        _c(\"div\", { staticClass: \"col-12 text-right small mt-2\" }, [\n          _vm._v(\n            _vm._s(\n              _vm.$translate(\"Ceres::Template.newsletterIsRequiredFootnote\")\n            ) +\n              \" \" +\n              _vm._s(_vm.$translate(\"Ceres::Template.newsletterIsRequired\"))\n          ),\n        ]),\n      ]),\n      _vm._v(\" \"),\n      !!_vm.$ceres.config.global.googleRecaptchaApiKey && _vm.loadRecaptcha\n        ? _c(\"recaptcha\")\n        : _vm._e(),\n    ],\n    1\n  )\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns }","import mod from \"-!../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./NewsletterInput.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./NewsletterInput.vue?vue&type=script&lang=js\"","<template>\n    <form ref=\"newsletterForm\" :id=\"'newsletter-input-form_' + _uid\" method=\"post\" @submit.prevent=\"validateData\">\n        <div class=\"row\">\n            <div class=\"col-6\" v-if=\"showNameInputs\">\n                <div class=\"input-unit\" data-validate=\"!regex\">\n                    <label :for=\"'first-name-input_' + _uid\">{{ $translate(\"Ceres::Template.newsletterFirstName\") }}</label>\n                    <input type=\"text\" data-validate-ref=\"/[.:\\/\\d]/g\" :id=\"'first-name-input_' + _uid\" v-model=\"firstName\" data-testing=\"nl-first-name\">\n                </div>\n            </div>\n            <div class=\"col-6 pl-0\" v-if=\"showNameInputs\">\n                <div class=\"input-unit\" data-validate=\"!regex\">\n                    <label :for=\"'last-name-input_' + _uid\">{{ $translate(\"Ceres::Template.newsletterLastName\") }}</label>\n                    <input type=\"text\" data-validate-ref=\"/[.:\\/\\d]/g\" :id=\"'last-name-input_' + _uid\" v-model=\"lastName\"  data-testing=\"nl-last-name\">\n                </div>\n            </div>\n\n            <div class=\"col-12\">\n                <div class=\"input-group\">\n                    <div class=\"input-unit\" data-validate=\"mail\">\n                        <label :for=\"'email-input-id_' + _uid\">{{ $translate(\"Ceres::Template.newsletterEmail\") }} {{ $translate(\"Ceres::Template.newsletterIsRequiredFootnote\") }}</label>\n                        <input @focus=\"loadRecaptcha = true\" type=\"email\" autocomplete=\"email\" :id=\"'email-input-id_' + _uid\" v-model=\"email\" data-testing=\"nl-mail\">\n                    </div>\n                    <input autocomplete=\"none\" class=\"honey\" type=\"text\" name=\"username\" tabindex=\"-1\" v-model=\"honeypot\">\n                </div>\n            </div>\n\n            <div class=\"col-12\" v-if=\"showPrivacyPolicyCheckbox\">\n                <div class=\"form-check small\" data-validate>\n                    <input type=\"checkbox\" class=\"form-check-input\" :id=\"'privacy-policy-accept-id_' + _uid\" name=\"privacy-policy-accept\" v-model=\"privacyPolicyValue\" data-testing=\"nl-policy\">\n                    <label :for=\"'privacy-policy-accept-id_' + _uid\" class=\"form-check-label\" v-html=\"privacyPolicyText\"></label>\n                </div>\n            </div>\n\n            <div class=\"col-12 mt-3\">\n                <div class=\"input-group-btn\">\n                    <button type=\"button\" class=\"btn btn-block btn-primary btn-appearance\" @click=\"validateData\" :disabled=\"isDisabled\" :class=\"buttonSizeClass\" data-testing=\"nl-send\">\n                        <icon icon=\"paper-plane-o\" :loading=\"isDisabled\"></icon>\n                        {{ $translate(\"Ceres::Template.newsletterSubscribeButtonLabel\") }}\n                    </button>\n                </div>\n            </div>\n\n            <div class=\"col-12 text-right small mt-2\">{{ $translate(\"Ceres::Template.newsletterIsRequiredFootnote\") }} {{ $translate(\"Ceres::Template.newsletterIsRequired\") }}</div>\n        </div>\n        <recaptcha v-if=\"!!$ceres.config.global.googleRecaptchaApiKey && loadRecaptcha\"></recaptcha>\n    </form>\n</template>\n\n<script>\nimport ApiService from \"../../services/ApiService\";\nimport NotificationService from \"../../services/NotificationService\";\nimport ValidationService from \"../../services/ValidationService\";\nimport { executeReCaptcha } from \"../../helper/executeReCaptcha\";\nimport { ButtonSizePropertyMixin } from \"../../mixins/buttonSizeProperty.mixin\";\n\nexport default {\n    mixins: [ButtonSizePropertyMixin],\n\n    props: {\n        showNameInputs:\n        {\n            type: Boolean,\n            default: false\n        },\n        showPrivacyPolicyCheckbox:\n        {\n            type: Boolean,\n            default: true\n        },\n        emailFolder:\n        {\n            type: Number,\n            default: 0\n        }\n    },\n\n    data()\n    {\n        return {\n            firstName: \"\",\n            lastName: \"\",\n            email: \"\",\n            isDisabled: false,\n            privacyPolicyValue: false,\n            honeypot: \"\",\n            loadRecaptcha: false\n        };\n    },\n\n    computed:\n    {\n        privacyPolicyText()\n        {\n            const link = \"<a href=\\\"\" + App.urls.privacyPolicy + \"\\\" target=\\\"_blank\\\"><span class=\\\"text-primary text-appearance\\\">\"\n                + this.$translate(\"Ceres::Template.checkoutPrivacyPolicy\", {\"hyphen\": \"&shy;\"})\n                + \"</span></a>\";\n\n            return this.$translate(\"Ceres::Template.newsletterAcceptPrivacyPolicy\", {\"policy\": link}) + this.$translate(\"Ceres::Template.newsletterIsRequiredFootnote\");\n        }\n    },\n\n    methods: {\n        validateData()\n        {\n            this.isDisabled = true;\n\n            ValidationService.validate($(\"#newsletter-input-form_\" + this._uid))\n                .done(() =>\n                {\n                    this.save();\n                })\n                .fail(invalidFields =>\n                {\n                    ValidationService.markInvalidFields(invalidFields, \"error\");\n\n                    invalidFields.filter(field => {\n                        return field.dataset.validate !== null\n                    }).map((field) => {\n                        return {\n                            type: field.dataset.validate,\n                            name: field.innerText\n                        }\n                    }).forEach((field) => {\n                        if(field.type === '!regex')\n                        {\n                            NotificationService.error(this.$translate(\"Ceres::Template.newsletterNotAllowedCharacters\", {name: field.name}));\n                        }\n                    });\n\n                    this.isDisabled = false;\n                });\n        },\n\n        save()\n        {\n            const recaptchaEl = this.$el.querySelector(\"[data-recaptcha]\");\n\n            if (App.config.global.googleRecaptchaApiKey && (!window.grecaptcha || !recaptchaEl))\n            {\n                NotificationService.error(this.$translate(\"Ceres::Template.newsletterAcceptRecaptchaCookie\"));\n                this.isDisabled = false;\n                return;\n            }\n\n            executeReCaptcha(this.$el)\n            .then((recaptchaToken) =>\n            {\n                ApiService.post(\"/rest/io/customer/newsletter\", { email: this.email, firstName: this.firstName, lastName: this.lastName, emailFolder: this.emailFolder, honeypot: this.honeypot, recaptcha: recaptchaToken})\n                    .done(data =>\n                    {\n                        if (!!data.containsHoneypot)\n                        {\n                            NotificationService.warn(\n                                this.$translate(\"Ceres::Template.newsletterHoneypotWarning\")\n                            );\n                        }\n                        else\n                        {\n                            NotificationService.success(\n                                this.$translate(\"Ceres::Template.newsletterSuccessMessage\")\n                            ).closeAfter(3000);\n                        }\n                        this.resetInputs();\n                    })\n                    .fail(() =>\n                    {\n                        NotificationService.error(\n                            this.$translate(\"Ceres::Template.newsletterErrorMessage\")\n                        ).closeAfter(5000);\n                    })\n                    .always(() =>\n                    {\n                        this.isDisabled = false;\n                        this.resetRecaptcha();\n                    });\n            });\n        },\n\n        resetInputs()\n        {\n            this.firstName = \"\";\n            this.lastName = \"\";\n            this.email = \"\";\n            this.privacyPolicyValue = false;\n        },\n\n        resetRecaptcha()\n        {\n            if(App.config.global.googleRecaptchaVersion === 2 && window.grecaptcha)\n            {\n                const recaptchaId = this.$el.querySelector(\"[data-recaptcha]\");\n\n                window.grecaptcha.reset(recaptchaId);\n            }\n        },\n\n    }\n}\n</script>\n","import { render, staticRenderFns } from \"./NewsletterInput.vue?vue&type=template&id=161e5506\"\nimport script from \"./NewsletterInput.vue?vue&type=script&lang=js\"\nexport * from \"./NewsletterInput.vue?vue&type=script&lang=js\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  null,\n  null\n  \n)\n\nexport default component.exports"],"sourceRoot":""}