1(globalThis.webpackChunk_N_E=globalThis.webpackChunk_N_E||[]).push([[3659],{73510:(e,a,l)=>{"use strict";l.d(a,{Z:()=>t});var s=l(91373);let t=(0,s.Z)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},58621:(e,a,l)=>{"use strict";l.d(a,{Z:()=>t});var s=l(91373);let t=(0,s.Z)("credit-card",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]])},49525:(e,a,l)=>{"use strict";l.d(a,{Z:()=>t});var s=l(91373);let t=(0,s.Z)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]])},30348:(e,a,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/wa-marketing/campaign-details",function(){return l(90865)}])},90865:(e,a,l)=>{"use strict";l.r(a),l.d(a,{default:()=>campaign_details});var s=l(85893),t=l(2629),n=l(9008),r=l.n(n),i=l(11163),d=l(23834),o=l(88767),c=l(35400),m=l(69346),x=l(40805),g=l(55053),u=l(67294),p=l(36069),h=l(11010),f=l(91309),y=l(4586),b=l(28207),v=l(85857),N=l(94184),j=l.n(N),w=l(69697),_=l(627),C=l(75766),P=l(72253),k=l(14932),D=l(29110),E=l(76915);let wa_marketing_DuplicateWaCampaignCta=function(e){var a=e.user,l=e.campaignDetails,t=e.className,n=(0,i.useRouter)(),r=(0,o.useMutation)(c.d9);return(0,s.jsx)("div",{className:null!=t?t:"px-4 lg:px-6 lg:flex lg:justify-end w-full relative z-50",children:(0,s.jsx)("div",{className:"flex flex-col",children:(0,s.jsxs)(D.Z,{className:"text-sm px-4 py-2 lg:px-10 lg:py-4 lg:w-[350px] flex items-center justify-center gap-2",onClick:function(){r.mutateAsync({headers:(0,m.Ny)(a),campaignId:l.id}).then(function(e){var a=window.innerWidth>=768;n.push({pathname:a?"/web/wa-marketing/onboarding":"/wa-marketing/onboarding",query:(0,k._)((0,P._)({},n.query),(0,C._)({},d.az.CAMPAIGN_ID,e.data.id))})}).catch(function(e){(0,x.F4)(e,"WaCampaignDetailsComp.handleDuplicateCampaign")})},disabled:r.isLoading,children:[(0,s.jsx)(E.Z,{className:"hidden lg:block w-4 h-4"}),(0,s.jsx)("p",{children:"Duplicate Campaign"})]})})})};var Z=l(73510),S=l(34464),L=l(13766),M=l(49525),W=l(87099),T=l(10464),A=l(53221);let wa_marketing_WaCampaignDetailsComp=function(e){var a,l,t,n,r,g,p,N,C,P,k,D,E=e.campaignDetails,I=e.user,R=e.onPaymentSuccess,F=(0,i.useRouter)(),z=(0,f._)((0,u.useState)("info"),2),O=z[0],q=z[1],U=E.status,G=[v.SZ.LIVE,v.SZ.COMPLETED].includes(U),K=null!==(N=null===(l=E.created_at)||void 0===l?void 0:l._seconds)&&void 0!==N?N:0,X=new Date(1e3*K),B={sent:null!==(C=null===(t=E.analytics)||void 0===t?void 0:t.sent)&&void 0!==C?C:0,delivered:null!==(P=null===(n=E.analytics)||void 0===n?void 0:n.delivered)&&void 0!==P?P:0,read:null!==(k=null===(r=E.analytics)||void 0===r?void 0:r.read)&&void 0!==k?k:0,failed:null!==(D=null===(g=E.analytics)||void 0===g?void 0:g.failed)&&void 0!==D?D:0},Q=E.recipient_count||0,V=Q>0?Math.min(B.delivered/Q*100,100):0,Y=(0,o.useInfiniteQuery)(["getWaCampaignMessageLogs",E.id],function(e){var a={};return e.pageParam&&(a[d.az.LAST_CURSOR_ID]=e.pageParam),(0,c.rF)({headers:(0,m.Ny)(I),campaignId:E.id,queryParams:a})},{enabled:!!E.id&&!!I&&"recipients"===O,retry:0,getNextPageParam:function(e){if(e.last_cursor_id)return e.last_cursor_id},onError:function(e){(0,x.F4)(e,"WaMarketingCampaignDetailsPage.getWaCampaignMessageLogs")}}),H=(0,u.useMemo)(function(){var e,a,l=[];return null==Y||null===(a=Y.data)||void 0===a||null===(e=a.pages)||void 0===e||e.forEach(function(e){var a;l.push.apply(l,(0,y._)(null!==(a=e.data)&&void 0!==a?a:[]))}),l},[null==Y?void 0:null===(p=Y.data)||void 0===p?void 0:p.pages]),J={sent:"border border-blue-300 bg-blue-50 text-blue-700",delivered:"border border-yellow-300 bg-yellow-50 text-yellow-700",read:"border border-green-300 bg-green-50 text-green-700",failed:"border border-red bg-red-light text-red"},$=(0,o.useQuery)(["getWaCampaignMessageLogsDownloadUrl",E.id],(0,h._)(function(){return(0,b._)(this,function(e){return[2,(0,c.R_)({headers:(0,m.Ny)(I),campaignId:E.id})]})}),{enabled:!1,retry:0,onError:function(e){(0,x.F4)(e,"WaMarketingCampaignDetailsPage.getWaCampaignMessageLogsDownloadUrl")}}),ee=(a=(0,h._)(function(){var e,a,l;return(0,b._)(this,function(s){switch(s.label){case 0:return[4,$.refetch()];case 1:return(null==(l=s.sent())?void 0:null===(a=l.data)||void 0===a?void 0:null===(e=a.data)||void 0===e?void 0:e.url)&&window.open(l.data.data.url,"_blank"),[2]}})}),function(){return a.apply(this,arguments)});return(0,s.jsxs)("div",{className:"flex flex-col flex-1 h-full overflow-hidden bg-white lg:bg-[#f8f9fa]",children:[(0,s.jsx)("div",{className:"hidden md:flex items-center bg-white border-b border-gray-200 sticky top-0 z-10",children:(0,s.jsxs)("div",{className:"flex items-center justify-between px-6 py-6 w-full",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("h1",{className:"text-2xl font-bold text-gray-900",children:E.title}),(0,s.jsxs)("p",{className:"text-sm text-gray-500",children:["Created at ",(0,x.gU)(X)]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-6",children:[(0,s.jsxs)("button",{onClick:function(){return F.back()},className:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors focus:outline-none",children:[(0,s.jsx)("span",{className:"text-xl",children:"â"}),(0,s.jsx)("span",{children:"Back"})]}),(0,s.jsx)("div",{className:"h-6 w-px bg-gray-200"}),(0,s.jsx)(A.Z,{campaignDetails:E})]})]})}),G&&(0,s.jsx)("div",{className:"bg-white",children:(0,s.jsxs)("div",{className:"flex border-b border-gray-200 w-full px-6",children:[(0,s.jsx)("button",{className:j()("flex-1 md:flex-none md:px-10 text-center py-3 font-medium text-sm border-b-2","info"===O?"border-primary text-primary":"border-transparent text-gray-600"),onClick:function(){return q("info")},children:"Info"}),(0,s.jsx)("button",{className:j()("flex-1 md:flex-none md:px-10 text-center py-3 font-medium text-sm border-b-2","recipients"===O?"border-primary text-primary":"border-transparent text-gray-600"),onClick:function(){return q("recipients")},children:"Recipients"})]})}),(!G||"info"===O)&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"flex flex-col flex-1 overflow-y-auto p-4 w-full lg:px-6 lg:py-6 no-scrollbar relative",children:[(0,s.jsxs)("div",{className:"mb-6 md:hidden",children:[(0,s.jsx)("h1",{className:"text-xl font-semibold text-gray-900",children:E.title}),(0,s.jsxs)("div",{className:"flex items-center gap-3 mt-2",children:[(0,s.jsx)(A.Z,{campaignDetails:E}),(0,s.jsxs)("span",{className:"text-sm text-gray-600",children:["Created: ",(0,x.gU)(X)]})]})]}),"TEMPLATE_PENDING"===E.debug_status&&(0,s.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-3 mb-6 w-full",children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)(Z.Z,{className:"w-5 h-5 text-yellow-600 shrink-0"}),(0,s.jsx)("p",{className:"text-xs text-yellow-800 font-medium",children:"The message template used in this campaign is pending approval from WhatsApp. Once approved, the campaign will proceed as normal."})]})}),(0,s.jsxs)("div",{className:"flex flex-col lg:flex-row lg:gap-10 lg:items-start",children:[(0,s.jsx)("div",{className:"lg:mb-0 mb-6 lg:w-1/3 lg:flex-shrink-0 lg:sticky lg:top-0",children:(0,s.jsxs)("div",{className:"md:bg-white md:rounded-2xl md:p-6 md:shadow-sm md:border md:border-gray-100 lg:h-fit",children:[(0,s.jsxs)("h3",{className:"text-sm md:font-semibold text-gray-400 tracking-wider mb-2 md:mb-4 flex items-center gap-2",children:[(0,s.jsx)(S.Z,{className:"w-4 h-4 hidden md:block"})," Message Preview"]}),(0,s.jsx)(_.Z,{template:E.wa_template_details})]})}),(0,s.jsxs)("div",{className:"flex flex-col flex-1 gap-4 lg:mb-0 mb-10",children:[(0,s.jsxs)("div",{className:"bg-white rounded-2xl p-6 md:p-8 shadow-sm border border-gray-100",children:[(0,s.jsx)("h3",{className:"text-lg font-bold text-gray-900 mb-6",children:"Campaign Details"}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4 p-4 bg-gray-50 rounded-xl border border-gray-100",children:[(0,s.jsx)("div",{className:"p-3 bg-white rounded-lg shadow-sm",children:(0,s.jsx)(M.Z,{className:"w-5 h-5 text-gray-600"})}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("span",{className:"text-sm text-gray-500 font-medium",children:"Total Recipients"}),(0,s.jsx)("span",{className:"text-lg font-bold text-gray-900",children:Q.toLocaleStr
1ing()})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4 p-4 bg-gray-50 rounded-xl border border-gray-100",children:[(0,s.jsx)("div",{className:"p-3 bg-white rounded-lg shadow-sm",children:(0,s.jsx)(L.Z,{className:"w-5 h-5 text-gray-600"})}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("span",{className:"text-sm text-gray-500 font-medium",children:"Data File"}),E.data_url?(0,s.jsx)("a",{href:E.data_url,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-bold text-gray-900 hover:text-primary transition-colors",children:"Download CSV"}):(0,s.jsx)("span",{className:"text-lg font-bold text-gray-400",children:"Not Available"})]})]})]})]}),[v.SZ.LIVE,v.SZ.COMPLETED].includes(U)&&(0,s.jsxs)("div",{className:"bg-white rounded-2xl p-6 shadow-sm border border-gray-100",children:[(0,s.jsx)("h3",{className:"text-lg font-bold text-gray-900 mb-6",children:"Performance"}),(0,s.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-8",children:[(0,s.jsxs)("div",{className:"p-4 bg-gray-50 rounded-xl border border-gray-100",children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-gray-500 uppercase mb-1",children:"Sent"}),(0,s.jsx)("p",{className:"text-2xl font-bold text-gray-900",children:B.sent.toLocaleString()})]}),(0,s.jsxs)("div",{className:"p-4 bg-gray-50 rounded-xl border border-gray-100",children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-gray-500 uppercase mb-1",children:"Delivered"}),(0,s.jsx)("p",{className:"text-2xl font-bold text-gray-900",children:B.delivered.toLocaleString()})]}),(0,s.jsxs)("div",{className:"p-4 bg-gray-50 rounded-xl border border-gray-100",children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-gray-500 uppercase mb-1",children:"Read"}),(0,s.jsx)("p",{className:"text-2xl font-bold text-gray-900",children:B.read.toLocaleString()})]}),(0,s.jsxs)("div",{className:"p-4 bg-gray-50 rounded-xl border border-gray-100",children:[(0,s.jsx)("p",{className:"text-xs font-semibold text-gray-500 uppercase mb-1",children:"Failed"}),(0,s.jsx)("p",{className:"text-2xl font-bold text-gray-900",children:B.failed.toLocaleString()})]})]}),Q>0&&(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsxs)("p",{className:"text-sm text-gray-700 font-medium mb-2",children:["Delivery Count: ",B.delivered.toLocaleString()," ","/ ",Q.toLocaleString()]}),(0,s.jsx)("div",{className:"w-full bg-gray-200 h-2 rounded-full",children:(0,s.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:"".concat(V,"%")}})})]})]}),U===v.SZ.PAYMENT_PENDING&&(0,s.jsx)("div",{className:"bg-white rounded-2xl p-6 shadow-sm border border-gray-100 mb-6",children:(0,s.jsxs)("div",{className:"flex items-start gap-4",children:[(0,s.jsx)("div",{className:"p-3 bg-yellow-50 rounded-lg shadow-sm",children:(0,s.jsx)(Z.Z,{className:"w-6 h-6 text-yellow-600"})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("h3",{className:"text-lg font-bold text-gray-900 mb-1",children:"Payment Required"}),(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Complete the payment to send this campaign to your recipients."})]})]})})]})]})]})}),G&&"recipients"===O&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"md:hidden flex flex-col flex-1 min-h-0 overflow-y-auto",children:(0,s.jsx)(W.Z,{campaignDetails:E,campaignMessageLogs:H,isFetching:Y.isFetching,hasNextPage:!!Y.hasNextPage,fetchNextPage:function(){Y.fetchNextPage()},handleDownloadMessageLogs:function(){ee()},messageStatusStyles:J})}),(0,s.jsx)("div",{className:"hidden md:flex flex-col flex-1 min-h-0 overflow-hidden",children:(0,s.jsx)(T.Z,{campaignDetails:E,campaignMessageLogs:H,isFetching:Y.isFetching,hasNextPage:!!Y.hasNextPage,fetchNextPage:function(){Y.fetchNextPage()},handleDownloadMessageLogs:function(){ee()},messageStatusStyles:J})})]}),(null==E?void 0:E.status)===v.SZ.PAYMENT_PENDING?(0,s.jsxs)("div",{className:"px-4 lg:px-6 py-4 flex flex-col md:flex-row items-center justify-end w-full relative z-50 bg-transparent mt-auto gap-3",children:[(0,s.jsx)(wa_marketing_DuplicateWaCampaignCta,{user:I,campaignDetails:E,className:"w-full md:w-auto"}),(null==E?void 0:E.razorpay_order_id)&&(0,s.jsx)(w.Z,{orderId:E.razorpay_order_id,user:I,onSuccess:R,className:"w-full md:w-auto"})]}):[v.SZ.LIVE,v.SZ.COMPLETED].includes(null==E?void 0:E.status)?(0,s.jsx)(wa_marketing_DuplicateWaCampaignCta,{user:I,campaignDetails:E}):null]})},campaign_details=function(e){var a,l=e.user,n=(0,i.useRouter)(),h=n.query[d.az.CAMPAIGN_ID];(0,u.useEffect)(function(){l||n.push("/login")},[l,n]);var f=(0,o.useQuery)(["getWaCampaignDetails",h],function(){return(0,c.c_)({headers:(0,m.Ny)(l),campaignId:h})},{enabled:!!h&&!!l,retry:0,onError:function(e){(0,x.F4)(e,"WaMarketingCampaignDetailsPage.getWaCampaignDetails")}}),y=null===(a=f.data)||void 0===a?void 0:a.data;return(0,s.jsxs)(t.Z,{className:"md:!bg-white md:!py-0",innerClassName:"md:!max-w-full md:!rounded-none md:overflow-hidden",children:[(0,s.jsxs)(r(),{children:[(0,s.jsx)("meta",{name:"robots",content:"noindex, nofollow"}),(0,s.jsx)("title",{children:"Campaign Details"})]}),(0,s.jsxs)("div",{className:"flex flex-col flex-1 h-full w-full ",children:[(0,s.jsxs)("div",{className:"flex items-center mt-4 mb-2 md:hidden md:mt-0",children:[(0,s.jsx)("div",{className:"px-4 cursor-pointer",onClick:function(){n.back()},children:(0,s.jsx)(g.Z,{})}),(0,s.jsx)("p",{className:"text-black text-lg font-semibold",children:"Campaign Details"})]}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-scroll md:overflow-hidden flex flex-col no-scrollbar py-2 md:pt-0",children:[!f.isLoading&&!y&&(0,s.jsx)("p",{className:"text-center text-gray-600 mt-10",children:"No campaign data found."}),y?(0,s.jsx)(wa_marketing_WaCampaignDetailsComp,{campaignDetails:y,user:l,onPaymentSuccess:function(){f.refetch()}}):null]}),f.isFetching?(0,s.jsx)(p.Z,{}):null]})]})}},29110:(e,a,l)=>{"use strict";l.d(a,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var s=l(72253),t=l(14932),n=l(47702),r=l(85893),i=l(94184),d=l.n(i);let __WEBPACK_DEFAULT_EXPORT__=function(e){var a=e.children,l=e.className,i=(0,n._)(e,["children","className"]);return(0,r.jsx)("button",(0,t._)((0,s._)({className:d()("bg-primary text-white text-base font-semibold py-3 px-6 rounded-lg ".concat(void 0===l?"":l),{"opacity-60":!!i.disabled})},i),{children:a}))}},17863:(e,a,l)=>{"use strict";l.d(a,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var s=l(72253),t=l(14932),n=l(47702),r=l(85893),i=l(94184),d=l.n(i);let __WEBPACK_DEFAULT_EXPORT__=function(e){var a=e.children,l=e.className,i=(0,n._)(e,["children","className"]);return(0,r.jsx)("button",(0,t._)((0,s._)({className:d()("bg-[#f57141] hover:bg-[#e05a33] text-white text-base font-semibold py-3 px-6 rounded-lg transition-all ".concat(void 0===l?"":l),{"bg-gray-300 hover:bg-gray-300 cursor-not-allowed opacity-100":!!i.disabled})},i),{children:a}))}},69697:(e,a,l)=>{"use strict";l.d(a,{Z:()=>wa_marketing_CompleteWaPaymentCta});var s=l(72253),t=l(14932),n=l(85893),r=l(67294),i=l(88767),d=l(69346),o=l(30809),c=l(23834),m=l(1278),x=l(24243),g=l(99322),u=l(40805),p=l(29110),h=l(17863),f=l(35400),y=l(58621);let wa_marketing_CompleteWaPaymentCta=function(e){var a,l=e.orderId,b=e.orderDetails,v=e.user,N=e.onSuccess,j=e.automaticallyInitiatePayment,w=e.partnerConfig,_=e.variant,C=e.className,P=(0,i.useQuery)(["getWaOrderDetails",l],function(){return(0,f.Y3)({orderId:l,headers:(0,d.Ny)(v)})},{retry:0,enabled:!!l&&!b,onError:function(e){(0,u.F4)(e,"CompleteWaPaymentCta.getWaOrderDetails")}}),k=(0,i.useMutation)(o.m5),onPaymentResponseReceived=function(e){k.mutateAsync({headers:(0,d.Ny)(v),queryParams:{},data:(0,t._)((0,s._)({},e),{payment_source:"GROWEASY_WHATSAPP_MARKETING"})},{onError:function(e){(0,u.F4)(e,"CompleteWaPaymentCta.onPaymentResponseReceived")},onSuccess:function(){(0,g.showToastMessage)("Payment Success","success"),(0,x.logEvent)(m.K.payment_success),N()}})},D=null!=b?b:null==P?void 0:null===(a=P.data)||void 0===a?void 0:a.data,onPayNowClick=function(){if(D){var e,a,l,
1s,t,n={email:v.email},r={key:null!==(l=null==w?void 0:w.razorpayKeyId)&&void 0!==l?l:c.yj,amount:D.amount,currency:D.currency,name:null!==(s=null==w?void 0:w.name)&&void 0!==s?s:"GrowEasy",description:"Transaction to launch lead generation campaign",image:null!==(t=null==w?void 0:null===(e=w.meta)||void 0===e?void 0:e.ogImage)&&void 0!==t?t:"https://groweasy.ai/images/groweasy-logo-square.png",order_id:D.razorpay_order_id,prefill:n,theme:{color:"#294744"},handler:onPaymentResponseReceived,webview_intent:!0};if(null===(a=window)||void 0===a?void 0:a.Razorpay){var i=new window.Razorpay(r);i.on("payment.failed",function(e){var a;(0,x.logEvent)(m.K.payment_failed),(0,g.showToastMessage)("Payment failed: ".concat(null==e?void 0:null===(a=e.error)||void 0===a?void 0:a.reason),"error")}),i.open()}}};return(0,r.useEffect)(function(){j&&onPayNowClick()},[j,D]),(0,n.jsx)("div",{className:null!=C?C:"px-4 lg:px-6 lg:flex lg:justify-end w-full z-50",children:(0,n.jsx)("div",{className:"flex flex-col",children:"v4"===_?(0,n.jsxs)(h.Z,{className:"mt-2 w-full flex flex-row",onClick:onPayNowClick,disabled:P.isLoading,children:[(0,n.jsx)(y.Z,{className:"hidden lg:block w-4 h-4"}),"Complete Payment"]}):(0,n.jsxs)(p.Z,{className:"text-sm px-4 py-2 lg:px-10 lg:py-4 lg:w-[350px] flex items-center justify-center gap-2",onClick:onPayNowClick,disabled:P.isLoading,children:[(0,n.jsx)(y.Z,{className:"hidden lg:block w-4 h-4"}),(0,n.jsx)("p",{children:"Complete Payment"})]})})})}}},e=>{var __webpack_exec__=a=>e(e.s=a);e.O(0,[6158,5675,8767,8388,5400,8773,9774,2888,179],()=>__webpack_exec__(30348)),_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.