@oxyhq/services 5.6.7 → 5.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/core/index.js +31 -5
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/index.js +5 -165
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/index.js +88 -170
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/isFrontend.js +10 -0
- package/lib/commonjs/ui/isFrontend.js.map +1 -0
- package/lib/module/core/index.js +31 -5
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/index.js +2 -131
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/index.js +53 -37
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/isFrontend.js +6 -0
- package/lib/module/ui/isFrontend.js.map +1 -0
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -8
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/ui/index.d.ts +2 -23
- package/lib/typescript/ui/index.d.ts.map +1 -1
- package/lib/typescript/ui/isFrontend.d.ts +3 -0
- package/lib/typescript/ui/isFrontend.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/middleware.test.ts +105 -0
- package/src/__tests__/setup.ts +10 -0
- package/src/core/index.ts +34 -5
- package/src/index.ts +3 -139
- package/src/ui/index.ts +70 -38
- package/src/ui/isFrontend.ts +5 -0
package/src/index.ts
CHANGED
|
@@ -6,143 +6,7 @@
|
|
|
6
6
|
* - Backend: Core functionality only (UI components are no-ops)
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
import OxyCore from './core';
|
|
11
|
-
import { OxyServices } from './core';
|
|
12
|
-
import { DeviceManager } from './utils/deviceManager';
|
|
13
|
-
import * as Models from './models/interfaces';
|
|
14
|
-
|
|
15
|
-
// ------------- Environment Detection -------------
|
|
16
|
-
const isFrontend = typeof window !== 'undefined' ||
|
|
17
|
-
(typeof global !== 'undefined' && global.navigator) ||
|
|
18
|
-
(typeof process !== 'undefined' && process.env.NODE_ENV === 'development' && typeof document !== 'undefined');
|
|
19
|
-
|
|
20
|
-
// ------------- Core Exports (Always Available) -------------
|
|
21
|
-
export default OxyCore;
|
|
22
|
-
export { OxyServices };
|
|
9
|
+
// Universal entry: always statically export everything
|
|
23
10
|
export * from './core';
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export * from './models/interfaces';
|
|
27
|
-
export * from './models/secureSession';
|
|
28
|
-
|
|
29
|
-
// ------------- Safe Toast Export -------------
|
|
30
|
-
export { toast } from './lib/sonner-safe';
|
|
31
|
-
|
|
32
|
-
// ------------- UI Exports (Conditional) -------------
|
|
33
|
-
if (isFrontend) {
|
|
34
|
-
// Frontend: Export all UI components and hooks
|
|
35
|
-
try {
|
|
36
|
-
// Import UI components and hooks
|
|
37
|
-
const {
|
|
38
|
-
OxyProvider,
|
|
39
|
-
OxySignInButton,
|
|
40
|
-
OxyLogo,
|
|
41
|
-
Avatar,
|
|
42
|
-
FollowButton,
|
|
43
|
-
OxyPayButton,
|
|
44
|
-
FontLoader,
|
|
45
|
-
useOxy,
|
|
46
|
-
useOxyAuth,
|
|
47
|
-
useOxyUser,
|
|
48
|
-
useOxyKarma,
|
|
49
|
-
useOxyPayments,
|
|
50
|
-
useOxyDevices,
|
|
51
|
-
useOxyNotifications,
|
|
52
|
-
useOxySocket,
|
|
53
|
-
useOxyQR,
|
|
54
|
-
useOxyIAP,
|
|
55
|
-
OxyContextProvider,
|
|
56
|
-
OxyContextState,
|
|
57
|
-
OxyContextProviderProps,
|
|
58
|
-
useFollow,
|
|
59
|
-
ProfileScreen,
|
|
60
|
-
OxyRouter,
|
|
61
|
-
useAuthStore,
|
|
62
|
-
OxyIcon,
|
|
63
|
-
IconProps,
|
|
64
|
-
fontFamilies,
|
|
65
|
-
fontStyles
|
|
66
|
-
} = require('./ui');
|
|
67
|
-
|
|
68
|
-
// Export all UI components
|
|
69
|
-
exports.OxyProvider = OxyProvider;
|
|
70
|
-
exports.OxySignInButton = OxySignInButton;
|
|
71
|
-
exports.OxyLogo = OxyLogo;
|
|
72
|
-
exports.Avatar = Avatar;
|
|
73
|
-
exports.FollowButton = FollowButton;
|
|
74
|
-
exports.OxyPayButton = OxyPayButton;
|
|
75
|
-
exports.FontLoader = FontLoader;
|
|
76
|
-
|
|
77
|
-
// Export all hooks
|
|
78
|
-
exports.useOxy = useOxy;
|
|
79
|
-
exports.useOxyAuth = useOxyAuth;
|
|
80
|
-
exports.useOxyUser = useOxyUser;
|
|
81
|
-
exports.useOxyKarma = useOxyKarma;
|
|
82
|
-
exports.useOxyPayments = useOxyPayments;
|
|
83
|
-
exports.useOxyDevices = useOxyDevices;
|
|
84
|
-
exports.useOxyNotifications = useOxyNotifications;
|
|
85
|
-
exports.useOxySocket = useOxySocket;
|
|
86
|
-
exports.useOxyQR = useOxyQR;
|
|
87
|
-
exports.useOxyIAP = useOxyIAP;
|
|
88
|
-
exports.useFollow = useFollow;
|
|
89
|
-
|
|
90
|
-
// Export context
|
|
91
|
-
exports.OxyContextProvider = OxyContextProvider;
|
|
92
|
-
exports.OxyContextState = OxyContextState;
|
|
93
|
-
exports.OxyContextProviderProps = OxyContextProviderProps;
|
|
94
|
-
|
|
95
|
-
// Export screens and navigation
|
|
96
|
-
exports.ProfileScreen = ProfileScreen;
|
|
97
|
-
exports.OxyRouter = OxyRouter;
|
|
98
|
-
exports.useAuthStore = useAuthStore;
|
|
99
|
-
|
|
100
|
-
// Export UI components
|
|
101
|
-
exports.OxyIcon = OxyIcon;
|
|
102
|
-
exports.IconProps = IconProps;
|
|
103
|
-
exports.fontFamilies = fontFamilies;
|
|
104
|
-
exports.fontStyles = fontStyles;
|
|
105
|
-
|
|
106
|
-
} catch (e: any) {
|
|
107
|
-
console.warn('UI components failed to load:', e?.message || 'Unknown error');
|
|
108
|
-
// Fallback to no-op exports
|
|
109
|
-
const noopComponent = () => null;
|
|
110
|
-
const noopHook = () => ({});
|
|
111
|
-
|
|
112
|
-
exports.OxyProvider = noopComponent;
|
|
113
|
-
exports.useOxy = noopHook;
|
|
114
|
-
exports.useOxyAuth = noopHook;
|
|
115
|
-
exports.useOxyUser = noopHook;
|
|
116
|
-
exports.useOxyKarma = noopHook;
|
|
117
|
-
exports.useOxyPayments = noopHook;
|
|
118
|
-
exports.useOxyDevices = noopHook;
|
|
119
|
-
exports.useOxyNotifications = noopHook;
|
|
120
|
-
exports.useOxySocket = noopHook;
|
|
121
|
-
exports.useOxyQR = noopHook;
|
|
122
|
-
exports.useOxyIAP = noopHook;
|
|
123
|
-
exports.useFollow = noopHook;
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
// Backend: Export no-op UI components
|
|
127
|
-
const noopComponent = () => null;
|
|
128
|
-
const noopHook = () => ({});
|
|
129
|
-
|
|
130
|
-
exports.OxyProvider = noopComponent;
|
|
131
|
-
exports.OxySignInButton = noopComponent;
|
|
132
|
-
exports.OxyLogo = noopComponent;
|
|
133
|
-
exports.Avatar = noopComponent;
|
|
134
|
-
exports.FollowButton = noopComponent;
|
|
135
|
-
exports.OxyPayButton = noopComponent;
|
|
136
|
-
exports.FontLoader = { setupFonts: () => {} };
|
|
137
|
-
exports.useOxy = noopHook;
|
|
138
|
-
exports.useOxyAuth = noopHook;
|
|
139
|
-
exports.useOxyUser = noopHook;
|
|
140
|
-
exports.useOxyKarma = noopHook;
|
|
141
|
-
exports.useOxyPayments = noopHook;
|
|
142
|
-
exports.useOxyDevices = noopHook;
|
|
143
|
-
exports.useOxyNotifications = noopHook;
|
|
144
|
-
exports.useOxySocket = noopHook;
|
|
145
|
-
exports.useOxyQR = noopHook;
|
|
146
|
-
exports.useOxyIAP = noopHook;
|
|
147
|
-
exports.useFollow = noopHook;
|
|
148
|
-
}
|
|
11
|
+
export * from './ui';
|
|
12
|
+
export { toast } from './lib/sonner-safe';
|
package/src/ui/index.ts
CHANGED
|
@@ -1,51 +1,83 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* UI Component exports - Frontend Only
|
|
2
|
+
* UI Component exports - Frontend Only (with backend-safe fallbacks)
|
|
3
3
|
*
|
|
4
4
|
* This module exports all React/React Native UI components and hooks.
|
|
5
|
-
*
|
|
5
|
+
* In backend, all exports are no-ops or empty objects.
|
|
6
6
|
*/
|
|
7
|
+
import isFrontend from './isFrontend';
|
|
7
8
|
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
export { default as OxySignInButton } from './components/OxySignInButton';
|
|
11
|
-
export { default as OxyLogo } from './components/OxyLogo';
|
|
12
|
-
export { default as Avatar } from './components/Avatar';
|
|
13
|
-
export { default as FollowButton } from './components/FollowButton';
|
|
14
|
-
export { default as OxyPayButton } from './components/OxyPayButton';
|
|
15
|
-
export { FontLoader, setupFonts } from './components/FontLoader';
|
|
9
|
+
// Real UI exports
|
|
10
|
+
let OxyProvider, OxySignInButton, OxyLogo, Avatar, FollowButton, OxyPayButton, FontLoader, setupFonts, OxyIcon, useOxy, useOxyAuth, useOxyUser, useOxyKarma, useOxyPayments, useOxyDevices, useOxyNotifications, useOxySocket, useOxyQR, useOxyIAP, OxyContextProvider, OxyContextState, OxyContextProviderProps, useFollow, ProfileScreen, OxyRouter, useAuthStore, fontFamilies, fontStyles, toast;
|
|
16
11
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
if (isFrontend) {
|
|
13
|
+
OxyProvider = require('./components/OxyProvider').default;
|
|
14
|
+
OxySignInButton = require('./components/OxySignInButton').default;
|
|
15
|
+
OxyLogo = require('./components/OxyLogo').default;
|
|
16
|
+
Avatar = require('./components/Avatar').default;
|
|
17
|
+
FollowButton = require('./components/FollowButton').default;
|
|
18
|
+
OxyPayButton = require('./components/OxyPayButton').default;
|
|
19
|
+
FontLoader = require('./components/FontLoader').FontLoader;
|
|
20
|
+
setupFonts = require('./components/FontLoader').setupFonts;
|
|
21
|
+
OxyIcon = require('./components/icon').OxyIcon;
|
|
22
|
+
useOxy = require('./context/OxyContext').useOxy;
|
|
23
|
+
OxyContextProvider = require('./context/OxyContext').OxyContextProvider;
|
|
24
|
+
OxyContextState = require('./context/OxyContext').OxyContextState;
|
|
25
|
+
OxyContextProviderProps = require('./context/OxyContext').OxyContextProviderProps;
|
|
26
|
+
useFollow = require('./hooks').useFollow;
|
|
27
|
+
ProfileScreen = require('./screens/ProfileScreen').default;
|
|
28
|
+
OxyRouter = require('./navigation/OxyRouter').default;
|
|
29
|
+
useAuthStore = require('./stores/authStore').useAuthStore;
|
|
30
|
+
fontFamilies = require('./styles/fonts').fontFamilies;
|
|
31
|
+
fontStyles = require('./styles/fonts').fontStyles;
|
|
32
|
+
toast = require('../lib/sonner').toast;
|
|
33
|
+
} else {
|
|
34
|
+
// Backend: no-op fallbacks
|
|
35
|
+
const noopComponent = () => null;
|
|
36
|
+
const noopHook = () => ({});
|
|
37
|
+
OxyProvider = noopComponent;
|
|
38
|
+
OxySignInButton = noopComponent;
|
|
39
|
+
OxyLogo = noopComponent;
|
|
40
|
+
Avatar = noopComponent;
|
|
41
|
+
FollowButton = noopComponent;
|
|
42
|
+
OxyPayButton = noopComponent;
|
|
43
|
+
FontLoader = noopComponent;
|
|
44
|
+
setupFonts = () => {};
|
|
45
|
+
OxyIcon = noopComponent;
|
|
46
|
+
useOxy = noopHook;
|
|
47
|
+
OxyContextProvider = noopComponent;
|
|
48
|
+
OxyContextState = {};
|
|
49
|
+
OxyContextProviderProps = {};
|
|
50
|
+
useFollow = noopHook;
|
|
51
|
+
ProfileScreen = noopComponent;
|
|
52
|
+
OxyRouter = noopComponent;
|
|
53
|
+
useAuthStore = noopHook;
|
|
54
|
+
fontFamilies = {};
|
|
55
|
+
fontStyles = {};
|
|
56
|
+
toast = () => {};
|
|
57
|
+
}
|
|
20
58
|
|
|
21
|
-
// Export context and hooks
|
|
22
59
|
export {
|
|
23
|
-
|
|
60
|
+
OxyProvider,
|
|
61
|
+
OxySignInButton,
|
|
62
|
+
OxyLogo,
|
|
63
|
+
Avatar,
|
|
64
|
+
FollowButton,
|
|
65
|
+
OxyPayButton,
|
|
66
|
+
FontLoader,
|
|
67
|
+
setupFonts,
|
|
68
|
+
OxyIcon,
|
|
24
69
|
useOxy,
|
|
70
|
+
OxyContextProvider,
|
|
25
71
|
OxyContextState,
|
|
26
|
-
OxyContextProviderProps
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// Hooks
|
|
36
|
-
export { useFollow } from './hooks';
|
|
37
|
-
|
|
38
|
-
// Screens
|
|
39
|
-
export { default as ProfileScreen } from './screens/ProfileScreen';
|
|
40
|
-
|
|
41
|
-
// Navigation
|
|
42
|
-
export { default as OxyRouter } from './navigation/OxyRouter';
|
|
43
|
-
|
|
44
|
-
// Export stores for advanced usage
|
|
45
|
-
export { useAuthStore } from './stores/authStore';
|
|
46
|
-
|
|
47
|
-
// Export toast for UI notifications
|
|
48
|
-
export { toast } from '../lib/sonner';
|
|
72
|
+
OxyContextProviderProps,
|
|
73
|
+
useFollow,
|
|
74
|
+
ProfileScreen,
|
|
75
|
+
OxyRouter,
|
|
76
|
+
useAuthStore,
|
|
77
|
+
fontFamilies,
|
|
78
|
+
fontStyles,
|
|
79
|
+
toast
|
|
80
|
+
};
|
|
49
81
|
|
|
50
82
|
// Re-export core services for convenience in UI context
|
|
51
83
|
export { OxyServices } from '../core';
|