Current File : /home/pacjaorg/public_html/wp-content/plugins/civist/civist-wordpress-registration.js |
(window.civistJsonp=window.civistJsonp||[]).push([[9],{471:function(e,t,n){"use strict";var i,a,r={kind:"Request",fragment:{kind:"Fragment",name:"registerTenantMutation",type:"Mutation",metadata:null,argumentDefinitions:i=[{kind:"LocalArgument",name:"input",type:"registerTenantInput!",defaultValue:null}],selections:a=[{kind:"LinkedField",alias:null,name:"registerTenant",storageKey:null,args:[{kind:"Variable",name:"input",variableName:"input",type:"registerTenantInput!"}],concreteType:"registerTenantPayload",plural:!1,selections:[{kind:"ScalarField",alias:null,name:"apiKey",args:null,storageKey:null},{kind:"ScalarField",alias:null,name:"apiUrl",args:null,storageKey:null},{kind:"ScalarField",alias:null,name:"widgetUrl",args:null,storageKey:null},{kind:"ScalarField",alias:null,name:"apiKeyId",args:null,storageKey:null},{kind:"ScalarField",alias:null,name:"oEmbedUrl",args:null,storageKey:null}]}]},operation:{kind:"Operation",name:"registerTenantMutation",argumentDefinitions:i,selections:a},params:{operationKind:"mutation",name:"registerTenantMutation",id:null,text:"mutation registerTenantMutation(\n $input: registerTenantInput!\n) {\n registerTenant(input: $input) {\n apiKey\n apiUrl\n widgetUrl\n apiKeyId\n oEmbedUrl\n }\n}\n",metadata:{}}};r.hash="a9f1e32af77e4e2b279f8876792b5370",e.exports=r},472:function(e,t,n){"use strict";var i,a,r={kind:"Request",fragment:{kind:"Fragment",name:"registerTenantWithRegistrationTokenMutation",type:"Mutation",metadata:null,argumentDefinitions:i=[{kind:"LocalArgument",name:"input",type:"registerTenantWithRegistrationTokenInput!",defaultValue:null}],selections:a=[{kind:"LinkedField",alias:null,name:"registerTenantWithRegistrationToken",storageKey:null,args:[{kind:"Variable",name:"input",variableName:"input",type:"registerTenantWithRegistrationTokenInput!"}],concreteType:"registerTenantWithRegistrationTokenPayload",plural:!1,selections:[{kind:"ScalarField",alias:null,name:"apiKey",args:null,storageKey:null},{kind:"ScalarField",alias:null,name:"apiUrl",args:null,storageKey:null},{kind:"ScalarField",alias:null,name:"widgetUrl",args:null,storageKey:null},{kind:"ScalarField",alias:null,name:"apiKeyId",args:null,storageKey:null},{kind:"ScalarField",alias:null,name:"oEmbedUrl",args:null,storageKey:null}]}]},operation:{kind:"Operation",name:"registerTenantWithRegistrationTokenMutation",argumentDefinitions:i,selections:a},params:{operationKind:"mutation",name:"registerTenantWithRegistrationTokenMutation",id:null,text:"mutation registerTenantWithRegistrationTokenMutation(\n $input: registerTenantWithRegistrationTokenInput!\n) {\n registerTenantWithRegistrationToken(input: $input) {\n apiKey\n apiUrl\n widgetUrl\n apiKeyId\n oEmbedUrl\n }\n}\n",metadata:{}}};r.hash="cbe70a4c2b43d08aae3f3343ff14391c",e.exports=r},849:function(e,t,n){n(67),n(147),n(157),n(158),n(159),n(160),n(161),e.exports=n(880)},880:function(e,t,n){"use strict";n.r(t);var i=n(0),a=n.n(i),r=n(100),o=(n(162),n(65),n(20)),s=n(93),l=n(7),c=n.n(l),u=n(58),d=n.n(u),m=n(10),g=n.n(m),p=n(11),f=n.n(p),h=n(13),k=n.n(h),T=n(12),b=n.n(T),v=n(5),w=n.n(v),y=n(14),E=n.n(y),M=n(2),R=n.n(M),S=n(6),x=n.n(S),F=n(28),C=n.n(F),A=n(3),K=n(35),W=n.n(K),j=n(16),I=n(45),O=n(18),U=n(8),_=n(17),L=n(9),V=function(){var e=n(471);return e.hash&&"a9f1e32af77e4e2b279f8876792b5370"!==e.hash&&console.error("The definition of 'registerTenantMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."),n(471)},q=function(e,t,n){return Object(L.commitMutation)(e,x()({mutation:V,variables:{input:{clientMutationId:0,email:t.email,termsAndConditionsAccepted:t.termsAndConditionsAccepted,source:t.source,sourceMetadata:t.sourceMetadata,verificationTargetUrl:t.verificationTargetUrl,pluginLanguage:t.pluginLanguage}}},n))},D=function(){var e=n(472);return e.hash&&"cbe70a4c2b43d08aae3f3343ff14391c"!==e.hash&&console.error("The definition of 'registerTenantWithRegistrationTokenMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."),n(472)},H=function(e,t,n){return Object(L.commitMutation)(e,x()({mutation:D,variables:{input:{clientMutationId:0,registrationToken:t.registrationToken,source:t.source,sourceMetadata:t.sourceMetadata,pluginLanguage:t.pluginLanguage}}},n))},N=n(203),P=n(109),$=n(32),J=n(25),B=n(198),Y=n(39),z=n(141),G=n(40),Q=n(53),X=Object(Q.a)(Q.c.urlMiddleware({url:"".concat(_.n,"graphql")})),Z=Object(A.defineMessages)({submit:{id:"wp.registration.box.connect.submit",description:"The text on the button that submits the form to connect to civist.",defaultMessage:"Connect Civist"},title:{id:"wp.registration.box.connect.title",description:"The title in the connect box in the registration form.",defaultMessage:"Welcome to Civist"},text:{id:"wp.registration.box.connect.text",description:"The text in the connect box in the registration form.",defaultMessage:"Connecting to Civist will allow you to start campaigning using your own WordPress"},haveToken:{id:"wp.registration.box.connect.have_token",description:"The link on the registration form that allows the user to register with a token.",defaultMessage:"I have a registration token"},notHaveToken:{id:"wp.registration.box.connect.not_have_token",description:"The link on the registration form that allows the user to register with an email.",defaultMessage:"I don't have a registration token"}}),ee=Object(A.defineMessages)({email:{id:"wp.registration.box.connect.form.input.email.label",description:"The label of the email input field in the connect to civist form.",defaultMessage:"Email"},registrationToken:{id:"wp.registration.box.connect.form.input.registration_token.label",description:"The label of the token input field in the connect to civist form.",defaultMessage:"Paste your registration token here"},termsAndConditions:{id:"wp.registration.box.connect.form.input.terms_and_conditions.label",description:"The label of the checkbox to accept the terms and conditions in the connect to civist form.",defaultMessage:"I accept the {link}"},termsAndConditionsLink:{id:"wp.registration.box.connect.form.input.terms_and_conditions_link.label",description:"The text of the terms and conditions link in the connect to civist form.",defaultMessage:"terms and conditions"}}),te=Object(A.defineMessages)({termsAndConditionsAccepted:{id:"wp.registration.box.connect.form.input.terms_and_conditions.error",description:"The error message when the terms and conditions were not accepted in the connect to civist form.",defaultMessage:"You must accept the terms and conditions"},registrationToken:{id:"wp.registration.box.connect.form.input.registration_token.error",description:"The error label of the registration token input field in the connect to civist form.",defaultMessage:"registration token"}}),ne=Object(J.g)(Object(J.e)({createMessages:function(e,t){return"termsAndConditionsAccepted"===e?[function(e){return{message:e.formatMessage(te.termsAndConditionsAccepted)}}]:Object(J.c)(x()({},ee,{registrationToken:te.registrationToken}))(e,t)}}));Object(F.addValidationRule)("isEmail",function(e,t){return Object(G.d)(t)});var ie=function(e){function t(){var e,n;g()(this,t);for(var i=arguments.length,a=new Array(i),r=0;r<i;r++)a[r]=arguments[r];return n=k()(this,(e=b()(t)).call.apply(e,[this].concat(a))),R()(w()(n),"errorHandler",ne(Object(J.f)(n.props.notificationsState.pushNotification)(n.props.intl))),R()(w()(n),"style",{input:{rootContainer:{width:"auto"},input:{width:"auto",maxWidth:"100%"}},form:{padding:"15px 0 10px 0"},spacer:{height:"16px"}}),R()(w()(n),"state",{isRegistrationWithToken:!1}),R()(w()(n),"onRegisterEmail",function(e){var t=e.email,i=e.termsAndConditionsAccepted;n.props.form.onSubmitStart(function(){q(X,{email:t,termsAndConditionsAccepted:i,verificationTargetUrl:"".concat(_.u,"?page=").concat(_.j),source:window.location.href,pluginLanguage:_.v,sourceMetadata:Object(G.a)({emailSource:t===_.t?"system":"custom",client:_.f,clientVersion:_.q})},{onCompleted:function(e){var t=e.registerTenant;return n.onRegisterTenantSuccess(t)},onError:n.onSubmitFailure})})}),R()(w()(n),"onRegisterToken",function(e){var t=e.registrationToken;n.props.form.onSubmitStart(function(){H(X,{registrationToken:t,source:window.location.href,pluginLanguage:_.v,sourceMetadata:Object(G.a)({client:_.f,clientVersion:_.q})},{onCompleted:function(e){var t=e.registerTenantWithRegistrationToken;return n.onRegisterTenantSuccess(t)},onError:n.onSubmitFailure})})}),R()(w()(n),"onSubmitFailure",function(e){n.props.form.onSubmitEnd(function(){n.errorHandler(e)},!0)}),R()(w()(n),"onRegisterTenantSuccess",function(){var e=d()(regeneratorRuntime.mark(function e(i){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.wpSettings.setSettings(x()({},i,{nonce:_.o}));case 3:n.props.form.onSubmitEnd(function(){window.location.reload()}),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),n.onSubmitFailure(e.t0);case 9:case"end":return e.stop()}},e,null,[[0,6]])}));return function(t){return e.apply(this,arguments)}}()),R()(w()(n),"showTokenField",function(e){e.preventDefault(),n.setState({isRegistrationWithToken:!0},function(){n.form.reset({})})}),R()(w()(n),"showEmailField",function(e){e.preventDefault(),n.setState({isRegistrationWithToken:!1},function(){n.form.reset({email:_.t})})}),R()(w()(n),"saveFormRef",function(e){n.form=e}),n}return E()(t,e),f()(t,[{key:"render",value:function(){var e=this.props,t=e.form,n=e.intl,i=e.notificationsState;return a.a.createElement(j.f,null,a.a.createElement(j.a,null),a.a.createElement(B.a,{notifications:i.notifications,dismissNotification:i.dismissNotification}),a.a.createElement(I.a,null,a.a.createElement(P.a,{rotate:t.isSubmitting}),a.a.createElement(I.c,null,a.a.createElement(A.FormattedMessage,Z.title)),a.a.createElement(I.b,null,a.a.createElement(A.FormattedMessage,Z.text)),a.a.createElement("div",{style:this.style.form},a.a.createElement(C.a,{onValidSubmit:this.state.isRegistrationWithToken?this.onRegisterToken:this.onRegisterEmail,onValid:t.onValid,onInvalid:t.onInvalid,ref:this.saveFormRef,noValidate:!0},this.state.isRegistrationWithToken?a.a.createElement(O.n,{name:"registrationToken",required:!0,value:""},a.a.createElement(A.FormattedMessage,ee.registrationToken)):a.a.createElement(O.g,{name:"email",type:"email",validations:"isEmail",autoComplete:"email",required:!0,style:this.style.input,value:_.t},a.a.createElement(A.FormattedMessage,ee.email)),this.state.isRegistrationWithToken?null:a.a.createElement(O.b,{name:"termsAndConditionsAccepted",value:!1,validations:"isTrue"},a.a.createElement(A.FormattedMessage,c()({},ee.termsAndConditions,{values:{link:a.a.createElement("a",{href:n.formatMessage(z.c),target:"_blank",rel:"noreferrer noopener"},a.a.createElement(A.FormattedMessage,ee.termsAndConditionsLink))}}))),a.a.createElement("div",{style:{marginTop:"16px"}},this.state.isRegistrationWithToken?a.a.createElement("a",{href:"",onClick:this.showEmailField},a.a.createElement(A.FormattedMessage,Z.notHaveToken)):a.a.createElement("a",{href:"",onClick:this.showTokenField},a.a.createElement(A.FormattedMessage,Z.haveToken))),a.a.createElement("div",{style:this.style.spacer}),a.a.createElement(U.j,{hero:!0,disabled:t.isInvalid||t.isSubmitting},a.a.createElement(A.FormattedMessage,Z.submit))))))}}]),t}(i.Component);R()(ie,"wpSettings",new N.a("".concat(_.s,"?action=").concat(_.p))),ie.propTypes={intl:A.intlShape.isRequired,form:$.b.isRequired,notificationsState:Y.a.isRequired};var ae=Object(A.injectIntl)(Object(Y.b)()(Object($.a)(W()(ie)))),re=n(140);Object(r.render)(a.a.createElement(function(){return a.a.createElement(s.a,null,a.a.createElement(o.HashRouter,null,a.a.createElement(o.Switch,null,a.a.createElement(o.Route,{path:"/",component:ae}),a.a.createElement(o.Route,{component:re.a}))))},null),window.document.getElementById("civist-wrapper"))}},[[849,0,2,1]]]);