@smartsides/oracle-ebs-sdk 1.0.6 → 1.0.9

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.
@@ -1,6 +1,6 @@
1
1
  import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { UseMutationOptions, UseQueryOptions } from '@tanstack/react-query';
3
- import { G as GetAbsenceTypesParams, j as GetSitSegmentsParams, Q as GetDffSegmentsParams, O as OracleEBSClient, b as LoginResponse, L as LoginCredentials, U as UserContext, e as GetAbsenceTypesResponse, g as GetLeaveHistoryResponse, i as CreateLeaveRequestResponse, h as CreateLeaveRequestInput, k as GetSitSegmentsResponse, m as SaveAndPreviewSitRequestResponse, l as SaveAndPreviewSitRequestInput, o as SubmitSitRequestResponse, n as SubmitSitRequestInput, s as GetNotificationsResponse, u as GetNotificationDetailsParams, t as NotificationDetails, v as ProcessApprovalResponse, P as ProcessApprovalInput, y as GetPayslipHeaderParams, z as PayslipHeader, B as GetPayslipDetailsParams, E as GetPayslipDetailsResponse, F as PersonalInformation, I as GetEmployeeHierarchyResponse, Y as GetAccrualBalancesParams, Z as GetAccrualBalancesResponse, J as GetTableColumnsParams, K as GetTableColumnsResponse, V as GetDffSegmentsResponse, W as HealthCheckResponse } from '../OracleEBSClient-BE9XZUi1.js';
3
+ import { G as GetAbsenceTypesParams, j as GetSitSegmentsParams, Q as GetDffSegmentsParams, O as OracleEBSClient, b as LoginResponse, L as LoginCredentials, U as UserContext, e as GetAbsenceTypesResponse, g as GetLeaveHistoryResponse, i as CreateLeaveRequestResponse, h as CreateLeaveRequestInput, k as GetSitSegmentsResponse, m as SaveAndPreviewSitRequestResponse, l as SaveAndPreviewSitRequestInput, o as SubmitSitRequestResponse, n as SubmitSitRequestInput, s as GetNotificationsResponse, u as GetNotificationDetailsParams, t as NotificationDetails, v as ProcessApprovalResponse, P as ProcessApprovalInput, y as GetPayslipHeaderParams, z as PayslipHeader, B as GetPayslipDetailsParams, E as GetPayslipDetailsResponse, F as PersonalInformation, I as GetEmployeeHierarchyResponse, Y as GetAccrualBalancesParams, Z as GetAccrualBalancesResponse, J as GetTableColumnsParams, K as GetTableColumnsResponse, V as GetDffSegmentsResponse, W as HealthCheckResponse } from '../OracleEBSClient-BDnxW4cW.js';
4
4
  import 'ky';
5
5
 
6
6
  declare const queryKeys: {
package/dist/index.d.mts CHANGED
@@ -1,5 +1,7 @@
1
- export { A as APIResponse, d as AbsenceType, X as AccrualBalance, C as CacheOptions, w as CloseFyiParams, x as CloseFyiResponse, h as CreateLeaveRequestInput, i as CreateLeaveRequestResponse, M as DffSegment, H as EmployeeHierarchyNode, G as GetAbsenceTypesParams, e as GetAbsenceTypesResponse, Y as GetAccrualBalancesParams, Z as GetAccrualBalancesResponse, Q as GetDffSegmentsParams, V as GetDffSegmentsResponse, I as GetEmployeeHierarchyResponse, g as GetLeaveHistoryResponse, u as GetNotificationDetailsParams, s as GetNotificationsResponse, B as GetPayslipDetailsParams, E as GetPayslipDetailsResponse, y as GetPayslipHeaderParams, p as GetSitHistoryParams, r as GetSitHistoryResponse, j as GetSitSegmentsParams, k as GetSitSegmentsResponse, J as GetTableColumnsParams, K as GetTableColumnsResponse, W as HealthCheckResponse, f as LeaveHistoryRecord, L as LoginCredentials, b as LoginResponse, N as Notification, t as NotificationDetails, O as OracleEBSClient, a as OracleEBSConfig, D as PayslipDetail, z as PayslipHeader, F as PersonalInformation, P as ProcessApprovalInput, v as ProcessApprovalResponse, c as Responsibility, R as RetryOptions, l as SaveAndPreviewSitRequestInput, m as SaveAndPreviewSitRequestResponse, q as SitHistoryRecord, S as SitSegment, n as SubmitSitRequestInput, o as SubmitSitRequestResponse, T as TableColumn, U as UserContext } from './OracleEBSClient-BE9XZUi1.mjs';
1
+ export { A as APIResponse, d as AbsenceType, X as AccrualBalance, $ as ActionType, a3 as AiResponse, C as CacheOptions, a2 as CallToAction, a7 as ChatHistory, a1 as ChatMessage, a4 as ChatRequest, a8 as ChatThread, w as CloseFyiParams, x as CloseFyiResponse, h as CreateLeaveRequestInput, i as CreateLeaveRequestResponse, ac as CreateThreadResponse, ad as DeleteThreadResponse, M as DffSegment, H as EmployeeHierarchyNode, G as GetAbsenceTypesParams, e as GetAbsenceTypesResponse, Y as GetAccrualBalancesParams, Z as GetAccrualBalancesResponse, Q as GetDffSegmentsParams, V as GetDffSegmentsResponse, I as GetEmployeeHierarchyResponse, g as GetLeaveHistoryResponse, u as GetNotificationDetailsParams, s as GetNotificationsResponse, B as GetPayslipDetailsParams, E as GetPayslipDetailsResponse, y as GetPayslipHeaderParams, p as GetSitHistoryParams, r as GetSitHistoryResponse, j as GetSitSegmentsParams, k as GetSitSegmentsResponse, J as GetTableColumnsParams, K as GetTableColumnsResponse, aa as GetThreadMessagesResponse, ab as GetThreadsResponse, W as HealthCheckResponse, f as LeaveHistoryRecord, L as LoginCredentials, b as LoginResponse, _ as MessageRole, N as Notification, t as NotificationDetails, O as OracleEBSClient, a as OracleEBSConfig, D as PayslipDetail, z as PayslipHeader, F as PersonalInformation, P as ProcessApprovalInput, v as ProcessApprovalResponse, c as Responsibility, R as RetryOptions, l as SaveAndPreviewSitRequestInput, m as SaveAndPreviewSitRequestResponse, q as SitHistoryRecord, S as SitSegment, n as SubmitSitRequestInput, o as SubmitSitRequestResponse, T as TableColumn, a9 as ThreadMessage, U as UserContext, a0 as UserIntent, a6 as VoiceResponse, a5 as VoiceTranscription } from './OracleEBSClient-BDnxW4cW.mjs';
2
+ export { queryKeys, useAccrualBalances, useCreateLeaveRequest, useDffSegments, useEmployeeHierarchy, useHealthCheck, useLeaveHistory, useLeaveTypes, useLogin, useNotificationDetails, useNotifications, usePayslipDetails, usePayslipHeader, usePersonalInfo, useProcessApproval, useSaveAndPreviewSitRequest, useSitSegments, useSubmitSitRequest, useTableColumns, useUserContext } from './hooks/index.mjs';
2
3
  import 'ky';
4
+ import '@tanstack/react-query';
3
5
 
4
6
  declare class APIError extends Error {
5
7
  readonly statusCode: number;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- export { A as APIResponse, d as AbsenceType, X as AccrualBalance, C as CacheOptions, w as CloseFyiParams, x as CloseFyiResponse, h as CreateLeaveRequestInput, i as CreateLeaveRequestResponse, M as DffSegment, H as EmployeeHierarchyNode, G as GetAbsenceTypesParams, e as GetAbsenceTypesResponse, Y as GetAccrualBalancesParams, Z as GetAccrualBalancesResponse, Q as GetDffSegmentsParams, V as GetDffSegmentsResponse, I as GetEmployeeHierarchyResponse, g as GetLeaveHistoryResponse, u as GetNotificationDetailsParams, s as GetNotificationsResponse, B as GetPayslipDetailsParams, E as GetPayslipDetailsResponse, y as GetPayslipHeaderParams, p as GetSitHistoryParams, r as GetSitHistoryResponse, j as GetSitSegmentsParams, k as GetSitSegmentsResponse, J as GetTableColumnsParams, K as GetTableColumnsResponse, W as HealthCheckResponse, f as LeaveHistoryRecord, L as LoginCredentials, b as LoginResponse, N as Notification, t as NotificationDetails, O as OracleEBSClient, a as OracleEBSConfig, D as PayslipDetail, z as PayslipHeader, F as PersonalInformation, P as ProcessApprovalInput, v as ProcessApprovalResponse, c as Responsibility, R as RetryOptions, l as SaveAndPreviewSitRequestInput, m as SaveAndPreviewSitRequestResponse, q as SitHistoryRecord, S as SitSegment, n as SubmitSitRequestInput, o as SubmitSitRequestResponse, T as TableColumn, U as UserContext } from './OracleEBSClient-BE9XZUi1.js';
1
+ export { A as APIResponse, d as AbsenceType, X as AccrualBalance, $ as ActionType, a3 as AiResponse, C as CacheOptions, a2 as CallToAction, a7 as ChatHistory, a1 as ChatMessage, a4 as ChatRequest, a8 as ChatThread, w as CloseFyiParams, x as CloseFyiResponse, h as CreateLeaveRequestInput, i as CreateLeaveRequestResponse, ac as CreateThreadResponse, ad as DeleteThreadResponse, M as DffSegment, H as EmployeeHierarchyNode, G as GetAbsenceTypesParams, e as GetAbsenceTypesResponse, Y as GetAccrualBalancesParams, Z as GetAccrualBalancesResponse, Q as GetDffSegmentsParams, V as GetDffSegmentsResponse, I as GetEmployeeHierarchyResponse, g as GetLeaveHistoryResponse, u as GetNotificationDetailsParams, s as GetNotificationsResponse, B as GetPayslipDetailsParams, E as GetPayslipDetailsResponse, y as GetPayslipHeaderParams, p as GetSitHistoryParams, r as GetSitHistoryResponse, j as GetSitSegmentsParams, k as GetSitSegmentsResponse, J as GetTableColumnsParams, K as GetTableColumnsResponse, aa as GetThreadMessagesResponse, ab as GetThreadsResponse, W as HealthCheckResponse, f as LeaveHistoryRecord, L as LoginCredentials, b as LoginResponse, _ as MessageRole, N as Notification, t as NotificationDetails, O as OracleEBSClient, a as OracleEBSConfig, D as PayslipDetail, z as PayslipHeader, F as PersonalInformation, P as ProcessApprovalInput, v as ProcessApprovalResponse, c as Responsibility, R as RetryOptions, l as SaveAndPreviewSitRequestInput, m as SaveAndPreviewSitRequestResponse, q as SitHistoryRecord, S as SitSegment, n as SubmitSitRequestInput, o as SubmitSitRequestResponse, T as TableColumn, a9 as ThreadMessage, U as UserContext, a0 as UserIntent, a6 as VoiceResponse, a5 as VoiceTranscription } from './OracleEBSClient-BDnxW4cW.js';
2
+ export { queryKeys, useAccrualBalances, useCreateLeaveRequest, useDffSegments, useEmployeeHierarchy, useHealthCheck, useLeaveHistory, useLeaveTypes, useLogin, useNotificationDetails, useNotifications, usePayslipDetails, usePayslipHeader, usePersonalInfo, useProcessApproval, useSaveAndPreviewSitRequest, useSitSegments, useSubmitSitRequest, useTableColumns, useUserContext } from './hooks/index.js';
2
3
  import 'ky';
4
+ import '@tanstack/react-query';
3
5
 
4
6
  declare class APIError extends Error {
5
7
  readonly statusCode: number;
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var ky = require('ky');
4
+ var reactQuery = require('@tanstack/react-query');
4
5
 
5
6
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
7
 
@@ -179,7 +180,8 @@ var BaseClient = class {
179
180
  async post(url, data, options) {
180
181
  try {
181
182
  this.log("info", `POST ${url}`);
182
- const response = await this.client.post(url, { json: data, ...options }).json();
183
+ const requestOptions = data instanceof FormData ? { body: data, ...options } : { json: data, ...options };
184
+ const response = await this.client.post(url, requestOptions).json();
183
185
  return response;
184
186
  } catch (error) {
185
187
  throw this.handleError(error);
@@ -368,10 +370,11 @@ var SitRequestsModule = class extends BaseClient {
368
370
  */
369
371
  async getHistory(params) {
370
372
  const searchParams = new URLSearchParams();
371
- if (params?.startDate) searchParams.set("startDate", params.startDate);
372
- if (params?.endDate) searchParams.set("endDate", params.endDate);
373
- const url = `sit-requests/history${searchParams.toString() ? `?${searchParams}` : ""}`;
374
- const response = await this.get(url);
373
+ searchParams.set("sitName", params.sitName);
374
+ if (params.transactionId) searchParams.set("transactionId", params.transactionId);
375
+ if (params.startDate) searchParams.set("startDate", params.startDate);
376
+ if (params.endDate) searchParams.set("endDate", params.endDate);
377
+ const response = await this.get(`sit-requests/history?${searchParams}`);
375
378
  return response.data;
376
379
  }
377
380
  };
@@ -395,78 +398,92 @@ var NotificationsModule = class extends BaseClient {
395
398
  return response.data;
396
399
  }
397
400
  /**
398
- * Process approval action (approve/reject)
401
+ * Get all notification details (SSHR_SIT_REQDTLS)
402
+ * All parameters are required
403
+ */
404
+ async getAllDetails(params) {
405
+ const searchParams = new URLSearchParams();
406
+ searchParams.set("notificationId", params.notificationId);
407
+ searchParams.set("itemKey", params.itemKey);
408
+ searchParams.set("analysisCriteriaId", params.analysisCriteriaId);
409
+ searchParams.set("idFlexNum", params.idFlexNum);
410
+ const response = await this.get(`notifications/all-details?${searchParams}`);
411
+ return response.data;
412
+ }
413
+ /**
414
+ * Get absence details for FYI notifications
415
+ */
416
+ async getAbsenceDetails(params) {
417
+ const searchParams = new URLSearchParams();
418
+ searchParams.set("itemKey", params.itemKey);
419
+ const response = await this.get(`notifications/absence-details?${searchParams}`);
420
+ return response.data;
421
+ }
422
+ /**
423
+ * Get action history for a notification
424
+ */
425
+ async getActionHistory(params) {
426
+ const searchParams = new URLSearchParams();
427
+ searchParams.set("notificationId", params.notificationId);
428
+ const response = await this.get(`notifications/action-history?${searchParams}`);
429
+ return response.data;
430
+ }
431
+ /**
432
+ * Process approval action (APPROVE/DECLINE)
399
433
  */
400
434
  async processApproval(input) {
401
- const response = await this.post("notifications/process-approval", input);
435
+ const response = await this.post("notifications/process-approval-action", input);
402
436
  return response.data;
403
437
  }
404
438
  /**
405
439
  * Close FYI notification
406
440
  */
407
441
  async closeFyi(params) {
408
- const searchParams = new URLSearchParams();
409
- searchParams.set("notificationId", params.notificationId);
410
- const response = await this.get(`notifications/close-fyi?${searchParams}`);
442
+ const response = await this.post("notifications/close-fyi", {
443
+ notificationId: params.notificationId
444
+ });
411
445
  return response.data;
412
446
  }
413
447
  };
414
448
 
415
449
  // src/modules/PayslipModule.ts
416
450
  var PayslipModule = class extends BaseClient {
417
- /**
418
- * Get employee number from stored user context
419
- */
420
- getEmployeeNumberFromContext(providedEmployeeNumber) {
421
- if (providedEmployeeNumber) {
422
- return providedEmployeeNumber;
423
- }
424
- const employeeNumber = this.getEmployeeNumber();
425
- if (!employeeNumber) {
426
- throw new Error("Employee number not available. Please login first.");
427
- }
428
- return employeeNumber;
429
- }
430
451
  /**
431
452
  * Get payslip header
453
+ * Note: employeeNumber is extracted from JWT by backend
432
454
  */
433
455
  async getHeader(params) {
434
- const employeeNumber = this.getEmployeeNumberFromContext(params.employeeNumber);
435
456
  const searchParams = new URLSearchParams();
436
- searchParams.set("employeeNumber", employeeNumber);
437
457
  searchParams.set("periodName", params.periodName);
438
458
  const response = await this.get(`payslip/header?${searchParams}`);
439
459
  return response.data;
440
460
  }
441
461
  /**
442
462
  * Get payslip details
463
+ * Note: employeeNumber is extracted from JWT by backend
443
464
  */
444
465
  async getDetails(params) {
445
- const employeeNumber = this.getEmployeeNumberFromContext(params.employeeNumber);
446
466
  const searchParams = new URLSearchParams();
447
- searchParams.set("employeeNumber", employeeNumber);
448
467
  searchParams.set("periodName", params.periodName);
449
468
  const response = await this.get(`payslip/details?${searchParams}`);
450
469
  return response.data;
451
470
  }
452
471
  /**
453
472
  * Get payslip leave details
473
+ * Note: employeeNumber is extracted from JWT by backend
454
474
  */
455
475
  async getLeaveDetails(params) {
456
- const employeeNumber = this.getEmployeeNumberFromContext(params.employeeNumber);
457
476
  const searchParams = new URLSearchParams();
458
- searchParams.set("employeeNumber", employeeNumber);
459
477
  searchParams.set("periodName", params.periodName);
460
478
  const response = await this.get(`payslip/leave-details?${searchParams}`);
461
479
  return response.data;
462
480
  }
463
481
  /**
464
482
  * Get payslip run balances
483
+ * Note: employeeNumber is extracted from JWT by backend
465
484
  */
466
485
  async getRunBalances(params) {
467
- const employeeNumber = this.getEmployeeNumberFromContext(params.employeeNumber);
468
486
  const searchParams = new URLSearchParams();
469
- searchParams.set("employeeNumber", employeeNumber);
470
487
  searchParams.set("periodName", params.periodName);
471
488
  const response = await this.get(`payslip/run-balances?${searchParams}`);
472
489
  return response.data;
@@ -545,6 +562,127 @@ var HealthModule = class extends BaseClient {
545
562
  }
546
563
  };
547
564
 
565
+ // src/modules/AiModule.ts
566
+ var AiModule = class extends BaseClient {
567
+ /**
568
+ * Send a text message to the AI assistant
569
+ * @param request Chat request with message and optional history
570
+ * @returns AI response with message and CTAs
571
+ */
572
+ async sendMessage(request) {
573
+ const response = await this.post("ai/chat", request);
574
+ return response.data;
575
+ }
576
+ /**
577
+ * Send a voice message to the AI assistant
578
+ * @param audioBlob Audio file as Blob
579
+ * @param options Optional language and threadId for conversation continuity
580
+ * @returns Transcription and AI response
581
+ */
582
+ async sendVoice(audioBlob, options) {
583
+ const formData = new FormData();
584
+ formData.append("audio", audioBlob, "voice-message.webm");
585
+ if (options?.language) {
586
+ formData.append("language", options.language);
587
+ }
588
+ if (options?.threadId) {
589
+ formData.append("threadId", options.threadId);
590
+ }
591
+ const response = await this.post("ai/voice", formData, {
592
+ headers: {
593
+ // Let browser set Content-Type with boundary for multipart/form-data
594
+ }
595
+ });
596
+ return response.data;
597
+ }
598
+ /**
599
+ * Save chat message to local history
600
+ * @param message Chat message to save
601
+ */
602
+ saveChatMessage(message) {
603
+ try {
604
+ const history = this.getLocalChatHistory();
605
+ history.push({
606
+ ...message,
607
+ timestamp: /* @__PURE__ */ new Date()
608
+ });
609
+ const trimmedHistory = history.slice(-50);
610
+ if (typeof localStorage !== "undefined") {
611
+ localStorage.setItem(
612
+ "ai_chat_history",
613
+ JSON.stringify(trimmedHistory)
614
+ );
615
+ }
616
+ } catch (error) {
617
+ console.error("Failed to save chat message:", error);
618
+ }
619
+ }
620
+ /**
621
+ * Get local chat history from localStorage
622
+ * @returns Array of chat messages with timestamps
623
+ */
624
+ getLocalChatHistory() {
625
+ try {
626
+ if (typeof localStorage === "undefined") return [];
627
+ const stored = localStorage.getItem("ai_chat_history");
628
+ if (!stored) return [];
629
+ const parsed = JSON.parse(stored);
630
+ return parsed.map((msg) => ({
631
+ ...msg,
632
+ timestamp: new Date(msg.timestamp)
633
+ }));
634
+ } catch (error) {
635
+ console.error("Failed to get chat history:", error);
636
+ return [];
637
+ }
638
+ }
639
+ /**
640
+ * Clear local chat history
641
+ */
642
+ clearChatHistory() {
643
+ try {
644
+ if (typeof localStorage !== "undefined") {
645
+ localStorage.removeItem("ai_chat_history");
646
+ }
647
+ } catch (error) {
648
+ console.error("Failed to clear chat history:", error);
649
+ }
650
+ }
651
+ // ==================== Chat Thread Management ====================
652
+ /**
653
+ * Get all chat threads for the current user
654
+ * @returns Array of chat threads
655
+ */
656
+ async getChatThreads() {
657
+ const response = await this.get("ai/threads");
658
+ return response.data.threads;
659
+ }
660
+ /**
661
+ * Get messages for a specific thread
662
+ * @param threadId Thread ID
663
+ * @returns Thread with messages
664
+ */
665
+ async getThreadMessages(threadId) {
666
+ const response = await this.get(`ai/threads/${threadId}/messages`);
667
+ return response.data;
668
+ }
669
+ /**
670
+ * Create a new chat thread
671
+ * @returns New thread
672
+ */
673
+ async createThread() {
674
+ const response = await this.post("ai/threads", {});
675
+ return response.data.thread;
676
+ }
677
+ /**
678
+ * Delete a chat thread
679
+ * @param threadId Thread ID to delete
680
+ */
681
+ async deleteThread(threadId) {
682
+ await this.delete(`ai/threads/${threadId}`);
683
+ }
684
+ };
685
+
548
686
  // src/client/OracleEBSClient.ts
549
687
  var OracleEBSClient = class {
550
688
  constructor(config) {
@@ -557,6 +695,7 @@ var OracleEBSClient = class {
557
695
  this.accrualBalances = new AccrualBalancesModule(config);
558
696
  this.forms = new FormsModule(config);
559
697
  this.health = new HealthModule(config);
698
+ this.ai = new AiModule(config);
560
699
  }
561
700
  /**
562
701
  * Set authentication token for all modules
@@ -571,6 +710,7 @@ var OracleEBSClient = class {
571
710
  this.accrualBalances.setToken(token, user);
572
711
  this.forms.setToken(token, user);
573
712
  this.health.setToken(token, user);
713
+ this.ai.setToken(token, user);
574
714
  }
575
715
  /**
576
716
  * Clear authentication token from all modules
@@ -585,17 +725,238 @@ var OracleEBSClient = class {
585
725
  this.accrualBalances.clearToken();
586
726
  this.forms.clearToken();
587
727
  this.health.clearToken();
728
+ this.ai.clearToken();
729
+ }
730
+ };
731
+
732
+ // src/types/ai.ts
733
+ var MessageRole = /* @__PURE__ */ ((MessageRole2) => {
734
+ MessageRole2["USER"] = "user";
735
+ MessageRole2["ASSISTANT"] = "assistant";
736
+ MessageRole2["SYSTEM"] = "system";
737
+ return MessageRole2;
738
+ })(MessageRole || {});
739
+ var ActionType = /* @__PURE__ */ ((ActionType2) => {
740
+ ActionType2["NAVIGATE"] = "navigate";
741
+ ActionType2["API_CALL"] = "api_call";
742
+ ActionType2["DOWNLOAD"] = "download";
743
+ ActionType2["CLOSE_NOTIFICATION"] = "close_notification";
744
+ ActionType2["SUBMIT_LEAVE"] = "submit_leave";
745
+ ActionType2["APPROVE_NOTIFICATION"] = "approve_notification";
746
+ ActionType2["DECLINE_NOTIFICATION"] = "decline_notification";
747
+ return ActionType2;
748
+ })(ActionType || {});
749
+ var UserIntent = /* @__PURE__ */ ((UserIntent2) => {
750
+ UserIntent2["NOTIFICATIONS_SUMMARY"] = "notifications_summary";
751
+ UserIntent2["NOTIFICATION_CLOSE"] = "notification_close";
752
+ UserIntent2["NOTIFICATION_ACTION"] = "notification_action";
753
+ UserIntent2["PAYSLIP_QUERY"] = "payslip_query";
754
+ UserIntent2["PAYSLIP_RETRIEVAL"] = "payslip_retrieval";
755
+ UserIntent2["SALARY_DEDUCTION"] = "salary_deduction";
756
+ UserIntent2["LEAVE_BALANCE"] = "leave_balance";
757
+ UserIntent2["LEAVE_REQUEST"] = "leave_request";
758
+ UserIntent2["PROFILE_INFO"] = "profile_info";
759
+ UserIntent2["HIRING_DATE"] = "hiring_date";
760
+ UserIntent2["POSITION_INFO"] = "position_info";
761
+ UserIntent2["GENERAL_QUERY"] = "general_query";
762
+ UserIntent2["OUT_OF_SCOPE"] = "out_of_scope";
763
+ return UserIntent2;
764
+ })(UserIntent || {});
765
+ var queryKeys = {
766
+ auth: {
767
+ userContext: ["auth", "user-context"]
768
+ },
769
+ leaves: {
770
+ restrictedTypes: (params) => ["leaves", "restricted-types", params],
771
+ history: ["leaves", "history"]
772
+ },
773
+ sitRequests: {
774
+ segments: (params) => ["sit-requests", "segments", params],
775
+ history: ["sit-requests", "history"]
776
+ },
777
+ notifications: {
778
+ list: ["notifications", "list"],
779
+ details: (notificationId) => ["notifications", "details", notificationId]
780
+ },
781
+ payslip: {
782
+ header: (periodName) => ["payslip", "header", periodName],
783
+ details: (periodName) => ["payslip", "details", periodName]
784
+ },
785
+ employee: {
786
+ personalInfo: ["employee", "personal-info"],
787
+ hierarchy: ["employee", "hierarchy"]
788
+ },
789
+ accrualBalances: {
790
+ get: (calculationDate) => ["accrual-balances", calculationDate]
791
+ },
792
+ forms: {
793
+ tableColumns: (tableName) => ["forms", "table-columns", tableName],
794
+ dffSegments: (params) => ["forms", "dff-segments", params]
795
+ },
796
+ health: {
797
+ check: ["health", "check"]
588
798
  }
589
799
  };
800
+ function useLogin(client, options) {
801
+ return reactQuery.useMutation({
802
+ mutationFn: (credentials) => client.auth.login(credentials),
803
+ ...options
804
+ });
805
+ }
806
+ function useUserContext(client, options) {
807
+ return reactQuery.useQuery({
808
+ queryKey: queryKeys.auth.userContext,
809
+ queryFn: () => client.auth.getUserContext(),
810
+ ...options
811
+ });
812
+ }
813
+ function useLeaveTypes(client, params, options) {
814
+ return reactQuery.useQuery({
815
+ queryKey: queryKeys.leaves.restrictedTypes(params),
816
+ queryFn: () => client.leaves.getRestrictedTypes(params),
817
+ ...options
818
+ });
819
+ }
820
+ function useLeaveHistory(client, options) {
821
+ return reactQuery.useQuery({
822
+ queryKey: queryKeys.leaves.history,
823
+ queryFn: () => client.leaves.getHistory(),
824
+ ...options
825
+ });
826
+ }
827
+ function useCreateLeaveRequest(client, options) {
828
+ return reactQuery.useMutation({
829
+ mutationFn: (input) => client.leaves.createRequest(input),
830
+ ...options
831
+ });
832
+ }
833
+ function useSitSegments(client, params, options) {
834
+ return reactQuery.useQuery({
835
+ queryKey: queryKeys.sitRequests.segments(params),
836
+ queryFn: () => client.sitRequests.getSegments(params),
837
+ ...options
838
+ });
839
+ }
840
+ function useSaveAndPreviewSitRequest(client, options) {
841
+ return reactQuery.useMutation({
842
+ mutationFn: (input) => client.sitRequests.saveAndPreview(input),
843
+ ...options
844
+ });
845
+ }
846
+ function useSubmitSitRequest(client, options) {
847
+ return reactQuery.useMutation({
848
+ mutationFn: (input) => client.sitRequests.submit(input),
849
+ ...options
850
+ });
851
+ }
852
+ function useNotifications(client, options) {
853
+ return reactQuery.useQuery({
854
+ queryKey: queryKeys.notifications.list,
855
+ queryFn: () => client.notifications.getList(),
856
+ ...options
857
+ });
858
+ }
859
+ function useNotificationDetails(client, params, options) {
860
+ return reactQuery.useQuery({
861
+ queryKey: queryKeys.notifications.details(params.notificationId),
862
+ queryFn: () => client.notifications.getDetails(params),
863
+ ...options
864
+ });
865
+ }
866
+ function useProcessApproval(client, options) {
867
+ return reactQuery.useMutation({
868
+ mutationFn: (input) => client.notifications.processApproval(input),
869
+ ...options
870
+ });
871
+ }
872
+ function usePayslipHeader(client, params, options) {
873
+ return reactQuery.useQuery({
874
+ queryKey: queryKeys.payslip.header(params.periodName),
875
+ queryFn: () => client.payslip.getHeader(params),
876
+ ...options
877
+ });
878
+ }
879
+ function usePayslipDetails(client, params, options) {
880
+ return reactQuery.useQuery({
881
+ queryKey: queryKeys.payslip.details(params.periodName),
882
+ queryFn: () => client.payslip.getDetails(params),
883
+ ...options
884
+ });
885
+ }
886
+ function usePersonalInfo(client, options) {
887
+ return reactQuery.useQuery({
888
+ queryKey: queryKeys.employee.personalInfo,
889
+ queryFn: () => client.employee.getPersonalInfo(),
890
+ ...options
891
+ });
892
+ }
893
+ function useEmployeeHierarchy(client, options) {
894
+ return reactQuery.useQuery({
895
+ queryKey: queryKeys.employee.hierarchy,
896
+ queryFn: () => client.employee.getHierarchy(),
897
+ ...options
898
+ });
899
+ }
900
+ function useAccrualBalances(client, params, options) {
901
+ return reactQuery.useQuery({
902
+ queryKey: queryKeys.accrualBalances.get(params.calculationDate),
903
+ queryFn: () => client.accrualBalances.getBalances(params),
904
+ ...options
905
+ });
906
+ }
907
+ function useTableColumns(client, params, options) {
908
+ return reactQuery.useQuery({
909
+ queryKey: queryKeys.forms.tableColumns(params.tableName),
910
+ queryFn: () => client.forms.getTableColumns(params),
911
+ ...options
912
+ });
913
+ }
914
+ function useDffSegments(client, params, options) {
915
+ return reactQuery.useQuery({
916
+ queryKey: queryKeys.forms.dffSegments(params),
917
+ queryFn: () => client.forms.getDffSegments(params),
918
+ ...options
919
+ });
920
+ }
921
+ function useHealthCheck(client, options) {
922
+ return reactQuery.useQuery({
923
+ queryKey: queryKeys.health.check,
924
+ queryFn: () => client.health.check(),
925
+ ...options
926
+ });
927
+ }
590
928
 
591
929
  exports.APIError = APIError;
930
+ exports.ActionType = ActionType;
592
931
  exports.ForbiddenError = ForbiddenError;
932
+ exports.MessageRole = MessageRole;
593
933
  exports.NetworkError = NetworkError;
594
934
  exports.NotFoundError = NotFoundError;
595
935
  exports.OracleEBSClient = OracleEBSClient;
596
936
  exports.ServerError = ServerError;
597
937
  exports.TimeoutError = TimeoutError;
598
938
  exports.UnauthorizedError = UnauthorizedError;
939
+ exports.UserIntent = UserIntent;
599
940
  exports.ValidationError = ValidationError;
941
+ exports.queryKeys = queryKeys;
942
+ exports.useAccrualBalances = useAccrualBalances;
943
+ exports.useCreateLeaveRequest = useCreateLeaveRequest;
944
+ exports.useDffSegments = useDffSegments;
945
+ exports.useEmployeeHierarchy = useEmployeeHierarchy;
946
+ exports.useHealthCheck = useHealthCheck;
947
+ exports.useLeaveHistory = useLeaveHistory;
948
+ exports.useLeaveTypes = useLeaveTypes;
949
+ exports.useLogin = useLogin;
950
+ exports.useNotificationDetails = useNotificationDetails;
951
+ exports.useNotifications = useNotifications;
952
+ exports.usePayslipDetails = usePayslipDetails;
953
+ exports.usePayslipHeader = usePayslipHeader;
954
+ exports.usePersonalInfo = usePersonalInfo;
955
+ exports.useProcessApproval = useProcessApproval;
956
+ exports.useSaveAndPreviewSitRequest = useSaveAndPreviewSitRequest;
957
+ exports.useSitSegments = useSitSegments;
958
+ exports.useSubmitSitRequest = useSubmitSitRequest;
959
+ exports.useTableColumns = useTableColumns;
960
+ exports.useUserContext = useUserContext;
600
961
  //# sourceMappingURL=index.js.map
601
962
  //# sourceMappingURL=index.js.map