How to use getConfigInfo method in storybook-root

Best JavaScript code snippet using storybook-root

sharepointlist.service.ts

Source:sharepointlist.service.ts Github

copy

Full Screen

...33export class SharepointlistService {34 //public webAbsoluteUrl = window.location.origin + "/leaveauto";35 public webAbsoluteUrl = "https://portal.bergerbd.com/leaveauto"; //uncomment for localhost //PendingApproval36 public apiUrl = "https://portal.bergerbd.com"; //uncomment for localhost //PendingApproval37 private getConfigInfo(){38 const mySP = pnp.sp.configure({39 headers:{40 "Accept": "application/json; odata=verbose"41 }42 }, this.webAbsoluteUrl);43 //console.log("Returned config: "+ mySP);44 return mySP;45 }; 46 47 private getApiConfigInfo(){48 const mySP = pnp.sp.configure({49 headers:{50 "Accept": "application/json; odata=verbose"51 }52 }, this.apiUrl);53 //console.log("Returned config: "+ mySP);54 return mySP;55 }; 56 constructor(private http: HttpClient) { }57 58 async getSPLoggedInUser():Promise<any>{ 59 let userADId;60 const apiUrl = this.webAbsoluteUrl + "/_api/web/currentuser?$expand=Groups"; 61 await this.http62 .get(apiUrl)63 .toPromise()64 .then(65 (res) => {66 userADId = JSON.parse(JSON.stringify(res)).Id;67 } 68 ).catch(69 (res)=>{70 const sringify = JSON.stringify(res);71 userADId = "";72 }73 );74 return Number(userADId);75 //return +userADId; 76 }77 async getEmpIdNdOffice(user?:any):Promise<any>{78 const logedUser = {79 Office: "",80 EmpID:"",81 ADId: 0,82 //Access:user.Access,83 }84 const userADId = Number(await this.getSPLoggedInUser()); 85 86 logedUser.ADId = userADId;87 88 //let apiUrl = "https://portaldv.bergerbd.com/leaveauto/_api/web/lists/getByTitle('BergerEmployeeInformation')/items?&$top=2000000&$select=EmployeeName,Email/ID,Email/Title,Email/EMail,OptManagerEmail/ID,OptManagerEmail/Title,DeptID,EmployeeId,EmployeeGrade,Department,Designation,OfficeLocation,Mobile,CostCenter,CompanyCode&$expand=Email/ID,OptManagerEmail/ID&$filter=Email/ID eq 1026"89 const apiUrl = this.webAbsoluteUrl + "/_api/web/lists/getByTitle('BergerEmployeeInformation')/items?&$top=2000000&$select=EmployeeName,Email/ID,Email/Title,Email/EMail,OptManagerEmail/ID,OptManagerEmail/Title,DeptID,EmployeeId,EmployeeGrade,Department,Designation,OfficeLocation,Mobile,CostCenter,CompanyCode&$expand=Email/ID,OptManagerEmail/ID&$filter=Email/ID eq '"+userADId+"'"; 90 await this.http91 .get(apiUrl)92 .toPromise()93 .then(94 (res) => {95 const sringify = JSON.stringify(res);96 const parse = JSON.parse(sringify);97 logedUser.Office = parse.value[0].OfficeLocation;98 logedUser.EmpID = parse.value[0].EmployeeId;99 console.log("Loged user's Office Location : " + logedUser.Office +"; Emp ID: "+ logedUser.EmpID);100 //alert("Loged user's OfficeLocation: " + parse.value[0].OfficeLocation +"; Emp ID: "+ parse.value[0].EmployeeId);101 } 102 )103 .catch(104 (res)=>{105 const sringify = JSON.stringify(res);106 if(userADId == 1026){107 logedUser.Office = "Corporate";108 logedUser.EmpID = "000";109 }else{110 logedUser.Office = "";111 logedUser.EmpID = "";112 //logedUser.Access = user.Access;113 }114 }115 );116 117 return logedUser;118 }119 // async getLoggedInUsersProcess(){ 120 // const user = {121 // ADId:0,122 // Access:"",123 // Office: "",124 // EmpID:"",125 // Locations:[], 126 // }127 128 // user.ADId = await this.getSPLoggedInUser();129 130 // const apiUrl = this.webAbsoluteUrl + "/_api/web/lists/getByTitle('PendingApproval')/items?&$top=2000&$select=Title,ProcessName,Status,RequestLink,Modified,Created,PendingWith/ID,PendingWith/Title,Author/ID,Author/Title&$expand=Author,PendingWith&$filter=Author/ID eq '"+Number(user.ADId)+"'&$orderby=ProcessName asc"; 131 // let items;132 // const data:IMyProcessItems[] = []; 133 // await this.http134 // .get(apiUrl)135 // .toPromise()136 // .then(137 // //.subscribe(138 // (res) => {139 // items = JSON.parse(JSON.stringify(res));140 // let pWith;141 // for(let i = 0; i< items.value.length; i++){142 // if(items.value[i].PendingWith != undefined){143 // pWith = items.value[i].PendingWith[0].Title;144 // }145 // const eachItem:IMyProcessItems = {146 // Title: items.value[i].Title,147 // ProcessName: items.value[i].ProcessName,148 // Author: items.value[i].Author,149 // Status: items.value[i].Status, 150 // PendingWith: pWith,151 // Created: items.value[i].Created,152 // Modified: items.value[i].Modified,153 // RequestLink: items.value[i].RequestLink154 // }155 156 // data.push(eachItem);157 // }158 // } 159 // ).catch(160 // (res)=>{161 // const sringify = JSON.stringify(res);162 // }163 // );164 // return data; 165 // }166 //========= for all dashboards start ==========167 // async getLoggedInUsersDashboards(){ 168 // const user = {169 // ADId:0,170 // Access:"",171 // Office: "",172 // EmpID:"",173 // Locations:[], 174 // }175 176 // //user.ADId = await this.getSPLoggedInUser(); // activate and implement for user access on dashboards177 178 // const apiUrl = this.webAbsoluteUrl + "/_api/web/lists/getByTitle('PendingApproval')/items?&$top=2000&$select=Title,ProcessName,Status,RequestLink,Modified,Created,PendingWith/ID,PendingWith/Title,Author/ID,Author/Title&$expand=Author,PendingWith&$orderby=ProcessName asc"; 179 // let items;180 // const data:IMyProcessItems[] = []; 181 // await this.http182 // .get(apiUrl)183 // .toPromise()184 // .then(185 // //.subscribe(186 // (res) => {187 // items = JSON.parse(JSON.stringify(res));188 // let pWith;189 // for(let i = 0; i< items.value.length; i++){190 // if(items.value[i].PendingWith != undefined){191 // pWith = items.value[i].PendingWith[0].Title;192 // }193 // const eachItem:IMyProcessItems = {194 // Title: items.value[i].Title,195 // ProcessName: items.value[i].ProcessName,196 // Author: items.value[i].Author,197 // Status: items.value[i].Status, 198 // PendingWith: pWith,199 // Created: items.value[i].Created,200 // Modified: items.value[i].Modified,201 // RequestLink: items.value[i].RequestLink202 // }203 204 // data.push(eachItem);205 // }206 // } 207 // ).catch(208 // (res)=>{209 // const sringify = JSON.stringify(res);210 // }211 // );212 // return data; 213 // }214 //-----------for all dashbboards ends ---------215 public async getUsersWFMasterListItems(list?: any, user?: any):Promise<any>{216 //let userADId = user;217 let data:any;218 //const data = 219 await from(this.getConfigInfo().web220 .lists.getByTitle(list.name) 221 .items.select(list.query)222 .expand('Author') 223 //.expand('PendingWith', 'Author') 224 //.filter("Author/ID eq '"+Number(userADId)+"'") 225 .orderBy('Created', false)226 .top(20000) 227 .get()228 .then((r:any)=>{229 data = r;230 return data;231 }) 232 );233 return data;234 //console.log("Fetched data by getLoggedUsersWFMasterListItems: "+ JSON.stringify(data));235 236 // if(user.Office == "Corporate"){237 // let data;238 // data = 239 // from(this.getConfigInfo().web240 // .lists.getByTitle(list.name) 241 // .items.select(list.query)242 // //.expand('Author') 243 // //.expand('PendingWith', 'Author') 244 // //.filter("Author/ID eq '"+Number(userADId)+"'") 245 // .orderBy('Created', false)246 // .top(20000) 247 // .get() 248 // );249 // //console.log("Fetched data by getLoggedUsersWFMasterListItems: "+ JSON.stringify(data));250 // return data;251 // }252 // else {253 // let data;254 // data = 255 // from(this.getConfigInfo().web256 // .lists.getByTitle(list.name)257 // .items258 // //.filter("Status eq 'Submitted'")259 // //.filter("Author/Office eq 'Corporate (9000)'")260 // //.filter(`substringof('Corporate' ,Author/Office)`)261 // .expand('Author')262 // //.expand('PendingWith', 'Author')263 // .orderBy('Created', false)264 // .select(list.query) 265 // //.filter("Author/ID eq '"+Number(userADId)+"'")266 // .top(100) 267 // .get() 268 // );269 // console.log("Fetched data by getLoggedUsersWFMasterListItems: "+ JSON.stringify(data));270 // return data;271 // }272 273 }274 public async getUsersWFMasterFewListItems(list?: any, user?: any):Promise<any>{275 const userADId = user;276 if(user.Office == "Corporate"){277 let data:any;278 await from(this.getConfigInfo().web279 .lists.getByTitle(list.name) 280 .items281 .orderBy('Created', false)282 .select(list.query)283 .expand('PendingWith', 'Author') 284 //.filter("Author/ID eq '"+Number(userADId)+"'") 285 .top(100) 286 .get()287 .then((r:any)=>{288 data = r;289 return data;290 }) 291 );292 //console.log("Fetched data by getLoggedUsersWFMasterListItems: "+ JSON.stringify(data));293 return data;294 }295 else {296 let data:any;297 await from(this.getConfigInfo().web298 .lists.getByTitle(list.name)299 .items300 .orderBy('Created', false)301 .filter("substringof('"+ user.Office +"' ,Author/Office)")302 .expand('PendingWith', 'Author') 303 .select(list.query) 304 //.filter("Author/ID eq '"+Number(userADId)+"'")305 .top(100) 306 .get() 307 .then((r:any)=>{308 data = r;309 return data;310 }) 311 );312 console.log("Fetched data by getLoggedUsersWFMasterListItems: "+ JSON.stringify(data));313 return data;314 }315 316 }317 public async getUsersTMMasterListItems(list?: any, user?: any):Promise<any>{318 let data:any; 319 const uempID = user;320 await from(this.getConfigInfo().web321 .lists.getByTitle(list.name) 322 .items.select('ID','RequestID','RequestorEmployeeID','RequestorName','RequestorLocation','RequestorBusinessArea','RequestorCostCenter','Division','MerchandizingType','RequestorEmail','Author/Title','RequestStatus','ApprovalStatus','PendingTo','Created','VendorName','VendorCode','VendorAddress','VendorEmail','VendorStatus','TotalAmount','GUID','Modified') 323 .filter("RequestorEmployeeID eq '"+uempID+"'")324 .expand('Author')325 .orderBy('Created', false)326 .top(200000) 327 .get()328 .then((r:any)=>{329 data = r;330 return data;331 }) 332 );333 //console.log("Fetched data by ListWithSppnpjs Service: "+ JSON.stringify(data));334 return data; 335 336 }337 public async getUsersWFOldMasterListItems(list?: any, user?: any):Promise<any>{338 let data:any; 339 const uempID = user;340 await from(this.getConfigInfo().web341 .lists.getByTitle(list.name) 342 .items.select(list.query) 343 .filter("RequestorEmployeeID eq '"+uempID+"'")344 .expand(list.expand)345 .orderBy('Created', false)346 .top(200000) 347 .get() 348 .then((r:any)=>{349 data = r;350 return data;351 }) 352 );353 //console.log("Fetched data by getUsersWFOldMasterListItems Service: "+ JSON.stringify(data));354 return data;355 }356 async getGroupedListItems(){357 //let all = this.workflows$;358 let group:any[];359 const all = await this.getMasterListItems();360 const allReq = await JSON.parse(JSON.stringify(all));361 362 await allReq363 .pipe(364 groupBy((workflow: Workflow) => workflow.ProcessName),365 // tap(console.log)366 mergeMap((workflowsGroup$: GroupedObservable<string, Workflow>) =>367 workflowsGroup$.pipe(368 reduce((acc: Array<Workflow>, cur: Workflow) => [...acc, cur], []),369 map((arr: Array<Workflow>) => {370 return {371 key: arr[0].ProcessName,372 value: [...arr]373 };374 }),375 tap((data: WorkflowGroup) => {group.push(data); console.log(data); console.log(group.length)})376 )377 )378 )379 .subscribe(()=>{380 const data = {381 all: allReq,382 grouped: group,383 }384 return data;385 });386 387 }388 public async getMasterListItemsWithParam(list?: any, user?: any){389 let data:any;390 await from(this.getConfigInfo().web391 .lists.getByTitle("PendingApproval") 392 .items.select('ID','Title','ProcessName','RequestedByName','Status','EmployeeID','RequestedByEmail','RequestLink','GUID','Modified','Created','PendingWith/ID','PendingWith/Title','Author/ID','Author/Title') //,'Author/ID','Author/Title','Author/Office','PendingWith/ID','PendingWith/Title',393 //.expand('Author', 'PendingWith')394 .expand('PendingWith', 'Author')395 .orderBy('Created', false)396 .top(200000) 397 .get() 398 );399 //console.log("Fetched data by SharepointlistService: "+ JSON.stringify(data));400 return data; 401 }402 public async getMasterListItems(){403 let data:any;404 await from(this.getConfigInfo().web405 .lists.getByTitle("PendingApproval") 406 .items.select('ID','Title','ProcessName','RequestedByName','Status','EmployeeID','RequestedByEmail','RequestLink','GUID','Modified','Created','PendingWith/ID','PendingWith/Title','Author/ID','Author/Title') //,'Author/ID','Author/Title','Author/Office','PendingWith/ID','PendingWith/Title',407 //.expand('Author', 'PendingWith')408 .expand('PendingWith', 'Author')409 .orderBy('Created', false)410 .top(200000) 411 .get() 412 );413 //console.log("Fetched data by SharepointlistService: "+ JSON.stringify(data));414 return data; 415 }416 //=============== only this generic method is being used for Emp Reimbursement & other Dashboards to fetch data =========417 public async fetchListItems(list?: any, user?: any):Promise<any>{418 const userADId = user;419 420 let data:any;421 await from(this.getConfigInfo().web.lists422 .getByTitle(list.name) 423 .items.select(list.select)424 .expand(list.expand)425 //.expand('PendingWith', 'Author') 426 //.filter(list.filter)427 //.filter("substringof('"+ user.Office +"' ,Author/Office)") 428 //.filter("Author/ID eq '"+Number(userADId)+"'")429 .orderBy('Created', false)430 .top(list.top) 431 .get() 432 ); 433 //console.log("Fetched data by fetchListItems service: "+ JSON.stringify(data));434 return data;435 }436 //=============== only this generic method is being used for Dashboard to fetch data =========437 public async fetchListItemsWithFilterExpand(list?: any, user?: any):Promise<any>{438 const userADId = user;439 440 let data:any;441 await from(this.getConfigInfo().web.lists442 .getByTitle(list.name) 443 .items.select(list.select)444 .expand(list.expand)445 .filter(list.filterBy+" eq '"+list.filterWith+"'" )446 //.filter(list.filter)447 //.filter("substringof('"+ user.Office +"' ,Author/Office)") 448 //.filter("Author/ID eq '"+Number(userADId)+"'")449 .orderBy('Created', false)450 .top(list.top) 451 .get() 452 ); 453 console.log("ConfigInfo: "+ JSON.stringify(data));454 return data;455 }456 //=============== only this generic method is being used for Dashboard to fetch data =========457 public async fetchListItemsWith3NdFilterExpand(list?: any, user?: any):Promise<any>{458 const userADId = user;459 460 let data:any;461 await from(this.getConfigInfo().web.lists462 .getByTitle(list.name) 463 .items.select(list.select)464 .expand(list.expand)465 .filter(`(${list.filterBy} eq '${list.filterWith}') and (IsAdjusted eq 'No') and (Status eq 'CashOfficerProcessed' or Status eq 'CompletedAsTravel')`) 466 .orderBy('Created', false)467 .top(list.top) 468 .get() 469 ); 470 //console.log("Fetched data by fetchListItems service: "+ JSON.stringify(data));471 return data;472 }473 //=============== only this generic method is being used for dynamic Dashboards to fetch data =========474 public async fetchListItemWithExpStFilOrd(list?: any, user?: any): Promise<any>{475 const userADId = user; 476 477 let data;478 try { 479 data = 480 from(this.getConfigInfo().web.lists481 .getByTitle(list.name)482 .items.select(list.select)483 .expand(list.expand)484 .filter(list.filter) 485 .orderBy(list.orderByPrm, list.orderByVal)486 .top(list.top)487 .get()); 488 //console.log("Fetched data by fetchListItems service: "+ JSON.stringify(data));489 return data;490 } catch(e) {491 console.log(e); 492 }493 494 }495 public getDataFrmLocSer(urn: string){496 return this.http.get(urn);497 }498 499 //=========get logged user Email================500 async getSPLoggedInUserEmail():Promise<any>{ 501 let userADEmail;502 const apiUrl = this.webAbsoluteUrl + "/_api/web/currentuser?$expand=Groups"; 503 await this.http504 .get(apiUrl)505 .toPromise()506 .then(507 (res) => {508 userADEmail = JSON.parse(JSON.stringify(res)).Email;509 } 510 ).catch(511 (res)=>{512 const sringify = JSON.stringify(res);513 userADEmail = "";514 }515 );516 //return Number(userADId);517 return userADEmail; 518 }519 //=========fetching list items with filter (filter by ADId)options ================520 public getItemsWithFilterExpand(list?: any, user?: any):Promise<any>{521 const userADId = user; 522 523 return this.getConfigInfo().web.lists524 .getByTitle(list.name) 525 .items.select(list.select)526 .expand(list.expand)527 //.filter("substringof('"+ user.Office +"' ,Author/Office)") 528 .filter(list.filterBy+" eq '"+Number(userADId)+"'")529 .orderBy('Created', false)530 .top(Number(list.top)) 531 .get()532 .then()533 .catch((rej)=>{534 console.log(rej.message);535 }) 536 //); 537 //console.log("Fetched data by getItemsWithFilterExpand service: "+ JSON.stringify(data));538 539 }540 //=========fetching list items with filter (filter by ADId)options ================541 // public getItemWithAnyFilterExpand(list?: any, user?: any):Promise<any>{542 // let userADId = user; 543 // let data;544 // data = 545 // from(this.getConfigInfo().web.lists546 // .getByTitle(list.name) 547 // .items.select(list.select)548 // .expand(list.expand)549 // //.filter("substringof('"+ user.Office +"' ,Author/Office)") 550 // .filter(list.filterBy+" eq '"+list.filterWith+"'")551 // .orderBy('Created', false)552 // .top(Number(list.top)) 553 // .get() 554 // ); 555 // //console.log("Fetched data by getItemsWithFilterExpand service: "+ JSON.stringify(data));556 // return data;557 // }558 //=========fetching list items with filter (filter by ADEmail)options ================559 // public getItemsWithEmailFilter(list?: any, userEmail?: any):Promise<any>{560 // //userEmail = "shoaib@bergerbd.com"; //should be comment out for production561 // let data;562 // data = 563 // from(this.getConfigInfo().web.lists564 // .getByTitle(list.name) 565 // .items.select(list.select)566 // .filter(list.filterBy+" eq '"+userEmail+"'")567 // .orderBy('Created', false)568 // .top(Number(list.top)) 569 // .get() 570 // ); 571 // //console.log("Fetched data by getItemsWithFilterExpand service: "+ JSON.stringify(data));572 // return data;573 // }574 //=========fetching list items without filter options ================575 // public getItemsWithoutFilter(list?: any, user?: any):Promise<any>{576 // let userADId = user;577 578 // let data;579 // data = 580 // from(this.getConfigInfo().web.lists581 // .getByTitle(list.name) 582 // .items.select(list.select)583 // .expand(list.expand)584 // //.filter("substringof('"+ user.Office +"' ,Author/Office)")585 // //.filter(list.filterBy+" eq '"+Number(userADId)+"'")586 // .orderBy('Created', false)587 // .top(list.top) 588 // .get() 589 // ); 590 // //console.log("Fetched data by fetchListItems service: "+ JSON.stringify(data));591 // return data;592 // }593 594 //=========fetching list items with Substring filter options ================595 // public getItemsWithFilterSubstringExpand(list?: any, user?: any):Promise<any>{596 // let userADId = user; 597 // let data;598 // data = 599 // from(this.getConfigInfo().web.lists600 // .getByTitle(list.name) 601 // .items.select(list.select)602 // .expand(list.expand)603 // .filter("substringof('"+ user.Office +"' ,"+ list.filterBy +')"')604 // //.filter("substringof('"+ user.Office +"' ,Author/Office)") 605 // .orderBy('Created', false)606 // .top(Number(list.top)) 607 // .get() 608 // ); 609 // //console.log("Fetched data by getItemsWithFilterSubstringExpand service: "+ JSON.stringify(data));610 // return data;611 // }612 //=========fetching list items without filter options ================613 // public getItemsWithoutExpandFilter(list?: any, user?: any):Promise<any>{614 // let userADId = user;615 616 // let data;617 // data = 618 // from(this.getConfigInfo().web.lists619 // .getByTitle(list.name) 620 // .items.select(list.select)621 // //.expand(list.expand)622 // //.filter("substringof('"+ user.Office +"' ,Author/Office)")623 // //.filter(list.filterBy+" eq '"+Number(userADId)+"'")624 // .orderBy('Created', false)625 // .top(list.top) 626 // .get() 627 // ); 628 // //console.log("Fetched data by fetchListItems service: "+ JSON.stringify(data));629 // return data;630 // }631 //=========fetching list items with filter and without expand options ================632 // public getFilteredItemsWithoutExpand(list?: any):Promise<any>{633 634 // let data;635 // data = 636 // from(this.getConfigInfo().web.lists637 // .getByTitle(list.name) 638 // .items.select(list.select)639 // .filter(list.filterBy+" eq '"+list.filterWith+"'")640 // .top(list.top) 641 // .get()642 // .catch((rej)=>{643 // console.log(rej.message);644 // }) 645 // ); 646 647 // return data;648 // }649 //======== add an item to the list start=============650 async saveListItem(list:any): Promise<any>{651 const savedItemInfo = {652 ID: null,653 GUID: null,654 }655 656 await this.getConfigInfo().web.lists.getByTitle(list.name).items.add(list.item).then((result: any) => { 657 // let rID= result.data.Id;658 // let rGUID= result.data.GUID;659 savedItemInfo.ID= result.data.Id;660 savedItemInfo.GUID= result.data.GUID; 661 }, (error: any): void => { 662 console.log('Error while creating the item: ' + error);663 });664 665 return savedItemInfo;666 }667 //-----------add an item to the list ends-----------668 //======== add an item to the list start=============669 async updateListItem(list:any): Promise<any>{670 const savedItemInfo = {671 ID: null,672 GUID: null,673 }674 675 await this.getConfigInfo().web.lists.getByTitle(list.name).items.getById(list.rId).update(list.item).then((result: any) => { 676 // let rID= result.data.Id;677 // let rGUID= result.data.GUID;678 savedItemInfo.ID= result.data.Id;679 savedItemInfo.GUID= result.data.GUID; 680 }, (error: any): void => { 681 console.log('Error while creating the item: ' + error);682 }); 683 684 return savedItemInfo;685 }686 //-----------add an item to the list ends-----------687 //======== add an item to the list start=============688 async addAttachment(list:any): Promise<any>{689 const savedItemInfo = {690 ID: null,691 GUID: null,692 }693 694 this.getConfigInfo().web.lists.getByTitle(list.name).items.getById(list.id).attachmentFiles.add(list.attachmentName, list.arrayBuffer).then((result) => { 695 //console.log(JSON.stringify(result));696 // let rID= result.data.Id;697 // let rGUID= result.data.GUID;698 savedItemInfo.ID= result.data.Id;699 savedItemInfo.GUID= result.data.GUID; 700 }, (error: any): void => { 701 console.log('Error while creating the item: ' + error);702 });703 704 return savedItemInfo;705 }706 //-----------add an item to the list ends-----------707 708 ...

Full Screen

Full Screen

config.ts

Source:config.ts Github

copy

Full Screen

...125): ConfigInfo<Key> {126 return config;127}128const CONFIGURABLE_SERVER_CONFIG = [129 getConfigInfo({130 key: 'prefix',131 type: 'string',132 isArray: false,133 description: "This bot's command prefix.",134 parser: getStringConfig,135 }),136 getConfigInfo({137 key: 'statistics',138 type: 'boolean',139 isArray: false,140 description: 'Enables statistics. Only the bot owner can change this.',141 restricted: true,142 parser: getBooleanConfig,143 }),144 getConfigInfo({145 key: 'japaneseRoles',146 type: 'role',147 isArray: true,148 description:149 'Roles for native Japanese speakers. This will affect hardcore mode and user statistics',150 parser: getStringArrayConfig,151 }),152 getConfigInfo({153 key: 'japaneseOnlyChannels',154 type: 'channel',155 isArray: true,156 description:157 'Channels where only Japanese is allowed. Must have `japaneseRoles` defined.',158 parser: getStringArrayConfig,159 }),160 getConfigInfo({161 key: 'beginnerJapaneseChannels',162 type: 'channel',163 isArray: true,164 description:165 'Channels where beginner kanji are allowed. Must have `japaneseRoles` defined.',166 parser: getStringArrayConfig,167 }),168 getConfigInfo({169 key: 'langExChannels',170 type: 'channel',171 isArray: true,172 description:173 'Channels where you need to talk in your target language. Must have `japaneseRoles` defined.',174 parser: getStringArrayConfig,175 }),176 getConfigInfo({177 key: 'hardcoreRole',178 type: 'role',179 isArray: false,180 description: 'Role used for hardcore mode.',181 parser: getStringConfig,182 }),183 getConfigInfo({184 key: 'hardcoreIgnoredChannels',185 type: 'channelOrCategory',186 isArray: true,187 description: 'Channels or categories that are ignored from hardcore mode.',188 parser: getStringArrayConfig,189 }),190 getConfigInfo({191 key: 'ignoredChannels',192 type: 'channelOrCategory',193 isArray: true,194 description:195 'Channels or categories that are ignored from server statistics. Bot commands will still work. Useful for channels like bot-spam or quiz.',196 parser: getStringArrayConfig,197 }),198 getConfigInfo({199 key: 'hiddenChannels',200 type: 'channelOrCategory',201 isArray: true,202 description:203 'Channels or categories that are hidden from general server statistics. Messages will still be counted, but these channels will only show up on user stats if the command is invoked from one of the hidden channels. Useful for mod channels as some mod commands only work in hidden channels.',204 parser: getStringArrayConfig,205 }),206 getConfigInfo({207 key: 'voiceMuteRoles',208 type: 'role',209 isArray: true,210 description: 'Role that mutes users in voice channels.',211 parser: getStringArrayConfig,212 }),213 getConfigInfo({214 key: 'focusRoles',215 type: 'role',216 isArray: true,217 description: 'Roles that make users not see/read channels.',218 parser: getStringArrayConfig,219 }),220 getConfigInfo({221 key: 'timeoutIndicatorRole',222 type: 'role',223 isArray: false,224 description:225 'Role that indicates users on timeout, either by selfmute or muted by mods. Useful with role icons',226 parser: getStringConfig,227 }),228 getConfigInfo({229 key: 'userLogChannel',230 type: 'channel',231 isArray: false,232 description:233 'Channel used for logging user join/leave notifications. Setting this channel enables these notifications. You can additinally enable "Log Name Changes" to log nickname/username changes in this channel.',234 parser: getStringConfig,235 }),236 getConfigInfo({237 key: 'logUserJoinLeaves',238 type: 'boolean',239 isArray: false,240 description: 'Enable logging user joins/leaves in the "User Log Channel".',241 parser: getBooleanConfig,242 }),243 getConfigInfo({244 key: 'logNameChanges',245 type: 'boolean',246 isArray: false,247 description:248 'Enable logging user nickname/username changes in the "User Log Channel".',249 parser: getBooleanConfig,250 }),251 getConfigInfo({252 key: 'modActionLogChannel',253 type: 'channel',254 isArray: false,255 description:256 'Channel used for logging mod actions (such as bans, message deletes) using Ciri commands. Note that if Ciri was NOT used to perform these actions they will NOT be logged.',257 parser: getStringConfig,258 }),259 getConfigInfo({260 key: 'modLogChannel',261 type: 'channel',262 isArray: false,263 description:264 'Channel used for logging verbose mod related information such as watched user actions.',265 parser: getStringConfig,266 }),267 getConfigInfo({268 key: 'userDMFallbackChannel',269 type: 'channel',270 isArray: false,271 description:272 'Channel used when the bot fails to DM the person for mod actions, such as the `warn` command or `mute` command.',273 parser: getStringConfig,274 }),275 getConfigInfo({276 key: 'ignoredBotPrefixes',277 type: 'string',278 isArray: true,279 description:280 'Prefixes that are used for other bots in the server. This will prevent bot commands from being included in the server statistics.',281 parser: getStringArrayConfig,282 }),283] as const;284const CONFIG_KEYS = CONFIGURABLE_SERVER_CONFIG.map((c) => c.key) as Readonly<285 (keyof ServerConfig)[]286>;287function formatStringType(type: ConfigType, value: string) {288 if (!value) return '`None`';289 if (type === 'channel' || type === 'channelOrCategory')...

Full Screen

Full Screen

depositService.js

Source:depositService.js Github

copy

Full Screen

...6class DepositService extends ApiService {7 constructor() {8 super();9 }10 getConfigInfo() {11 let authToken = window.localStorage.getItem("token");12 return {13 authToken: authToken,14 sysId: 'qWechat',15 client_id: 'wechat',16 appVersion: '1.0'17 }18 }19 /**20 * params:参数{searchKey:key}21 **/22 getBankCard = (params, needLoading = true) => {23 let headers = {'Content-Type': 'application/x-www-form-urlencoded'};24 params = {...params, ...this.getConfigInfo()};25 return this.post(Constant.API_HOST + Constant.QUERY_BANK_CARD, {params, headers, needLoading});26 }27 /**28 * params:参数{searchKey:key}29 **/30 getAvaiableAmt = (params, needLoading = true) => {31 let headers = {'Content-Type': 'application/x-www-form-urlencoded'};32 params = {...params, ...this.getConfigInfo()};33 return this.post(Constant.API_HOST + Constant.QUERY_AVAIABLE_AMT, {params, headers, needLoading});34 // return this.get('http://172.16.37.29:3001/api/getAvaiableAmt', {params, needLoading})35 }36 //校验交易密码37 hfPasswordCheck = (params, needLoading = true) => {38 let headers = {'Content-Type': 'application/x-www-form-urlencoded'};39 params = {...params, ...this.getConfigInfo()};40 return this.post(Constant.API_HOST + Constant.HF_PASSWORD_CHECK, {params, headers, needLoading});41 };42 /*充值*/43 deposit = (params, needLoading = true) => {44 let headers = {'Content-Type': 'application/x-www-form-urlencoded'};45 params = {...params, ...this.getConfigInfo()};46 return this.post(Constant.API_HOST + Constant.DEPOSIT_AMT, {params, headers, needLoading});47 };48 /*协议支付申请*/49 signedPayApply = (params, needLoading = true) => {50 let headers = {'Content-Type': 'application/x-www-form-urlencoded'};51 params = {...params, ...this.getConfigInfo()};52 return this.post(Constant.API_HOST + Constant.SIGNED_PAY_APPLY, {params, headers, needLoading});53 };54 /*协议支付确认*/55 signedPayConfirm = (params, needLoading = true) => {56 let headers = {'Content-Type': 'application/x-www-form-urlencoded'};57 params = {...params, ...this.getConfigInfo()};58 return this.post(Constant.API_HOST + Constant.SIGNED_PAY_CONFIRM, {params, headers, needLoading});59 };60 /*获取控台配置交易短信验证码开关*/61 getTradeSmsValidateSwitch = (params, needLoading = true) => {62 let headers = {'Content-Type': 'application/x-www-form-urlencoded'};63 params = {...params, ...this.getConfigInfo()};64 return this.post(Constant.API_HOST + Constant.WITHDRAW_CONFIG, {params, headers, needLoading});65 };66 /*发送交易短信*/67 sendTradeSms = (params, needLoading = true) => {68 let headers = {'Content-Type': 'application/x-www-form-urlencoded'};69 params = {...params, ...this.getConfigInfo()};70 return this.post(Constant.API_HOST + Constant.SEND_TRADE_SMS, {params, headers, needLoading});71 };72}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { getConfigInfo } from "storybook-root";2import { storiesOf } from "@storybook/react";3import React from "react";4storiesOf("Test", module).add("test", () => {5 const { config } = getConfigInfo();6 return <div>{config}</div>;7});8import { setConfigInfo } from "storybook-root";9setConfigInfo({10});11{12 "scripts": {13 },14 "devDependencies": {15 },16 "dependencies": {17 }18}19const path = require("path");20const rootDir = path.resolve(__dirname, "../");21const root = path.join.bind(path, rootDir);22module.exports = {23 resolve: {24 alias: {25 "storybook-root": root("node_modules/storybook-root")26 }27 }28};29import "storybook-root/register";30import "storybook-root/config";31import { getConfigInfo } from "storybook-root";32import { storiesOf } from "@storybook/react";33import React from "react";34storiesOf("Test", module).add("test", () => {35 const { config } = getConfigInfo();36 return <div>{config}</div>;37});38import { setConfigInfo } from "storybook-root";39setConfigInfo({40});

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful