@oxyhq/services 5.7.4 → 5.8.1
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 +125 -268
- package/lib/commonjs/core/index.js +172 -0
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/index.js +88 -29
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/node/createAuth.js +585 -7
- package/lib/commonjs/node/createAuth.js.map +1 -1
- package/lib/commonjs/node/index.js +31 -41
- package/lib/commonjs/node/index.js.map +1 -1
- package/lib/commonjs/ui/components/Avatar.js +15 -6
- package/lib/commonjs/ui/components/Avatar.js.map +1 -1
- package/lib/commonjs/ui/components/GroupedItem.js +58 -13
- package/lib/commonjs/ui/components/GroupedItem.js.map +1 -1
- package/lib/commonjs/ui/components/GroupedSection.js +7 -1
- package/lib/commonjs/ui/components/GroupedSection.js.map +1 -1
- package/lib/commonjs/ui/components/Header.js +322 -0
- package/lib/commonjs/ui/components/Header.js.map +1 -0
- package/lib/commonjs/ui/components/OxyProvider.js +23 -7
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/index.js +7 -0
- package/lib/commonjs/ui/components/index.js.map +1 -1
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js +1 -1
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/commonjs/ui/components/internal/TextField.js +606 -546
- package/lib/commonjs/ui/components/internal/TextField.js.map +1 -1
- package/lib/commonjs/ui/components/internal/TextField.md +436 -0
- package/lib/commonjs/ui/context/OxyContext.js +122 -78
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionSocket.js +5 -2
- package/lib/commonjs/ui/hooks/useSessionSocket.js.map +1 -1
- package/lib/commonjs/ui/index.js +1 -16
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/navigation/OxyRouter.js +1 -1
- package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +6 -6
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountManagementDemo.js +3 -3
- package/lib/commonjs/ui/screens/AccountManagementDemo.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +241 -598
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +1151 -406
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +135 -237
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AppInfoScreen.js +246 -463
- package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FeedbackScreen.js +3 -3
- package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +808 -650
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/RecoverAccountScreen.js +51 -72
- package/lib/commonjs/ui/screens/RecoverAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SessionManagementScreen.js +11 -29
- package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js +30 -303
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignUpScreen.js +4 -4
- package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js +19 -31
- package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js +7 -10
- package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js +11 -5
- package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js +11 -4
- package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js.map +1 -1
- package/lib/commonjs/ui/stores/authStore.js +12 -0
- package/lib/commonjs/ui/stores/authStore.js.map +1 -1
- package/lib/commonjs/ui/styles/authStyles.js +337 -0
- package/lib/commonjs/ui/styles/authStyles.js.map +1 -0
- package/lib/commonjs/ui/styles/index.js +11 -0
- package/lib/commonjs/ui/styles/index.js.map +1 -1
- package/lib/module/core/index.js +172 -0
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/index.js +26 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/node/createAuth.js +584 -7
- package/lib/module/node/createAuth.js.map +1 -1
- package/lib/module/node/index.js +8 -12
- package/lib/module/node/index.js.map +1 -1
- package/lib/module/ui/components/Avatar.js +15 -6
- package/lib/module/ui/components/Avatar.js.map +1 -1
- package/lib/module/ui/components/GroupedItem.js +59 -14
- package/lib/module/ui/components/GroupedItem.js.map +1 -1
- package/lib/module/ui/components/GroupedSection.js +7 -1
- package/lib/module/ui/components/GroupedSection.js.map +1 -1
- package/lib/module/ui/components/Header.js +317 -0
- package/lib/module/ui/components/Header.js.map +1 -0
- package/lib/module/ui/components/OxyProvider.js +25 -9
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/index.js +1 -0
- package/lib/module/ui/components/index.js.map +1 -1
- package/lib/module/ui/components/internal/GroupedPillButtons.js +1 -1
- package/lib/module/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/module/ui/components/internal/TextField.js +607 -547
- package/lib/module/ui/components/internal/TextField.js.map +1 -1
- package/lib/module/ui/components/internal/TextField.md +436 -0
- package/lib/module/ui/context/OxyContext.js +121 -77
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/hooks/useSessionSocket.js +5 -2
- package/lib/module/ui/hooks/useSessionSocket.js.map +1 -1
- package/lib/module/ui/index.js +1 -16
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/navigation/OxyRouter.js +1 -1
- package/lib/module/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +6 -6
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountManagementDemo.js +3 -3
- package/lib/module/ui/screens/AccountManagementDemo.js.map +1 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js +242 -597
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +1152 -407
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +135 -237
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/AppInfoScreen.js +248 -465
- package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/module/ui/screens/FeedbackScreen.js +3 -3
- package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/module/ui/screens/PaymentGatewayScreen.js +809 -651
- package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/module/ui/screens/RecoverAccountScreen.js +53 -74
- package/lib/module/ui/screens/RecoverAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/SessionManagementScreen.js +11 -29
- package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/SignInScreen.js +32 -305
- package/lib/module/ui/screens/SignInScreen.js.map +1 -1
- package/lib/module/ui/screens/SignUpScreen.js +5 -5
- package/lib/module/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/module/ui/screens/internal/SignInPasswordStep.js +19 -31
- package/lib/module/ui/screens/internal/SignInPasswordStep.js.map +1 -1
- package/lib/module/ui/screens/internal/SignInUsernameStep.js +7 -10
- package/lib/module/ui/screens/internal/SignInUsernameStep.js.map +1 -1
- package/lib/module/ui/screens/internal/SignUpIdentityStep.js +11 -5
- package/lib/module/ui/screens/internal/SignUpIdentityStep.js.map +1 -1
- package/lib/module/ui/screens/internal/SignUpSecurityStep.js +11 -4
- package/lib/module/ui/screens/internal/SignUpSecurityStep.js.map +1 -1
- package/lib/module/ui/stores/authStore.js +12 -0
- package/lib/module/ui/stores/authStore.js.map +1 -1
- package/lib/module/ui/styles/authStyles.js +332 -0
- package/lib/module/ui/styles/authStyles.js.map +1 -0
- package/lib/module/ui/styles/index.js +1 -0
- package/lib/module/ui/styles/index.js.map +1 -1
- package/lib/typescript/core/index.d.ts +67 -0
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +13 -3
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/node/createAuth.d.ts +112 -0
- package/lib/typescript/node/createAuth.d.ts.map +1 -1
- package/lib/typescript/node/index.d.ts +3 -7
- package/lib/typescript/node/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/Avatar.d.ts.map +1 -1
- package/lib/typescript/ui/components/GroupedItem.d.ts +6 -0
- package/lib/typescript/ui/components/GroupedItem.d.ts.map +1 -1
- package/lib/typescript/ui/components/GroupedSection.d.ts +6 -0
- package/lib/typescript/ui/components/GroupedSection.d.ts.map +1 -1
- package/lib/typescript/ui/components/Header.d.ts +22 -0
- package/lib/typescript/ui/components/Header.d.ts.map +1 -0
- package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/ui/components/index.d.ts +1 -0
- package/lib/typescript/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/internal/TextField.d.ts +31 -16
- package/lib/typescript/ui/components/internal/TextField.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts +5 -2
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useSessionSocket.d.ts.map +1 -1
- package/lib/typescript/ui/index.d.ts +1 -2
- package/lib/typescript/ui/index.d.ts.map +1 -1
- package/lib/typescript/ui/navigation/types.d.ts +9 -2
- package/lib/typescript/ui/navigation/types.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AppInfoScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts +5 -1
- package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SessionManagementScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts +1 -1
- package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts +0 -1
- package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts.map +1 -1
- package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
- package/lib/typescript/ui/styles/authStyles.d.ts +326 -0
- package/lib/typescript/ui/styles/authStyles.d.ts.map +1 -0
- package/lib/typescript/ui/styles/index.d.ts +1 -0
- package/lib/typescript/ui/styles/index.d.ts.map +1 -1
- package/package.json +1 -6
- package/src/core/index.ts +189 -0
- package/src/index.ts +72 -4
- package/src/node/createAuth.ts +623 -7
- package/src/node/index.ts +20 -18
- package/src/ui/components/Avatar.tsx +11 -5
- package/src/ui/components/GroupedItem.tsx +57 -9
- package/src/ui/components/GroupedSection.tsx +12 -0
- package/src/ui/components/Header.tsx +364 -0
- package/src/ui/components/OxyProvider.tsx +31 -15
- package/src/ui/components/index.ts +1 -0
- package/src/ui/components/internal/GroupedPillButtons.tsx +1 -1
- package/src/ui/components/internal/TextField.md +436 -0
- package/src/ui/components/internal/TextField.tsx +720 -620
- package/src/ui/context/OxyContext.tsx +150 -63
- package/src/ui/hooks/useSessionSocket.ts +5 -2
- package/src/ui/index.ts +1 -19
- package/src/ui/navigation/OxyRouter.tsx +1 -1
- package/src/ui/navigation/types.ts +10 -2
- package/src/ui/screens/AccountCenterScreen.tsx +5 -5
- package/src/ui/screens/AccountManagementDemo.tsx +9 -9
- package/src/ui/screens/AccountOverviewScreen.tsx +265 -414
- package/src/ui/screens/AccountSettingsScreen.tsx +1165 -403
- package/src/ui/screens/AccountSwitcherScreen.tsx +158 -202
- package/src/ui/screens/AppInfoScreen.tsx +270 -497
- package/src/ui/screens/FeedbackScreen.tsx +3 -3
- package/src/ui/screens/PaymentGatewayScreen.tsx +668 -365
- package/src/ui/screens/ProfileScreen.tsx +5 -5
- package/src/ui/screens/RecoverAccountScreen.tsx +46 -74
- package/src/ui/screens/SessionManagementScreen.tsx +14 -22
- package/src/ui/screens/SignInScreen.tsx +27 -294
- package/src/ui/screens/SignUpScreen.tsx +5 -5
- package/src/ui/screens/internal/SignInPasswordStep.tsx +11 -22
- package/src/ui/screens/internal/SignInUsernameStep.tsx +3 -10
- package/src/ui/screens/internal/SignUpIdentityStep.tsx +2 -5
- package/src/ui/screens/internal/SignUpSecurityStep.tsx +3 -4
- package/src/ui/stores/authStore.ts +12 -0
- package/src/ui/styles/authStyles.ts +352 -0
- package/src/ui/styles/index.ts +1 -0
- package/lib/commonjs/node/middleware.js +0 -227
- package/lib/commonjs/node/middleware.js.map +0 -1
- package/lib/commonjs/ui/zero-config/index.js +0 -25
- package/lib/commonjs/ui/zero-config/index.js.map +0 -1
- package/lib/commonjs/ui/zero-config/provider.js +0 -278
- package/lib/commonjs/ui/zero-config/provider.js.map +0 -1
- package/lib/module/node/middleware.js +0 -199
- package/lib/module/node/middleware.js.map +0 -1
- package/lib/module/ui/zero-config/index.js +0 -8
- package/lib/module/ui/zero-config/index.js.map +0 -1
- package/lib/module/ui/zero-config/provider.js +0 -270
- package/lib/module/ui/zero-config/provider.js.map +0 -1
- package/lib/typescript/node/middleware.d.ts +0 -92
- package/lib/typescript/node/middleware.d.ts.map +0 -1
- package/lib/typescript/ui/zero-config/index.d.ts +0 -5
- package/lib/typescript/ui/zero-config/index.d.ts.map +0 -1
- package/lib/typescript/ui/zero-config/provider.d.ts +0 -84
- package/lib/typescript/ui/zero-config/provider.d.ts.map +0 -1
- package/src/__tests__/middleware.test.ts +0 -105
- package/src/__tests__/setup.ts +0 -10
- package/src/node/middleware.ts +0 -234
- package/src/ui/zero-config/index.ts +0 -11
- package/src/ui/zero-config/provider.tsx +0 -310
package/README.md
CHANGED
|
@@ -1,347 +1,201 @@
|
|
|
1
1
|
# OxyHQServices
|
|
2
2
|
|
|
3
|
-
A TypeScript client library for the Oxy API providing
|
|
4
|
-
|
|
5
|
-
## ✨ Zero-Config Quick Start
|
|
6
|
-
|
|
7
|
-
### Frontend (React/Next.js) - 2 lines of code:
|
|
8
|
-
|
|
9
|
-
```jsx
|
|
10
|
-
import { OxyZeroConfigProvider, useOxyZeroConfig } from '@oxyhq/services/ui';
|
|
11
|
-
|
|
12
|
-
// 1. Wrap your app
|
|
13
|
-
function App() {
|
|
14
|
-
return (
|
|
15
|
-
<OxyZeroConfigProvider>
|
|
16
|
-
<YourApp />
|
|
17
|
-
</OxyZeroConfigProvider>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// 2. Use authentication anywhere
|
|
22
|
-
function Dashboard() {
|
|
23
|
-
const { user, login, logout, isAuthenticated } = useOxyZeroConfig();
|
|
24
|
-
|
|
25
|
-
if (isAuthenticated) {
|
|
26
|
-
return <div>Welcome {user.username}! <button onClick={logout}>Logout</button></div>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return <button onClick={() => login('user', 'password')}>Login</button>;
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Backend (Express.js) - 1 line of code:
|
|
34
|
-
|
|
35
|
-
```js
|
|
36
|
-
import express from 'express';
|
|
37
|
-
import { createOxyAuth } from '@oxyhq/services/node';
|
|
38
|
-
|
|
39
|
-
const app = express();
|
|
40
|
-
|
|
41
|
-
// Zero-config auth - req.user automatically available
|
|
42
|
-
app.use('/api', createOxyAuth());
|
|
43
|
-
|
|
44
|
-
app.get('/api/profile', (req, res) => {
|
|
45
|
-
res.json({ user: req.user }); // req.user populated automatically!
|
|
46
|
-
});
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
**That's it!** No complex configuration, no manual token management, no middleware setup.
|
|
3
|
+
A TypeScript client library for the Oxy API providing authentication, user management, and UI components for React and React Native applications.
|
|
50
4
|
|
|
51
5
|
## Table of Contents
|
|
52
6
|
|
|
53
|
-
- [Zero-Config Guide](#-zero-config-quick-start)
|
|
54
7
|
- [Features](#features)
|
|
55
|
-
- [
|
|
56
|
-
- [Complete Examples](#complete-examples)
|
|
57
|
-
- [Advanced Usage](#advanced-usage)
|
|
8
|
+
- [Quick Start](#quick-start)
|
|
58
9
|
- [Documentation](#documentation)
|
|
59
|
-
- [
|
|
10
|
+
- [UI Components](#ui-components)
|
|
11
|
+
- [Package Exports](#package-exports)
|
|
12
|
+
- [Requirements](#requirements)
|
|
13
|
+
- [Development](#development)
|
|
14
|
+
- [Integration](#integration)
|
|
15
|
+
- [License](#license)
|
|
60
16
|
|
|
61
17
|
## Features
|
|
62
18
|
|
|
63
|
-
-
|
|
64
|
-
-
|
|
19
|
+
- 🔐 **Streamlined Authentication**: Zero-config authentication with automatic token management
|
|
20
|
+
- 🔄 **Auto Token Refresh**: Seamless token lifecycle management behind the scenes
|
|
65
21
|
- 👥 **User Management**: Profile operations and social features
|
|
66
|
-
- 🎨 **UI Components**: Pre-built React components for common functionality
|
|
22
|
+
- 🎨 **UI Components**: Pre-built React components for common functionality
|
|
67
23
|
- 📱 **Cross-Platform**: Works in React Native and web applications
|
|
68
24
|
- 🔧 **TypeScript**: Full type safety and IntelliSense support
|
|
69
|
-
-
|
|
70
|
-
- 📦 **Express Middleware**: One-line backend authentication with `req.user` support
|
|
25
|
+
- 🚀 **Performance**: Optimized with automatic caching and state management
|
|
71
26
|
|
|
72
|
-
##
|
|
27
|
+
## Quick Start
|
|
73
28
|
|
|
74
29
|
```bash
|
|
75
30
|
npm install @oxyhq/services
|
|
76
31
|
```
|
|
77
32
|
|
|
78
|
-
|
|
33
|
+
### Streamlined Authentication (Recommended)
|
|
79
34
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
**App.js**
|
|
83
|
-
```jsx
|
|
84
|
-
import React from 'react';
|
|
85
|
-
import { OxyZeroConfigProvider } from '@oxyhq/services/ui';
|
|
86
|
-
import Dashboard from './Dashboard';
|
|
35
|
+
```typescript
|
|
36
|
+
import { OxyProvider, useOxy } from '@oxyhq/services';
|
|
87
37
|
|
|
88
|
-
|
|
38
|
+
function App() {
|
|
89
39
|
return (
|
|
90
|
-
<
|
|
91
|
-
<
|
|
92
|
-
</
|
|
40
|
+
<OxyProvider baseURL="https://api.example.com">
|
|
41
|
+
<YourApp />
|
|
42
|
+
</OxyProvider>
|
|
93
43
|
);
|
|
94
44
|
}
|
|
45
|
+
|
|
46
|
+
function UserProfile() {
|
|
47
|
+
const { oxyServices } = useOxy();
|
|
48
|
+
|
|
49
|
+
const fetchData = async () => {
|
|
50
|
+
// No manual authentication needed - everything is automatic!
|
|
51
|
+
const user = await oxyServices.getCurrentUser();
|
|
52
|
+
const notifications = await oxyServices.getNotifications();
|
|
53
|
+
};
|
|
54
|
+
}
|
|
95
55
|
```
|
|
96
56
|
|
|
97
|
-
|
|
98
|
-
```jsx
|
|
99
|
-
import React from 'react';
|
|
100
|
-
import { useOxyZeroConfig } from '@oxyhq/services/ui';
|
|
57
|
+
### With Built-in Bottom Sheet
|
|
101
58
|
|
|
102
|
-
|
|
103
|
-
const { user, login, logout, isAuthenticated, isLoading } = useOxyZeroConfig();
|
|
59
|
+
The OxyProvider now includes a built-in gorhom bottom sheet - no manual setup required!
|
|
104
60
|
|
|
105
|
-
|
|
61
|
+
```typescript
|
|
62
|
+
import { OxyProvider, useOxy, OxySignInButton } from '@oxyhq/services';
|
|
106
63
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
64
|
+
function App() {
|
|
65
|
+
return (
|
|
66
|
+
<OxyProvider
|
|
67
|
+
baseURL="https://api.example.com"
|
|
68
|
+
initialScreen="SignIn"
|
|
69
|
+
theme="light"
|
|
70
|
+
>
|
|
71
|
+
<YourApp />
|
|
72
|
+
</OxyProvider>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
115
75
|
|
|
76
|
+
function Component() {
|
|
77
|
+
const { showBottomSheet } = useOxy();
|
|
78
|
+
|
|
79
|
+
const openSignIn = () => {
|
|
80
|
+
showBottomSheet('SignIn'); // Works automatically!
|
|
81
|
+
};
|
|
82
|
+
|
|
116
83
|
return (
|
|
117
84
|
<div>
|
|
118
|
-
<
|
|
119
|
-
<
|
|
85
|
+
<button onClick={openSignIn}>Sign In</button>
|
|
86
|
+
<OxySignInButton /> {/* Also works automatically! */}
|
|
120
87
|
</div>
|
|
121
88
|
);
|
|
122
89
|
}
|
|
123
90
|
```
|
|
124
91
|
|
|
125
|
-
###
|
|
92
|
+
### Traditional Usage
|
|
126
93
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
import express from 'express';
|
|
130
|
-
import { createOxyAuth } from '@oxyhq/services/node';
|
|
131
|
-
|
|
132
|
-
const app = express();
|
|
133
|
-
app.use(express.json());
|
|
94
|
+
```typescript
|
|
95
|
+
import { OxyServices } from '@oxyhq/services';
|
|
134
96
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
res.json({ message: 'Public endpoint' });
|
|
97
|
+
const oxy = new OxyServices({
|
|
98
|
+
baseURL: 'http://localhost:3000'
|
|
138
99
|
});
|
|
139
100
|
|
|
140
|
-
//
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
app.get('/api/profile', (req, res) => {
|
|
145
|
-
res.json({
|
|
146
|
-
message: `Hello ${req.user.username}!`,
|
|
147
|
-
user: req.user
|
|
148
|
-
});
|
|
101
|
+
// Authenticate
|
|
102
|
+
const response = await oxy.auth.login({
|
|
103
|
+
email: 'user@example.com',
|
|
104
|
+
password: 'password'
|
|
149
105
|
});
|
|
150
106
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
### Next.js Full-Stack
|
|
155
|
-
|
|
156
|
-
**pages/_app.js**
|
|
157
|
-
```jsx
|
|
158
|
-
import { OxyZeroConfigProvider } from '@oxyhq/services/ui';
|
|
159
|
-
|
|
160
|
-
export default function App({ Component, pageProps }) {
|
|
161
|
-
return (
|
|
162
|
-
<OxyZeroConfigProvider>
|
|
163
|
-
<Component {...pageProps} />
|
|
164
|
-
</OxyZeroConfigProvider>
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
**pages/api/user.js**
|
|
170
|
-
```js
|
|
171
|
-
import { createOxyAuth } from '@oxyhq/services/node';
|
|
172
|
-
|
|
173
|
-
const auth = createOxyAuth();
|
|
174
|
-
|
|
175
|
-
export default async function handler(req, res) {
|
|
176
|
-
// Apply authentication
|
|
177
|
-
await new Promise((resolve, reject) => {
|
|
178
|
-
auth(req, res, (err) => {
|
|
179
|
-
if (err) reject(err);
|
|
180
|
-
else resolve();
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
// req.user is now available
|
|
185
|
-
res.json({ user: req.user });
|
|
186
|
-
}
|
|
107
|
+
// Get current user
|
|
108
|
+
const user = await oxy.users.getCurrentUser();
|
|
187
109
|
```
|
|
188
110
|
|
|
189
|
-
##
|
|
190
|
-
|
|
191
|
-
### Configuration Options
|
|
192
|
-
|
|
193
|
-
**Frontend**
|
|
194
|
-
```jsx
|
|
195
|
-
<OxyZeroConfigProvider
|
|
196
|
-
apiUrl="https://your-api.com"
|
|
197
|
-
onAuthChange={(user) => console.log('Auth changed:', user)}
|
|
198
|
-
>
|
|
199
|
-
<App />
|
|
200
|
-
</OxyZeroConfigProvider>
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
**Backend**
|
|
204
|
-
```js
|
|
205
|
-
app.use('/api', createOxyAuth({
|
|
206
|
-
baseURL: 'https://your-oxy-api.com',
|
|
207
|
-
loadUser: true,
|
|
208
|
-
publicPaths: ['/api/health'],
|
|
209
|
-
onError: (error, req, res) => {
|
|
210
|
-
res.status(error.status).json({ error: error.message });
|
|
211
|
-
}
|
|
212
|
-
}));
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
### Direct API Access
|
|
216
|
-
|
|
217
|
-
```jsx
|
|
218
|
-
import { useOxyApi } from '@oxyhq/services/ui';
|
|
219
|
-
|
|
220
|
-
function ProfileForm() {
|
|
221
|
-
const api = useOxyApi();
|
|
222
|
-
|
|
223
|
-
const updateProfile = async (data) => {
|
|
224
|
-
const user = await api.updateProfile(data);
|
|
225
|
-
// Token automatically included in request
|
|
226
|
-
};
|
|
111
|
+
## Documentation
|
|
227
112
|
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
```
|
|
113
|
+
For comprehensive documentation, API reference, and examples:
|
|
231
114
|
|
|
232
|
-
|
|
115
|
+
- [📚 Full Documentation](./docs/README.md)
|
|
116
|
+
- [🚀 Quick Start Guide](./docs/quick-start.md)
|
|
117
|
+
- [🔐 Core API Reference](./docs/core-api.md)
|
|
118
|
+
- [⚡ Streamlined Authentication](./docs/core-api.md#streamlined-authentication) - **NEW!**
|
|
119
|
+
- [💼 Integration Examples](./docs/examples/)
|
|
233
120
|
|
|
234
|
-
|
|
235
|
-
import { createOptionalOxyAuth } from '@oxyhq/services/node';
|
|
121
|
+
## UI Components
|
|
236
122
|
|
|
237
|
-
|
|
238
|
-
app.use('/api/content', createOptionalOxyAuth());
|
|
123
|
+
Import and use pre-built React components:
|
|
239
124
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
res.json({ content: 'personalized', user: req.user });
|
|
243
|
-
} else {
|
|
244
|
-
res.json({ content: 'public' });
|
|
245
|
-
}
|
|
246
|
-
});
|
|
125
|
+
```typescript
|
|
126
|
+
import { OxyProvider, Avatar, FollowButton } from '@oxyhq/services/ui';
|
|
247
127
|
```
|
|
248
128
|
|
|
249
|
-
##
|
|
250
|
-
|
|
251
|
-
### Zero-Config Guide
|
|
252
|
-
- **[🚀 Zero-Config Setup Guide](./docs/zero-config.md)** - Complete guide with examples
|
|
253
|
-
|
|
254
|
-
### Advanced Documentation
|
|
255
|
-
- **[📚 Full Documentation](./docs/README.md)** - Complete system documentation
|
|
256
|
-
- **[🚀 Quick Start Guide](./docs/quick-start.md)** - Traditional setup guide
|
|
257
|
-
- **[🔐 Core API Reference](./docs/core-api.md)** - Detailed API documentation
|
|
258
|
-
- **[💼 Integration Examples](./docs/examples/)** - More integration examples
|
|
259
|
-
|
|
260
|
-
### UI Components
|
|
261
|
-
- **[🎨 UI Components Guide](./docs/ui-components.md)** - React/RN component usage
|
|
129
|
+
## Package Exports
|
|
262
130
|
|
|
263
|
-
|
|
131
|
+
The library provides multiple entry points:
|
|
264
132
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
**Before (complex setup):**
|
|
268
|
-
```jsx
|
|
269
|
-
import { OxyProvider, useOxy } from '@oxyhq/services/ui';
|
|
133
|
+
```typescript
|
|
134
|
+
// Core services only (Node.js/Express)
|
|
270
135
|
import { OxyServices } from '@oxyhq/services';
|
|
271
136
|
|
|
272
|
-
|
|
137
|
+
// UI components only (React/React Native)
|
|
138
|
+
import { OxyProvider, Avatar } from '@oxyhq/services/ui';
|
|
273
139
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
<OxyProvider oxyServices={oxy}>
|
|
277
|
-
<Dashboard />
|
|
278
|
-
</OxyProvider>
|
|
279
|
-
);
|
|
280
|
-
}
|
|
140
|
+
// Full package (Core + UI)
|
|
141
|
+
import { OxyServices, OxyProvider } from '@oxyhq/services/full';
|
|
281
142
|
```
|
|
282
143
|
|
|
283
|
-
|
|
284
|
-
```jsx
|
|
285
|
-
import { OxyZeroConfigProvider, useOxyZeroConfig } from '@oxyhq/services/ui';
|
|
144
|
+
## Zero-Config Express Router
|
|
286
145
|
|
|
287
|
-
|
|
288
|
-
return (
|
|
289
|
-
<OxyZeroConfigProvider>
|
|
290
|
-
<Dashboard />
|
|
291
|
-
</OxyZeroConfigProvider>
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
Just change the provider and hook names - the API is nearly identical!
|
|
297
|
-
|
|
298
|
-
### Package Exports
|
|
299
|
-
|
|
300
|
-
The library provides multiple entry points for different use cases:
|
|
146
|
+
Quickly mount authentication routes in any Express app:
|
|
301
147
|
|
|
302
148
|
```typescript
|
|
303
|
-
|
|
304
|
-
import {
|
|
305
|
-
|
|
306
|
-
// Zero-config backend
|
|
307
|
-
import { createOxyAuth } from '@oxyhq/services/node';
|
|
308
|
-
|
|
309
|
-
// Core services only (traditional)
|
|
310
|
-
import { OxyServices } from '@oxyhq/services';
|
|
149
|
+
import express from 'express';
|
|
150
|
+
import { createAuth } from '@oxyhq/services/core';
|
|
311
151
|
|
|
312
|
-
|
|
313
|
-
|
|
152
|
+
const app = express();
|
|
153
|
+
app.use('/auth', createAuth({ baseURL: 'http://localhost:3000' }).middleware());
|
|
314
154
|
```
|
|
315
155
|
|
|
156
|
+
This automatically provides sign-up, login, logout, refresh, and session management endpoints.
|
|
157
|
+
|
|
316
158
|
## Requirements
|
|
317
159
|
|
|
318
160
|
- **Node.js** 16+ (for backend usage)
|
|
319
|
-
- **React** 16.8+ (for React components)
|
|
161
|
+
- **React** 16.8+ (for React components)
|
|
320
162
|
- **React Native** 0.60+ (for mobile components)
|
|
321
163
|
- **TypeScript** 4.0+ (optional but recommended)
|
|
322
164
|
|
|
323
165
|
## Troubleshooting
|
|
324
166
|
|
|
325
|
-
###
|
|
167
|
+
### FormData Issues in React Native/Expo
|
|
168
|
+
|
|
169
|
+
If you encounter `ReferenceError: Property 'FormData' doesn't exist` when using Expo with Hermes engine:
|
|
170
|
+
|
|
171
|
+
**For file uploads in React Native/Expo:**
|
|
172
|
+
- The library handles this automatically - no additional setup required
|
|
173
|
+
- File uploads will work with both native FormData (when available) and the polyfilled version
|
|
174
|
+
- Ensure you're using the latest version of the package
|
|
175
|
+
|
|
176
|
+
### Additional Dependencies
|
|
177
|
+
|
|
178
|
+
For React Native projects, you may need to install peer dependencies:
|
|
326
179
|
|
|
327
|
-
|
|
328
|
-
|
|
180
|
+
```bash
|
|
181
|
+
npm install axios jwt-decode invariant
|
|
182
|
+
```
|
|
329
183
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
184
|
+
## Important for React Native Hermes Users
|
|
185
|
+
|
|
186
|
+
If you use this package in a React Native app with the Hermes engine, you must add the following import as the very first line of your app's entry file (e.g., App.js or index.js):
|
|
333
187
|
|
|
334
|
-
**FormData Issues in React Native/Expo**
|
|
335
|
-
Add this import as the first line of your app entry file:
|
|
336
188
|
```js
|
|
337
189
|
import 'react-native-url-polyfill/auto';
|
|
338
190
|
```
|
|
339
191
|
|
|
340
|
-
|
|
192
|
+
This ensures that FormData and other web APIs are polyfilled before any dependencies are loaded. If you do not do this, you may see errors like:
|
|
341
193
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
194
|
+
```
|
|
195
|
+
ReferenceError: Property 'FormData' doesn't exist, js engine: hermes
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
345
199
|
|
|
346
200
|
## Development
|
|
347
201
|
|
|
@@ -352,17 +206,20 @@ npm install
|
|
|
352
206
|
# Build the library
|
|
353
207
|
npm run build
|
|
354
208
|
|
|
355
|
-
# Run tests
|
|
209
|
+
# Run tests
|
|
356
210
|
npm test
|
|
211
|
+
|
|
212
|
+
# Development mode
|
|
213
|
+
npm run dev
|
|
357
214
|
```
|
|
358
215
|
|
|
359
216
|
## Integration
|
|
360
217
|
|
|
361
218
|
This library works with:
|
|
362
|
-
- **[Oxy API](../api/)** - The companion authentication server
|
|
363
|
-
- **Express.js** - Built-in
|
|
364
|
-
- **React/React Native** -
|
|
365
|
-
- **Next.js** - SSR/SSG authentication
|
|
219
|
+
- **[Oxy API](../oxy-api/)** - The companion authentication server
|
|
220
|
+
- **Express.js** - Built-in middleware support
|
|
221
|
+
- **React/React Native** - UI components and hooks
|
|
222
|
+
- **Next.js** - SSR/SSG authentication
|
|
366
223
|
|
|
367
224
|
## License
|
|
368
225
|
|
|
@@ -516,9 +516,17 @@ class OxyServices {
|
|
|
516
516
|
*/
|
|
517
517
|
async getCurrentUser() {
|
|
518
518
|
try {
|
|
519
|
+
console.log('OxyServices: Fetching current user...');
|
|
519
520
|
const res = await this.client.get('/users/me');
|
|
521
|
+
console.log('OxyServices: Current user response:', {
|
|
522
|
+
hasUser: !!res.data,
|
|
523
|
+
userLinksMetadata: res.data?.linksMetadata,
|
|
524
|
+
userLinks: res.data?.links,
|
|
525
|
+
userWebsite: res.data?.website
|
|
526
|
+
});
|
|
520
527
|
return res.data;
|
|
521
528
|
} catch (error) {
|
|
529
|
+
console.error('OxyServices: Error fetching current user:', error);
|
|
522
530
|
throw this.handleError(error);
|
|
523
531
|
}
|
|
524
532
|
}
|
|
@@ -530,9 +538,12 @@ class OxyServices {
|
|
|
530
538
|
*/
|
|
531
539
|
async updateProfile(updates) {
|
|
532
540
|
try {
|
|
541
|
+
console.log('OxyServices: Updating profile with:', updates);
|
|
533
542
|
const res = await this.client.put('/users/me', updates);
|
|
543
|
+
console.log('OxyServices: Profile update response:', res.data);
|
|
534
544
|
return res.data;
|
|
535
545
|
} catch (error) {
|
|
546
|
+
console.error('OxyServices: Error updating profile:', error);
|
|
536
547
|
throw this.handleError(error);
|
|
537
548
|
}
|
|
538
549
|
}
|
|
@@ -1246,10 +1257,13 @@ class OxyServices {
|
|
|
1246
1257
|
* @returns Array of user sessions
|
|
1247
1258
|
*/
|
|
1248
1259
|
async getSessionsBySessionId(sessionId) {
|
|
1260
|
+
console.log('getSessionsBySessionId called with sessionId:', sessionId);
|
|
1249
1261
|
try {
|
|
1250
1262
|
const res = await this.client.get(`/secure-session/sessions/${sessionId}`);
|
|
1263
|
+
console.log('getSessionsBySessionId response:', res.data);
|
|
1251
1264
|
return res.data.sessions;
|
|
1252
1265
|
} catch (error) {
|
|
1266
|
+
console.error('getSessionsBySessionId error:', error);
|
|
1253
1267
|
throw this.handleError(error);
|
|
1254
1268
|
}
|
|
1255
1269
|
}
|
|
@@ -1718,6 +1732,164 @@ class OxyServices {
|
|
|
1718
1732
|
throw this.handleError(error);
|
|
1719
1733
|
}
|
|
1720
1734
|
}
|
|
1735
|
+
|
|
1736
|
+
/**
|
|
1737
|
+
* Fetch metadata for a URL (title, description, image)
|
|
1738
|
+
* @param url - The URL to fetch metadata for
|
|
1739
|
+
* @returns Promise with metadata object
|
|
1740
|
+
*/
|
|
1741
|
+
async fetchLinkMetadata(url) {
|
|
1742
|
+
try {
|
|
1743
|
+
const response = await this.client.post('/link-metadata/fetch-metadata', {
|
|
1744
|
+
url
|
|
1745
|
+
});
|
|
1746
|
+
return response.data;
|
|
1747
|
+
} catch (error) {
|
|
1748
|
+
throw this.handleError(error);
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
/**
|
|
1753
|
+
* Search for locations using the enhanced location search API
|
|
1754
|
+
* @param query - Search query string
|
|
1755
|
+
* @param limit - Maximum number of results (default: 5)
|
|
1756
|
+
* @param countrycodes - Optional country codes filter (e.g., "us,ca")
|
|
1757
|
+
* @returns Promise with array of location results
|
|
1758
|
+
*/
|
|
1759
|
+
async searchLocations(query, limit = 5, countrycodes) {
|
|
1760
|
+
try {
|
|
1761
|
+
const params = new URLSearchParams({
|
|
1762
|
+
query,
|
|
1763
|
+
limit: limit.toString()
|
|
1764
|
+
});
|
|
1765
|
+
if (countrycodes) {
|
|
1766
|
+
params.append('countrycodes', countrycodes);
|
|
1767
|
+
}
|
|
1768
|
+
const res = await this.client.get(`/location-search/search?${params.toString()}`);
|
|
1769
|
+
return res.data.results;
|
|
1770
|
+
} catch (error) {
|
|
1771
|
+
throw this.handleError(error);
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
/**
|
|
1776
|
+
* Get detailed information about a specific location by coordinates
|
|
1777
|
+
* @param lat - Latitude
|
|
1778
|
+
* @param lon - Longitude
|
|
1779
|
+
* @returns Promise with detailed location information
|
|
1780
|
+
*/
|
|
1781
|
+
async getLocationDetails(lat, lon) {
|
|
1782
|
+
try {
|
|
1783
|
+
const res = await this.client.get(`/location-search/details?lat=${lat}&lon=${lon}`);
|
|
1784
|
+
return res.data.result;
|
|
1785
|
+
} catch (error) {
|
|
1786
|
+
throw this.handleError(error);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
/**
|
|
1791
|
+
* Find locations near a point using geospatial queries
|
|
1792
|
+
* @param lat - Latitude
|
|
1793
|
+
* @param lon - Longitude
|
|
1794
|
+
* @param maxDistance - Maximum distance in meters (default: 10000)
|
|
1795
|
+
* @param limit - Maximum number of results (default: 10)
|
|
1796
|
+
* @param skip - Number of results to skip (default: 0)
|
|
1797
|
+
* @returns Promise with nearby locations
|
|
1798
|
+
*/
|
|
1799
|
+
async findLocationsNear(lat, lon, maxDistance = 10000, limit = 10, skip = 0) {
|
|
1800
|
+
try {
|
|
1801
|
+
const params = new URLSearchParams({
|
|
1802
|
+
lat: lat.toString(),
|
|
1803
|
+
lon: lon.toString(),
|
|
1804
|
+
maxDistance: maxDistance.toString(),
|
|
1805
|
+
limit: limit.toString(),
|
|
1806
|
+
skip: skip.toString()
|
|
1807
|
+
});
|
|
1808
|
+
const res = await this.client.get(`/location-search/near?${params.toString()}`);
|
|
1809
|
+
return res.data;
|
|
1810
|
+
} catch (error) {
|
|
1811
|
+
throw this.handleError(error);
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
/**
|
|
1816
|
+
* Search locations in database by text
|
|
1817
|
+
* @param query - Search query
|
|
1818
|
+
* @param limit - Maximum number of results (default: 10)
|
|
1819
|
+
* @param skip - Number of results to skip (default: 0)
|
|
1820
|
+
* @param type - Filter by location type
|
|
1821
|
+
* @param country - Filter by country
|
|
1822
|
+
* @param city - Filter by city
|
|
1823
|
+
* @returns Promise with search results
|
|
1824
|
+
*/
|
|
1825
|
+
async searchLocationsInDB(query, limit = 10, skip = 0, type, country, city) {
|
|
1826
|
+
try {
|
|
1827
|
+
const params = new URLSearchParams({
|
|
1828
|
+
query,
|
|
1829
|
+
limit: limit.toString(),
|
|
1830
|
+
skip: skip.toString()
|
|
1831
|
+
});
|
|
1832
|
+
if (type) params.append('type', type);
|
|
1833
|
+
if (country) params.append('country', country);
|
|
1834
|
+
if (city) params.append('city', city);
|
|
1835
|
+
const res = await this.client.get(`/location-search/db-search?${params.toString()}`);
|
|
1836
|
+
return res.data;
|
|
1837
|
+
} catch (error) {
|
|
1838
|
+
throw this.handleError(error);
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
/**
|
|
1843
|
+
* Get location statistics
|
|
1844
|
+
* @returns Promise with location statistics
|
|
1845
|
+
*/
|
|
1846
|
+
async getLocationStats() {
|
|
1847
|
+
try {
|
|
1848
|
+
const res = await this.client.get('/location-search/stats');
|
|
1849
|
+
return res.data.stats;
|
|
1850
|
+
} catch (error) {
|
|
1851
|
+
throw this.handleError(error);
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
/**
|
|
1856
|
+
* Get cache statistics
|
|
1857
|
+
* @returns Promise with cache statistics
|
|
1858
|
+
*/
|
|
1859
|
+
async getLocationCacheStats() {
|
|
1860
|
+
try {
|
|
1861
|
+
const res = await this.client.get('/location-search/cache/stats');
|
|
1862
|
+
return res.data.stats;
|
|
1863
|
+
} catch (error) {
|
|
1864
|
+
throw this.handleError(error);
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
/**
|
|
1869
|
+
* Clear location cache
|
|
1870
|
+
* @returns Promise with success status
|
|
1871
|
+
*/
|
|
1872
|
+
async clearLocationCache() {
|
|
1873
|
+
try {
|
|
1874
|
+
const res = await this.client.delete('/location-search/cache');
|
|
1875
|
+
return res.data;
|
|
1876
|
+
} catch (error) {
|
|
1877
|
+
throw this.handleError(error);
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
/**
|
|
1882
|
+
* Get performance statistics
|
|
1883
|
+
* @returns Promise with performance statistics
|
|
1884
|
+
*/
|
|
1885
|
+
async getLocationPerformanceStats() {
|
|
1886
|
+
try {
|
|
1887
|
+
const res = await this.client.get('/location-search/performance');
|
|
1888
|
+
return res.data;
|
|
1889
|
+
} catch (error) {
|
|
1890
|
+
throw this.handleError(error);
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1721
1893
|
}
|
|
1722
1894
|
|
|
1723
1895
|
// Default export for backward compatibility
|