@passgage/sdk-react-native 1.0.4 → 1.0.5

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/dist/index.d.mts CHANGED
@@ -65,6 +65,14 @@ interface APIError extends Error {
65
65
  status?: number;
66
66
  response?: BaseResponse;
67
67
  }
68
+ interface FlowResponseType {
69
+ success: boolean;
70
+ message: string;
71
+ error?: {
72
+ code: string;
73
+ details?: string;
74
+ };
75
+ }
68
76
 
69
77
  /**
70
78
  * Device-related types and interfaces
@@ -104,6 +112,7 @@ interface QrDevice {
104
112
  device_type?: string;
105
113
  created_at: string;
106
114
  updated_at: string;
115
+ is_iot: boolean;
107
116
  }
108
117
  interface DeviceAccessRequest {
109
118
  userId?: string;
@@ -113,6 +122,12 @@ interface DeviceAccessRequest {
113
122
  interface QrAccessResponse {
114
123
  qr_ids: string[];
115
124
  }
125
+ interface ReqCreateEntrance {
126
+ device_id: string;
127
+ created_at?: string;
128
+ entrance_type?: DeviceDirection;
129
+ service_id?: string;
130
+ }
116
131
 
117
132
  /**
118
133
  * Entrance-related types and interfaces
@@ -154,6 +169,7 @@ interface CreateEntranceRequest {
154
169
  interface CreateEntranceFromQRRequest {
155
170
  device_id: string;
156
171
  created_at?: string;
172
+ entrance_type?: DeviceDirection;
157
173
  service_id?: string;
158
174
  }
159
175
  interface EntranceQueryParams {
@@ -201,6 +217,16 @@ interface LoginCredentials {
201
217
  login: string;
202
218
  /** User password */
203
219
  password: string;
220
+ rememberUser?: boolean;
221
+ }
222
+ /**
223
+ * Azure AD login credentials
224
+ */
225
+ interface AzureLoginCredentials {
226
+ /** Azure AD id_token */
227
+ id_token: string;
228
+ /** Device type (android/ios) */
229
+ device_type?: 'android' | 'ios';
204
230
  }
205
231
  /**
206
232
  * Token information
@@ -271,6 +297,12 @@ interface LoginRequest {
271
297
  interface LoginResponse {
272
298
  tokens: AuthTokens;
273
299
  }
300
+ /**
301
+ * Azure AD login response data from API
302
+ */
303
+ interface AzureLoginResponse {
304
+ tokens: AuthTokens;
305
+ }
274
306
  /**
275
307
  * Token refresh request payload
276
308
  */
@@ -407,7 +439,7 @@ declare class ApiClient {
407
439
  /**
408
440
  * Generic POST request
409
441
  */
410
- post<T = unknown, R = unknown>(options: Omit<RequestOptions<T>, 'method'>): Promise<BaseResponse<R>>;
442
+ post<T = unknown>(options: Omit<RequestOptions<T>, 'method'>): Promise<any>;
411
443
  /**
412
444
  * Generic PUT request
413
445
  */
@@ -431,6 +463,7 @@ declare function createApiClient(config: ApiClientConfig): ApiClient;
431
463
  */
432
464
  declare const EP_LOGIN = "users/sign_in";
433
465
  declare const EP_TOKEN = "token";
466
+ declare const EP_AZURE_AUTH = "auth/azure";
434
467
  declare const EP_DEVICES = "devices";
435
468
  declare const EP_QR_DEVICES = "devices/qr_devices";
436
469
  declare const EP_QR_ACCESS = "qr_access/accessible_qrs";
@@ -444,6 +477,7 @@ declare const EP_TRIGGER_IOT = "iot/trigger";
444
477
  declare const EP_USERS = "users";
445
478
  declare const EP_ME = "users/lite_me";
446
479
 
480
+ declare const endpoints_EP_AZURE_AUTH: typeof EP_AZURE_AUTH;
447
481
  declare const endpoints_EP_BRANCHES: typeof EP_BRANCHES;
448
482
  declare const endpoints_EP_CREATE_QR: typeof EP_CREATE_QR;
449
483
  declare const endpoints_EP_DEVICES: typeof EP_DEVICES;
@@ -459,7 +493,7 @@ declare const endpoints_EP_TOKEN: typeof EP_TOKEN;
459
493
  declare const endpoints_EP_TRIGGER_IOT: typeof EP_TRIGGER_IOT;
460
494
  declare const endpoints_EP_USERS: typeof EP_USERS;
461
495
  declare namespace endpoints {
462
- export { endpoints_EP_BRANCHES as EP_BRANCHES, endpoints_EP_CREATE_QR as EP_CREATE_QR, endpoints_EP_DEVICES as EP_DEVICES, endpoints_EP_ENTRANCES as EP_ENTRANCES, endpoints_EP_LOCATION_VERIFICATION as EP_LOCATION_VERIFICATION, endpoints_EP_LOGIN as EP_LOGIN, endpoints_EP_ME as EP_ME, endpoints_EP_NFC_CHECK as EP_NFC_CHECK, endpoints_EP_QR_ACCESS as EP_QR_ACCESS, endpoints_EP_QR_CHECK as EP_QR_CHECK, endpoints_EP_QR_DEVICES as EP_QR_DEVICES, endpoints_EP_TOKEN as EP_TOKEN, endpoints_EP_TRIGGER_IOT as EP_TRIGGER_IOT, endpoints_EP_USERS as EP_USERS };
496
+ export { endpoints_EP_AZURE_AUTH as EP_AZURE_AUTH, endpoints_EP_BRANCHES as EP_BRANCHES, endpoints_EP_CREATE_QR as EP_CREATE_QR, endpoints_EP_DEVICES as EP_DEVICES, endpoints_EP_ENTRANCES as EP_ENTRANCES, endpoints_EP_LOCATION_VERIFICATION as EP_LOCATION_VERIFICATION, endpoints_EP_LOGIN as EP_LOGIN, endpoints_EP_ME as EP_ME, endpoints_EP_NFC_CHECK as EP_NFC_CHECK, endpoints_EP_QR_ACCESS as EP_QR_ACCESS, endpoints_EP_QR_CHECK as EP_QR_CHECK, endpoints_EP_QR_DEVICES as EP_QR_DEVICES, endpoints_EP_TOKEN as EP_TOKEN, endpoints_EP_TRIGGER_IOT as EP_TRIGGER_IOT, endpoints_EP_USERS as EP_USERS };
463
497
  }
464
498
 
465
499
  /**
@@ -467,36 +501,13 @@ declare namespace endpoints {
467
501
  *
468
502
  * Handles user authentication, token management, and user information retrieval.
469
503
  */
504
+ declare module 'axios' {
505
+ interface AxiosRequestConfig {
506
+ skipAuth?: boolean;
507
+ }
508
+ }
470
509
 
471
- /**
472
- * Authentication Service
473
- *
474
- * Provides methods for user authentication and token management.
475
- *
476
- * @example
477
- * ```typescript
478
- * const authService = new AuthService(apiClient);
479
- *
480
- * // Login
481
- * const result = await authService.login({
482
- * login: 'user@example.com',
483
- * password: 'password123'
484
- * });
485
- *
486
- * if (result.success) {
487
- * console.log('Logged in:', result.tokens);
488
- * }
489
- * ```
490
- */
491
- declare class AuthService {
492
- private apiClient;
493
- private tokenStorage?;
494
- constructor(apiClient: ApiClient);
495
- /**
496
- * Set token storage implementation
497
- * This is used by platform-specific implementations (React Native, Android, iOS)
498
- */
499
- setTokenStorage(storage: TokenStorage): void;
510
+ declare const AuthService: {
500
511
  /**
501
512
  * Login with credentials
502
513
  *
@@ -517,7 +528,28 @@ declare class AuthService {
517
528
  * }
518
529
  * ```
519
530
  */
520
- login(credentials: LoginCredentials): Promise<LoginResult>;
531
+ login: (credentials: LoginCredentials) => Promise<LoginResult>;
532
+ /**
533
+ * Login with Azure AD token
534
+ *
535
+ * @param credentials - Azure AD login credentials (id_token and optional device_type)
536
+ * @returns Login result with tokens on success
537
+ *
538
+ * @example
539
+ * ```typescript
540
+ * const result = await authService.loginWithAzure({
541
+ * id_token: 'azure_id_token_here',
542
+ * device_type: 'ios'
543
+ * });
544
+ *
545
+ * if (result.success) {
546
+ * console.log('Access token:', result.tokens.access.token);
547
+ * } else {
548
+ * console.error('Azure login failed:', result.error);
549
+ * }
550
+ * ```
551
+ */
552
+ loginWithAzure: (credentials: AzureLoginCredentials) => Promise<LoginResult>;
521
553
  /**
522
554
  * Refresh access token using refresh token
523
555
  *
@@ -533,7 +565,7 @@ declare class AuthService {
533
565
  * }
534
566
  * ```
535
567
  */
536
- refreshToken(refreshToken: string): Promise<RefreshTokenResult>;
568
+ refreshToken: (refreshToken: string) => Promise<RefreshTokenResult>;
537
569
  /**
538
570
  * Get current user information
539
571
  *
@@ -548,43 +580,14 @@ declare class AuthService {
548
580
  * }
549
581
  * ```
550
582
  */
551
- getCurrentUser(): Promise<{
583
+ getCurrentUser: () => Promise<{
552
584
  success: true;
553
585
  user: User;
554
586
  } | {
555
587
  success: false;
556
588
  error: string;
557
589
  }>;
558
- /**
559
- * Logout current user
560
- * Clears tokens from storage and API client
561
- *
562
- * @example
563
- * ```typescript
564
- * await authService.logout();
565
- * console.log('User logged out');
566
- * ```
567
- */
568
- logout(): Promise<void>;
569
- /**
570
- * Check if user is authenticated
571
- *
572
- * @returns True if user has valid tokens
573
- */
574
- isAuthenticated(): Promise<boolean>;
575
- /**
576
- * Get stored tokens
577
- *
578
- * @returns Stored tokens or null
579
- */
580
- getStoredTokens(): Promise<AuthTokens | null>;
581
- /**
582
- * Get stored user
583
- *
584
- * @returns Stored user or null
585
- */
586
- getStoredUser(): Promise<User | null>;
587
- }
590
+ };
588
591
 
589
592
  /**
590
593
  * QR Access Service
@@ -598,43 +601,19 @@ interface QRValidationOptions {
598
601
  skipLocationCheck?: boolean;
599
602
  skipRepetitiveCheck?: boolean;
600
603
  }
601
- interface QRValidationResult {
602
- success: boolean;
603
- message: string;
604
+ interface QRValidationResult extends FlowResponseType {
604
605
  entrance?: Entrance;
605
- error?: {
606
- code: string;
607
- details?: string;
608
- };
609
606
  }
610
- declare class QRAccessService {
611
- private apiClient;
612
- constructor(apiClient: ApiClient);
607
+ declare const QRAccessService: {
613
608
  /**
614
- * Validate QR code format
615
- */
616
- private validateQRFormat;
617
- /**
618
- * Check if location validation is required
619
- */
620
- private shouldValidateLocation;
621
- /**
622
- * Validate user location against device location
623
- */
624
- private validateLocation;
625
- /**
626
- * Validate QR code with full checks
609
+ * Trigger IoT device
627
610
  */
628
- validateQR(options: QRValidationOptions): Promise<QRValidationResult>;
611
+ triggerIoTDevice: (deviceId: string, config?: AxiosRequestConfig) => Promise<BaseResponse<Entrance>>;
629
612
  /**
630
613
  * Create entrance from QR code
631
614
  */
632
- createEntranceFromQR(request: CreateEntranceFromQRRequest): Promise<BaseResponse<Entrance>>;
633
- /**
634
- * Trigger IoT device
635
- */
636
- triggerIoTDevice(deviceId: string): Promise<BaseResponse>;
637
- }
615
+ createEntranceFromQR: (request: CreateEntranceFromQRRequest) => Promise<BaseResponse<Entrance>>;
616
+ };
638
617
 
639
618
  /**
640
619
  * NFC Access Service
@@ -648,168 +627,71 @@ interface NFCValidationOptions {
648
627
  skipLocationCheck?: boolean;
649
628
  skipRepetitiveCheck?: boolean;
650
629
  }
651
- interface NFCValidationResult {
652
- success: boolean;
653
- message: string;
630
+ interface NFCValidationResult extends FlowResponseType {
654
631
  entrance?: Entrance;
655
- error?: {
656
- code: string;
657
- details?: string;
658
- };
659
632
  }
660
- declare class NFCAccessService {
661
- private apiClient;
662
- constructor(apiClient: ApiClient);
663
- /**
664
- * Validate NFC code format
665
- */
666
- private validateNFCFormat;
667
- /**
668
- * Check if location validation is required
669
- */
670
- private shouldValidateLocation;
671
- /**
672
- * Validate user location against device location
673
- */
674
- private validateLocation;
633
+ declare const NfcAccessService: {
634
+ validateNFCFormat: (code: string) => boolean;
635
+ shouldValidateLocation: (device?: QrDevice) => boolean;
636
+ validateLocation: (device?: QrDevice, userLocation?: Coordinates) => {
637
+ valid: boolean;
638
+ distance?: number;
639
+ };
675
640
  /**
676
641
  * Validate NFC code with full checks
677
642
  */
678
643
  validateNFC(options: NFCValidationOptions): Promise<NFCValidationResult>;
679
- }
680
-
681
- /**
682
- * Check-In Service
683
- * Handles GPS-based check-in to nearby branches
684
- */
685
-
686
- interface CheckInOptions {
687
- branchId: string;
688
- entranceType: EntranceType;
689
- userId: string;
690
- userLocation?: Coordinates;
691
- }
692
- interface CheckInResult {
693
- success: boolean;
694
- message: string;
695
- entrance?: Entrance;
696
- error?: {
697
- code: string;
698
- details?: string;
699
- };
700
- }
701
- declare class CheckInService {
702
- private apiClient;
703
- constructor(apiClient: ApiClient);
704
- /**
705
- * Get nearby branches based on user location
706
- */
707
- getNearbyBranches(request: NearbyBranchesRequest): Promise<BaseResponse<Branch[]>>;
708
- /**
709
- * Check in to a branch
710
- */
711
- checkIn(options: CheckInOptions): Promise<CheckInResult>;
712
- /**
713
- * Get branch by ID
714
- */
715
- getBranchById(branchId: string): Promise<BaseResponse<Branch>>;
716
- /**
717
- * Get all branches (with pagination)
718
- */
719
- getAllBranches(params?: {
720
- page?: number;
721
- per_page?: number;
722
- }): Promise<BaseResponse<Branch[]>>;
723
- }
724
-
725
- /**
726
- * Remote Work Service
727
- * Handles remote work entry and exit logging
728
- */
729
-
730
- interface RemoteWorkEntryOptions {
731
- userId: string;
732
- entranceType: EntranceType;
733
- timestamp?: Date | string;
734
- description?: string;
735
- }
736
- interface RemoteWorkResult {
737
- success: boolean;
738
- message: string;
739
- entrance?: Entrance;
740
- error?: {
741
- code: string;
742
- details?: string;
743
- };
744
- }
745
- declare class RemoteWorkService {
746
- private apiClient;
747
- constructor(apiClient: ApiClient);
748
- /**
749
- * Log remote work entry or exit
750
- */
751
- logRemoteWork(options: RemoteWorkEntryOptions): Promise<RemoteWorkResult>;
752
- /**
753
- * Log remote work entry
754
- */
755
- logEntry(options: Omit<RemoteWorkEntryOptions, 'entranceType'>): Promise<RemoteWorkResult>;
756
- /**
757
- * Log remote work exit
758
- */
759
- logExit(options: Omit<RemoteWorkEntryOptions, 'entranceType'>): Promise<RemoteWorkResult>;
760
- }
644
+ };
761
645
 
762
646
  /**
763
647
  * Device Access Service
764
648
  * Handles device access control and management
765
649
  */
766
650
 
767
- declare class DeviceAccessService {
768
- private apiClient;
769
- constructor(apiClient: ApiClient);
651
+ declare const DeviceAccessService: {
770
652
  /**
771
653
  * Get all devices
772
654
  */
773
- getDevices(params?: {
655
+ getDevices: (params?: {
774
656
  page?: number;
775
657
  per_page?: number;
776
- }): Promise<BaseResponse<Device[]>>;
658
+ }) => Promise<BaseResponse<Device[]>>;
777
659
  /**
778
660
  * Get all QR devices
779
661
  */
780
- getQRDevices(params?: {
662
+ getQRDevices: (params?: {
781
663
  page?: number;
782
664
  per_page?: number;
783
- }): Promise<BaseResponse<QrDevice[]>>;
665
+ }) => Promise<BaseResponse<QrDevice[]>>;
784
666
  /**
785
667
  * Get all QR devices with pagination support
786
668
  */
787
- getAllQRDevices(): Promise<QrDevice[]>;
669
+ getAllQRDevices: () => Promise<QrDevice[]>;
788
670
  /**
789
671
  * Get accessible QR codes for current user
790
672
  */
791
- getAccessibleQRs(): Promise<BaseResponse<QrAccessResponse>>;
673
+ getAccessibleQRs: () => Promise<BaseResponse<QrAccessResponse>>;
792
674
  /**
793
675
  * Get user devices
794
676
  */
795
- getUserDevices(request: DeviceAccessRequest): Promise<BaseResponse<Device[]>>;
677
+ getUserDevices: (request: DeviceAccessRequest) => Promise<BaseResponse<Device[]>>;
796
678
  /**
797
679
  * Get device by ID
798
680
  */
799
- getDeviceById(deviceId: string): Promise<BaseResponse<Device>>;
681
+ getDeviceById: (deviceId: string) => Promise<BaseResponse<Device>>;
800
682
  /**
801
683
  * Check if user has access to a device
802
684
  */
803
- checkDeviceAccess(deviceId: string): Promise<boolean>;
685
+ checkDeviceAccess: (deviceId: string) => Promise<boolean>;
804
686
  /**
805
687
  * Find QR device by QR code ID
806
688
  */
807
- findDeviceByQRCode(qrCodeId: string): Promise<QrDevice | undefined>;
689
+ findDeviceByQRCode: (qrCodeId: string) => Promise<QrDevice | undefined>;
808
690
  /**
809
691
  * Find QR device by NFC code
810
692
  */
811
- findDeviceByNFCCode(nfcCode: string): Promise<QrDevice | undefined>;
812
- }
693
+ findDeviceByNFCCode: (nfcCode: string) => Promise<QrDevice | undefined>;
694
+ };
813
695
 
814
696
  /**
815
697
  * Location Service
@@ -927,12 +809,14 @@ declare function validateCoordinates(coords?: Coordinates): boolean;
927
809
  /**
928
810
  * Validation utility functions
929
811
  */
812
+
930
813
  /**
931
814
  * Check if a code was recently read (within 15 seconds)
932
815
  * @param code - Code to check
933
816
  * @returns true if this is a new read, false if repetitive
934
817
  */
935
- declare function checkRepetitiveRead(code: string): boolean;
818
+ declare function checkRepetitiveRead(code?: string): boolean;
819
+ declare const addQrReadRecord: (code?: string) => void;
936
820
  /**
937
821
  * Clear all read records
938
822
  */
@@ -942,7 +826,7 @@ declare function clearReadRecords(): void;
942
826
  * @param code - QR code to validate
943
827
  * @returns true if valid
944
828
  */
945
- declare function validateQRCode(code: string): boolean;
829
+ declare function validateQRCode(code?: string): boolean;
946
830
  /**
947
831
  * Validate NFC code format
948
832
  * @param code - NFC code to validate
@@ -955,6 +839,17 @@ declare function validateNFCCode(code: string): boolean;
955
839
  * @returns true if valid UUID
956
840
  */
957
841
  declare function validateDeviceId(id: string): boolean;
842
+ /**
843
+ * Check if location validation is required
844
+ */
845
+ declare const shouldValidateLocation: (device: QrDevice) => boolean;
846
+ /**
847
+ * Validate user location against device location
848
+ */
849
+ declare const validateLocation: (device: QrDevice, userLocation?: Coordinates) => {
850
+ valid: boolean;
851
+ distance?: number;
852
+ };
958
853
 
959
854
  /**
960
855
  * Date utility functions
@@ -995,250 +890,65 @@ declare function parseISO(isoString: string): Date;
995
890
  * Main provider component for SDK configuration
996
891
  */
997
892
 
998
- interface PassgageAccessConfig {
999
- baseURL: string;
1000
- token?: string;
1001
- apiVersion?: string;
1002
- timeout?: number;
1003
- onUnauthorized?: () => void;
1004
- onError?: (error: Error) => void;
1005
- }
1006
- interface PassgageAccessContextValue {
1007
- apiClient: ApiClient;
1008
- authService: AuthService;
1009
- qrAccessService: QRAccessService;
1010
- nfcAccessService: NFCAccessService;
1011
- checkInService: CheckInService;
1012
- remoteWorkService: RemoteWorkService;
1013
- deviceAccessService: DeviceAccessService;
1014
- locationService: LocationService;
1015
- config: PassgageAccessConfig;
1016
- setToken: (token: string | null) => void;
1017
- clearToken: () => void;
1018
- }
1019
893
  interface PassgageAccessProviderProps {
1020
894
  children: ReactNode;
1021
895
  baseURL: string;
1022
- token?: string;
896
+ msalToken: string;
1023
897
  apiVersion?: string;
1024
898
  timeout?: number;
1025
- onUnauthorized?: () => void;
1026
- onError?: (error: Error) => void;
899
+ rememberUser?: boolean;
900
+ onUnauthorized?: (error: Error) => void;
901
+ getLocationErrorCallback?: (error: any) => void;
902
+ locationPermissionErrorCallback?: (error: any) => void;
1027
903
  }
1028
- declare function PassgageAccessProvider({ children, baseURL, token, apiVersion, timeout, onUnauthorized, onError, }: PassgageAccessProviderProps): React.JSX.Element;
1029
- /**
1030
- * Hook to access Passgage SDK context
1031
- */
1032
- declare function usePassgageAccess(): PassgageAccessContextValue;
1033
-
1034
- /**
1035
- * Authentication Hook
1036
- *
1037
- * Provides authentication functionality including login, logout, and user state management.
1038
- */
904
+ declare function PassgageAccessProvider(props: PassgageAccessProviderProps): React.JSX.Element;
905
+ declare const usePassgageAccessContext: () => PassgageAccessProviderProps;
1039
906
 
1040
- interface UsePassgageAuthOptions {
1041
- /**
1042
- * Callback called when login is successful
1043
- */
1044
- onLoginSuccess?: (user?: User) => void;
1045
- /**
1046
- * Callback called when login fails
1047
- */
1048
- onLoginError?: (error: string) => void;
1049
- /**
1050
- * Callback called when logout is successful
1051
- */
1052
- onLogoutSuccess?: () => void;
1053
- /**
1054
- * Automatically check for stored tokens on mount
1055
- * @default true
1056
- */
1057
- autoRestore?: boolean;
1058
- }
1059
- interface UsePassgageAuthReturn {
1060
- /**
1061
- * Login with credentials
1062
- */
1063
- login: (credentials: LoginCredentials) => Promise<LoginResult>;
1064
- /**
1065
- * Logout current user
1066
- */
1067
- logout: () => Promise<void>;
1068
- /**
1069
- * Refresh access token
1070
- */
1071
- refreshToken: () => Promise<boolean>;
1072
- /**
1073
- * Whether user is authenticated
1074
- */
1075
- isAuthenticated: boolean;
1076
- /**
1077
- * Current user information
1078
- */
1079
- user: User | null;
1080
- /**
1081
- * Whether an auth operation is in progress
1082
- */
1083
- isLoading: boolean;
1084
- /**
1085
- * Last error message
1086
- */
1087
- error: string | null;
1088
- /**
1089
- * Clear error message
1090
- */
1091
- clearError: () => void;
907
+ interface EnteranceFlowOptions {
908
+ skipLocationCheck?: boolean;
909
+ skipRepetitiveCheck?: boolean;
1092
910
  }
1093
- /**
1094
- * Authentication hook
1095
- *
1096
- * @example
1097
- * ```typescript
1098
- * function LoginScreen() {
1099
- * const { login, isLoading, error, isAuthenticated } = usePassgageAuth({
1100
- * onLoginSuccess: (user) => {
1101
- * console.log('Logged in:', user);
1102
- * navigation.navigate('Home');
1103
- * },
1104
- * onLoginError: (error) => {
1105
- * Alert.alert('Login Failed', error);
1106
- * }
1107
- * });
1108
- *
1109
- * const handleLogin = async () => {
1110
- * await login({
1111
- * login: 'user@example.com',
1112
- * password: 'password123'
1113
- * });
1114
- * };
1115
- *
1116
- * if (isAuthenticated) {
1117
- * return <Text>Already logged in!</Text>;
1118
- * }
1119
- *
1120
- * return (
1121
- * <View>
1122
- * <Button
1123
- * title="Login"
1124
- * onPress={handleLogin}
1125
- * disabled={isLoading}
1126
- * />
1127
- * {error && <Text>{error}</Text>}
1128
- * </View>
1129
- * );
1130
- * }
1131
- * ```
1132
- */
1133
- declare function usePassgageAuth(options?: UsePassgageAuthOptions): UsePassgageAuthReturn;
1134
911
 
1135
912
  /**
1136
913
  * usePassgageQRScanner hook
1137
914
  * QR code scanning with validation
1138
915
  */
1139
916
 
1140
- interface UsePassgageQRScannerOptions {
917
+ interface UsePassgageQRScanner {
918
+ options: EnteranceFlowOptions;
1141
919
  onSuccess?: (entrance?: Entrance) => void;
1142
- onError?: (error: Error) => void;
1143
- skipLocationCheck?: boolean;
1144
- skipRepetitiveCheck?: boolean;
920
+ onError?: (error?: FlowResponseType) => void;
1145
921
  }
1146
922
  interface UsePassgageQRScannerReturn {
1147
923
  scan: (qrCode: string, device?: QrDevice) => Promise<void>;
1148
924
  isLoading: boolean;
1149
- error: Error | null;
925
+ error: FlowResponseType | null;
1150
926
  }
1151
- declare function usePassgageQRScanner(options?: UsePassgageQRScannerOptions): UsePassgageQRScannerReturn;
927
+ declare const usePassgageQRScanner: (payload: UsePassgageQRScanner) => UsePassgageQRScannerReturn;
1152
928
 
1153
929
  /**
1154
930
  * usePassgageNFCScanner hook
1155
- * NFC card scanning with validation
931
+ * NFC card isScanning with validation
1156
932
  */
1157
933
 
1158
934
  interface UsePassgageNFCScannerOptions {
935
+ options: EnteranceFlowOptions;
1159
936
  onSuccess?: (entrance?: Entrance) => void;
1160
937
  onError?: (error: Error) => void;
1161
- skipLocationCheck?: boolean;
1162
- skipRepetitiveCheck?: boolean;
1163
- autoStart?: boolean;
1164
938
  }
1165
939
  interface UsePassgageNFCScannerReturn {
940
+ nfcData?: string;
941
+ supportNFC?: boolean;
1166
942
  startScanning: () => Promise<void>;
1167
943
  stopScanning: () => Promise<void>;
1168
944
  isScanning: boolean;
1169
945
  error: Error | null;
1170
946
  }
1171
- declare function usePassgageNFCScanner(options?: UsePassgageNFCScannerOptions): UsePassgageNFCScannerReturn;
1172
-
1173
947
  /**
1174
- * usePassgageCheckIn hook
1175
- * GPS-based check-in to nearby branches
948
+ * Convert hex string to decimal
1176
949
  */
1177
-
1178
- interface UsePassgageCheckInOptions {
1179
- radius?: number;
1180
- }
1181
- interface CheckInEntryParams {
1182
- branchId: string;
1183
- userId: string;
1184
- }
1185
- interface CheckInExitParams {
1186
- branchId: string;
1187
- userId: string;
1188
- }
1189
- interface GetNearbyBranchesParams {
1190
- radius?: number;
1191
- }
1192
- interface UsePassgageCheckInReturn {
1193
- getNearbyBranches: (params?: GetNearbyBranchesParams) => Promise<{
1194
- success: boolean;
1195
- data?: Branch[];
1196
- error?: string;
1197
- }>;
1198
- checkInEntry: (params: CheckInEntryParams) => Promise<{
1199
- success: boolean;
1200
- data?: any;
1201
- error?: string;
1202
- }>;
1203
- checkInExit: (params: CheckInExitParams) => Promise<{
1204
- success: boolean;
1205
- data?: any;
1206
- error?: string;
1207
- }>;
1208
- isLoading: boolean;
1209
- error: Error | null;
1210
- }
1211
- declare function usePassgageCheckIn(options?: UsePassgageCheckInOptions): UsePassgageCheckInReturn;
1212
-
1213
- /**
1214
- * usePassgageRemoteWork hook
1215
- * Remote work entry/exit logging
1216
- */
1217
- interface RemoteWorkEntryParams {
1218
- userId: string;
1219
- description?: string;
1220
- timestamp?: Date | string;
1221
- }
1222
- interface RemoteWorkExitParams {
1223
- userId: string;
1224
- description?: string;
1225
- timestamp?: Date | string;
1226
- }
1227
- interface UsePassgageRemoteWorkReturn {
1228
- logEntry: (params: RemoteWorkEntryParams) => Promise<{
1229
- success: boolean;
1230
- data?: any;
1231
- error?: string;
1232
- }>;
1233
- logExit: (params: RemoteWorkExitParams) => Promise<{
1234
- success: boolean;
1235
- data?: any;
1236
- error?: string;
1237
- }>;
1238
- isLoading: boolean;
1239
- error: Error | null;
1240
- }
1241
- declare function usePassgageRemoteWork(): UsePassgageRemoteWorkReturn;
950
+ declare const reversedHexToDec: (reversedHex: string) => string;
951
+ declare function usePassgageNFCScanner(payload: UsePassgageNFCScannerOptions): UsePassgageNFCScannerReturn;
1242
952
 
1243
953
  /**
1244
954
  * useLocation hook
@@ -1266,4 +976,4 @@ declare function useLocation(options?: UseLocationOptions): UseLocationReturn;
1266
976
 
1267
977
  declare const SDK_VERSION = "1.0.4";
1268
978
 
1269
- export { type APIError, ApiClient, type ApiClientConfig, AuthService, type AuthState, type AuthTokens, type BaseResponse, type Branch, type CheckInEntryParams, type CheckInExitParams, type CheckInOptions, type CheckInResult, CheckInService, type CompanyInfo, type Coordinates, type CreateEntranceFromQRRequest, type CreateEntranceRequest, type Device, type DeviceAccessRequest, DeviceAccessService, DeviceDirection, DeviceUsage, endpoints as Endpoints, type Entrance, type EntranceQueryParams, EntranceType, type GetNearbyBranchesParams, LocationService, type LocationVerificationLog, type LoginCredentials, type LoginRequest, type LoginResponse, type LoginResult, NFCAccessService, type NFCValidationOptions, type NFCValidationResult, type NearbyBranchesRequest, type PaginationMeta, type PassgageAccessConfig, type PassgageAccessContextValue, PassgageAccessProvider, type PassgageAccessProviderProps, QRAccessService, type QRValidationOptions, type QRValidationResult, type QrAccessResponse, type QrDevice, type RefreshTokenRequest, type RefreshTokenResponse, type RefreshTokenResult, type RemoteWorkEntryOptions, type RemoteWorkEntryParams, type RemoteWorkExitParams, type RemoteWorkResult, RemoteWorkService, type RequestOptions, SDK_VERSION, type TokenInfo, type TokenStorage, type UseLocationOptions, type UseLocationReturn, type UsePassgageAuthOptions, type UsePassgageAuthReturn, type UsePassgageCheckInOptions, type UsePassgageCheckInReturn, type UsePassgageNFCScannerOptions, type UsePassgageNFCScannerReturn, type UsePassgageQRScannerOptions, type UsePassgageQRScannerReturn, type UsePassgageRemoteWorkReturn, type User, calculateDistance, checkOnLocation, checkRepetitiveRead, clearReadRecords, createApiClient, formatDate, formatDateTime, formatISO, formatTime, parseISO, useLocation, usePassgageAccess, usePassgageAuth, usePassgageCheckIn, usePassgageNFCScanner, usePassgageQRScanner, usePassgageRemoteWork, validateCoordinates, validateDeviceId, validateNFCCode, validateQRCode };
979
+ export { type APIError, ApiClient, type ApiClientConfig, AuthService, type AuthState, type AuthTokens, type AzureLoginCredentials, type AzureLoginResponse, type BaseResponse, type Branch, type CompanyInfo, type Coordinates, type CreateEntranceFromQRRequest, type CreateEntranceRequest, type Device, type DeviceAccessRequest, DeviceAccessService, DeviceDirection, DeviceUsage, endpoints as Endpoints, type Entrance, type EntranceQueryParams, EntranceType, type FlowResponseType, LocationService, type LocationVerificationLog, type LoginCredentials, type LoginRequest, type LoginResponse, type LoginResult, type NFCValidationOptions, type NFCValidationResult, type NearbyBranchesRequest, NfcAccessService, type PaginationMeta, PassgageAccessProvider, type PassgageAccessProviderProps, QRAccessService, type QRValidationOptions, type QRValidationResult, type QrAccessResponse, type QrDevice, type RefreshTokenRequest, type RefreshTokenResponse, type RefreshTokenResult, type ReqCreateEntrance, type RequestOptions, SDK_VERSION, type TokenInfo, type TokenStorage, type UseLocationOptions, type UseLocationReturn, type UsePassgageNFCScannerOptions, type UsePassgageNFCScannerReturn, type UsePassgageQRScanner, type UsePassgageQRScannerReturn, type User, addQrReadRecord, calculateDistance, checkOnLocation, checkRepetitiveRead, clearReadRecords, createApiClient, formatDate, formatDateTime, formatISO, formatTime, parseISO, reversedHexToDec, shouldValidateLocation, useLocation, usePassgageAccessContext, usePassgageNFCScanner, usePassgageQRScanner, validateCoordinates, validateDeviceId, validateLocation, validateNFCCode, validateQRCode };