{"version":3,"sources":["webpack:///./node_modules/core-js/modules/es.string.includes.js","webpack:///./node_modules/core-js/internals/not-a-regexp.js","webpack:///./node_modules/core-js/internals/correct-is-regexp-logic.js","webpack:///./node_modules/core-js/modules/es.array.includes.js","webpack:///./node_modules/core-js/modules/es.array.map.js","webpack:///./src/views/Subscription/Suspend.vue?cb15","webpack:///./src/views/Subscription/Suspend.vue","webpack:///./src/views/Subscription/Suspend.vue?4c75","webpack:///./src/views/Subscription/Suspend.vue?d6dc"],"names":["$","notARegExp","requireObjectCoercible","toString","correctIsRegExpLogic","target","proto","forced","includes","searchString","this","indexOf","arguments","length","undefined","isRegExp","module","exports","it","TypeError","wellKnownSymbol","MATCH","METHOD_NAME","regexp","error1","error2","$includes","addToUnscopables","el","$map","map","arrayMethodHasSpeciesSupport","HAS_SPECIES_SUPPORT","callbackfn","render","_vm","_h","$createElement","_c","_self","staticClass","_v","cancellationScheduled","errorState","attrs","name","inputFields","currentStateIs","states","INITIAL","LOADING","ERROR","on","$event","preventDefault","suspendSubscription","_l","field","index","key","ref","refInFor","_e","COMPLETE","staticRenderFns","ErrorStrings","SubscriptionSuspend","_mixins","_inherits","_super","_createSuper","_this","_classCallCheck","suspendFrom","value","required","type","placeholder","errors","min","minFromDate","suspendTo","minToDate","disabled","declarationFile","customErrorMessage","info","infoColor","inputExplanationParagraph","explanation","_createClass","get","$store","state","currentUser","_this$currentUser$sub","subscriptionDetails","cancellationProcessDate","date","Date","setDate","getDate","concat","getFullYear","getMonth","slice","_this$inputFields","setMonth","_suspendSubscription","_asyncToGenerator","_regeneratorRuntime","mark","_callee","api","_this$currentUser$sub2","errorsWithoutKeys","wrap","_context","prev","next","clearErrors","validate","abrupt","SubscriptionApi","subscriptionSuspend","subscriptionId","subscription","uploadId","t0","Object","entries","response","data","filter","toUpperCase","setErrors","stop","apply","_this2","forEach","_ref","_ref2","_slicedToArray","errorKey","errorValue","_ref3","_ref4","fieldKey","fieldValue","toLowerCase","values","_this3","valid","$refs","isArray","every","inputField","mixins","State","__decorate","Watch","Component","components","Content","Toolbar","FormInput","FormButton","component"],"mappings":"gHACA,IAAIA,EAAI,EAAQ,QACZC,EAAa,EAAQ,QACrBC,EAAyB,EAAQ,QACjCC,EAAW,EAAQ,QACnBC,EAAuB,EAAQ,QAInCJ,EAAE,CAAEK,OAAQ,SAAUC,OAAO,EAAMC,QAASH,EAAqB,aAAe,CAC9EI,SAAU,SAAkBC,GAC1B,SAAUN,EAASD,EAAuBQ,OACvCC,QAAQR,EAASF,EAAWQ,IAAgBG,UAAUC,OAAS,EAAID,UAAU,QAAKE,O,uBCZzF,IAAIC,EAAW,EAAQ,QAEvBC,EAAOC,QAAU,SAAUC,GACzB,GAAIH,EAASG,GACX,MAAMC,UAAU,iDAChB,OAAOD,I,qBCLX,IAAIE,EAAkB,EAAQ,QAE1BC,EAAQD,EAAgB,SAE5BJ,EAAOC,QAAU,SAAUK,GACzB,IAAIC,EAAS,IACb,IACE,MAAMD,GAAaC,GACnB,MAAOC,GACP,IAEE,OADAD,EAAOF,IAAS,EACT,MAAMC,GAAaC,GAC1B,MAAOE,KACT,OAAO,I,kCCZX,IAAIzB,EAAI,EAAQ,QACZ0B,EAAY,EAAQ,QAA+BlB,SACnDmB,EAAmB,EAAQ,QAI/B3B,EAAE,CAAEK,OAAQ,QAASC,OAAO,GAAQ,CAClCE,SAAU,SAAkBoB,GAC1B,OAAOF,EAAUhB,KAAMkB,EAAIhB,UAAUC,OAAS,EAAID,UAAU,QAAKE,MAKrEa,EAAiB,a,kCCbjB,IAAI3B,EAAI,EAAQ,QACZ6B,EAAO,EAAQ,QAAgCC,IAC/CC,EAA+B,EAAQ,QAEvCC,EAAsBD,EAA6B,OAKvD/B,EAAE,CAAEK,OAAQ,QAASC,OAAO,EAAMC,QAASyB,GAAuB,CAChEF,IAAK,SAAaG,GAChB,OAAOJ,EAAKnB,KAAMuB,EAAYrB,UAAUC,OAAS,EAAID,UAAU,QAAKE,O,yCCZxE,IAAIoB,EAAS,W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.bff86592.js","sourcesContent":["'use strict';\nvar $ = require('../internals/export');\nvar notARegExp = require('../internals/not-a-regexp');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar toString = require('../internals/to-string');\nvar correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');\n\n// `String.prototype.includes` method\n// https://tc39.es/ecma262/#sec-string.prototype.includes\n$({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {\n includes: function includes(searchString /* , position = 0 */) {\n return !!~toString(requireObjectCoercible(this))\n .indexOf(toString(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","var isRegExp = require('../internals/is-regexp');\n\nmodule.exports = function (it) {\n if (isRegExp(it)) {\n throw TypeError(\"The method doesn't accept regular expressions\");\n } return it;\n};\n","var wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar MATCH = wellKnownSymbol('match');\n\nmodule.exports = function (METHOD_NAME) {\n var regexp = /./;\n try {\n '/./'[METHOD_NAME](regexp);\n } catch (error1) {\n try {\n regexp[MATCH] = false;\n return '/./'[METHOD_NAME](regexp);\n } catch (error2) { /* empty */ }\n } return false;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $includes = require('../internals/array-includes').includes;\nvar addToUnscopables = require('../internals/add-to-unscopables');\n\n// `Array.prototype.includes` method\n// https://tc39.es/ecma262/#sec-array.prototype.includes\n$({ target: 'Array', proto: true }, {\n includes: function includes(el /* , fromIndex = 0 */) {\n return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables('includes');\n","'use strict';\nvar $ = require('../internals/export');\nvar $map = require('../internals/array-iteration').map;\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');\n\n// `Array.prototype.map` method\n// https://tc39.es/ecma262/#sec-array.prototype.map\n// with adding support of @@species\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {\n map: function map(callbackfn /* , thisArg */) {\n return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"view view--toolbar\"},[_c('Toolbar',[_c('h2',{},[_vm._v(\"Abonnement opschorten\")])]),_c('Content',[(_vm.cancellationScheduled || _vm.errorState === 'SUBSCRIPTIONALREADYCANCELED')?[_c('h2',[_vm._v(\"Ik wil mijn abonnement opschorten\")]),_c('p',[_vm._v(\"Je hebt je abonnement al opgezegd. \"),_c('router-link',{staticClass:\"link\",attrs:{\"to\":{ name: 'subscriptionCancel' }}},[_c('span',[_vm._v(\"klik hier\")])]),_vm._v(\" om je opzegging ongedaan te maken.\")],1)]:(_vm.errorState === 'COULDNOTLOADSUBSCRIPTION')?[_c('h2',[_vm._v(\"Ik wil mijn abonnement opschorten\")]),_c('p',[_vm._v(\"Er is wat fout gegaan bij het verwerken van je opschorting, probeer het nogmaals of neem contact op met de \"),_c('router-link',{staticClass:\"link\",attrs:{\"to\":{ name: 'help' }}},[_c('span',[_vm._v(\"BFNL klantenservice\")])]),_vm._v(\".\")],1)]:[_c('h2',[_vm._v(\"Ik wil mijn abonnement opschorten\")]),(\n _vm.inputFields &&\n _vm.currentStateIs(this.states.INITIAL) ||\n _vm.currentStateIs(this.states.LOADING) ||\n _vm.currentStateIs(this.states.ERROR)\n )?_c('form',{attrs:{\"novalidate\":\"\"},on:{\"submit\":function($event){$event.preventDefault();return _vm.suspendSubscription()}}},[_c('p',{staticClass:\"paragraph\"},[_vm._v(\" Opschorting bij zwangerschap, ziekte of blessure is mogelijk wanneer je hierdoor minimaal één maand niet kunt sporten. Vul onderstaand formulier in om de opschorting aan te vragen. \")]),_c('h3',[_vm._v(\"De opschorting verloopt automatisch\")]),_c('p',{staticClass:\"paragraph\"},[_vm._v(\" Zo kan je zonder verdere acties het sporten weer oppakken. Is het nodig om de opschorting te verlengen? Laat dit aan ons weten vóór de einddatum van de opschorting. \")]),_c('h3',[_vm._v(\"Ik ben zwanger\")]),_c('p',{staticClass:\"paragraph\"},[_vm._v(\" Gefeliciteerd met je zwangerschap! \"),_c('ul',[_c('li',[_vm._v(\" Je abonnement wordt gepauzeerd van 6 weken voor de uitgerekende datum tot 10 weken erna. We verwerken dit niet met terugwerkende kracht. \")]),_c('li',[_vm._v(\" Wil je langer dan de standaard 16 weken opschorten? Upload dan in plaats van je zwangerschapsverklaring een medische verklaring waaruit blijkt dat je aanvullende medische redenen hebt om langer dan 16 weken op te schorten. \")])])]),_c('hr'),_vm._l((_vm.inputFields),function(field,index){return _c('FormInput',{key:(\"field-\" + (field.name)),ref:index,refInFor:true,attrs:{\"inputField\":field}})}),_c('FormButton',{attrs:{\"caption\":'Abonnement opschorten',\"loading\":_vm.currentStateIs(this.states.LOADING)}})],2):_vm._e(),(_vm.currentStateIs(this.states.COMPLETE))?_c('AlertInfo',[_vm._v(\" Bedankt voor de informatie. Jouw aanvraag tot opschorting is verstuurd.\"),_c('br'),_vm._v(\" We gaan met jouw aanvraag aan de slag. Binnenkort ontvang je per e-mail meer informatie. \")]):_vm._e()]],2)],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\r\nimport Component, { mixins } from 'vue-class-component'\r\nimport { State } from '@/mixins/state'\r\n\r\nimport { SubscriptionApi } from '@/api'\r\n\r\nimport Content from '@/components/Content.vue'\r\nimport Toolbar from '@/components/Layout/Toolbar.vue'\r\nimport FormInput, { InputField, FormInputInstance } from '@/components/Form/Input.vue'\r\nimport FormButton from '@/components/Form/Button.vue'\r\nimport { isArray } from 'lodash'\r\nimport { User } from '@/types'\r\nimport { Watch } from 'vue-property-decorator'\r\n\r\ninterface InputFields {\r\n suspendFrom: InputField;\r\n suspendTo: InputField;\r\n declarationFile: InputField;\r\n explanation: InputField;\r\n}\r\n\r\nconst ErrorStrings = ['NOERROR', 'COULDNOTLOADSUBSCRIPTION', 'SUBSCRIPTIONALREADYCANCELED'] as const\r\ntype ErrorTypes = typeof ErrorStrings[number]\r\n\r\n@Component({\r\n components: {\r\n Content,\r\n Toolbar,\r\n FormInput,\r\n FormButton\r\n }\r\n})\r\nexport default class SubscriptionSuspend extends mixins(State) {\r\n inputFields: InputFields = {\r\n suspendFrom: {\r\n name: 'suspendFrom',\r\n value: '',\r\n required: true,\r\n type: 'date',\r\n placeholder: 'Graag opschorten vanaf',\r\n errors: [],\r\n min: this.minFromDate\r\n },\r\n suspendTo: {\r\n name: 'suspendTo',\r\n value: '',\r\n required: true,\r\n type: 'date',\r\n placeholder: 'Graag opschorten tot',\r\n errors: [],\r\n min: this.minToDate,\r\n disabled: true\r\n },\r\n declarationFile: {\r\n name: 'declarationFile',\r\n value: '',\r\n required: true,\r\n type: 'file',\r\n placeholder: 'Upload medische verklaring of zwangerschapsverklaring',\r\n errors: [],\r\n customErrorMessage: 'Vergeet niet je bestand te uploaden',\r\n info: 'Je kunt de volgende bestandstypen uploaden: .jpg, .png, .pdf',\r\n infoColor: 'black',\r\n inputExplanationParagraph: 'Voorbeelden medische verklaring: verwijsbrief, opname afspraak, verklaring fysiotherapeut. Vertrouwelijke informatie mag je onleesbaar maken.'\r\n },\r\n explanation: {\r\n name: 'explanation',\r\n value: '',\r\n required: true,\r\n type: 'textarea',\r\n placeholder: 'Toelichting',\r\n errors: []\r\n }\r\n }\r\n\r\n errorState: ErrorTypes = 'NOERROR'\r\n\r\n get errorStatem (): ErrorTypes {\r\n return this.errorState\r\n }\r\n\r\n get currentUser (): User {\r\n return this.$store.state.currentUser\r\n }\r\n\r\n get cancellationScheduled (): boolean {\r\n return this.currentUser.subscriptionDetails?.cancellationProcessDate !== null\r\n }\r\n\r\n get subscription () {\r\n return this.currentUser.subscriptionDetails\r\n }\r\n\r\n get minFromDate () {\r\n const date = new Date()\r\n date.setDate(date.getDate() + 1)\r\n return `${date.getFullYear()}-${`0${date.getMonth() + 1}`.slice(-2)}-${`0${date.getDate()}`.slice(-2)}`\r\n }\r\n\r\n get minToDate () {\r\n if (this.inputFields?.suspendFrom.value) {\r\n const date = new Date(this.inputFields.suspendFrom.value)\r\n date.setMonth(date.getMonth() + 1)\r\n return `${date.getFullYear()}-${`0${date.getMonth() + 1}`.slice(-2)}-${`0${date.getDate()}`.slice(-2)}`\r\n }\r\n return this.minFromDate\r\n }\r\n\r\n @Watch('inputFields.suspendFrom.value')\r\n onSuspendFromDateChanged () {\r\n if (this.inputFields) {\r\n if (this.inputFields.suspendFrom.value !== '') {\r\n this.inputFields.suspendTo.value = this.minToDate\r\n this.inputFields.suspendTo.disabled = false\r\n }\r\n this.inputFields.suspendTo.min = this.minToDate\r\n }\r\n }\r\n\r\n public async suspendSubscription () {\r\n this.clearErrors()\r\n if (!this.validate() || !this.inputFields) {\r\n return\r\n }\r\n\r\n const api = new SubscriptionApi()\r\n try {\r\n this.state = this.states.LOADING\r\n this.clearErrors()\r\n await api.subscriptionSuspend({\r\n subscriptionId: this.currentUser.subscription?.subscriptionId || 0,\r\n suspendFrom: this.inputFields.suspendFrom.value,\r\n suspendTo: this.inputFields.suspendTo.value,\r\n explanation: this.inputFields.explanation.value,\r\n uploadId: this.inputFields.declarationFile.value\r\n }\r\n )\r\n\r\n this.state = this.states.COMPLETE\r\n } catch (error) {\r\n this.state = this.states.ERROR\r\n\r\n const errorsWithoutKeys = Object.entries(error.response.data.errors).filter(it => it[0] === '').map(it => (it[1] as string).toString().toUpperCase())\r\n if (errorsWithoutKeys.includes(ErrorStrings[1] as string)) {\r\n this.errorState = 'COULDNOTLOADSUBSCRIPTION'\r\n } else if (errorsWithoutKeys.includes(ErrorStrings[2] as string)) {\r\n this.errorState = 'SUBSCRIPTIONALREADYCANCELED'\r\n } else {\r\n this.setErrors(error.response.data.errors)\r\n }\r\n }\r\n }\r\n\r\n public setErrors (errors: []) {\r\n if (this.inputFields) {\r\n Object.entries(errors).forEach(([errorKey, errorValue]) => {\r\n Object.entries(this.inputFields).forEach(([fieldKey, fieldValue]) => {\r\n if (errorKey.toLowerCase() === fieldKey.toLowerCase()) {\r\n fieldValue.errors = errorValue\r\n }\r\n })\r\n })\r\n }\r\n }\r\n\r\n public clearErrors () {\r\n if (this.inputFields) {\r\n Object.values(this.inputFields).forEach((fieldValue: InputField) => {\r\n fieldValue.errors = []\r\n })\r\n }\r\n }\r\n\r\n public validate () {\r\n let valid = true\r\n if (this.inputFields) {\r\n Object.values(this.inputFields).forEach((fieldValue: InputField) => {\r\n const field = (this.$refs[fieldValue.name] as FormInputInstance)\r\n if (isArray(field)) {\r\n valid = field.every((inputField: FormInputInstance) => inputField.validate()) && valid\r\n } else {\r\n valid = field.validate() && valid\r\n }\r\n })\r\n return valid\r\n }\r\n }\r\n}\r\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--14-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??ref--14-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Suspend.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--14-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??ref--14-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Suspend.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./Suspend.vue?vue&type=template&id=6d3eea5a&\"\nimport script from \"./Suspend.vue?vue&type=script&lang=ts&\"\nexport * from \"./Suspend.vue?vue&type=script&lang=ts&\"\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":""}