PageSourceSearch

https://groweasy.ai/_next/static/chunks/pages/wa-marketing/onboarding-66d7203343c1d0b3.js

js groweasy.ai collected 2026-10-04 18:53:09 UTC 18,407 bytes, 1 lines download raw bytes

1(globalThis.webpackChunk_N_E=globalThis.webpackChunk_N_E||[]).push([[5744],{25411:(e,t,n)=>{"use strict";n.d(t,{l7t:()=>a.l7t});var a=n(70231)},27324:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/wa-marketing/onboarding",function(){return n(42213)}])},42213:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>onboarding});var a=n(75766),r=n(72253),s=n(14932),l=n(91309),i=n(85893),o=n(67294),c=n(11163),d=n(2629),u=n(23834),m=n(9008),p=n.n(m),f=n(55053),x=n(25675),h=n.n(x),v=n(94184),g=n.n(v),b=n(40805),y=n(99322),_=n(28142),j=n(25411),N=n(88767),w=n(69346),S=n(32433),C=n(59266),D=n(85857),P=n(48403);let onboarding_AudienceUploadStep=function(e){var t=e.onNext,n=e.uploadedFileUrl,a=e.user,r=(0,l._)((0,o.useState)(!1),2),s=r[0],c=r[1],d=(0,l._)((0,o.useState)(!1),2),u=d[0],m=d[1],p=(0,o.useRef)(null),f=(0,l._)((0,o.useState)(null),2),x=f[0],v=f[1],A=(0,l._)((0,o.useState)(null),2),I=A[0],k=A[1],E=(0,l._)((0,o.useState)(null),2),R=E[0],T=E[1],F=(0,l._)((0,o.useState)(0),2),O=F[0],U=F[1],M=(0,o.useRef)(null);(0,N.useQuery)(["jobStatus",R],function(){return(0,S.i)({headers:(0,w.Ny)(a),queryParams:{job_id:R||""}})},{enabled:!!R,refetchInterval:function(e){var t,n=null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.status;return n!==D.By.COMPLETED&&n!==D.By.FAILED&&5e3},refetchIntervalInBackground:!0,staleTime:0,refetchOnWindowFocus:!1,onSuccess:function(e){var t=null==e?void 0:e.data;if(t){if("number"==typeof t.progress_percentage&&U(t.progress_percentage),t.status===D.By.COMPLETED){U(100);var n=t.meta_data;setTimeout(function(){k((null==n?void 0:n.parsed_csv_file_url)||null),T(null),m(!1)},500)}else if(t.status===D.By.FAILED){var a=t.error_text||"Failed to process CSV file with AI";(0,y.showToastMessage)(a,"error"),v(null),T(null),m(!1)}}},onError:function(e){(0,b.F4)(e,"AudienceUploadStep.jobStatusQuery"),v(null),T(null),m(!1)}}),(0,o.useEffect)(function(){return function(){M.current&&clearInterval(M.current)}},[]);var handleFileSelect=function(e){var t=(0,P.sJ)(e);if(t){(0,y.showToastMessage)(t,"error");return}m(!0),U(0),k(null),T(null),v(e),U(0),M.current=setInterval(function(){U(function(e){return e>=90?e:Math.min(90,e+10)})},300),(0,C.KC)({headers:(0,w.Ny)(a),file:e,flowType:"BULK_WA"}).then(function(e){M.current&&(clearInterval(M.current),M.current=null),U(100),setTimeout(function(){var t;T(null===(t=e.data)||void 0===t?void 0:t.job_id)},300)}).catch(function(e){M.current&&(clearInterval(M.current),M.current=null),(0,b.F4)(e,"AudienceUploadStep.parseCsvWithAi"),v(null),m(!1)})},L=x?null!==I:!!n,W=x?!I||u:!n||u;return(0,i.jsxs)("div",{className:"flex flex-col px-2 md:px-5 py-6 flex-1",children:[(0,i.jsxs)("div",{className:g()("border-2 rounded-xl p-8 transition-all cursor-pointer",{"border-primary bg-primary/5":s,"border-gray-300 bg-gray-50":!s&&!x&&!n,"border-green-500 bg-green-50":L&&!s&&!u,"pointer-events-none":u}),onDragOver:function(e){e.preventDefault(),c(!0)},onDragLeave:function(e){e.preventDefault(),c(!1)},onDrop:function(e){e.preventDefault(),c(!1);var t=e.dataTransfer.files;t.length>0&&handleFileSelect(t[0])},onClick:function(){var e;return null===(e=p.current)||void 0===e?void 0:e.click()},children:[(0,i.jsx)("input",{ref:p,type:"file",accept:".csv",onChange:function(e){var t=e.target.files;t&&t.length>0&&handleFileSelect(t[0])},className:"hidden"}),(0,i.jsx)("div",{className:"flex flex-col items-center text-center",children:u?(0,i.jsxs)("div",{className:"flex flex-col items-center justify-center p-4 text-center w-full",children:[(0,i.jsx)("div",{className:"w-8 h-8 border-4 border-primary/30 border-t-primary rounded-full animate-spin mb-3"}),(0,i.jsx)("p",{className:"text-sm font-medium text-black",children:R?"AI is parsing your uploaded file...":"Uploading file for parsing..."}),(0,i.jsxs)("div",{className:"w-full max-w-[280px] mt-2 flex items-center gap-2 lg:gap-3 mx-auto",children:[(0,i.jsx)("div",{className:"flex-1 bg-primary/20 rounded-full h-[6px] lg:h-2 overflow-hidden shadow-inner",children:(0,i.jsx)("div",{className:"bg-primary h-full rounded-full transition-all duration-300 ease-out",style:{width:"".concat(O,"%")}})}),(0,i.jsxs)("span",{className:"text-xxs lg:text-xs font-semibold tracking-wider text-primary shrink-0 text-right",children:[Math.round(O),"%"]})]})]}):L?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"w-12 h-12 bg-green-500 rounded-full flex items-center justify-center mb-4",children:(0,i.jsx)(h(),{src:"/images/common/tick.svg",width:24,height:24,alt:"Success"})}),x?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("p",{className:"font-semibold text-gray-900 mb-1 text-center",children:x.name}),(0,i.jsx)("p",{className:"text-sm font-semibold text-primary underline mb-2 cursor-pointer text-center",onClick:function(e){e.stopPropagation(),(0,b.UU)(I)},children:"View Parsed File"})]}):(0,i.jsx)("p",{className:"text-sm font-semibold text-primary underline mb-2 cursor-pointer text-center",onClick:function(e){e.stopPropagation(),(0,b.UU)(n)},children:"View Uploaded File"}),(0,i.jsx)("p",{className:"text-sm text-gray-600 text-center",children:"Click to upload a different file"})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center mb-4",children:(0,i.jsx)(j.l7t,{className:"w-6 h-6 text-primary"})}),(0,i.jsx)("p",{className:"font-semibold text-gray-900 mb-1",children:"Upload CSV"}),(0,i.jsx)("p",{className:"text-sm text-gray-600",children:"Drag and drop or"}),(0,i.jsxs)("button",{type:"button",className:"border-2 border-gray-300 hover:border-primary transition-all border-dashed flex items-center justify-center gap-2 mt-3 py-3 px-4 roun
1ded-lg w-full max-w-xs",children:[(0,i.jsx)(_.Z,{className:"w-4 h-auto text-primary"}),(0,i.jsx)("span",{className:"text-sm",children:"Click to upload CSV"})]})]})})]}),(0,i.jsx)("div",{className:"mt-4 bg-primary2/5 border border-primary/25 rounded-lg p-4",children:(0,i.jsxs)("div",{className:"flex items-start gap-2",children:[(0,i.jsx)("span",{className:"text-primary2 text-lg mt-0.5",children:"ⓘ"}),(0,i.jsx)("div",{className:"flex-1",children:(0,i.jsxs)("p",{className:"text-xs text-primary leading-relaxed",children:[(0,i.jsx)("strong",{children:"CSV Format:"})," Your file must contain phone_number and name. Phone numbers should be without symbols. Example: 91720647XXXX"]})})]})}),(0,i.jsx)("div",{className:"mt-4",children:(0,i.jsx)("button",{type:"button",className:"text-sm text-primary underline",onClick:function(e){e.stopPropagation(),(0,P.bc)()},children:"Download Sample CSV"})}),(0,i.jsx)("div",{className:"mt-auto",children:(0,i.jsx)("button",{type:"button",onClick:function(){t(void 0,x?I||void 0:n)},disabled:W,className:g()("w-full py-3 px-4 rounded-lg font-semibold transition-all",{"bg-primary text-white hover:bg-primary/90":!W,"bg-gray-300 text-gray-500 cursor-not-allowed":W}),children:"Continue"})})]})};var A=n(77690),I=n(35400),k=n(36069),E=n(1278),R=n(24243),T=n(627);let onboarding_CampaignPreviewStep=function(e){var t,n,r,s=e.selectedTemplate,l=e.campaignDetails,o=e.onBack,d=e.user,m=(0,c.useRouter)(),p=Math.round(null!==(n=null==l?void 0:l.tentative_cost)&&void 0!==n?n:(null!==(t=null==l?void 0:l.recipient_count)&&void 0!==t?t:0)*110)/100,f=.18*p,x=null!==(r=null==l?void 0:l.tentative_currency)&&void 0!==r?r:"INR",v=x&&"INR"!==x?"$":"₹",y=(0,N.useMutation)(I.RS);return(0,i.jsxs)("div",{className:"flex flex-col flex-1 h-full px-2 md:px-5 pt-6 overflow-hidden",children:[(0,i.jsxs)("div",{className:"flex-1 overflow-y-scroll no-scrollbar",children:[(0,i.jsxs)("div",{className:"mb-6",children:[(0,i.jsx)("h3",{className:"text-sm text-gray-600 mb-2",children:"Message Preview"}),(0,i.jsx)(T.Z,{template:s})]}),(0,i.jsx)("div",{className:"mb-6",children:(0,i.jsx)("div",{children:(0,i.jsxs)("div",{className:"bg-emerald-600/5 rounded-lg px-4 py-2 border border-emerald-600/30 flex items-center justify-between",children:[(0,i.jsx)("p",{className:"text-sm text-primary mb-1",children:"Total Recipients"}),(0,i.jsx)("p",{className:"text-lg font-bold text-primary2",children:null==l?void 0:l.recipient_count})]})})}),(0,i.jsxs)("div",{className:"mb-6",children:[(0,i.jsx)("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Payment Details"}),(0,i.jsx)("div",{className:"bg-gray-100/70 rounded-lg p-4 border-2 border-primary2/20",children:(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,i.jsx)("p",{className:"text-sm text-gray-700",children:"Subtotal"}),(0,i.jsxs)("p",{className:"text-sm font-semibold text-gray-900",children:[v,p.toFixed(2)]})]}),(0,i.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,i.jsx)("p",{className:"text-sm text-gray-700",children:"GST (18%)"}),(0,i.jsxs)("p",{className:"text-sm font-semibold text-gray-900",children:[v,f.toFixed(2)]})]})]}),(0,i.jsx)("div",{className:"border-t-2 border-gray-300 pt-3",children:(0,i.jsxs)("div",{className:"flex justify-between items-center font-bold text-primary2",children:[(0,i.jsx)("p",{className:"text-base",children:"Total Amount"}),(0,i.jsxs)("p",{className:"text-xl",children:["₹",(p+f).toFixed(2)]})]})})]})})]}),(0,i.jsx)("div",{className:"mb-6 bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,i.jsxs)("div",{className:"flex items-start gap-2",children:[(0,i.jsx)("span",{className:"text-yellow-600 text-lg mt-0.5",children:"⚠️"}),(0,i.jsx)("div",{className:"flex-1",children:(0,i.jsxs)("p",{className:"text-xs text-yellow-900 leading-relaxed",children:[(0,i.jsx)("strong",{children:"Note:"})," Once sent, messages cannot be recalled. Please review carefully before proceeding with payment."]})})]})})]}),(0,i.jsxs)("div",{className:"flex gap-3 py-3",children:[(0,i.jsx)("button",{type:"button",onClick:o,className:"flex-1 px-4 roun
1ded-lg border-2 border-gray-300 text-gray-700 font-semibold hover:bg-gray-50 transition-all disabled:opacity-50",children:"Back"}),(0,i.jsx)("div",{onClick:function(){(0,R.logEvent)(E.K.wa_payment_initiated),y.mutateAsync({headers:(0,w.Ny)(d),data:{wa_campaign_id:l.id,currency:"INR"}}).then(function(e){var t,n,r;m.push({pathname:"/wa-marketing/payment",query:(r={},(0,a._)(r,u.az.CAMPAIGN_ID,null===(t=e.data)||void 0===t?void 0:t.wa_campaign_id),(0,a._)(r,u.az.ORDER_ID,null===(n=e.data)||void 0===n?void 0:n.razorpay_order_id),r)})}).catch(function(e){(0,b.F4)(e,"CampaignPreviewStep.onPayAndSendClick")})},className:g()("cursor-pointer flex-1 py-4 px-4 rounded-lg font-semibold transition-all shadow-lg bg-gradient-to-br from-primary2 to-emerald-700 text-white hover:from-green-600 hover:to-emerald-700"),children:(0,i.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,i.jsx)(h(),{src:"/images/common/whatsapp.svg",width:20,height:20,alt:"WhatsApp"}),"Pay & Send"]})})]}),y.isLoading?(0,i.jsx)(k.Z,{}):null]})},onboarding=function(e){var t,n,m=e.user,x=(0,c.useRouter)(),h=x.query[u.az.CAMPAIGN_ID],v=x.query[u.az.WABA_ID],g=x.query[u.az.PHONE_NUMBER_ID],y=(0,l._)((0,o.useState)(1),2),_=y[0],j=y[1],S=(0,l._)((0,o.useState)(null),2),C=S[0],D=S[1],P=(0,l._)((0,o.useState)({waba_id:v,phone_number_id:g,title:"Campaign ".concat(new Date().toDateString())}),2),E=P[0],R=P[1];(0,o.useEffect)(function(){m||x.push("/login")},[m,x]);var T=(0,N.useQuery)(["getWaCampaignDetails",h],function(){return(0,I.c_)({headers:(0,w.Ny)(m),campaignId:h})},{enabled:!!h&&!!m,onError:function(e){(0,b.F4)(e,"WaMarketingCampaigns.getWaCampaignDetails")},onSuccess:function(e){R(e.data)}}),F=(0,N.useQuery)(["getWaTemplateDetails",null==E?void 0:E.wa_template_id],function(){return(0,I.Ei)({headers:(0,w.Ny)(m),templateId:null==E?void 0:E.wa_template_id})},{enabled:!!(null==E?void 0:E.wa_template_id)&&!!m,onError:function(e){(0,b.F4)(e,"WaMarketingCampaigns.getWaTemplateDetails")},onSuccess:function(e){D(e.data)}}),O=(0,N.useMutation)(I.Be),saveCampaignDetails=function(e,t,n,l){O.mutateAsync({headers:(0,w.Ny)(m),data:e,file:n,fileUrl:l}).then(function(e){R(e.data),x.push({pathname:x.pathname,query:(0,s._)((0,r._)({},x.query),(0,a._)({},u.az.CAMPAIGN_ID,e.data.id))},void 0,{shallow:!0}),t()}).catch(function(e){(0,b.F4)(e,"WaMarketingCampaigns.saveCampaignDetails")})},navigateSteps=function(e){"next"===e&&_<3?j(_+1):"previous"===e&&_>1&&j(_-1)};return m?(0,i.jsxs)(d.Z,{children:[(0,i.jsxs)(p(),{children:[(0,i.jsx)("meta",{name:"robots",content:"noindex, nofollow"}),(0,i.jsx)("title",{children:"Bulk WhatsApp Messaging - GrowEasy"})]}),(0,i.jsxs)("div",{className:"flex flex-col flex-1 h-full w-full",children:[(0,i.jsxs)("div",{className:"flex items-center mt-4 mb-2",children:[(0,i.jsx)("div",{className:"px-4 cursor-pointer",onClick:function(){x.back()},children:(0,i.jsx)(f.Z,{})}),(0,i.jsxs)("div",{className:"flex-1",children:[(0,i.jsx)("p",{className:"text-black text-lg font-semibold",children:function(){switch(_){case 1:return"Whom do you want to send?";case 2:return"What message do you want to send?";case 3:return"Campaign Created";default:return""}}()}),(0,i.jsxs)("p",{className:"text-xs text-gray-600 mt-0.5",children:["Step ",_," of 3"]})]})]}),(0,i.jsxs)("div",{className:"flex-1 overflow-y-auto flex flex-col h-full bg-gray-50",children:[1===_&&(0,i.jsx)(onboarding_AudienceUploadStep,{user:m,onNext:function(e,t){saveCampaignDetails((0,r._)({},E),function(){navigateSteps("next")},e,t)},uploadedFileUrl:null==E?void 0:E.data_url}),2===_&&(0,i.jsx)(A.Z,{user:m,onTemplateSelect:function(e){D(e)},onNext:function(){saveCampaignDetails((0,s._)((0,r._)({},E),{wa_template_id:C.id}),function(){navigateSteps("next")})},onBack:function(){return navigateSteps("previous")},selectedTemplate:C,wabaId:null!==(t=null==E?void 0:E.waba_id)&&void 0!==t?t:v,phoneNumberId:null!==(n=null==E?void 0:E.phone_number_id)&&void 0!==n?n:g,campaignDetails:E}),3===_&&(0,i.jsx)(onboarding_CampaignPreviewStep,{user:m,selectedTemplate:C,campaignDetails:E,onBack:function(){return navigateSteps("previous")}})]}),T.isFetching||F.isFetching||O.isLoading?(0,i.jsx)(k.Z,{}):null]})]}):null}}
1,32433:(e,t,n)=>{"use strict";n.d(t,{i:()=>l});var a=n(11010),r=n(28207),s=n(69346),l=function(){var e=(0,a._)(function(e){var t,n,a,l;return(0,r._)(this,function(r){switch(r.label){case 0:return t=e.headers,a=void 0===(n=e.queryParams)?{}:n,l=new URL(s.Pn.JOBS),Object.keys(a).forEach(function(e){l.searchParams.set(e,a[e])}),[4,(0,s.t5)({url:l.toString(),headers:t})];case 1:return[2,r.sent()]}})});return function(t){return e.apply(this,arguments)}}()},59266:(e,t,n)=>{"use strict";n.d(t,{K2:()=>c,KC:()=>p,Mx:()=>i,NW:()=>m,Ou:()=>u,V4:()=>f,Vj:()=>x,d1:()=>d,hh:()=>o});var a=n(11010),r=n(91309),s=n(28207),l=n(69346),i=function(){var e=(0,a._)(function(e){var t,n;return(0,s._)(this,function(a){switch(a.label){case 0:return t=e.headers,n=e.data,[4,(0,l._T)({url:l.Pn.ORG_LEADS,headers:t,body:n})];case 1:return[2,a.sent()]}})});return function(t){return e.apply(this,arguments)}}(),o=function(){var e=(0,a._)(function(e){var t,n,a;return(0,s._)(this,function(s){switch(s.label){case 0:return t=e.headers,a=void 0===(n=e.queryParams)?{}:n,[4,(0,l.t5)({url:function(e){var t=[],n=!0,a=!1,s=void 0;try{for(var i,o=Object.entries(e)[Symbol.iterator]();!(n=(i=o.next()).done);n=!0){var c=(0,r._)(i.value,2),d=c[0],u=c[1];void 0!==u&&""!==u&&("custom_fields_filters"===d?t.push("custom_fields_filters=".concat(u)):t.push("".concat(encodeURIComponent(d),"=").concat(encodeURIComponent(String(u)))))}}catch(e){a=!0,s=e}finally{try{n||null==o.return||o.return()}finally{if(a)throw s}}var m=t.join("&");return m?"".concat(l.Pn.ORG_LEADS,"?").concat(m):l.Pn.ORG_LEADS}(a),headers:t})];case 1:return[2,s.sent()]}})});return function(t){return e.apply(this,arguments)}}(),c=function(){var e=(0,a._)(function(e){var t,n,a,i;return(0,s._)(this,function(s){switch(s.label){case 0:return t=e.headers,a=void 0===(n=e.queryParams)?{}:n,i=new URL(l.Pn.ORG_ANALYTICS_SALES),Object.entries(a).forEach(function(e){var t=(0,r._)(e,2),n=t[0],a=t[1];void 0!==a&&""!==a&&i.searchParams.set(n,String(a))}),[4,(0,l.t5)({url:i.toString(),headers:t})];case 1:return[2,s.sent().data]}})});return function(t){return e.apply(this,arguments)}}(),d=function(){var e=(0,a._)(function(e){var t,n,a,r;return(0,s._)(this,function(s){switch(s.label){case 0:return t=e.headers,n=e.leadId,[4,(0,l.t5)({url:"".concat(l.Pn.ORG_LEADS,"/").concat(n),headers:t})];case 1:return[2,null!==(r=(a=s.sent()).data)&&void 0!==r?r:a]}})});return function(t){return e.apply(this,arguments)}}(),u=function(){var e=(0,a._)(function(e){var t,n,a,r,i;return(0,s._)(this,function(s){switch(s.label){case 0:return t=e.headers,n=e.leadId,a=e.data,[4,(0,l._T)({url:"".concat(l.Pn.ORG_LEADS,"/").concat(n,"/activities"),headers:t,body:a})];case 1:return[2,null!==(i=(r=s.sent()).data)&&void 0!==i?i:r]}})});return function(t){return e.apply(this,arguments)}}(),m=function(){var e=(0,a._)(function(e){var t,n,a,r;return(0,s._)(this,function(s){switch(s.label){case 0:if(t=e.headers,n=e.file,!(a=e.fileUrl))return[3,2];return[4,(0,l._T)({url:l.Pn.ORG_LEADS_IMPORT,headers:t,body:{file_url:a}})];case 1:case 3:return[2,s.sent()];case 2:return r=new FormData,n&&r.append("file",n),[4,(0,l.SU)({url:l.Pn.ORG_LEADS_IMPORT,headers:t,body:r})]}})});return function(t){return e.apply(this,arguments)}}(),p=function(){var e=(0,a._)(function(e){var t,n,a,r;return(0,s._)(this,function(s){switch(s.label){case 0:return t=e.headers,n=e.file,a=e.flowType,(r=new FormData).append("file",n),a&&r.append("flow_type",a),[4,(0,l.SU)({url:l.Pn.AI_CSV_PARSER,headers:t,body:r})];case 1:return[2,s.sent()]}})});return function(t){return e.apply(this,arguments)}}(),f=function(){var e=(0,a._)(function(e){var t,n,a;return(0,s._)(this,function(r){switch(r.label){case 0:return t=e.headers,n=e.leadId,a=e.data,[4,(0,l._T)({url:"".concat(l.Pn.ORG_LEADS,"/").concat(n),headers:t,body:a})];case 1:return r.sent(),[2]}})});return function(t){return e.apply(this,arguments)}}(),x=function(){var e=(0,a._)(function(e){var t,n;return(0,s._)(this,function(a){switch(a.label){case 0:return t=e.headers,n=e.leadId,[4,(0,l._T)({url:l.Pn.ORG_LEAD_SUMMARY,headers:t,body:{lead_id:n}})];case 1:return[2,a.sent()]}})});return function(t){return e.apply(this,arguments)}}()}},e=>{var __webpack_exec__=t=>e(e.s=t);e.O(0,[1778,6158,5675,8767,8388,5400,2558,1435,9774,2888,179],()=>__webpack_exec__(27324)),_N_E=e.O()}]);

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.