@oxyhq/services 0.1.18 → 5.1.8

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.
Files changed (197) hide show
  1. package/README.md +17 -138
  2. package/UI_COMPONENTS.md +143 -0
  3. package/lib/commonjs/assets/OxyLogo.svg +1 -0
  4. package/lib/commonjs/assets/assets/OxyLogo.svg +1 -0
  5. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  6. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  7. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  8. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  9. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  10. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  11. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  12. package/lib/commonjs/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  13. package/lib/commonjs/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  14. package/lib/commonjs/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  15. package/lib/commonjs/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  16. package/lib/commonjs/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  17. package/lib/commonjs/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  18. package/lib/commonjs/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  19. package/lib/commonjs/core/index.js +783 -0
  20. package/lib/commonjs/core/index.js.map +1 -0
  21. package/lib/commonjs/index.js +137 -0
  22. package/lib/commonjs/index.js.map +1 -0
  23. package/lib/commonjs/models/interfaces.js +2 -0
  24. package/lib/commonjs/models/interfaces.js.map +1 -0
  25. package/lib/commonjs/package.json +1 -0
  26. package/lib/commonjs/ui/components/Avatar.js +98 -0
  27. package/lib/commonjs/ui/components/Avatar.js.map +1 -0
  28. package/lib/commonjs/ui/components/FontLoader.js +181 -0
  29. package/lib/commonjs/ui/components/FontLoader.js.map +1 -0
  30. package/lib/commonjs/ui/components/OxyLogo.js +56 -0
  31. package/lib/commonjs/ui/components/OxyLogo.js.map +1 -0
  32. package/lib/commonjs/ui/components/OxyProvider.js +464 -0
  33. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -0
  34. package/lib/commonjs/ui/components/OxySignInButton.js +178 -0
  35. package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -0
  36. package/lib/commonjs/ui/components/bottomSheet/index.js +37 -0
  37. package/lib/commonjs/ui/components/bottomSheet/index.js.map +1 -0
  38. package/lib/commonjs/ui/context/OxyContext.js +296 -0
  39. package/lib/commonjs/ui/context/OxyContext.js.map +1 -0
  40. package/lib/commonjs/ui/index.js +144 -0
  41. package/lib/commonjs/ui/index.js.map +1 -0
  42. package/lib/commonjs/ui/navigation/OxyRouter.js +145 -0
  43. package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -0
  44. package/lib/commonjs/ui/navigation/types.js +6 -0
  45. package/lib/commonjs/ui/navigation/types.js.map +1 -0
  46. package/lib/commonjs/ui/screens/AboutKarmaScreen.js +45 -0
  47. package/lib/commonjs/ui/screens/AboutKarmaScreen.js.map +1 -0
  48. package/lib/commonjs/ui/screens/AccountCenterScreen.js +280 -0
  49. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -0
  50. package/lib/commonjs/ui/screens/AccountOverviewScreen.js +566 -0
  51. package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -0
  52. package/lib/commonjs/ui/screens/SignInScreen.js +230 -0
  53. package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -0
  54. package/lib/commonjs/ui/screens/SignUpScreen.js +673 -0
  55. package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -0
  56. package/lib/commonjs/ui/styles/FONTS.md +126 -0
  57. package/lib/commonjs/ui/styles/fonts.js +84 -0
  58. package/lib/commonjs/ui/styles/fonts.js.map +1 -0
  59. package/lib/commonjs/ui/styles/index.js +28 -0
  60. package/lib/commonjs/ui/styles/index.js.map +1 -0
  61. package/lib/commonjs/ui/styles/theme.js +122 -0
  62. package/lib/commonjs/ui/styles/theme.js.map +1 -0
  63. package/lib/module/assets/OxyLogo.svg +1 -0
  64. package/lib/module/assets/assets/OxyLogo.svg +1 -0
  65. package/lib/module/assets/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  66. package/lib/module/assets/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  67. package/lib/module/assets/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  68. package/lib/module/assets/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  69. package/lib/module/assets/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  70. package/lib/module/assets/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  71. package/lib/module/assets/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  72. package/lib/module/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  73. package/lib/module/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  74. package/lib/module/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  75. package/lib/module/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  76. package/lib/module/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  77. package/lib/module/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  78. package/lib/module/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  79. package/lib/module/core/index.js +777 -0
  80. package/lib/module/core/index.js.map +1 -0
  81. package/lib/module/index.js +40 -0
  82. package/lib/module/index.js.map +1 -0
  83. package/lib/module/models/interfaces.js +2 -0
  84. package/lib/module/models/interfaces.js.map +1 -0
  85. package/lib/module/package.json +1 -0
  86. package/lib/module/ui/components/Avatar.js +93 -0
  87. package/lib/module/ui/components/Avatar.js.map +1 -0
  88. package/lib/module/ui/components/FontLoader.js +176 -0
  89. package/lib/module/ui/components/FontLoader.js.map +1 -0
  90. package/lib/module/ui/components/OxyLogo.js +49 -0
  91. package/lib/module/ui/components/OxyLogo.js.map +1 -0
  92. package/lib/module/ui/components/OxyProvider.js +458 -0
  93. package/lib/module/ui/components/OxyProvider.js.map +1 -0
  94. package/lib/module/ui/components/OxySignInButton.js +172 -0
  95. package/lib/module/ui/components/OxySignInButton.js.map +1 -0
  96. package/lib/module/ui/components/bottomSheet/index.js +8 -0
  97. package/lib/module/ui/components/bottomSheet/index.js.map +1 -0
  98. package/lib/module/ui/context/OxyContext.js +291 -0
  99. package/lib/module/ui/context/OxyContext.js.map +1 -0
  100. package/lib/module/ui/index.js +26 -0
  101. package/lib/module/ui/index.js.map +1 -0
  102. package/lib/module/ui/navigation/OxyRouter.js +138 -0
  103. package/lib/module/ui/navigation/OxyRouter.js.map +1 -0
  104. package/lib/module/ui/navigation/types.js +4 -0
  105. package/lib/module/ui/navigation/types.js.map +1 -0
  106. package/lib/module/ui/screens/AboutKarmaScreen.js +40 -0
  107. package/lib/module/ui/screens/AboutKarmaScreen.js.map +1 -0
  108. package/lib/module/ui/screens/AccountCenterScreen.js +275 -0
  109. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -0
  110. package/lib/module/ui/screens/AccountOverviewScreen.js +560 -0
  111. package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -0
  112. package/lib/module/ui/screens/SignInScreen.js +224 -0
  113. package/lib/module/ui/screens/SignInScreen.js.map +1 -0
  114. package/lib/module/ui/screens/SignUpScreen.js +668 -0
  115. package/lib/module/ui/screens/SignUpScreen.js.map +1 -0
  116. package/lib/module/ui/styles/FONTS.md +126 -0
  117. package/lib/module/ui/styles/fonts.js +81 -0
  118. package/lib/module/ui/styles/fonts.js.map +1 -0
  119. package/lib/module/ui/styles/index.js +5 -0
  120. package/lib/module/ui/styles/index.js.map +1 -0
  121. package/lib/module/ui/styles/theme.js +115 -0
  122. package/lib/module/ui/styles/theme.js.map +1 -0
  123. package/lib/typescript/core/index.d.ts +304 -0
  124. package/lib/typescript/core/index.d.ts.map +1 -0
  125. package/lib/typescript/index.d.ts +14 -0
  126. package/lib/typescript/index.d.ts.map +1 -0
  127. package/lib/typescript/models/interfaces.d.ts +98 -0
  128. package/lib/typescript/models/interfaces.d.ts.map +1 -0
  129. package/lib/typescript/ui/components/Avatar.d.ts +62 -0
  130. package/lib/typescript/ui/components/Avatar.d.ts.map +1 -0
  131. package/lib/typescript/ui/components/FontLoader.d.ts +15 -0
  132. package/lib/typescript/ui/components/FontLoader.d.ts.map +1 -0
  133. package/lib/typescript/ui/components/OxyLogo.d.ts +29 -0
  134. package/lib/typescript/ui/components/OxyLogo.d.ts.map +1 -0
  135. package/lib/typescript/ui/components/OxyProvider.d.ts +12 -0
  136. package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -0
  137. package/lib/typescript/ui/components/OxySignInButton.d.ts +65 -0
  138. package/lib/typescript/ui/components/OxySignInButton.d.ts.map +1 -0
  139. package/lib/typescript/ui/components/bottomSheet/index.d.ts +3 -0
  140. package/lib/typescript/ui/components/bottomSheet/index.d.ts.map +1 -0
  141. package/lib/typescript/ui/context/OxyContext.d.ts +26 -0
  142. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -0
  143. package/lib/typescript/ui/index.d.ts +16 -0
  144. package/lib/typescript/ui/index.d.ts.map +1 -0
  145. package/lib/typescript/ui/navigation/OxyRouter.d.ts +5 -0
  146. package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -0
  147. package/lib/typescript/ui/navigation/types.d.ts +107 -0
  148. package/lib/typescript/ui/navigation/types.d.ts.map +1 -0
  149. package/lib/typescript/ui/screens/AboutKarmaScreen.d.ts +5 -0
  150. package/lib/typescript/ui/screens/AboutKarmaScreen.d.ts.map +1 -0
  151. package/lib/typescript/ui/screens/AccountCenterScreen.d.ts +5 -0
  152. package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -0
  153. package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts +5 -0
  154. package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -0
  155. package/lib/typescript/ui/screens/SignInScreen.d.ts +5 -0
  156. package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -0
  157. package/lib/typescript/ui/screens/SignUpScreen.d.ts +5 -0
  158. package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +1 -0
  159. package/lib/typescript/ui/styles/fonts.d.ts +21 -0
  160. package/lib/typescript/ui/styles/fonts.d.ts.map +1 -0
  161. package/lib/typescript/ui/styles/index.d.ts +3 -0
  162. package/lib/typescript/ui/styles/index.d.ts.map +1 -0
  163. package/lib/typescript/ui/styles/theme.d.ts +69 -0
  164. package/lib/typescript/ui/styles/theme.d.ts.map +1 -0
  165. package/package.json +95 -51
  166. package/src/assets/OxyLogo.svg +1 -0
  167. package/src/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  168. package/src/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  169. package/src/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  170. package/src/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  171. package/src/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  172. package/src/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  173. package/src/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  174. package/src/core/index.ts +768 -0
  175. package/src/index.ts +57 -0
  176. package/src/models/interfaces.ts +128 -0
  177. package/src/ui/components/Avatar.tsx +155 -0
  178. package/src/ui/components/FontLoader.tsx +180 -0
  179. package/src/ui/components/OxyLogo.tsx +73 -0
  180. package/src/ui/components/OxyProvider.tsx +490 -0
  181. package/src/ui/components/OxySignInButton.tsx +207 -0
  182. package/src/ui/components/bottomSheet/index.tsx +12 -0
  183. package/src/ui/context/OxyContext.tsx +344 -0
  184. package/src/ui/index.ts +28 -0
  185. package/src/ui/navigation/OxyRouter.tsx +142 -0
  186. package/src/ui/navigation/types.ts +124 -0
  187. package/src/ui/screens/AboutKarmaScreen.tsx +52 -0
  188. package/src/ui/screens/AccountCenterScreen.tsx +240 -0
  189. package/src/ui/screens/AccountOverviewScreen.tsx +512 -0
  190. package/src/ui/screens/SignInScreen.tsx +210 -0
  191. package/src/ui/screens/SignUpScreen.tsx +607 -0
  192. package/src/ui/styles/FONTS.md +126 -0
  193. package/src/ui/styles/fonts.ts +77 -0
  194. package/src/ui/styles/index.ts +2 -0
  195. package/src/ui/styles/theme.ts +142 -0
  196. package/dist/index.d.ts +0 -152
  197. package/dist/index.js +0 -1
package/src/index.ts ADDED
@@ -0,0 +1,57 @@
1
+ /**
2
+ * OxyHQServices Main Export File
3
+ */
4
+
5
+ // ------------- Core Imports -------------
6
+ import OxyCore from './core';
7
+ import { OxyServices } from './core';
8
+
9
+ // ------------- UI Imports -------------
10
+ import {
11
+ // Context and Hooks
12
+ OxyProvider,
13
+ OxyContextProvider,
14
+ useOxy,
15
+
16
+ // Screens
17
+ SignInScreen,
18
+ SignUpScreen,
19
+ AccountCenterScreen,
20
+
21
+ // Components
22
+ OxySignInButton,
23
+ OxyLogo,
24
+ Avatar,
25
+ FontLoader
26
+ } from './ui';
27
+
28
+ // ------------- Type Imports -------------
29
+ import { OxyContextState, OxyContextProviderProps } from './ui/context/OxyContext';
30
+
31
+ // ------------- Core Exports -------------
32
+ export default OxyCore; // Default export for backward compatibility
33
+ export { OxyServices };
34
+ export * from './core';
35
+
36
+ // ------------- UI Exports -------------
37
+ export {
38
+ // Context and Hooks
39
+ OxyProvider,
40
+ OxyContextProvider,
41
+ useOxy,
42
+
43
+ // Screens
44
+ SignInScreen,
45
+ SignUpScreen,
46
+ AccountCenterScreen,
47
+
48
+ // Components
49
+ OxySignInButton,
50
+ OxyLogo,
51
+ Avatar,
52
+ FontLoader
53
+ };
54
+
55
+ // ------------- Type Exports -------------
56
+ export { OxyContextState, OxyContextProviderProps };
57
+ export * from './ui/navigation/types';
@@ -0,0 +1,128 @@
1
+ export interface OxyConfig {
2
+ baseURL: string;
3
+ // Add other config options as needed
4
+ }
5
+
6
+ export interface User {
7
+ id: string;
8
+ username: string;
9
+ email?: string;
10
+ avatarUrl?: string;
11
+ // Add other user fields as needed
12
+ }
13
+
14
+ export interface LoginResponse {
15
+ accessToken?: string;
16
+ refreshToken?: string;
17
+ token?: string; // For backwards compatibility
18
+ user: User;
19
+ message?: string;
20
+ }
21
+
22
+ export interface Notification {
23
+ id: string;
24
+ message: string;
25
+ // Add other notification fields as needed
26
+ }
27
+
28
+ export interface Wallet {
29
+ id: string;
30
+ balance: number;
31
+ // Add other wallet fields as needed
32
+ }
33
+
34
+ export interface Transaction {
35
+ id: string;
36
+ amount: number;
37
+ type: string;
38
+ timestamp: string;
39
+ // Add other transaction fields as needed
40
+ }
41
+
42
+ export interface TransferFundsRequest {
43
+ fromUserId: string;
44
+ toUserId: string;
45
+ amount: number;
46
+ }
47
+
48
+ export interface PurchaseRequest {
49
+ userId: string;
50
+ itemId: string;
51
+ amount: number;
52
+ }
53
+
54
+ export interface WithdrawalRequest {
55
+ userId: string;
56
+ amount: number;
57
+ address: string;
58
+ }
59
+
60
+ export interface TransactionResponse {
61
+ success: boolean;
62
+ transaction: Transaction;
63
+ }
64
+
65
+ export interface KarmaRule {
66
+ id: string;
67
+ description: string;
68
+ // Add other karma rule fields as needed
69
+ }
70
+
71
+ export interface KarmaHistory {
72
+ id: string;
73
+ userId: string;
74
+ points: number;
75
+ // Add other karma history fields as needed
76
+ }
77
+
78
+ export interface KarmaLeaderboardEntry {
79
+ userId: string;
80
+ total: number;
81
+ }
82
+
83
+ export interface KarmaAwardRequest {
84
+ userId: string;
85
+ points: number;
86
+ reason?: string;
87
+ }
88
+
89
+ export interface ApiError {
90
+ message: string;
91
+ code: string;
92
+ status: number;
93
+ details?: any;
94
+ }
95
+
96
+ export interface PaymentMethod {
97
+ id: string;
98
+ type: string;
99
+ // Add other payment method fields as needed
100
+ }
101
+
102
+ export interface PaymentRequest {
103
+ userId: string;
104
+ planId: string;
105
+ paymentMethodId: string;
106
+ }
107
+
108
+ export interface PaymentResponse {
109
+ transactionId: string;
110
+ status: string;
111
+ }
112
+
113
+ export interface AnalyticsData {
114
+ userId: string;
115
+ // Add other analytics fields as needed
116
+ }
117
+
118
+ export interface FollowerDetails {
119
+ userId: string;
120
+ followers: number;
121
+ // Add other follower details as needed
122
+ }
123
+
124
+ export interface ContentViewer {
125
+ userId: string;
126
+ viewedAt: string;
127
+ // Add other content viewer fields as needed
128
+ }
@@ -0,0 +1,155 @@
1
+ import React from 'react';
2
+ import { View, Text, Image, StyleSheet, StyleProp, ViewStyle, ImageStyle, TextStyle, ActivityIndicator, Platform } from 'react-native';
3
+ import { useThemeColors } from '../styles';
4
+ import { fontFamilies } from '../styles/fonts';
5
+
6
+ export interface AvatarProps {
7
+ /**
8
+ * URL of the avatar image
9
+ */
10
+ imageUrl?: string;
11
+
12
+ /**
13
+ * Text to display when no image is available
14
+ * Defaults to first letter of name if name is provided
15
+ */
16
+ text?: string;
17
+
18
+ /**
19
+ * Full name to derive the initials from (takes first letter)
20
+ */
21
+ name?: string;
22
+
23
+ /**
24
+ * Size of the avatar in pixels
25
+ * @default 40
26
+ */
27
+ size?: number;
28
+
29
+ /**
30
+ * Theme to use for colors
31
+ * @default 'light'
32
+ */
33
+ theme?: 'light' | 'dark';
34
+
35
+ /**
36
+ * Background color for text avatar
37
+ * Defaults to theme primary color
38
+ */
39
+ backgroundColor?: string;
40
+
41
+ /**
42
+ * Text color for text avatar
43
+ * @default '#FFFFFF'
44
+ */
45
+ textColor?: string;
46
+
47
+ /**
48
+ * Additional styles for the container
49
+ */
50
+ style?: StyleProp<ViewStyle>;
51
+
52
+ /**
53
+ * Additional styles for the image
54
+ * Only used when imageUrl is provided
55
+ */
56
+ imageStyle?: StyleProp<ImageStyle>;
57
+
58
+ /**
59
+ * Additional styles for the text
60
+ */
61
+ textStyle?: StyleProp<TextStyle>;
62
+
63
+ /**
64
+ * Is loading state
65
+ * @default false
66
+ */
67
+ isLoading?: boolean;
68
+ }
69
+
70
+ /**
71
+ * Avatar component that displays either an image or text avatar
72
+ * Falls back to displaying the first letter of the name if no image is provided
73
+ */
74
+ const Avatar: React.FC<AvatarProps> = ({
75
+ imageUrl,
76
+ text,
77
+ name,
78
+ size = 40,
79
+ theme = 'light',
80
+ backgroundColor,
81
+ textColor = '#FFFFFF',
82
+ style,
83
+ imageStyle,
84
+ textStyle,
85
+ isLoading = false,
86
+ }) => {
87
+ // Get theme colors
88
+ const colors = useThemeColors(theme);
89
+
90
+ // Use the primary color from theme as default background if not specified
91
+ const bgColor = backgroundColor || colors.primary;
92
+
93
+ // Calculate font size based on avatar size
94
+ const fontSize = Math.floor(size * 0.4);
95
+
96
+ // Determine what text to display for fallback
97
+ const displayText = text ||
98
+ (name ? name.charAt(0).toUpperCase() : '');
99
+
100
+ // Style for container based on size
101
+ const containerStyle = {
102
+ width: size,
103
+ height: size,
104
+ borderRadius: size / 2, // Make it circular
105
+ };
106
+
107
+ if (isLoading) {
108
+ return (
109
+ <View style={[styles.container, containerStyle, { backgroundColor: colors.inputBackground }, style]}>
110
+ <ActivityIndicator color={colors.primary} size={size > 50 ? 'large' : 'small'} />
111
+ </View>
112
+ );
113
+ }
114
+
115
+ // If an image URL is provided, use Image component
116
+ if (imageUrl) {
117
+ return (
118
+ <Image
119
+ source={{ uri: imageUrl }}
120
+ style={[styles.container, containerStyle, imageStyle]}
121
+ />
122
+ );
123
+ }
124
+
125
+ // Otherwise show text avatar
126
+ return (
127
+ <View style={[styles.container, containerStyle, { backgroundColor: bgColor }, style]}>
128
+ <Text style={[
129
+ styles.text,
130
+ {
131
+ fontSize,
132
+ fontFamily: fontFamilies.phuduBold,
133
+ },
134
+ { color: textColor },
135
+ textStyle
136
+ ]}>
137
+ {displayText}
138
+ </Text>
139
+ </View>
140
+ );
141
+ };
142
+
143
+ const styles = StyleSheet.create({
144
+ container: {
145
+ overflow: 'hidden',
146
+ justifyContent: 'center',
147
+ alignItems: 'center',
148
+ },
149
+ text: {
150
+ // Font family is applied directly in the component to use the constants
151
+ fontWeight: Platform.OS === 'web' ? 'bold' : undefined, // Only apply fontWeight on web
152
+ },
153
+ });
154
+
155
+ export default Avatar;
@@ -0,0 +1,180 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { Text, View, ActivityIndicator, StyleSheet, Platform } from 'react-native';
3
+ import * as Font from 'expo-font';
4
+
5
+ /**
6
+ * Get the Phudu font sources for both native and web environments
7
+ * This is specifically designed to work when distributed as an npm package
8
+ */
9
+ const getPhuduFonts = () => {
10
+ try {
11
+ // For both development and when used as a package
12
+ // Load all static font weights
13
+ return {
14
+ 'Phudu-Light': require('../../assets/fonts/Phudu/Phudu-Light.ttf'),
15
+ 'Phudu-Regular': require('../../assets/fonts/Phudu/Phudu-Regular.ttf'),
16
+ 'Phudu-Medium': require('../../assets/fonts/Phudu/Phudu-Medium.ttf'),
17
+ 'Phudu-SemiBold': require('../../assets/fonts/Phudu/Phudu-SemiBold.ttf'),
18
+ 'Phudu-Bold': require('../../assets/fonts/Phudu/Phudu-Bold.ttf'),
19
+ 'Phudu-ExtraBold': require('../../assets/fonts/Phudu/Phudu-ExtraBold.ttf'),
20
+ 'Phudu-Black': require('../../assets/fonts/Phudu/Phudu-Black.ttf'),
21
+ };
22
+ } catch (error) {
23
+ console.warn('Failed to load Phudu fonts:', error);
24
+ return null;
25
+ }
26
+ };
27
+
28
+ /**
29
+ * FontLoader component that loads custom fonts before rendering children
30
+ * This works in both the package development and when consumed as an npm package
31
+ */
32
+ export const FontLoader = ({
33
+ children,
34
+ fallbackContent,
35
+ }: {
36
+ children: React.ReactNode;
37
+ fallbackContent?: React.ReactNode;
38
+ }) => {
39
+ const [fontState, setFontState] = useState<'loading' | 'loaded' | 'error'>('loading');
40
+
41
+ useEffect(() => {
42
+ const loadFonts = async () => {
43
+ try {
44
+ // Get all the font weights
45
+ const phuduFonts = getPhuduFonts();
46
+
47
+ if (!phuduFonts) {
48
+ throw new Error('Phudu font files not found');
49
+ }
50
+
51
+ // Load all the static Phudu fonts with their respective weights
52
+ await Font.loadAsync(phuduFonts);
53
+
54
+ setFontState('loaded');
55
+ } catch (error) {
56
+ console.error('Error loading fonts:', error);
57
+ // Fallback to render without custom fonts
58
+ setFontState('error');
59
+ }
60
+ };
61
+
62
+ loadFonts();
63
+ }, []);
64
+
65
+ if (fontState === 'loading') {
66
+ // Render a loading placeholder while fonts are loading
67
+ if (fallbackContent) {
68
+ return <>{fallbackContent}</>;
69
+ }
70
+ return (
71
+ <View style={styles.loaderContainer}>
72
+ <ActivityIndicator size="small" color="#d169e5" />
73
+ </View>
74
+ );
75
+ }
76
+
77
+ if (fontState === 'error') {
78
+ console.warn('Fonts failed to load. Using system fonts instead.');
79
+ }
80
+
81
+ // Return children even on error - the app will use system fonts as fallback
82
+ return <>{children}</>;
83
+ };
84
+
85
+ /**
86
+ * Setup fonts for applications consuming this package
87
+ * This should be called by applications using your package
88
+ */
89
+ export const setupFonts = async () => {
90
+ try {
91
+ const phuduFonts = getPhuduFonts();
92
+
93
+ if (!phuduFonts) {
94
+ throw new Error('Phudu font files not found');
95
+ }
96
+
97
+ if (Platform.OS === 'web') {
98
+ // For web platform, dynamically inject CSS to load the fonts
99
+ if (typeof document !== 'undefined') {
100
+ // Create a style element
101
+ const style = document.createElement('style');
102
+
103
+ // Define @font-face rules for each font weight
104
+ const fontFaceRules = `
105
+ @font-face {
106
+ font-family: 'Phudu';
107
+ src: url(${phuduFonts['Phudu-Light']}) format('truetype');
108
+ font-weight: 300;
109
+ font-style: normal;
110
+ }
111
+ @font-face {
112
+ font-family: 'Phudu';
113
+ src: url(${phuduFonts['Phudu-Regular']}) format('truetype');
114
+ font-weight: 400;
115
+ font-style: normal;
116
+ }
117
+ @font-face {
118
+ font-family: 'Phudu';
119
+ src: url(${phuduFonts['Phudu-Medium']}) format('truetype');
120
+ font-weight: 500;
121
+ font-style: normal;
122
+ }
123
+ @font-face {
124
+ font-family: 'Phudu';
125
+ src: url(${phuduFonts['Phudu-SemiBold']}) format('truetype');
126
+ font-weight: 600;
127
+ font-style: normal;
128
+ }
129
+ @font-face {
130
+ font-family: 'Phudu';
131
+ src: url(${phuduFonts['Phudu-Bold']}) format('truetype');
132
+ font-weight: 700;
133
+ font-style: normal;
134
+ }
135
+ @font-face {
136
+ font-family: 'Phudu';
137
+ src: url(${phuduFonts['Phudu-ExtraBold']}) format('truetype');
138
+ font-weight: 800;
139
+ font-style: normal;
140
+ }
141
+ @font-face {
142
+ font-family: 'Phudu';
143
+ src: url(${phuduFonts['Phudu-Black']}) format('truetype');
144
+ font-weight: 900;
145
+ font-style: normal;
146
+ }
147
+ `;
148
+
149
+ style.textContent = fontFaceRules;
150
+ // Append to the document head
151
+ document.head.appendChild(style);
152
+ console.info('All Phudu web fonts have been dynamically loaded');
153
+ }
154
+ } else {
155
+ // For native platforms, guidance for the package users
156
+ console.info('Fonts should be linked in native projects to use Phudu fonts');
157
+
158
+ // Attempt to load the fonts anyway (this works if the consumer has linked the assets)
159
+ await Font.loadAsync(phuduFonts);
160
+ }
161
+
162
+ return true;
163
+ } catch (error: any) {
164
+ console.warn('Error setting up fonts:', error?.message || error);
165
+ return false;
166
+ }
167
+ };
168
+
169
+ const styles = StyleSheet.create({
170
+ loaderContainer: {
171
+ position: 'absolute',
172
+ top: 0,
173
+ left: 0,
174
+ right: 0,
175
+ bottom: 0,
176
+ justifyContent: 'center',
177
+ alignItems: 'center',
178
+ backgroundColor: 'transparent',
179
+ },
180
+ });
@@ -0,0 +1,73 @@
1
+ import React from 'react';
2
+ import Svg, { Circle, Path } from 'react-native-svg';
3
+ import { ViewStyle } from 'react-native';
4
+ import { useThemeColors } from '../styles/theme';
5
+
6
+ interface OxyLogoProps {
7
+ width?: number;
8
+ height?: number;
9
+ style?: ViewStyle;
10
+ /**
11
+ * Primary fill color for the logo
12
+ * If not provided, the theme's primary color will be used
13
+ */
14
+ fillColor?: string;
15
+ /**
16
+ * Secondary fill color for the inner glow effect
17
+ * If not provided, a lighter shade of the fillColor will be used
18
+ */
19
+ secondaryFillColor?: string;
20
+ /**
21
+ * Theme to use for the logo colors
22
+ * @default 'light'
23
+ */
24
+ theme?: 'light' | 'dark';
25
+ }
26
+
27
+ /**
28
+ * SVG logo component for Oxy
29
+ * This component renders the Oxy logo as an SVG and uses theme colors by default
30
+ */
31
+ export const OxyLogo: React.FC<OxyLogoProps> = ({
32
+ width = 24,
33
+ height = 24,
34
+ style,
35
+ fillColor,
36
+ secondaryFillColor,
37
+ theme = 'light'
38
+ }) => {
39
+ // Get colors from theme
40
+ const themeColors = useThemeColors(theme);
41
+
42
+ // Use theme primary color if no fillColor is provided
43
+ const primaryColor = fillColor || themeColors.primary;
44
+
45
+ const innerFillColor = secondaryFillColor || themeColors.background;
46
+
47
+ return (
48
+ <Svg width={width} height={height} viewBox="0 0 294.84 174.42" style={style}>
49
+ <Path
50
+ d="M241.03 24.83c-3.42-9.32-9.47-19.01-19.05-22.86-6.33-2.55-13.1-2.6-19.49-.26-.52.19-2.22 1.12-2.54 1.12-.22 0-3.3-1.39-4.05-1.61-15.97-4.57-30.37 9.5-39.44 20.8-1.15 1.43-2.29 2.92-3.27 4.48-.35.28-.56-.8-.69-1.06C146.04 12.12 135.23-.4 118.95 1 106.2 2.09 97.86 12.26 96.36 24.5 89.8 16.6 81.31 9.75 71.2 7.08c-15.67-4.13-33.09-.39-45.34 10.17C-3.79 42.81-5.21 97.16 7.9 131.37c9.4 24.5 28.9 43.2 56.85 40.1 11.33-1.25 21.77-5.76 29.87-13.81.13-.03 1.58 1.62 1.9 1.91 2.63 2.38 5.97 4.23 9.43 5.07 17.29 4.17 30.59-11.83 39.99-23.82.21-.05.29.13.41.26 1.22 1.26 2.48 3.38 3.67 4.83 4.4 5.34 10.34 11.44 16.49 14.67 6.58 3.46 14.76 4.48 21.74 1.59 6.43 11.54 20.66 15.21 32.49 9.8 15.49-7.08 28.86-30.53 36.97-45.03 9.26-16.56 18.94-34.11 26.22-51.62 7.51-18.09 19.12-51.35 2.09-67.08-13.19-12.18-31.47-2.47-40.24 9.94l-4.77 6.65z"
51
+ fill={primaryColor}
52
+ />
53
+ <Path
54
+ d="M241.03 24.83l4.77-6.65c8.77-12.41 27.04-22.12 40.24-9.94 17.03 15.73 5.42 48.99-2.09 67.08-7.27 17.51-16.96 35.06-26.22 51.62-8.11 14.5-21.48 37.95-36.97 45.03-11.83 5.41-26.07 1.74-32.49-9.8-6.98 2.89-15.16 1.87-21.74-1.59-6.15-3.23-12.09-9.34-16.49-14.67-1.19-1.45-2.46-3.56-3.67-4.83-.12-.13-.2-.3-.41-.26-9.4 11.99-22.7 28-39.99 23.82-3.46-.84-6.8-2.69-9.43-5.07-.32-.29-1.77-1.94-1.9-1.91-8.1 8.04-18.53 12.55-29.87 13.81-27.95 3.09-47.46-15.6-56.85-40.1C-5.21 97.16-3.79 42.81 25.86 17.24 38.11 6.68 55.52 2.94 71.2 7.07c10.11 2.67 18.6 9.52 25.16 17.42 1.5-12.24 9.84-22.4 22.59-23.5 16.29-1.4 27.1 11.12 33.56 24.44.13.26.34 1.34.69 1.06.98-1.56 2.12-3.05 3.27-4.48 9.07-11.31 23.46-25.37 39.44-20.8.75.22 3.83 1.61 4.05 1.61.32 0 2.02-.93 2.54-1.12 6.4-2.33 13.16-2.28 19.49.26 9.58 3.85 15.64 13.54 19.05 22.86zm-6.67 48c-.88-9.38-1.79-18.77-3.55-28.03s-6.28-28.62-17.53-29.63-15.8 12.97-16.25 22.08c-.74 15.27 4.07 34.76 8.66 49.33 1.38 4.37 3 10.74 6.08 14.08 2.11 2.28 5.31 4.24 8.25 5.17-7.02 9.48-14.5 19.44-18.34 30.74-2.02 5.96-3.84 17.45 2.68 21.32 9.11 5.41 18.68-5.84 23.72-12.25 5.64-7.18 10.62-15.76 15.13-23.7 7.64-13.46 15.57-27.88 22.11-41.89 6.55-14.02 15.36-34.93 14.36-50.48-.25-3.85-2.02-10.44-6.3-11.53-8.54-2.18-17.65 11.65-21.44 17.8-7.07 11.49-12.42 24.19-17.22 36.77l-.37.21zm-83.67-14.84c-.11.08-.3-.27-.36-.38-.89-1.66-1.61-4.13-2.39-5.94-3.05-7.11-6.55-15.22-10.16-22.01s-11.12-16.46-20.3-12.96-6.07 17.71-4.28 24.7c3.59 13.98 9.21 27.75 14.81 41.02-5.93 11.33-11.94 22.65-17.47 34.19-3.8 7.92-10.58 22.31-4.93 30.54 6.13 8.92 18.44-3.44 22.73-8.57l19.09-23.41.39.27c6.19 10.08 12.58 21.57 21.85 29.14 6.31 5.16 15.72 6.95 17.45-3.38 1.09-6.53-3.31-16.75-5.87-22.86-4.2-10-9.25-19.64-14.62-29.05l-.13-.52c1.51-2.98 3.38-5.75 5.03-8.65 4-7.06 7.7-14.28 11.61-21.39 4.97-9.05 14.77-23.79 13.86-34.3-.31-3.61-2.31-8.51-6.42-8.92-8.41-.84-18.76 11.28-23.48 17.35-6.12 7.86-11.53 16.49-16.43 25.15zM55 20.71c-28.18 1.93-38.49 35.65-39.8 59.2-1.68 30.16 10.02 82.97 50.53 76.2 32.13-5.37 37.37-46.47 34.97-72.86S88.19 18.44 55 20.71zm140.7 93.28c.31.07.32-.1.47-.28 1-1.16 1.69-3.21 2.78-4.4l.06-.37c-3.26-4.14-4.87-9.22-6.52-14.16-1.44-4.32-2.5-8.78-3.91-13.09-.07-.2-.12-.7-.38-.7-1.27 2.82-3.17 5.34-4.31 8.21 4.29 8.08 8.46 16.26 11.81 24.79z"
55
+ fill={primaryColor}
56
+ />
57
+ <Path
58
+ d="M55 20.71c33.19-2.27 43.33 36.41 45.7 62.54s-2.84 67.49-34.97 72.86c-40.5 6.77-52.21-46.03-50.53-76.2 1.31-23.56 11.62-57.27 39.8-59.2zm.99 38.66c-4.57.62-7.12 6.56-8.21 10.46-3.47 12.39-1.15 36.95 5.85 47.99 4 6.3 10.59 7.71 14.1.13 5.48-11.82 4.06-35.72-.36-47.87-1.84-5.06-5-11.57-11.38-10.7zM150.69 57.99c4.9-8.66 10.31-17.29 16.43-25.15 4.73-6.07 15.07-18.19 23.48-17.35 4.11.41 6.1 5.31 6.42 8.92.91 10.52-8.89 25.26-13.86 34.3-3.9 7.11-7.61 14.33-11.61 21.39-1.64 2.9-3.52 5.67-5.03 8.65l.13.52c5.37 9.41 10.42 19.05 14.62 29.05 2.57 6.11 6.97 16.33 5.87 22.86-1.73 10.33-11.14 8.54-17.45 3.38-9.27-7.57-15.67-19.07-21.85-29.14l-.39-.27-19.09 23.41c-4.29 5.13-16.6 17.49-22.73 8.57-5.66-8.23 1.13-22.63 4.93-30.54 5.53-11.54 11.54-22.86 17.47-34.19-5.61-13.27-11.22-27.03-14.81-41.02-1.8-6.99-4.69-21.27 4.28-24.7s16.55 5.88 20.3 12.96 7.11 14.9 10.16 22.01c.78 1.81 1.5 4.29 2.39 5.94.06.11.25.46.36.38zM234.36 72.83l.37-.21c4.8-12.59 10.15-25.29 17.22-36.77 3.79-6.16 12.9-19.98 21.44-17.8 4.28 1.09 6.06 7.68 6.3 11.53.99 15.56-7.82 36.47-14.36 50.48-6.54 14.01-14.47 28.42-22.11 41.89-4.51 7.95-9.49 16.53-15.13 23.7-5.03 6.41-14.61 17.66-23.72 12.25-6.52-3.87-4.71-15.36-2.68-21.32 3.84-11.31 11.32-21.27 18.34-30.74-2.94-.93-6.15-2.89-8.25-5.17-3.09-3.34-4.71-9.71-6.08-14.08-4.59-14.57-9.4-34.06-8.66-49.33.44-9.11 4.77-23.11 16.25-22.08s15.83 20.68 17.53 29.63 2.67 18.65 3.55 28.03z"
59
+ fill={innerFillColor}
60
+ />
61
+ <Path
62
+ d="M195.7 113.99c-3.35-8.52-7.52-16.71-11.81-24.79 1.14-2.87 3.04-5.39 4.31-8.21.25 0 .31.5.38.7 1.41 4.31 2.47 8.77 3.91 13.09 1.65 4.94 3.26 10.02 6.52 14.16l-.06.37c-1.09 1.19-1.78 3.24-2.78 4.4-.15.17-.16.35-.47.28z"
63
+ fill={primaryColor}
64
+ />
65
+ <Path
66
+ d="M55.99 59.37c6.38-.87 9.53 5.65 11.38 10.7 4.42 12.14 5.84 36.05.36 47.87-3.51 7.58-10.1 6.17-14.1-.13-7-11.03-9.32-35.6-5.85-47.99 1.09-3.9 3.64-9.84 8.21-10.46z"
67
+ fill={primaryColor}
68
+ />
69
+ </Svg>
70
+ );
71
+ };
72
+
73
+ export default OxyLogo;