@oxyhq/services 0.1.17 → 5.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -138
- package/UI_COMPONENTS.md +142 -0
- package/lib/commonjs/assets/OxyLogo.svg +1 -0
- package/lib/commonjs/assets/assets/OxyLogo.svg +1 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/lib/commonjs/core/index.js +783 -0
- package/lib/commonjs/core/index.js.map +1 -0
- package/lib/commonjs/index.js +128 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/models/interfaces.js +2 -0
- package/lib/commonjs/models/interfaces.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/ui/components/FontLoader.js +181 -0
- package/lib/commonjs/ui/components/FontLoader.js.map +1 -0
- package/lib/commonjs/ui/components/OxyLogo.js +56 -0
- package/lib/commonjs/ui/components/OxyLogo.js.map +1 -0
- package/lib/commonjs/ui/components/OxyProvider.js +464 -0
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -0
- package/lib/commonjs/ui/components/OxySignInButton.js +178 -0
- package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -0
- package/lib/commonjs/ui/components/bottomSheet/index.js +37 -0
- package/lib/commonjs/ui/components/bottomSheet/index.js.map +1 -0
- package/lib/commonjs/ui/context/OxyContext.js +296 -0
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -0
- package/lib/commonjs/ui/index.js +136 -0
- package/lib/commonjs/ui/index.js.map +1 -0
- package/lib/commonjs/ui/navigation/OxyRouter.js +140 -0
- package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -0
- package/lib/commonjs/ui/navigation/types.js +6 -0
- package/lib/commonjs/ui/navigation/types.js.map +1 -0
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +280 -0
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +578 -0
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/SignInScreen.js +230 -0
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/SignUpScreen.js +673 -0
- package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -0
- package/lib/commonjs/ui/styles/FONTS.md +126 -0
- package/lib/commonjs/ui/styles/fonts.js +84 -0
- package/lib/commonjs/ui/styles/fonts.js.map +1 -0
- package/lib/commonjs/ui/styles/index.js +28 -0
- package/lib/commonjs/ui/styles/index.js.map +1 -0
- package/lib/commonjs/ui/styles/theme.js +122 -0
- package/lib/commonjs/ui/styles/theme.js.map +1 -0
- package/lib/module/assets/OxyLogo.svg +1 -0
- package/lib/module/assets/assets/OxyLogo.svg +1 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/lib/module/core/index.js +777 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/index.js +29 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/models/interfaces.js +2 -0
- package/lib/module/models/interfaces.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/ui/components/FontLoader.js +176 -0
- package/lib/module/ui/components/FontLoader.js.map +1 -0
- package/lib/module/ui/components/OxyLogo.js +49 -0
- package/lib/module/ui/components/OxyLogo.js.map +1 -0
- package/lib/module/ui/components/OxyProvider.js +458 -0
- package/lib/module/ui/components/OxyProvider.js.map +1 -0
- package/lib/module/ui/components/OxySignInButton.js +172 -0
- package/lib/module/ui/components/OxySignInButton.js.map +1 -0
- package/lib/module/ui/components/bottomSheet/index.js +8 -0
- package/lib/module/ui/components/bottomSheet/index.js.map +1 -0
- package/lib/module/ui/context/OxyContext.js +291 -0
- package/lib/module/ui/context/OxyContext.js.map +1 -0
- package/lib/module/ui/index.js +25 -0
- package/lib/module/ui/index.js.map +1 -0
- package/lib/module/ui/navigation/OxyRouter.js +133 -0
- package/lib/module/ui/navigation/OxyRouter.js.map +1 -0
- package/lib/module/ui/navigation/types.js +4 -0
- package/lib/module/ui/navigation/types.js.map +1 -0
- package/lib/module/ui/screens/AccountCenterScreen.js +275 -0
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -0
- package/lib/module/ui/screens/AccountOverviewScreen.js +573 -0
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -0
- package/lib/module/ui/screens/SignInScreen.js +224 -0
- package/lib/module/ui/screens/SignInScreen.js.map +1 -0
- package/lib/module/ui/screens/SignUpScreen.js +668 -0
- package/lib/module/ui/screens/SignUpScreen.js.map +1 -0
- package/lib/module/ui/styles/FONTS.md +126 -0
- package/lib/module/ui/styles/fonts.js +81 -0
- package/lib/module/ui/styles/fonts.js.map +1 -0
- package/lib/module/ui/styles/index.js +5 -0
- package/lib/module/ui/styles/index.js.map +1 -0
- package/lib/module/ui/styles/theme.js +115 -0
- package/lib/module/ui/styles/theme.js.map +1 -0
- package/lib/typescript/core/index.d.ts +304 -0
- package/lib/typescript/core/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +11 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/models/interfaces.d.ts +98 -0
- package/lib/typescript/models/interfaces.d.ts.map +1 -0
- package/lib/typescript/ui/components/FontLoader.d.ts +15 -0
- package/lib/typescript/ui/components/FontLoader.d.ts.map +1 -0
- package/lib/typescript/ui/components/OxyLogo.d.ts +29 -0
- package/lib/typescript/ui/components/OxyLogo.d.ts.map +1 -0
- package/lib/typescript/ui/components/OxyProvider.d.ts +12 -0
- package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -0
- package/lib/typescript/ui/components/OxySignInButton.d.ts +65 -0
- package/lib/typescript/ui/components/OxySignInButton.d.ts.map +1 -0
- package/lib/typescript/ui/components/bottomSheet/index.d.ts +3 -0
- package/lib/typescript/ui/components/bottomSheet/index.d.ts.map +1 -0
- package/lib/typescript/ui/context/OxyContext.d.ts +26 -0
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -0
- package/lib/typescript/ui/index.d.ts +15 -0
- package/lib/typescript/ui/index.d.ts.map +1 -0
- package/lib/typescript/ui/navigation/OxyRouter.d.ts +5 -0
- package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -0
- package/lib/typescript/ui/navigation/types.d.ts +107 -0
- package/lib/typescript/ui/navigation/types.d.ts.map +1 -0
- package/lib/typescript/ui/screens/AccountCenterScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/SignInScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/SignUpScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +1 -0
- package/lib/typescript/ui/styles/fonts.d.ts +21 -0
- package/lib/typescript/ui/styles/fonts.d.ts.map +1 -0
- package/lib/typescript/ui/styles/index.d.ts +3 -0
- package/lib/typescript/ui/styles/index.d.ts.map +1 -0
- package/lib/typescript/ui/styles/theme.d.ts +69 -0
- package/lib/typescript/ui/styles/theme.d.ts.map +1 -0
- package/package.json +95 -51
- package/src/assets/OxyLogo.svg +1 -0
- package/src/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/src/core/index.ts +768 -0
- package/src/index.ts +46 -0
- package/src/models/interfaces.ts +128 -0
- package/src/ui/components/FontLoader.tsx +180 -0
- package/src/ui/components/OxyLogo.tsx +73 -0
- package/src/ui/components/OxyProvider.tsx +490 -0
- package/src/ui/components/OxySignInButton.tsx +207 -0
- package/src/ui/components/bottomSheet/index.tsx +12 -0
- package/src/ui/context/OxyContext.tsx +344 -0
- package/src/ui/index.ts +27 -0
- package/src/ui/navigation/OxyRouter.tsx +137 -0
- package/src/ui/navigation/types.ts +124 -0
- package/src/ui/screens/AccountCenterScreen.tsx +240 -0
- package/src/ui/screens/AccountOverviewScreen.tsx +519 -0
- package/src/ui/screens/SignInScreen.tsx +210 -0
- package/src/ui/screens/SignUpScreen.tsx +607 -0
- package/src/ui/styles/FONTS.md +126 -0
- package/src/ui/styles/fonts.ts +77 -0
- package/src/ui/styles/index.ts +2 -0
- package/src/ui/styles/theme.ts +142 -0
- package/dist/index.d.ts +0 -152
- package/dist/index.js +0 -1
package/src/index.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import OxyCore from './core';
|
|
2
|
+
import { OxyServices } from './core';
|
|
3
|
+
|
|
4
|
+
// Export UI components and types
|
|
5
|
+
import {
|
|
6
|
+
OxyProvider,
|
|
7
|
+
OxyContextProvider,
|
|
8
|
+
useOxy,
|
|
9
|
+
SignInScreen,
|
|
10
|
+
SignUpScreen,
|
|
11
|
+
AccountCenterScreen,
|
|
12
|
+
OxySignInButton,
|
|
13
|
+
OxyLogo,
|
|
14
|
+
FontLoader
|
|
15
|
+
} from './ui';
|
|
16
|
+
|
|
17
|
+
// Export OxyContext types directly
|
|
18
|
+
import { OxyContextState, OxyContextProviderProps } from './ui/context/OxyContext';
|
|
19
|
+
|
|
20
|
+
// Create a default export for backward compatibility
|
|
21
|
+
export default OxyCore;
|
|
22
|
+
|
|
23
|
+
// Export OxyServices class directly from core
|
|
24
|
+
export { OxyServices };
|
|
25
|
+
|
|
26
|
+
// Export other items from core
|
|
27
|
+
export * from './core';
|
|
28
|
+
|
|
29
|
+
// Export UI components
|
|
30
|
+
export {
|
|
31
|
+
OxyProvider,
|
|
32
|
+
OxyContextProvider,
|
|
33
|
+
useOxy,
|
|
34
|
+
SignInScreen,
|
|
35
|
+
SignUpScreen,
|
|
36
|
+
AccountCenterScreen,
|
|
37
|
+
OxySignInButton,
|
|
38
|
+
OxyLogo,
|
|
39
|
+
FontLoader
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Export types explicitly
|
|
43
|
+
export { OxyContextState, OxyContextProviderProps }
|
|
44
|
+
|
|
45
|
+
// Export navigation types
|
|
46
|
+
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,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;
|