PageSourceSearch

https://app.convertout.com/_next/static/chunks/pages/settings-663a580c3c717bf0.js

js convertout.com collected 2026-09-28 06:05:40 UTC 15,580 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[662],{52837:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/settings",function(){return t(71559)}])},11958:function(e,n,t){"use strict";t.d(n,{C:function(){return i}});var o=t(58923),i=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3,i={message:n,duration:t};if(e){var a=o.Toast.create(e,i);a.dispatch(o.Toast.Action.SHOW)}}},71559:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return $}});var o=t(91098),i=t(20018),a=t(93700),l=t(16364),s=t(85893),r=t(67294),u=t(94345),c=t(65224),d=t(12089),m=t(98537),p=t(1169),v=t(87497),h=t(5677),b=t(38655),f=t(9175),g=t(11505),x=t(92436),y=t(58923),k=t(99023),C=t(46607),j=t(21239),S=t(29653),Z=t(11056),A=t(3334),P=t(19305),w=t(86975),L=t(47289),T=(t(8215),t(19911)),N=t(79798),_=t(21840),q=t(22785),U=t(11958),I=function(e){var n,t,u=e.shopSettings,c=(0,r.useState)(!1),d=c[0],m=c[1],v=(0,r.useState)([]),b=v[0],f=v[1],g=(0,r.useState)(!1),x=g[0],y=g[1],k=(0,r.useContext)(C.Context);(0,r.useEffect)((function(){var e,n;f(null!==(n=null===u||void 0===u||null===(e=u.applicationQuestionnaire)||void 0===e?void 0:e.questions)&&void 0!==n?n:[])}),[u]);var j,S=function(){var e=(0,o.Z)((function(){var e,n;return(0,l.__generator)(this,(function(t){switch(t.label){case 0:e=b.filter((function(e){return e.text.trim().length>0})),y(!0),t.label=1;case 1:return t.trys.push([1,5,6,7]),[4,(0,T.Z)(k)];case 2:return(n=t.sent())?[4,n.post("".concat("https://app.convertout.com","/api/shopSettings"),{applicationQuestionnaire:e.length>0?{questions:e}:null})]:[3,4];case 3:t.sent(),f(e),m(!1),(0,U.C)(k,"Application questionnaire saved"),t.label=4;case 4:return[3,7];case 5:return t.sent(),(0,U.C)(k,"There was a problem saving the questionnaire"),[3,7];case 6:return y(!1),[7];case 7:return[2]}}
1))}));return function(){return e.apply(this,arguments)}}(),Z=null!==(j=null===u||void 0===u||null===(n=u.applicationQuestionnaire)||void 0===n||null===(t=n.questions)||void 0===t?void 0:t.length)&&void 0!==j?j:0;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.z,{onClick:function(){return m(!0)},plain:!0,children:Z>0?"Edit questionnaire (".concat(Z," questions)"):"Set up questionnaire"}),(0,s.jsxs)(_.u,{open:d,onClose:function(){return m(!1)},title:"Application questionnaire",primaryAction:{content:"Save",loading:x,onAction:S},secondaryActions:[{content:"Cancel",onAction:function(){return m(!1)}}],children:[(0,s.jsx)(_.u.Section,{children:(0,s.jsx)(q.l,{children:(0,s.jsx)("p",{children:"When approval is required, ambassadors will be asked to answer these questions before their application is reviewed."})})}),(0,s.jsxs)(_.u.Section,{children:[0===b.length&&(0,s.jsx)("p",{className:"text-gray-500 text-sm mb-3",children:"No questions yet. Add one below."}),(0,s.jsx)("div",{className:"space-y-3",children:b.map((function(e,n){return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)("div",{className:"flex-1",children:(0,s.jsx)(p.n,{label:"Question ".concat(n+1),value:e.text,onChange:function(n){return t=e.id,o=n,void f((function(e){return e.map((function(e){return e.id===t?(0,a.Z)((0,i.Z)({},e),{text:o}):e}))}));var t,o},autoComplete:"off",placeholder:"e.g. How do you plan to promote our products?"})}),(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(h.z,{destructive:!0,plain:!0,onClick:function(){return n=e.id,void f((function(e){return e.filter((function(e){return e.id!==n}))}));var n},children:"Remove"})})]},e.id)}))}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(h.z,{onClick:function(){var e="q_".concat(Date.now().toString(36),"_").concat(Math.random().toString(36).slice(2,6));f((function(n){return(0,N.Z)(n).concat([{id:e,text:""}])}))},children:"Add question"})})]})]})]})},E=["All products","Specific collections"],H=function(e){if(!/^#[\da-f]{6}$/i.test(e))return"You must enter a valid hex color such as #4F46E5"},$=(0,Z.Zh)("common")((function(){var e,n=(0,r.useContext)(C.Context),t="https://app.convertout.com",Z=(0,S.Z)("api/shopSettings"),N=(0,r.useState)(!1),_=N[0],q=N[1],U=(0,r.useState)(!1),$=U[0],O=U[1],Y=(0,r.useState)(null!==(e=null===Z||void 0===Z?void 0:Z.selectedCollections)&&void 0!==e?e:[]),F=Y[0],X=Y[1];(0,r.useEffect)((function(){var e;X(null!==(e=null===Z||void 0===Z?void 0:Z.selectedCollections)&&void 0!==e?e:[])}),[Z]);var B,z,D,K,W,M,R,Q,J,V,G,ee,ne,te=function(){var e=(0,o.Z)((function(){var e,o;return(0,l.__generator)(this,(function(i){switch(i.label){case 0:return e={commissionPercentage:Number(he.commissionPercentage.value),discountPercentage:Number(he.discountPercentage.value),minimumPayoutAmount:Number(he.minimumPayoutAmount.value),customPaymentInfoPrompt:he.customPaymentInfoPrompt.value,termsLink:he.termsLink.value,locale:he.locale.value,sendEmailNewAmbassador:oe.checked,sendEmailNewSale:ie.checked,primaryColor:he.primaryColor.value,backgroundColor:he.backgroundColor.value,omnisendApiKey:he.omnisendApiKey.value,klaviyoApiKey:he.klaviyoApiKey.value,hideAffiliateLink:ae.checked,hideCustomLinkBuilder:le.checked,hideSmsButton:se.checked,hideEmailButton:re.checked,customHeadline:he.customHeadline.value,customSubheadline:he.customSubheadline.value,basedOnSubtotal:ue.checked,subtractTaxes:ce.checked,requireApproval:de.checked,allowChangePromoCode:me.checked,appliesOnSubscription:pe.checked,discountAppliesTo:he.discountAppliesTo.value,selectedCollections:F},[4,(0,T.Z)(n)];case 1:return[4,null===(o=i.sent())||void 0===o?void 0:o.post("".concat(t,"/api/shopSettings"),e)];case 2:return i.sent(),[2]}}))}));return function(){return e.apply(this,arguments)}}(),oe=(0,f.xY)(null!==(B=null===Z||void 0===Z?void 0:Z.sendEmailNewAmbassador)&&void 0!==B&&B),ie=(0,f.xY)(null!==(z=null===Z||void 0===Z?void 0:Z.sendEmailNewSale)&&void 0!==z&&z),ae=(0,f.xY)(null!==(D=null===Z||void 0===Z?void 0:Z.hideAffiliateLink)&&void 0!==D&&D),le=(0,f.xY)(null!==(K=null===Z||void 0===Z?void 0:Z.hideCustomLinkBuilder)&&void 0!==K&&K),se=(0,f.xY)(null!==(W=null===Z||void 0===Z?void 0:Z.hideSmsButton)&&void 0!==W&&W),re=(0,f.xY)(null!==(M=null===Z||void 0===Z?void 0:Z.hideEmailButton)&&void 0!==M&&M),ue=(0,f.xY)(null!==(R=null===Z||void 0===Z?void 0:Z.basedOnSubtotal)&&void 0!==R&&R),ce=(0,f.xY)(null!==(Q=null===Z||void 0===Z?void 0:Z.subtractTaxes)&&void 0!==Q&&Q),de=(0,f.xY)(null!==(J=null===Z||void 0===Z?void 0:Z.requireApproval)&&void 0!==J&&J),me=(0,f.xY)(null!==(V=null===Z||void 0===Z?void 0:Z.allowChangePromoCode)&&void 0!==V&&V),pe=(0,f.xY)(null!==(G=null===Z||void 0===Z?void 0:Z.appliesOnSubscription)&&void 0!==G&&G),ve=(0,g.c)({fields:{commissionPercentage:(0,f.U$)({value:(null===Z||void 0===Z?void 0:Z.commissionPercentage)?Z.commissionPercentage.toString():"",validates:[(0,x.zl)("Commission percentage is required"),(0,x.ob)("Commission percentage must be greater than 0.")]}),discountPercentage:(0,f.U$)({value:(null===Z||void 0===Z?void 0:Z.discountPercentage)?null===Z||void 0===Z?void 0:Z.discountPercentage.toString():"",validates:[(0,x.zl)("Discount percentage is required."),(0,x.ob)("Discount percentage must be greater than 0.")]}),discountAppliesTo:(0,f.U$)({value:(null===Z||void 0===Z?void 0:Z.discountAppliesTo)?Z.discountAppliesTo:E[0],validates:[]}),minimumPayoutAmount:(0,f.U$)({value:(null===Z||void 0===Z?void 0:Z.minimumPayoutAmount)?null===Z||void 0===Z?void 0:Z.minimumPayoutAmount.toString():"10",validates:[(0,x.zl)("Minimum payout amount is required."),(0,x.ev)("Minimum payout amount must be greater than 0.")]}),customPaymentInfoPrompt:(0,f.U$)({value:(null===Z||void 0===Z?void 0:Z.customPaymentInfoPrompt)?Z.customPaymentInfoPrompt:"Enter your PayPal email",validates:[(0,x.zl)("Payment info prompt is required.")]}),termsLink:(0,f.U$)({value:(null===Z||void 0===Z?void 0:Z.termsLink)?Z.termsLink:"",validates:[j.D]}),customHeadline:(0,f.U$)({value:(null===Z||void 0===Z?void 0:Z.customHeadline)?Z.customHeadline:"",validates:[]}),customSubheadline:(0,f.U$)({value:(null===Z||void 0===Z?void 0:Z.customSubheadline)?Z.customSubheadline:"",validates:[]}),portalImageLink:(0,f.U$)({value:(null===Z||void 0===Z?void 0:Z.portalImageLink)?Z.portalImageLink:"",validates:[j.D]}),logoImageLink:(0,f.U$)({value:(null===Z||void 0===Z?void 0:Z.logoImageLink)?Z.logoImageLink:"",validates:[j.D]}),primaryColor:(0,f.U$)({value:(null===Z||void 0===Z?void 0:Z.primaryColor)?Z.primaryColor:"#4F46E5",validates:[H]}),backgroundColor:(0,f.U$)({value:(null===Z||void 0===Z?void 0:Z.backgroundColor)?Z.backgroundColor:"#F7FAFC",validates:[H]}),locale:(0,f.U$)({value:Z&&(0,w.y)(null===Z||void 0===Z?void 0:Z.locale)?Z.locale:"en",validates:[]}),omnisendApiKey:(0,f.U$)({value:null!==(ee=null===Z||void 0===Z?void 0:Z.omnisendApiKey)&&void 0!==ee?ee:"",validates:[]}),klaviyoApiKey:(0,f.U$)({value:null!==(ne=null===Z||void 0===Z?void 0:Z.klaviyoApiKey)&&void 0!==ne?ne:"",validates:[]})},onSubmit:function(){return(0,o.Z)((function(){var e,t,o,i;return(0,l.__generator)(this,(function(a){switch(a.label){case 0:return a.trys.push([0,9,,10]),[3,2];case 1:return a.sent(),[2,{status:"success"}];case 2:return n?[4,(0,k.getSessionToken)(n)]:(console.error("no app bridge could not save"),[2,{status:"fail",errors:[{message:"no app bridge"}]}]);case 3:if(!a.sent())return[3,8];a.label=4;case 4:return a.trys.push([4,6,,7]),[4,te()];case 5:return a.sent(),e={message:"Settings saved",duration:3e3},n&&y.Toast.create(n,e).dispatch(y.Toast.Action.SHOW),[3,7];case 6:return t=a.sent(),o={message:"An error occured while trying to save, please try again",duration:3e3},n&&y.Toast.create(n,o).dispatch(y.Toast.Action.SHOW),A.Z.error("settings.tsx save settings",JSON.stringify(t)),console.error("settings.tsx save settings",t),[3,7];case 7:return[2,{status:"success"}];case 8:return[2,{status:"fail",errors:[{message:"Could not save data, no token"}]}];case 9:return i=a.sent(),A.Z.error("settings.tsx 2 could not save data",JSON.stringify(i)),console.error("save settings error 2",i),[2,{status:"fail",errors:[{message:"Could not save data"}]}];case 10:return[2]}}
1))}))()}}),he=ve.fields,be=ve.submit,fe=ve.submitting,ge=ve.submitErrors;return(0,s.jsx)(L.Z,{children:(0,s.jsx)(u.l,{onSubmit:be,children:(0,s.jsxs)(c.A,{children:[(0,s.jsx)(c.A.AnnotatedSection,{title:"Program settings",description:"How your ambassador program works.",children:(0,s.jsx)(d.Z,{sectioned:!0,children:(0,s.jsxs)(m.l,{children:[(0,s.jsx)(p.n,(0,a.Z)((0,i.Z)({name:"commissionPercentage",disabled:!Z},he.commissionPercentage),{label:"Commission percentage (%)",type:"number",min:"1",max:"100",autoComplete:"off"})),(0,s.jsx)(p.n,(0,a.Z)((0,i.Z)({name:"discountPercentage",disabled:!Z},he.discountPercentage),{label:"Discount percentage (%)",type:"number",max:"100",min:"1",autoComplete:"off"})),(0,s.jsx)(v.P,(0,a.Z)((0,i.Z)({name:"discountAppliesTo",disabled:!Z},he.discountAppliesTo),{options:E,label:"Discount applies to"})),he.discountAppliesTo.value===E[1]&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.z,{onClick:function(){O(!0)},children:"Select collections"}),(0,s.jsx)(C.ResourcePicker,{resourceType:"Collection",open:$,initialSelectionIds:F.map((function(e){return{id:e}})),selectMultiple:!0,onCancel:function(){O(!1)},onSelection:function(){var e=(0,o.Z)((function(e){var o,i;return(0,l.__generator)(this,(function(a){switch(a.label){case 0:return O(!1),o=e.selection.map((function(e){return e.id})),X(o),[4,(0,T.Z)(n)];case 1:return[4,null===(i=a.sent())||void 0===i?void 0:i.post("".concat(t,"/api/shopSettings"),{selectedCollections:o})];case 2:return a.sent(),[2]}}))}));return function(n){return e.apply(this,arguments)}}()})]}),(0,s.jsx)(p.n,(0,a.Z)((0,i.Z)({name:"minimumPayoutAmount",disabled:!Z},he.minimumPayoutAmount),{label:"Minimum payout amount",type:"number",min:"1",autoComplete:"off"})),(0,s.jsx)(b.X,(0,a.Z)((0,i.Z)({name:"basedOnSubtotal",disabled:!Z},ue),{label:"Calculate commission on subtotal instead of total"})),(0,s.jsx)(b.X,(0,a.Z)((0,i.Z)({name:"subtractTaxes",disabled:!Z},ce),{label:"Subtract taxes from commission calculation"})),(0,s.jsx)("div",{children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(b.X,(0,a.Z)((0,i.Z)({name:"requireApproval",disabled:!Z},de),{label:"Require approval for ambassador applications"})),(0,s.jsx)(I,{shopSettings:Z})]})}),(0,s.jsx)(b.X,(0,a.Z)((0,i.Z)({name:"allowChangePromoCode",disabled:!Z},me),{label:"Allow ambassadors to change their own promo code"})),(0,s.jsx)(b.X,(0,a.Z)((0,i.Z)({name:"appliesOnSubscription",disabled:!Z},pe),{label:"Apply discount to subscriptions"}))]})})}),(0,s.jsx)(c.A.AnnotatedSection,{title:"Portal options",description:"How your portal appears.",children:(0,s.jsx)(d.Z,{sectioned:!0,children:(0,s.jsxs)(m.l,{children:[(0,s.jsx)(v.P,(0,a.Z)((0,i.Z)({name:"locale",disabled:!Z},he.locale),{options:w.V,label:"Portal language",helpText:"Want another language? Please contact support."})),(0,s.jsx)(p.n,(0,a.Z)((0,i.Z)({name:"primaryColor",disabled:!Z},he.primaryColor),{label:"Primary color",autoComplete:"off"})),(0,s.jsx)(p.n,(0,a.Z)((0,i.Z)({name:"backgroundColor",placeholder:"#F7FAFC",disabled:!Z},he.backgroundColor),{label:"Background color",autoComplete:"off"})),(0,s.jsx)(p.n,(0,a.Z)((0,i.Z)({name:"customHeadline",disabled:!Z},he.customHeadline),{label:"Custom headline",autoComplete:"off"})),(0,s.jsx)(p.n,(0,a.Z)((0,i.Z)({name:"customSubheadline",disabled:!Z},he.customSubheadline),{label:"Custom subheadline",autoComplete:"off"})),(0,s.jsx)(p.n,(0,a.Z)((0,i.Z)({name:"customPaymentInfoPrompt",disabled:!Z},he.customPaymentInfoPrompt),{label:"Payment info prompt - What ambassadors will see when entering in their payment info",autoComplete:"off"})),(0,s.jsx)(p.n,(0,a.Z)((0,i.Z)({name:"termsLink",disabled:!Z},he.termsLink),{label:"Ambassador terms link",labelAction:{content:"View template",onAction:function(){window&&window.open("https://www.convertout.com/blog/free-brand-ambassador-contract-template-for-your-shopify-store/","_blank")}},autoComplete:"off"})),(0,s.jsx)(b.X,(0,a.Z)((0,i.Z)({name:"hideAffiliateLink",disabled:!Z},ae),{label:"Hide affiliate link (only show promo code)"})),(0,s.jsx)(b.X,(0,a.Z)((0,i.Z)({name:"hideCustomLinkBuilder",disabled:!Z},le),{label:"Hide custom link builder"})),(0,s.jsx)(b.X,(0,a.Z)((0,i.Z)({name:"hideSmsButton",disabled:!Z},se),{label:"Hide SMS button"})),(0,s.jsx)(b.X,(0,a.Z)((0,i.Z)({name:"hideEmailButton",disabled:!Z},re),{label:"Hide email button"})),(0,s.jsxs)(m.l.Group,{condensed:!0,children:[(0,s.jsx)(P.Z,{setUploading:q,labelTitle:"Logo (transparent background, 400px x 100px recommended)",field:"logoImageLink",previewImageUrl:null===Z||void 0===Z?void 0:Z.logoImageLink}),(0,s.jsx)(P.Z,{setUploading:q,labelTitle:"Portal Welcome (1000px x 1000px recommended)",field:"portalImageLink",previewImageUrl:null===Z||void 0===Z?void 0:Z.portalImageLink})]})]})})}),ge.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"text-red-600",children:"Sorry there was a problem saving, please try again."})]}),(0,s.jsx)("div",{className:"ml-auto mt-6 mb-8",children:(0,s.jsx)(h.z,{"data-cy":"submit",loading:fe||_,submit:!0,primary:!0,children:"Save"})})]})})})}))},21239:function(e,n,t){"use strict";t.d(n,{D:function(){return o}});var o=function(e){if(e&&""!==e)return function(e){var n;try{n=new URL(e)}catch(t){return!1}return"http:"===n.protocol||"https:"===n.protocol}(e)?void 0:"Link must be a valid URL starting with http."}}},function(e){e.O(0,[3662,7721,1664,9675,514,9173,8208,1840,1169,4651,7262,6430,4441,7289,9774,2888,179],(function(){return n=52837,e(e.s=n);var n}));var n=e.O();_N_E=n}]);

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.