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AgB,KAChBQ,6BAA8B,KAC9BhB,eAAe,EACfoE,cAAc,GCzCD,SAASC,IACtB,MAAMC,EAAKC,SAASC,cAAc,iEAC5B,YAAE1E,KAAgB2E,GAAiBzB,KAAK0B,MAAMJ,EAAGK,QAAQC,WAC/DH,EAAatD,gBAAkBsD,EAAarD,UAAUC,QAAQvB,GAE9D,MAAMxF,EAAQ,IAAIuK,KAAiBJ,GAEnC,OAAOK,EAAAA,EAAAA,IAAY,CACjBxK,QACAwE,QAAO,EACPiG,UAAS,EACTC,QACF,GACF,C","sources":["webpack://agra/./app/javascript/campaign-form-shared/store/mutations.js","webpack://agra/./app/javascript/campaign-form-shared/store/state.js","webpack://agra/./app/javascript/campaign-form-shared/store/actions.js","webpack://agra/./app/javascript/petition/start/store/actions.js","webpack://agra/./app/javascript/petition/start/store/mutations.js","webpack://agra/./app/javascript/petition/start/store/getters.js","webpack://agra/./app/javascript/petition/start/store/state.js","webpack://agra/./app/javascript/petition/start/store/index.js"],"sourcesContent":["export default {\n setPublishUrl(state, publishUrl) {\n state.publishUrl = publishUrl\n },\n\n setLinkUserUrl(state, linkUserUrl) {\n state.linkUserUrl = linkUserUrl\n },\n\n setValidationErrors(state, validationErrors) {\n state.validationErrors = validationErrors\n },\n\n setAuthenticationModalData(state, authenticationModalData) {\n state.authenticationModalData = Object.assign(state.authenticationModalData, authenticationModalData)\n },\n\n setDisplayMissingInfoModal(state, { value, requiredFields }) {\n state.displayMissingInfoModal = value\n state.missingInfoRequiredFields = requiredFields\n },\n\n setDisplayUserAccountCreationAwaitingEmailConfirmation(state, { value, userEmail }) {\n state.displayUserAccountCreationAwaitingEmailConfirmation = value\n state.userEmailAddressAwaitingConfirmation = userEmail\n },\n\n setDisplayVerifyMfaTokenModal(state, { value, mfaParameters }) {\n state.displayVerifyMfaTokenModal = value\n state.mfaParameters = mfaParameters\n },\n\n setDisplayAuthenticationModal(state, displayAuthenticationModal) {\n state.displayAuthenticationModal = displayAuthenticationModal\n },\n\n setDisplayAwaitingApprovalModal(state, displayAwaitingApprovalModal) {\n state.displayAwaitingApprovalModal = displayAwaitingApprovalModal\n }\n}\n","export default {\n // Where to submit to publish after user authenticates\n publishUrl: null,\n\n // Where to submit to link user to new campaign\n linkUserUrl: null,\n\n // Text to display on the form, organised by field\n content: {},\n\n // Extra parameters we should submit with the form\n extraParameters: {},\n\n // If the user can choose to associate the event with a partnership, the list of options\n partnershipOptions: [],\n\n // Flag indicating if the \"campaign awaiting approval\" modal should be displayed\n displayAwaitingApprovalModal: false,\n\n //// Sign in / sign up properties\n authenticationModalData: {\n // SSO options\n enableFacebookLogin: false,\n facebookLoginUrl: null,\n enableGoogleLogin: false,\n googleLoginUrl: null,\n\n askForCountry: null,\n countryData: null,\n askForPostcode: null,\n phoneNumberMandatory: null,\n\n emailOptInTypeData: null,\n\n newAccountDisclaimer: null,\n\n // EU Data processing consent\n showEuDataProcessingConsent: false,\n euDataProcessingConsentData: null,\n\n termsOfServiceData: null,\n\n organisationId: null,\n additionalFieldConfigs: []\n },\n\n // Flag indicating if the user authentication modal should be displayed\n displayAuthenticationModal: false,\n\n // Flag indicating if the modal notifying user that account creation is pending\n // email confirmation should be displayed\n displayUserAccountCreationAwaitingEmailConfirmation: false,\n\n // Flag indicating if the MFA token verification modal should be displayed\n displayVerifyMfaTokenModal: false,\n\n // Flag indicating if the modal to collect missing user account info should be displayed\n displayMissingInfoModal: false,\n\n // Error message for non recoverable error during sign up (e.g.: member is banned)\n nonRecoverableErrorOnSignup: null,\n\n // Email address of the user that's awaiting to be confirmed\n userEmailAddressAwaitingConfirmation: null,\n\n // Setup information for the MFA token verification modal\n mfaParameters: {\n userId: null,\n statusCheckPath: null,\n supportsSms: false,\n tokenHelpText: null,\n verifyTokenPath: null\n },\n\n // Setup information for the Missing Info modal\n missingInfoRequiredFields: []\n}\n","import ajax from '../../helpers/ajax'\n\nexport default {\n linkCampaignWithUnconfirmedUser({ state }, userToken) {\n ajax.put({\n url: state.linkUserUrl,\n data: {\n user_token: userToken\n },\n errorHandler: (response) => {\n window.errorLogger.error(`Error linking campaign with user: ${response}`)\n }\n })\n }\n}\n","import sharedActions from '@/campaign-form-shared/store/actions'\nimport ajax from '@/helpers/ajax'\nimport { objectKeysToSnakeCase } from '@/helpers/transform-object-keys'\nimport { trackEvent } from '@/analytics/track'\n\nfunction createPetitionStart({ state, commit, dispatch }) {\n commit('setSubmitInProgress', true)\n\n return new Promise((resolve) => {\n ajax.post({\n url: state.createUrl,\n data: {\n petition: objectKeysToSnakeCase({\n ...state.values,\n locale: state.extraParameters.locale,\n source: state.extraParameters.source,\n external_action_id: state.extraParameters.external_action_id\n })\n },\n successHandler: (response) => {\n if (response.success) {\n commit('setPetitionStartToken', response.petition.token)\n commit('setUpdateUrl', response.updateUrl)\n commit('setPublishUrl', response.publishUrl)\n commit('setRequestHelpUrl', response.requestHelpUrl)\n commit('setPetitionStartCreated', true)\n commit('setCurrentField', response.petition.currentStep)\n commit('setPetitionStartUrl', response.petitionStartUrl)\n\n dispatch('trackFieldShown')\n\n // Clear validation errors\n commit('setValidationErrors', {})\n } else {\n commit('setValidationErrors', response.validationErrors)\n }\n\n commit('setSubmitInProgress', false)\n resolve(response.success)\n }\n })\n })\n}\n\nfunction updatePetitionStart({ state, commit, getters, dispatch }) {\n commit('setSubmitInProgress', true)\n\n return new Promise((resolve) => {\n ajax.put({\n url: state.updateUrl,\n data: {\n petition: objectKeysToSnakeCase(state.values)\n },\n successHandler: (response) => {\n if (response.success) {\n if (response.finished) {\n // Last step is either authenticating the user to associate with the new petition\n // or redirecting to the petition page (if the user was already signed in)\n if (response.requiresAuthentication) {\n if (response.forceSingleSignOn) {\n window.location = response.singleSignOnRedirect.url\n } else {\n commit('setAuthenticationModalData', response.authenticationModalData)\n commit('setDisplayAuthenticationModal', true)\n commit('setLinkUserUrl', response.linkUserUrl)\n\n trackEvent(\n 'Login/Signup Modal Shown',\n {\n action: 'auth-modal-shown',\n category: 'petition-start-form'\n }\n )\n }\n } else if (response.requiresApproval) {\n commit('setDisplayAwaitingApprovalModal', true)\n } else if (response.redirectUrl) {\n window.location = response.redirectUrl\n }\n } else {\n commit('setCurrentField', response.petition.currentStep)\n dispatch('trackFieldShown')\n }\n\n // Clear validation errors\n commit('setValidationErrors', {})\n commit('clearRequestHelpPrompt')\n } else {\n commit('setValidationErrors', response.validationErrors)\n\n if (response.helpPromptEnabled && !state.helpRequested) {\n commit('setRequestHelpPromptOnField', getters.firstFieldWithError)\n } else {\n commit('clearRequestHelpPrompt')\n }\n }\n\n commit('setSubmitInProgress', false)\n resolve(response.success)\n }\n })\n })\n}\n\nexport default {\n ...sharedActions,\n\n publish({ state, commit }) {\n commit('setSubmitInProgress', true)\n\n ajax.post({\n url: state.publishUrl,\n successHandler: (response) => {\n commit('setSubmitInProgress', false)\n if (response.success) {\n if (response.requiresApproval) {\n commit('setDisplayAwaitingApprovalModal', true)\n } else {\n window.location = response.redirectUrl\n }\n }\n }\n })\n },\n\n submitField({ state, commit, getters, dispatch }) {\n if (!state.petitionStartCreated) {\n return createPetitionStart({ state, commit, dispatch })\n } else {\n return updatePetitionStart({ state, commit, getters, dispatch })\n }\n },\n\n trackFieldShown({ getters }) {\n trackEvent(\n getters.trackingEventNameForCurrentField,\n getters.trackingEventDataForCurrentField\n )\n }\n}\n","import sharedMutations from '@/campaign-form-shared/store/mutations'\n\nexport default {\n ...sharedMutations,\n clearRequestHelpPrompt(state) {\n state.fieldToShowRequestHelpPrompt = null\n },\n\n setCurrentField(state, currentField) {\n state.currentFieldIdx = state.allFields.indexOf(currentField)\n },\n\n setHelpRequested(state) {\n state.helpRequested = true\n },\n\n setPetitionStartCreated(state, value) {\n state.petitionStartCreated = value\n },\n\n setPetitionStartToken(state, token) {\n state.petitionStartToken = token\n },\n\n setPetitionStartUrl(state, petitionStartUrl) {\n state.petitionStartUrl = petitionStartUrl\n history.pushState({ token: state.petitionStartToken }, '', state.petitionStartUrl)\n },\n\n setSubmitInProgress(state, value) {\n state.submitInProgress = value\n },\n\n setNonRecoverableErrorOnSignup(state, errorMessage) {\n state.nonRecoverableErrorOnSignup = errorMessage\n },\n\n setUpdateUrl(state, updateUrl) {\n state.updateUrl = updateUrl\n },\n\n setRequestHelpUrl(state, requestHelpUrl) {\n state.requestHelpUrl = requestHelpUrl\n },\n\n setRequestHelpPromptOnField(state, field) {\n state.fieldToShowRequestHelpPrompt = field\n },\n\n setValue(state, {field, value}) {\n state.values[field] = value\n\n // Clear error on field if there was one\n if (state.validationErrors[field]) {\n let clonedValidationErrors = Object.assign({}, state.validationErrors)\n delete clonedValidationErrors[field]\n\n state.validationErrors = clonedValidationErrors\n }\n }\n}\n","import camelCase from 'lodash/camelCase'\n\nexport default {\n contentForNextField: (state, getters) => {\n return state.content[getters.nextField]\n },\n\n currentlyShownFields: (state) => {\n return state.allFields.slice(0, state.currentFieldIdx + 1)\n },\n\n firstFieldWithError: (state) => {\n if (Object.keys(state.validationErrors).length === 0) {\n return null\n }\n\n for (let fieldIndex in state.allFields) {\n const fieldName = state.allFields[fieldIndex]\n if (state.validationErrors[camelCase(fieldName)]) {\n return fieldName\n }\n }\n\n throw `Could not find field for validation error. Validation errors: ${JSON.stringify(state.validationErrors)}`\n },\n\n lastShownField: (_state, getters) => {\n const shownFields = getters.currentlyShownFields\n return shownFields[shownFields.length - 1]\n },\n\n nextField: (state) => {\n return state.allFields[state.currentFieldIdx + 1]\n },\n\n onFirstField: (state) => {\n return state.currentFieldIdx === 0\n },\n\n onLastField: (state) => {\n return state.currentFieldIdx + 1 === state.allFields.length\n },\n\n pendingGeocodingOnNextSubmit: (state) => {\n // Location field is visible, user chose 'local' option but geocoded location is missing\n return state.values.locationKind === 'local' &&\n (!state.values.location || !state.values.location.latitude)\n },\n\n progressPercentage: (state) => {\n // This is the case before the index, fields are initialized and\n // returning 0 before initialization is necessary to make the\n // progress bar animate from 0 to the actual value (instead of from 100%).\n if (state.currentFieldIdx === state.allFields.length) {\n return 0\n }\n // Starts with it partially filled in (1 / (#fields + 1))\n return (state.currentFieldIdx + 1) / (state.allFields.length + 1) * 100\n },\n\n trackingEventDataForCurrentField: (state, getters) => {\n return {\n action: `${getters.lastShownField}-field-shown`,\n category: 'petition-start-form'\n }\n },\n\n trackingEventNameForCurrentField: (_state, getters) => {\n return `${getters.lastShownField} Field Shown`\n }\n}\n","import sharedState from '@/campaign-form-shared/store/state'\n\nexport default {\n ...sharedState,\n\n // Where to submit to create the petition start\n createUrl: null,\n\n // Where to submit to update the petition start\n updateUrl: null,\n\n //\n submitInProgress: false,\n\n // The petition start's URL once it has been created. This allows users to browse back and continue\n // with the petititon start process if they leave the page\n petitionStartUrl: null,\n\n // The list of all fields on the form, and which one we're currently on\n allFields: [],\n currentFieldIdx: 0,\n\n // Flag indicating if the petition start has been already created or not\n petitionStartCreated: false,\n\n // Petition start's token, should only have a value if it has been already created\n petitionStartToken: null,\n\n // When the form has been submitted, submitted values and validation errors by field\n values: {\n partnershipId: null,\n cannotChangeAssociatedPartnership: false,\n localChapterId: null,\n title: '',\n who: '',\n what: '',\n why: '',\n locationKind: null,\n location: null,\n utmParams: {}\n },\n\n validationErrors: {},\n\n // State for the Get Help form\n requestHelpUrl: null,\n fieldToShowRequestHelpPrompt: null,\n helpRequested: false,\n userLoggedIn: false\n}\n","import { createStore } from 'vuex'\n\nimport actions from './actions'\nimport mutations from './mutations'\nimport getters from './getters'\nimport defaultState from './state'\n\nexport default function buildStore() {\n const el = document.querySelector('.vue-component-loader[data-component-name=petitionStartForm]')\n const { currentStep, ...initialState } = JSON.parse(el.dataset.storeData)\n initialState.currentFieldIdx = initialState.allFields.indexOf(currentStep)\n\n const state = {...defaultState, ...initialState}\n\n return createStore({\n state,\n getters,\n mutations,\n actions\n })\n}\n"],"names":["setPublishUrl","state","publishUrl","setLinkUserUrl","linkUserUrl","setValidationErrors","validationErrors","setAuthenticationModalData","authenticationModalData","Object","assign","setDisplayMissingInfoModal","value","requiredFields","displayMissingInfoModal","missingInfoRequiredFields","setDisplayUserAccountCreationAwaitingEmailConfirmation","userEmail","displayUserAccountCreationAwaitingEmailConfirmation","userEmailAddressAwaitingConfirmation","setDisplayVerifyMfaTokenModal","mfaParameters","displayVerifyMfaTokenModal","setDisplayAuthenticationModal","displayAuthenticationModal","setDisplayAwaitingApprovalModal","displayAwaitingApprovalModal","content","extraParameters","partnershipOptions","enableFacebookLogin","facebookLoginUrl","enableGoogleLogin","googleLoginUrl","askForCountry","countryData","askForPostcode","phoneNumberMandatory","emailOptInTypeData","newAccountDisclaimer","showEuDataProcessingConsent","euDataProcessingConsentData","termsOfServiceData","organisationId","additionalFieldConfigs","nonRecoverableErrorOnSignup","userId","statusCheckPath","supportsSms","tokenHelpText","verifyTokenPath","linkCampaignWithUnconfirmedUser","userToken","ajax","put","url","data","user_token","errorHandler","response","window","errorLogger","error","sharedActions","publish","commit","post","successHandler","success","requiresApproval","location","redirectUrl","submitField","getters","dispatch","petitionStartCreated","Promise","resolve","updateUrl","petition","objectKeysToSnakeCase","values","finished","requiresAuthentication","forceSingleSignOn","singleSignOnRedirect","trackEvent","action","category","currentStep","helpPromptEnabled","helpRequested","firstFieldWithError","updatePetitionStart","createUrl","locale","source","external_action_id","token","requestHelpUrl","petitionStartUrl","createPetitionStart","trackFieldShown","trackingEventNameForCurrentField","trackingEventDataForCurrentField","sharedMutations","clearRequestHelpPrompt","fieldToShowRequestHelpPrompt","setCurrentField","currentField","currentFieldIdx","allFields","indexOf","setHelpRequested","setPetitionStartCreated","setPetitionStartToken","petitionStartToken","setPetitionStartUrl","history","pushState","setSubmitInProgress","submitInProgress","setNonRecoverableErrorOnSignup","errorMessage","setUpdateUrl","setRequestHelpUrl","setRequestHelpPromptOnField","field","setValue","clonedValidationErrors","contentForNextField","nextField","currentlyShownFields","slice","keys","length","fieldIndex","fieldName","camelCase","JSON","stringify","lastShownField","_state","shownFields","onFirstField","onLastField","pendingGeocodingOnNextSubmit","locationKind","latitude","progressPercentage","sharedState","partnershipId","cannotChangeAssociatedPartnership","localChapterId","title","who","what","why","utmParams","userLoggedIn","buildStore","el","document","querySelector","initialState","parse","dataset","storeData","defaultState","createStore","mutations","actions"],"sourceRoot":""}