1import{a as ee}from"./chunk-YBSCVQ5X.js";import{b as Z}from"./chunk-DLEHEH43.js";import{B as X,i as z,m as J,t as Q}from"./chunk-C53UORQN.js";import{Ya as W}from"./chunk-GRKZLBTJ.js";import{j as $}from"./chunk-DNJMDJPD.js";import{b as Y}from"./chunk-JMVK4GP4.js";import{i as H}from"./chunk-DXTONCKZ.js";import{b as B,c as G}from"./chunk-HRCH7YTL.js";import{c as w}from"./chunk-V2N2YMJZ.js";import{d as b}from"./chunk-3WKYSXKM.js";import{a as V}from"./chunk-CJEIUXWH.js";import{b as q,c as K}from"./chunk-LS74OHRZ.js";import{j as R,l as j}from"./chunk-NKUORADV.js";import{t as k}from"./chunk-224PXFJJ.js";import{Cd as p,Ec as v,Fb as F,G as x,Ja as M,La as C,Md as A,N as S,R as D,Ua as O,Vc as d,Wc as U,da as E,f as P,la as g,lc as c,mc as l,nc as L,pb as N,qa as a,r as u,rc as h,sc as f,t as T}from"./chunk-QXK5WLZZ.js";import{a as _,b as y}from"./chunk-MH5V57HS.js";var ie=(()=>{class r{lazyDialog=a(Y);async openTaskDialog(e,t,s){let i=await this.lazyDialog.getDialogService();switch(e.id){case"set-profile":{let{SetProfileDialogComponent:o}=await import("./set-profile-dialog.component-GCDJZKIN.js");return i.open(o,{data:{task:e},panelClass:["basic-dialog"],width:"500px",maxWidth:"90vw",disableClose:!e.completed})}case"name-hub":{let{NameHubDialogComponent:o}=await import("./name-hub-dialog.component-OPEKM57Q.js");return i.open(o,{data:{task:e,currentBusinessName:t},panelClass:["basic-dialog"],width:"500px",maxWidth:"90vw"})}case"set-hub-url":{let{SlugDialogComponent:o}=await import("./slug-dialog.component-4G7XIO3Z.js");return i.open(o,{data:{task:e,currentSlug:s},panelClass:["basic-dialog"],width:"500px",maxWidth:"90vw"})}case"branding":{let{BrandingDialogComponent:o}=await import("./branding-dialog.component-NUNAOJHV.js");return i.open(o,{data:{task:e},panelClass:["basic-dialog"],width:"600px",maxWidth:"90vw"})}case"first-post":{let{FirstPostDialogComponent:o}=await import("./first-post-dialog.component-GWFTQBHE.js");return i.open(o,{data:{task:e},panelClass:["basic-dialog"],width:"550px",maxWidth:"90vw"})}case"invite-members":{let{InviteMembersDialogComponent:o}=await import("./invite-members-dialog.component-JJ4C345H.js");return i.open(o,{data:{task:e},panelClass:["basic-dialog"],width:"500px",maxWidth:"90vw"})}case"notifications":{let{EnableNotificationsDialogComponent:o}=await import("./enable-notifications-dialog.component-FS3TIW4W.js");return i.open(o,{data:{task:e},panelClass:["basic-dialog"],width:"550px",maxWidth:"90vw"})}case"go-live":{let{GoLiveDialogComponent:o}=await import("./go-live-dialog.component-CB4FCDMJ.js");return i.open(o,{data:{task:e},panelClass:["basic-dialog"],width:"600px",maxWidth:"90vw"})}default:{let{TaskDialogComponent:o}=await import("./task-dialog.component-DFWY74RZ.js");return i.open(o,{data:{task:e},panelClass:["basic-dialog"],width:"500px",maxWidth:"90vw"})}}}static \u0275fac=function(t){return new(t||r)};static \u0275prov=g({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var se=(()=>{class r{dialogService=a(ie);checklistService=a(ee);authService=a(Q);snackbar=a(J);platformId=a(O);loggingService=b("GettingStartedChecklistFacade");analytics=z("GettingStartedChecklistFacade");firebase=a(Z);configService=a(W);config=w(this.configService.config$);currentUser=w(this.authService.currentUser$);destroy$=new P;_devForceEnableGoLive=!1;_simulateUnsupportedBrowser=!1;setProfileChecked=!1;autoCompleteInProgress=new Set;hasTrackedFirstPostCompletion=!1;hasGoneLive=M(!1);currentBusinessName=p(()=>this.config()?.businessName||"");currentSlug=p(()=>this.config()?.slug||"");BASE_CHECKLIST_TASKS=[{id:"set-profile",title:"Set Name & Password",icon:"account-edit"},{id:"name-hub",title:"Name your Hub",routerLink:"/admin/lookAndFeel",icon:"pencil"},{id:"set-hub-url",title:"Set your Hub URL",icon:"link-variant"},{id:"branding",title:"Customize Appearance",routerLink:"/admin/lookAndFeel",icon:"palette"},{id:"notifications",title:"Enable Notifications",icon:"bell"},{id:"first-post",title:"Create First Post",routerLink:"/home",icon:"post"},{id:"go-live",title:"Go Live!",icon:"rocket-launch",isGoLiveButton:!0}];tasks=p(()=>{let t=this.config()?.checklistProgress?.steps||[];return this.BASE_CHECKLIST_TASKS.map(s=>{let i=t.find(I=>I.taskId===s.id),o=!1,n=!1,m=i?.completed??!1;if(s.id==="notifications"&&k(this.platformId)){let oe=!this.firebase.isPushAPISupported||this._simulateUnsupportedBrowser,ne=typeof Notification<"u"?Notification.permission:"default";if(oe)m=!0,o=!0;else switch(ne){case"granted":m=!0;break;case"denied":m=!0,n=!0;break;case"default":m=!1;break}}return y(_({},s),{completed:m,notApplicable:o,blocked:n})})});completableTasks=p(()=>this.tasks().filter(e=>!e.isGoLiveButton));completedCount=p(()=>this.completableTasks().filter(e=>e.completed).length);totalCount=p(()=>this.completableTasks().length);progressPercentage=p(()=>{let e=this.totalCount();return e>0?this.completedCount()/e*100:0});allTasksCompleted=p(()=>this._devForceEnableGoLive||this.completedCount()===this.totalCount());constructor(){if(A()&&k(this.platformId)){let e=new URLSearchParams(window.location.search);this._devForceEnableGoLive=e.get("enableGoLive")==="true",this._simulateUnsupportedBrowser=e.get("simulateUnsupportedBrowser")==="true"}C(()=>{let e=this.tasks().find(o=>o.id==="notifications");
1if(!e?.completed||(this.config()?.checklistProgress?.steps||[]).some(o=>o.taskId==="notifications"&&o.completed))return;let i=e.notApplicable?"unsupported":e.blocked?"blocked":"already_granted";this.safeAutoCompleteNotifications(i)}),C(()=>{if(this.setProfileChecked)return;let e=this.currentUser();if(!e||!e.campaign_user_id)return;if(!e.isOwner){this.setProfileChecked=!0;return}let t=this.config();if(!t?.checklistProgress||!t.checklistProgress.steps||t.checklistProgress.steps.length===0)return;let s=this.tasks().find(i=>i.id==="set-profile");if(s){if(s.completed){this.setProfileChecked=!0;return}this.setProfileChecked=!0,this.checkSetProfileRequired()}}),this.listenForNotificationChanges()}cleanup(){this.destroy$.next(),this.destroy$.complete()}async openAndCompleteTask(e){this.trackTaskStart(e);let t=e.completed,s=await this.dialogService.openTaskDialog(e,this.currentBusinessName(),this.currentSlug()),i=await u(s.afterClosed());if(!i){this.trackTaskCancelled(e);return}if(!i.completed){this.trackTaskCancelled(e);return}try{let o=i.taskId==="set-profile"?void 0:await this.checklistService.completeTask(this.buildCompleteTaskPayload(i));if(this.trackTaskComplete(e,i.taskId),o&&o.redirectUrl)this.showTaskCompletionMessage(i),i.taskId==="set-hub-url"&&this.handleSlugChangeSuccess(i,o);else{try{await u(this.configService.syncConfig())}catch(n){this.loggingService.error("Task saved, but the config refresh failed",{error:n instanceof Error?n.message:String(n),taskId:i.taskId}),this.snackbar.open("Saved. Reload the page to see the change.");return}i.taskId==="go-live"?this.handleGoLiveSuccess():t||this.showTaskCompletionMessage(i)}}catch(o){let n=o instanceof Error?o.message:String(o);this.loggingService.error("Failed to save task progress",{error:n,taskId:i.taskId}),this.trackTaskError(e,i.taskId,n),this.snackbar.open("Failed to save progress. Please try again.")}}trackChecklistToggle(e){let t=this.currentUser()?.campaign_user_id,s=this.config()?.campaignId;t!=null&&s!=null&&this.analytics.trackEvent({name:"checklist_toggled",context:{userId:t,hubId:s,timestamp:new Date().toISOString()},properties:{taskId:"checklist_toggle",taskTitle:"Getting Started Checklist",expanded:e}})}trackTaskNavigation(e){if(!e.routerLink)return;let t=this.currentUser()?.campaign_user_id,s=this.config()?.campaignId;t!=null&&s!=null&&this.analytics.trackEvent({name:"checklist_task_navigate",context:{userId:t,hubId:s,timestamp:new Date().toISOString()},properties:{taskId:e.id,taskTitle:e.title,routerLink:e.routerLink}})}trackChecklistDismissal(){let e=this.currentUser()?.campaign_user_id,t=this.config()?.campaignId;e!=null&&t!=null&&this.analytics.trackEvent({name:"checklist_dismissed_after_golive",context:{userId:e,hubId:t,timestamp:new Date().toISOString()},properties:{taskId:"checklist_dismissed",taskTitle:"Getting Started Checklist"}})}buildCompleteTaskPayload(e){switch(e.taskId){case"go-live":return{taskId:"go-live"};case"name-hub":if(!e.data?.hubName)throw new Error("Hub name is required for name-hub task");return{taskId:"name-hub",data:{hubName:e.data.hubName}};case"set-hub-url":if(!e.data?.slug)throw new Error("Slug is required for set-hub-url task");return{taskId:"set-hub-url",data:{slug:e.data.slug}};case"branding":return{taskId:"branding"};case"notifications":return{taskId:"notifications"};case"first-post":return{taskId:"first-post"};case"invite-members":throw new Error("invite-members task is not part of the getting started checklist");default:{let t=e;throw new Error(`Unknown or unhandled task ID: ${t?.taskId}`)}}}trackTaskStart(e){let t=this.currentUser()?.campaign_user_id,s=this.config()?.campaignId;t!=null&&s!=null&&this.analytics.trackEvent({name:"checklist_task_start",context:{userId:t,hubId:s,timestamp:new Date().toISOString()},properties:{taskId:e.id,taskTitle:e.title}})}trackTaskComplete(e,t){let s=this.currentUser()?.campaign_user_id,i=this.config()?.campaignId;s!=null&&i!=null&&this.analytics.trackEvent({name:"checklist_task_completed",context:{userId:s,hubId:i,timestamp:new Date().toISOString()},properties:{taskId:t,taskTitle:e.title}}
1)}trackTaskCancelled(e){let t=this.currentUser()?.campaign_user_id,s=this.config()?.campaignId;t!=null&&s!=null&&this.analytics.trackEvent({name:"checklist_task_cancelled",context:{userId:t,hubId:s,timestamp:new Date().toISOString()},properties:{taskId:e.id,taskTitle:e.title}})}trackTaskError(e,t,s){let i=this.currentUser()?.campaign_user_id,o=this.config()?.campaignId;i!=null&&o!=null&&this.analytics.trackEvent({name:"checklist_task_error",context:{userId:i,hubId:o,timestamp:new Date().toISOString()},properties:{taskId:t,taskTitle:e.title,error:s}})}trackExternalTaskCompletion(e,t){let s={id:e,title:t,completed:!0};this.trackTaskComplete(s,e)}trackPostEditorLaunched(e,t){let s=this.currentUser()?.campaign_user_id,i=this.config()?.campaignId;s!=null&&i!=null&&this.analytics.trackEvent({name:"post_editor_launched",context:{userId:s,hubId:i,timestamp:new Date().toISOString()},properties:{taskId:e,taskTitle:t,source:"first_post_dialog"}})}async checkAndTrackFirstPostCompletion(){try{(await u(this.checklistService.getChecklistState())).tasks.find(s=>s.taskId==="first-post")?.completed&&!this.hasTrackedFirstPostCompletion&&(this.hasTrackedFirstPostCompletion=!0,this.trackExternalTaskCompletion("first-post","Create Your First Post"))}catch(e){this.loggingService.warn("Failed to check first-post completion status",{error:e instanceof Error?e.message:String(e)})}}handleGoLiveSuccess(){let e=this.currentUser()?.campaign_user_id,t=this.config()?.campaignId;e!=null&&t!=null&&this.analytics.trackEvent({name:"go_live_success_modal",context:{userId:e,hubId:t,timestamp:new Date().toISOString()},properties:{taskId:"go-live",taskTitle:"Go Live!"}}),this.hasGoneLive.set(!0)}async handleSlugChangeSuccess(e,t){let s=e.data.slug,i=this.currentUser()?.campaign_user_id,o=this.config()?.campaignId;if(i!=null&&o!=null&&this.analytics.trackEvent({name:"checklist_slug_changed",context:{userId:i,hubId:o,timestamp:new Date().toISOString()},properties:{newSlug:s}}),k(this.platformId))if(t&&t.redirectUrl){let n=t.redirectUrl;this.loggingService.debug("Server provided redirect URL for slug change",{redirectUrl:n}),setTimeout(()=>{window.location.href=n},1e3)}else this.loggingService.debug("No redirect URL provided, reloading current page",{hostname:window.location.hostname}),setTimeout(()=>{window.location.reload()},1e3)}showTaskCompletionMessage(e){let t=e.taskId;if(t==="notifications"){let o=e.data?.permissionState,n;switch(o){case"granted":n="Notifications enabled successfully!";break;case"already-enabled":n="Notifications already enabled!";break;case"unsupported":n="Task completed (browser does not support notifications)";break;case"denied":n="Notification preference saved";break;default:n="Notification preference saved"}this.snackbar.open(n);return}let i={"set-profile":"Profile completed successfully!","name-hub":"Hub name saved successfully!","set-hub-url":"Hub URL saved successfully!",branding:"Branding updated successfully!","first-post":"First post created successfully!","go-live":"\u{1F389} Congratulations! Your Hub is now live!"}[t]||"Task completed successfully!";this.snackbar.open(i)}trackAutoCompletion(e){let t=this.currentUser()?.campaign_user_id,s=this.config()?.campaignId;t!=null&&s!=null&&this.analytics.trackEvent({name:"checklist_task_completed",context:{userId:t,hubId:s,timestamp:new Date().toISOString()},properties:{taskId:"notifications",taskTitle:"Enable Notifications",method:"auto",reason:e}})}async safeAutoCompleteNotifications(e){if(!(this.config()?.checklistProgress?.steps||[]).find(i=>i.taskId==="notifications")?.completed&&!this.autoCompleteInProgress.has("notifications")){this.autoCompleteInProgress.add("notifications");try{await this.checklistService.completeTask({taskId:"notifications"}),await u(this.configService.syncConfig()),this.trackAutoCompletion(e)}catch(i){this.autoCompleteInProgress.delete("notifications"),this.loggingService.error(`Failed to auto-complete notifications task (${e})`,{error:i instanceof Error?i.message:String(i)})}}}listenForNotificationChanges(){this.firebase.tokenChange$.pipe(T(e=>!!e.token),D(),x(Boolean),E(this.destroy$)).subscribe(async()=>{await this.safeAutoCompleteNotifications("token_received")})}async checkSetProfileRequired(){let e=this.currentUser(),t=e?.campaign_user_id,s=this.config()?.campaignId;if(!e||t==null||s==null){this.loggingService.warn("checkSetProfileRequired called without authentication",{hasUserId:t!=null,hasHubId:s!=null});return}if(!e.isOwner){this.loggingService.debug("checkSetProfileRequired skipped - user is not an owner",{userId:t,hubId:s,isOwner:!1});return}let i=this.config()?.checklistProgress;if(!i?.steps||i.steps.length===0){this.loggingService.debug("checkSetProfileRequired skipped - checklistProgress
1is empty",{userId:t,hubId:s,hasChecklistProgress:!!i,stepsCount:i?.steps?.length??0});return}let o=this.tasks().find(n=>n.id==="set-profile");!o||o.completed||(this.loggingService.debug("Auto-launching set-profile dialog for email signup owner",{taskId:"set-profile",userId:t,hubId:s,isOwner:!0}),this.analytics.trackEvent({name:"checklist_set_profile_auto_launch",context:{userId:t,hubId:s,timestamp:new Date().toISOString()},properties:{taskId:"set-profile",taskTitle:"Set Name & Password",isOwner:!0}}),await this.openAndCompleteTask(o))}static \u0275fac=function(t){return new(t||r)};static \u0275prov=g({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var Ge=(()=>{class r{dialogRef=a(q);router=a(H);postEditorService=a($);channelService=a(X);checklistFacade=a(se);logger=b("FirstPostDialogComponent");isComposing=!1;data=a(K);cancel(){this.dialogRef.close()}async composePost(){if(!this.isComposing){this.isComposing=!0;try{let e=this.dialogRef.afterClosed().pipe(S(1));await this.router.navigateByUrl("/home"),this.checklistFacade.trackPostEditorLaunched(this.data.task.id,this.data.task.title),this.dialogRef.close({completed:!1,taskId:this.data.task.id}),await u(e),await this.openPostEditor()}finally{this.isComposing=!1}}}async openPostEditor(){try{let e=await u(this.channelService.homeChannel$.pipe(S(1)));if(!e){this.logger.warn("Failed to open post editor: home channel not available",{operation:"openPostEditor"});return}await this.postEditorService.open({channels:[e],instantPublish:!0})}catch(e){let t=e;this.logger.captureException(t,{operation:"openPostEditor",error:t.message})}}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=F({type:r,selectors:[["ih-first-post-dialog"]],decls:23,vars:1,consts:[["ih-header",""],["ih-content",""],[1,"dialog-description"],[1,"tip-section"],["svgIcon","information"],[1,"tip-content"],["ih-footer",""],["mat-button","","type","button",3,"click"],["mat-raised-button","","color","primary","type","button",3,"click"]],template:function(t,s){t&1&&(c(0,"ih-basic-dialog"),h(1,0),d(2),f(),h(3,1),c(4,"p",2),d(5," Welcome your community with your first post! This is a great way to introduce yourself, explain what the Hub is about, and encourage members to start engaging with your content. "),l(),c(6,"div",3),L(7,"mat-icon",4),c(8,"div",5)(9,"strong"),d(10,"The create button will appear wherever you can create content. Look for it in the bottom right corner."),l(),c(11,"ul")(12,"li"),d(13,"Channels you select determine where the post will be published"),l(),c(14,"li"),d(15," Selecting Home reaches everyone, use specific channels to target audiences, combining both will maximize visibility "),l(),c(16,"li"),d(17,"You can adjust channels at any time, even after publishing"),l()()()(),f(),h(18,6),c(19,"button",7),v("click",function(){return s.cancel()}),d(20,"Cancel"),l(),c(21,"button",8),v("click",function(){return s.composePost()}),d(22,"Start creating"),l(),f(),l()),t&2&&(N(2),U(s.data.task.title))},dependencies:[j,R,G,B,V],styles:["[_nghost-%COMP%]{display:block}.dialog-description[_ngcontent-%COMP%]{margin:0 0 1.5rem;color:var(--color-text-secondary, rgba(0, 0, 0, .6));font-size:.95rem;line-height:1.5}.tip-section[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.75rem;padding:1rem;margin-bottom:.5rem;background:var(--color-background-secondary, #f5f5f5);border-radius:4px;font-size:.875rem}.tip-section[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{width:20px;height:20px;font-size:20px;color:var(--color-primary, #1976d2);flex-shrink:0;margin-top:2px}.tip-section[_ngcontent-%COMP%] .tip-content[_ngcontent-%COMP%]{flex:1;line-height:1.5}.tip-section[_ngcontent-%COMP%] .tip-content[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{display:block;margin-bottom:.5rem}.tip-section[_ngcontent-%COMP%] .tip-content[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin:.5rem 0;padding-left:1.25rem}.tip-section[_ngcontent-%COMP%] .tip-content[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{margin-bottom:.25rem}.tip-section[_ngcontent-%COMP%] .tip-content[_ngcontent-%COMP%] .tip-note[_ngcontent-%COMP%]{margin:.75rem 0 0;font-size:.8125rem;color:var(--color-text-secondary, rgba(0, 0, 0, .6))}"],changeDetection:0})}return r})();export{Ge as a,ie as b,se as c}; 2/**i18n:c9e569e2ecdb3e0de183c72d8315eadfdcb9da9e09d5ac2d9fef9056c1853e21*/
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.