vendor: 5,278 bytes, lines 1-2
1/*! For license information please see affiliate.8dc6a1ca60430cffb874.js.LICENSE.txt */ 2"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[9388],{36280(e,t,n){n.r(t);var r,a,i,o=n(68909),l=n(64060),c=n(16029),u=n(97785),s=n(99694),f=n(83166),m=n(96414),p=n(35567),d=n(746),y=n(85605),h=n(42374),_=n(75058),v=n(8992),b=n(71409),g=n(57008),E=n(39242),O=n(27448),w=n(53385);function j(){var e=N(),t=e.m(j),n=(Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__).constructor;function r(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===n||"GeneratorFunction"===(t.displayName||t.name))}var a={throw:1,return:2,break:3,continue:3};function i(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,a[e],t)},delegateYield:function(e,a,i){return t.resultName=a,n(r.d,C(e),i)},finish:function(e){return n(r.f,e)}},n=function(e,n,a){r.p=t.prev,r.n=t.next;try{return e(n,a)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(j=function(){return{wrap:function(t,n,r,a){return e.w(i(t),n,r,a&&a.reverse())},isGeneratorFunction:r,mark:e.m,awrap:function(e,t){return new x(e,t)},AsyncIterator:F,async:function(e,t,n,a,o){return(r(t)?A:k)(i(e),t,n,a,o)},keys:S,values:C}})()}function C(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError($(e)+" is not iterable")}function S(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}}function k(e,t,n,r,a){var i=A(e,t,n,r,a);return i.next().then(function(e){return e.done?e.value:i.next()})}function A(e,t,n,r,a){return new F(N().w(e,t,n,r),a||Promise)}function F(e,t){function n(r,a,i,o){try{var l=e[r](a),c=l.value;return c instanceof x?t.resolve(c.v).then(function(e){n("next",e,i,o)},function(e){n("throw",e,i,o)}):t.resolve(c).then(function(e){l.value=e,i(l)},function(e){return n("throw",e,i,o)})}catch(e){o(e)}}var r;this.next||(P(F.prototype),P(F.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),P(this,"_invoke",function(e,a,i){function o(){return new t(function(t,r){n(e,i,t,r)})}return r=r?r.then(o,o):o()},!0)}function N(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function i(n,r,a,i){var c=r&&r.prototype instanceof l?r:l,u=Object.create(c.prototype);return P(u,"_invoke",function(n,r,a){var i,l,c,u=0,s=a||[],f=!1,m={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,l=0,c=e,m.n=n,o}};function p(n,r){for(l=n,c=r,t=0;!f&&u&&!a&&t<s.length;t++){var a,i=s[t],p=m.p,d=i[2];n>3?(a=d===r)&&(c=i[(l=i[4])?5:(l=3,3)],i[4]=i[5]=e):i[0]<=p&&((a=n<2&&p<i[1])?(l=0,m.v=r,m.n=i[1]):p<d&&(a=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,m.n=d,l=0))}if(a||n>1)return o;throw f=!0,r}return function(a,s,d){if(u>1)throw TypeError("Generator is already running");for(f&&1===s&&p(s,d),l=s,c=d;(t=l<2?e:c)||!f;){i||(l?l<3?(l>1&&(m.n=-1),p(l,c)):m.n=c:m.v=c);try{if(u=2,i){if(l||(a="next"),t=i[a]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,l<2&&(l=0)}else 1===l&&(t=i.return)&&t.call(i),l<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),l=1);i=e}else if((t=(f=m.n<0)?c:n.call(r,m))!==o)break}catch(t){i=e,l=1,c=t}finally{u=1}}return{value:t,done:f}}}(n,a,i),!0),u}var o={};function l(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][r]?t(t([][r]())):(P(t={},r,function(){return this}),t),f=u.prototype=l.prototype=Object.create(s);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,P(e,a,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,P(f,"constructor",u),P(u,"constructor",c),c.displayName="GeneratorFunction",P(u,a,"GeneratorFunction"),P(f),P(f,a,"Generator"),P(f,r,function(){return this}),P(f,"toString",function(){return"[object Generator]"}),(N=function(){return{w:i,m}})()}function P(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}P=function(e,t,n,r){function i(t,n){P(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},P(e,t,n,r)}function x(e,t){this.v=e,this.k=t}function R(e,t,n,r,a,i,o){try{var l=e[i](o),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,a)}function D(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var i=e.apply(t,n);function o(e){R(i,r,a,o,l,"next",e)}function l(e){R(i,r,a,o,l,"throw",e)}o(void 0)})}}function I(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
2t%2?I(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function L(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function T(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,M(r.key),r)}}function U(e,t,n){return t=q(t),function(e,t){if(t&&("object"==$(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,z()?Reflect.construct(t,n||[],q(e).constructor):t.apply(e,n))}function z(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(z=function(){return!!e})()}function q(e){return q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},q(e)}function B(e,t){return B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},B(e,t)}function H(e,t,n){return(t=M(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function M(e){var t=function(e,t){if("object"!=$(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=$(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==$(t)?t:t+""}function $(e){return $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$(e)}var Y=function(e,t,n,r){var a,i=arguments.length,o=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":$(Reflect))&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(o=(i<3?a(o):i>3?a(t,n,o):a(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o},K=(0,_.Ng)(function(e){return{auth:e.auth,companyInfo:e.companyInfo}},null,null,{forwardRef:!0}),V=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),H(n=U(this,t,[e]),"recaptchaRef",void 0),H(n,"inputLookup",{});var r=e.affiliate;return n.state={isDirty:!1,affiliate:Object.assign({},r),error:null,errorFields:{},submitting:!1},n.recaptchaRef=o.createRef(),n.onInputChange=n.onInputChange.bind(n),n.onSubmit=n.onSubmit.bind(n),n.checkRecaptcha=n.checkRecaptcha.bind(n),n.onSelectChanged=n.onSelectChanged.bind(n),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&B(e,t)}(t,e),n=t,_=[{key:"GET_RECAPTCHA",value:function(){return(0,c.Ay)(r||(r=L(['\n query getSetting_affiliate_recaptcha {\n setting(setting_key: "integrations.recaptcha") {\n setting\n }\n }\n '])))}},{key:"CREATE_AFFILIATE",value:function(){return(0,c.Ay)(a||(a=L(["\n mutation create_affiliate_cp($input: AffiliateUpdateInput!, $withUser: Boolean) {\n createAffiliate(input: $input, withUser: $withUser) {\n affiliate {\n affiliate_id\n }\n errors\n }\n }\n "])))}},{key:"GET_MY_USER",value:function(){return(0,c.Ay)(i||(i=L(["\n query get_my_user_affiliate {\n myUser {\n user_id\n company\n first_name\n last_name\n email\n phone_1{\n phone\n }\n main_address{\n line_1\n line_2\n city\n zip_code\n state{\n state_id\n state_name\n }\n country_id\n }\n }\n }\n "])))}},{key:"render",value:function(){var e,t,n=this,r=this.props.companyInfo,a=this.state,i=a.affiliate,l=a.isDirty,c=a.submitting,u=a.errorFields,p=null!==(e=null===(t=i.affiliate_location)||void 0===t?void 0:t.country_id)&&void 0!==e?e:v.Countries.DEFAULT.valueOf().toString();return o.createElement(o.Fragment,null,o.createElement("h2",null,"Add Affiliate"),o.createElement(E.X,{query:this.GET_RECAPTCHA()},function(e){var t,a,d,y=e.loading,_=e.error,v=e.data;if(y)return o.createElement("div",{className:"loader"},"Loading...");if(_)return o.createElement(O.v,{error:_});if(!v||!v.setting)return null;var E=(0,m.get)(v,"setting.setting")||{};return o.createElement("form",{onSubmit:function(e){return n.onSubmit(e,E
2)}},o.createElement(s.XG,{when:l,message:"Form has unsaved changes - continue?"}),o.createElement("div",{className:"form-inputs"},o.createElement(f.ErrorFormGroup,{field:"name",errors:u},o.createElement("label",{htmlFor:"name"},"Name"),o.createElement("input",{className:"form-control",onChange:n.onInputChange,id:"name",name:"name","data-display":"name",value:i.name?i.name:""}))),o.createElement("hr",null),o.createElement("h5",null,"Contact Information"),o.createElement("div",{className:"form-inputs"},o.createElement(f.ErrorFormGroup,{field:"first_name",errors:u},o.createElement("label",{htmlFor:"first_name"},"First Name"),o.createElement("input",{className:"form-control",onChange:n.onInputChange,id:"first_name",name:"first_name","data-display":"first_name",value:i.first_name?i.first_name:""})),o.createElement(f.ErrorFormGroup,{field:"last_name",errors:u},o.createElement("label",{htmlFor:"last_name"},"Last Name"),o.createElement("input",{className:"form-control",onChange:n.onInputChange,id:"last_name",name:"last_name","data-display":"last_name",value:i.last_name?i.last_name:""}))),o.createElement("div",{className:"form-inputs"},o.createElement(f.ErrorFormGroup,{field:"email",errors:u},o.createElement("label",{htmlFor:"email"},"Email"),o.createElement("input",{className:"form-control",onChange:n.onInputChange,id:"email",name:"email","data-display":"email",value:i.email?i.email:""})),o.createElement(f.ErrorFormGroup,{field:"phone",errors:u},o.createElement("label",{htmlFor:"phone"},"Phone"),o.createElement(h.L,{id:"phone",value:i.phone?i.phone:"",className:"form-control",country:(0,m.get)(r,"address.country.code")||"US",onChange:function(e){return n.setState(function(t){return{isDirty:!0,affiliate:G(G({},t.affiliate),{},{phone:e})}})}}))),o.createElement("hr",null),o.createElement("h5",null,"Location Information"),o.createElement("div",{className:"form-inputs"},o.createElement(f.ErrorFormGroup,{field:"affiliate_location.line_1",errors:u},o.createElement("label",{htmlFor:"affiliate_location_line_1"},"Address (line 1)"),o.createElement("input",{className:"form-control",type:"text",id:"affiliate_location_line_1",name:"affiliate_location.line_1","data-display":"Affiliate Location Address Line 1",onChange:n.onInputChange,value:(0,m.get)(i,"affiliate_location.line_1")||""}))),o.createElement("div",{className:"form-inputs"},o.createElement(f.ErrorFormGroup,{field:"affiliate_location.line_2",errors:u},o.createElement("label",{htmlFor:"affiliate_location_line_2"},"Address (line 2)"),o.createElement("input",{className:"form-control",type:"text",id:"affiliate_location_line_2",name:"affiliate_location.line_2","data-display":"Affiliate Location Address Line 2",onChange:n.onInputChange,value:(0,m.get)(i,"affiliate_location.line_2")||""}))),o.createElement("div",{className:"form-inputs"},o.createElement(f.ErrorFormGroup,{field:"affiliate_location.city",errors:u},o.createElement("label",{htmlFor:"affiliate_location_city"},"City"),o.createElement("input",{className:"form-control",type:"text",id:"affiliate_location_city",name:"affiliate_location.city","data-display":"Affiliate Location Address City",onChange:n.onInputChange,value:(0,m.get)(i,"affiliate_location.city")||""})),o.createElement(f.ErrorFormGroup,{field:"affiliate_location.state",errors:u},o.createElement(b.g,{value:null===(t=i.affiliate_location)||void 0===t?void 0:t.state,filter:{country_id:p},onChange:n.onSelectChanged,id:"affiliate_location_state",name:"affiliate_location.state",inputDataDisplay:"State"})),o.createElement(f.ErrorFormGroup,{field:"affiliate_location.zip_code",errors:u},o.createElement(b.R,{className:"form-control",value:null!==(a=null===(d=i.affiliate_location)||void 0===d?void 0:d.zip_code)&&void 0!==a?a:"",country_id:p,id:"affiliate_location_zip_code",name:"affiliate_location.zip_code","data-display":"Affiliate Location Address Postal Code",onChange:n.onInputChange,companyInfo:r})),o.createElement(f.ErrorFormGroup,{field:"affiliate_location.country_id",errors:u},o.createElement("label",{htmlFor:"affiliate_location_country_id"},"Country"),o.createElement(g.b,{id:"affiliate_location_country_id",name:"affiliate_location.country_id",className:"input-select",initialValue:p,onChange:function(e){return n.onSelectChanged("affiliate_location.country_id",e?parseInt(null==e?void 0:e.value):null)}}))),o.createElement("div",{className:"form-group"},o.createElement(w.A,{ref:n.recaptchaRef,sitekey:E.site_key,size:"v3"===E.version?"invisible":"normal"})),o.createElement("div",{className:"form-inputs"},o.createElement("button",{className:"btn btn-primary ml-auto ".concat(c?"disabled":""),type:"submit"},o.createElement("span",null,"Create"),c?o.createElement("div",{className:"loader loader-light"}):"")))}))}},{key:"componentDidMount",value:(A=D(j().mark(function e(){var t,n,r,a,i;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=l.findDOMNode(this),this.inputLookup=(0,y.A)(n),e.next=4,p.Sn.query({query:this.GET_MY_USER()});case 4:r=e.sent,a=r.data.myUser,i={},null!=a&&a.company&&(i.name=a.company),null!=a&&a.first_name&&(i.first_name=a.first_name),null!=a&&a.last_name&&(i.last_name=a.last_name),null!=a&&a.email&&(i.email=a.email),null!=a&&null!==(t=a.phone_1)&&void 0!==t&&t.phone&&(i.phone=a.phone_1.phone),null!=a&&a.main_address&&(i.affiliate_location={},a.main_address.line_1&&(i.affiliate_location.line_1=a.main_address.line_1),a.main_address.line_2&&(i.affiliate_location.line_2=a.main_address.line_2),a.main_address.city&&(i.affiliate_location.city=a.main_address.city),a.main_address.zip_code&&(i.affiliate_location.zip_code=a.main_address.zip_code),a.main_address.state&&(i.affiliate_location.state={},a.main_address.state.state_id&&(i.affiliate_location.state.state_id=a.main_address.state.state_id),a.main_address.state.state_name&&(i.affiliate_location.state.state_name=a.main_address.state.state_name))),this.setState({affiliate:i});case 14:case"end":return e.stop()}},e,this)})),function(){return A.apply(this,arguments)})},{key:"onInputChange",value:function(e){var t=Object.assign({},this.state,{isDirty:!0});t.affiliate=Object.assign({},t.affiliate),"number"===e.target.type?(0,m.set)(t,"affiliate.".concat(e.target.name),parseFloat(e.target.value)):"checkbox"===e.target.type?(0,m.set)(t,"affiliate.".concat(e.target.name),e.target.checked):(0,m.set)(t,"affiliate.".concat(e.target.name),e.target.value),this.setState(t)}},{key:"onSelectChanged",value:function(e,t){var n=Object.assign({},this.state,{isDirty:!0});(0,m.set)(n.affiliate,e,t),this.setState(n)}},{key:"onDropdownChange",value:function(e,t){var n=Object.assign({},this.state,{isDirty:!0});n.affiliate=Object.assign({},n.affiliate),Array.isArray(e)?n.affiliate[t]=e.map(function(e){return e.value}):n.affiliate[t]=e?e.value:null,this.setState(n)}},{key:"checkRecaptcha",value:(k=D(j().mark(function e(t){var n,r;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.site_key){e.next=2;break}return e.abrupt("return","");case 2:if("v3"!==t.version){e.next=11;break}return e.prev=3,e.next=6,this.recaptchaRef.current.execute();case 6:e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(3),new Error("Error with user verification.");case 11:if(r=null===(n=this.recaptchaRef.current)||void 0===n?void 0:n.getValue()){e.next=14;break}throw new Error("Please Complete user verification.");case 14:return e.abrupt("return",r);case 15:case"end":return e.stop()}},e,this,[[3,8]])})),function(e){return k.apply(this,arguments)})},{key:"onSubmit",value:function(e,t){e&&e.preventDefault(),this.state.submitting?console.log("Already saving"):(this.setState({submitting:!0}),u.oR.dismiss(),this.submitChanges(t))}},{key:"submitChanges",value:(S=D(j().mark(function e(t){var n,r,a,i,o,l;return j().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.state.affiliate,e.prev=1,e.next=4,this.checkRecaptcha(t);case 4:if(r=e.sent,!t.site_key||r){e.next=7;break}throw new Error("Recaptcha is required");case 7:return a=Object.assign({},n),i={mutation:this.CREATE_AFFILIATE(),variables:{input:a,withUser:!0}},e.prev=9,e.next=12,p.Sn.mutate(i);case 12:o=(o=e.sent).data.createAffiliate,e.next=19;break;case 16:e.prev=16,e.t0=e.catch(9),o=(0,d.Ay)(e.t0,this.inputLookup);case 19:if(!(o.errors&&o.errors.length>0)){e.next=24;break}return l={},o.errors.map(function(e){if(e.indexOf(";")>=0){var t=e.split(";"),n=t.shift(),r=t.join(";");l[n]=r,u.oR.error(r)}else u.oR.error(e,{autoClose:!1})}),this.setState({errorFields:l}),e.abrupt("return");case 24:u.oR.success("Affiliate Created"),this.setState({isDirty:!1,errorFields:[]}),e.next=32;break;case 28:e.prev=28,e.t1=e.catch(1),console.log(e.t1),u.oR.error("Error saving: "+e.t1.message,{autoClose:!1});case 32:return e.prev=32,this.setState({submitting:!1}),e.finish(32);case 35:case"end":return e.stop()}},e,this,[[1,28,32,35],[9,16]])})),function(e){return S.apply(this,arguments)})}],_&&T(n.prototype,_),C&&T(n,C),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,_,C,S,k,A}(o.Component);const X=V=Y([K],V);n.d(t,["default",0,X])}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.