@osise/api-client 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -0
- package/dist/cjs/api/admin-b2b.js +260 -0
- package/dist/cjs/api/admin-b2b.js.map +1 -0
- package/dist/cjs/api/admin-finance.js +78 -0
- package/dist/cjs/api/admin-finance.js.map +1 -0
- package/dist/cjs/api/admin-payouts.js +54 -0
- package/dist/cjs/api/admin-payouts.js.map +1 -0
- package/dist/cjs/api/admin-qc.js +237 -0
- package/dist/cjs/api/admin-qc.js.map +1 -0
- package/dist/cjs/api/admin.js +280 -24
- package/dist/cjs/api/admin.js.map +1 -1
- package/dist/cjs/api/b2b.js +124 -0
- package/dist/cjs/api/b2b.js.map +1 -0
- package/dist/cjs/api/communication.js +283 -0
- package/dist/cjs/api/communication.js.map +1 -0
- package/dist/cjs/api/index.js +33 -1
- package/dist/cjs/api/index.js.map +1 -1
- package/dist/cjs/api/jobs.js +304 -43
- package/dist/cjs/api/jobs.js.map +1 -1
- package/dist/cjs/api/location.js +91 -0
- package/dist/cjs/api/location.js.map +1 -0
- package/dist/cjs/api/payments.js +129 -0
- package/dist/cjs/api/payments.js.map +1 -0
- package/dist/cjs/api/support.js +148 -0
- package/dist/cjs/api/support.js.map +1 -0
- package/dist/cjs/hooks/index.js +1738 -4
- package/dist/cjs/hooks/index.js.map +1 -1
- package/dist/cjs/index.js +35 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/admin-finance.js +7 -0
- package/dist/cjs/types/admin-finance.js.map +1 -0
- package/dist/cjs/types/admin-invoice.js +7 -0
- package/dist/cjs/types/admin-invoice.js.map +1 -0
- package/dist/cjs/types/admin-payout.js +7 -0
- package/dist/cjs/types/admin-payout.js.map +1 -0
- package/dist/cjs/types/b2b.js +7 -0
- package/dist/cjs/types/b2b.js.map +1 -0
- package/dist/cjs/types/communication.js +90 -0
- package/dist/cjs/types/communication.js.map +1 -0
- package/dist/cjs/types/enums.js +343 -1
- package/dist/cjs/types/enums.js.map +1 -1
- package/dist/cjs/types/index.js +18 -2
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/types/job.js +1 -0
- package/dist/cjs/types/job.js.map +1 -1
- package/dist/cjs/types/location.js +7 -0
- package/dist/cjs/types/location.js.map +1 -0
- package/dist/cjs/types/payment.js +7 -0
- package/dist/cjs/types/payment.js.map +1 -0
- package/dist/cjs/types/qc.js +8 -0
- package/dist/cjs/types/qc.js.map +1 -0
- package/dist/cjs/types/support.js +7 -0
- package/dist/cjs/types/support.js.map +1 -0
- package/dist/esm/api/admin-b2b.js +255 -0
- package/dist/esm/api/admin-b2b.js.map +1 -0
- package/dist/esm/api/admin-finance.js +74 -0
- package/dist/esm/api/admin-finance.js.map +1 -0
- package/dist/esm/api/admin-payouts.js +50 -0
- package/dist/esm/api/admin-payouts.js.map +1 -0
- package/dist/esm/api/admin-qc.js +233 -0
- package/dist/esm/api/admin-qc.js.map +1 -0
- package/dist/esm/api/admin.js +275 -22
- package/dist/esm/api/admin.js.map +1 -1
- package/dist/esm/api/b2b.js +120 -0
- package/dist/esm/api/b2b.js.map +1 -0
- package/dist/esm/api/communication.js +275 -0
- package/dist/esm/api/communication.js.map +1 -0
- package/dist/esm/api/index.js +10 -1
- package/dist/esm/api/index.js.map +1 -1
- package/dist/esm/api/jobs.js +304 -43
- package/dist/esm/api/jobs.js.map +1 -1
- package/dist/esm/api/location.js +87 -0
- package/dist/esm/api/location.js.map +1 -0
- package/dist/esm/api/payments.js +124 -0
- package/dist/esm/api/payments.js.map +1 -0
- package/dist/esm/api/support.js +143 -0
- package/dist/esm/api/support.js.map +1 -0
- package/dist/esm/hooks/index.js +1552 -3
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/index.js +36 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/admin-finance.js +6 -0
- package/dist/esm/types/admin-finance.js.map +1 -0
- package/dist/esm/types/admin-invoice.js +6 -0
- package/dist/esm/types/admin-invoice.js.map +1 -0
- package/dist/esm/types/admin-payout.js +6 -0
- package/dist/esm/types/admin-payout.js.map +1 -0
- package/dist/esm/types/b2b.js +6 -0
- package/dist/esm/types/b2b.js.map +1 -0
- package/dist/esm/types/communication.js +87 -0
- package/dist/esm/types/communication.js.map +1 -0
- package/dist/esm/types/enums.js +341 -0
- package/dist/esm/types/enums.js.map +1 -1
- package/dist/esm/types/index.js +18 -2
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/types/job.js +1 -0
- package/dist/esm/types/job.js.map +1 -1
- package/dist/esm/types/location.js +6 -0
- package/dist/esm/types/location.js.map +1 -0
- package/dist/esm/types/payment.js +6 -0
- package/dist/esm/types/payment.js.map +1 -0
- package/dist/esm/types/qc.js +7 -0
- package/dist/esm/types/qc.js.map +1 -0
- package/dist/esm/types/support.js +6 -0
- package/dist/esm/types/support.js.map +1 -0
- package/dist/types/api/admin-b2b.d.ts +225 -0
- package/dist/types/api/admin-b2b.d.ts.map +1 -0
- package/dist/types/api/admin-finance.d.ts +52 -0
- package/dist/types/api/admin-finance.d.ts.map +1 -0
- package/dist/types/api/admin-payouts.d.ts +37 -0
- package/dist/types/api/admin-payouts.d.ts.map +1 -0
- package/dist/types/api/admin-qc.d.ts +157 -0
- package/dist/types/api/admin-qc.d.ts.map +1 -0
- package/dist/types/api/admin.d.ts +184 -17
- package/dist/types/api/admin.d.ts.map +1 -1
- package/dist/types/api/b2b.d.ts +77 -0
- package/dist/types/api/b2b.d.ts.map +1 -0
- package/dist/types/api/communication.d.ts +201 -0
- package/dist/types/api/communication.d.ts.map +1 -0
- package/dist/types/api/index.d.ts +10 -1
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/jobs.d.ts +197 -38
- package/dist/types/api/jobs.d.ts.map +1 -1
- package/dist/types/api/location.d.ts +76 -0
- package/dist/types/api/location.d.ts.map +1 -0
- package/dist/types/api/payments.d.ts +81 -0
- package/dist/types/api/payments.d.ts.map +1 -0
- package/dist/types/api/support.d.ts +101 -0
- package/dist/types/api/support.d.ts.map +1 -0
- package/dist/types/hooks/index.d.ts +965 -6
- package/dist/types/hooks/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +32 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types/admin-finance.d.ts +265 -0
- package/dist/types/types/admin-finance.d.ts.map +1 -0
- package/dist/types/types/admin-invoice.d.ts +262 -0
- package/dist/types/types/admin-invoice.d.ts.map +1 -0
- package/dist/types/types/admin-payout.d.ts +180 -0
- package/dist/types/types/admin-payout.d.ts.map +1 -0
- package/dist/types/types/admin.d.ts +1341 -0
- package/dist/types/types/admin.d.ts.map +1 -1
- package/dist/types/types/b2b.d.ts +687 -0
- package/dist/types/types/b2b.d.ts.map +1 -0
- package/dist/types/types/communication.d.ts +670 -0
- package/dist/types/types/communication.d.ts.map +1 -0
- package/dist/types/types/enums.d.ts +311 -0
- package/dist/types/types/enums.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +10 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/job.d.ts +576 -55
- package/dist/types/types/job.d.ts.map +1 -1
- package/dist/types/types/location.d.ts +74 -0
- package/dist/types/types/location.d.ts.map +1 -0
- package/dist/types/types/payment.d.ts +281 -0
- package/dist/types/types/payment.d.ts.map +1 -0
- package/dist/types/types/qc.d.ts +589 -0
- package/dist/types/types/qc.d.ts.map +1 -0
- package/dist/types/types/support.d.ts +194 -0
- package/dist/types/types/support.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/esm/hooks/index.js
CHANGED
|
@@ -244,6 +244,7 @@ export function useCurrentUser() {
|
|
|
244
244
|
enabled: isAuthenticated,
|
|
245
245
|
});
|
|
246
246
|
}
|
|
247
|
+
// ==================== Consumer Hooks ====================
|
|
247
248
|
/**
|
|
248
249
|
* Hook for consumer profile
|
|
249
250
|
*/
|
|
@@ -335,6 +336,33 @@ export function useArtisanPerformance() {
|
|
|
335
336
|
enabled: isAuthenticated,
|
|
336
337
|
});
|
|
337
338
|
}
|
|
339
|
+
// ==================== Job Hooks ====================
|
|
340
|
+
// ==================== Service Categories Hooks ====================
|
|
341
|
+
/**
|
|
342
|
+
* Hook for service categories
|
|
343
|
+
*/
|
|
344
|
+
export function useServiceCategories() {
|
|
345
|
+
const client = useOsiseClient();
|
|
346
|
+
return useQuery(() => client.serviceCategories.list());
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Hook for a specific service category
|
|
350
|
+
*/
|
|
351
|
+
export function useServiceCategory(categoryId) {
|
|
352
|
+
const client = useOsiseClient();
|
|
353
|
+
return useQuery(() => client.serviceCategories.get(categoryId), {
|
|
354
|
+
enabled: !!categoryId,
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
// ==================== Job Estimate Hooks ====================
|
|
358
|
+
/**
|
|
359
|
+
* Hook for getting a job estimate
|
|
360
|
+
*/
|
|
361
|
+
export function useEstimate() {
|
|
362
|
+
const client = useOsiseClient();
|
|
363
|
+
return useMutation((data) => client.jobs.getEstimate(data));
|
|
364
|
+
}
|
|
365
|
+
// ==================== Consumer Job Hooks ====================
|
|
338
366
|
/**
|
|
339
367
|
* Hook for consumer jobs
|
|
340
368
|
*/
|
|
@@ -345,6 +373,190 @@ export function useConsumerJobs(params) {
|
|
|
345
373
|
enabled: isAuthenticated,
|
|
346
374
|
});
|
|
347
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* Alias for useConsumerJobs
|
|
378
|
+
*/
|
|
379
|
+
export function useJobs(params) {
|
|
380
|
+
return useConsumerJobs(params);
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Hook for a specific job
|
|
384
|
+
*/
|
|
385
|
+
export function useJob(jobId) {
|
|
386
|
+
const client = useOsiseClient();
|
|
387
|
+
const isAuthenticated = useIsAuthenticated();
|
|
388
|
+
return useQuery(() => client.jobs.get(jobId), {
|
|
389
|
+
enabled: isAuthenticated && !!jobId,
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Hook for job status
|
|
394
|
+
*/
|
|
395
|
+
export function useJobStatus(jobId) {
|
|
396
|
+
const client = useOsiseClient();
|
|
397
|
+
const isAuthenticated = useIsAuthenticated();
|
|
398
|
+
return useQuery(() => client.jobs.getStatus(jobId), {
|
|
399
|
+
enabled: isAuthenticated && !!jobId,
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Hook for job updates/timeline
|
|
404
|
+
*/
|
|
405
|
+
export function useJobUpdates(jobId) {
|
|
406
|
+
const client = useOsiseClient();
|
|
407
|
+
const isAuthenticated = useIsAuthenticated();
|
|
408
|
+
return useQuery(() => client.jobs.getUpdates(jobId), {
|
|
409
|
+
enabled: isAuthenticated && !!jobId,
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Hook for job artisan info
|
|
414
|
+
*/
|
|
415
|
+
export function useJobArtisan(jobId) {
|
|
416
|
+
const client = useOsiseClient();
|
|
417
|
+
const isAuthenticated = useIsAuthenticated();
|
|
418
|
+
return useQuery(() => client.jobs.getArtisan(jobId), {
|
|
419
|
+
enabled: isAuthenticated && !!jobId,
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Hook for job ETA
|
|
424
|
+
*/
|
|
425
|
+
export function useJobEta(jobId) {
|
|
426
|
+
const client = useOsiseClient();
|
|
427
|
+
const isAuthenticated = useIsAuthenticated();
|
|
428
|
+
return useQuery(() => client.jobs.getEta(jobId), {
|
|
429
|
+
enabled: isAuthenticated && !!jobId,
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Hook for artisan location
|
|
434
|
+
*/
|
|
435
|
+
export function useJobLocation(jobId) {
|
|
436
|
+
const client = useOsiseClient();
|
|
437
|
+
const isAuthenticated = useIsAuthenticated();
|
|
438
|
+
return useQuery(() => client.jobs.getLocation(jobId), {
|
|
439
|
+
enabled: isAuthenticated && !!jobId,
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Hook for creating a job
|
|
444
|
+
*/
|
|
445
|
+
export function useCreateJob() {
|
|
446
|
+
const client = useOsiseClient();
|
|
447
|
+
return useMutation((data) => client.jobs.create(data));
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Hook for cancelling a job
|
|
451
|
+
*/
|
|
452
|
+
export function useCancelJob() {
|
|
453
|
+
const client = useOsiseClient();
|
|
454
|
+
return useMutation(({ jobId, reason }) => client.jobs.cancel(jobId, { reason }));
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Hook for rescheduling a job
|
|
458
|
+
*/
|
|
459
|
+
export function useRescheduleJob() {
|
|
460
|
+
const client = useOsiseClient();
|
|
461
|
+
return useMutation(({ jobId, data }) => client.jobs.reschedule(jobId, data));
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Hook for escalating a job
|
|
465
|
+
*/
|
|
466
|
+
export function useEscalateJob() {
|
|
467
|
+
const client = useOsiseClient();
|
|
468
|
+
return useMutation(({ jobId, data }) => client.jobs.escalate(jobId, data));
|
|
469
|
+
}
|
|
470
|
+
// ==================== Quote Hooks ====================
|
|
471
|
+
/**
|
|
472
|
+
* Hook for job quote
|
|
473
|
+
*/
|
|
474
|
+
export function useJobQuote(jobId) {
|
|
475
|
+
const client = useOsiseClient();
|
|
476
|
+
const isAuthenticated = useIsAuthenticated();
|
|
477
|
+
return useQuery(() => client.jobs.getQuote(jobId), {
|
|
478
|
+
enabled: isAuthenticated && !!jobId,
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Hook for approving a quote
|
|
483
|
+
*/
|
|
484
|
+
export function useApproveQuote() {
|
|
485
|
+
const client = useOsiseClient();
|
|
486
|
+
return useMutation((jobId) => client.jobs.approveQuote(jobId));
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Hook for rejecting a quote
|
|
490
|
+
*/
|
|
491
|
+
export function useRejectQuote() {
|
|
492
|
+
const client = useOsiseClient();
|
|
493
|
+
return useMutation(({ jobId, reason }) => client.jobs.rejectQuote(jobId, { reason }));
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Hook for negotiating a quote
|
|
497
|
+
*/
|
|
498
|
+
export function useNegotiateQuote() {
|
|
499
|
+
const client = useOsiseClient();
|
|
500
|
+
return useMutation(({ jobId, data }) => client.jobs.negotiateQuote(jobId, data));
|
|
501
|
+
}
|
|
502
|
+
// ==================== Rating Hooks ====================
|
|
503
|
+
/**
|
|
504
|
+
* Hook for job rating
|
|
505
|
+
*/
|
|
506
|
+
export function useJobRating(jobId) {
|
|
507
|
+
const client = useOsiseClient();
|
|
508
|
+
const isAuthenticated = useIsAuthenticated();
|
|
509
|
+
return useQuery(() => client.jobs.getRating(jobId), {
|
|
510
|
+
enabled: isAuthenticated && !!jobId,
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Hook for submitting a rating
|
|
515
|
+
*/
|
|
516
|
+
export function useSubmitRating() {
|
|
517
|
+
const client = useOsiseClient();
|
|
518
|
+
return useMutation(({ jobId, data }) => client.jobs.submitRating(jobId, data));
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Hook for adding a tip
|
|
522
|
+
*/
|
|
523
|
+
export function useAddTip() {
|
|
524
|
+
const client = useOsiseClient();
|
|
525
|
+
return useMutation(({ jobId, data }) => client.jobs.addTip(jobId, data));
|
|
526
|
+
}
|
|
527
|
+
// ==================== Job Completion & Issues Hooks ====================
|
|
528
|
+
/**
|
|
529
|
+
* Hook for confirming job completion
|
|
530
|
+
*/
|
|
531
|
+
export function useConfirmCompletion() {
|
|
532
|
+
const client = useOsiseClient();
|
|
533
|
+
return useMutation(({ jobId, notes }) => client.jobs.confirmCompletion(jobId, notes ? { notes } : undefined));
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Hook for reporting an issue
|
|
537
|
+
*/
|
|
538
|
+
export function useReportIssue() {
|
|
539
|
+
const client = useOsiseClient();
|
|
540
|
+
return useMutation(({ jobId, data }) => client.jobs.reportIssue(jobId, data));
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Hook for requesting a redo
|
|
544
|
+
*/
|
|
545
|
+
export function useRequestRedo() {
|
|
546
|
+
const client = useOsiseClient();
|
|
547
|
+
return useMutation(({ jobId, data }) => client.jobs.requestRedo(jobId, data));
|
|
548
|
+
}
|
|
549
|
+
// ==================== Artisan Job Hooks ====================
|
|
550
|
+
/**
|
|
551
|
+
* Hook for available jobs (artisan)
|
|
552
|
+
*/
|
|
553
|
+
export function useAvailableJobs() {
|
|
554
|
+
const client = useOsiseClient();
|
|
555
|
+
const isAuthenticated = useIsAuthenticated();
|
|
556
|
+
return useQuery(() => client.artisanJobs.getAvailable(), {
|
|
557
|
+
enabled: isAuthenticated,
|
|
558
|
+
});
|
|
559
|
+
}
|
|
348
560
|
/**
|
|
349
561
|
* Hook for artisan jobs
|
|
350
562
|
*/
|
|
@@ -356,15 +568,207 @@ export function useArtisanJobs(params) {
|
|
|
356
568
|
});
|
|
357
569
|
}
|
|
358
570
|
/**
|
|
359
|
-
* Hook for
|
|
571
|
+
* Hook for artisan job history
|
|
360
572
|
*/
|
|
361
|
-
export function
|
|
573
|
+
export function useArtisanJobHistory(params) {
|
|
362
574
|
const client = useOsiseClient();
|
|
363
575
|
const isAuthenticated = useIsAuthenticated();
|
|
364
|
-
return useQuery(() => client.
|
|
576
|
+
return useQuery(() => client.artisanJobs.getHistory(params), {
|
|
577
|
+
enabled: isAuthenticated,
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Hook for accepting a job
|
|
582
|
+
*/
|
|
583
|
+
export function useAcceptJob() {
|
|
584
|
+
const client = useOsiseClient();
|
|
585
|
+
return useMutation(({ jobId, data }) => client.artisanJobs.accept(jobId, data));
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Hook for declining a job
|
|
589
|
+
*/
|
|
590
|
+
export function useDeclineJob() {
|
|
591
|
+
const client = useOsiseClient();
|
|
592
|
+
return useMutation(({ jobId, data }) => client.artisanJobs.decline(jobId, data));
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Hook for acknowledging assignment
|
|
596
|
+
*/
|
|
597
|
+
export function useAcknowledgeJob() {
|
|
598
|
+
const client = useOsiseClient();
|
|
599
|
+
return useMutation(({ jobId, data }) => client.artisanJobs.acknowledge(jobId, data));
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Hook for marking en route
|
|
603
|
+
*/
|
|
604
|
+
export function useMarkEnRoute() {
|
|
605
|
+
const client = useOsiseClient();
|
|
606
|
+
return useMutation(({ jobId, data }) => client.artisanJobs.markEnRoute(jobId, data));
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Hook for marking arrived
|
|
610
|
+
*/
|
|
611
|
+
export function useMarkArrived() {
|
|
612
|
+
const client = useOsiseClient();
|
|
613
|
+
return useMutation(({ jobId, data }) => client.artisanJobs.markArrived(jobId, data));
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Hook for updating artisan location
|
|
617
|
+
*/
|
|
618
|
+
export function useUpdateArtisanLocation() {
|
|
619
|
+
const client = useOsiseClient();
|
|
620
|
+
return useMutation(({ jobId, data }) => client.artisanJobs.updateLocation(jobId, data));
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Hook for sending job update
|
|
624
|
+
*/
|
|
625
|
+
export function useSendJobUpdate() {
|
|
626
|
+
const client = useOsiseClient();
|
|
627
|
+
return useMutation(({ jobId, data }) => client.artisanJobs.sendUpdate(jobId, data));
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Hook for marking job complete
|
|
631
|
+
*/
|
|
632
|
+
export function useMarkComplete() {
|
|
633
|
+
const client = useOsiseClient();
|
|
634
|
+
return useMutation(({ jobId, data }) => client.artisanJobs.markComplete(jobId, data));
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Hook for submitting a quote (artisan)
|
|
638
|
+
*/
|
|
639
|
+
export function useSubmitQuote() {
|
|
640
|
+
const client = useOsiseClient();
|
|
641
|
+
return useMutation(({ jobId, data }) => client.artisanJobs.submitQuote(jobId, data));
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Hook for revising a quote (artisan)
|
|
645
|
+
*/
|
|
646
|
+
export function useReviseQuote() {
|
|
647
|
+
const client = useOsiseClient();
|
|
648
|
+
return useMutation(({ jobId, data }) => client.artisanJobs.reviseQuote(jobId, data));
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Hook for requesting materials
|
|
652
|
+
*/
|
|
653
|
+
export function useRequestMaterials() {
|
|
654
|
+
const client = useOsiseClient();
|
|
655
|
+
return useMutation(({ jobId, data }) => client.artisanJobs.requestMaterials(jobId, data));
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Hook for confirming cash received
|
|
659
|
+
*/
|
|
660
|
+
export function useConfirmCashReceived() {
|
|
661
|
+
const client = useOsiseClient();
|
|
662
|
+
return useMutation(({ jobId, data }) => client.artisanJobs.confirmCashReceived(jobId, data));
|
|
663
|
+
}
|
|
664
|
+
// ==================== Admin Job Hooks ====================
|
|
665
|
+
/**
|
|
666
|
+
* Hook for job queue (admin/dispatcher)
|
|
667
|
+
*/
|
|
668
|
+
export function useJobQueue(params) {
|
|
669
|
+
const client = useOsiseClient();
|
|
670
|
+
const isAuthenticated = useIsAuthenticated();
|
|
671
|
+
return useQuery(() => client.adminJobs.getQueue(params), {
|
|
672
|
+
enabled: isAuthenticated,
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Hook for active jobs (admin)
|
|
677
|
+
*/
|
|
678
|
+
export function useActiveJobs() {
|
|
679
|
+
const client = useOsiseClient();
|
|
680
|
+
const isAuthenticated = useIsAuthenticated();
|
|
681
|
+
return useQuery(() => client.adminJobs.getActive(), {
|
|
682
|
+
enabled: isAuthenticated,
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Hook for admin job detail
|
|
687
|
+
*/
|
|
688
|
+
export function useAdminJob(jobId) {
|
|
689
|
+
const client = useOsiseClient();
|
|
690
|
+
const isAuthenticated = useIsAuthenticated();
|
|
691
|
+
return useQuery(() => client.adminJobs.get(jobId), {
|
|
692
|
+
enabled: isAuthenticated && !!jobId,
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Hook for available artisans for a job
|
|
697
|
+
*/
|
|
698
|
+
export function useAvailableArtisans(jobId) {
|
|
699
|
+
const client = useOsiseClient();
|
|
700
|
+
const isAuthenticated = useIsAuthenticated();
|
|
701
|
+
return useQuery(() => client.adminJobs.getAvailableArtisans(jobId), {
|
|
702
|
+
enabled: isAuthenticated && !!jobId,
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Hook for suggested artisans for a job
|
|
707
|
+
*/
|
|
708
|
+
export function useSuggestedArtisans(jobId) {
|
|
709
|
+
const client = useOsiseClient();
|
|
710
|
+
const isAuthenticated = useIsAuthenticated();
|
|
711
|
+
return useQuery(() => client.adminJobs.getSuggestedArtisans(jobId), {
|
|
365
712
|
enabled: isAuthenticated && !!jobId,
|
|
366
713
|
});
|
|
367
714
|
}
|
|
715
|
+
/**
|
|
716
|
+
* Hook for assigning artisan to job
|
|
717
|
+
*/
|
|
718
|
+
export function useAssignArtisan() {
|
|
719
|
+
const client = useOsiseClient();
|
|
720
|
+
return useMutation(({ jobId, data }) => client.adminJobs.assignArtisan(jobId, data));
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Hook for broadcasting job to artisans
|
|
724
|
+
*/
|
|
725
|
+
export function useBroadcastJob() {
|
|
726
|
+
const client = useOsiseClient();
|
|
727
|
+
return useMutation(({ jobId, data }) => client.adminJobs.broadcast(jobId, data));
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Hook for reassigning job
|
|
731
|
+
*/
|
|
732
|
+
export function useReassignJob() {
|
|
733
|
+
const client = useOsiseClient();
|
|
734
|
+
return useMutation(({ jobId, data }) => client.adminJobs.reassign(jobId, data));
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Hook for updating job priority
|
|
738
|
+
*/
|
|
739
|
+
export function useUpdateJobPriority() {
|
|
740
|
+
const client = useOsiseClient();
|
|
741
|
+
return useMutation(({ jobId, data }) => client.adminJobs.updatePriority(jobId, data));
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Hook for adding job note
|
|
745
|
+
*/
|
|
746
|
+
export function useAddJobNote() {
|
|
747
|
+
const client = useOsiseClient();
|
|
748
|
+
return useMutation(({ jobId, data }) => client.adminJobs.addNote(jobId, data));
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Hook for updating job ETA
|
|
752
|
+
*/
|
|
753
|
+
export function useUpdateJobEta() {
|
|
754
|
+
const client = useOsiseClient();
|
|
755
|
+
return useMutation(({ jobId, data }) => client.adminJobs.updateEta(jobId, data));
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Hook for logging customer contact
|
|
759
|
+
*/
|
|
760
|
+
export function useLogCustomerContact() {
|
|
761
|
+
const client = useOsiseClient();
|
|
762
|
+
return useMutation(({ jobId, data }) => client.adminJobs.logCustomerContact(jobId, data));
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Hook for logging artisan contact
|
|
766
|
+
*/
|
|
767
|
+
export function useLogArtisanContact() {
|
|
768
|
+
const client = useOsiseClient();
|
|
769
|
+
return useMutation(({ jobId, data }) => client.adminJobs.logArtisanContact(jobId, data));
|
|
770
|
+
}
|
|
771
|
+
// ==================== Admin Hooks ====================
|
|
368
772
|
/**
|
|
369
773
|
* Hook for admin dashboard stats
|
|
370
774
|
*/
|
|
@@ -405,4 +809,1149 @@ export function usePendingApplications(params) {
|
|
|
405
809
|
enabled: isAuthenticated,
|
|
406
810
|
});
|
|
407
811
|
}
|
|
812
|
+
// ==================== Payment Hooks ====================
|
|
813
|
+
/**
|
|
814
|
+
* Hook for getting saved payment methods
|
|
815
|
+
*/
|
|
816
|
+
export function usePaymentMethods() {
|
|
817
|
+
const client = useOsiseClient();
|
|
818
|
+
const isAuthenticated = useIsAuthenticated();
|
|
819
|
+
return useQuery(() => client.payments.getPaymentMethods(), {
|
|
820
|
+
enabled: isAuthenticated,
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* Hook for adding a payment method
|
|
825
|
+
*/
|
|
826
|
+
export function useAddPaymentMethod() {
|
|
827
|
+
const client = useOsiseClient();
|
|
828
|
+
return useMutation((data) => client.payments.addPaymentMethod(data));
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Hook for updating a payment method
|
|
832
|
+
*/
|
|
833
|
+
export function useUpdatePaymentMethod() {
|
|
834
|
+
const client = useOsiseClient();
|
|
835
|
+
return useMutation(({ methodId, data }) => client.payments.updatePaymentMethod(methodId, data));
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Hook for deleting a payment method
|
|
839
|
+
*/
|
|
840
|
+
export function useDeletePaymentMethod() {
|
|
841
|
+
const client = useOsiseClient();
|
|
842
|
+
return useMutation((methodId) => client.payments.deletePaymentMethod(methodId));
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Hook for setting default payment method
|
|
846
|
+
*/
|
|
847
|
+
export function useSetDefaultPaymentMethod() {
|
|
848
|
+
const client = useOsiseClient();
|
|
849
|
+
return useMutation((methodId) => client.payments.setDefaultPaymentMethod(methodId));
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Hook for getting payment status
|
|
853
|
+
*/
|
|
854
|
+
export function usePaymentStatus(jobId) {
|
|
855
|
+
const client = useOsiseClient();
|
|
856
|
+
const isAuthenticated = useIsAuthenticated();
|
|
857
|
+
return useQuery(() => client.payments.getPaymentStatus(jobId), {
|
|
858
|
+
enabled: isAuthenticated && !!jobId,
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Hook for getting payment details
|
|
863
|
+
*/
|
|
864
|
+
export function usePayment(jobId) {
|
|
865
|
+
const client = useOsiseClient();
|
|
866
|
+
const isAuthenticated = useIsAuthenticated();
|
|
867
|
+
return useQuery(() => client.payments.getPayment(jobId), {
|
|
868
|
+
enabled: isAuthenticated && !!jobId,
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Hook for initiating a payment
|
|
873
|
+
*/
|
|
874
|
+
export function useInitiatePayment() {
|
|
875
|
+
const client = useOsiseClient();
|
|
876
|
+
return useMutation(({ jobId, data }) => client.payments.initiatePayment(jobId, data));
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Hook for completing a card payment
|
|
880
|
+
*/
|
|
881
|
+
export function usePayWithCard() {
|
|
882
|
+
const client = useOsiseClient();
|
|
883
|
+
return useMutation(({ jobId, paymentReference, saveCard }) => client.payments.payWithCard(jobId, paymentReference, saveCard));
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Hook for recording a bank transfer payment
|
|
887
|
+
*/
|
|
888
|
+
export function usePayWithTransfer() {
|
|
889
|
+
const client = useOsiseClient();
|
|
890
|
+
return useMutation(({ jobId, data }) => client.payments.payWithTransfer(jobId, data));
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* Hook for confirming cash payment (artisan)
|
|
894
|
+
*/
|
|
895
|
+
export function useConfirmCashPayment() {
|
|
896
|
+
const client = useOsiseClient();
|
|
897
|
+
return useMutation(({ jobId, data }) => client.payments.confirmCashPayment(jobId, data));
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* Hook for getting a receipt
|
|
901
|
+
*/
|
|
902
|
+
export function useReceipt(jobId) {
|
|
903
|
+
const client = useOsiseClient();
|
|
904
|
+
const isAuthenticated = useIsAuthenticated();
|
|
905
|
+
return useQuery(() => client.payments.getReceipt(jobId), {
|
|
906
|
+
enabled: isAuthenticated && !!jobId,
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Hook for getting an invoice (B2B)
|
|
911
|
+
*/
|
|
912
|
+
export function useInvoice(jobId) {
|
|
913
|
+
const client = useOsiseClient();
|
|
914
|
+
const isAuthenticated = useIsAuthenticated();
|
|
915
|
+
return useQuery(() => client.payments.getInvoice(jobId), {
|
|
916
|
+
enabled: isAuthenticated && !!jobId,
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* Hook for payment history
|
|
921
|
+
*/
|
|
922
|
+
export function usePaymentHistory(params) {
|
|
923
|
+
const client = useOsiseClient();
|
|
924
|
+
const isAuthenticated = useIsAuthenticated();
|
|
925
|
+
return useQuery(() => client.payments.getPaymentHistory(params), {
|
|
926
|
+
enabled: isAuthenticated,
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
// ==================== Admin B2B Invoice Hooks ====================
|
|
930
|
+
/**
|
|
931
|
+
* Hook for company invoices (admin)
|
|
932
|
+
*/
|
|
933
|
+
export function useCompanyInvoices(companyId, params) {
|
|
934
|
+
const client = useOsiseClient();
|
|
935
|
+
const isAuthenticated = useIsAuthenticated();
|
|
936
|
+
return useQuery(() => client.adminB2BInvoices.listInvoices(companyId, params), {
|
|
937
|
+
enabled: isAuthenticated && !!companyId,
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* Hook for invoice detail (admin)
|
|
942
|
+
*/
|
|
943
|
+
export function useAdminInvoice(companyId, invoiceId) {
|
|
944
|
+
const client = useOsiseClient();
|
|
945
|
+
const isAuthenticated = useIsAuthenticated();
|
|
946
|
+
return useQuery(() => client.adminB2BInvoices.getInvoice(companyId, invoiceId), {
|
|
947
|
+
enabled: isAuthenticated && !!companyId && !!invoiceId,
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* Hook for creating an invoice
|
|
952
|
+
*/
|
|
953
|
+
export function useCreateInvoice() {
|
|
954
|
+
const client = useOsiseClient();
|
|
955
|
+
return useMutation(({ companyId, data }) => client.adminB2BInvoices.createInvoice(companyId, data));
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Hook for updating a draft invoice
|
|
959
|
+
*/
|
|
960
|
+
export function useUpdateInvoice() {
|
|
961
|
+
const client = useOsiseClient();
|
|
962
|
+
return useMutation(({ companyId, invoiceId, data }) => client.adminB2BInvoices.updateInvoice(companyId, invoiceId, data));
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Hook for sending an invoice
|
|
966
|
+
*/
|
|
967
|
+
export function useSendInvoice() {
|
|
968
|
+
const client = useOsiseClient();
|
|
969
|
+
return useMutation(({ companyId, invoiceId, data }) => client.adminB2BInvoices.sendInvoice(companyId, invoiceId, data));
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* Hook for recording invoice payment
|
|
973
|
+
*/
|
|
974
|
+
export function useRecordInvoicePayment() {
|
|
975
|
+
const client = useOsiseClient();
|
|
976
|
+
return useMutation(({ companyId, invoiceId, data }) => client.adminB2BInvoices.recordPayment(companyId, invoiceId, data));
|
|
977
|
+
}
|
|
978
|
+
/**
|
|
979
|
+
* Hook for cancelling an invoice
|
|
980
|
+
*/
|
|
981
|
+
export function useCancelInvoice() {
|
|
982
|
+
const client = useOsiseClient();
|
|
983
|
+
return useMutation(({ companyId, invoiceId, data }) => client.adminB2BInvoices.cancelInvoice(companyId, invoiceId, data));
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* Hook for company statement
|
|
987
|
+
*/
|
|
988
|
+
export function useCompanyStatement(companyId, params) {
|
|
989
|
+
const client = useOsiseClient();
|
|
990
|
+
const isAuthenticated = useIsAuthenticated();
|
|
991
|
+
return useQuery(() => client.adminB2BInvoices.getStatement(companyId, params), {
|
|
992
|
+
enabled: isAuthenticated && !!companyId,
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Hook for invoiceable jobs
|
|
997
|
+
*/
|
|
998
|
+
export function useInvoiceableJobs(companyId, params) {
|
|
999
|
+
const client = useOsiseClient();
|
|
1000
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1001
|
+
return useQuery(() => client.adminB2BInvoices.getInvoiceableJobs(companyId, params), {
|
|
1002
|
+
enabled: isAuthenticated && !!companyId,
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
// ==================== Admin Payout Hooks ====================
|
|
1006
|
+
/**
|
|
1007
|
+
* Hook for pending payouts
|
|
1008
|
+
*/
|
|
1009
|
+
export function usePendingPayouts(params) {
|
|
1010
|
+
const client = useOsiseClient();
|
|
1011
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1012
|
+
return useQuery(() => client.adminPayouts.getPendingPayouts(params), {
|
|
1013
|
+
enabled: isAuthenticated,
|
|
1014
|
+
});
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Hook for processing weekly payouts
|
|
1018
|
+
*/
|
|
1019
|
+
export function useProcessWeeklyPayouts() {
|
|
1020
|
+
const client = useOsiseClient();
|
|
1021
|
+
return useMutation((data) => client.adminPayouts.processWeeklyPayouts(data));
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* Hook for payout history
|
|
1025
|
+
*/
|
|
1026
|
+
export function usePayoutHistory(params) {
|
|
1027
|
+
const client = useOsiseClient();
|
|
1028
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1029
|
+
return useQuery(() => client.adminPayouts.getHistory(params), {
|
|
1030
|
+
enabled: isAuthenticated,
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Hook for payout detail
|
|
1035
|
+
*/
|
|
1036
|
+
export function useAdminPayout(payoutId) {
|
|
1037
|
+
const client = useOsiseClient();
|
|
1038
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1039
|
+
return useQuery(() => client.adminPayouts.getPayout(payoutId), {
|
|
1040
|
+
enabled: isAuthenticated && !!payoutId,
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Hook for retrying a failed payout
|
|
1045
|
+
*/
|
|
1046
|
+
export function useRetryPayout() {
|
|
1047
|
+
const client = useOsiseClient();
|
|
1048
|
+
return useMutation(({ payoutId, data }) => client.adminPayouts.retryPayout(payoutId, data));
|
|
1049
|
+
}
|
|
1050
|
+
// ==================== Admin Finance Hooks ====================
|
|
1051
|
+
/**
|
|
1052
|
+
* Hook for admin transactions
|
|
1053
|
+
*/
|
|
1054
|
+
export function useAdminTransactions(params) {
|
|
1055
|
+
const client = useOsiseClient();
|
|
1056
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1057
|
+
return useQuery(() => client.adminFinance.listTransactions(params), {
|
|
1058
|
+
enabled: isAuthenticated,
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Hook for admin transaction detail
|
|
1063
|
+
*/
|
|
1064
|
+
export function useAdminTransaction(transactionId) {
|
|
1065
|
+
const client = useOsiseClient();
|
|
1066
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1067
|
+
return useQuery(() => client.adminFinance.getTransaction(transactionId), {
|
|
1068
|
+
enabled: isAuthenticated && !!transactionId,
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Hook for flagging a transaction
|
|
1073
|
+
*/
|
|
1074
|
+
export function useFlagTransaction() {
|
|
1075
|
+
const client = useOsiseClient();
|
|
1076
|
+
return useMutation(({ transactionId, data }) => client.adminFinance.flagTransaction(transactionId, data));
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Hook for unflagging a transaction
|
|
1080
|
+
*/
|
|
1081
|
+
export function useUnflagTransaction() {
|
|
1082
|
+
const client = useOsiseClient();
|
|
1083
|
+
return useMutation((transactionId) => client.adminFinance.unflagTransaction(transactionId));
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* Hook for marking a transaction as reconciled
|
|
1087
|
+
*/
|
|
1088
|
+
export function useMarkTransactionReconciled() {
|
|
1089
|
+
const client = useOsiseClient();
|
|
1090
|
+
return useMutation((transactionId) => client.adminFinance.markReconciled(transactionId));
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Hook for reconciliation report
|
|
1094
|
+
*/
|
|
1095
|
+
export function useReconciliationReport(params) {
|
|
1096
|
+
const client = useOsiseClient();
|
|
1097
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1098
|
+
return useQuery(() => client.adminFinance.getReconciliationReport(params), {
|
|
1099
|
+
enabled: isAuthenticated,
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Hook for revenue summary
|
|
1104
|
+
*/
|
|
1105
|
+
export function useRevenueSummary(params) {
|
|
1106
|
+
const client = useOsiseClient();
|
|
1107
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1108
|
+
return useQuery(() => client.adminFinance.getRevenueSummary(params), {
|
|
1109
|
+
enabled: isAuthenticated,
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
/**
|
|
1113
|
+
* Hook for commission summary
|
|
1114
|
+
*/
|
|
1115
|
+
export function useCommissionSummary(params) {
|
|
1116
|
+
const client = useOsiseClient();
|
|
1117
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1118
|
+
return useQuery(() => client.adminFinance.getCommissionSummary(params), {
|
|
1119
|
+
enabled: isAuthenticated,
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* Hook for outstanding balances
|
|
1124
|
+
*/
|
|
1125
|
+
export function useOutstandingBalances(params) {
|
|
1126
|
+
const client = useOsiseClient();
|
|
1127
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1128
|
+
return useQuery(() => client.adminFinance.getOutstandingBalances(params), {
|
|
1129
|
+
enabled: isAuthenticated,
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
// ==================== Consumer B2B Hooks ====================
|
|
1133
|
+
/**
|
|
1134
|
+
* Hook for getting my company info (B2B consumer)
|
|
1135
|
+
*/
|
|
1136
|
+
export function useMyCompany() {
|
|
1137
|
+
const client = useOsiseClient();
|
|
1138
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1139
|
+
return useQuery(() => client.b2b.getMyCompany(), {
|
|
1140
|
+
enabled: isAuthenticated,
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* Hook for linking to a company
|
|
1145
|
+
*/
|
|
1146
|
+
export function useLinkToCompany() {
|
|
1147
|
+
const client = useOsiseClient();
|
|
1148
|
+
return useMutation((data) => client.b2b.linkToCompany(data));
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Hook for unlinking from company
|
|
1152
|
+
*/
|
|
1153
|
+
export function useUnlinkFromCompany() {
|
|
1154
|
+
const client = useOsiseClient();
|
|
1155
|
+
return useMutation(() => client.b2b.unlinkFromCompany());
|
|
1156
|
+
}
|
|
1157
|
+
/**
|
|
1158
|
+
* Hook for team members (B2B consumer)
|
|
1159
|
+
*/
|
|
1160
|
+
export function useTeamMembers(params) {
|
|
1161
|
+
const client = useOsiseClient();
|
|
1162
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1163
|
+
return useQuery(() => client.b2b.getTeam(params), {
|
|
1164
|
+
enabled: isAuthenticated,
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Hook for inviting a team member
|
|
1169
|
+
*/
|
|
1170
|
+
export function useInviteTeamMember() {
|
|
1171
|
+
const client = useOsiseClient();
|
|
1172
|
+
return useMutation((data) => client.b2b.inviteTeamMember(data));
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Hook for updating team member role
|
|
1176
|
+
*/
|
|
1177
|
+
export function useUpdateTeamMemberRole() {
|
|
1178
|
+
const client = useOsiseClient();
|
|
1179
|
+
return useMutation(({ memberId, data }) => client.b2b.updateTeamMemberRole(memberId, data));
|
|
1180
|
+
}
|
|
1181
|
+
/**
|
|
1182
|
+
* Hook for removing a team member
|
|
1183
|
+
*/
|
|
1184
|
+
export function useRemoveTeamMember() {
|
|
1185
|
+
const client = useOsiseClient();
|
|
1186
|
+
return useMutation((memberId) => client.b2b.removeTeamMember(memberId));
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
* Hook for monthly B2B report
|
|
1190
|
+
*/
|
|
1191
|
+
export function useB2BMonthlyReport(year, month) {
|
|
1192
|
+
const client = useOsiseClient();
|
|
1193
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1194
|
+
return useQuery(() => client.b2b.getMonthlyReport(year, month), {
|
|
1195
|
+
enabled: isAuthenticated,
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
/**
|
|
1199
|
+
* Hook for B2B properties (consumer)
|
|
1200
|
+
*/
|
|
1201
|
+
export function useB2BProperties(params) {
|
|
1202
|
+
const client = useOsiseClient();
|
|
1203
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1204
|
+
return useQuery(() => client.b2b.getProperties(params), {
|
|
1205
|
+
enabled: isAuthenticated,
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Hook for B2B property detail (consumer)
|
|
1210
|
+
*/
|
|
1211
|
+
export function useB2BProperty(propertyId) {
|
|
1212
|
+
const client = useOsiseClient();
|
|
1213
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1214
|
+
return useQuery(() => client.b2b.getProperty(propertyId), {
|
|
1215
|
+
enabled: isAuthenticated && !!propertyId,
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
/**
|
|
1219
|
+
* Hook for creating a B2B property (consumer)
|
|
1220
|
+
*/
|
|
1221
|
+
export function useCreateB2BProperty() {
|
|
1222
|
+
const client = useOsiseClient();
|
|
1223
|
+
return useMutation((data) => client.b2b.createProperty(data));
|
|
1224
|
+
}
|
|
1225
|
+
/**
|
|
1226
|
+
* Hook for updating a B2B property (consumer)
|
|
1227
|
+
*/
|
|
1228
|
+
export function useUpdateB2BProperty() {
|
|
1229
|
+
const client = useOsiseClient();
|
|
1230
|
+
return useMutation(({ propertyId, data }) => client.b2b.updateProperty(propertyId, data));
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Hook for deleting a B2B property (consumer)
|
|
1234
|
+
*/
|
|
1235
|
+
export function useDeleteB2BProperty() {
|
|
1236
|
+
const client = useOsiseClient();
|
|
1237
|
+
return useMutation((propertyId) => client.b2b.deleteProperty(propertyId));
|
|
1238
|
+
}
|
|
1239
|
+
// ==================== Admin B2B Company Hooks ====================
|
|
1240
|
+
/**
|
|
1241
|
+
* Hook for admin B2B companies list
|
|
1242
|
+
*/
|
|
1243
|
+
export function useAdminCompanies(params) {
|
|
1244
|
+
const client = useOsiseClient();
|
|
1245
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1246
|
+
return useQuery(() => client.adminB2B.listCompanies(params), {
|
|
1247
|
+
enabled: isAuthenticated,
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Hook for admin company detail
|
|
1252
|
+
*/
|
|
1253
|
+
export function useAdminCompany(companyId) {
|
|
1254
|
+
const client = useOsiseClient();
|
|
1255
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1256
|
+
return useQuery(() => client.adminB2B.getCompany(companyId), {
|
|
1257
|
+
enabled: isAuthenticated && !!companyId,
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Hook for creating a company (admin)
|
|
1262
|
+
*/
|
|
1263
|
+
export function useCreateCompany() {
|
|
1264
|
+
const client = useOsiseClient();
|
|
1265
|
+
return useMutation((data) => client.adminB2B.createCompany(data));
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Hook for updating a company (admin)
|
|
1269
|
+
*/
|
|
1270
|
+
export function useUpdateCompany() {
|
|
1271
|
+
const client = useOsiseClient();
|
|
1272
|
+
return useMutation(({ companyId, data }) => client.adminB2B.updateCompany(companyId, data));
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Hook for deleting a company (admin)
|
|
1276
|
+
*/
|
|
1277
|
+
export function useDeleteCompany() {
|
|
1278
|
+
const client = useOsiseClient();
|
|
1279
|
+
return useMutation((companyId) => client.adminB2B.deleteCompany(companyId));
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Hook for regenerating company code (admin)
|
|
1283
|
+
*/
|
|
1284
|
+
export function useRegenerateCompanyCode() {
|
|
1285
|
+
const client = useOsiseClient();
|
|
1286
|
+
return useMutation((companyId) => client.adminB2B.regenerateCompanyCode(companyId));
|
|
1287
|
+
}
|
|
1288
|
+
/**
|
|
1289
|
+
* Hook for assigning account manager (admin)
|
|
1290
|
+
*/
|
|
1291
|
+
export function useAssignAccountManager() {
|
|
1292
|
+
const client = useOsiseClient();
|
|
1293
|
+
return useMutation(({ companyId, data }) => client.adminB2B.assignAccountManager(companyId, data));
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Hook for company usage report (admin)
|
|
1297
|
+
*/
|
|
1298
|
+
export function useCompanyUsageReport(companyId, params) {
|
|
1299
|
+
const client = useOsiseClient();
|
|
1300
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1301
|
+
return useQuery(() => client.adminB2B.getUsageReport(companyId, params), {
|
|
1302
|
+
enabled: isAuthenticated && !!companyId,
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
// ==================== Admin B2B Company User Hooks ====================
|
|
1306
|
+
/**
|
|
1307
|
+
* Hook for company users (admin)
|
|
1308
|
+
*/
|
|
1309
|
+
export function useAdminCompanyUsers(companyId, params) {
|
|
1310
|
+
const client = useOsiseClient();
|
|
1311
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1312
|
+
return useQuery(() => client.adminB2B.listCompanyUsers(companyId, params), {
|
|
1313
|
+
enabled: isAuthenticated && !!companyId,
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Hook for adding a company user (admin)
|
|
1318
|
+
*/
|
|
1319
|
+
export function useAddCompanyUser() {
|
|
1320
|
+
const client = useOsiseClient();
|
|
1321
|
+
return useMutation(({ companyId, data }) => client.adminB2B.addCompanyUser(companyId, data));
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Hook for updating a company user (admin)
|
|
1325
|
+
*/
|
|
1326
|
+
export function useUpdateCompanyUser() {
|
|
1327
|
+
const client = useOsiseClient();
|
|
1328
|
+
return useMutation(({ companyId, userId, data }) => client.adminB2B.updateCompanyUser(companyId, userId, data));
|
|
1329
|
+
}
|
|
1330
|
+
/**
|
|
1331
|
+
* Hook for removing a company user (admin)
|
|
1332
|
+
*/
|
|
1333
|
+
export function useRemoveCompanyUser() {
|
|
1334
|
+
const client = useOsiseClient();
|
|
1335
|
+
return useMutation(({ companyId, userId }) => client.adminB2B.removeCompanyUser(companyId, userId));
|
|
1336
|
+
}
|
|
1337
|
+
// ==================== Admin B2B Contract Hooks ====================
|
|
1338
|
+
/**
|
|
1339
|
+
* Hook for company contracts (admin)
|
|
1340
|
+
*/
|
|
1341
|
+
export function useAdminCompanyContracts(companyId, params) {
|
|
1342
|
+
const client = useOsiseClient();
|
|
1343
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1344
|
+
return useQuery(() => client.adminB2B.listCompanyContracts(companyId, params), {
|
|
1345
|
+
enabled: isAuthenticated && !!companyId,
|
|
1346
|
+
});
|
|
1347
|
+
}
|
|
1348
|
+
/**
|
|
1349
|
+
* Hook for contract detail (admin)
|
|
1350
|
+
*/
|
|
1351
|
+
export function useAdminContract(contractId) {
|
|
1352
|
+
const client = useOsiseClient();
|
|
1353
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1354
|
+
return useQuery(() => client.adminB2B.getContract(contractId), {
|
|
1355
|
+
enabled: isAuthenticated && !!contractId,
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* Hook for creating a contract (admin)
|
|
1360
|
+
*/
|
|
1361
|
+
export function useCreateContract() {
|
|
1362
|
+
const client = useOsiseClient();
|
|
1363
|
+
return useMutation(({ companyId, data }) => client.adminB2B.createContract(companyId, data));
|
|
1364
|
+
}
|
|
1365
|
+
/**
|
|
1366
|
+
* Hook for updating a contract (admin)
|
|
1367
|
+
*/
|
|
1368
|
+
export function useUpdateContract() {
|
|
1369
|
+
const client = useOsiseClient();
|
|
1370
|
+
return useMutation(({ contractId, data }) => client.adminB2B.updateContract(contractId, data));
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Hook for terminating a contract (admin)
|
|
1374
|
+
*/
|
|
1375
|
+
export function useTerminateContract() {
|
|
1376
|
+
const client = useOsiseClient();
|
|
1377
|
+
return useMutation(({ contractId, reason }) => client.adminB2B.terminateContract(contractId, reason));
|
|
1378
|
+
}
|
|
1379
|
+
// ==================== Admin B2B Property Hooks ====================
|
|
1380
|
+
/**
|
|
1381
|
+
* Hook for company properties (admin)
|
|
1382
|
+
*/
|
|
1383
|
+
export function useAdminCompanyProperties(companyId, params) {
|
|
1384
|
+
const client = useOsiseClient();
|
|
1385
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1386
|
+
return useQuery(() => client.adminB2B.listCompanyProperties(companyId, params), {
|
|
1387
|
+
enabled: isAuthenticated && !!companyId,
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1390
|
+
/**
|
|
1391
|
+
* Hook for property detail (admin)
|
|
1392
|
+
*/
|
|
1393
|
+
export function useAdminProperty(propertyId) {
|
|
1394
|
+
const client = useOsiseClient();
|
|
1395
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1396
|
+
return useQuery(() => client.adminB2B.getProperty(propertyId), {
|
|
1397
|
+
enabled: isAuthenticated && !!propertyId,
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
/**
|
|
1401
|
+
* Hook for creating a property (admin)
|
|
1402
|
+
*/
|
|
1403
|
+
export function useCreateAdminProperty() {
|
|
1404
|
+
const client = useOsiseClient();
|
|
1405
|
+
return useMutation(({ companyId, data }) => client.adminB2B.createProperty(companyId, data));
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* Hook for updating a property (admin)
|
|
1409
|
+
*/
|
|
1410
|
+
export function useUpdateAdminProperty() {
|
|
1411
|
+
const client = useOsiseClient();
|
|
1412
|
+
return useMutation(({ propertyId, data }) => client.adminB2B.updateProperty(propertyId, data));
|
|
1413
|
+
}
|
|
1414
|
+
/**
|
|
1415
|
+
* Hook for deleting a property (admin)
|
|
1416
|
+
*/
|
|
1417
|
+
export function useDeleteAdminProperty() {
|
|
1418
|
+
const client = useOsiseClient();
|
|
1419
|
+
return useMutation((propertyId) => client.adminB2B.deleteProperty(propertyId));
|
|
1420
|
+
}
|
|
1421
|
+
// ==================== Admin B2B Meeting Note Hooks ====================
|
|
1422
|
+
/**
|
|
1423
|
+
* Hook for company meeting notes (admin)
|
|
1424
|
+
*/
|
|
1425
|
+
export function useAdminMeetingNotes(companyId, params) {
|
|
1426
|
+
const client = useOsiseClient();
|
|
1427
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1428
|
+
return useQuery(() => client.adminB2B.listCompanyMeetingNotes(companyId, params), {
|
|
1429
|
+
enabled: isAuthenticated && !!companyId,
|
|
1430
|
+
});
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* Hook for meeting note detail (admin)
|
|
1434
|
+
*/
|
|
1435
|
+
export function useAdminMeetingNote(meetingNoteId) {
|
|
1436
|
+
const client = useOsiseClient();
|
|
1437
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1438
|
+
return useQuery(() => client.adminB2B.getMeetingNote(meetingNoteId), {
|
|
1439
|
+
enabled: isAuthenticated && !!meetingNoteId,
|
|
1440
|
+
});
|
|
1441
|
+
}
|
|
1442
|
+
/**
|
|
1443
|
+
* Hook for creating a meeting note (admin)
|
|
1444
|
+
*/
|
|
1445
|
+
export function useCreateMeetingNote() {
|
|
1446
|
+
const client = useOsiseClient();
|
|
1447
|
+
return useMutation(({ companyId, data }) => client.adminB2B.createMeetingNote(companyId, data));
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* Hook for updating a meeting note (admin)
|
|
1451
|
+
*/
|
|
1452
|
+
export function useUpdateMeetingNote() {
|
|
1453
|
+
const client = useOsiseClient();
|
|
1454
|
+
return useMutation(({ meetingNoteId, data }) => client.adminB2B.updateMeetingNote(meetingNoteId, data));
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* Hook for deleting a meeting note (admin)
|
|
1458
|
+
*/
|
|
1459
|
+
export function useDeleteMeetingNote() {
|
|
1460
|
+
const client = useOsiseClient();
|
|
1461
|
+
return useMutation((meetingNoteId) => client.adminB2B.deleteMeetingNote(meetingNoteId));
|
|
1462
|
+
}
|
|
1463
|
+
// ==================== Admin Analytics Hooks ====================
|
|
1464
|
+
/**
|
|
1465
|
+
* Hook for dashboard KPIs
|
|
1466
|
+
*/
|
|
1467
|
+
export function useDashboardKpis(params) {
|
|
1468
|
+
const client = useOsiseClient();
|
|
1469
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1470
|
+
return useQuery(() => client.adminAnalytics.getDashboard(params), {
|
|
1471
|
+
enabled: isAuthenticated,
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1474
|
+
/**
|
|
1475
|
+
* Hook for job analytics
|
|
1476
|
+
*/
|
|
1477
|
+
export function useJobAnalytics(params) {
|
|
1478
|
+
const client = useOsiseClient();
|
|
1479
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1480
|
+
return useQuery(() => client.adminAnalytics.getJobAnalytics(params), {
|
|
1481
|
+
enabled: isAuthenticated,
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* Hook for artisan analytics (detailed)
|
|
1486
|
+
*/
|
|
1487
|
+
export function useArtisanAnalytics(params) {
|
|
1488
|
+
const client = useOsiseClient();
|
|
1489
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1490
|
+
return useQuery(() => client.adminAnalytics.getArtisanAnalytics(params), {
|
|
1491
|
+
enabled: isAuthenticated,
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1494
|
+
/**
|
|
1495
|
+
* Hook for customer analytics
|
|
1496
|
+
*/
|
|
1497
|
+
export function useCustomerAnalytics(params) {
|
|
1498
|
+
const client = useOsiseClient();
|
|
1499
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1500
|
+
return useQuery(() => client.adminAnalytics.getCustomerAnalytics(params), {
|
|
1501
|
+
enabled: isAuthenticated,
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* Hook for revenue analytics
|
|
1506
|
+
*/
|
|
1507
|
+
export function useRevenueAnalytics(params) {
|
|
1508
|
+
const client = useOsiseClient();
|
|
1509
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1510
|
+
return useQuery(() => client.adminAnalytics.getRevenueAnalytics(params), {
|
|
1511
|
+
enabled: isAuthenticated,
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
/**
|
|
1515
|
+
* Hook for SLA compliance analytics
|
|
1516
|
+
*/
|
|
1517
|
+
export function useSlaAnalytics(params) {
|
|
1518
|
+
const client = useOsiseClient();
|
|
1519
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1520
|
+
return useQuery(() => client.adminAnalytics.getSlaAnalytics(params), {
|
|
1521
|
+
enabled: isAuthenticated,
|
|
1522
|
+
});
|
|
1523
|
+
}
|
|
1524
|
+
/**
|
|
1525
|
+
* Hook for complaint analytics
|
|
1526
|
+
*/
|
|
1527
|
+
export function useComplaintAnalytics(params) {
|
|
1528
|
+
const client = useOsiseClient();
|
|
1529
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1530
|
+
return useQuery(() => client.adminAnalytics.getComplaintAnalytics(params), {
|
|
1531
|
+
enabled: isAuthenticated,
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
// ==================== Admin Reports Hooks ====================
|
|
1535
|
+
/**
|
|
1536
|
+
* Hook for generating jobs report
|
|
1537
|
+
*/
|
|
1538
|
+
export function useGenerateJobsReport() {
|
|
1539
|
+
const client = useOsiseClient();
|
|
1540
|
+
return useMutation((data) => client.adminReports.generateJobsReport(data));
|
|
1541
|
+
}
|
|
1542
|
+
/**
|
|
1543
|
+
* Hook for generating artisans report
|
|
1544
|
+
*/
|
|
1545
|
+
export function useGenerateArtisansReport() {
|
|
1546
|
+
const client = useOsiseClient();
|
|
1547
|
+
return useMutation((data) => client.adminReports.generateArtisansReport(data));
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* Hook for generating customers report
|
|
1551
|
+
*/
|
|
1552
|
+
export function useGenerateCustomersReport() {
|
|
1553
|
+
const client = useOsiseClient();
|
|
1554
|
+
return useMutation((data) => client.adminReports.generateCustomersReport(data));
|
|
1555
|
+
}
|
|
1556
|
+
/**
|
|
1557
|
+
* Hook for generating revenue report
|
|
1558
|
+
*/
|
|
1559
|
+
export function useGenerateRevenueReport() {
|
|
1560
|
+
const client = useOsiseClient();
|
|
1561
|
+
return useMutation((data) => client.adminReports.generateRevenueReport(data));
|
|
1562
|
+
}
|
|
1563
|
+
/**
|
|
1564
|
+
* Hook for listing reports
|
|
1565
|
+
*/
|
|
1566
|
+
export function useReportsList(params) {
|
|
1567
|
+
const client = useOsiseClient();
|
|
1568
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1569
|
+
return useQuery(() => client.adminReports.list(params), {
|
|
1570
|
+
enabled: isAuthenticated,
|
|
1571
|
+
});
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* Hook for report detail
|
|
1575
|
+
*/
|
|
1576
|
+
export function useReport(reportId) {
|
|
1577
|
+
const client = useOsiseClient();
|
|
1578
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1579
|
+
return useQuery(() => client.adminReports.get(reportId), {
|
|
1580
|
+
enabled: isAuthenticated && !!reportId,
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1583
|
+
/**
|
|
1584
|
+
* Hook for exporting a report
|
|
1585
|
+
*/
|
|
1586
|
+
export function useExportReport() {
|
|
1587
|
+
const client = useOsiseClient();
|
|
1588
|
+
return useMutation(({ reportId, data }) => client.adminReports.export(reportId, data));
|
|
1589
|
+
}
|
|
1590
|
+
/**
|
|
1591
|
+
* Hook for scheduled reports list
|
|
1592
|
+
*/
|
|
1593
|
+
export function useScheduledReports(params) {
|
|
1594
|
+
const client = useOsiseClient();
|
|
1595
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1596
|
+
return useQuery(() => client.adminReports.getScheduled(params), {
|
|
1597
|
+
enabled: isAuthenticated,
|
|
1598
|
+
});
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Hook for creating a scheduled report
|
|
1602
|
+
*/
|
|
1603
|
+
export function useCreateScheduledReport() {
|
|
1604
|
+
const client = useOsiseClient();
|
|
1605
|
+
return useMutation((data) => client.adminReports.createScheduled(data));
|
|
1606
|
+
}
|
|
1607
|
+
/**
|
|
1608
|
+
* Hook for scheduled report detail
|
|
1609
|
+
*/
|
|
1610
|
+
export function useScheduledReport(scheduleId) {
|
|
1611
|
+
const client = useOsiseClient();
|
|
1612
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1613
|
+
return useQuery(() => client.adminReports.getScheduledById(scheduleId), {
|
|
1614
|
+
enabled: isAuthenticated && !!scheduleId,
|
|
1615
|
+
});
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* Hook for updating a scheduled report
|
|
1619
|
+
*/
|
|
1620
|
+
export function useUpdateScheduledReport() {
|
|
1621
|
+
const client = useOsiseClient();
|
|
1622
|
+
return useMutation(({ scheduleId, data }) => client.adminReports.updateScheduled(scheduleId, data));
|
|
1623
|
+
}
|
|
1624
|
+
/**
|
|
1625
|
+
* Hook for deleting a scheduled report
|
|
1626
|
+
*/
|
|
1627
|
+
export function useDeleteScheduledReport() {
|
|
1628
|
+
const client = useOsiseClient();
|
|
1629
|
+
return useMutation((scheduleId) => client.adminReports.deleteScheduled(scheduleId));
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* Hook for available report types
|
|
1633
|
+
*/
|
|
1634
|
+
export function useAvailableReportTypes() {
|
|
1635
|
+
const client = useOsiseClient();
|
|
1636
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1637
|
+
return useQuery(() => client.adminReports.getAvailableTypes(), {
|
|
1638
|
+
enabled: isAuthenticated,
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
// ==================== Admin System Hooks ====================
|
|
1642
|
+
/**
|
|
1643
|
+
* Hook for admin users list
|
|
1644
|
+
*/
|
|
1645
|
+
export function useAdminUsers(params) {
|
|
1646
|
+
const client = useOsiseClient();
|
|
1647
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1648
|
+
return useQuery(() => client.adminSystem.getAdminUsers(params), {
|
|
1649
|
+
enabled: isAuthenticated,
|
|
1650
|
+
});
|
|
1651
|
+
}
|
|
1652
|
+
/**
|
|
1653
|
+
* Hook for admin user detail
|
|
1654
|
+
*/
|
|
1655
|
+
export function useAdminUser(userId) {
|
|
1656
|
+
const client = useOsiseClient();
|
|
1657
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1658
|
+
return useQuery(() => client.adminSystem.getAdminUser(userId), {
|
|
1659
|
+
enabled: isAuthenticated && !!userId,
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1662
|
+
/**
|
|
1663
|
+
* Hook for creating an admin user
|
|
1664
|
+
*/
|
|
1665
|
+
export function useCreateAdminUser() {
|
|
1666
|
+
const client = useOsiseClient();
|
|
1667
|
+
return useMutation((data) => client.adminSystem.createAdminUser(data));
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Hook for updating an admin user
|
|
1671
|
+
*/
|
|
1672
|
+
export function useUpdateAdminUser() {
|
|
1673
|
+
const client = useOsiseClient();
|
|
1674
|
+
return useMutation(({ userId, data }) => client.adminSystem.updateAdminUser(userId, data));
|
|
1675
|
+
}
|
|
1676
|
+
/**
|
|
1677
|
+
* Hook for deactivating an admin user
|
|
1678
|
+
*/
|
|
1679
|
+
export function useDeactivateAdminUser() {
|
|
1680
|
+
const client = useOsiseClient();
|
|
1681
|
+
return useMutation(({ userId, data }) => client.adminSystem.deactivateAdminUser(userId, data));
|
|
1682
|
+
}
|
|
1683
|
+
/**
|
|
1684
|
+
* Hook for updating admin user roles
|
|
1685
|
+
*/
|
|
1686
|
+
export function useUpdateAdminUserRoles() {
|
|
1687
|
+
const client = useOsiseClient();
|
|
1688
|
+
return useMutation(({ userId, data }) => client.adminSystem.updateAdminUserRoles(userId, data));
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Hook for service areas list
|
|
1692
|
+
*/
|
|
1693
|
+
export function useServiceAreas(params) {
|
|
1694
|
+
const client = useOsiseClient();
|
|
1695
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1696
|
+
return useQuery(() => client.adminSystem.getServiceAreas(params), {
|
|
1697
|
+
enabled: isAuthenticated,
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1700
|
+
/**
|
|
1701
|
+
* Hook for service area detail
|
|
1702
|
+
*/
|
|
1703
|
+
export function useServiceArea(areaId) {
|
|
1704
|
+
const client = useOsiseClient();
|
|
1705
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1706
|
+
return useQuery(() => client.adminSystem.getServiceArea(areaId), {
|
|
1707
|
+
enabled: isAuthenticated && !!areaId,
|
|
1708
|
+
});
|
|
1709
|
+
}
|
|
1710
|
+
/**
|
|
1711
|
+
* Hook for creating a service area
|
|
1712
|
+
*/
|
|
1713
|
+
export function useCreateServiceArea() {
|
|
1714
|
+
const client = useOsiseClient();
|
|
1715
|
+
return useMutation((data) => client.adminSystem.createServiceArea(data));
|
|
1716
|
+
}
|
|
1717
|
+
/**
|
|
1718
|
+
* Hook for updating a service area
|
|
1719
|
+
*/
|
|
1720
|
+
export function useUpdateServiceArea() {
|
|
1721
|
+
const client = useOsiseClient();
|
|
1722
|
+
return useMutation(({ areaId, data }) => client.adminSystem.updateServiceArea(areaId, data));
|
|
1723
|
+
}
|
|
1724
|
+
/**
|
|
1725
|
+
* Hook for deleting a service area
|
|
1726
|
+
*/
|
|
1727
|
+
export function useDeleteServiceArea() {
|
|
1728
|
+
const client = useOsiseClient();
|
|
1729
|
+
return useMutation((areaId) => client.adminSystem.deleteServiceArea(areaId));
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Hook for pricing configuration
|
|
1733
|
+
*/
|
|
1734
|
+
export function usePricingConfig() {
|
|
1735
|
+
const client = useOsiseClient();
|
|
1736
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1737
|
+
return useQuery(() => client.adminSystem.getPricingConfig(), {
|
|
1738
|
+
enabled: isAuthenticated,
|
|
1739
|
+
});
|
|
1740
|
+
}
|
|
1741
|
+
/**
|
|
1742
|
+
* Hook for updating pricing configuration
|
|
1743
|
+
*/
|
|
1744
|
+
export function useUpdatePricingConfig() {
|
|
1745
|
+
const client = useOsiseClient();
|
|
1746
|
+
return useMutation((data) => client.adminSystem.updatePricingConfig(data));
|
|
1747
|
+
}
|
|
1748
|
+
/**
|
|
1749
|
+
* Hook for commission configuration
|
|
1750
|
+
*/
|
|
1751
|
+
export function useCommissionConfig() {
|
|
1752
|
+
const client = useOsiseClient();
|
|
1753
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1754
|
+
return useQuery(() => client.adminSystem.getCommissionConfig(), {
|
|
1755
|
+
enabled: isAuthenticated,
|
|
1756
|
+
});
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* Hook for updating commission configuration
|
|
1760
|
+
*/
|
|
1761
|
+
export function useUpdateCommissionConfig() {
|
|
1762
|
+
const client = useOsiseClient();
|
|
1763
|
+
return useMutation((data) => client.adminSystem.updateCommissionConfig(data));
|
|
1764
|
+
}
|
|
1765
|
+
/**
|
|
1766
|
+
* Hook for system settings
|
|
1767
|
+
*/
|
|
1768
|
+
export function useSystemSettings() {
|
|
1769
|
+
const client = useOsiseClient();
|
|
1770
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1771
|
+
return useQuery(() => client.adminSystem.getSystemSettings(), {
|
|
1772
|
+
enabled: isAuthenticated,
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1775
|
+
/**
|
|
1776
|
+
* Hook for updating system settings
|
|
1777
|
+
*/
|
|
1778
|
+
export function useUpdateSystemSettings() {
|
|
1779
|
+
const client = useOsiseClient();
|
|
1780
|
+
return useMutation((data) => client.adminSystem.updateSystemSettings(data));
|
|
1781
|
+
}
|
|
1782
|
+
/**
|
|
1783
|
+
* Hook for activity logs
|
|
1784
|
+
*/
|
|
1785
|
+
export function useActivityLogs(params) {
|
|
1786
|
+
const client = useOsiseClient();
|
|
1787
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1788
|
+
return useQuery(() => client.adminSystem.getActivityLogs(params), {
|
|
1789
|
+
enabled: isAuthenticated,
|
|
1790
|
+
});
|
|
1791
|
+
}
|
|
1792
|
+
/**
|
|
1793
|
+
* Hook for activity log detail
|
|
1794
|
+
*/
|
|
1795
|
+
export function useActivityLog(logId) {
|
|
1796
|
+
const client = useOsiseClient();
|
|
1797
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1798
|
+
return useQuery(() => client.adminSystem.getActivityLog(logId), {
|
|
1799
|
+
enabled: isAuthenticated && !!logId,
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
/**
|
|
1803
|
+
* Hook for error logs
|
|
1804
|
+
*/
|
|
1805
|
+
export function useErrorLogs(params) {
|
|
1806
|
+
const client = useOsiseClient();
|
|
1807
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1808
|
+
return useQuery(() => client.adminSystem.getErrorLogs(params), {
|
|
1809
|
+
enabled: isAuthenticated,
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
// ==================== Support Ticket Hooks ====================
|
|
1813
|
+
/**
|
|
1814
|
+
* Hook for getting user's support tickets
|
|
1815
|
+
*/
|
|
1816
|
+
export function useTickets(params) {
|
|
1817
|
+
const client = useOsiseClient();
|
|
1818
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1819
|
+
return useQuery(() => client.support.getTickets(params), {
|
|
1820
|
+
enabled: isAuthenticated,
|
|
1821
|
+
});
|
|
1822
|
+
}
|
|
1823
|
+
/**
|
|
1824
|
+
* Hook for getting a specific ticket
|
|
1825
|
+
*/
|
|
1826
|
+
export function useTicket(ticketId) {
|
|
1827
|
+
const client = useOsiseClient();
|
|
1828
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1829
|
+
return useQuery(() => client.support.getTicket(ticketId), {
|
|
1830
|
+
enabled: isAuthenticated && !!ticketId,
|
|
1831
|
+
});
|
|
1832
|
+
}
|
|
1833
|
+
/**
|
|
1834
|
+
* Hook for creating a support ticket
|
|
1835
|
+
*/
|
|
1836
|
+
export function useCreateTicket() {
|
|
1837
|
+
const client = useOsiseClient();
|
|
1838
|
+
return useMutation((data) => client.support.createTicket(data));
|
|
1839
|
+
}
|
|
1840
|
+
/**
|
|
1841
|
+
* Hook for sending a message in a ticket
|
|
1842
|
+
*/
|
|
1843
|
+
export function useSendTicketMessage() {
|
|
1844
|
+
const client = useOsiseClient();
|
|
1845
|
+
return useMutation(({ ticketId, data }) => client.support.sendMessage(ticketId, data));
|
|
1846
|
+
}
|
|
1847
|
+
/**
|
|
1848
|
+
* Hook for closing a ticket
|
|
1849
|
+
*/
|
|
1850
|
+
export function useCloseTicket() {
|
|
1851
|
+
const client = useOsiseClient();
|
|
1852
|
+
return useMutation(({ ticketId, data }) => client.support.closeTicket(ticketId, data));
|
|
1853
|
+
}
|
|
1854
|
+
/**
|
|
1855
|
+
* Hook for rating a ticket
|
|
1856
|
+
*/
|
|
1857
|
+
export function useRateTicket() {
|
|
1858
|
+
const client = useOsiseClient();
|
|
1859
|
+
return useMutation(({ ticketId, data }) => client.support.rateTicket(ticketId, data));
|
|
1860
|
+
}
|
|
1861
|
+
/**
|
|
1862
|
+
* Hook for marking ticket messages as read
|
|
1863
|
+
*/
|
|
1864
|
+
export function useMarkTicketMessagesAsRead() {
|
|
1865
|
+
const client = useOsiseClient();
|
|
1866
|
+
return useMutation((ticketId) => client.support.markMessagesAsRead(ticketId));
|
|
1867
|
+
}
|
|
1868
|
+
// ==================== FAQ Hooks ====================
|
|
1869
|
+
/**
|
|
1870
|
+
* Hook for getting FAQ articles
|
|
1871
|
+
*/
|
|
1872
|
+
export function useFaq(params) {
|
|
1873
|
+
const client = useOsiseClient();
|
|
1874
|
+
return useQuery(() => client.support.getFaq(params));
|
|
1875
|
+
}
|
|
1876
|
+
/**
|
|
1877
|
+
* Hook for searching FAQ articles
|
|
1878
|
+
*/
|
|
1879
|
+
export function useSearchFaq(params) {
|
|
1880
|
+
const client = useOsiseClient();
|
|
1881
|
+
return useQuery(() => client.support.searchFaq(params), {
|
|
1882
|
+
enabled: !!params.query,
|
|
1883
|
+
});
|
|
1884
|
+
}
|
|
1885
|
+
/**
|
|
1886
|
+
* Hook for getting a specific FAQ article
|
|
1887
|
+
*/
|
|
1888
|
+
export function useFaqArticle(articleId) {
|
|
1889
|
+
const client = useOsiseClient();
|
|
1890
|
+
return useQuery(() => client.support.getFaqArticle(articleId), {
|
|
1891
|
+
enabled: !!articleId,
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1894
|
+
/**
|
|
1895
|
+
* Hook for recording FAQ feedback
|
|
1896
|
+
*/
|
|
1897
|
+
export function useRecordFaqFeedback() {
|
|
1898
|
+
const client = useOsiseClient();
|
|
1899
|
+
return useMutation(({ articleId, data }) => client.support.recordFaqFeedback(articleId, data));
|
|
1900
|
+
}
|
|
1901
|
+
// ==================== Artisan Support Hooks ====================
|
|
1902
|
+
/**
|
|
1903
|
+
* Hook for reporting an emergency (artisan)
|
|
1904
|
+
*/
|
|
1905
|
+
export function useReportEmergency() {
|
|
1906
|
+
const client = useOsiseClient();
|
|
1907
|
+
return useMutation((data) => client.artisanSupport.reportEmergency(data));
|
|
1908
|
+
}
|
|
1909
|
+
/**
|
|
1910
|
+
* Hook for getting artisan's support tickets
|
|
1911
|
+
*/
|
|
1912
|
+
export function useArtisanTickets(params) {
|
|
1913
|
+
const client = useOsiseClient();
|
|
1914
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1915
|
+
return useQuery(() => client.artisanSupport.getTickets(params), {
|
|
1916
|
+
enabled: isAuthenticated,
|
|
1917
|
+
});
|
|
1918
|
+
}
|
|
1919
|
+
/**
|
|
1920
|
+
* Hook for getting a specific artisan ticket
|
|
1921
|
+
*/
|
|
1922
|
+
export function useArtisanTicket(ticketId) {
|
|
1923
|
+
const client = useOsiseClient();
|
|
1924
|
+
const isAuthenticated = useIsAuthenticated();
|
|
1925
|
+
return useQuery(() => client.artisanSupport.getTicket(ticketId), {
|
|
1926
|
+
enabled: isAuthenticated && !!ticketId,
|
|
1927
|
+
});
|
|
1928
|
+
}
|
|
1929
|
+
/**
|
|
1930
|
+
* Hook for creating an artisan support ticket
|
|
1931
|
+
*/
|
|
1932
|
+
export function useCreateArtisanTicket() {
|
|
1933
|
+
const client = useOsiseClient();
|
|
1934
|
+
return useMutation((data) => client.artisanSupport.createTicket(data));
|
|
1935
|
+
}
|
|
1936
|
+
/**
|
|
1937
|
+
* Hook for sending a message in an artisan ticket
|
|
1938
|
+
*/
|
|
1939
|
+
export function useSendArtisanTicketMessage() {
|
|
1940
|
+
const client = useOsiseClient();
|
|
1941
|
+
return useMutation(({ ticketId, data }) => client.artisanSupport.sendMessage(ticketId, data));
|
|
1942
|
+
}
|
|
1943
|
+
/**
|
|
1944
|
+
* Hook for closing an artisan ticket
|
|
1945
|
+
*/
|
|
1946
|
+
export function useCloseArtisanTicket() {
|
|
1947
|
+
const client = useOsiseClient();
|
|
1948
|
+
return useMutation(({ ticketId, data }) => client.artisanSupport.closeTicket(ticketId, data));
|
|
1949
|
+
}
|
|
1950
|
+
/**
|
|
1951
|
+
* Hook for rating an artisan ticket
|
|
1952
|
+
*/
|
|
1953
|
+
export function useRateArtisanTicket() {
|
|
1954
|
+
const client = useOsiseClient();
|
|
1955
|
+
return useMutation(({ ticketId, data }) => client.artisanSupport.rateTicket(ticketId, data));
|
|
1956
|
+
}
|
|
408
1957
|
//# sourceMappingURL=index.js.map
|