@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.
- package/README.md +17 -138
- package/UI_COMPONENTS.md +143 -0
- package/lib/commonjs/assets/OxyLogo.svg +1 -0
- package/lib/commonjs/assets/assets/OxyLogo.svg +1 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/lib/commonjs/core/index.js +783 -0
- package/lib/commonjs/core/index.js.map +1 -0
- package/lib/commonjs/index.js +137 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/models/interfaces.js +2 -0
- package/lib/commonjs/models/interfaces.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/ui/components/Avatar.js +98 -0
- package/lib/commonjs/ui/components/Avatar.js.map +1 -0
- package/lib/commonjs/ui/components/FontLoader.js +181 -0
- package/lib/commonjs/ui/components/FontLoader.js.map +1 -0
- package/lib/commonjs/ui/components/OxyLogo.js +56 -0
- package/lib/commonjs/ui/components/OxyLogo.js.map +1 -0
- package/lib/commonjs/ui/components/OxyProvider.js +464 -0
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -0
- package/lib/commonjs/ui/components/OxySignInButton.js +178 -0
- package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -0
- package/lib/commonjs/ui/components/bottomSheet/index.js +37 -0
- package/lib/commonjs/ui/components/bottomSheet/index.js.map +1 -0
- package/lib/commonjs/ui/context/OxyContext.js +296 -0
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -0
- package/lib/commonjs/ui/index.js +144 -0
- package/lib/commonjs/ui/index.js.map +1 -0
- package/lib/commonjs/ui/navigation/OxyRouter.js +145 -0
- package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -0
- package/lib/commonjs/ui/navigation/types.js +6 -0
- package/lib/commonjs/ui/navigation/types.js.map +1 -0
- package/lib/commonjs/ui/screens/AboutKarmaScreen.js +45 -0
- package/lib/commonjs/ui/screens/AboutKarmaScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +280 -0
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +566 -0
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/SignInScreen.js +230 -0
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/SignUpScreen.js +673 -0
- package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -0
- package/lib/commonjs/ui/styles/FONTS.md +126 -0
- package/lib/commonjs/ui/styles/fonts.js +84 -0
- package/lib/commonjs/ui/styles/fonts.js.map +1 -0
- package/lib/commonjs/ui/styles/index.js +28 -0
- package/lib/commonjs/ui/styles/index.js.map +1 -0
- package/lib/commonjs/ui/styles/theme.js +122 -0
- package/lib/commonjs/ui/styles/theme.js.map +1 -0
- package/lib/module/assets/OxyLogo.svg +1 -0
- package/lib/module/assets/assets/OxyLogo.svg +1 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/lib/module/core/index.js +777 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/index.js +40 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/models/interfaces.js +2 -0
- package/lib/module/models/interfaces.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/ui/components/Avatar.js +93 -0
- package/lib/module/ui/components/Avatar.js.map +1 -0
- package/lib/module/ui/components/FontLoader.js +176 -0
- package/lib/module/ui/components/FontLoader.js.map +1 -0
- package/lib/module/ui/components/OxyLogo.js +49 -0
- package/lib/module/ui/components/OxyLogo.js.map +1 -0
- package/lib/module/ui/components/OxyProvider.js +458 -0
- package/lib/module/ui/components/OxyProvider.js.map +1 -0
- package/lib/module/ui/components/OxySignInButton.js +172 -0
- package/lib/module/ui/components/OxySignInButton.js.map +1 -0
- package/lib/module/ui/components/bottomSheet/index.js +8 -0
- package/lib/module/ui/components/bottomSheet/index.js.map +1 -0
- package/lib/module/ui/context/OxyContext.js +291 -0
- package/lib/module/ui/context/OxyContext.js.map +1 -0
- package/lib/module/ui/index.js +26 -0
- package/lib/module/ui/index.js.map +1 -0
- package/lib/module/ui/navigation/OxyRouter.js +138 -0
- package/lib/module/ui/navigation/OxyRouter.js.map +1 -0
- package/lib/module/ui/navigation/types.js +4 -0
- package/lib/module/ui/navigation/types.js.map +1 -0
- package/lib/module/ui/screens/AboutKarmaScreen.js +40 -0
- package/lib/module/ui/screens/AboutKarmaScreen.js.map +1 -0
- package/lib/module/ui/screens/AccountCenterScreen.js +275 -0
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -0
- package/lib/module/ui/screens/AccountOverviewScreen.js +560 -0
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -0
- package/lib/module/ui/screens/SignInScreen.js +224 -0
- package/lib/module/ui/screens/SignInScreen.js.map +1 -0
- package/lib/module/ui/screens/SignUpScreen.js +668 -0
- package/lib/module/ui/screens/SignUpScreen.js.map +1 -0
- package/lib/module/ui/styles/FONTS.md +126 -0
- package/lib/module/ui/styles/fonts.js +81 -0
- package/lib/module/ui/styles/fonts.js.map +1 -0
- package/lib/module/ui/styles/index.js +5 -0
- package/lib/module/ui/styles/index.js.map +1 -0
- package/lib/module/ui/styles/theme.js +115 -0
- package/lib/module/ui/styles/theme.js.map +1 -0
- package/lib/typescript/core/index.d.ts +304 -0
- package/lib/typescript/core/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +14 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/models/interfaces.d.ts +98 -0
- package/lib/typescript/models/interfaces.d.ts.map +1 -0
- package/lib/typescript/ui/components/Avatar.d.ts +62 -0
- package/lib/typescript/ui/components/Avatar.d.ts.map +1 -0
- package/lib/typescript/ui/components/FontLoader.d.ts +15 -0
- package/lib/typescript/ui/components/FontLoader.d.ts.map +1 -0
- package/lib/typescript/ui/components/OxyLogo.d.ts +29 -0
- package/lib/typescript/ui/components/OxyLogo.d.ts.map +1 -0
- package/lib/typescript/ui/components/OxyProvider.d.ts +12 -0
- package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -0
- package/lib/typescript/ui/components/OxySignInButton.d.ts +65 -0
- package/lib/typescript/ui/components/OxySignInButton.d.ts.map +1 -0
- package/lib/typescript/ui/components/bottomSheet/index.d.ts +3 -0
- package/lib/typescript/ui/components/bottomSheet/index.d.ts.map +1 -0
- package/lib/typescript/ui/context/OxyContext.d.ts +26 -0
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -0
- package/lib/typescript/ui/index.d.ts +16 -0
- package/lib/typescript/ui/index.d.ts.map +1 -0
- package/lib/typescript/ui/navigation/OxyRouter.d.ts +5 -0
- package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -0
- package/lib/typescript/ui/navigation/types.d.ts +107 -0
- package/lib/typescript/ui/navigation/types.d.ts.map +1 -0
- package/lib/typescript/ui/screens/AboutKarmaScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/AboutKarmaScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/AccountCenterScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/SignInScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/SignUpScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +1 -0
- package/lib/typescript/ui/styles/fonts.d.ts +21 -0
- package/lib/typescript/ui/styles/fonts.d.ts.map +1 -0
- package/lib/typescript/ui/styles/index.d.ts +3 -0
- package/lib/typescript/ui/styles/index.d.ts.map +1 -0
- package/lib/typescript/ui/styles/theme.d.ts +69 -0
- package/lib/typescript/ui/styles/theme.d.ts.map +1 -0
- package/package.json +95 -51
- package/src/assets/OxyLogo.svg +1 -0
- package/src/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/src/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/src/core/index.ts +768 -0
- package/src/index.ts +57 -0
- package/src/models/interfaces.ts +128 -0
- package/src/ui/components/Avatar.tsx +155 -0
- package/src/ui/components/FontLoader.tsx +180 -0
- package/src/ui/components/OxyLogo.tsx +73 -0
- package/src/ui/components/OxyProvider.tsx +490 -0
- package/src/ui/components/OxySignInButton.tsx +207 -0
- package/src/ui/components/bottomSheet/index.tsx +12 -0
- package/src/ui/context/OxyContext.tsx +344 -0
- package/src/ui/index.ts +28 -0
- package/src/ui/navigation/OxyRouter.tsx +142 -0
- package/src/ui/navigation/types.ts +124 -0
- package/src/ui/screens/AboutKarmaScreen.tsx +52 -0
- package/src/ui/screens/AccountCenterScreen.tsx +240 -0
- package/src/ui/screens/AccountOverviewScreen.tsx +512 -0
- package/src/ui/screens/SignInScreen.tsx +210 -0
- package/src/ui/screens/SignUpScreen.tsx +607 -0
- package/src/ui/styles/FONTS.md +126 -0
- package/src/ui/styles/fonts.ts +77 -0
- package/src/ui/styles/index.ts +2 -0
- package/src/ui/styles/theme.ts +142 -0
- package/dist/index.d.ts +0 -152
- package/dist/index.js +0 -1
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
10
|
+
var _reactNativeGestureHandler = require("react-native-gesture-handler");
|
|
11
|
+
var _OxyContext = require("../context/OxyContext");
|
|
12
|
+
var _OxyRouter = _interopRequireDefault(require("../navigation/OxyRouter"));
|
|
13
|
+
var _FontLoader = require("./FontLoader");
|
|
14
|
+
var _bottomSheet = require("./bottomSheet");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
18
|
+
// filepath: /home/nate/OxyServicesandApi/OxyHQServices/src/ui/components/OxyProvider.tsx
|
|
19
|
+
|
|
20
|
+
// Import bottom sheet components directly - no longer a peer dependency
|
|
21
|
+
|
|
22
|
+
// Initialize fonts automatically
|
|
23
|
+
(0, _FontLoader.setupFonts)();
|
|
24
|
+
const {
|
|
25
|
+
height,
|
|
26
|
+
width
|
|
27
|
+
} = _reactNative.Dimensions.get('window');
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Enhanced OxyProvider component
|
|
31
|
+
*
|
|
32
|
+
* This component serves two purposes:
|
|
33
|
+
* 1. As a context provider for authentication and session management across the app
|
|
34
|
+
* 2. As a UI component for authentication and account management using a bottom sheet
|
|
35
|
+
*/
|
|
36
|
+
const OxyProvider = props => {
|
|
37
|
+
const {
|
|
38
|
+
oxyServices,
|
|
39
|
+
children,
|
|
40
|
+
contextOnly = false,
|
|
41
|
+
onAuthStateChange,
|
|
42
|
+
storageKeyPrefix,
|
|
43
|
+
...bottomSheetProps
|
|
44
|
+
} = props;
|
|
45
|
+
|
|
46
|
+
// Create internal bottom sheet ref
|
|
47
|
+
const internalBottomSheetRef = (0, _react.useRef)(null);
|
|
48
|
+
|
|
49
|
+
// If contextOnly is true, we just provide the context without the bottom sheet UI
|
|
50
|
+
if (contextOnly) {
|
|
51
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyContext.OxyContextProvider, {
|
|
52
|
+
oxyServices: oxyServices,
|
|
53
|
+
storageKeyPrefix: storageKeyPrefix,
|
|
54
|
+
onAuthStateChange: onAuthStateChange,
|
|
55
|
+
children: children
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Otherwise, provide both the context and the bottom sheet UI
|
|
60
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyContext.OxyContextProvider, {
|
|
61
|
+
oxyServices: oxyServices,
|
|
62
|
+
storageKeyPrefix: storageKeyPrefix,
|
|
63
|
+
onAuthStateChange: onAuthStateChange,
|
|
64
|
+
bottomSheetRef: internalBottomSheetRef,
|
|
65
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FontLoader.FontLoader, {
|
|
66
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeGestureHandler.GestureHandlerRootView, {
|
|
67
|
+
style: styles.gestureHandlerRoot,
|
|
68
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_bottomSheet.BottomSheetModalProvider, {
|
|
69
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.StatusBar, {
|
|
70
|
+
translucent: true,
|
|
71
|
+
backgroundColor: "transparent"
|
|
72
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeSafeAreaContext.SafeAreaProvider, {
|
|
73
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(OxyBottomSheet, {
|
|
74
|
+
...bottomSheetProps,
|
|
75
|
+
bottomSheetRef: internalBottomSheetRef,
|
|
76
|
+
oxyServices: oxyServices
|
|
77
|
+
}), children]
|
|
78
|
+
})]
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* OxyBottomSheet component - A bottom sheet-based authentication and account management UI
|
|
87
|
+
*
|
|
88
|
+
* This is the original OxyProvider UI functionality, now extracted into its own component
|
|
89
|
+
* and reimplemented using BottomSheetModal for better Android compatibility
|
|
90
|
+
*/
|
|
91
|
+
const OxyBottomSheet = ({
|
|
92
|
+
oxyServices,
|
|
93
|
+
initialScreen = 'SignIn',
|
|
94
|
+
onClose,
|
|
95
|
+
onAuthenticated,
|
|
96
|
+
theme = 'light',
|
|
97
|
+
customStyles = {},
|
|
98
|
+
bottomSheetRef,
|
|
99
|
+
autoPresent = false
|
|
100
|
+
}) => {
|
|
101
|
+
// Use the internal ref (which is passed as a prop from OxyProvider)
|
|
102
|
+
const modalRef = (0, _react.useRef)(null);
|
|
103
|
+
|
|
104
|
+
// Set up effect to sync the internal ref with our modal ref
|
|
105
|
+
(0, _react.useEffect)(() => {
|
|
106
|
+
if (bottomSheetRef && modalRef.current) {
|
|
107
|
+
// We need to expose certain methods to the internal ref
|
|
108
|
+
const methodsToExpose = ['snapToIndex', 'snapToPosition', 'close', 'expand', 'collapse'];
|
|
109
|
+
methodsToExpose.forEach(method => {
|
|
110
|
+
if (modalRef.current && typeof modalRef.current[method] === 'function') {
|
|
111
|
+
// Properly forward methods from modalRef to bottomSheetRef
|
|
112
|
+
// @ts-ignore - We're doing a runtime compatibility layer
|
|
113
|
+
bottomSheetRef.current = bottomSheetRef.current || {};
|
|
114
|
+
// @ts-ignore - Dynamic method assignment
|
|
115
|
+
bottomSheetRef.current[method] = (...args) => {
|
|
116
|
+
// @ts-ignore - Dynamic method call
|
|
117
|
+
return modalRef.current?.[method]?.(...args);
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// Add a method to navigate between screens
|
|
123
|
+
// @ts-ignore - Adding custom method
|
|
124
|
+
bottomSheetRef.current._navigateToScreen = screenName => {
|
|
125
|
+
// Access the navigation function exposed by OxyRouter
|
|
126
|
+
// Use internal mechanism to notify router about navigation
|
|
127
|
+
// We'll use a simple event-based approach
|
|
128
|
+
if (typeof document !== 'undefined') {
|
|
129
|
+
// For web - use a custom event
|
|
130
|
+
const event = new CustomEvent('oxy:navigate', {
|
|
131
|
+
detail: screenName
|
|
132
|
+
});
|
|
133
|
+
document.dispatchEvent(event);
|
|
134
|
+
} else {
|
|
135
|
+
// For React Native - use the navigation prop directly if available
|
|
136
|
+
console.log(`Requesting navigation to ${screenName}`);
|
|
137
|
+
// We'll implement a simpler mechanism in OxyRouter
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}, [bottomSheetRef, modalRef]);
|
|
142
|
+
|
|
143
|
+
// Use percentage-based snap points for better cross-platform compatibility
|
|
144
|
+
const [snapPoints, setSnapPoints] = (0, _react.useState)(['60%', '85%']);
|
|
145
|
+
|
|
146
|
+
// Animation values - we'll use these for content animations
|
|
147
|
+
const fadeAnim = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
|
|
148
|
+
const slideAnim = (0, _react.useRef)(new _reactNative.Animated.Value(50)).current;
|
|
149
|
+
const handleScaleAnim = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
|
|
150
|
+
|
|
151
|
+
// Track keyboard status
|
|
152
|
+
const [keyboardVisible, setKeyboardVisible] = (0, _react.useState)(false);
|
|
153
|
+
const [keyboardHeight, setKeyboardHeight] = (0, _react.useState)(0);
|
|
154
|
+
const insets = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
|
|
155
|
+
|
|
156
|
+
// Get the authentication context
|
|
157
|
+
const oxyContext = (0, _OxyContext.useOxy)();
|
|
158
|
+
|
|
159
|
+
// Handle keyboard events
|
|
160
|
+
(0, _react.useEffect)(() => {
|
|
161
|
+
const keyboardWillShowListener = _reactNative.Keyboard.addListener(_reactNative.Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', event => {
|
|
162
|
+
setKeyboardVisible(true);
|
|
163
|
+
// Get keyboard height from event
|
|
164
|
+
const keyboardHeightValue = event.endCoordinates.height;
|
|
165
|
+
setKeyboardHeight(keyboardHeightValue);
|
|
166
|
+
|
|
167
|
+
// Ensure the bottom sheet remains visible when keyboard opens
|
|
168
|
+
// by adjusting to the highest snap point
|
|
169
|
+
if (modalRef.current) {
|
|
170
|
+
modalRef.current.snapToIndex(1);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
const keyboardWillHideListener = _reactNative.Keyboard.addListener(_reactNative.Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide', () => {
|
|
174
|
+
setKeyboardVisible(false);
|
|
175
|
+
setKeyboardHeight(0);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// Cleanup listeners
|
|
179
|
+
return () => {
|
|
180
|
+
keyboardWillShowListener.remove();
|
|
181
|
+
keyboardWillHideListener.remove();
|
|
182
|
+
};
|
|
183
|
+
}, []);
|
|
184
|
+
|
|
185
|
+
// Present the modal when component mounts, but only if autoPresent is true
|
|
186
|
+
(0, _react.useEffect)(() => {
|
|
187
|
+
// Add expand method that handles presentation and animations
|
|
188
|
+
if (bottomSheetRef && modalRef.current) {
|
|
189
|
+
// Override expand to handle initial presentation
|
|
190
|
+
// @ts-ignore - Dynamic method assignment
|
|
191
|
+
bottomSheetRef.current.expand = () => {
|
|
192
|
+
// Only present if not already presented
|
|
193
|
+
modalRef.current?.present();
|
|
194
|
+
|
|
195
|
+
// Start content animations after presenting
|
|
196
|
+
_reactNative.Animated.parallel([_reactNative.Animated.timing(fadeAnim, {
|
|
197
|
+
toValue: 1,
|
|
198
|
+
duration: 300,
|
|
199
|
+
useNativeDriver: _reactNative.Platform.OS === 'ios' // Only use native driver on iOS
|
|
200
|
+
}), _reactNative.Animated.spring(slideAnim, {
|
|
201
|
+
toValue: 0,
|
|
202
|
+
friction: 8,
|
|
203
|
+
tension: 40,
|
|
204
|
+
useNativeDriver: _reactNative.Platform.OS === 'ios' // Only use native driver on iOS
|
|
205
|
+
})]).start();
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Auto-present if the autoPresent prop is true
|
|
210
|
+
if (autoPresent && modalRef.current) {
|
|
211
|
+
// Small delay to allow everything to initialize
|
|
212
|
+
const timer = setTimeout(() => {
|
|
213
|
+
modalRef.current?.present();
|
|
214
|
+
|
|
215
|
+
// Start content animations after presenting
|
|
216
|
+
_reactNative.Animated.parallel([_reactNative.Animated.timing(fadeAnim, {
|
|
217
|
+
toValue: 1,
|
|
218
|
+
duration: 300,
|
|
219
|
+
useNativeDriver: _reactNative.Platform.OS === 'ios' // Only use native driver on iOS
|
|
220
|
+
}), _reactNative.Animated.spring(slideAnim, {
|
|
221
|
+
toValue: 0,
|
|
222
|
+
friction: 8,
|
|
223
|
+
tension: 40,
|
|
224
|
+
useNativeDriver: _reactNative.Platform.OS === 'ios' // Only use native driver on iOS
|
|
225
|
+
})]).start();
|
|
226
|
+
}, 100);
|
|
227
|
+
return () => clearTimeout(timer);
|
|
228
|
+
}
|
|
229
|
+
}, [bottomSheetRef, modalRef, fadeAnim, slideAnim, autoPresent]);
|
|
230
|
+
|
|
231
|
+
// Handle authentication success from the bottom sheet screens
|
|
232
|
+
const handleAuthenticated = (0, _react.useCallback)(user => {
|
|
233
|
+
// Call the prop callback if provided
|
|
234
|
+
if (onAuthenticated) {
|
|
235
|
+
onAuthenticated(user);
|
|
236
|
+
}
|
|
237
|
+
}, [onAuthenticated]);
|
|
238
|
+
|
|
239
|
+
// Handle indicator animation - subtle pulse effect
|
|
240
|
+
(0, _react.useEffect)(() => {
|
|
241
|
+
const pulseAnimation = _reactNative.Animated.sequence([_reactNative.Animated.timing(handleScaleAnim, {
|
|
242
|
+
toValue: 1.1,
|
|
243
|
+
duration: 300,
|
|
244
|
+
useNativeDriver: _reactNative.Platform.OS === 'ios' // Only use native driver on iOS
|
|
245
|
+
}), _reactNative.Animated.timing(handleScaleAnim, {
|
|
246
|
+
toValue: 1,
|
|
247
|
+
duration: 300,
|
|
248
|
+
useNativeDriver: _reactNative.Platform.OS === 'ios' // Only use native driver on iOS
|
|
249
|
+
})]);
|
|
250
|
+
|
|
251
|
+
// Run the animation once when component mounts
|
|
252
|
+
pulseAnimation.start();
|
|
253
|
+
}, []);
|
|
254
|
+
|
|
255
|
+
// Handle backdrop rendering
|
|
256
|
+
const renderBackdrop = (0, _react.useCallback)(props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_bottomSheet.BottomSheetBackdrop, {
|
|
257
|
+
...props,
|
|
258
|
+
disappearsOnIndex: -1,
|
|
259
|
+
appearsOnIndex: 0,
|
|
260
|
+
opacity: 0.5
|
|
261
|
+
}), []);
|
|
262
|
+
|
|
263
|
+
// Background style based on theme
|
|
264
|
+
const getBackgroundStyle = () => {
|
|
265
|
+
const baseColor = customStyles.backgroundColor || (theme === 'light' ? '#FFFFFF' : '#121212');
|
|
266
|
+
return {
|
|
267
|
+
backgroundColor: baseColor,
|
|
268
|
+
// Make sure there's no transparency
|
|
269
|
+
opacity: 1,
|
|
270
|
+
// Additional Android-specific styles
|
|
271
|
+
..._reactNative.Platform.select({
|
|
272
|
+
android: {
|
|
273
|
+
elevation: 24
|
|
274
|
+
}
|
|
275
|
+
})
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
// Method to adjust snap points from Router
|
|
280
|
+
const adjustSnapPoints = (0, _react.useCallback)(points => {
|
|
281
|
+
// Ensure snap points are high enough when keyboard is visible
|
|
282
|
+
if (keyboardVisible) {
|
|
283
|
+
// If keyboard is visible, make sure we use higher snap points
|
|
284
|
+
// to ensure the sheet content remains visible
|
|
285
|
+
const highestPoint = points[points.length - 1];
|
|
286
|
+
setSnapPoints([highestPoint, highestPoint]);
|
|
287
|
+
} else {
|
|
288
|
+
setSnapPoints(points);
|
|
289
|
+
}
|
|
290
|
+
}, [keyboardVisible]);
|
|
291
|
+
|
|
292
|
+
// Method to programmatically navigate to a specific screen
|
|
293
|
+
const navigateToScreen = (0, _react.useCallback)(screenName => {
|
|
294
|
+
// If we have a router component with navigate method, use it
|
|
295
|
+
if (modalRef.current) {
|
|
296
|
+
// Store the navigate function on the modal ref so it can be accessed externally
|
|
297
|
+
// @ts-ignore - Adding custom property for external navigation
|
|
298
|
+
modalRef.current._navigateToScreen = screen => {
|
|
299
|
+
// This will be populated by the OxyRouter component when it renders
|
|
300
|
+
console.log(`Navigating to ${screen} programmatically`);
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
}, []);
|
|
304
|
+
|
|
305
|
+
// Close the bottom sheet with animation
|
|
306
|
+
const handleClose = (0, _react.useCallback)(() => {
|
|
307
|
+
// Animate content out
|
|
308
|
+
_reactNative.Animated.timing(fadeAnim, {
|
|
309
|
+
toValue: 0,
|
|
310
|
+
duration: _reactNative.Platform.OS === 'android' ? 100 : 200,
|
|
311
|
+
// Faster on Android
|
|
312
|
+
useNativeDriver: _reactNative.Platform.OS === 'ios' // Only use native driver on iOS
|
|
313
|
+
}).start(() => {
|
|
314
|
+
// Dismiss the sheet
|
|
315
|
+
modalRef.current?.dismiss();
|
|
316
|
+
if (onClose) {
|
|
317
|
+
setTimeout(() => {
|
|
318
|
+
onClose();
|
|
319
|
+
}, _reactNative.Platform.OS === 'android' ? 150 : 100);
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
}, [onClose, fadeAnim]);
|
|
323
|
+
|
|
324
|
+
// Handle sheet index changes
|
|
325
|
+
const handleSheetChanges = (0, _react.useCallback)(index => {
|
|
326
|
+
if (index === -1 && onClose) {
|
|
327
|
+
onClose();
|
|
328
|
+
} else if (index === 1) {
|
|
329
|
+
// Pulse animation when expanded to full height
|
|
330
|
+
_reactNative.Animated.sequence([_reactNative.Animated.timing(handleScaleAnim, {
|
|
331
|
+
toValue: 1.2,
|
|
332
|
+
duration: 200,
|
|
333
|
+
useNativeDriver: _reactNative.Platform.OS === 'ios' // Only use native driver on iOS
|
|
334
|
+
}), _reactNative.Animated.timing(handleScaleAnim, {
|
|
335
|
+
toValue: 1,
|
|
336
|
+
duration: 200,
|
|
337
|
+
useNativeDriver: _reactNative.Platform.OS === 'ios' // Only use native driver on iOS
|
|
338
|
+
})]).start();
|
|
339
|
+
} else if (index === 0 && keyboardVisible) {
|
|
340
|
+
// If keyboard is visible and user tries to go to a smaller snap point,
|
|
341
|
+
// force the sheet to stay at the highest point for better visibility
|
|
342
|
+
modalRef.current?.snapToIndex(1);
|
|
343
|
+
}
|
|
344
|
+
}, [onClose, handleScaleAnim, keyboardVisible]);
|
|
345
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_bottomSheet.BottomSheetModal, {
|
|
346
|
+
ref: modalRef,
|
|
347
|
+
index: 0,
|
|
348
|
+
snapPoints: snapPoints,
|
|
349
|
+
enablePanDownToClose: true,
|
|
350
|
+
backdropComponent: renderBackdrop,
|
|
351
|
+
handleComponent: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
352
|
+
style: {
|
|
353
|
+
alignItems: 'center',
|
|
354
|
+
paddingVertical: 8,
|
|
355
|
+
...(_reactNative.Platform.OS === 'ios' ? {
|
|
356
|
+
transform: [{
|
|
357
|
+
scale: handleScaleAnim
|
|
358
|
+
}]
|
|
359
|
+
} : {})
|
|
360
|
+
},
|
|
361
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
362
|
+
style: [styles.indicator, {
|
|
363
|
+
backgroundColor: customStyles.handleColor || (theme === 'light' ? '#CCCCCC' : '#444444')
|
|
364
|
+
}]
|
|
365
|
+
})
|
|
366
|
+
}),
|
|
367
|
+
backgroundStyle: [getBackgroundStyle(), {
|
|
368
|
+
borderTopLeftRadius: 35,
|
|
369
|
+
borderTopRightRadius: 35
|
|
370
|
+
}],
|
|
371
|
+
handleIndicatorStyle: {
|
|
372
|
+
backgroundColor: customStyles.handleColor || (theme === 'light' ? '#CCCCCC' : '#444444'),
|
|
373
|
+
width: 40,
|
|
374
|
+
height: 4
|
|
375
|
+
},
|
|
376
|
+
onChange: handleSheetChanges
|
|
377
|
+
// Adding additional props to improve layout behavior
|
|
378
|
+
,
|
|
379
|
+
keyboardBehavior: "interactive",
|
|
380
|
+
keyboardBlurBehavior: "restore",
|
|
381
|
+
android_keyboardInputMode: "adjustResize",
|
|
382
|
+
enableOverDrag: true,
|
|
383
|
+
enableContentPanningGesture: true,
|
|
384
|
+
enableHandlePanningGesture: true,
|
|
385
|
+
overDragResistanceFactor: 2.5,
|
|
386
|
+
enableBlurKeyboardOnGesture: true
|
|
387
|
+
// Log sheet animations for debugging
|
|
388
|
+
,
|
|
389
|
+
onAnimate: (fromIndex, toIndex) => {
|
|
390
|
+
console.log(`Animating from index ${fromIndex} to ${toIndex}`);
|
|
391
|
+
},
|
|
392
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_bottomSheet.BottomSheetView, {
|
|
393
|
+
style: [styles.contentContainer,
|
|
394
|
+
// Override padding if provided in customStyles
|
|
395
|
+
customStyles.contentPadding !== undefined && {
|
|
396
|
+
padding: customStyles.contentPadding
|
|
397
|
+
},
|
|
398
|
+
// Add bottom padding when keyboard is visible to ensure content is not covered
|
|
399
|
+
keyboardVisible && {
|
|
400
|
+
paddingBottom: Math.max(keyboardHeight - insets.bottom, 0)
|
|
401
|
+
}],
|
|
402
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
403
|
+
style: [styles.animatedContent,
|
|
404
|
+
// Apply animations - conditionally for Android
|
|
405
|
+
_reactNative.Platform.OS === 'android' ? {
|
|
406
|
+
opacity: 1 // No fade animation on Android
|
|
407
|
+
} : {
|
|
408
|
+
opacity: fadeAnim,
|
|
409
|
+
transform: [{
|
|
410
|
+
translateY: slideAnim
|
|
411
|
+
}]
|
|
412
|
+
}],
|
|
413
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyRouter.default, {
|
|
414
|
+
oxyServices: oxyServices,
|
|
415
|
+
initialScreen: initialScreen,
|
|
416
|
+
onClose: handleClose,
|
|
417
|
+
onAuthenticated: handleAuthenticated,
|
|
418
|
+
theme: theme,
|
|
419
|
+
adjustSnapPoints: adjustSnapPoints
|
|
420
|
+
})
|
|
421
|
+
})
|
|
422
|
+
})
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
const styles = _reactNative.StyleSheet.create({
|
|
426
|
+
contentContainer: {
|
|
427
|
+
flex: 1,
|
|
428
|
+
padding: 16,
|
|
429
|
+
width: '100%',
|
|
430
|
+
height: '100%',
|
|
431
|
+
backgroundColor: 'transparent' // Make this transparent to let the bottom sheet background show through
|
|
432
|
+
},
|
|
433
|
+
animatedContent: {
|
|
434
|
+
flex: 1,
|
|
435
|
+
width: '100%',
|
|
436
|
+
height: '100%'
|
|
437
|
+
},
|
|
438
|
+
indicator: {
|
|
439
|
+
width: 40,
|
|
440
|
+
height: 4,
|
|
441
|
+
alignSelf: 'center',
|
|
442
|
+
marginTop: 8,
|
|
443
|
+
marginBottom: 8,
|
|
444
|
+
borderRadius: 35
|
|
445
|
+
},
|
|
446
|
+
errorContainer: {
|
|
447
|
+
flex: 1,
|
|
448
|
+
justifyContent: 'center',
|
|
449
|
+
alignItems: 'center'
|
|
450
|
+
},
|
|
451
|
+
gestureHandlerRoot: {
|
|
452
|
+
flex: 1,
|
|
453
|
+
position: 'relative',
|
|
454
|
+
backgroundColor: 'transparent',
|
|
455
|
+
..._reactNative.Platform.select({
|
|
456
|
+
android: {
|
|
457
|
+
height: '100%',
|
|
458
|
+
width: '100%'
|
|
459
|
+
}
|
|
460
|
+
})
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
var _default = exports.default = OxyProvider;
|
|
464
|
+
//# sourceMappingURL=OxyProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeSafeAreaContext","_reactNativeGestureHandler","_OxyContext","_OxyRouter","_interopRequireDefault","_FontLoader","_bottomSheet","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","setupFonts","height","width","Dimensions","OxyProvider","props","oxyServices","children","contextOnly","onAuthStateChange","storageKeyPrefix","bottomSheetProps","internalBottomSheetRef","useRef","jsx","OxyContextProvider","bottomSheetRef","FontLoader","GestureHandlerRootView","style","styles","gestureHandlerRoot","jsxs","BottomSheetModalProvider","StatusBar","translucent","backgroundColor","SafeAreaProvider","OxyBottomSheet","initialScreen","onClose","onAuthenticated","theme","customStyles","autoPresent","modalRef","useEffect","current","methodsToExpose","forEach","method","args","_navigateToScreen","screenName","document","event","CustomEvent","detail","dispatchEvent","console","log","snapPoints","setSnapPoints","useState","fadeAnim","Animated","Value","slideAnim","handleScaleAnim","keyboardVisible","setKeyboardVisible","keyboardHeight","setKeyboardHeight","insets","useSafeAreaInsets","oxyContext","useOxy","keyboardWillShowListener","Keyboard","addListener","Platform","OS","keyboardHeightValue","endCoordinates","snapToIndex","keyboardWillHideListener","remove","expand","present","parallel","timing","toValue","duration","useNativeDriver","spring","friction","tension","start","timer","setTimeout","clearTimeout","handleAuthenticated","useCallback","user","pulseAnimation","sequence","renderBackdrop","BottomSheetBackdrop","disappearsOnIndex","appearsOnIndex","opacity","getBackgroundStyle","baseColor","select","android","elevation","adjustSnapPoints","points","highestPoint","length","navigateToScreen","screen","handleClose","dismiss","handleSheetChanges","index","BottomSheetModal","ref","enablePanDownToClose","backdropComponent","handleComponent","View","alignItems","paddingVertical","transform","scale","indicator","handleColor","backgroundStyle","borderTopLeftRadius","borderTopRightRadius","handleIndicatorStyle","onChange","keyboardBehavior","keyboardBlurBehavior","android_keyboardInputMode","enableOverDrag","enableContentPanningGesture","enableHandlePanningGesture","overDragResistanceFactor","enableBlurKeyboardOnGesture","onAnimate","fromIndex","toIndex","BottomSheetView","contentContainer","contentPadding","undefined","padding","paddingBottom","Math","max","bottom","animatedContent","translateY","StyleSheet","create","flex","alignSelf","marginTop","marginBottom","borderRadius","errorContainer","justifyContent","position","_default","exports"],"sourceRoot":"../../../../src","sources":["ui/components/OxyProvider.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,0BAAA,GAAAH,OAAA;AAMA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAGA,IAAAQ,YAAA,GAAAR,OAAA;AAA2I,IAAAS,WAAA,GAAAT,OAAA;AAAA,SAAAM,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAX,wBAAAW,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAf,uBAAA,YAAAA,CAAAW,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,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3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.OxySignInButton = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _OxyContext = require("../context/OxyContext");
|
|
10
|
+
var _OxyLogo = _interopRequireDefault(require("./OxyLogo"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
/**
|
|
14
|
+
* A pre-styled button component for signing in with Oxy services
|
|
15
|
+
*
|
|
16
|
+
* This component automatically integrates with the OxyProvider context
|
|
17
|
+
* and will control the authentication bottom sheet when pressed.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* // Basic usage
|
|
22
|
+
* <OxySignInButton />
|
|
23
|
+
*
|
|
24
|
+
* // Custom styling
|
|
25
|
+
* <OxySignInButton
|
|
26
|
+
* variant="contained"
|
|
27
|
+
* style={{ marginTop: 20 }}
|
|
28
|
+
* text="Login with Oxy"
|
|
29
|
+
* />
|
|
30
|
+
*
|
|
31
|
+
* // Custom handler
|
|
32
|
+
* <OxySignInButton onPress={() => {
|
|
33
|
+
* // Custom authentication flow
|
|
34
|
+
* console.log('Custom auth flow initiated');
|
|
35
|
+
* }} />
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
const OxySignInButton = ({
|
|
39
|
+
variant = 'default',
|
|
40
|
+
onPress,
|
|
41
|
+
style,
|
|
42
|
+
textStyle,
|
|
43
|
+
text = 'Sign in with Oxy',
|
|
44
|
+
disabled = false,
|
|
45
|
+
showWhenAuthenticated = false
|
|
46
|
+
}) => {
|
|
47
|
+
// Get all needed values from context in a single call
|
|
48
|
+
const {
|
|
49
|
+
user,
|
|
50
|
+
showBottomSheet
|
|
51
|
+
} = (0, _OxyContext.useOxy)();
|
|
52
|
+
|
|
53
|
+
// Don't show the button if already authenticated (unless explicitly overridden)
|
|
54
|
+
if (user && !showWhenAuthenticated) return null;
|
|
55
|
+
|
|
56
|
+
// Default handler that uses the context methods
|
|
57
|
+
const handlePress = () => {
|
|
58
|
+
if (onPress) {
|
|
59
|
+
onPress();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Default behavior: open the bottom sheet and navigate to SignIn
|
|
64
|
+
if (showBottomSheet) {
|
|
65
|
+
// Show the bottom sheet and navigate to SignIn
|
|
66
|
+
showBottomSheet('SignIn');
|
|
67
|
+
} else {
|
|
68
|
+
console.warn('OxySignInButton: showBottomSheet is not available. Either provide an onPress prop or ensure this component is used within an OxyProvider.');
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Determine the button style based on the variant
|
|
73
|
+
const getButtonStyle = () => {
|
|
74
|
+
switch (variant) {
|
|
75
|
+
case 'outline':
|
|
76
|
+
return [styles.buttonOutline, style];
|
|
77
|
+
case 'contained':
|
|
78
|
+
return [styles.buttonContained, style];
|
|
79
|
+
default:
|
|
80
|
+
return [styles.buttonDefault, style];
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// Determine the text style based on the variant
|
|
85
|
+
const getTextStyle = () => {
|
|
86
|
+
switch (variant) {
|
|
87
|
+
case 'outline':
|
|
88
|
+
return [styles.textOutline, textStyle];
|
|
89
|
+
case 'contained':
|
|
90
|
+
return [styles.textContained, textStyle];
|
|
91
|
+
default:
|
|
92
|
+
return [styles.textDefault, textStyle];
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// This function was previously used for logo container styling
|
|
97
|
+
// Now removed as we're not using the container anymore
|
|
98
|
+
|
|
99
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
100
|
+
style: [styles.button, getButtonStyle(), disabled && styles.buttonDisabled],
|
|
101
|
+
onPress: handlePress,
|
|
102
|
+
disabled: disabled,
|
|
103
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
104
|
+
style: styles.buttonContent,
|
|
105
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyLogo.default, {
|
|
106
|
+
width: 20,
|
|
107
|
+
height: 20,
|
|
108
|
+
fillColor: variant === 'contained' ? 'white' : '#d169e5',
|
|
109
|
+
secondaryFillColor: variant === 'contained' ? '#d169e5' : undefined,
|
|
110
|
+
style: disabled ? {
|
|
111
|
+
opacity: 0.6
|
|
112
|
+
} : undefined
|
|
113
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
114
|
+
style: [styles.text, getTextStyle(), disabled && styles.textDisabled],
|
|
115
|
+
children: text
|
|
116
|
+
})]
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
exports.OxySignInButton = OxySignInButton;
|
|
121
|
+
const styles = _reactNative.StyleSheet.create({
|
|
122
|
+
button: {
|
|
123
|
+
padding: 14,
|
|
124
|
+
borderRadius: 35,
|
|
125
|
+
alignItems: 'center',
|
|
126
|
+
justifyContent: 'center'
|
|
127
|
+
},
|
|
128
|
+
buttonDefault: {
|
|
129
|
+
backgroundColor: '#FFFFFF',
|
|
130
|
+
borderWidth: 1,
|
|
131
|
+
borderColor: '#DDDDDD',
|
|
132
|
+
shadowColor: '#000000',
|
|
133
|
+
shadowOffset: {
|
|
134
|
+
width: 0,
|
|
135
|
+
height: 2
|
|
136
|
+
},
|
|
137
|
+
shadowOpacity: 0.1,
|
|
138
|
+
shadowRadius: 4,
|
|
139
|
+
elevation: 2
|
|
140
|
+
},
|
|
141
|
+
buttonOutline: {
|
|
142
|
+
backgroundColor: 'transparent',
|
|
143
|
+
borderWidth: 1,
|
|
144
|
+
borderColor: '#d169e5'
|
|
145
|
+
},
|
|
146
|
+
buttonContained: {
|
|
147
|
+
backgroundColor: '#d169e5'
|
|
148
|
+
},
|
|
149
|
+
buttonDisabled: {
|
|
150
|
+
opacity: 0.6
|
|
151
|
+
},
|
|
152
|
+
buttonContent: {
|
|
153
|
+
flexDirection: 'row',
|
|
154
|
+
alignItems: 'center',
|
|
155
|
+
justifyContent: 'center'
|
|
156
|
+
},
|
|
157
|
+
text: {
|
|
158
|
+
fontFamily: _reactNative.Platform.OS === 'web' ? 'Phudu' : 'Phudu-SemiBold',
|
|
159
|
+
fontWeight: _reactNative.Platform.OS === 'web' ? '600' : undefined,
|
|
160
|
+
// Only apply fontWeight on web
|
|
161
|
+
fontSize: 16,
|
|
162
|
+
marginLeft: 10
|
|
163
|
+
},
|
|
164
|
+
textDefault: {
|
|
165
|
+
color: '#333333'
|
|
166
|
+
},
|
|
167
|
+
textOutline: {
|
|
168
|
+
color: '#d169e5'
|
|
169
|
+
},
|
|
170
|
+
textContained: {
|
|
171
|
+
color: '#FFFFFF'
|
|
172
|
+
},
|
|
173
|
+
textDisabled: {
|
|
174
|
+
color: '#888888'
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
var _default = exports.default = OxySignInButton;
|
|
178
|
+
//# sourceMappingURL=OxySignInButton.js.map
|