1"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[12874],{12874:function(e,n,l){l.r(n);var a=l(60436),i=l(64467),t=l(89379),o=l(5544),s=l(88094),r=l(59272),c=l(99763),d=l(82566),u=l(55713),m=l(47894),h=l(19393),v=l(77069),p=l(45256),f=l(2889),b=(l(6387),l(60105)),x=l(15678),g=[{value:"self",label:"Self (Manual) - I will find and invite creators myself."},{value:"ai",label:"A.I. Assisted - The system will automatically find and suggest creators."},{value:"agency",label:"Agency - A third-party agency I've invited will manage this."}],w=[{value:"self",label:"Self (Manual) - I will review and approve every creator."},{value:"ai",label:"A.I. Assisted - The system vets applicants and provides recommendations."},{value:"agency",label:"Agency - A third-party agency will manage approvals."},{value:"auto",label:"Automatic - Any creator who applies is instantly approved."}],j=[{value:"self",label:"Self (Manual) - I will review all content before publishing."},{value:"ai",label:"A.I. Assisted - The system checks content against the brief."},{value:"agency",label:"Agency - A third-party agency will manage approvals."},{value:"auto",label:"Automatic - All submitted content is automatically approved."}],y=function(e){return(0,x.jsx)(d.A,{id:"tooltip-".concat(Math.random()),children:e})},_=function(e){var n,l=e.name,a=e.label,i=e.icon,t=e.tooltip,o=e.description,s=e.options,r=e.value,d=e.onChange,h=e.errors;return(0,x.jsxs)("div",{className:"form-group mb-4",children:[(0,x.jsxs)("div",{className:"d-flex align-items-center mb-1",children:[(0,x.jsx)("div",{className:"text-primary me-2",style:{width:"20px",textAlign:"center"},children:(0,x.jsx)(u.gc,{icon:i})}),(0,x.jsx)("label",{htmlFor:l,className:"form-label fw-bold text-dark mb-0",children:a}),t&&(0,x.jsx)(c.A,{placement:"top",overlay:y(t),children:(0,x.jsx)(u.gc,{icon:m.wRm,className:"ms-2 text-muted small",style:{cursor:"pointer"}})})]}),(0,x.jsx)("p",{className:"small text-muted ms-4 mb-2",children:o}),(0,x.jsx)("div",{className:"input-group shadow-sm ms-4",style:{width:"calc(100% - 1.5rem)"},children:(0,x.jsx)("select",{name:l,id:l,className:"form-select form-control-custom p-3 ".concat(null!==h&&void 0!==h&&h[l]?"is-invalid":""),onChange:d,value:null!==r&&void 0!==r?r:"",children:s.map((function(e){return(0,x.jsx)("option",{value:e.value,children:e.label},e.value)}))})}),null===h||void 0===h||null===(n=h[l])||void 0===n?void 0:n.map((function(e,n){return(0,x.jsx)("div",{className:"ms-4 mt-1",children:(0,x.jsx)(f.default,{message:e},n)})}))]})},N=function(e){var n,l=e.name,a=e.label,i=e.icon,t=e.tooltip,o=e.description,s=e.type,r=void 0===s?"text":s,d=e.placeholder,h=void 0===d?"":d,v=e.value,p=e.onChange,b=e.errors;return(0,x.jsxs)("div",{className:"form-group mb-4",children:[(0,x.jsxs)("div",{className:"d-flex align-items-center mb-1",children:[(0,x.jsx)("div",{className:"text-primary me-2",style:{width:"20px",textAlign:"center"},children:(0,x.jsx)(u.gc,{icon:i})}),(0,x.jsx)("label",{htmlFor:l,className:"form-label fw-bold text-dark mb-0",children:a}),t&&(0,x.jsx)(c.A,{placement:"top",overlay:y(t),children:(0,x.jsx)(u.gc,{icon:m.wRm,className:"ms-2 text-muted small",style:{cursor:"pointer"}})})]}),(0,x.jsx)("p",{className:"small text-muted ms-4 mb-2",children:o}),(0,x.jsx)("div",{className:"input-group shadow-sm ms-4",style:{width:"calc(100% - 1.5rem)"},children:(0,x.jsx)("input",{type:r,name:l,id:l,value:null!==v&&void 0!==v?v:"",onChange:p,placeholder:h,className:"form-control form-control-custom p-3 ".concat(null!==b&&void 0!==b&&b[l]?"is-invalid":"")})}),null===b||void 0===b||null===(n=b[l])||void 0===n?void 0:n.map((function(e,n){return(0,x.jsx)("div",{className:"ms-4 mt-1",children:(0,x.jsx)(f.default,{message:e},n)})}))]})};n.default=function(e){var n,l,c,d,f,y=e.campaignData,A=e.setCampaignData,k=(e.subscriptions,e.editorMode),M=void 0===k?"advanced":k,D=e.errors,C=(0,s.use
1State)([]),S=(0,o.A)(C,2),F=S[0],I=S[1],T=(0,s.useState)([]),B=(0,o.A)(T,2),E=B[0],q=B[1],R=(0,s.useState)("0"),L=(0,o.A)(R,2),O=L[0],H=L[1];(0,s.useEffect)((function(){null!==y&&void 0!==y&&y.community_id&&(p.Ay.api.Communities.listEmailTemplates(y.community_id,{per_page:200}).then((function(e){I(e.data.data)})).catch((function(e){console.error("Failed to fetch contact templates:",e)})),p.Ay.api.Scheduler.listSchedules({sort:"name"}).then((function(e){q(e.data.data)})).catch((function(e){console.error("Failed to fetch schedulers:",e)})))}),[null===y||void 0===y?void 0:y.community_id]);var U=function(e){var n=e.target,l=n.name,a=n.value;A((function(e){return(0,t.A)((0,t.A)({},e),{},(0,i.A)({},l,a))}))},Q=function(e){var n=e.target,l=n.name,a=n.value;A((function(e){return(0,t.A)((0,t.A)({},e),{},(0,i.A)({},l,a))}))};return(0,x.jsxs)("div",{className:"container mt-4",children:[(0,x.jsxs)("div",{className:"card border-0 shadow-sm mb-3",children:[(0,x.jsx)("div",{className:"card-header bg-white py-4 px-4 border-bottom",children:(0,x.jsxs)("div",{className:"d-flex align-items-center",children:[(0,x.jsx)("div",{className:"bg-primary bg-opacity-10 rounded-circle p-3 me-3 text-primary",children:(0,x.jsx)(u.gc,{icon:m.AgW,className:"fs-3"})}),(0,x.jsxs)("div",{children:[(0,x.jsx)("h3",{className:"mb-1 fw-bold text-dark",children:"Campaign Management"}),(0,x.jsx)("p",{className:"text-muted mb-0 small",children:"Configure automation, communication templates, and outreach limits."})]})]})}),(0,x.jsx)("div",{className:"card-body bg-light p-4",children:(0,x.jsxs)(r.A,{activeKey:O,onSelect:H,alwaysOpen:!0,className:"custom-accordion",children:[(0,x.jsxs)(r.A.Item,{eventKey:"0",className:"border-0 mb-3 shadow-sm rounded overflow-hidden",children:[(0,x.jsx)(r.A.Header,{children:(0,x.jsxs)("div",{className:"d-flex align-items-center w-100 py-2",children:[(0,x.jsx)("div",{className:"icon-box bg-primary bg-opacity-10 text-primary rounded p-2 me-3",children:(0,x.jsx)(u.gc,{icon:m.UBk,className:"fs-5"})}),(0,x.jsxs)("div",{children:[(0,x.jsx)("span",{className:"fw-bold d-block accordion-title",children:"Workflow Automation"}),(0,x.jsx)("span",{className:"accordion-subtitle small",children:"Approval processes and content gating."})]})]})}),(0,x.jsxs)(r.A.Body,{className:"bg-white pt-4",children:[(0,x.jsx)(_,{name:"manage_creator_sourcing_with",label:"Creator Sourcing",icon:m.UBk,tooltip:"Determines who finds creators for this campaign.",description:"Choose how creators are discovered before outreach begins.",options:g,value:null===y||void 0===y?void 0:y.manage_creator_sourcing_with,onChange:Q,errors:D}),(0,x.jsx)(_,{name:"manage_creator_approval_with",label:"Creator Approval",icon:m.FK2,tooltip:"Determines how influencers are approved when they apply.",description:"Decide how influencers who apply to your campaign are approved.",options:w,value:null===y||void 0===y?void 0:y.manage_creator_approval_with,onChange:Q,errors:D}),"advanced"===M&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(_,{name:"manage_content_approval_with",label:"Content Approval",icon:m.AgW,tooltip:"Controls how you review content (videos, posts) before publication.",description:"Choose how influencer-created content is approved before it goes live.",options:j,value:null===y||void 0===y?void 0:y.manage_content_approval_with,onChange:Q,errors:D}),(0,x.jsx)("div",{className:"mb-4 ms-4 p-3 bg-light rounded border",children:(0,x.jsxs)("div",{className:"d-flex align-items-center justify-content-between",children:[(0,x.jsxs)("div",{children:[(0,x.jsxs)("label",{htmlFor:"require_approval",className:"form-label mb-0 fw-bold text-dark",children:[(0,x.jsx)(u.gc,{icon:m.Dfk,className:"me-2 text-primary"}),"Require Content Approval?"]}),(0,x.jsx)("p",{className:"small text-muted mt-1 mb-0",children:"If ON, you must manually approve content before it counts as complete."})]}),(0,x.jsxs)("div",{className:"d-flex align-items-center",children:[(0,x.jsx)(v.A,{checked:!(null===y||void 0===y||!y.require_approval),onChange:function(e,n,l){return function(e,n,l){A((function(n){return(0,t.A)((0,t.A)({},n),{},(0,i.A)({},l,e))}))}(e,0,l)},id:"require_approval",onColor:"#0d6efd",height:24,width:48}),(0,x.jsx)("span",{className:"ms-2 fw-bold small text-dark",children:null!==y&&void 0!==y&&y.require_approval?"Required":"Auto"})]})]})})]})]})]}),"advanced"===M&&(0,x.jsxs)(r.A.Item,{eventKey:"1",className:"border-0 mb-3 shadow-sm rounded overflow-hidden",children:[(0,x.jsx)(r.A.Header,{children:(0,x.jsxs)("div",{className:"d-flex align-items-center w-100 py-2",children:[(0,x.jsx)("div",{className:"icon-box bg-info bg-opacity-10 text-info rounded p-2 me-3",children:(0,x.jsx)(u.gc,{icon:m.y_8,className:"fs-5"})}),(0,x.jsxs)("div",{children:[(0,x.jsx)("span",{className:"fw-bold d-block accordion-title",children:"Communication & Templates"}),(0,x.jsx)("span",{className:"accordion-subtitle small",children:"Email templates and contact details."})]})]})}),(0,x.jsxs)(r.A.Body,{className:"bg-white pt-4",children:[(0,x.jsx)(_,{name:"contact_template_id",label:"Default Invite Template",icon:m.y_8,tooltip:"Select a pre-made email template for the first outreach email.",description:"This template will be automatically populated with details.",options:[{value:"",label:"None (Use System Default Invite)"}].concat((0,a.A)(F.map((function(e){return{value:e.id,label:e.name}})))),value:null===y||void 0===y?void 0:y.contact_template_id,onChange:Q,errors:D}),(0,x.jsx)(b.default,{campaignData:y,selectedSchedulerId:null===y||void 0===y?void 0:y.title_promotion_schedule_id,onSchedulerChange:function(e){return A((function(n){return(0,t.A)((0,t.A)({},n),{},{title_promotion_schedule_id:e})}))},schedulers:E,setSchedulers:q,errors:D,label:"Social Media Scheduler",description:"Link this campaign to a social media scheduler.",tooltip:"Associate this campaign with a social media scheduler for automated posts and outreach DMs."}),(0,x.jsx)(N,{name:"meeting_link",label:"Scheduling Link (Optional)",icon:m.CQO,tooltip:"Link to Calendly or similar for booking calls.",description:"Enter a URL where influencers can schedule a meeting with you.",placeholder:"https://calendly.com/your-name/campaign-chat",value:null===y||void 0===y?void 0:y.meeting_link,onChange:U,errors:D}),(0,x.jsx)(N,{name:"reply_emails",label:"Contact Email(s) (Optional)",icon:m.Hzw,tooltip:"Primary contact emails for influencer questions.",description:"Enter one or more comma-separated email addresses.",placeholder:"e.g., [email protected], [email protected]",value:null===y||void 0===y?void 0:y.reply_emails,onChange:U,errors:D})]})]}),"advanced"===M&&(0,x.jsxs)(r.A.Item,{eventKey:"2",className:"border-0 mb-3 shadow-sm rounded overflow-hidden",children:[(0,x.jsx)(r.A.Header,{children:(0,x.jsxs)("div",{className:"d-flex align-items-center w-100 py-2",children:[(0,x.jsx)("div",{className:"icon-box bg-warning bg-opacity-10 text-warning rounded p-2 me-3",children:(0,x.jsx)(u.gc,{icon:m.isI,className:"fs-5"})}),(0,x.jsxs)("div",{children:[(0,x.jsx)("span",{className:"fw-bold d-block accordion-title",children:"Outreach Limits"}),(0,x.jsx)("span",{className:"accordion-subtitle small",children:"Control the frequency of follow-ups."})]})]})}),(0,x.jsxs)(r.A.Body,{className:"bg-white pt-4",children:[(0,x.jsxs)("div",{className:"row",children:[(0,x.jsx)("div",{className:"col-md-6",children:(0,x.jsx)(_,{name:"email_limit",label:"Max Email Follow-ups",icon:m.y_8,tooltip:"The maximum number of emails (including the invite) sent to an influencer.",description:"How many emails should we send in the sequence?",options:[{value:"1",label:"1 Email (Invite Only)"},{value:"2",label:"2 Emails"},{value:"3",label:"3 Emails"},{value:"4",label:"4 Emails"},{value:"5",label:"5 Emails (Recommended)"}],value:null!==(n=null===y||void 0===y?void 0:y.email_limit)&&void 0!==n?n:"5",onChange:Q,errors:D})}),(0,x.jsx)("div",{className:"col-md-6",children:(0,x.jsx)(_,{name:"twitter_dm_limit",label:"Max Twitter DM Follow-ups",icon:h.HQ1,tooltip:"The maximum number of Twitter DMs sent to an influencer.",description:"How many DMs should we send in the sequence?",options:[{value:"0",label:"0 DMs (Disabled)"},{value:"1",label:"1 DM"},{value:"2",label:"2 DMs"},{value:"3",label:"3 DMs"},{value:"4",label:"4 DMs"},{value:"5",label:"5 DMs (Recommended)"}],value:null!==(l=null===y||void 0===y?void 0:y.twitter_dm_limit)&&void 0!==l?l:"5",onChange:Q,errors:D})})]}),(0,x.jsxs)("div",{className:"row",children:[(0,x.jsx)("div",{className:"col-md-6",children:(0,x.jsx)(_,{name:"instagram_dm_limit",label:"Max Instagram DM Follow-ups",icon:m.Bep,tooltip:"The maximum number of Instagram DMs sent to an influencer.",description:"How many DMs should we send in the sequence?",options:[{value:"0",label:"0 DMs (Disabled)"},{value:"1",label:"1 DM"},{value:"2",label:"2 DMs"},{value:"3",label:"3 DMs"},{value:"4",label:"4 DMs"},{value:"5",label:"5 DMs (Recommended)"}],value:null!==(c=null===y||void 0===y?void 0:y.instagram_dm_limit)&&void 0!==c?c:"5",onChange:Q,errors:D})}),(0,x.jsx)("div",{className:"col-md-6",children:(0,x.jsx)(_,{name:"tiktok_dm_limit",label:"Max TikTok DM Follow-ups",icon:m.Bep,tooltip:"The maximum number of TikTok DMs sent to an influencer.",description:"How many DMs should we send in the sequence?",options:[{value:"0",label:"0 DMs (Disabled)"},{value:"1",label:"1 DM"},{value:"2",label:"2 DMs"},{value:"3",label:"3 DMs"},{value:"4",label:"4 DMs"},{value:"5",label:"5 DMs (Recommended)"}],value:null!==(d=null===y||void 0===y?void 0:y.tiktok_dm_limit)&&void 0!==d?d:"5",onChange:Q,errors:D})})]}),(0,x.jsx)("div",{className:"row",children:(0,x.jsx)("div",{className:"col-md-6",children:(0,x.jsx)(_,{name:"bluesky_dm_limit",label:"Max Bluesky DM Follow-ups",icon:m.Bep,tooltip:"The maximum number of Bluesky DMs sent to an influencer.",description:"How many DMs should we send in the sequence?",options:[{value:"0",label:"0 DMs (Disabled)"},{value:"1",label:"1 DM"},{value:"2",label:"2 DMs"},{value:"3",label:"3 DMs"},{value:"4",label:"4 DMs"},{value:"5",label:"5 DMs (Recommended)"}],value:null!==(f=null===y||void 0===y?void 0:y.bluesky_dm_limit)&&void 0!==f?f:"5",onChange:Q,errors:D})})})]})]})]})})]}),(0,x.jsx)("style",{children:"\n /* Custom Accordion Styling */\n .custom-accordion .accordion-button {\n background-color: #232a5c; /* Dark blue when closed */\n color: white;\n box-shadow: none;\n padding: 1rem 1.25rem;\n }\n \n .custom-accordion .accordion-button:not(.collapsed) {\n background-color: #e9ecef; /* Light grey when open */\n color: #212529; /* Dark text */\n box-shadow: none;\n }\n\n /* Override text colors inside the button based on state */\n .custom-accordion .accordion-button .accordion-title {\n color: white;\n font-size: 1.1rem;\n }\n .custom-accordion .accordion-button .accordion-subtitle {\n color: rgba(255, 255, 255, 0.7);\n }\n\n .custom-accordion .accordion-button:not(.collapsed) .accordion-title {\n color: #212529;\n }\n .custom-accordion .accordion-button:not(.collapsed) .accordion-subtitle {\n color: #6c757d;\n }\n\n .custom-accordion .accordion-button:focus {\n box-shadow: none;\n border-color: rgba(0,0,0,.125);\n }\n\n /* Custom Chevron Icons */\n .custom-accordion .accordion-button::after {\n background-image: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e\");\n }\n .custom-accordion .accordion-button:not(.collapsed)::after {\n background-image: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23212529'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e\");\n }\n\n /* Custom Input Styling */\n .form-control-custom {\n border: 1px solid #ced4da !important;\n background-color: #f8f9fa;\n transition: all 0.2s ease;\n }\n .form-control-custom:focus {\n background-color: #fff;\n border-color: #86b7fe !important;\n box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);\n }\n "})]})}},60105:function(e,n,l){l.r(n);
1var a=l(91212),i=l(10467),t=l(5544),o=l(60436),s=l(89379),r=l(88094),c=l(45256),d=l(55713),u=l(19393),m=l(47894),h=l(99763),v=l(82566),p=l(2889),f=l(15678),b=function(e){var n;return(null===e||void 0===e||null===(n=e.data)||void 0===n?void 0:n.data)||(null===e||void 0===e?void 0:e.data)||null},x=function(e){return String((null===e||void 0===e?void 0:e.id)||"")},g=function(e,n){if(null===n||void 0===n||!n.id)return e;var l=e.findIndex((function(e){return x(e)===x(n)}));return l>=0?e.map((function(e,a){return a===l?(0,s.A)((0,s.A)({},e),n):e})):[].concat((0,o.A)(e),[n]).sort((function(e,n){return String((null===e||void 0===e?void 0:e.name)||"").localeCompare(String((null===n||void 0===n?void 0:n.name)||""))}))},w=[{key:"twitter",name:"X",icon:u.HQ1,color:"#111111",oauthUrl:function(){return"https://api.glitch.fun/auth/twitter/redirect"},connectionFields:["twitter_oauth_token_2","twitter_refresh_token_2","twitter_oauth_token"],accountFields:["twitter_name","twitter_id"]},{key:"bluesky",name:"Bluesky",icon:m.jBL,color:"#1185FE",oauthUrl:function(){return"https://api.glitch.fun/auth/bluesky/redirect"},connectionFields:["bluesky_oauth_token","bluesky_refresh_token"],accountFields:["bluesky_name","bluesky_id"]}];n.default=function(e){var n,l,o,s=e.campaignData,u=e.selectedSchedulerId,j=e.onSchedulerChange,y=e.schedulers,_=void 0===y?[]:y,N=e.setSchedulers,A=e.errors,k=e.label,M=void 0===k?"Social Scheduler":k,D=e.description,C=void 0===D?"Required for social DMs.":D,S=e.tooltip,F=void 0===S?"Link a scheduler to enable automated social interactions.":S,I=(0,r.useState)(!1),T=(0,t.A)(I,2),B=T[0],E=T[1],q=(0,r.useState)(""),R=(0,t.A)(q,2),L=R[0],O=R[1],H=(0,r.useState)(!1),U=(0,t.A)(H,2),Q=U[0],K=U[1],z=(0,r.useState)(""),W=(0,t.A)(z,2),X=W[0],P=W[1],G=(0,r.useState)(!1),J=(0,t.A)(G,2),V=J[0],Y=J[1],Z=(0,r.useState)(""),$=(0,t.A)(Z,2),ee=$[0],ne=$[1],le=(0,r.useState)(""),ae=(0,t.A)(le,2),ie=ae[0],te=ae[1],oe=(0,r.useMemo)((function(){var e=Array.isArray(_)?_:[],n=(null===s||void 0===s?void 0:s.title_promotion_schedule)||(null===s||void 0===s?void 0:s.scheduler)||null;return null!==n&&void 0!==n&&n.id&&!e.some((function(e){return x(e)===x(n)}))?g(e,n):e}),[s,_]),se=(0,r.useMemo)((function(){return oe.find((function(e){return x(e)===String(u||"")}))||null}),[oe,u]),re=(null===s||void 0===s?void 0:s.title_id)||(null===s||void 0===s||null===(n=s.title)||void 0===n?void 0:n.id)||"",ce=(null===s||void 0===s||null===(l=s.title)||void 0===l?void 0:l.name)||(null===s||void 0===s?void 0:s.game_title)||(null===s||void 0===s?void 0:s.title_name)||(null===s||void 0===s?void 0:s.name)||"Campaign",de="".concat(ce," Social Scheduler");(0,r.useEffect)((function(){B&&!L&&O(de)}),[B,L,de]);var ue,me=function(e){null!==e&&void 0!==e&&e.id&&"function"===typeof N&&N((function(n){return g(Array.isArray(n)?n:[],e)}))},he=function(){var e=(0,i.A)((0,a.A)().m((function e(){var n,l,i,t,o,s;return(0,a.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(te(""),ne(""),re){e.n=1;break}return te("A linked game title is required before creating a scheduler."),e.a(2);case 1:if(n=(L||de).trim()){e.n=2;break}return te("Scheduler name is required."),e.a(2);case 2:return K(!0),e.p=3,e.n=4,c.Ay.api.Scheduler.createSchedule({name:n,title_id:re,is_active:!0,posts_per_week:1,email_reminders_per_week:0,pull_from_community:!1});case 4:if(l=e.v,null!==(i=b(l))&&void 0!==i&&i.id){e.n=5;break}throw new Error("The scheduler was created, but the response did not include an id.");case 5:me(i),null===j||void 0===j||j(i.id),E(!1),ne("Scheduler created and selected. Connect X or Bluesky if this campaign will send DMs."),e.n=7;break;case 6:e.p=6,s=e.v,console.error("Failed to create campaign scheduler:",s),te((null===s||void 0===s||null===(t=s.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.message)||(null===s||void 0===s||null===(o=s.response)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.error)||(null===s||void 0===s?void 0:s.message)||"Failed to create scheduler.");case 7:return e.p=7,K(!1),e.f(7);case 8:return e.a(2)}}),e,null,[[3,6,7,8]])})));return function(){return e.apply(this,arguments)}}(),ve=function(){var e=(0,i.A)((0,a.A)().m((function e(){var n,l,i,t,o;return(0,a.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(u&&"function"===typeof c.Ay.api.Scheduler.getSchedule){e.n=1;break}return e.a(2);case 1:return Y(!0),ne(""),te(""),e.p=2,e.n=3,c.Ay.api.Scheduler.getSchedule(u);case 3:n=e.v,null!==(l=b(n))&&void 0!==l&&l.id?(me(l),ne("Scheduler connection status refreshed.")):te("Unable to refresh this scheduler connection status."),e.n=5;break;case 4:e.p=4,o=e.v,console.error("Failed to refresh scheduler:",o),te((null===o||void 0===o||null===(i=o.response)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.message)||(null===o||void 0===o||null===(t=o.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.error)||"Failed to refresh scheduler.");case 5:return e.p=5,Y(!1),e.f(5);case 6:return e.a(2)}}),e,null,[[2,4,5,6]])})));return function(){return e.apply(this,arguments)}}(),pe=function(){var e=(0,i.A)((0,a.A)().m((function e(n){var l,i,t,o,s,r,d,u,m;return(0,a.A)().w((function(e){for(;;)switch(e.p=e.n){case 0:if(null!==se&&void 0!==se&&se.id){e.n=1;break}return te("Select or create a scheduler before connecting social accounts."),e.a(2);case 1:return P(n.key),ne(""),te(""),e.p=2,e.n=3,c.Ay.api.Users.oneTimeLoginToken();case 3:i=e.v,t=null===i||void 0===i||null===(l=i.data)||void 0===l||null===(l=l.data)||void 0===l?void 0:l.one_time_login_token,o=new URLSearchParams({scheduler_id:se.id,redirect:window.location.href}),t&&o.set("token",t),s="".concat(n.oauthUrl(),"?").concat(o.toString()),(r=window.open(s,"_blank","width=960,height=760,noopener,noreferrer"))&&"function"===typeof r.focus&&r.focus(),ne("".concat(n.name," OAuth opened in a new tab. Return here and refresh after connecting.")),e.n=5;break;case 4:e.p=4,m=e.v,console.error("Failed to open ".concat(n.name," OAuth:"),m),te((null===m||void 0===m||null===(d=m.response)||void 0===d||null===(d=d.data)||void 0===d?void 0:d.message)||(null===m||void 0===m||null===(u=m.response)||void 0===u||null===(u=u.data)||void 0===u?void 0:u.error)||"Failed to start ".concat(n.name," OAuth."));case 5:return e.p=5,P(""),e.f(5);case 6:return e.a(2)}}),e,null,[[2,4,5,6]])})));return function(n){return e.apply(this,arguments)}}();return(0,f.jsxs)("div",{className:"form-group mb-4",children:[(0,f.jsxs)("div",{className:"d-flex align-items-center mb-1",children:[(0,f.jsx)("div",{className:"text-primary me-2",style:{width:"20px",textAlign:"center"},children:(0,f.jsx)(d.gc,{icon:m.BEE})}),(0,f.jsx)("label",{htmlFor:"title_promotion_schedule_id",className:"form-label fw-bold text-dark mb-0",children:M}),F&&(0,f.jsx)(h.A,{placement:"top",overlay:(ue=F,(0,f.jsx)(v.A,{id:"campaign-scheduler-tooltip-".concat(Math.random()),children:ue})),children:(0,f.jsx)(d.gc,{icon:m.wRm,className:"ms-2 text-muted small",style:{cursor:"pointer"}})})]}),(0,f.jsx)("p",{className:"small text-muted ms-4 mb-2",children:C}),(0,f.jsxs)("div",{className:"ms-4",style:{width:"calc(100% - 1.5rem)"},children:[(0,f.jsxs)("div",{className:"d-flex gap-2 align-items-stretch",children:[(0,f.jsxs)("select",{name:"title_promotion_schedule_id",id:"title_promotion_schedule_id",className:"form-select form-control-custom p-3 shadow-sm ".concat(null!==A&&void 0!==A&&A.title_promotion_schedule_id?"is-invalid":""),onChange:function(e){ne(""),te(""),null===j||void 0===j||j(e.target.value)},value:u||"",children:[(0,f.jsx)("option",{value:"",children:"None"}),oe.map((function(e){return(0,f.jsx)("option",{value:e.id,children:e.name},e.id)}))]}),(0,f.jsxs)("button",{type:"button",className:"btn btn-outline-primary px-3 flex-shrink-0",onClick:function(){E((function(e){return!e})),te(""),ne("")},children:[(0,f.jsx)(d.gc,{icon:B?m.s0Q:m.QLR,className:"me-2"}),B?"Cancel":"Add Scheduler"]})]}),null===A||void 0===A||null===(o=A.title_promotion_schedule_id)||void 0===o?void 0:o.map((function(e,n){return(0,f.jsx)("div",{className:"mt-1",children:(0,f.jsx)(p.default,{message:e})},n)})),B&&(0,f.jsxs)("div",{className:"border rounded bg-light p-3 mt-3",children:[(0,f.jsx)("label",{htmlFor:"campaign_inline_scheduler_name",className:"form-label small fw-bold text-uppercase text-muted",children:"Scheduler Name"}),(0,f.jsxs)("div",{className:"d-flex gap-2",children:[(0,f.jsx)("input",{id:"campaign_inline_scheduler_name",type:"text",className:"form-control",value:L,onChange:function(e){return O(e.target.value)},placeholder:"Campaign social scheduler"}),(0,f.jsx)("button",{type:"button",className:"btn btn-primary flex-shrink-0",onClick:he,disabled:Q,children:Q?"Creating...":"Create"})]}),(0,f.jsx)("div",{className:"small text-muted mt-2",children:"This creates a scheduler for the campaign game and selects it here."})]}),(0,f.jsxs)("div",{className:"border rounded p-3 mt-3 bg-white",children:[(0,f.jsxs)("div",{className:"d-flex justify-content-between align-items-start gap-3 flex-wrap mb-3",children:[(0,f.jsxs)("div",{children:[(0,f.jsx)("div",{className:"fw-bold text-dark",children:"Social DM Accounts"}),(0,f.jsx)("div",{className:"small text-muted",children:"X and Bluesky DMs use the selected scheduler credentials."})]}),(null===se||void 0===se?void 0:se.id)&&(0,f.jsxs)("button",{type:"button",className:"btn btn-outline-secondary btn-sm",onClick:ve,disabled:V,children:[(0,f.jsx)(d.gc,{icon:m.VNe,spin:V,
1className:"me-2"}),"Refresh"]})]}),null!==se&&void 0!==se&&se.id?(0,f.jsx)("div",{className:"row g-3",children:w.map((function(e){var n=function(e){return e.connectionFields.some((function(e){return Boolean(null===se||void 0===se?void 0:se[e])}))}(e),l=function(e){return e.accountFields.some((function(e){return Boolean(null===se||void 0===se?void 0:se[e])}))}(e),a=n&&("twitter"===e.key||l);return(0,f.jsx)("div",{className:"col-md-6",children:(0,f.jsx)("div",{className:"border rounded p-3 h-100",children:(0,f.jsxs)("div",{className:"d-flex justify-content-between align-items-start gap-2",children:[(0,f.jsxs)("div",{className:"d-flex align-items-start gap-2",children:[(0,f.jsx)("div",{className:"rounded d-inline-flex align-items-center justify-content-center",style:{width:34,height:34,backgroundColor:n?e.color:"#e9ecef",color:n?"#fff":"#6c757d"},children:(0,f.jsx)(d.gc,{icon:e.icon})}),(0,f.jsxs)("div",{children:[(0,f.jsx)("div",{className:"fw-bold text-dark",children:e.name}),(0,f.jsxs)("span",{className:"badge ".concat(a?"bg-success":n?"bg-warning text-dark":"bg-light text-muted border"),children:[(0,f.jsx)(d.gc,{icon:a?m.SGM:m.s0Q,className:"me-1"}),a?"Connected":n?"Needs account":"Not connected"]}),n&&l&&(0,f.jsx)("div",{className:"small text-muted mt-1",children:e.accountFields.map((function(e){return null===se||void 0===se?void 0:se[e]})).find(Boolean)})]})]}),!a&&(0,f.jsxs)("button",{type:"button",className:"btn btn-outline-primary btn-sm flex-shrink-0",onClick:function(){return pe(e)},disabled:X===e.key,children:[(0,f.jsx)(d.gc,{icon:m.AaJ,className:"me-1"}),X===e.key?"Opening...":"Connect"]})]})})},e.key)}))}):(0,f.jsxs)("div",{className:"alert alert-info small mb-0",children:[(0,f.jsx)(d.gc,{icon:m.iW_,className:"me-2"}),"Select or create a scheduler before enabling social DMs."]})]}),ee&&(0,f.jsx)("div",{className:"alert alert-success small py-2 mt-3 mb-0",children:ee}),ie&&(0,f.jsx)("div",{className:"mt-3",children:(0,f.jsx)(p.default,{message:ie})})]})]})}}}]);
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.