PageSourceSearch

https://sociallab.sa/chunk-DzDqW1w_.js

js sociallab.sa collected 2026-10-01 23:54:35 UTC 13,475 bytes, 1 lines download raw bytes

1import {D as D$1}from'./chunk-DP0FjjND.js';import {f as fi}from'./chunk-BufvWJrK.js';import'./chunk-DVE9lSOz.js';import'./chunk-Bxzd0hMT.js';import {W as W$1}from'./chunk-CF84gehD.js';import {I}from'./chunk-CZeAMs3r.js';import'./chunk-CmdXsb3H.js';import'./chunk-DvLFd6NQ.js';import {R as Ri}from'./chunk-D46YmFa5.js';import {W,br as ht$1,E,D,cN as Ft,V,bK as P,bI as Gt,aE as ut$1,v as vr,co as Bg,e as f,O,X as Xb,j as Xv,R as RM,z as zg,bt as Lg,bu as Ts,bv as Og,bw as Pg,bQ as Zs,bx as Gt$1,by as Jc,T as Tt,N as Ng,w as w0,H as H0,bO as jh,Z as Zx,k as dn,b2 as da,cp as xr,da as wr,bP as Dh,bL as Sh,l as zw,bA as Nw,s as sk,n as nd,r as rC,m as wC,o as mv,p as GC,t as tD,q as vD,aO as cD,aP as hD,b0 as _D,aW as pD,aX as mD,u as al,cz as Wg,x as tM,y as dM,L as Lb,A as r1,P as P1,B as xS,C as Vs,F as zs,I as Fi,J as GS,K as iI,M as RI,Q as us,S as ms,Y as UI,bT as GI,_ as tE,$ as Dn,a0 as ME,a1 as ny,a2 as go,a3 as Kd,a4 as XE,a5 as LT,a6 as mA,cx as WM,a7 as mt,aa as Js,ac as H_,ad as gd,ae as pS,a9 as ZT,a8 as fy,bD as db,ab as Ey,ag as SC,ak as Ed,al as gS,aj as jy,ah as YT,ai as dy,bE as pb,bS as Y_,aT as d_,aD as By,bg as mS,aR as i_,aS as Vp,aU as Hp,bh as rS}from'./main-4WA6AAHG.js';var pt=n=>[n];function ut(n,g){n&1&&(Js(0,"div",3)(1,"mat-icon",21),H_(2,"event_busy"),gd(),Js(3,"p",22),H_(4),pS(5,"translate"),gd(),Js(6,"p",23),H_(7),pS(8,"translate"),gd()()),n&2&&(SC(4),jy(gS(5,2,"No Bookr configuration yet")),SC(3),jy(gS(8,4,"Configure Bookr to let your AI assistant book appointments for your business.")));}function gt(n,g){if(n&1&&(Js(0,"div",24)(1,"span",25),H_(2),pS(3,"translate"),pS(4,"translate"),gd(),Js(5,"span",26),H_(6),pS(7,"translate"),pS(8,"date"),gd()(),fy(9,"mat-divider",27)),n&2){let e=d_();SC(),dy("ngClass",e.settings.isActive?"badge-success":"badge-warn"),SC(),Ed(" ",e.settings.isActive?gS(3,4,"Active"):gS(4,6,"Inactive")," "),SC(4),By(" ",gS(7,8,"Created"),": ",mS(8,10,e.settings.createdOn,"mediumDate")," ");}}function ft(n,g){n&1&&(Js(0,"mat-error"),H_(1),pS(2,"translate"),gd()),n&2&&(SC(),jy(gS(2,1,"API Key is required")));}function vt(n,g){n&1&&(Js(0,"mat-error"),H_(1),pS(2,"translate"),gd()),n&2&&(SC(),jy(gS(2,1,"Vendor Slug is required")));}function ht(n,g){if(n&1){let e=i_();Js(0,"button",28),Ey("click",function(){Vp(e);let t=d_();return Hp(t.clearSelectedTemplate())}),Js(1,"mat-icon"),H_(2,"close"),gd()();}}function bt(n,g){if(n&1&&fy(0,"app-alert-message",14),n&2){let e=d_();dy("type",e.validationResult.isValid?"success":"error")("messages",rS(3,pt,e.validationMessage))("dismissible",true);}}function St(n,g){n&1&&fy(0,"mat-spinner",17);}function Mt(n,g){n&1&&(Js(0,"mat-icon"),H_(1,"wifi_tethering"),gd());}function Ct(n,g){if(n&1){let e=i_();Js(0,"button",29),Ey("click",function(){Vp(e);let t=d_();return Hp(t.deleteSettings())}),Js(1,"mat-icon"),H_(2,"delete"),gd(),H_(3),pS(4,"translate"),gd();}n&2&&(SC(3),Ed(" ",gS(4,1,"Delete Configuration")," "));}var xi=(()=>{class n{constructor(e,r,t,f,h,_,y,V,b){this.service=e,this.templatesService=r,this.loadingService=t,this.errorService=f,this.toastr=h,this.dialog=_,this.fb=y,this.dialogConfigService=V,this.translate=b,this.sub=new W,this.settings=null,this.isLoading=false,this.selectedTemplate=null,this.isValidating=false,this.validationResult=null,this.settingsForm=this.fb.group({apiKey:["",ht$1.required],vendorSlug:["",ht$1.required],confirmationTemplateId:[null],isActive:[true]});}ngOnInit(){this.loadSettings();}ngOnDestroy(){this.sub.unsubscribe();}loadSettings(){this.isLoading=true,this.loadingService.beginSuppress(),this.sub.add(this.service.getMyBookrSettings().subscribe({next:e=>{this.isLoading=false,this.loadingService.endSuppress(),e.succeeded&&(this.settings=e.data??null,this.applyToForm());},error:e=>{this.isLoading=false,this.loadingService.endSuppress(),this.errorService.setError(e,"Error loading Bookr configuration");}}));}applyToForm(){this.settings?(this.settingsForm.patchValue({apiKey:this.settings.hasApiKey?this.settings.maskedApiKey:"",vendorSlug:this.settings.vendorSlug??"",confirmationTemplateId:this.settings.confirmationTemplateId??null,isActive:this.settings.isActive}),this.settings.confirmationTemplateId?this.loadSelectedTemplate(this.settings.confirmationTemplateId):this.selectedTemplate=null):(this.selectedTemplate=null,this.settingsForm.reset({apiKey:"",vendorSlug:"",confirmationTemplateId:null,isActive:true}));}loadSelectedTemplate(e){this.sub.add(this.templatesService.getTemplateById(e).subscribe({next:r=>{r.succeeded&&(this.selectedTemplate=r.data??null);}}));}openSelectTemplateDialog(){let e=this.dialogConfigService.getDefaultDialogConfig();this.dialog.open(fi,E(D({},e),{data:{isLibrary:null}})).afterClosed().subscribe(t=>{t&&(this.selectedTemplate=t,this.settingsForm.patchValue({confirmationTemplateId:t.id}));});}clearSelectedTemplate(){this.selectedTemplate=null,this.settingsForm.patchValue({confirmationTemplateId:null});}
1save(){if(this.settingsForm.invalid){this.settingsForm.markAllAsTouched();return}let e=this.settingsForm.value;if(this.settings?.isActive===true&&e.isActive===false){this.confirmBookrImpact(()=>this.submitSave(e),()=>{this.settingsForm.patchValue({isActive:true});});return}this.submitSave(e);}submitSave(e){let r={apiKey:e.apiKey,vendorSlug:e.vendorSlug,confirmationTemplateId:e.confirmationTemplateId||null,isActive:e.isActive};this.loadingService.loadingOn(),this.sub.add(this.service.addOrUpdateMyBookrSettings(r).subscribe({next:t=>{this.loadingService.loadingOff(),t.succeeded?(this.settings=t.data??null,this.applyToForm(),this.toastr.success("Bookr configuration saved successfully")):this.errorService.setError(t,"Failed to save Bookr configuration");},error:t=>{this.loadingService.loadingOff(),this.errorService.setError(t,"Error saving Bookr configuration");}}));}validateConnection(){let e=this.settingsForm.value,r={apiKey:e.apiKey||null,vendorSlug:e.vendorSlug||null};this.isValidating=true,this.validationResult=null,this.loadingService.beginSuppress(),this.sub.add(this.service.validateMyBookrSettings(r).subscribe({next:t=>{this.isValidating=false,this.loadingService.endSuppress(),this.validationResult=t.succeeded&&t.data?t.data:{isValid:false,vendorName:null,servicesCount:null,error:null};},error:()=>{this.isValidating=false,this.loadingService.endSuppress(),this.validationResult={isValid:false,vendorName:null,servicesCount:null,error:null};}}));}get validationMessage(){let e=this.validationResult;if(!e)return "";if(e.isValid){let r=(e.vendorName??"").trim(),t=e.servicesCount;return r&&t!=null?this.translate.instant("BookrValidateConnected",{vendor:r,count:t}):r?this.translate.instant("BookrValidateConnectedNoCount",{vendor:r}):t!=null?this.translate.instant("BookrValidateConnectedCountOnly",{count:t}):this.translate.instant("Connected")}return e.error||this.translate.instant("Connection failed. Check the API key, vendor slug and base URL, then try again.")}deleteSettings(){this.confirmBookrImpact(()=>this.submitDelete(),void 0,true);}submitDelete(){this.loadingService.loadingOn(),this.sub.add(this.service.deleteMyBookrSettings().subscribe({next:e=>{this.loadingService.loadingOff(),e.succeeded?(this.settings=null,this.applyToForm(),this.toastr.success("Bookr configuration deleted successfully")):this.errorService.setError(e,"Failed to delete Bookr configuration");},error:e=>{this.loadingService.loadingOff(),this.errorService.setError(e,"Error deleting Bookr configuration");}}));}confirmBookrImpact(e,r,t=false){this.sub.add(this.service.getMyBookrAffectedAssistants().subscribe({next:f=>{let h=f.succeeded?f.data??[]:[];if(h.length===0){t?this.dialog.open(Ri,{width:"400px",data:true}).afterClosed().subscribe(mt=>mt?e():r?.()):e();return}let _=h.map(b=>b.name).join("\u060C "),y=this.dialogConfigService.getDefaultDialogConfig();this.dialog.open(Ft,E(D({},y),{width:"520px",maxWidth:"92vw",data:{title:"This will stop AI booking replies",message:this.translate.instant("BookrImpactConfirmMessage",{count:h.length,names:_}),confirmText:"Confirm",cancelText:"Cancel",confirmColor:"warn",cancelColor:"primary",icon:"warning_amber"}})).afterClosed().subscribe(b=>b?e():r?.());},error:()=>{this.dialog.open(Ri,{width:"400px",data:true}).afterClosed().subscribe(h=>h?e():r?.());}}));}static{this.\u0275fac=function(r){return new(r||n)(V(D$1),V(I),V(P),V(Gt),V(ut$1),V(vr),V(Bg),V(f),V(O))};}static{this.\u0275cmp=Xb({type:n,selectors:[["app-bookr-integration"]],decls:64,vars:48,consts:[[1,"cardWithShadow","theme-card"],[1,"m-r-4"],[1,"b-t-1","m-t-16"],[1,"no-key-section","text-center","p-32"],[3,"formGroup"],[1,"col-12"],[1,"w-100","m-b-16"],["matInput","","formControlName","apiKey","type","password","required","","autocomplete","new-password"],["matInput","","formControlName","vendorSlug","required",""],["matInput","","readonly","",3,"value","placeholder"],["mat-icon-button","","matSuffix","","type","button","color","primary","aria-label","search",3,"click"],["mat-icon-button","","matSuffix","","type","button","color","warn","aria-label","close"],[1,"m-b-16"],["formControlName","isActive"],[3,"type","messages","dismissible"],[1,"d-flex","justify-content-end","align-items-center","gap-8","m-b-8","m-t-16","flex-wrap"],["type","button","mat-stroked-button","","color","primary",3,"click","disabled"],["diameter","18",1,"btn-spinner"],[1,"header-spacer"],["type","button","mat-stroked-button","","color","warn"],["type","button","mat-flat-button","","color","primary",3,"click"],[1,"f-s-48","text-muted","d-block","m-b-16"],[1,"f-s-16","m-b-8"],[1,"text-muted","m-b-24"],[1,"m-b-16","m-t-16"],[1,"badge",3,"ngClass"],[1,"text-muted","f-s-12","m-l-8"],[1,"m-b-24"],["mat-icon-button","","matSuffix","","type","button","color","warn","aria-label","close",3,"click"],["type","button","mat-stroked-button","","color","warn",3,"click"]],template:function(r,t){r&1&&(Js(0,"mat-card",0)(1,"mat-card-header")(2,"mat-card-title")(3,"mat-icon",1),H_(4,"event_available"),gd(),H_(5),pS(6,"translate"),gd(),Js(7,"mat-card-subtitle"),H_(8),pS(9,"translate"),gd()(),Js(10,"mat-card-content",2),ZT(11,ut,9,6,"div",3),ZT(12,gt,10,13),Js(13,"form",4)(14,"div",5)(15,"mat-form-field",6)(16,"mat-label"),H_(17),pS(18,"translate"),gd(),fy(19,"input",7),db(),Js(20,"mat-hint"),H_(21),pS(22,"translate"),gd(),ZT(23,ft,3,3,"mat-error"),gd()(),Js(24,"div",5)(25,"mat-form-field",6)(26,"mat-label"),H_(27),pS(28,"translate"),gd(),fy(29,"input",8),db(),Js(30,"mat-hint"),H_(31),pS(32,"translate"),gd(),ZT(33,vt,3,3,"mat-error"),gd()(),Js(34,"div",5)(35,"mat-form-field",6)(36,"mat-label"),H_(37),pS(38,"translate"),gd(),fy(39,"input",9),pS(40,"translate"),Js(41,"button",10),Ey("click",function(){return t.openSelectTemplateDialog()}),Js(42,"mat-icon"),H_(43,"search"),gd()(),ZT(44,ht,3,0,"button",11),Js(45,"mat-hint"),H_(46),pS(47,"translate"),gd()()(),Js(48,"div",12)(49,"mat-checkbox",13),H_(50),pS(51,"translate"),gd(),db(),gd(),ZT(52,bt,1,5,"app-alert-message",14),Js(53,"div",15)(54,"button",16),Ey("click",function(){return t.validateConnection()}),ZT(55,St,1,0,"mat-spinner",17)(56,Mt,2,0,"mat-icon"),H_(57),pS(58,"translate"),gd(),fy(59,"span",18),ZT(60,Ct,5,3,"button",19),Js(61,"button",20),Ey("click",function(){return t.save()}),H_(62),pS(63,"translate"),gd()()()()()),r&2&&(SC(5),Ed(" ",gS(6,24,"Bookr Integration")," "),SC(3),jy(gS(9,26,"Manage your Bookr booking integration credentials.")),SC(3),YT(!t.settings&&!t.isLoading?11:-1),SC(),YT(t.settings?12:-1),SC(),dy("formGroup",t.settingsForm),SC(4),jy(gS(18,28,"API Key")),SC(2),pb(),SC(2),jy(gS(22,30,"This is a masked placeholder, not your real key. Leave it as-is to keep your current key, or type a new key to replace it.")),SC(2),YT(t.settingsForm.get("apiKey")?.hasError("required")&&t.settingsForm.get("apiKey")?.touched?23:-1),SC(4),jy(gS(28,32,"Vendor Slug")),SC(2),pb(),SC(2),jy(gS(32,34,"Vendor slug is provided by Bookr for your business.")),SC(2),YT(t.settingsForm.get("vendorSlug")?.hasError("required")&&t.settingsForm.get("vendorSlug")?.touched?33:-1),SC(4),jy(gS(38,3
16,"Confirmation Template")),SC(2),dy("placeholder",Y_(gS(40,38,"Select Confirmation Template")))("value",t.selectedTemplate?.friendlyName||""),SC(5),YT(t.selectedTemplate?44:-1),SC(2),jy(gS(47,40,"Optional \u2014 used to send the booking confirmation via WhatsApp when needed.")),SC(3),pb(),SC(),jy(gS(51,42,"Is Active")),SC(2),YT(t.validationResult?52:-1),SC(2),dy("disabled",t.isValidating||t.settingsForm.invalid),SC(),YT(t.isValidating?55:56),SC(2),Ed(" ",gS(58,44,"Validate connection")," "),SC(3),YT(t.settings?60:-1),SC(2),Ed(" ",gS(63,46,"Save Configuration")," "));},dependencies:[Xv,RM,zg,Lg,Ts,Og,Pg,Zs,Gt$1,Jc,Tt,W$1,Ng,w0,H0,jh,Zx,dn,da,xr,wr,Dh,Sh,zw,Nw,sk,nd,rC,wC,mv,GC,tD,vD,cD,hD,_D,pD,mD,al,Wg,tM,dM,Lb,r1,P1,xS,Vs,zs,Fi,GS,iI,RI,us,ms,UI,GI,tE,Dn,ME,ny,go,Kd,XE,LT,mA,WM,mt],styles:[".badge[_ngcontent-%COMP%]{display:inline-block;padding:4px 12px;border-radius:var(--radius-card);font-size:var(--font-size-xs);font-weight:600}.badge.badge-success[_ngcontent-%COMP%]{background:#e6fffa;color:#13deb9}.badge.badge-warn[_ngcontent-%COMP%]{background:#fef5e5;color:#ffae1f}.no-key-section[_ngcontent-%COMP%]   mat-icon[_ngcontent-%COMP%]{font-size:var(--font-size-5xl);height:48px;width:48px;color:#5d6b85}.gap-8[_ngcontent-%COMP%]{gap:8px}.header-spacer[_ngcontent-%COMP%]{flex:1}.btn-spinner[_ngcontent-%COMP%]{display:inline-block;margin-inline-end:8px;vertical-align:middle}"],changeDetection:1});}}return n})();export{xi as BookrIntegrationComponent};

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.