@oxyhq/services 5.3.11 → 5.4.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 +21 -0
- package/lib/commonjs/assets/assets/icons/OxyServices.tsx +67 -0
- package/lib/commonjs/assets/assets/icons/logo_OxyServices.svg +1 -0
- package/lib/commonjs/assets/icons/OxyServices.js +53 -0
- package/lib/commonjs/assets/icons/OxyServices.js.map +1 -0
- package/lib/commonjs/assets/icons/logo_OxyServices.svg +1 -0
- package/lib/commonjs/core/index.js +119 -23
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/index.js +2 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/lib/sonner.js +15 -11
- package/lib/commonjs/lib/sonner.js.map +1 -1
- package/lib/commonjs/node/index.js +2 -0
- package/lib/commonjs/node/index.js.map +1 -1
- package/lib/commonjs/ui/components/GroupedItem.js +109 -0
- package/lib/commonjs/ui/components/GroupedItem.js.map +1 -0
- package/lib/commonjs/ui/components/GroupedSection.js +33 -0
- package/lib/commonjs/ui/components/GroupedSection.js.map +1 -0
- package/lib/commonjs/ui/components/OxyProvider.js +95 -112
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/ProfileCard.js +124 -0
- package/lib/commonjs/ui/components/ProfileCard.js.map +1 -0
- package/lib/commonjs/ui/components/QuickActions.js +87 -0
- package/lib/commonjs/ui/components/QuickActions.js.map +1 -0
- package/lib/commonjs/ui/components/Section.js +36 -0
- package/lib/commonjs/ui/components/Section.js.map +1 -0
- package/lib/commonjs/ui/components/SectionTitle.js +35 -0
- package/lib/commonjs/ui/components/SectionTitle.js.map +1 -0
- package/lib/commonjs/ui/components/bottomSheet/index.js +6 -6
- package/lib/commonjs/ui/components/index.js +97 -0
- package/lib/commonjs/ui/components/index.js.map +1 -0
- package/lib/commonjs/ui/navigation/OxyRouter.js +20 -3
- package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +190 -207
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountManagementDemo.js +299 -0
- package/lib/commonjs/ui/screens/AccountManagementDemo.js.map +1 -0
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +669 -401
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +695 -498
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +451 -488
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AppInfoScreen.js +498 -185
- package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/BillingManagementScreen.js +636 -0
- package/lib/commonjs/ui/screens/BillingManagementScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/FileManagementScreen.js +2497 -0
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +1620 -0
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/ProfileScreen.js +117 -13
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js +1 -1
- package/lib/commonjs/ui/screens/SignUpScreen.js +1 -1
- package/lib/commonjs/utils/polyfills.js +42 -0
- package/lib/commonjs/utils/polyfills.js.map +1 -0
- package/lib/module/assets/assets/icons/OxyServices.tsx +67 -0
- package/lib/module/assets/assets/icons/logo_OxyServices.svg +1 -0
- package/lib/module/assets/icons/OxyServices.js +46 -0
- package/lib/module/assets/icons/OxyServices.js.map +1 -0
- package/lib/module/assets/icons/logo_OxyServices.svg +1 -0
- package/lib/module/core/index.js +119 -23
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/lib/sonner.js +13 -1
- package/lib/module/lib/sonner.js.map +1 -1
- package/lib/module/node/index.js +3 -0
- package/lib/module/node/index.js.map +1 -1
- package/lib/module/ui/components/GroupedItem.js +104 -0
- package/lib/module/ui/components/GroupedItem.js.map +1 -0
- package/lib/module/ui/components/GroupedSection.js +28 -0
- package/lib/module/ui/components/GroupedSection.js.map +1 -0
- package/lib/module/ui/components/OxyProvider.js +97 -114
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/ProfileCard.js +119 -0
- package/lib/module/ui/components/ProfileCard.js.map +1 -0
- package/lib/module/ui/components/QuickActions.js +82 -0
- package/lib/module/ui/components/QuickActions.js.map +1 -0
- package/lib/module/ui/components/Section.js +31 -0
- package/lib/module/ui/components/Section.js.map +1 -0
- package/lib/module/ui/components/SectionTitle.js +30 -0
- package/lib/module/ui/components/SectionTitle.js.map +1 -0
- package/lib/module/ui/components/bottomSheet/index.js +2 -5
- package/lib/module/ui/components/bottomSheet/index.js.map +1 -1
- package/lib/module/ui/components/index.js +18 -0
- package/lib/module/ui/components/index.js.map +1 -0
- package/lib/module/ui/navigation/OxyRouter.js +20 -3
- package/lib/module/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +191 -208
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountManagementDemo.js +296 -0
- package/lib/module/ui/screens/AccountManagementDemo.js.map +1 -0
- package/lib/module/ui/screens/AccountOverviewScreen.js +671 -403
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +698 -501
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +450 -488
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/AppInfoScreen.js +498 -186
- package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/module/ui/screens/BillingManagementScreen.js +631 -0
- package/lib/module/ui/screens/BillingManagementScreen.js.map +1 -0
- package/lib/module/ui/screens/FileManagementScreen.js +2492 -0
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -0
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js +1615 -0
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -0
- package/lib/module/ui/screens/ProfileScreen.js +118 -14
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/SignInScreen.js +1 -1
- package/lib/module/ui/screens/SignInScreen.js.map +1 -1
- package/lib/module/ui/screens/SignUpScreen.js +1 -1
- package/lib/module/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/module/utils/polyfills.js +36 -0
- package/lib/module/utils/polyfills.js.map +1 -0
- package/lib/typescript/assets/icons/OxyServices.d.ts +29 -0
- package/lib/typescript/assets/icons/OxyServices.d.ts.map +1 -0
- package/lib/typescript/core/index.d.ts +26 -1
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/lib/sonner.d.ts +5 -1
- package/lib/typescript/lib/sonner.d.ts.map +1 -1
- package/lib/typescript/models/interfaces.d.ts +1 -2
- package/lib/typescript/models/interfaces.d.ts.map +1 -1
- package/lib/typescript/node/index.d.ts +1 -0
- package/lib/typescript/node/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/GroupedItem.d.ts +17 -0
- package/lib/typescript/ui/components/GroupedItem.d.ts.map +1 -0
- package/lib/typescript/ui/components/GroupedSection.d.ts +19 -0
- package/lib/typescript/ui/components/GroupedSection.d.ts.map +1 -0
- package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/ui/components/ProfileCard.d.ts +20 -0
- package/lib/typescript/ui/components/ProfileCard.d.ts.map +1 -0
- package/lib/typescript/ui/components/QuickActions.d.ts +15 -0
- package/lib/typescript/ui/components/QuickActions.d.ts.map +1 -0
- package/lib/typescript/ui/components/Section.d.ts +11 -0
- package/lib/typescript/ui/components/Section.d.ts.map +1 -0
- package/lib/typescript/ui/components/SectionTitle.d.ts +9 -0
- package/lib/typescript/ui/components/SectionTitle.d.ts.map +1 -0
- package/lib/typescript/ui/components/bottomSheet/index.d.ts +3 -2
- package/lib/typescript/ui/components/bottomSheet/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/index.d.ts +13 -0
- package/lib/typescript/ui/components/index.d.ts.map +1 -0
- package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -1
- package/lib/typescript/ui/navigation/types.d.ts +8 -0
- package/lib/typescript/ui/navigation/types.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountManagementDemo.d.ts +8 -0
- package/lib/typescript/ui/screens/AccountManagementDemo.d.ts.map +1 -0
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts +1 -4
- 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/BillingManagementScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/BillingManagementScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/FileManagementScreen.d.ts +8 -0
- package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/ProfileScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SessionManagementScreen.d.ts.map +1 -1
- package/lib/typescript/utils/polyfills.d.ts +6 -0
- package/lib/typescript/utils/polyfills.d.ts.map +1 -0
- package/package.json +11 -3
- package/src/__tests__/polyfills.test.ts +30 -0
- package/src/__tests__/setup.ts +43 -0
- package/src/__tests__/ui/screens/AccountSettingsScreen.test.tsx +8 -8
- package/src/assets/icons/OxyServices.tsx +67 -0
- package/src/assets/icons/logo_OxyServices.svg +1 -0
- package/src/core/index.ts +127 -19
- package/src/index.ts +3 -0
- package/src/lib/sonner.ts +10 -1
- package/src/models/interfaces.ts +1 -2
- package/src/node/index.ts +3 -0
- package/src/ui/components/GroupedItem.tsx +118 -0
- package/src/ui/components/GroupedSection.tsx +45 -0
- package/src/ui/components/OxyProvider.tsx +95 -120
- package/src/ui/components/ProfileCard.tsx +129 -0
- package/src/ui/components/QuickActions.tsx +90 -0
- package/src/ui/components/Section.tsx +37 -0
- package/src/ui/components/SectionTitle.tsx +31 -0
- package/src/ui/components/bottomSheet/index.tsx +13 -11
- package/src/ui/components/index.ts +15 -0
- package/src/ui/navigation/OxyRouter.tsx +20 -3
- package/src/ui/navigation/types.ts +10 -1
- package/src/ui/screens/AccountCenterScreen.tsx +188 -159
- package/src/ui/screens/AccountManagementDemo.tsx +297 -0
- package/src/ui/screens/AccountOverviewScreen.tsx +474 -310
- package/src/ui/screens/AccountSettingsScreen.tsx +648 -463
- package/src/ui/screens/AccountSwitcherScreen.tsx +385 -449
- package/src/ui/screens/AppInfoScreen.tsx +571 -140
- package/src/ui/screens/BillingManagementScreen.tsx +589 -0
- package/src/ui/screens/FileManagementScreen.tsx +2513 -0
- package/src/ui/screens/PremiumSubscriptionScreen.tsx +1628 -0
- package/src/ui/screens/ProfileScreen.tsx +101 -7
- package/src/ui/screens/SessionManagementScreen.tsx +1 -0
- package/src/ui/screens/SignInScreen.tsx +1 -1
- package/src/ui/screens/SignUpScreen.tsx +1 -1
- package/src/utils/polyfills.ts +34 -0
- package/lib/commonjs/lib/sonner.web.js +0 -17
- package/lib/commonjs/lib/sonner.web.js.map +0 -1
- package/lib/module/lib/sonner.web.js +0 -4
- package/lib/module/lib/sonner.web.js.map +0 -1
- package/lib/typescript/__tests__/ui/screens/AccountSettingsScreen.test.d.ts +0 -2
- package/lib/typescript/__tests__/ui/screens/AccountSettingsScreen.test.d.ts.map +0 -1
- package/lib/typescript/lib/sonner.web.d.ts +0 -2
- package/lib/typescript/lib/sonner.web.d.ts.map +0 -1
- package/src/lib/sonner.web.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountSettingsScreen.d.ts","sourceRoot":"","sources":["../../../../src/ui/screens/AccountSettingsScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AccountSettingsScreen.d.ts","sourceRoot":"","sources":["../../../../src/ui/screens/AccountSettingsScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAY3D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAQtD,QAAA,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA2iBpD,CAAC;AAkOF,eAAe,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountSwitcherScreen.d.ts","sourceRoot":"","sources":["../../../../src/ui/screens/AccountSwitcherScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAanD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"AccountSwitcherScreen.d.ts","sourceRoot":"","sources":["../../../../src/ui/screens/AccountSwitcherScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAanD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAyBtD,QAAA,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmjB1D,CAAC;AA2MF,eAAe,2BAA2B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppInfoScreen.d.ts","sourceRoot":"","sources":["../../../../src/ui/screens/AppInfoScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAanD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"AppInfoScreen.d.ts","sourceRoot":"","sources":["../../../../src/ui/screens/AppInfoScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAanD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAoBtD,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAilB5C,CAAC;AA2FF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BillingManagementScreen.d.ts","sourceRoot":"","sources":["../../../../src/ui/screens/BillingManagementScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAWnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AA0BtD,QAAA,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA6VtD,CAAC;AA0MF,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseScreenProps } from '../navigation/types';
|
|
3
|
+
interface FileManagementScreenProps extends BaseScreenProps {
|
|
4
|
+
userId?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const FileManagementScreen: React.FC<FileManagementScreenProps>;
|
|
7
|
+
export default FileManagementScreen;
|
|
8
|
+
//# sourceMappingURL=FileManagementScreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileManagementScreen.d.ts","sourceRoot":"","sources":["../../../../src/ui/screens/FileManagementScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAehE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAOtD,UAAU,yBAA0B,SAAQ,eAAe;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA0wD7D,CAAC;AA4qBF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PremiumSubscriptionScreen.d.ts","sourceRoot":"","sources":["../../../../src/ui/screens/PremiumSubscriptionScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAanD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAgDtD,QAAA,MAAM,yBAAyB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA0kCxD,CAAC;AAodF,eAAe,yBAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileScreen.d.ts","sourceRoot":"","sources":["../../../../src/ui/screens/ProfileScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAKtD,UAAU,kBAAmB,SAAQ,eAAe;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ProfileScreen.d.ts","sourceRoot":"","sources":["../../../../src/ui/screens/ProfileScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAKtD,UAAU,kBAAmB,SAAQ,eAAe;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA8K/C,CAAC;AA8DF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionManagementScreen.d.ts","sourceRoot":"","sources":["../../../../src/ui/screens/SessionManagementScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAYnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"SessionManagementScreen.d.ts","sourceRoot":"","sources":["../../../../src/ui/screens/SessionManagementScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAYnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAmBtD,QAAA,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmTtD,CAAC;AAiIF,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polyfills.d.ts","sourceRoot":"","sources":["../../../src/utils/polyfills.ts"],"names":[],"mappings":"AAAA;;GAEG;AAgBH,eAAO,MAAM,uBAAuB,QAAO,OAE1C,CAAC;AAGF,eAAO,MAAM,sBAAsB,QAAO,GAUzC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/services",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.1",
|
|
4
4
|
"description": "Reusable OxyHQ module to handle authentication, user management, karma system, device-based session management and more 🚀",
|
|
5
5
|
"main": "lib/commonjs/node/index.js",
|
|
6
6
|
"module": "lib/module/node/index.js",
|
|
@@ -68,6 +68,8 @@
|
|
|
68
68
|
"bootstrap": "yarn install && yarn example"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
+
"@gorhom/bottom-sheet": "^5.1.6",
|
|
72
|
+
"@oxyhq/services": "^5.4.0",
|
|
71
73
|
"@react-native-async-storage/async-storage": "^2.1.2",
|
|
72
74
|
"axios": "^1.9.0",
|
|
73
75
|
"expo-font": "^13.3.1",
|
|
@@ -75,13 +77,13 @@
|
|
|
75
77
|
"form-data": "^4.0.0",
|
|
76
78
|
"invariant": "^2.2.4",
|
|
77
79
|
"jwt-decode": "^4.0.0",
|
|
78
|
-
"react-native-actions-sheet": "^0.9.7",
|
|
79
80
|
"react-native-safe-area-context": "^5.4.0",
|
|
80
81
|
"react-test-renderer": "^18.3.1",
|
|
81
82
|
"sonner": "^2.0.4",
|
|
82
83
|
"sonner-native": "^0.20.0"
|
|
83
84
|
},
|
|
84
85
|
"devDependencies": {
|
|
86
|
+
"@biomejs/biome": "^1.9.4",
|
|
85
87
|
"@commitlint/cli": "^17.6.5",
|
|
86
88
|
"@commitlint/config-conventional": "^17.6.5",
|
|
87
89
|
"@release-it/conventional-changelog": "^8.0.1",
|
|
@@ -91,10 +93,12 @@
|
|
|
91
93
|
"@types/invariant": "^2.2.34",
|
|
92
94
|
"@types/jest": "^29.5.14",
|
|
93
95
|
"@types/jwt-decode": "^2.2.1",
|
|
96
|
+
"@types/node": "^20.5.1",
|
|
94
97
|
"@types/react": "~18.3.12",
|
|
95
98
|
"@types/react-native": "~0.73.0",
|
|
96
99
|
"copyfiles": "^2.4.1",
|
|
97
100
|
"husky": "^4.3.8",
|
|
101
|
+
"jest": "^30.0.0",
|
|
98
102
|
"lint-staged": "^13.2.2",
|
|
99
103
|
"metro-react-native-babel-preset": "^0.77.0",
|
|
100
104
|
"react": "18.3.1",
|
|
@@ -104,9 +108,11 @@
|
|
|
104
108
|
"react-native-reanimated": "^3.16.1",
|
|
105
109
|
"react-native-svg": "^14.2.0",
|
|
106
110
|
"release-it": "^17.6.0",
|
|
111
|
+
"ts-jest": "^29.4.0",
|
|
107
112
|
"typescript": "^5.3.0"
|
|
108
113
|
},
|
|
109
114
|
"peerDependencies": {
|
|
115
|
+
"@expo/vector-icons": "^14.1.0",
|
|
110
116
|
"@types/react": "*",
|
|
111
117
|
"@types/react-native": "*",
|
|
112
118
|
"axios": "^1.9.0",
|
|
@@ -120,6 +126,9 @@
|
|
|
120
126
|
"react-native-svg": ">=13.0.0"
|
|
121
127
|
},
|
|
122
128
|
"peerDependenciesMeta": {
|
|
129
|
+
"@expo/vector-icons": {
|
|
130
|
+
"optional": true
|
|
131
|
+
},
|
|
123
132
|
"@types/react-native": {
|
|
124
133
|
"optional": true
|
|
125
134
|
},
|
|
@@ -137,7 +146,6 @@
|
|
|
137
146
|
]
|
|
138
147
|
},
|
|
139
148
|
"resolutions": {
|
|
140
|
-
"@gorhom/bottom-sheet": "^5.1.0",
|
|
141
149
|
"react-native-gesture-handler": "^2.20.2",
|
|
142
150
|
"react-native-reanimated": "^3.16.1"
|
|
143
151
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test file to verify FormData polyfill functionality
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { getFormDataConstructor } from '../utils/polyfills';
|
|
6
|
+
|
|
7
|
+
describe('FormData Polyfill Tests', () => {
|
|
8
|
+
it('should provide FormData constructor', () => {
|
|
9
|
+
const FormDataConstructor = getFormDataConstructor();
|
|
10
|
+
expect(FormDataConstructor).toBeDefined();
|
|
11
|
+
expect(typeof FormDataConstructor).toBe('function');
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should create FormData instance successfully', () => {
|
|
15
|
+
const FormDataConstructor = getFormDataConstructor();
|
|
16
|
+
const formData = new FormDataConstructor();
|
|
17
|
+
expect(formData).toBeDefined();
|
|
18
|
+
expect(typeof formData.append).toBe('function');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should handle form data append operations', () => {
|
|
22
|
+
const FormDataConstructor = getFormDataConstructor();
|
|
23
|
+
const formData = new FormDataConstructor();
|
|
24
|
+
|
|
25
|
+
// Should not throw
|
|
26
|
+
expect(() => {
|
|
27
|
+
formData.append('test', 'value');
|
|
28
|
+
}).not.toThrow();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
2
|
+
|
|
3
|
+
// Mock React Native APIs
|
|
4
|
+
global.jest = require('jest');
|
|
5
|
+
|
|
6
|
+
// Mock Dimensions
|
|
7
|
+
jest.mock('react-native', () => {
|
|
8
|
+
const RN = jest.requireActual('react-native');
|
|
9
|
+
return {
|
|
10
|
+
...RN,
|
|
11
|
+
Dimensions: {
|
|
12
|
+
get: jest.fn().mockReturnValue({ width: 375, height: 800 }),
|
|
13
|
+
},
|
|
14
|
+
Platform: {
|
|
15
|
+
OS: 'web',
|
|
16
|
+
select: (options: any) => options.web || options.default,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Mock AsyncStorage
|
|
22
|
+
jest.mock('@react-native-async-storage/async-storage', () =>
|
|
23
|
+
require('@react-native-async-storage/async-storage/jest/async-storage-mock')
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
// Mock react-native-gesture-handler
|
|
27
|
+
jest.mock('react-native-gesture-handler', () => {
|
|
28
|
+
const View = require('react-native').View;
|
|
29
|
+
return {
|
|
30
|
+
ScrollView: View,
|
|
31
|
+
PanGestureHandler: View,
|
|
32
|
+
TapGestureHandler: View,
|
|
33
|
+
FlingGestureHandler: View,
|
|
34
|
+
PinchGestureHandler: View,
|
|
35
|
+
RotationGestureHandler: View,
|
|
36
|
+
State: {},
|
|
37
|
+
PanResponder: {
|
|
38
|
+
create: jest.fn(() => ({
|
|
39
|
+
panHandlers: {},
|
|
40
|
+
})),
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
});
|
|
@@ -15,10 +15,10 @@ jest.mock('../../../ui/context/OxyContext', () => ({
|
|
|
15
15
|
avatar: { url: 'https://example.com/avatar.jpg' }
|
|
16
16
|
},
|
|
17
17
|
oxyServices: {
|
|
18
|
-
|
|
19
|
-
id: '123',
|
|
20
|
-
username: 'testuser',
|
|
21
|
-
email: 'test@example.com'
|
|
18
|
+
updateProfile: jest.fn(() => Promise.resolve({
|
|
19
|
+
id: '123',
|
|
20
|
+
username: 'testuser',
|
|
21
|
+
email: 'test@example.com'
|
|
22
22
|
}))
|
|
23
23
|
},
|
|
24
24
|
isLoading: false
|
|
@@ -31,10 +31,10 @@ jest.mock('../../../ui/components/Avatar', () => 'Avatar');
|
|
|
31
31
|
|
|
32
32
|
describe('AccountSettingsScreen', () => {
|
|
33
33
|
const mockOxyServices = {
|
|
34
|
-
|
|
35
|
-
id: '123',
|
|
36
|
-
username: 'testuser',
|
|
37
|
-
email: 'test@example.com'
|
|
34
|
+
updateProfile: jest.fn(() => Promise.resolve({
|
|
35
|
+
id: '123',
|
|
36
|
+
username: 'testuser',
|
|
37
|
+
email: 'test@example.com'
|
|
38
38
|
}))
|
|
39
39
|
} as unknown as OxyServices;
|
|
40
40
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Svg, { Circle, Path } from 'react-native-svg';
|
|
3
|
+
import { ViewStyle } from 'react-native';
|
|
4
|
+
import { useThemeColors } from '../../ui/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 OxyServicesLogo: 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 500 429.13" style={style}>
|
|
49
|
+
<Path
|
|
50
|
+
d="M271.15,429.13c-12.38,0-24.78-1.63-36.86-4.86-39.01-10.16-71.27-35.39-90.69-71-39.48-71.06-15.42-164.13,53.69-207.79l8.31-6.07c8.55-6.03,18.59-9.22,29.05-9.22,16.08,0,31.29,7.71,40.68,20.62l.21,.29c15.8,22.39,10.69,53.67-11.4,69.73l-11.19,7.95-.62,.39c-25.72,16.07-35.17,50.02-21.08,75.68,6.3,11.29,16.51,19.38,28.66,22.64,3.73,1,7.56,1.51,11.36,1.51,8.39,0,16.81-2.5,24.34-7.22l78.31-48.52c24.92-15.46,33.73-49.13,19.61-75.04-5.41-9.73-14.12-17.34-24.45-21.25-12.62-4.59-22.64-13.82-28.22-26-5.56-12.15-6.01-25.72-1.27-38.26,7.14-19.55,25.89-32.66,46.75-32.66,6.08,0,12.02,1.11,17.68,3.31,32.46,12.08,59.83,35.74,77.09,66.65,39.48,71.79,15.05,165.27-54.39,208.52l-78.24,48.48c-23.04,14.45-49.82,22.13-77.33,22.13Z"
|
|
51
|
+
fill={primaryColor}
|
|
52
|
+
/><Path
|
|
53
|
+
d="M413.49,337.29l-78.19,48.45c-19.71,12.36-41.77,18.38-64.16,18.38-10.02,0-20.38-1.34-30.41-4.01-32.08-8.35-59.14-29.41-75.18-58.81-33.42-60.15-12.7-138.67,45.78-175.1l8.69-6.35c11.36-8.02,27.07-5.35,35.09,5.68,8.02,11.36,5.35,27.07-5.68,35.09l-10.36,7.35c-37.43,23.39-50.12,71.84-29.74,108.93,9.69,17.38,25.4,29.74,44.11,34.75,18.71,5.01,38.43,2,55.47-8.69l78.19-48.45c36.09-22.39,48.79-70.84,28.4-108.27-8.35-15.04-21.72-26.73-37.76-32.75-13.03-4.68-19.71-19.05-14.7-32.08,4.68-13.03,19.38-19.71,32.08-14.7,27.07,10.02,49.79,29.74,64.16,55.47,33.08,60.15,12.7,138.67-45.78,175.1Z"
|
|
54
|
+
fill={innerFillColor}
|
|
55
|
+
/>
|
|
56
|
+
<Path
|
|
57
|
+
d="M113.76,349.27c-4.23,0-10.64-.37-18-3.46-32.28-12.13-59.5-35.72-76.68-66.5C-20.68,207.75,3.73,114.23,73.47,70.79L151.71,22.31C175.41,7.7,202.25,0,229.37,0c12.25,0,24.49,1.57,36.38,4.67,38.93,10.14,71.27,35.3,91.07,70.84,39.59,71.26,15.52,164.32-53.59,207.98l-8.31,6.07c-8.54,6.03-18.59,9.22-29.05,9.22-16.08,0-31.29-7.71-40.68-20.62l-.21-.29c-15.8-22.39-10.69-53.67,11.4-69.74l11.19-7.94,.62-.39c25.72-16.07,35.18-50.02,21.08-75.68-6.3-11.3-16.5-19.38-28.66-22.64-3.74-1-7.56-1.51-11.37-1.51-8.39,0-16.8,2.5-24.33,7.22l-78.99,48.87c-24.91,15.45-33.71,49.12-19.6,75.03,5.41,9.74,14.13,17.34,24.46,21.25,25.81,9.4,39.23,38.05,29.91,63.99-7.24,19.76-26.08,32.93-46.93,32.93Z"
|
|
58
|
+
fill={primaryColor}
|
|
59
|
+
/><Path
|
|
60
|
+
d="M137.15,307.89c-3.68,10.02-13.37,16.37-23.39,16.37-3.01,0-5.68-.33-8.69-1.67-27.07-10.02-49.79-29.74-64.16-55.47C7.5,206.97,28.22,128.45,86.69,92.02l78.19-48.45c28.74-17.71,62.49-23.06,94.57-14.7,32.08,8.35,59.14,29.41,75.52,58.81,33.42,60.15,12.7,138.67-45.78,175.1l-8.69,6.35c-11.36,8.02-27.07,5.35-35.09-5.68-8.02-11.36-5.35-27.07,5.68-35.09l10.36-7.35c37.43-23.39,50.12-71.84,29.74-108.93-9.69-17.38-25.4-29.74-44.11-34.75-18.71-5.01-38.43-2-55.47,8.69l-78.86,48.79c-36.09,22.39-48.79,70.84-28.4,108.27,8.35,15.04,21.72,26.73,37.76,32.75,13.03,4.68,19.71,19.05,15.04,32.08Z"
|
|
61
|
+
fill={innerFillColor}
|
|
62
|
+
/>
|
|
63
|
+
</Svg>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default OxyServicesLogo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 429.13"><defs><style>.b{fill:#fff;}.c{fill:#d169e5;}</style></defs><path class="c" d="M271.15,429.13c-12.38,0-24.78-1.63-36.86-4.86-39.01-10.16-71.27-35.39-90.69-71-39.48-71.06-15.42-164.13,53.69-207.79l8.31-6.07c8.55-6.03,18.59-9.22,29.05-9.22,16.08,0,31.29,7.71,40.68,20.62l.21,.29c15.8,22.39,10.69,53.67-11.4,69.73l-11.19,7.95-.62,.39c-25.72,16.07-35.17,50.02-21.08,75.68,6.3,11.29,16.51,19.38,28.66,22.64,3.73,1,7.56,1.51,11.36,1.51,8.39,0,16.81-2.5,24.34-7.22l78.31-48.52c24.92-15.46,33.73-49.13,19.61-75.04-5.41-9.73-14.12-17.34-24.45-21.25-12.62-4.59-22.64-13.82-28.22-26-5.56-12.15-6.01-25.72-1.27-38.26,7.14-19.55,25.89-32.66,46.75-32.66,6.08,0,12.02,1.11,17.68,3.31,32.46,12.08,59.83,35.74,77.09,66.65,39.48,71.79,15.05,165.27-54.39,208.52l-78.24,48.48c-23.04,14.45-49.82,22.13-77.33,22.13Z"/><path class="b" d="M413.49,337.29l-78.19,48.45c-19.71,12.36-41.77,18.38-64.16,18.38-10.02,0-20.38-1.34-30.41-4.01-32.08-8.35-59.14-29.41-75.18-58.81-33.42-60.15-12.7-138.67,45.78-175.1l8.69-6.35c11.36-8.02,27.07-5.35,35.09,5.68,8.02,11.36,5.35,27.07-5.68,35.09l-10.36,7.35c-37.43,23.39-50.12,71.84-29.74,108.93,9.69,17.38,25.4,29.74,44.11,34.75,18.71,5.01,38.43,2,55.47-8.69l78.19-48.45c36.09-22.39,48.79-70.84,28.4-108.27-8.35-15.04-21.72-26.73-37.76-32.75-13.03-4.68-19.71-19.05-14.7-32.08,4.68-13.03,19.38-19.71,32.08-14.7,27.07,10.02,49.79,29.74,64.16,55.47,33.08,60.15,12.7,138.67-45.78,175.1Z"/><path class="c" d="M113.76,349.27c-4.23,0-10.64-.37-18-3.46-32.28-12.13-59.5-35.72-76.68-66.5C-20.68,207.75,3.73,114.23,73.47,70.79L151.71,22.31C175.41,7.7,202.25,0,229.37,0c12.25,0,24.49,1.57,36.38,4.67,38.93,10.14,71.27,35.3,91.07,70.84,39.59,71.26,15.52,164.32-53.59,207.98l-8.31,6.07c-8.54,6.03-18.59,9.22-29.05,9.22-16.08,0-31.29-7.71-40.68-20.62l-.21-.29c-15.8-22.39-10.69-53.67,11.4-69.74l11.19-7.94,.62-.39c25.72-16.07,35.18-50.02,21.08-75.68-6.3-11.3-16.5-19.38-28.66-22.64-3.74-1-7.56-1.51-11.37-1.51-8.39,0-16.8,2.5-24.33,7.22l-78.99,48.87c-24.91,15.45-33.71,49.12-19.6,75.03,5.41,9.74,14.13,17.34,24.46,21.25,25.81,9.4,39.23,38.05,29.91,63.99-7.24,19.76-26.08,32.93-46.93,32.93Z"/><path class="b" d="M137.15,307.89c-3.68,10.02-13.37,16.37-23.39,16.37-3.01,0-5.68-.33-8.69-1.67-27.07-10.02-49.79-29.74-64.16-55.47C7.5,206.97,28.22,128.45,86.69,92.02l78.19-48.45c28.74-17.71,62.49-23.06,94.57-14.7,32.08,8.35,59.14,29.41,75.52,58.81,33.42,60.15,12.7,138.67-45.78,175.1l-8.69,6.35c-11.36,8.02-27.07,5.35-35.09-5.68-8.02-11.36-5.35-27.07,5.68-35.09l10.36-7.35c37.43-23.39,50.12-71.84,29.74-108.93-9.69-17.38-25.4-29.74-44.11-34.75-18.71-5.01-38.43-2-55.47,8.69l-78.86,48.79c-36.09,22.39-48.79,70.84-28.4,108.27,8.35,15.04,21.72,26.73,37.76,32.75,13.03,4.68,19.71,19.05,15.04,32.08Z"/></svg>
|
package/src/core/index.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import axios, { AxiosInstance, AxiosError, AxiosRequestConfig, InternalAxiosRequestConfig } from 'axios';
|
|
2
2
|
import { jwtDecode } from 'jwt-decode';
|
|
3
|
+
import { getFormDataConstructor } from '../utils/polyfills';
|
|
3
4
|
|
|
4
5
|
let NodeFormData: any = null;
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
// Check if we're in Node.js environment
|
|
8
|
+
if (typeof window === 'undefined') {
|
|
6
9
|
try {
|
|
7
10
|
NodeFormData = require('form-data');
|
|
8
11
|
} catch (e) {
|
|
@@ -150,6 +153,14 @@ export class OxyServices {
|
|
|
150
153
|
);
|
|
151
154
|
}
|
|
152
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Gets the base URL configured for this OxyServices instance
|
|
158
|
+
* @returns The base URL
|
|
159
|
+
*/
|
|
160
|
+
public getBaseURL(): string {
|
|
161
|
+
return this.client.defaults.baseURL || '';
|
|
162
|
+
}
|
|
163
|
+
|
|
153
164
|
/**
|
|
154
165
|
* Gets the currently authenticated user ID from the token
|
|
155
166
|
* @returns The user ID or null if not authenticated
|
|
@@ -481,6 +492,33 @@ export class OxyServices {
|
|
|
481
492
|
}
|
|
482
493
|
}
|
|
483
494
|
|
|
495
|
+
/**
|
|
496
|
+
* Get the currently authenticated user's profile
|
|
497
|
+
* @returns User data for the current user
|
|
498
|
+
*/
|
|
499
|
+
async getCurrentUser(): Promise<User> {
|
|
500
|
+
try {
|
|
501
|
+
const res = await this.client.get('/users/me');
|
|
502
|
+
return res.data;
|
|
503
|
+
} catch (error) {
|
|
504
|
+
throw this.handleError(error);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Update the authenticated user's profile
|
|
510
|
+
* @param updates - Object containing fields to update
|
|
511
|
+
* @returns Updated user data
|
|
512
|
+
*/
|
|
513
|
+
async updateProfile(updates: Record<string, any>): Promise<User> {
|
|
514
|
+
try {
|
|
515
|
+
const res = await this.client.put('/users/me', updates);
|
|
516
|
+
return res.data;
|
|
517
|
+
} catch (error) {
|
|
518
|
+
throw this.handleError(error);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
484
522
|
/**
|
|
485
523
|
* Update user profile (requires auth)
|
|
486
524
|
* @param userId - User ID to update (must match authenticated user or have admin rights)
|
|
@@ -972,27 +1010,66 @@ export class OxyServices {
|
|
|
972
1010
|
* @returns File metadata including ID and download URL
|
|
973
1011
|
*/
|
|
974
1012
|
async uploadFile(
|
|
975
|
-
file: File | Blob |
|
|
1013
|
+
file: File | Blob | any, // Use 'any' to handle Buffer type in cross-platform scenarios
|
|
976
1014
|
filename: string,
|
|
977
1015
|
metadata?: Record<string, any>
|
|
1016
|
+
): Promise<FileMetadata> {
|
|
1017
|
+
const response = await this.uploadFiles([file], [filename], metadata);
|
|
1018
|
+
return response.files[0];
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* Upload multiple files using GridFS
|
|
1023
|
+
* @param files - Array of files to upload
|
|
1024
|
+
* @param filenames - Array of filenames (must match files array length)
|
|
1025
|
+
* @param metadata - Optional metadata to associate with all files
|
|
1026
|
+
* @returns Array of file metadata
|
|
1027
|
+
*/
|
|
1028
|
+
async uploadFiles(
|
|
1029
|
+
files: (File | Blob | any)[],
|
|
1030
|
+
filenames: string[],
|
|
1031
|
+
metadata?: Record<string, any>
|
|
978
1032
|
): Promise<FileUploadResponse> {
|
|
979
1033
|
try {
|
|
1034
|
+
if (files.length !== filenames.length) {
|
|
1035
|
+
throw new Error('Files and filenames arrays must have the same length');
|
|
1036
|
+
}
|
|
1037
|
+
|
|
980
1038
|
// Create form data to handle the file upload
|
|
981
|
-
|
|
1039
|
+
let formData: any;
|
|
982
1040
|
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
if (!NodeFormData) {
|
|
987
|
-
throw new Error('form-data module is required for file uploads from Buffer in Node.js but not found.');
|
|
988
|
-
}
|
|
989
|
-
// No need to convert to Blob; form-data handles Buffers directly.
|
|
990
|
-
formData.append('file', file, { filename }); // Pass filename in options for form-data
|
|
1041
|
+
if (typeof window === 'undefined' && NodeFormData) {
|
|
1042
|
+
// Node.js environment - prefer node-specific form-data
|
|
1043
|
+
formData = new NodeFormData();
|
|
991
1044
|
} else {
|
|
992
|
-
// Browser environment
|
|
993
|
-
|
|
1045
|
+
// Browser/React Native environment - use polyfilled or native FormData
|
|
1046
|
+
const FormDataConstructor = getFormDataConstructor();
|
|
1047
|
+
formData = new FormDataConstructor();
|
|
994
1048
|
}
|
|
995
1049
|
|
|
1050
|
+
// Add all files to the form data
|
|
1051
|
+
files.forEach((file, index) => {
|
|
1052
|
+
const filename = filenames[index];
|
|
1053
|
+
|
|
1054
|
+
// Handle different file types (Browser vs Node.js vs React Native)
|
|
1055
|
+
const isNodeBuffer = typeof window === 'undefined' &&
|
|
1056
|
+
file &&
|
|
1057
|
+
typeof file.constructor === 'function' &&
|
|
1058
|
+
file.constructor.name === 'Buffer';
|
|
1059
|
+
|
|
1060
|
+
if (isNodeBuffer) {
|
|
1061
|
+
// Node.js environment with Buffer
|
|
1062
|
+
if (!NodeFormData) {
|
|
1063
|
+
throw new Error('form-data module is required for file uploads from Buffer but not found.');
|
|
1064
|
+
}
|
|
1065
|
+
// form-data handles Buffers directly.
|
|
1066
|
+
formData.append('files', file, { filename }); // Pass filename in options for form-data
|
|
1067
|
+
} else {
|
|
1068
|
+
// Browser/React Native environment with File or Blob
|
|
1069
|
+
formData.append('files', file as Blob, filename);
|
|
1070
|
+
}
|
|
1071
|
+
});
|
|
1072
|
+
|
|
996
1073
|
// Add metadata as JSON string if provided
|
|
997
1074
|
if (metadata) {
|
|
998
1075
|
formData.append('metadata', JSON.stringify(metadata));
|
|
@@ -1046,9 +1123,24 @@ export class OxyServices {
|
|
|
1046
1123
|
*/
|
|
1047
1124
|
async deleteFile(fileId: string): Promise<FileDeleteResponse> {
|
|
1048
1125
|
try {
|
|
1126
|
+
console.log('Deleting file with ID:', fileId);
|
|
1049
1127
|
const res = await this.client.delete(`/files/${fileId}`);
|
|
1128
|
+
console.log('Delete response:', res.data);
|
|
1050
1129
|
return res.data;
|
|
1051
|
-
} catch (error) {
|
|
1130
|
+
} catch (error: any) {
|
|
1131
|
+
console.error('Delete file error:', error);
|
|
1132
|
+
console.error('Error response:', error.response?.data);
|
|
1133
|
+
console.error('Error status:', error.response?.status);
|
|
1134
|
+
|
|
1135
|
+
// Provide more specific error messages based on status code
|
|
1136
|
+
if (error.response?.status === 404) {
|
|
1137
|
+
throw new Error('File not found or already deleted');
|
|
1138
|
+
} else if (error.response?.status === 403) {
|
|
1139
|
+
throw new Error('You do not have permission to delete this file');
|
|
1140
|
+
} else if (error.response?.status === 400) {
|
|
1141
|
+
throw new Error('Invalid file ID format');
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1052
1144
|
throw this.handleError(error);
|
|
1053
1145
|
}
|
|
1054
1146
|
}
|
|
@@ -1059,7 +1151,7 @@ export class OxyServices {
|
|
|
1059
1151
|
* @returns Full URL to download the file
|
|
1060
1152
|
*/
|
|
1061
1153
|
getFileDownloadUrl(fileId: string): string {
|
|
1062
|
-
return `${this.client.defaults.baseURL}/files/${fileId}
|
|
1154
|
+
return `${this.client.defaults.baseURL}/files/${fileId}`;
|
|
1063
1155
|
}
|
|
1064
1156
|
|
|
1065
1157
|
/**
|
|
@@ -1068,7 +1160,7 @@ export class OxyServices {
|
|
|
1068
1160
|
* @returns Full URL to stream the file
|
|
1069
1161
|
*/
|
|
1070
1162
|
getFileStreamUrl(fileId: string): string {
|
|
1071
|
-
return `${this.client.defaults.baseURL}/files/${fileId}
|
|
1163
|
+
return `${this.client.defaults.baseURL}/files/${fileId}`;
|
|
1072
1164
|
}
|
|
1073
1165
|
|
|
1074
1166
|
/**
|
|
@@ -1086,13 +1178,29 @@ export class OxyServices {
|
|
|
1086
1178
|
filters?: Record<string, any>
|
|
1087
1179
|
): Promise<FileListResponse> {
|
|
1088
1180
|
try {
|
|
1089
|
-
const params: Record<string, any> = {
|
|
1181
|
+
const params: Record<string, any> = {};
|
|
1090
1182
|
if (limit !== undefined) params.limit = limit;
|
|
1091
1183
|
if (offset !== undefined) params.offset = offset;
|
|
1092
1184
|
if (filters) Object.assign(params, filters);
|
|
1093
1185
|
|
|
1094
|
-
const res = await this.client.get(
|
|
1095
|
-
|
|
1186
|
+
const res = await this.client.get(`/files/list/${userId}`, { params });
|
|
1187
|
+
|
|
1188
|
+
// Handle backend response format: backend returns FileMetadata[] directly
|
|
1189
|
+
// but interface expects { files: FileMetadata[], total: number, hasMore: boolean }
|
|
1190
|
+
const rawFiles = Array.isArray(res.data) ? res.data : res.data.files || [];
|
|
1191
|
+
|
|
1192
|
+
// Transform GridFS files to match FileMetadata interface (map _id to id)
|
|
1193
|
+
const filesArray = rawFiles.map((file: any) => ({
|
|
1194
|
+
...file,
|
|
1195
|
+
id: file._id?.toString() || file.id,
|
|
1196
|
+
uploadDate: file.uploadDate?.toISOString ? file.uploadDate.toISOString() : file.uploadDate
|
|
1197
|
+
}));
|
|
1198
|
+
|
|
1199
|
+
return {
|
|
1200
|
+
files: filesArray,
|
|
1201
|
+
total: filesArray.length,
|
|
1202
|
+
hasMore: false // No pagination in current backend implementation
|
|
1203
|
+
};
|
|
1096
1204
|
} catch (error) {
|
|
1097
1205
|
throw this.handleError(error);
|
|
1098
1206
|
}
|
package/src/index.ts
CHANGED
package/src/lib/sonner.ts
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import * as WebSonner from 'sonner';
|
|
3
|
+
import * as NativeSonner from 'sonner-native';
|
|
4
|
+
|
|
5
|
+
const { toast: webToast, Toaster: WebToaster } = WebSonner as any;
|
|
6
|
+
const { toast: nativeToast, Toaster: NativeToaster } = NativeSonner as any;
|
|
7
|
+
|
|
8
|
+
export const toast = Platform.OS === 'web' ? webToast : nativeToast;
|
|
9
|
+
export const Toaster = Platform.OS === 'web' ? WebToaster : NativeToaster;
|
|
10
|
+
export type ToastT = typeof webToast;
|
package/src/models/interfaces.ts
CHANGED
package/src/node/index.ts
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
* OxyHQServices Node.js Entry Point
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
// ------------- Polyfills -------------
|
|
6
|
+
import '../utils/polyfills';
|
|
7
|
+
|
|
5
8
|
// ------------- Core Imports -------------
|
|
6
9
|
import { OxyServices, OXY_CLOUD_URL } from '../core'; // Adjusted path
|
|
7
10
|
import * as Models from '../models/interfaces'; // Adjusted path
|