{"version":3,"sources":["webpack:///./src/pages/registration.vue","webpack:///./src/domain/services/registration-service.js","webpack:///src/pages/registration.vue","webpack:///./src/pages/registration.vue?6156","webpack:///./src/pages/registration.vue?8d2b","webpack:///./src/pages/registration.vue?60d6"],"names":["render","_vm","this","_c","_self","staticClass","on","goToBackDestination","_v","_s","backDestinationText","$tr","attrs","event","formLink","formId","handleRegFormSubmit","scopedSlots","_u","key","fn","submit","formSubmit","isLoading","staticRenderFns","RegistrationService","eventId","linkedEventId","store","state","registration","childReg","getEventLinks","useEvent","eventLinksWithEventData","catch","e","console","error","link","find","e2e","compareId","childId","quickRegistration","useRegistration","commit","components","AppForm","AppContentItems","DirectionLeftIcon","data","paramsLegalAgreement","filter","userId","computed","methods","form","email","createRegistrationData","getUser","path","query","auth","domainId","currentEventId","agreement","fromRegistration","component"],"mappings":"qHAAA,IAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,MAAM,CAACE,YAAY,gBAAgB,CAACF,EAAG,MAAM,CAACE,YAAY,4BAA4B,CAACF,EAAG,MAAM,CAACE,YAAY,wBAAwB,CAACF,EAAG,MAAM,CAACE,YAAY,eAAe,CAACF,EAAG,MAAM,CAACE,YAAY,iDAAiDC,GAAG,CAAC,MAAQL,EAAIM,sBAAsB,CAACJ,EAAG,OAAO,CAACE,YAAY,0BAA0B,CAACF,EAAG,sBAAsB,GAAGA,EAAG,OAAO,CAACE,YAAY,0CAA0C,CAACJ,EAAIO,GAAG,IAAIP,EAAIQ,GAAGR,EAAIS,qBAAqB,eAAeP,EAAG,KAAK,CAACE,YAAY,mCAAmC,CAACJ,EAAIO,GAAG,IAAIP,EAAIQ,GAAGR,EAAIU,IAAI,uBAAuB,OAAOR,EAAG,MAAM,CAACE,YAAY,0CAA0C,CAACF,EAAG,UAAU,CAACS,MAAM,CAAC,UAAUX,EAAIY,MAAMC,SAASC,QAAQT,GAAG,CAAC,OAASL,EAAIe,qBAAq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,SACA,sCAAAC,GAAA,EACA,kBAEA,IACA,MAAAC,SAAA,iCACA,uBAAAC,GAAA,uBAEA,GACAF,OACA/B,sBACA4B,uCAGA,sBAAAzC,qBAEA,cAAA+C,GAAA,iBACA,yCACA,iDACA,gDAEA,qBACAC,6BACAC,OAAAJ,yBAEA,SACA,4DACArB,iBACA,QACA,oBAIA,4BACA,gDACA,4CACA,UACA,sEACA,qBAAAwB,iBACA,eACA,qBAAAA,cACA,QACA,iDAEA,CACA,mBACAE,wBACA,qBAAAF,kBAGA,uBACA,yCACA,8CACA,8CACAG,EACAC,EACA,mBAEA,0BACA,2CACA,2BAEA,aACA,OAEA,oBACA,eACAC,yBAEA,4BAEA,GACA,mBACAL,aACAC,OACAI,aACAC,0BC1KsV,I,wBCQlVC,EAAY,eACd,EACApE,EACAwB,GACA,EACA,KACA,KACA,MAIa,aAAA4C,E,2CCnBf,W","file":"js/registration.9a5eb8d6.js","sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"registration\"},[_c('div',{staticClass:\"auth__header auth-header\"},[_c('div',{staticClass:\"auth-header__actions\"},[_c('div',{staticClass:\"header-back\"},[_c('div',{staticClass:\"header-back__content s-card s-card--no-padding\",on:{\"click\":_vm.goToBackDestination}},[_c('span',{staticClass:\"header-back__back-icon\"},[_c('DirectionLeftIcon')],1),_c('span',{staticClass:\"header-back__text s-subtitle-secondary\"},[_vm._v(\" \"+_vm._s(_vm.backDestinationText)+\" \")])])])])]),_c('h1',{staticClass:\"registration__title auth__title\"},[_vm._v(\" \"+_vm._s(_vm.$tr('registration.title'))+\" \")]),_c('div',{staticClass:\"s-card registration__registration-form\"},[_c('AppForm',{attrs:{\"form-id\":_vm.event.formLink.formId},on:{\"submit\":_vm.handleRegFormSubmit},scopedSlots:_vm._u([{key:\"submit\",fn:function({ submit: formSubmit }){return [_c('Portal',{attrs:{\"to\":\"registration-submit\"}},[_c('Button',{staticClass:\"registration-footer__submit\",attrs:{\"type\":\"primary\",\"size\":\"large\",\"disabled\":_vm.isLoading},on:{\"click\":formSubmit}},[_vm._v(\" \"+_vm._s(_vm.$tr('registration.submitBtn'))+\" \")])],1)]}}])})],1),_c('div',{staticClass:\"registration__registration-footer\"},[_c('div',{staticClass:\"row registration-footer\"},[_c('div',{staticClass:\"col-sm-12 col-lg-4 registration-footer__submit-wrapper\"},[_c('PortalTarget',{attrs:{\"name\":\"registration-submit\"}})],1),_c('div',{staticClass:\"col-sm-12 col-lg-8\"},[_c('AppContentItems',{staticClass:\"registration-footer__content-items\"})],1)])])])\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","import useRegistration from '@/domain/composables/use-registration'\nimport useEvent from '@/domain/composables/use-event'\nimport store from '@/store'\nimport { compareId } from '@/utils'\n\nexport default class RegistrationService {\n  static async handleLinkedRegistration(eventId) {\n    try {\n      const linkedEventId = store.state.registration.childReg\n\n      if (!linkedEventId) {\n        return\n      }\n      const { getEventLinks } = useEvent()\n\n      const eventLinksWithEventData = await getEventLinks(eventId).catch(\n        (e) => {\n          console.error(e)\n          return []\n        },\n      )\n\n      const link = eventLinksWithEventData.find((e2e) =>\n        compareId(e2e.childId, linkedEventId),\n      )\n\n      if (!link) {\n        console.error(`event ${linkedEventId} is not child of event ${eventId}`)\n        return\n      }\n\n      if (!link.quickRegistration) {\n        console.error(\n          `event ${linkedEventId} does not have a quick registration`,\n        )\n        return\n      }\n\n      const { quickRegistration } = useRegistration()\n      await quickRegistration(linkedEventId, eventId)\n    } catch (e) {\n      throw e\n    } finally {\n      store.commit('registration/SET_CHILD_REG', null)\n    }\n  }\n}\n","<template>\n  <div class=\"registration\">\n    <div class=\"auth__header auth-header\">\n      <div class=\"auth-header__actions\">\n        <div class=\"header-back\">\n          <div\n            class=\"header-back__content s-card s-card--no-padding\"\n            @click=\"goToBackDestination\"\n          >\n            <span class=\"header-back__back-icon\">\n              <DirectionLeftIcon />\n            </span>\n            <span class=\"header-back__text s-subtitle-secondary\">\n              {{ backDestinationText }}\n            </span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <h1 class=\"registration__title auth__title\">\n      {{ $tr('registration.title') }}\n    </h1>\n    <div class=\"s-card registration__registration-form\">\n      <AppForm :form-id=\"event.formLink.formId\" @submit=\"handleRegFormSubmit\">\n        <template #submit=\"{ submit: formSubmit }\">\n          <Portal to=\"registration-submit\">\n            <Button\n              type=\"primary\"\n              size=\"large\"\n              :disabled=\"isLoading\"\n              class=\"registration-footer__submit\"\n              @click=\"formSubmit\"\n            >\n              {{ $tr('registration.submitBtn') }}\n            </Button>\n          </Portal>\n        </template>\n      </AppForm>\n    </div>\n    <div class=\"registration__registration-footer\">\n      <div class=\"row registration-footer\">\n        <div class=\"col-sm-12 col-lg-4 registration-footer__submit-wrapper\">\n          <PortalTarget name=\"registration-submit\"></PortalTarget>\n        </div>\n        <div class=\"col-sm-12 col-lg-8\">\n          <AppContentItems class=\"registration-footer__content-items\" />\n        </div>\n      </div>\n    </div>\n  </div>\n</template>\n\n<script>\nimport { mapState } from 'vuex'\n\nimport AppForm from '@/components/common/app-form'\nimport useForm from '@/domain/composables/use-form'\nimport AppContentItems from '@/components/common/app-content-items'\nimport LangService from '@/domain/services/lang-service'\nimport DirectionLeftIcon from '@/components/themed-icons/direction-left'\nimport AuthService from '@/domain/services/auth-service'\nimport useDomainContent from '@/domain/composables/use-domain-content'\nimport useLegalAgreement from '@/domain/composables/use-legal-agreement'\nimport useUser from '@/domain/composables/use-user'\nimport RegistrationService from '@/domain/services/registration-service'\n\n// todo: разобраться с заходом по прямой ссылке во внутреннее мероприятие пользователя, зареганного на родительском\nexport default {\n  components: {\n    AppForm,\n    AppContentItems,\n    DirectionLeftIcon,\n  },\n  data() {\n    return {\n      isLoading: false,\n      paramsLegalAgreement: {\n        filter: { userId: this.$store.state.auth.userId },\n      },\n    }\n  },\n  computed: {\n    ...mapState({\n      event: (state) => state.event.data,\n    }),\n\n    backDestinationText() {\n      if (this.$store.getters['isActiveEventIsChild']) {\n        return this.$tr('registration.back.events')\n      }\n      return this.$tr('registration.back.login')\n    },\n  },\n\n  methods: {\n    async handleRegFormSubmit({ form }) {\n      this.isLoading = true\n\n      try {\n        const { email: userEmail } = this.$store.state.auth.userData\n        const { createRegistrationData } = useForm()\n\n        await createRegistrationData({\n          form,\n          eventId: this.event.id,\n          userId: this.$store.state.auth.userId,\n        })\n\n        this.$gtm.trackEvent({ event: 'reg-anketa' })\n\n        const { getUser } = useUser()\n        const user = await getUser(this.$store.state.auth.userId)\n        this.$store.commit('auth/SET_USER_DATA', user)\n        await RegistrationService.handleLinkedRegistration(this.event.id)\n\n        await LangService.toLocalePath({\n          path: '/registration/success',\n          query: { email: userEmail.toLowerCase() },\n        })\n      } catch (e) {\n        this.$Message.error(this.$tr('registration.errors.create'))\n        console.error(e)\n      } finally {\n        this.isLoading = false\n      }\n    },\n\n    async goToBackDestination() {\n      if (this.$store.getters['isActiveEventIsChild']) {\n        this.$store.commit('SET_APP_IS_LOADING', true)\n        try {\n          await this.loadFullEvent(this.$store.getters['domain/parentEventId'])\n          await LangService.toLocalePath({ path: '/events' })\n        } catch (e) {\n          await LangService.toLocalePath({ path: '/404' })\n        } finally {\n          this.$store.commit('SET_APP_IS_LOADING', false)\n        }\n      } else {\n        const auth = new AuthService()\n        auth.unsetAuthData()\n        await LangService.toLocalePath({ path: '/login' })\n      }\n    },\n    async checkAgreement() {\n      const domainId = this.$store.state.domain.data.id\n      const currentEventId = this.$store.getters['event/currentEventId']\n      const contentItems = await useDomainContent().getAgreementItemList(\n        domainId,\n        currentEventId,\n        this.$i18n.locale,\n      )\n      const requiredAgreements = contentItems.filter((item) => item.required)\n      const userAgreements = await useLegalAgreement().getLegalAgreement(\n        this.paramsLegalAgreement,\n      )\n      if (!contentItems.length) {\n        return\n      }\n      const allAgreementsApproved = requiredAgreements.every((required) => {\n        const userAgreement = userAgreements.find(\n          (agreement) => +agreement.contentId === +required.id,\n        )\n        return userAgreement && userAgreement.approved === true\n      })\n      if (!allAgreementsApproved) {\n        this.$router.push({\n          path: `/user`,\n          query: {\n            agreement: true,\n            fromRegistration: true,\n          },\n        })\n      }\n    },\n  },\n}\n</script>\n<style lang=\"scss\">\n@import '~@/styles/pages/registration-page.scss';\n@import '~@/styles/pages/login.scss';\n@import '~@/styles/blocks/header-back.scss';\n</style>\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./registration.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./registration.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./registration.vue?vue&type=template&id=2d0c9d5f&\"\nimport script from \"./registration.vue?vue&type=script&lang=js&\"\nexport * from \"./registration.vue?vue&type=script&lang=js&\"\nimport style0 from \"./registration.vue?vue&type=style&index=0&id=2d0c9d5f&prod&lang=scss&\"\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","export * from \"-!../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--9-oneOf-1-0!../../node_modules/css-loader/dist/cjs.js??ref--9-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--9-oneOf-1-2!../../node_modules/sass-loader/dist/cjs.js??ref--9-oneOf-1-3!../../node_modules/style-resources-loader/lib/index.js??ref--9-oneOf-1-4!../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./registration.vue?vue&type=style&index=0&id=2d0c9d5f&prod&lang=scss&\""],"sourceRoot":""}