PageSourceSearch

https://app.superlemon.xyz/assets/AdminConfiguration-CujT38iG.js

js superlemon.xyz collected 2026-10-01 11:29:10 UTC 6,960 bytes, 1 lines download raw bytes

1import{r as n,j as e,ai as V,w as S,o as A,k as _,a as te,b as ae,ah as M,T as I,at as se,L as U,m as ne,au as oe,P as re,bJ as T,bW as le}from"./index-BqA-Im5G.js";import{C as D}from"./countryCodes-_hptXn-A.js";import{e as ue}from"./react-select.esm-LgsS5pOu.js";import{g as ie}from"./Location-DAkcZzbI.js";import{c as ce,a as he}from"./crmOrders-BTDd1inn.js";import{g as de,s as me}from"./campaigns-BqqGFx8J.js";import{C as ge}from"./ContextualSaveBar-DXjqwQWU.js";import"./defineProperty-DRmM3rRU.js";import"./typeof-QjJsDpFa.js";const pe=l=>{const[f,d]=n.useState(l.countryCode),[m,v]=n.useState(l.phoneNumber),[C,y]=n.useState();n.useEffect(()=>{d(l.countryCode),v(l.phoneNumber),o()},[l]);const g=()=>{var s=/^(?:[0-9]\d{0,14})$/;return!m||m.match(s)?!1:"enter a valid phone number"},o=()=>{if(!l.countryCode){let s=ie();s&&d(s.value)}y(D.find(s=>s.value===f))};return e.jsx(V,{sectioned:!0,children:e.jsxs(S,{vertical:!0,children:[e.jsx("p",{children:"Please note that it is mandatory to include a link to your WhatsApp support number in every message."}),e.jsxs(S,{children:[e.jsxs("div",{className:"customSelect",children:[e.jsx(A,{children:"Please select your country code"}),e.jsx(ue,{options:D,value:C,onChange:s=>{l.onCountryChange(s==null?void 0:s.value),d(s==null?void 0:s.value)},onMenuOpen:()=>{y("")},onMenuClose:()=>{C==""&&y(D.find(s=>s.value===f))}})]}),e.jsx(_,{autoComplete:"off",label:e.jsx(A,{children:"Please enter your WhatsApp support number"}),value:m,maxLength:15,type:"text",placeholder:"Example: 9035026993",error:g(),onChange:s=>{l.onNumberChange(s),v(s),l.countryCode||l.onCountryChange(f)}})]})]})})},Te=l=>{const{shopDetailsData:f}=te(ae(t=>({shopDetailsData:t.shopDetailsData}))),[d,m]=n.useState({show:!1,message:""}),[v,C]=n.useState({show:!1,message:""}),[y,g]=n.useState(!1),[o,s]=n.useState({value:"75"}),[b,k]=n.useState({value:"75"}),[i,h]=n.useState({phone:null,thresholdValue:null}),[W,E]=n.useState({countryCode:"",phone:""}),[u,j]=n.useState({countryCode:"",phone:""}),[F,P]=n.useState({countryCode:"",phone:""}),[R,H]=n.useState(0);let c=f||{};const N=()=>{c&&c.userId&&(B(c.userId),$(c.userId),ee(c.userId))};n.useEffect(()=>{N()},[]),n.useEffect(()=>{var t=M(F,u);Object.keys(t).length>0?h(a=>({...a,phone:t})):h(a=>({...a,phone:null}))},[u]),n.useEffect(()=>{var t=M(b,o);Object.keys(t).length>0?h(a=>({...a,thresholdValue:t})):h(a=>({...a,thresholdValue:null}))},[o]),n.useEffect(()=>{i.phone||i.optin||i.thresholdValue?g(!0):g(!1)},[i]);const B=t=>{ce(t).then(a=>{a.status==="success"&&(E(a.settings),P(a.settings),j(a.settings))})},$=t=>{de(t).then(a=>{var r;(r=a==null?void 0:a.settings)!=null&&r.threshold?(k({...o,value:String(a.settings.threshold*100)}),s({...o,value:String(a.settings.threshold*100)})):a!==204&&p(a)})},Y=()=>{var t=/^(?:[1-9]\d{0,5})$/;return!u.countryCode||u.countryCode.match(t)?!1:u.countryCode&&u.countryCode[0]==="0"?"Cannot start with 0":"Enter a valid country code"},G=()=>{var t=/^(?:[0-9]\d{0,14})$/;return!u.phone||u.phone.match(t)?!1:"Enter a valid phone number"},J=()=>{N(),h({phone:null,thresholdValue:null}),s(b),P(W),g(!1)},K=async()=>{if(!u.countryCode||Y()){p("A valid support country code must be given");return}if(!u.phone||G()){p("A valid support phone number must be given");return}if(o.value!==b.value&&(Number(o.value)>100||Number(o.value)<1)){p("Invalid marketing campaign monthly usage limit");return}if(i.thresholdValue){let t=new URLSearchParams;t.append("threshold",String(Number(o.value)/100)),me(c.userId,t).then(a=>{a.status==="success"?(L("Data Saved"),k(o),h({...i,thresholdValue:null})):p(a)})}if(i.phone!==null){let t=new URLSearchParams,a=i.phone;Object.keys(a).forEach(r=>{t.append(r,a[r])}),he(c.userId,t).then(r=>{r.status==="success"?(L("Data Saved"),h({...i,optin:null}),E(x=>({...x,...r.settings})),P(x=>({...x,...r.settings})),j(x=>({...x,...r.settings}))):p(r)})}g(!1)},L=t=>{m({show:!0,message:t})},p=t=>{C({show:!0,message:t})},q=d.show?e.jsx(I,{content:d.message,onDismiss:()=>{m({show:!1,message:""})}}):null,z=v.show?e.jsx(I,{error:!0,content:v.message,onDismiss:()=>{C({show:!1,message:""})}}):null,Q=y?e.jsx(ge,{message:"Unsaved changes",saveAction:{content:"Save Settings",onAction:K},discardAction:{onAction:()=>{J()}}}):null,w=(t,a)=>{j(r=>({...r,[t]:a}))},X="Please note that this configuration is to ensure   smooth functioning of automated messaging. The proportion of your monthly messaging usage limit   will be reserved for automated messages",Z=e.jsx("span",{children:e.jsxs("p",{children:["SuperLemon includes your"," ",e.jsx("a",{className:"Polaris-Link Polaris-Link-Updated-Color",href:T,"data-polaris-unstyled":"true",target:"_blank",rel:"noopener noreferrer",children:"business name"})," ","and"," ",e.jsx("a",{className:"Polaris-Link Polaris-Link-Updated-Color",href:T,"data-polaris-unstyled":"true",target:"_blank",rel:"noopener noreferrer",children:"WhatsApp support number"})," "," in every automated message, so that your customers can recognise you and contact you easily if they need help.",e.jsx("br",{}),e.jsx("br",{}),"Please note that Automated WhatsApp messages are sent from our official WhatsApp Business API approved"," ",e.jsx("a",{className:"Polaris-Link Polaris-Link-Updated-Color",href:T,"data-polaris-unstyled":"true",target:"_blank",rel:"noopener noreferrer",children:"phone number"})," ","using message templates approved by WhatsApp."]})}),ee=t=>{le(t).then(a=>{if(a.status==="success"){let r=100*(a.message.balanceUsed/a.message.cappedAmount);H(r.toFixed(2).replace(/[.,]00$/,""))}}).catch(a=>{console.log(a)})},O=e.jsxs(e.Fragment,{children:[q,z,Q,e.jsx(U.AnnotatedSection,{title:"WhatsApp Configuration",description:Z,children:e.jsx(S,{vertical:!0,children:e.jsx("div",{className:"mt-2",children:e.jsx(pe,{phoneNumber:u.phone,countryCode:u.countryCode,onCountryChange:t=>{w("countryCode",t)},onNumberChange:t=>{w("phone",t)}})})})}),c.platform==ne.SHOPIFY&&se(c).includes(oe.CUSTOM_TEMPLATES)&&e.jsx(U.AnnotatedSection,{title:"Marketing Campaign Usage Limit",description:X,
1children:e.jsx(S,{vertical:!0,children:e.jsx(V,{sectioned:!0,children:e.jsxs(S,{vertical:!0,children:[e.jsx(_,{autoComplete:"off",label:e.jsx(A,{children:"Marketing campaign monthly usage limit (in %)"}),value:o.value,maxLength:3,max:100,type:"number",onChange:t=>{s({...o,value:t})},error:o.value&&(Number(o.value)>100||Number(o.value)<1)?"Invalid value":""}),e.jsxs("div",{className:"Polaris-Labelled__HelpText",id:"PolarisTextField21HelpText",children:["Note: Once the above mentioned usage limit is reached, marketing campaigns would not be triggered and the remaining usage will be reserved for automated messsaging.",Number(R)>=50&&e.jsxs(e.Fragment,{children:["To upgrade your monthly limit"," ",e.jsx("a",{href:"/campaigns",children:"click here"})," "]})]})]})})})})]});return l.isSubComponent?e.jsx("div",{style:{marginTop:"20px"},children:O}):e.jsx(re,{title:"Settings",children:O})};export{Te as default};

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.