@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/README.md CHANGED
@@ -29,153 +29,32 @@ The `@oxyhq/services` package provides a simple, promise-based client to interac
29
29
  - Analytics & content insights (time‑series data, viewers, follower stats)
30
30
  - Karma system (leaderboard, rules, award/deduct points)
31
31
 
32
- This library is framework-agnostic and works in Node.js, browser, and React Native environments.
32
+ ## What's New in 5.1.5
33
+
34
+ - **Fixed BottomSheet on Native Platforms**: The `OxyProvider` component now correctly displays the authentication UI in a bottom sheet on native platforms.
35
+ - **Added Bottom Sheet Controls**: The `OxyProvider` component now provides methods via context (`showBottomSheet`, `hideBottomSheet`) for programmatic control of the bottom sheet.
36
+ - **Improved Native Animations**: Enhanced animation and layout behavior for a smoother experience on all platforms.
33
37
 
34
38
  ## Installation
35
39
 
36
40
  ```bash
37
- npm install @oxyhq/services axios jwt-decode
38
- ```
39
-
40
- > **Peer Dependencies**: React, React Native, and optional storage libraries if used in mobile apps.
41
-
42
- ## Usage
43
-
44
- ```typescript
45
- import OxyServices, { OxyConfig } from '@oxyhq/services';
46
-
47
- const config: OxyConfig = { baseURL: 'https://api.mention.earth' };
48
- const client = new OxyServices(config);
49
-
50
- // Authenticate and start using API
51
- (async () => {
52
- const login = await client.login('alice', 'Secret123!');
53
- console.log('Logged in user:', login.user);
54
- const profile = await client.getProfileByUsername('bob');
55
- console.log('Bob’s profile:', profile);
56
- })();
57
- ```
58
-
59
- ## Configuration
60
-
61
- `OxyConfig`:
41
+ # npm
42
+ npm install @oxyhq/services
62
43
 
63
- ```ts
64
- interface OxyConfig {
65
- /** Base URL of the Oxy API, e.g. https://api.mention.earth */
66
- baseURL: string;
67
- /** Optional timeout in milliseconds (default: 0 for no timeout) */
68
- timeout?: number;
69
- }
44
+ # yarn
45
+ yarn add @oxyhq/services
70
46
  ```
71
47
 
72
- - Requests use `axios` under the hood. You can set `timeout` or other axios defaults via config or by accessing `client.client.defaults`.
73
- - Tokens are stored in-memory; for persistence (e.g. React Native storage), handle saving and restoring external to this library.
48
+ ### Required Peer Dependencies
74
49
 
75
- ## API Reference
76
-
77
- ### OxyConfig
78
-
79
- | Property | Type | Required | Description |
80
- | -------- | --------- | -------- | ------------------------------------- |
81
- | baseURL | `string` | Yes | Root URL of the Oxy API server |
82
- | timeout | `number` | No | Request timeout in milliseconds |
83
-
84
- ### Class: OxyServices
85
-
86
- Instantiate with:
87
- ```ts
88
- const client = new OxyServices(config);
89
- ```
90
-
91
- #### Authentication
92
-
93
- | Method | Signature | Description |
94
- | -------------------- | ----------------------------------------------------------- | ---------------------------------------------- |
95
- | `signUp` | `(username: string, email: string, password: string) => Promise<{ message: string; token: string; user: User }>` | Create a new user and receive a token |
96
- | `login` | `(username: string, password: string) => Promise<LoginResponse>` | Authenticate and store access & refresh tokens |
97
- | `logout` | `() => Promise<void>` | Revoke current refresh token |
98
- | `refreshTokens` | `() => Promise<{ accessToken: string; refreshToken: string }>` | Obtain new tokens using stored refresh token |
99
- | `validate` | `() => Promise<boolean>` | Check if current access token is valid |
100
-
101
- #### User & Profiles
102
-
103
- | Method | Signature | Description |
104
- | ---------------------------- | ----------------------------------------------- | -------------------------------------------------------------------------- |
105
- | `getProfileByUsername` | `(username: string) => Promise<any>` | Fetch public profile by username |
106
- | `searchProfiles` | `(query: string, limit?: number, offset?: number) => Promise<any[]>` | Full-text search for profiles |
107
- | `getUserById` | `(userId: string) => Promise<any>` | Fetch user data by user ID |
108
- | `updateUser` | `(userId: string, updates: Record<string, any>) => Promise<any>` | Update fields on authenticated user profile |
109
- | `followUser` / `unfollowUser`| `(userId: string) => Promise<any>` | Toggle following relationship with target user |
110
-
111
- #### Notifications
112
-
113
- | Method | Signature | Description |
114
- | ------------------------------- | ----------------------------------------- | ----------------------------------------- |
115
- | `getNotifications` | `() => Promise<Notification[]>` | Retrieve all notifications for current user|
116
- | `getUnreadCount` | `() => Promise<number>` | Count unread notifications |
117
- | `createNotification` | `(data: Partial<Notification>) => Promise<Notification>` | (Admin) create custom notification |
118
- | `markNotificationAsRead` | `(id: string) => Promise<void>` | Mark one notification as read |
119
- | `markAllNotificationsAsRead` | `() => Promise<void>` | Mark all notifications as read |
120
- | `deleteNotification` | `(id: string) => Promise<void>` | Delete a notification |
121
-
122
- #### Payments & Wallet
123
-
124
- | Method | Signature | Description |
125
- | ------------------------ | --------------------------------------------------------------- | ---------------------------------------- |
126
- | `processPayment` | `(data: { userId: string; plan: string; paymentMethod: any; platform: string }) => Promise<{ success: boolean; transactionId: string }>` | Charge user for subscription or plan |
127
- | `validatePaymentMethod` | `(paymentMethod: any) => Promise<{ valid: boolean }>` | Pre-validate payment method |
128
- | `getPaymentMethods` | `(userId: string) => Promise<any>` | List saved payment methods |
129
- | `getWallet` | `(userId: string) => Promise<any>` | Fetch or initialize wallet balance |
130
- | `getTransactionHistory` | `(userId: string, limit?: number, offset?: number) => Promise<any>` | Retrieve paginated transaction history |
131
- | `getTransaction` | `(transactionId: string) => Promise<any>` | Fetch details for a specific transaction |
132
- | `transferFunds` | `(data: { fromUserId: string; toUserId: string; amount: number; description?: string }) => Promise<any>` | Transfer funds between users |
133
- | `processPurchase` | `(data: { userId: string; amount: number; itemId: string; itemType: string; description?: string }) => Promise<any>` | Debit wallet for an in‑app purchase |
134
- | `requestWithdrawal` | `(data: { userId: string; amount: number; address: string }) => Promise<any>` | Initiate a withdrawal request |
135
-
136
- #### Analytics
137
-
138
- | Method | Signature | Description |
139
- | ------------------------ | -------------------------------------------------------------- | ----------------------------------------- |
140
- | `getAnalytics` | `(userId: string, period?: string) => Promise<any>` | Time‑series metrics for a user |
141
- | `updateAnalytics` | `(userId: string, type: string, data: Record<string, any>) => Promise<{ message: string }>` | Increment analytics counters |
142
- | `getContentViewers` | `(userId: string, period?: string) => Promise<any[]>` | List viewers of user content |
143
- | `getFollowerDetails` | `(userId: string, period?: string) => Promise<any>` | Insights on follower growth |
144
-
145
- #### Karma System
146
-
147
- | Method | Signature | Description |
148
- | --------------------------- | ----------------------------------------------------------- | --------------------------------------------- |
149
- | `getKarmaLeaderboard` | `() => Promise<any[]>` | Global leaderboard of top karma earners |
150
- | `getKarmaRules` | `() => Promise<any[]>` | List configured karma rules |
151
- | `getUserKarmaTotal` | `(userId: string) => Promise<{ total: number }>` | Fetch total karma for a user |
152
- | `getUserKarmaHistory` | `(userId: string, limit?: number, offset?: number) => Promise<any>` | User’s karma event history |
153
- | `awardKarma` / `deductKarma`| `(data: { userId: string; points: number; reason?: string }) => Promise<any>` | Modify user karma (requires auth) |
154
- | `createOrUpdateKarmaRule` | `(data: any) => Promise<any>` | (Admin) define or update karma rules |
155
-
156
- ## Examples
157
-
158
- See usage in the [Fast Start](#usage) section above. For advanced scenarios (e.g., external token storage, Axios customization), refer to source code: `src/index.ts`.
159
-
160
- ## Development
50
+ For React Native applications using the bottom sheet authentication UI:
161
51
 
162
52
  ```bash
163
- # Install dev deps
164
- tonpm install
165
- # Build library
166
- npm run build
167
- # Run tests (no tests by default)
168
- npm test
169
- ```
170
-
171
- ## Contributing
53
+ # npm
54
+ npm install react-native-gesture-handler react-native-reanimated react-native-safe-area-context
172
55
 
173
- 1. Fork the repo
174
- 2. Create feature branch
175
- 3. Code and add tests
176
- 4. Build and commit
177
- 5. Open PR for review
178
-
179
- ## License
56
+ # yarn
57
+ yarn add react-native-gesture-handler react-native-reanimated react-native-safe-area-context
58
+ ```
180
59
 
181
- MIT © Oxy
60
+ Note: The bottom sheet is now managed internally by the package, so you no longer need to install `@gorhom/bottom-sheet` directly.
@@ -0,0 +1,143 @@
1
+ # OxyHQ Services UI Components
2
+
3
+ This document provides details about the UI components available in the `@oxyhq/services` package.
4
+
5
+ ## Table of Contents
6
+
7
+ - [OxyProvider](#oxyprovider)
8
+ - [OxySignInButton](#oxysigninbutton)
9
+ - [OxyLogo](#oxylogo)
10
+ - [Avatar](#avatar)
11
+
12
+ ## OxyProvider
13
+
14
+ The main provider component that manages authentication state and exposes the bottom sheet for sign-in, sign-up, and account management.
15
+
16
+ ```tsx
17
+ import { OxyProvider } from '@oxyhq/services';
18
+
19
+ // In your app
20
+ <OxyProvider
21
+ oxyServices={oxyServicesInstance}
22
+ initialScreen="SignIn"
23
+ autoPresent={false}
24
+ onAuthenticated={(user) => console.log('User authenticated:', user)}
25
+ theme="light"
26
+ >
27
+ {children}
28
+ </OxyProvider>
29
+ ```
30
+
31
+ ### Props
32
+
33
+ | Prop | Type | Required | Description |
34
+ |------|------|----------|-------------|
35
+ | oxyServices | `OxyServices` | Yes | Instance of OxyServices initialized with your API configuration |
36
+ | initialScreen | `'SignIn' \| 'SignUp' \| 'AccountCenter'` | No | Initial screen to display when the sheet opens |
37
+ | autoPresent | `boolean` | No | Whether to automatically present the sheet on mount |
38
+ | onAuthenticated | `(user: User) => void` | No | Callback when a user is authenticated |
39
+ | onClose | `() => void` | No | Callback when the sheet is closed |
40
+ | onAuthStateChange | `(user: User \| null) => void` | No | Callback when auth state changes |
41
+ | storageKeyPrefix | `string` | No | Prefix for stored auth tokens |
42
+ | theme | `'light' \| 'dark'` | No | Theme for the sheet UI |
43
+
44
+ ## OxySignInButton
45
+
46
+ A pre-styled button component for signing in with Oxy services. This component automatically integrates with the OxyProvider context and will control the authentication bottom sheet when pressed.
47
+
48
+ ```tsx
49
+ import { OxySignInButton } from '@oxyhq/services';
50
+
51
+ // Basic usage
52
+ <OxySignInButton />
53
+
54
+ // Custom styling
55
+ <OxySignInButton
56
+ variant="contained"
57
+ style={{ marginTop: 20 }}
58
+ text="Login with Oxy"
59
+ />
60
+
61
+ // Custom handler
62
+ <OxySignInButton onPress={() => {
63
+ // Custom authentication flow
64
+ console.log('Custom auth flow initiated');
65
+ }} />
66
+ ```
67
+
68
+ ### Props
69
+
70
+ | Prop | Type | Default | Description |
71
+ |------|------|---------|-------------|
72
+ | variant | `'default' \| 'outline' \| 'contained'` | `'default'` | Controls the appearance of the button |
73
+ | onPress | `() => void` | `undefined` | Optional function to handle button press, if not provided, the button will use the `showBottomSheet` method from OxyContext |
74
+ | style | `StyleProp<ViewStyle>` | `undefined` | Additional styles for the button container |
75
+ | textStyle | `StyleProp<TextStyle>` | `undefined` | Additional styles for the button text |
76
+ | text | `string` | `'Sign in with Oxy'` | Custom button text |
77
+ | navigationDelay | `number` | `300` | Delay in milliseconds before navigating to SignIn screen after expanding |
78
+ | disabled | `boolean` | `false` | Whether to disable the button |
79
+ | showWhenAuthenticated | `boolean` | `false` | Whether to show the button even if user is already authenticated |
80
+
81
+ ### Design Variants
82
+
83
+ - **Default**: A flat white button with a subtle shadow
84
+ - **Outline**: A transparent button with a colored border
85
+ - **Contained**: A solid colored button with white text
86
+
87
+ ### Behavior
88
+
89
+ By default, the OxySignInButton:
90
+
91
+ 1. Uses the context from OxyProvider to detect if a user is already authenticated
92
+ 2. Only renders if no user is authenticated (unless showWhenAuthenticated is true)
93
+ 3. When pressed, automatically opens the bottom sheet and navigates to the SignIn screen
94
+ 4. Can be customized with your own onPress handler for custom authentication flows
95
+
96
+ ## OxyLogo
97
+
98
+ The Oxy logo component for React Native applications. This is an SVG component that can be used to display the Oxy logo in your app.
99
+
100
+ ```tsx
101
+ import { OxyLogo } from '@oxyhq/services';
102
+
103
+ // Basic usage
104
+ <OxyLogo />
105
+
106
+ // Custom size
107
+ <OxyLogo width={32} height={32} />
108
+
109
+ // With custom style
110
+ <OxyLogo
111
+ width={24}
112
+ height={24}
113
+ style={{ margin: 5 }}
114
+ />
115
+
116
+ // With custom colors
117
+ <OxyLogo
118
+ width={24}
119
+ height={24}
120
+ fillColor="#9c27b0"
121
+ secondaryFillColor="#ce93d8"
122
+ />
123
+ ```
124
+
125
+ ### Props
126
+
127
+ | Prop | Type | Default | Description |
128
+ |------|------|---------|-------------|
129
+ | width | `number` | `24` | Width of the logo in pixels |
130
+ | height | `number` | `24` | Height of the logo in pixels |
131
+ | style | `StyleProp<ViewStyle>` | `undefined` | Additional styles for the logo container |
132
+ | fillColor | `string` | `'#d169e5'` | Primary fill color for the logo |
133
+ | secondaryFillColor | `string` | `'#db85ec'` | Secondary fill color for the inner glow effect |
134
+
135
+ ### Requirements
136
+
137
+ This component requires `react-native-svg` to be installed in your project:
138
+
139
+ ```bash
140
+ npm install react-native-svg
141
+ # or
142
+ yarn add react-native-svg
143
+ ```
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 294.84 174.42"><defs><style>.cls-1{fill:#d169e5;}.cls-2{fill:#fefefe;}</style></defs><path class="cls-2" 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,1c-12.75,1.09-21.09,11.26-22.59,23.5-6.56-7.9-15.05-14.75-25.16-17.42-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"/><path class="cls-1" 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.24c12.25-10.56,29.66-14.3,45.34-10.17,10.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.86ZM234.36,72.83c-.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.21ZM150.69,57.99c-.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.86s-12.51-64.81-45.7-62.54ZM195.7,113.99c.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"/><path class="cls-2" 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.2ZM55.99,59.37c-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.7Z"/><path class="cls-2" d="M150.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.38Z"/><path class="cls-2" d="M234.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"/><path class="cls-2" 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"/><path class="cls-1" 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"/></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 294.84 174.42"><defs><style>.cls-1{fill:#d169e5;}.cls-2{fill:#fefefe;}</style></defs><path class="cls-2" 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,1c-12.75,1.09-21.09,11.26-22.59,23.5-6.56-7.9-15.05-14.75-25.16-17.42-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"/><path class="cls-1" 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.24c12.25-10.56,29.66-14.3,45.34-10.17,10.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.86ZM234.36,72.83c-.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.21ZM150.69,57.99c-.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.86s-12.51-64.81-45.7-62.54ZM195.7,113.99c.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"/><path class="cls-2" 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.2ZM55.99,59.37c-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.7Z"/><path class="cls-2" d="M150.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.38Z"/><path class="cls-2" d="M234.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"/><path class="cls-2" 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"/><path class="cls-1" 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"/></svg>