@oxyhq/services 5.26.4 → 5.27.0
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/web/oxy-services.esm.js +2 -0
- package/dist/web/oxy-services.esm.js.map +1 -0
- package/dist/web/types/assets/icons/OxyServices.d.ts +28 -0
- package/dist/web/types/assets/illustrations/HighFive.d.ts +8 -0
- package/dist/web/types/constants/version.d.ts +13 -0
- package/dist/web/types/core/AuthManager.d.ts +143 -0
- package/dist/web/types/core/CrossDomainAuth.d.ts +160 -0
- package/dist/web/types/core/HttpService.d.ts +163 -0
- package/dist/web/types/core/OxyServices.base.d.ts +126 -0
- package/dist/web/types/core/OxyServices.d.ts +81 -0
- package/dist/web/types/core/OxyServices.errors.d.ts +11 -0
- package/dist/web/types/core/index.d.ts +20 -0
- package/dist/web/types/core/mixins/OxyServices.analytics.d.ts +66 -0
- package/dist/web/types/core/mixins/OxyServices.assets.d.ts +135 -0
- package/dist/web/types/core/mixins/OxyServices.auth.d.ts +186 -0
- package/dist/web/types/core/mixins/OxyServices.developer.d.ts +99 -0
- package/dist/web/types/core/mixins/OxyServices.devices.d.ts +96 -0
- package/dist/web/types/core/mixins/OxyServices.features.d.ts +228 -0
- package/dist/web/types/core/mixins/OxyServices.fedcm.d.ts +200 -0
- package/dist/web/types/core/mixins/OxyServices.karma.d.ts +85 -0
- package/dist/web/types/core/mixins/OxyServices.language.d.ts +81 -0
- package/dist/web/types/core/mixins/OxyServices.location.d.ts +64 -0
- package/dist/web/types/core/mixins/OxyServices.payment.d.ts +111 -0
- package/dist/web/types/core/mixins/OxyServices.popup.d.ts +205 -0
- package/dist/web/types/core/mixins/OxyServices.privacy.d.ts +122 -0
- package/dist/web/types/core/mixins/OxyServices.redirect.d.ts +245 -0
- package/dist/web/types/core/mixins/OxyServices.security.d.ts +78 -0
- package/dist/web/types/core/mixins/OxyServices.user.d.ts +184 -0
- package/dist/web/types/core/mixins/OxyServices.utility.d.ts +93 -0
- package/dist/web/types/core/mixins/index.d.ts +30 -0
- package/dist/web/types/core/mixins/mixinHelpers.d.ts +31 -0
- package/dist/web/types/crypto/index.d.ts +11 -0
- package/dist/web/types/crypto/keyManager.d.ts +189 -0
- package/dist/web/types/crypto/polyfill.d.ts +12 -0
- package/dist/web/types/crypto/recoveryPhrase.d.ts +58 -0
- package/dist/web/types/crypto/signatureService.d.ts +86 -0
- package/dist/web/types/i18n/index.d.ts +3 -0
- package/dist/web/types/index.d.ts +62 -0
- package/dist/web/types/lib/sonner-safe.d.ts +8 -0
- package/dist/web/types/lib/sonner.d.ts +11 -0
- package/dist/web/types/lib/sonner.web.d.ts +14 -0
- package/dist/web/types/models/interfaces.d.ts +415 -0
- package/dist/web/types/models/session.d.ts +27 -0
- package/dist/web/types/node/index.d.ts +9 -0
- package/dist/web/types/shared/index.d.ts +28 -0
- package/dist/web/types/shared/utils/colorUtils.d.ts +104 -0
- package/dist/web/types/shared/utils/debugUtils.d.ts +48 -0
- package/dist/web/types/shared/utils/errorUtils.d.ts +97 -0
- package/dist/web/types/shared/utils/index.d.ts +13 -0
- package/dist/web/types/shared/utils/networkUtils.d.ts +139 -0
- package/dist/web/types/shared/utils/themeUtils.d.ts +90 -0
- package/dist/web/types/ui/client.d.ts +33 -0
- package/dist/web/types/ui/components/ActivityIndicator.d.ts +44 -0
- package/dist/web/types/ui/components/AnimationExample.d.ts +3 -0
- package/dist/web/types/ui/components/AutoHeightScrollView.d.ts +22 -0
- package/dist/web/types/ui/components/Avatar.d.ts +60 -0
- package/dist/web/types/ui/components/BottomSheet.d.ts +28 -0
- package/dist/web/types/ui/components/BottomSheetRouter.d.ts +8 -0
- package/dist/web/types/ui/components/CrossFadeIcon.d.ts +26 -0
- package/dist/web/types/ui/components/EmptyState.d.ts +7 -0
- package/dist/web/types/ui/components/ErrorBoundary.d.ts +30 -0
- package/dist/web/types/ui/components/FollowButton.d.ts +17 -0
- package/dist/web/types/ui/components/FontLoader.d.ts +14 -0
- package/dist/web/types/ui/components/GroupedItem.d.ts +23 -0
- package/dist/web/types/ui/components/GroupedSection.d.ts +24 -0
- package/dist/web/types/ui/components/Header.d.ts +37 -0
- package/dist/web/types/ui/components/HelperText.d.ts +46 -0
- package/dist/web/types/ui/components/Icon.d.ts +59 -0
- package/dist/web/types/ui/components/IconButton/IconButton.d.ts +98 -0
- package/dist/web/types/ui/components/IconButton/utils.d.ts +18 -0
- package/dist/web/types/ui/components/LoadingState.d.ts +8 -0
- package/dist/web/types/ui/components/OxyLogo.d.ts +28 -0
- package/dist/web/types/ui/components/OxyPayButton.d.ts +28 -0
- package/dist/web/types/ui/components/OxyProvider.d.ts +33 -0
- package/dist/web/types/ui/components/OxySignInButton.d.ts +64 -0
- package/dist/web/types/ui/components/ProfileCard.d.ts +17 -0
- package/dist/web/types/ui/components/QuickActions.d.ts +14 -0
- package/dist/web/types/ui/components/Section.d.ts +11 -0
- package/dist/web/types/ui/components/SectionTitle.d.ts +9 -0
- package/dist/web/types/ui/components/SettingRow.d.ts +19 -0
- package/dist/web/types/ui/components/SignInModal.d.ts +17 -0
- package/dist/web/types/ui/components/StepBasedScreen.d.ts +25 -0
- package/dist/web/types/ui/components/Surface.d.ts +75 -0
- package/dist/web/types/ui/components/TextField/Addons/Outline.d.ts +15 -0
- package/dist/web/types/ui/components/TextField/Addons/Underline.d.ts +18 -0
- package/dist/web/types/ui/components/TextField/Adornment/TextFieldAdornment.d.ts +44 -0
- package/dist/web/types/ui/components/TextField/Adornment/TextFieldAffix.d.ts +72 -0
- package/dist/web/types/ui/components/TextField/Adornment/TextFieldIcon.d.ts +77 -0
- package/dist/web/types/ui/components/TextField/Adornment/enums.d.ts +12 -0
- package/dist/web/types/ui/components/TextField/Adornment/types.d.ts +11 -0
- package/dist/web/types/ui/components/TextField/Adornment/utils.d.ts +11 -0
- package/dist/web/types/ui/components/TextField/Label/InputLabel.d.ts +4 -0
- package/dist/web/types/ui/components/TextField/Label/LabelBackground.d.ts +3 -0
- package/dist/web/types/ui/components/TextField/TextFieldFlat.d.ts +3 -0
- package/dist/web/types/ui/components/TextField/TextFieldOutlined.d.ts +3 -0
- package/dist/web/types/ui/components/TextField/constants.d.ts +31 -0
- package/dist/web/types/ui/components/TextField/helpers.d.ts +96 -0
- package/dist/web/types/ui/components/TextField/types.d.ts +155 -0
- package/dist/web/types/ui/components/TextField.d.ts +191 -0
- package/dist/web/types/ui/components/TouchableRipple/Pressable.d.ts +12 -0
- package/dist/web/types/ui/components/TouchableRipple/TouchableRipple.d.ts +61 -0
- package/dist/web/types/ui/components/TouchableRipple/utils.d.ts +10 -0
- package/dist/web/types/ui/components/Typography/AnimatedText.d.ts +34 -0
- package/dist/web/types/ui/components/Typography/types.d.ts +18 -0
- package/dist/web/types/ui/components/WebOxyProvider.d.ts +51 -0
- package/dist/web/types/ui/components/feedback/FormInput.d.ts +19 -0
- package/dist/web/types/ui/components/feedback/ProgressIndicator.d.ts +10 -0
- package/dist/web/types/ui/components/feedback/constants.d.ts +4 -0
- package/dist/web/types/ui/components/feedback/feedbackStyles.d.ts +279 -0
- package/dist/web/types/ui/components/feedback/index.d.ts +6 -0
- package/dist/web/types/ui/components/feedback/types.d.ts +45 -0
- package/dist/web/types/ui/components/feedback/useFeedbackForm.d.ts +8 -0
- package/dist/web/types/ui/components/fileManagement/AnimatedButton.d.ts +15 -0
- package/dist/web/types/ui/components/fileManagement/FileDetailsModal.d.ts +14 -0
- package/dist/web/types/ui/components/fileManagement/FileViewer.d.ts +17 -0
- package/dist/web/types/ui/components/fileManagement/UploadPreview.d.ts +20 -0
- package/dist/web/types/ui/components/fileManagement/styles.d.ts +859 -0
- package/dist/web/types/ui/components/icon/FAIRWalletIcon.d.ts +8 -0
- package/dist/web/types/ui/components/icon/OxyIcon.d.ts +9 -0
- package/dist/web/types/ui/components/icon/index.d.ts +3 -0
- package/dist/web/types/ui/components/index.d.ts +16 -0
- package/dist/web/types/ui/components/internal/GroupedPillButtons.d.ts +17 -0
- package/dist/web/types/ui/components/internal/PinInput.d.ts +22 -0
- package/dist/web/types/ui/components/modals/DeleteAccountModal.d.ts +18 -0
- package/dist/web/types/ui/components/modals/index.d.ts +1 -0
- package/dist/web/types/ui/components/payment/PaymentDetailsStep.d.ts +20 -0
- package/dist/web/types/ui/components/payment/PaymentMethodStep.d.ts +13 -0
- package/dist/web/types/ui/components/payment/PaymentReviewStep.d.ts +15 -0
- package/dist/web/types/ui/components/payment/PaymentSuccessStep.d.ts +9 -0
- package/dist/web/types/ui/components/payment/PaymentSummaryStep.d.ts +14 -0
- package/dist/web/types/ui/components/payment/constants.d.ts +6 -0
- package/dist/web/types/ui/components/payment/index.d.ts +8 -0
- package/dist/web/types/ui/components/payment/paymentStyles.d.ts +395 -0
- package/dist/web/types/ui/components/payment/types.d.ts +39 -0
- package/dist/web/types/ui/components/photogrid/JustifiedPhotoGrid.d.ts +26 -0
- package/dist/web/types/ui/components/styles/overlay.d.ts +3 -0
- package/dist/web/types/ui/components/styles/shadow.d.ts +2 -0
- package/dist/web/types/ui/components/theming.d.ts +7 -0
- package/dist/web/types/ui/components/types.d.ts +79 -0
- package/dist/web/types/ui/components/utils/forwardRef.d.ts +11 -0
- package/dist/web/types/ui/components/utils/hasTouchHandler.d.ts +5 -0
- package/dist/web/types/ui/components/utils/roundLayoutSize.d.ts +1 -0
- package/dist/web/types/ui/components/utils/splitStyles.d.ts +19 -0
- package/dist/web/types/ui/constants/iconColors.d.ts +129 -0
- package/dist/web/types/ui/constants/spacing.d.ts +32 -0
- package/dist/web/types/ui/constants/theme.d.ts +96 -0
- package/dist/web/types/ui/context/OxyContext.d.ts +74 -0
- package/dist/web/types/ui/context/ThemeContext.d.ts +18 -0
- package/dist/web/types/ui/context/hooks/useAuthOperations.d.ts +39 -0
- package/dist/web/types/ui/context/hooks/useDeviceManagement.d.ts +26 -0
- package/dist/web/types/ui/context/hooks/useLanguageManagement.d.ts +24 -0
- package/dist/web/types/ui/context/hooks/useSessionManagement.d.ts +40 -0
- package/dist/web/types/ui/hooks/index.d.ts +6 -0
- package/dist/web/types/ui/hooks/mutations/index.d.ts +8 -0
- package/dist/web/types/ui/hooks/mutations/mutationFactory.d.ts +75 -0
- package/dist/web/types/ui/hooks/mutations/useAccountMutations.d.ts +68 -0
- package/dist/web/types/ui/hooks/mutations/useServicesMutations.d.ts +22 -0
- package/dist/web/types/ui/hooks/queries/index.d.ts +10 -0
- package/dist/web/types/ui/hooks/queries/queryKeys.d.ts +64 -0
- package/dist/web/types/ui/hooks/queries/useAccountQueries.d.ts +42 -0
- package/dist/web/types/ui/hooks/queries/useSecurityQueries.d.ts +14 -0
- package/dist/web/types/ui/hooks/queries/useServicesQueries.d.ts +31 -0
- package/dist/web/types/ui/hooks/queryClient.d.ts +18 -0
- package/dist/web/types/ui/hooks/useAssets.d.ts +34 -0
- package/dist/web/types/ui/hooks/useAsyncAction.d.ts +50 -0
- package/dist/web/types/ui/hooks/useAuth.d.ts +73 -0
- package/dist/web/types/ui/hooks/useColorScheme.d.ts +7 -0
- package/dist/web/types/ui/hooks/useDeviceManagement.d.ts +26 -0
- package/dist/web/types/ui/hooks/useFileDownloadUrl.d.ts +18 -0
- package/dist/web/types/ui/hooks/useFileFiltering.d.ts +28 -0
- package/dist/web/types/ui/hooks/useFollow.d.ts +61 -0
- package/dist/web/types/ui/hooks/useFollow.types.d.ts +32 -0
- package/dist/web/types/ui/hooks/useI18n.d.ts +4 -0
- package/dist/web/types/ui/hooks/useLanguageManagement.d.ts +24 -0
- package/dist/web/types/ui/hooks/useProfileEditing.d.ts +35 -0
- package/dist/web/types/ui/hooks/useQueryClient.d.ts +6 -0
- package/dist/web/types/ui/hooks/useSessionManagement.d.ts +40 -0
- package/dist/web/types/ui/hooks/useSessionSocket.d.ts +13 -0
- package/dist/web/types/ui/hooks/useSettingToggle.d.ts +56 -0
- package/dist/web/types/ui/hooks/useStorage.d.ts +15 -0
- package/dist/web/types/ui/hooks/useThemeColors.d.ts +93 -0
- package/dist/web/types/ui/hooks/useThemeStyles.d.ts +44 -0
- package/dist/web/types/ui/hooks/useWebSSO.d.ts +57 -0
- package/dist/web/types/ui/index.d.ts +7 -0
- package/dist/web/types/ui/isFrontend.d.ts +2 -0
- package/dist/web/types/ui/navigation/bottomSheetManager.d.ts +26 -0
- package/dist/web/types/ui/navigation/routes.d.ts +5 -0
- package/dist/web/types/ui/screens/AccountCenterScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/AccountOverviewScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/AccountSettingsScreen.d.ts +7 -0
- package/dist/web/types/ui/screens/AccountSwitcherScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/AccountVerificationScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/AppInfoScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/EditProfileFieldScreen.d.ts +12 -0
- package/dist/web/types/ui/screens/FAQScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/FeedbackScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/FileManagementScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/FollowersListScreen.d.ts +8 -0
- package/dist/web/types/ui/screens/FollowingListScreen.d.ts +8 -0
- package/dist/web/types/ui/screens/HelpSupportScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/HistoryViewScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/LanguageSelectorScreen.d.ts +6 -0
- package/dist/web/types/ui/screens/LearnMoreUsernamesScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/LegalDocumentsScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/OxyAuthScreen.d.ts +16 -0
- package/dist/web/types/ui/screens/PaymentGatewayScreen.d.ts +14 -0
- package/dist/web/types/ui/screens/PremiumSubscriptionScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/PrivacySettingsScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/ProfileScreen.d.ts +8 -0
- package/dist/web/types/ui/screens/SavesCollectionsScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/SearchSettingsScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/SessionManagementScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/UserLinksScreen.d.ts +14 -0
- package/dist/web/types/ui/screens/UserListScreen.d.ts +10 -0
- package/dist/web/types/ui/screens/WelcomeNewUserScreen.d.ts +12 -0
- package/dist/web/types/ui/screens/karma/KarmaAboutScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/karma/KarmaCenterScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/karma/KarmaFAQScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/karma/KarmaLeaderboardScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/karma/KarmaRewardsScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/karma/KarmaRulesScreen.d.ts +4 -0
- package/dist/web/types/ui/server.d.ts +42 -0
- package/dist/web/types/ui/stores/accountStore.d.ts +33 -0
- package/dist/web/types/ui/stores/assetStore.d.ts +53 -0
- package/dist/web/types/ui/stores/authStore.d.ts +16 -0
- package/dist/web/types/ui/stores/fileStore.d.ts +30 -0
- package/dist/web/types/ui/stores/followStore.d.ts +24 -0
- package/dist/web/types/ui/styles/authStyles.d.ts +331 -0
- package/dist/web/types/ui/styles/fonts.d.ts +20 -0
- package/dist/web/types/ui/styles/index.d.ts +4 -0
- package/dist/web/types/ui/styles/spacing.d.ts +48 -0
- package/dist/web/types/ui/styles/theme.d.ts +67 -0
- package/dist/web/types/ui/types/fileManagement.d.ts +40 -0
- package/dist/web/types/ui/types/navigation.d.ts +36 -0
- package/dist/web/types/ui/utils/authHelpers.d.ts +98 -0
- package/dist/web/types/ui/utils/avatarUtils.d.ts +33 -0
- package/dist/web/types/ui/utils/colorUtils.d.ts +9 -0
- package/dist/web/types/ui/utils/confirmAction.d.ts +6 -0
- package/dist/web/types/ui/utils/errorHandlers.d.ts +34 -0
- package/dist/web/types/ui/utils/fileManagement.d.ts +86 -0
- package/dist/web/types/ui/utils/iconNames.d.ts +111 -0
- package/dist/web/types/ui/utils/sessionHelpers.d.ts +63 -0
- package/dist/web/types/ui/utils/storageHelpers.d.ts +27 -0
- package/dist/web/types/ui/utils/themeUtils.d.ts +10 -0
- package/dist/web/types/ui/utils/userUtils.d.ts +28 -0
- package/dist/web/types/utils/apiUtils.d.ts +53 -0
- package/dist/web/types/utils/asyncUtils.d.ts +58 -0
- package/dist/web/types/utils/cache.d.ts +127 -0
- package/dist/web/types/utils/deviceManager.d.ts +65 -0
- package/dist/web/types/utils/errorUtils.d.ts +46 -0
- package/dist/web/types/utils/hookUtils.d.ts +101 -0
- package/dist/web/types/utils/index.d.ts +6 -0
- package/dist/web/types/utils/languageUtils.d.ts +37 -0
- package/dist/web/types/utils/loggerUtils.d.ts +48 -0
- package/dist/web/types/utils/platform.d.ts +40 -0
- package/dist/web/types/utils/platformInit.d.ts +8 -0
- package/dist/web/types/utils/requestUtils.d.ts +123 -0
- package/dist/web/types/utils/sessionUtils.d.ts +54 -0
- package/dist/web/types/utils/validationUtils.d.ts +85 -0
- package/dist/web/types/web/WebOxyContext.d.ts +151 -0
- package/dist/web/types/web/index.d.ts +52 -0
- package/dist/web/types/web.d.ts +53 -0
- package/package.json +20 -6
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User display name and date formatting utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Formats a date string to a readable format (e.g., "Feb 21, 2025")
|
|
6
|
+
*/
|
|
7
|
+
export declare const formatDate: (dateString: string | undefined | null | Date) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Gets a display name from user data
|
|
10
|
+
*/
|
|
11
|
+
export declare const getDisplayName: (user: {
|
|
12
|
+
name?: {
|
|
13
|
+
full?: string;
|
|
14
|
+
first?: string;
|
|
15
|
+
last?: string;
|
|
16
|
+
};
|
|
17
|
+
username?: string;
|
|
18
|
+
} | null | undefined) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Gets a short display name (first name or username)
|
|
21
|
+
*/
|
|
22
|
+
export declare const getShortDisplayName: (user: {
|
|
23
|
+
name?: {
|
|
24
|
+
first?: string;
|
|
25
|
+
full?: string;
|
|
26
|
+
};
|
|
27
|
+
username?: string;
|
|
28
|
+
} | null | undefined) => string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for common API patterns
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Build URL search parameters from an object
|
|
6
|
+
* @param params Object with parameter key-value pairs
|
|
7
|
+
* @returns URLSearchParams instance
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildSearchParams(params: Record<string, any>): URLSearchParams;
|
|
10
|
+
/**
|
|
11
|
+
* Build URL with search parameters
|
|
12
|
+
* @param baseUrl Base URL
|
|
13
|
+
* @param params Object with parameter key-value pairs
|
|
14
|
+
* @returns Complete URL with search parameters
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildUrl(baseUrl: string, params?: Record<string, any>): string;
|
|
17
|
+
/**
|
|
18
|
+
* Common pagination parameters
|
|
19
|
+
*/
|
|
20
|
+
export interface PaginationParams {
|
|
21
|
+
limit?: number;
|
|
22
|
+
offset?: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build pagination search parameters
|
|
26
|
+
* @param params Pagination parameters
|
|
27
|
+
* @returns URLSearchParams with pagination
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildPaginationParams(params: PaginationParams): URLSearchParams;
|
|
30
|
+
/**
|
|
31
|
+
* Common API response wrapper
|
|
32
|
+
*/
|
|
33
|
+
export interface ApiResponse<T = any> {
|
|
34
|
+
data: T;
|
|
35
|
+
message?: string;
|
|
36
|
+
success?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Common error response wrapper
|
|
40
|
+
*/
|
|
41
|
+
export interface ErrorResponse {
|
|
42
|
+
message: string;
|
|
43
|
+
code: string;
|
|
44
|
+
status: number;
|
|
45
|
+
details?: any;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Safe JSON parsing with error handling
|
|
49
|
+
* @param data Data to parse
|
|
50
|
+
* @param fallback Fallback value if parsing fails
|
|
51
|
+
* @returns Parsed data or fallback
|
|
52
|
+
*/
|
|
53
|
+
export declare function safeJsonParse<T>(data: any, fallback: T): T;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Async utilities for common asynchronous patterns and error handling
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Wrapper for async operations with automatic error handling
|
|
6
|
+
* Returns null on error instead of throwing
|
|
7
|
+
*/
|
|
8
|
+
export declare function withErrorHandling<T>(operation: () => Promise<T>, errorHandler?: (error: any) => void, context?: string): Promise<T | null>;
|
|
9
|
+
/**
|
|
10
|
+
* Execute multiple async operations in parallel with error handling
|
|
11
|
+
*/
|
|
12
|
+
export declare function parallelWithErrorHandling<T>(operations: (() => Promise<T>)[], errorHandler?: (error: any, index: number) => void): Promise<(T | null)[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Retry an async operation with exponential backoff
|
|
15
|
+
*
|
|
16
|
+
* By default, does not retry on 4xx errors (client errors).
|
|
17
|
+
* Use shouldRetry callback to customize retry behavior.
|
|
18
|
+
*/
|
|
19
|
+
export declare function retryAsync<T>(operation: () => Promise<T>, maxRetries?: number, baseDelay?: number, shouldRetry?: (error: any) => boolean): Promise<T>;
|
|
20
|
+
/**
|
|
21
|
+
* Debounce async function calls
|
|
22
|
+
*/
|
|
23
|
+
export declare function debounceAsync<T extends (...args: any[]) => Promise<any>>(func: T, delay: number): (...args: Parameters<T>) => Promise<ReturnType<T>>;
|
|
24
|
+
/**
|
|
25
|
+
* Throttle async function calls
|
|
26
|
+
*/
|
|
27
|
+
export declare function throttleAsync<T extends (...args: any[]) => Promise<any>>(func: T, limit: number, interval: number): (...args: Parameters<T>) => Promise<ReturnType<T>>;
|
|
28
|
+
/**
|
|
29
|
+
* Execute async operations sequentially with progress tracking
|
|
30
|
+
*/
|
|
31
|
+
export declare function sequentialWithProgress<T>(operations: (() => Promise<T>)[], onProgress?: (completed: number, total: number) => void): Promise<T[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Batch async operations
|
|
34
|
+
*/
|
|
35
|
+
export declare function batchAsync<T>(items: T[], batchSize: number, processor: (batch: T[]) => Promise<void>): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Create a cancellable async operation
|
|
38
|
+
*/
|
|
39
|
+
export declare function createCancellableAsync<T>(operation: (signal: AbortSignal) => Promise<T>): {
|
|
40
|
+
execute: () => Promise<T>;
|
|
41
|
+
cancel: () => void;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Timeout wrapper for async operations
|
|
45
|
+
*/
|
|
46
|
+
export declare function withTimeout<T>(operation: Promise<T>, timeoutMs: number, timeoutMessage?: string): Promise<T>;
|
|
47
|
+
/**
|
|
48
|
+
* Execute async operation with loading state
|
|
49
|
+
*/
|
|
50
|
+
export declare function withLoadingState<T>(operation: () => Promise<T>, setLoading: (loading: boolean) => void): Promise<T>;
|
|
51
|
+
/**
|
|
52
|
+
* Create a promise that resolves after a delay
|
|
53
|
+
*/
|
|
54
|
+
export declare const delay: (ms: number) => Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Execute async operation with retry on specific errors
|
|
57
|
+
*/
|
|
58
|
+
export declare function retryOnError<T>(operation: () => Promise<T>, retryableErrors: (string | number)[], maxRetries?: number): Promise<T>;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized cache utility with TTL support
|
|
3
|
+
*
|
|
4
|
+
* This is a production-ready cache implementation used across the codebase
|
|
5
|
+
* for consistent caching behavior and performance optimization.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Cache statistics
|
|
9
|
+
*/
|
|
10
|
+
export interface CacheStats {
|
|
11
|
+
size: number;
|
|
12
|
+
hits: number;
|
|
13
|
+
misses: number;
|
|
14
|
+
hitRate: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* TTL-based cache implementation
|
|
18
|
+
*
|
|
19
|
+
* Features:
|
|
20
|
+
* - Automatic expiration based on TTL
|
|
21
|
+
* - Manual cleanup of expired entries
|
|
22
|
+
* - Statistics tracking (hits, misses, hit rate)
|
|
23
|
+
* - Type-safe generic interface
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const cache = new TTLCache<string>(5 * 60 * 1000); // 5 minutes
|
|
28
|
+
*
|
|
29
|
+
* // Set with default TTL
|
|
30
|
+
* cache.set('key', 'value');
|
|
31
|
+
*
|
|
32
|
+
* // Set with custom TTL
|
|
33
|
+
* cache.set('key', 'value', 10 * 60 * 1000); // 10 minutes
|
|
34
|
+
*
|
|
35
|
+
* // Get value
|
|
36
|
+
* const value = cache.get('key');
|
|
37
|
+
*
|
|
38
|
+
* // Get statistics
|
|
39
|
+
* const stats = cache.getStats();
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare class TTLCache<T> {
|
|
43
|
+
private cache;
|
|
44
|
+
private defaultTTL;
|
|
45
|
+
private hits;
|
|
46
|
+
private misses;
|
|
47
|
+
/**
|
|
48
|
+
* Create a new TTL cache
|
|
49
|
+
* @param defaultTTL Default TTL in milliseconds (default: 5 minutes)
|
|
50
|
+
*/
|
|
51
|
+
constructor(defaultTTL?: number);
|
|
52
|
+
/**
|
|
53
|
+
* Get a value from cache
|
|
54
|
+
* @param key Cache key
|
|
55
|
+
* @returns Cached value or null if not found or expired
|
|
56
|
+
*/
|
|
57
|
+
get(key: string): T | null;
|
|
58
|
+
/**
|
|
59
|
+
* Set a value in cache
|
|
60
|
+
* @param key Cache key
|
|
61
|
+
* @param data Data to cache
|
|
62
|
+
* @param ttl Optional TTL override (uses default if not provided)
|
|
63
|
+
*/
|
|
64
|
+
set(key: string, data: T, ttl?: number): void;
|
|
65
|
+
/**
|
|
66
|
+
* Delete a specific cache entry
|
|
67
|
+
* @param key Cache key
|
|
68
|
+
* @returns true if entry was deleted, false if not found
|
|
69
|
+
*/
|
|
70
|
+
delete(key: string): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Clear all cache entries
|
|
73
|
+
*/
|
|
74
|
+
clear(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Check if a key exists and is not expired
|
|
77
|
+
* @param key Cache key
|
|
78
|
+
* @returns true if key exists and is valid
|
|
79
|
+
*/
|
|
80
|
+
has(key: string): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Get all valid cache keys
|
|
83
|
+
* @returns Array of valid cache keys
|
|
84
|
+
*/
|
|
85
|
+
keys(): string[];
|
|
86
|
+
/**
|
|
87
|
+
* Clean up expired entries
|
|
88
|
+
* @returns Number of entries removed
|
|
89
|
+
*/
|
|
90
|
+
cleanup(): number;
|
|
91
|
+
/**
|
|
92
|
+
* Get cache size (number of entries)
|
|
93
|
+
*/
|
|
94
|
+
size(): number;
|
|
95
|
+
/**
|
|
96
|
+
* Get cache statistics
|
|
97
|
+
*/
|
|
98
|
+
getStats(): CacheStats;
|
|
99
|
+
/**
|
|
100
|
+
* Reset statistics (keeps cache entries)
|
|
101
|
+
*/
|
|
102
|
+
resetStats(): void;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Create a TTL cache instance (convenience function)
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const cache = createCache<string>(5 * 60 * 1000);
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export declare function createCache<T>(ttl?: number): TTLCache<T>;
|
|
113
|
+
/**
|
|
114
|
+
* Register a cache for automatic cleanup
|
|
115
|
+
* @param cache Cache instance to register
|
|
116
|
+
*/
|
|
117
|
+
export declare function registerCacheForCleanup(cache: TTLCache<any>): void;
|
|
118
|
+
/**
|
|
119
|
+
* Unregister a cache from automatic cleanup
|
|
120
|
+
* @param cache Cache instance to unregister
|
|
121
|
+
*/
|
|
122
|
+
export declare function unregisterCacheFromCleanup(cache: TTLCache<any>): void;
|
|
123
|
+
/**
|
|
124
|
+
* Stop all cleanup intervals (useful for testing)
|
|
125
|
+
* This will clear the interval and unregister all caches
|
|
126
|
+
*/
|
|
127
|
+
export declare function stopAllCleanupIntervals(): void;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface DeviceFingerprint {
|
|
2
|
+
userAgent: string;
|
|
3
|
+
platform: string;
|
|
4
|
+
language?: string;
|
|
5
|
+
timezone?: string;
|
|
6
|
+
screen?: {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
colorDepth: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface StoredDeviceInfo {
|
|
13
|
+
deviceId: string;
|
|
14
|
+
deviceName?: string;
|
|
15
|
+
fingerprint?: string;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
lastUsed: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Client-side device management utility
|
|
21
|
+
* Handles persistent device identification across app sessions
|
|
22
|
+
*/
|
|
23
|
+
export declare class DeviceManager {
|
|
24
|
+
private static DEVICE_KEY;
|
|
25
|
+
/**
|
|
26
|
+
* Check if we're in React Native environment
|
|
27
|
+
*/
|
|
28
|
+
private static isReactNative;
|
|
29
|
+
/**
|
|
30
|
+
* Get appropriate storage for the platform
|
|
31
|
+
*/
|
|
32
|
+
private static getStorage;
|
|
33
|
+
/**
|
|
34
|
+
* Get or create device fingerprint for current device
|
|
35
|
+
*/
|
|
36
|
+
static getDeviceFingerprint(): DeviceFingerprint;
|
|
37
|
+
/**
|
|
38
|
+
* Get stored device info or create new one
|
|
39
|
+
*/
|
|
40
|
+
static getDeviceInfo(): Promise<StoredDeviceInfo>;
|
|
41
|
+
/**
|
|
42
|
+
* Create new device info and store it
|
|
43
|
+
*/
|
|
44
|
+
static createNewDeviceInfo(): Promise<StoredDeviceInfo>;
|
|
45
|
+
/**
|
|
46
|
+
* Save device info to storage
|
|
47
|
+
*/
|
|
48
|
+
static saveDeviceInfo(deviceInfo: StoredDeviceInfo): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Update device name
|
|
51
|
+
*/
|
|
52
|
+
static updateDeviceName(deviceName: string): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Clear stored device info (useful for testing or reset)
|
|
55
|
+
*/
|
|
56
|
+
static clearDeviceInfo(): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Generate a unique device ID
|
|
59
|
+
*/
|
|
60
|
+
private static generateDeviceId;
|
|
61
|
+
/**
|
|
62
|
+
* Get a user-friendly device name based on platform
|
|
63
|
+
*/
|
|
64
|
+
static getDefaultDeviceName(): string;
|
|
65
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ApiError } from '../models/interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* Error handling utilities for consistent error processing
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Common error codes
|
|
7
|
+
*/
|
|
8
|
+
export declare const ErrorCodes: {
|
|
9
|
+
readonly UNAUTHORIZED: "UNAUTHORIZED";
|
|
10
|
+
readonly FORBIDDEN: "FORBIDDEN";
|
|
11
|
+
readonly INVALID_TOKEN: "INVALID_TOKEN";
|
|
12
|
+
readonly MISSING_TOKEN: "MISSING_TOKEN";
|
|
13
|
+
readonly VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
14
|
+
readonly BAD_REQUEST: "BAD_REQUEST";
|
|
15
|
+
readonly MISSING_PARAMETER: "MISSING_PARAMETER";
|
|
16
|
+
readonly INVALID_FORMAT: "INVALID_FORMAT";
|
|
17
|
+
readonly NOT_FOUND: "NOT_FOUND";
|
|
18
|
+
readonly ALREADY_EXISTS: "ALREADY_EXISTS";
|
|
19
|
+
readonly CONFLICT: "CONFLICT";
|
|
20
|
+
readonly INTERNAL_ERROR: "INTERNAL_ERROR";
|
|
21
|
+
readonly SERVICE_UNAVAILABLE: "SERVICE_UNAVAILABLE";
|
|
22
|
+
readonly TIMEOUT: "TIMEOUT";
|
|
23
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
24
|
+
readonly CONNECTION_FAILED: "CONNECTION_FAILED";
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Create a standardized API error
|
|
28
|
+
*/
|
|
29
|
+
export declare function createApiError(message: string, code?: string, status?: number, details?: Record<string, unknown>): ApiError;
|
|
30
|
+
/**
|
|
31
|
+
* Handle common HTTP errors and convert to ApiError
|
|
32
|
+
*/
|
|
33
|
+
export declare function handleHttpError(error: unknown): ApiError;
|
|
34
|
+
/**
|
|
35
|
+
* Get error code from HTTP status
|
|
36
|
+
* Exported for use in other modules
|
|
37
|
+
*/
|
|
38
|
+
export declare function getErrorCodeFromStatus(status: number): string;
|
|
39
|
+
/**
|
|
40
|
+
* Validate required fields and throw error if missing
|
|
41
|
+
*/
|
|
42
|
+
export declare function validateRequiredFields(data: Record<string, unknown>, fields: string[]): void;
|
|
43
|
+
/**
|
|
44
|
+
* Safe error logging with context
|
|
45
|
+
*/
|
|
46
|
+
export declare function logError(error: unknown, context?: string): void;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React hook utilities for common patterns and state management
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Hook for managing async operations with loading, error, and data states
|
|
6
|
+
*/
|
|
7
|
+
export declare function useAsync<T>(asyncFn: () => Promise<T>, deps?: React.DependencyList): {
|
|
8
|
+
data: T | null;
|
|
9
|
+
loading: boolean;
|
|
10
|
+
error: Error | null;
|
|
11
|
+
execute: () => Promise<T>;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Hook for managing async operations that execute on mount
|
|
15
|
+
*/
|
|
16
|
+
export declare function useAsyncEffect<T>(asyncFn: () => Promise<T>, deps?: React.DependencyList): {
|
|
17
|
+
data: T | null;
|
|
18
|
+
loading: boolean;
|
|
19
|
+
error: Error | null;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Hook for debounced values
|
|
23
|
+
*/
|
|
24
|
+
export declare function useDebounce<T>(value: T, delay: number): T;
|
|
25
|
+
/**
|
|
26
|
+
* Hook for throttled values
|
|
27
|
+
*/
|
|
28
|
+
export declare function useThrottle<T>(value: T, delay: number): T;
|
|
29
|
+
/**
|
|
30
|
+
* Hook for previous value
|
|
31
|
+
*/
|
|
32
|
+
export declare function usePrevious<T>(value: T): T | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Hook for boolean state with toggle
|
|
35
|
+
*/
|
|
36
|
+
export declare function useToggle(initialValue?: boolean): {
|
|
37
|
+
value: boolean;
|
|
38
|
+
toggle: () => void;
|
|
39
|
+
setTrue: () => void;
|
|
40
|
+
setFalse: () => void;
|
|
41
|
+
setValue: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Hook for counter state
|
|
45
|
+
*/
|
|
46
|
+
export declare function useCounter(initialValue?: number): {
|
|
47
|
+
count: number;
|
|
48
|
+
increment: () => void;
|
|
49
|
+
decrement: () => void;
|
|
50
|
+
reset: () => void;
|
|
51
|
+
setValue: (value: number) => void;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Hook for local storage (platform-safe)
|
|
55
|
+
*/
|
|
56
|
+
export declare function useLocalStorage<T>(key: string, initialValue: T): readonly [T, (value: T | ((val: T) => T)) => void];
|
|
57
|
+
/**
|
|
58
|
+
* Hook for session storage (platform-safe)
|
|
59
|
+
*/
|
|
60
|
+
export declare function useSessionStorage<T>(key: string, initialValue: T): readonly [T, (value: T | ((val: T) => T)) => void];
|
|
61
|
+
/**
|
|
62
|
+
* Hook for window size (platform-safe)
|
|
63
|
+
*/
|
|
64
|
+
export declare function useWindowSize(): {
|
|
65
|
+
width: number;
|
|
66
|
+
height: number;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Hook for scroll position (platform-safe)
|
|
70
|
+
*/
|
|
71
|
+
export declare function useScrollPosition(): number;
|
|
72
|
+
/**
|
|
73
|
+
* Hook for online/offline status (platform-safe)
|
|
74
|
+
*/
|
|
75
|
+
export declare function useOnlineStatus(): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Hook for media queries (platform-safe)
|
|
78
|
+
*/
|
|
79
|
+
export declare function useMediaQuery(query: string): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Hook for keyboard events (platform-safe)
|
|
82
|
+
*/
|
|
83
|
+
export declare function useKeyPress(targetKey: string): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Hook for click outside detection (platform-safe)
|
|
86
|
+
*/
|
|
87
|
+
export declare function useClickOutside(ref: React.RefObject<HTMLElement>, handler: () => void): void;
|
|
88
|
+
/**
|
|
89
|
+
* Hook for form validation
|
|
90
|
+
*/
|
|
91
|
+
export declare function useFormValidation<T extends Record<string, unknown>>(initialValues: T, validationSchema: (values: T) => Partial<Record<keyof T, string>>): {
|
|
92
|
+
values: T;
|
|
93
|
+
errors: Partial<Record<keyof T, string>>;
|
|
94
|
+
touched: Partial<Record<keyof T, boolean>>;
|
|
95
|
+
isValid: boolean;
|
|
96
|
+
setValue: (field: keyof T, value: T[keyof T]) => void;
|
|
97
|
+
setTouchedField: (field: keyof T) => void;
|
|
98
|
+
setValues: import("react").Dispatch<import("react").SetStateAction<T>>;
|
|
99
|
+
setErrors: import("react").Dispatch<import("react").SetStateAction<Partial<Record<keyof T, string>>>>;
|
|
100
|
+
setTouched: import("react").Dispatch<import("react").SetStateAction<Partial<Record<keyof T, boolean>>>>;
|
|
101
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { DeviceManager } from './deviceManager';
|
|
2
|
+
export type { DeviceFingerprint, StoredDeviceInfo } from './deviceManager';
|
|
3
|
+
export { RequestDeduplicator, RequestQueue, SimpleLogger } from './requestUtils';
|
|
4
|
+
export { TTLCache, createCache, registerCacheForCleanup, unregisterCacheFromCleanup } from './cache';
|
|
5
|
+
export type { CacheStats } from './cache';
|
|
6
|
+
export { normalizeSession, sortSessions, deduplicateSessions, deduplicateSessionsByUserId, normalizeAndSortSessions, mergeSessions, sessionsEqual, sessionsArraysEqual } from './sessionUtils';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Language utilities for OxyServices
|
|
3
|
+
* Provides access to supported languages and language metadata
|
|
4
|
+
*/
|
|
5
|
+
export interface LanguageMetadata {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
nativeName: string;
|
|
9
|
+
flag: string;
|
|
10
|
+
icon: string;
|
|
11
|
+
color: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const SUPPORTED_LANGUAGES: LanguageMetadata[];
|
|
14
|
+
/**
|
|
15
|
+
* Get language metadata by language code
|
|
16
|
+
* @param languageCode - BCP-47 language code (e.g., 'en-US', 'es-ES')
|
|
17
|
+
* @returns Language metadata or null if not found
|
|
18
|
+
*/
|
|
19
|
+
export declare function getLanguageMetadata(languageCode: string | null | undefined): LanguageMetadata | null;
|
|
20
|
+
/**
|
|
21
|
+
* Get language name by language code
|
|
22
|
+
* @param languageCode - BCP-47 language code (e.g., 'en-US', 'es-ES')
|
|
23
|
+
* @returns Language name (e.g., 'English') or the code if not found
|
|
24
|
+
*/
|
|
25
|
+
export declare function getLanguageName(languageCode: string | null | undefined): string;
|
|
26
|
+
/**
|
|
27
|
+
* Get native language name by language code
|
|
28
|
+
* @param languageCode - BCP-47 language code (e.g., 'en-US', 'es-ES')
|
|
29
|
+
* @returns Native language name (e.g., 'Español') or the code if not found
|
|
30
|
+
*/
|
|
31
|
+
export declare function getNativeLanguageName(languageCode: string | null | undefined): string;
|
|
32
|
+
/**
|
|
33
|
+
* Normalize language code to BCP-47 format
|
|
34
|
+
* @param lang - Language code (may be short like 'en' or full like 'en-US')
|
|
35
|
+
* @returns Normalized BCP-47 language code
|
|
36
|
+
*/
|
|
37
|
+
export declare function normalizeLanguageCode(lang?: string | null): string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized logging utilities for consistent logging across the application
|
|
3
|
+
*/
|
|
4
|
+
export declare enum LogLevel {
|
|
5
|
+
DEBUG = 0,
|
|
6
|
+
INFO = 1,
|
|
7
|
+
WARN = 2,
|
|
8
|
+
ERROR = 3,
|
|
9
|
+
NONE = 4
|
|
10
|
+
}
|
|
11
|
+
export interface LogContext {
|
|
12
|
+
component?: string;
|
|
13
|
+
method?: string;
|
|
14
|
+
userId?: string;
|
|
15
|
+
sessionId?: string;
|
|
16
|
+
requestId?: string;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
19
|
+
declare class Logger {
|
|
20
|
+
private level;
|
|
21
|
+
private isDevelopment;
|
|
22
|
+
setLevel(level: LogLevel): void;
|
|
23
|
+
private shouldLog;
|
|
24
|
+
private formatMessage;
|
|
25
|
+
debug(message: string, context?: LogContext, ...args: unknown[]): void;
|
|
26
|
+
info(message: string, context?: LogContext, ...args: unknown[]): void;
|
|
27
|
+
warn(message: string, context?: LogContext, ...args: unknown[]): void;
|
|
28
|
+
error(message: string, error?: Error | unknown, context?: LogContext, ...args: unknown[]): void;
|
|
29
|
+
auth(message: string, context?: LogContext, ...args: unknown[]): void;
|
|
30
|
+
api(message: string, context?: LogContext, ...args: unknown[]): void;
|
|
31
|
+
session(message: string, context?: LogContext, ...args: unknown[]): void;
|
|
32
|
+
user(message: string, context?: LogContext, ...args: unknown[]): void;
|
|
33
|
+
device(message: string, context?: LogContext, ...args: unknown[]): void;
|
|
34
|
+
payment(message: string, context?: LogContext, ...args: unknown[]): void;
|
|
35
|
+
performance(operation: string, duration: number, context?: LogContext): void;
|
|
36
|
+
errorWithStack(message: string, error: Error, context?: LogContext): void;
|
|
37
|
+
group(label: string, fn: () => void): void;
|
|
38
|
+
}
|
|
39
|
+
export declare const logger: Logger;
|
|
40
|
+
export declare const logAuth: (message: string, context?: LogContext, ...args: unknown[]) => void;
|
|
41
|
+
export declare const logApi: (message: string, context?: LogContext, ...args: unknown[]) => void;
|
|
42
|
+
export declare const logSession: (message: string, context?: LogContext, ...args: unknown[]) => void;
|
|
43
|
+
export declare const logUser: (message: string, context?: LogContext, ...args: unknown[]) => void;
|
|
44
|
+
export declare const logDevice: (message: string, context?: LogContext, ...args: unknown[]) => void;
|
|
45
|
+
export declare const logPayment: (message: string, context?: LogContext, ...args: unknown[]) => void;
|
|
46
|
+
export declare const logError: (message: string, error?: Error | unknown, context?: LogContext, ...args: unknown[]) => void;
|
|
47
|
+
export declare const logPerformance: (operation: string, duration: number, context?: LogContext) => void;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform Detection Utility
|
|
3
|
+
*
|
|
4
|
+
* Provides platform detection WITHOUT importing from 'react-native'.
|
|
5
|
+
* This allows core modules to be used in web/Node.js environments
|
|
6
|
+
* without bundlers failing on react-native imports.
|
|
7
|
+
*/
|
|
8
|
+
export type PlatformOS = 'ios' | 'android' | 'web' | 'windows' | 'macos' | 'unknown';
|
|
9
|
+
/**
|
|
10
|
+
* Get the current platform OS
|
|
11
|
+
* Safe to call from any environment (web, Node.js, React Native)
|
|
12
|
+
*/
|
|
13
|
+
export declare function getPlatformOS(): PlatformOS;
|
|
14
|
+
/**
|
|
15
|
+
* Check if running on web platform (browser or Node.js)
|
|
16
|
+
*/
|
|
17
|
+
export declare function isWeb(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Check if running in a native app (iOS or Android)
|
|
20
|
+
*/
|
|
21
|
+
export declare function isNative(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Check if running on iOS
|
|
24
|
+
*/
|
|
25
|
+
export declare function isIOS(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Check if running on Android
|
|
28
|
+
*/
|
|
29
|
+
export declare function isAndroid(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Set the platform OS explicitly
|
|
32
|
+
* Called by React Native entry point to register the platform
|
|
33
|
+
* This allows lazy detection in environments where react-native is available
|
|
34
|
+
*/
|
|
35
|
+
export declare function setPlatformOS(os: PlatformOS): void;
|
|
36
|
+
/**
|
|
37
|
+
* Try to initialize platform from react-native if available
|
|
38
|
+
* This is called lazily when needed, avoiding top-level imports
|
|
39
|
+
*/
|
|
40
|
+
export declare function initPlatformFromReactNative(): Promise<void>;
|