@onairos/react-native 3.0.9 → 3.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/assets/images/onairos_logo.svg +6 -0
- package/lib/commonjs/components/Onairos.js +214 -60
- package/lib/commonjs/components/Onairos.js.map +1 -1
- package/lib/commonjs/components/OnairosButton.js +105 -42
- package/lib/commonjs/components/OnairosButton.js.map +1 -1
- package/lib/commonjs/components/UniversalOnboarding.js +98 -26
- package/lib/commonjs/components/UniversalOnboarding.js.map +1 -1
- package/lib/module/assets/images/onairos_logo.svg +6 -0
- package/lib/module/components/Onairos.js +217 -62
- package/lib/module/components/Onairos.js.map +1 -1
- package/lib/module/components/OnairosButton.js +107 -43
- package/lib/module/components/OnairosButton.js.map +1 -1
- package/lib/module/components/UniversalOnboarding.js +100 -28
- package/lib/module/components/UniversalOnboarding.js.map +1 -1
- package/lib/module/index.js +10 -9
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/components/Onairos.d.ts +26 -24
- package/lib/typescript/components/Onairos.d.ts.map +1 -1
- package/lib/typescript/components/OnairosButton.d.ts +5 -1
- package/lib/typescript/components/OnairosButton.d.ts.map +1 -1
- package/lib/typescript/components/UniversalOnboarding.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +2 -1
- package/lib/typescript/types.d.ts.map +1 -1
- package/package.json +5 -3
- package/src/assets/images/onairos_logo.svg +6 -0
- package/src/components/Onairos.tsx +283 -89
- package/src/components/OnairosButton.tsx +110 -46
- package/src/components/UniversalOnboarding.tsx +105 -28
- package/src/types.ts +2 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect width="40" height="40" rx="8" fill="currentColor"/>
|
|
3
|
+
<path d="M20 10C14.48 10 10 14.48 10 20C10 25.52 14.48 30 20 30C25.52 30 30 25.52 30 20C30 14.48 25.52 10 20 10ZM20 28C15.59 28 12 24.41 12 20C12 15.59 15.59 12 20 12C24.41 12 28 15.59 28 20C28 24.41 24.41 28 20 28Z" fill="white"/>
|
|
4
|
+
<path d="M20 15C18.9 15 18 15.9 18 17V19C18 20.1 18.9 21 20 21C21.1 21 22 20.1 22 19V17C22 15.9 21.1 15 20 15Z" fill="white"/>
|
|
5
|
+
<path d="M20 24C19.448 24 19 24.448 19 25C19 25.552 19.448 26 20 26C20.552 26 21 25.552 21 25C21 24.448 20.552 24 20 24Z" fill="white"/>
|
|
6
|
+
</svg>
|
|
@@ -6,84 +6,238 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Onairos = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
var
|
|
9
|
+
var _reactNativeSvg = require("react-native-svg");
|
|
10
|
+
var _UniversalOnboarding = require("./UniversalOnboarding");
|
|
11
|
+
var _Overlay = require("./Overlay");
|
|
10
12
|
var _secureStorage = require("../utils/secureStorage");
|
|
13
|
+
var _api = require("../api");
|
|
14
|
+
var _Portal = require("../utils/Portal");
|
|
11
15
|
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); }
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
// Import the Onairos logo SVG
|
|
17
|
+
const onairosLogoSvg = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
18
|
+
<rect width="40" height="40" rx="8" fill="currentColor"/>
|
|
19
|
+
<path d="M20 10C14.48 10 10 14.48 10 20C10 25.52 14.48 30 20 30C25.52 30 30 25.52 30 20C30 14.48 25.52 10 20 10ZM20 28C15.59 28 12 24.41 12 20C12 15.59 15.59 12 20 12C24.41 12 28 15.59 28 20C28 24.41 24.41 28 20 28Z" fill="white"/>
|
|
20
|
+
<path d="M20 15C18.9 15 18 15.9 18 17V19C18 20.1 18.9 21 20 21C21.1 21 22 20.1 22 19V17C22 15.9 21.1 15 20 15Z" fill="white"/>
|
|
21
|
+
<path d="M20 24C19.448 24 19 24.448 19 25C19 25.552 19.448 26 20 26C20.552 26 21 25.552 21 25C21 24.448 20.552 24 20 24Z" fill="white"/>
|
|
22
|
+
</svg>`;
|
|
23
|
+
const Onairos = exports.Onairos = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
17
24
|
returnLink,
|
|
18
|
-
|
|
25
|
+
prefillUrl,
|
|
26
|
+
AppName,
|
|
19
27
|
buttonType = 'normal',
|
|
20
|
-
|
|
21
|
-
buttonWidth,
|
|
28
|
+
requestData,
|
|
29
|
+
buttonWidth = 180,
|
|
22
30
|
buttonHeight,
|
|
31
|
+
hasStroke = false,
|
|
32
|
+
enabled = true,
|
|
33
|
+
buttonForm = 'default',
|
|
34
|
+
onRejection,
|
|
35
|
+
onResolved,
|
|
36
|
+
preCheck,
|
|
23
37
|
color,
|
|
24
|
-
|
|
38
|
+
debug = false,
|
|
39
|
+
darkMode = false,
|
|
25
40
|
preferredPlatform,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const [
|
|
32
|
-
const [
|
|
33
|
-
|
|
41
|
+
testMode = false
|
|
42
|
+
}, ref) => {
|
|
43
|
+
const [showOnboarding, setShowOnboarding] = (0, _react.useState)(false);
|
|
44
|
+
const [showOverlay, setShowOverlay] = (0, _react.useState)(false);
|
|
45
|
+
const [storedCredentials, setStoredCredentials] = (0, _react.useState)(null);
|
|
46
|
+
const [isLoading, setIsLoading] = (0, _react.useState)(false);
|
|
47
|
+
const [isPressed, setIsPressed] = (0, _react.useState)(false);
|
|
48
|
+
|
|
49
|
+
// Expose methods for external control
|
|
50
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
51
|
+
trigger: async () => {
|
|
52
|
+
await handlePress();
|
|
53
|
+
},
|
|
54
|
+
reset: async () => {
|
|
55
|
+
await (0, _secureStorage.deleteCredentials)();
|
|
56
|
+
}
|
|
57
|
+
}));
|
|
58
|
+
|
|
59
|
+
// Compute button text based on buttonForm
|
|
60
|
+
const getButtonText = () => {
|
|
61
|
+
if (buttonForm === 'connect') {
|
|
62
|
+
return 'Connect with Onairos';
|
|
63
|
+
} else {
|
|
64
|
+
return 'Sign in with Onairos';
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// Calculate background color based on props and state
|
|
69
|
+
const getBackgroundColor = () => {
|
|
70
|
+
if (!enabled) {
|
|
71
|
+
return darkMode ? '#3A3A3A' : '#e0e0e0';
|
|
72
|
+
}
|
|
73
|
+
if (isPressed) {
|
|
74
|
+
return color ? typeof color === 'string' ? `${color}80` : color : darkMode ? '#32323280' : '#f5f5f580';
|
|
75
|
+
}
|
|
76
|
+
return color || (darkMode ? '#2A2A2A' : '#ffffff');
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// Calculate text color based on background luminance
|
|
80
|
+
const getTextColor = () => {
|
|
81
|
+
if (!enabled) {
|
|
82
|
+
return darkMode ? '#777777' : '#AAAAAA';
|
|
83
|
+
}
|
|
84
|
+
if (darkMode) {
|
|
85
|
+
return '#FFFFFF';
|
|
86
|
+
}
|
|
87
|
+
const bgColor = getBackgroundColor();
|
|
88
|
+
// Simple luminance check - in a real app, this would use a proper algorithm
|
|
89
|
+
return bgColor === '#ffffff' || bgColor === '#f5f5f580' || bgColor.includes('#f') ? '#000000' : '#FFFFFF';
|
|
90
|
+
};
|
|
91
|
+
const handlePress = async () => {
|
|
92
|
+
if (!enabled || isLoading) return;
|
|
93
|
+
setIsLoading(true);
|
|
34
94
|
try {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
95
|
+
if (preCheck) {
|
|
96
|
+
const shouldProceed = await preCheck();
|
|
97
|
+
if (!shouldProceed) {
|
|
98
|
+
onRejection === null || onRejection === void 0 || onRejection('Precheck validation failed');
|
|
99
|
+
setIsLoading(false);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Check if credentials exist
|
|
105
|
+
const hasStoredCreds = await (0, _secureStorage.hasCredentials)();
|
|
106
|
+
if (hasStoredCreds) {
|
|
107
|
+
// If credentials exist, fetch them and verify
|
|
40
108
|
const credentials = await (0, _secureStorage.getCredentials)();
|
|
41
|
-
if (!credentials || !credentials.username
|
|
42
|
-
|
|
109
|
+
if (!credentials || !credentials.username) {
|
|
110
|
+
// Invalid credentials, clear and start fresh
|
|
111
|
+
await (0, _secureStorage.deleteCredentials)();
|
|
112
|
+
setShowOnboarding(true);
|
|
113
|
+
setIsLoading(false);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
// Validate credentials with server
|
|
118
|
+
const isValid = await _api.onairosApi.validateCredentials(credentials.username);
|
|
119
|
+
if (!isValid) {
|
|
120
|
+
// Clear invalid credentials
|
|
121
|
+
await (0, _secureStorage.deleteCredentials)();
|
|
122
|
+
setShowOnboarding(true);
|
|
123
|
+
setIsLoading(false);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Store and display overlay with valid credentials
|
|
128
|
+
setStoredCredentials(credentials);
|
|
129
|
+
setShowOverlay(true);
|
|
130
|
+
} catch (validationError) {
|
|
131
|
+
console.warn('Validation error, proceeding to onboarding:', validationError);
|
|
132
|
+
setShowOnboarding(true);
|
|
43
133
|
}
|
|
134
|
+
} else {
|
|
135
|
+
// If no credentials, show onboarding
|
|
136
|
+
setShowOnboarding(true);
|
|
44
137
|
}
|
|
45
138
|
} catch (error) {
|
|
46
|
-
console.error('Error
|
|
139
|
+
console.error('Error during button press flow:', error);
|
|
140
|
+
// Fall back to onboarding on error
|
|
141
|
+
setShowOnboarding(true);
|
|
142
|
+
onRejection === null || onRejection === void 0 || onRejection(error instanceof Error ? error.message : 'Unknown error');
|
|
47
143
|
} finally {
|
|
48
|
-
|
|
144
|
+
setIsLoading(false);
|
|
49
145
|
}
|
|
50
|
-
}
|
|
51
|
-
(0, _react.
|
|
52
|
-
|
|
53
|
-
}, [initialize]);
|
|
54
|
-
const handleResolved = (0, _react.useCallback)((apiUrl, token, userData) => {
|
|
146
|
+
};
|
|
147
|
+
const handleOnboardingComplete = (0, _react.useCallback)((apiUrl, token, data) => {
|
|
148
|
+
setShowOnboarding(false);
|
|
55
149
|
if (onResolved) {
|
|
56
|
-
onResolved(apiUrl, token,
|
|
150
|
+
onResolved(apiUrl, token, data);
|
|
57
151
|
}
|
|
58
152
|
}, [onResolved]);
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
153
|
+
const handleOverlayResolved = (0, _react.useCallback)((apiUrl, token, data) => {
|
|
154
|
+
setShowOverlay(false);
|
|
155
|
+
if (onResolved) {
|
|
156
|
+
onResolved(apiUrl, token, data);
|
|
62
157
|
}
|
|
63
|
-
}, [
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
158
|
+
}, [onResolved]);
|
|
159
|
+
|
|
160
|
+
// Apply custom styling based on props
|
|
161
|
+
const buttonStyle = [styles.button, {
|
|
162
|
+
width: buttonWidth,
|
|
163
|
+
height: buttonHeight || 48,
|
|
164
|
+
backgroundColor: getBackgroundColor(),
|
|
165
|
+
borderWidth: hasStroke ? 1 : 0,
|
|
166
|
+
borderColor: darkMode ? '#555555' : '#000000',
|
|
167
|
+
borderRadius: buttonType === 'pill' ? 24 : 8
|
|
168
|
+
}];
|
|
169
|
+
const textStyle = {
|
|
170
|
+
...styles.buttonText,
|
|
171
|
+
color: getTextColor(),
|
|
172
|
+
opacity: enabled ? 1 : 0.7
|
|
173
|
+
};
|
|
174
|
+
const logoColor = getTextColor();
|
|
175
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
176
|
+
style: buttonStyle,
|
|
177
|
+
onPress: handlePress,
|
|
178
|
+
disabled: !enabled || isLoading,
|
|
179
|
+
accessibilityLabel: "Sign in with Onairos",
|
|
180
|
+
onPressIn: () => setIsPressed(true),
|
|
181
|
+
onPressOut: () => setIsPressed(false)
|
|
182
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
183
|
+
style: styles.buttonContent
|
|
184
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNativeSvg.SvgXml, {
|
|
185
|
+
xml: onairosLogoSvg.replace('currentColor', logoColor),
|
|
186
|
+
width: 24,
|
|
187
|
+
height: 24,
|
|
188
|
+
style: styles.logo
|
|
189
|
+
}), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
190
|
+
style: textStyle
|
|
191
|
+
}, getButtonText()))), showOnboarding && /*#__PURE__*/_react.default.createElement(_UniversalOnboarding.UniversalOnboarding, {
|
|
192
|
+
visible: showOnboarding,
|
|
193
|
+
onClose: () => {
|
|
194
|
+
setShowOnboarding(false);
|
|
195
|
+
onRejection === null || onRejection === void 0 || onRejection('User closed onboarding');
|
|
196
|
+
},
|
|
71
197
|
AppName: AppName,
|
|
72
|
-
returnLink: returnLink,
|
|
73
198
|
requestData: requestData,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}));
|
|
87
|
-
};
|
|
88
|
-
|
|
199
|
+
returnLink: returnLink || '',
|
|
200
|
+
onComplete: handleOnboardingComplete,
|
|
201
|
+
debug: debug,
|
|
202
|
+
test: testMode,
|
|
203
|
+
preferredPlatform: preferredPlatform
|
|
204
|
+
}), showOverlay && storedCredentials && /*#__PURE__*/_react.default.createElement(_Portal.Portal, null, /*#__PURE__*/_react.default.createElement(_Overlay.Overlay, {
|
|
205
|
+
data: requestData || {},
|
|
206
|
+
username: storedCredentials.username,
|
|
207
|
+
modelKey: storedCredentials.userPin || '',
|
|
208
|
+
onResolved: handleOverlayResolved,
|
|
209
|
+
appName: AppName,
|
|
210
|
+
darkMode: darkMode
|
|
211
|
+
})));
|
|
212
|
+
});
|
|
213
|
+
const styles = _reactNative.StyleSheet.create({
|
|
214
|
+
button: {
|
|
215
|
+
flexDirection: 'row',
|
|
216
|
+
alignItems: 'center',
|
|
217
|
+
justifyContent: 'center',
|
|
218
|
+
paddingVertical: 12,
|
|
219
|
+
paddingHorizontal: 16,
|
|
220
|
+
shadowColor: '#000',
|
|
221
|
+
shadowOffset: {
|
|
222
|
+
width: 0,
|
|
223
|
+
height: 2
|
|
224
|
+
},
|
|
225
|
+
shadowOpacity: 0.1,
|
|
226
|
+
shadowRadius: 4,
|
|
227
|
+
elevation: 2
|
|
228
|
+
},
|
|
229
|
+
buttonContent: {
|
|
230
|
+
flexDirection: 'row',
|
|
231
|
+
alignItems: 'center',
|
|
232
|
+
justifyContent: 'center'
|
|
233
|
+
},
|
|
234
|
+
logo: {
|
|
235
|
+
marginRight: 8
|
|
236
|
+
},
|
|
237
|
+
buttonText: {
|
|
238
|
+
fontSize: 16,
|
|
239
|
+
fontWeight: '600',
|
|
240
|
+
textAlign: 'center'
|
|
241
|
+
}
|
|
242
|
+
});
|
|
89
243
|
//# sourceMappingURL=Onairos.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeSvg","_UniversalOnboarding","_Overlay","_secureStorage","_api","_Portal","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","onairosLogoSvg","Onairos","exports","forwardRef","returnLink","prefillUrl","AppName","buttonType","requestData","buttonWidth","buttonHeight","hasStroke","enabled","buttonForm","onRejection","onResolved","preCheck","color","debug","darkMode","preferredPlatform","testMode","ref","showOnboarding","setShowOnboarding","useState","showOverlay","setShowOverlay","storedCredentials","setStoredCredentials","isLoading","setIsLoading","isPressed","setIsPressed","useImperativeHandle","trigger","handlePress","reset","deleteCredentials","getButtonText","getBackgroundColor","getTextColor","bgColor","includes","shouldProceed","hasStoredCreds","hasCredentials","credentials","getCredentials","username","isValid","onairosApi","validateCredentials","validationError","console","warn","error","Error","message","handleOnboardingComplete","useCallback","apiUrl","token","data","handleOverlayResolved","buttonStyle","styles","button","width","height","backgroundColor","borderWidth","borderColor","borderRadius","textStyle","buttonText","opacity","logoColor","createElement","Fragment","TouchableOpacity","style","onPress","disabled","accessibilityLabel","onPressIn","onPressOut","View","buttonContent","SvgXml","xml","replace","logo","Text","UniversalOnboarding","visible","onClose","onComplete","test","Portal","Overlay","modelKey","userPin","appName","StyleSheet","create","flexDirection","alignItems","justifyContent","paddingVertical","paddingHorizontal","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","marginRight","fontSize","fontWeight","textAlign"],"sourceRoot":"..\\..\\..\\src","sources":["components/Onairos.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AASA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAEA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,IAAA,GAAAN,OAAA;AAC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AAEiD,qBAAsB;IAClCuC,OAAO,EAAEjG,OAAQ;IACjBa,QAAQ,EAAEA;EAAS,CACpB,CACK,CAEV,CAAC;AAEP,CAAC,CAAC;AAEF,MAAM+C,MAAM,GAAGsC,uBAAU,CAACC,MAAM,CAAC;EAC/BtC,MAAM,EAAE;IACNuC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,eAAe,EAAE,EAAE;IACnBC,iBAAiB,EAAE,EAAE;IACrBC,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MAAE5C,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;IACrC4C,aAAa,EAAE,GAAG;IAClBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE;EACb,CAAC;EACD3B,aAAa,EAAE;IACbkB,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;EACDhB,IAAI,EAAE;IACJwB,WAAW,EAAE;EACf,CAAC;EACDzC,UAAU,EAAE;IACV0C,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -6,24 +6,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.OnairosButton = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeSvg = require("react-native-svg");
|
|
9
10
|
var _UniversalOnboarding = require("./UniversalOnboarding");
|
|
10
11
|
var _Overlay = require("./Overlay");
|
|
11
12
|
var _secureStorage = require("../utils/secureStorage");
|
|
12
13
|
var _api = require("../api");
|
|
13
14
|
var _Portal = require("../utils/Portal");
|
|
14
15
|
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); }
|
|
16
|
+
// Import the Onairos logo SVG
|
|
17
|
+
const onairosLogoSvg = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
18
|
+
<rect width="40" height="40" rx="8" fill="currentColor"/>
|
|
19
|
+
<path d="M20 10C14.48 10 10 14.48 10 20C10 25.52 14.48 30 20 30C25.52 30 30 25.52 30 20C30 14.48 25.52 10 20 10ZM20 28C15.59 28 12 24.41 12 20C12 15.59 15.59 12 20 12C24.41 12 28 15.59 28 20C28 24.41 24.41 28 20 28Z" fill="white"/>
|
|
20
|
+
<path d="M20 15C18.9 15 18 15.9 18 17V19C18 20.1 18.9 21 20 21C21.1 21 22 20.1 22 19V17C22 15.9 21.1 15 20 15Z" fill="white"/>
|
|
21
|
+
<path d="M20 24C19.448 24 19 24.448 19 25C19 25.552 19.448 26 20 26C20.552 26 21 25.552 21 25C21 24.448 20.552 24 20 24Z" fill="white"/>
|
|
22
|
+
</svg>`;
|
|
15
23
|
/**
|
|
16
24
|
* OnairosButton Component - A sign-in button similar to Google/Apple sign-in
|
|
17
25
|
*/
|
|
18
|
-
const OnairosButton = ({
|
|
26
|
+
const OnairosButton = exports.OnairosButton = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
19
27
|
returnLink,
|
|
20
28
|
prefillUrl,
|
|
21
29
|
AppName,
|
|
22
30
|
buttonType = 'normal',
|
|
23
31
|
requestData,
|
|
24
|
-
buttonWidth =
|
|
32
|
+
buttonWidth = 180,
|
|
25
33
|
buttonHeight = 48,
|
|
26
|
-
hasStroke =
|
|
34
|
+
hasStroke = false,
|
|
27
35
|
enabled = true,
|
|
28
36
|
buttonForm = 'default',
|
|
29
37
|
onRejection,
|
|
@@ -32,14 +40,58 @@ const OnairosButton = ({
|
|
|
32
40
|
color,
|
|
33
41
|
swerv = false,
|
|
34
42
|
debug = false,
|
|
43
|
+
darkMode = false,
|
|
35
44
|
preferredPlatform,
|
|
36
45
|
testMode = false
|
|
37
|
-
}) => {
|
|
46
|
+
}, ref) => {
|
|
38
47
|
const [showOnboarding, setShowOnboarding] = (0, _react.useState)(false);
|
|
39
48
|
const [showOverlay, setShowOverlay] = (0, _react.useState)(false);
|
|
40
49
|
const [storedCredentials, setStoredCredentials] = (0, _react.useState)(null);
|
|
41
50
|
const [isLoading, setIsLoading] = (0, _react.useState)(false);
|
|
42
|
-
const
|
|
51
|
+
const [isPressed, setIsPressed] = (0, _react.useState)(false);
|
|
52
|
+
|
|
53
|
+
// Expose methods via ref
|
|
54
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
55
|
+
trigger: async () => {
|
|
56
|
+
await handlePress();
|
|
57
|
+
},
|
|
58
|
+
reset: async () => {
|
|
59
|
+
await (0, _secureStorage.deleteCredentials)();
|
|
60
|
+
}
|
|
61
|
+
}));
|
|
62
|
+
|
|
63
|
+
// Compute button text based on buttonForm
|
|
64
|
+
const getButtonText = () => {
|
|
65
|
+
if (buttonForm === 'connect' || buttonForm === 'signup') {
|
|
66
|
+
return 'Connect with Onairos';
|
|
67
|
+
} else {
|
|
68
|
+
return 'Sign in with Onairos';
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Calculate background color based on props and state
|
|
73
|
+
const getBackgroundColor = () => {
|
|
74
|
+
if (!enabled) {
|
|
75
|
+
return darkMode ? '#3A3A3A' : '#e0e0e0';
|
|
76
|
+
}
|
|
77
|
+
if (isPressed) {
|
|
78
|
+
return color ? typeof color === 'string' ? `${color}80` : color : darkMode ? '#32323280' : '#f5f5f580';
|
|
79
|
+
}
|
|
80
|
+
return color || (darkMode ? '#2A2A2A' : '#ffffff');
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// Calculate text color based on background luminance
|
|
84
|
+
const getTextColor = () => {
|
|
85
|
+
if (!enabled) {
|
|
86
|
+
return darkMode ? '#777777' : '#AAAAAA';
|
|
87
|
+
}
|
|
88
|
+
if (darkMode) {
|
|
89
|
+
return '#FFFFFF';
|
|
90
|
+
}
|
|
91
|
+
const bgColor = getBackgroundColor();
|
|
92
|
+
// Simple luminance check
|
|
93
|
+
return bgColor === '#ffffff' || bgColor === '#f5f5f580' || bgColor.includes('#f') ? '#000000' : '#FFFFFF';
|
|
94
|
+
};
|
|
43
95
|
const handlePress = async () => {
|
|
44
96
|
if (!enabled || isLoading) return;
|
|
45
97
|
setIsLoading(true);
|
|
@@ -66,7 +118,7 @@ const OnairosButton = ({
|
|
|
66
118
|
return;
|
|
67
119
|
}
|
|
68
120
|
try {
|
|
69
|
-
// Validate credentials with server
|
|
121
|
+
// Validate credentials with server
|
|
70
122
|
const isValid = await _api.onairosApi.validateCredentials(credentials.username);
|
|
71
123
|
if (!isValid) {
|
|
72
124
|
// Clear invalid credentials
|
|
@@ -112,26 +164,38 @@ const OnairosButton = ({
|
|
|
112
164
|
// Calculate button styles based on props
|
|
113
165
|
const buttonStyle = [styles.button, buttonType === 'pill' && styles.pillButton, hasStroke && styles.strokedButton, {
|
|
114
166
|
width: buttonWidth,
|
|
115
|
-
height: buttonHeight
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
167
|
+
height: buttonHeight,
|
|
168
|
+
backgroundColor: getBackgroundColor(),
|
|
169
|
+
borderColor: darkMode ? '#555555' : '#000000'
|
|
170
|
+
}, swerv && styles.swervButton, !enabled && styles.disabledButton].filter(Boolean);
|
|
119
171
|
|
|
120
|
-
// Calculate text
|
|
121
|
-
const
|
|
172
|
+
// Calculate text color
|
|
173
|
+
const textColor = getTextColor();
|
|
174
|
+
const logoColor = textColor;
|
|
122
175
|
|
|
123
176
|
// Render components
|
|
124
177
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
125
178
|
style: buttonStyle,
|
|
126
179
|
onPress: handlePress,
|
|
127
180
|
disabled: !enabled || isLoading,
|
|
128
|
-
accessibilityLabel: `Sign in with Onairos
|
|
181
|
+
accessibilityLabel: `Sign in with Onairos`,
|
|
182
|
+
onPressIn: () => setIsPressed(true),
|
|
183
|
+
onPressOut: () => setIsPressed(false)
|
|
129
184
|
}, isLoading ? /*#__PURE__*/_react.default.createElement(_reactNative.ActivityIndicator, {
|
|
130
185
|
size: "small",
|
|
131
|
-
color:
|
|
132
|
-
}) : /*#__PURE__*/_react.default.createElement(
|
|
133
|
-
style:
|
|
134
|
-
},
|
|
186
|
+
color: textColor
|
|
187
|
+
}) : /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
188
|
+
style: styles.buttonContent
|
|
189
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNativeSvg.SvgXml, {
|
|
190
|
+
xml: onairosLogoSvg.replace('currentColor', logoColor),
|
|
191
|
+
width: 24,
|
|
192
|
+
height: 24,
|
|
193
|
+
style: styles.logo
|
|
194
|
+
}), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
195
|
+
style: [styles.buttonText, {
|
|
196
|
+
color: textColor
|
|
197
|
+
}]
|
|
198
|
+
}, getButtonText()))), showOnboarding && /*#__PURE__*/_react.default.createElement(_UniversalOnboarding.UniversalOnboarding, {
|
|
135
199
|
visible: showOnboarding,
|
|
136
200
|
onClose: () => {
|
|
137
201
|
setShowOnboarding(false);
|
|
@@ -139,19 +203,20 @@ const OnairosButton = ({
|
|
|
139
203
|
},
|
|
140
204
|
AppName: AppName,
|
|
141
205
|
requestData: requestData,
|
|
142
|
-
returnLink: returnLink,
|
|
206
|
+
returnLink: returnLink || '',
|
|
143
207
|
onComplete: handleOnboardingComplete,
|
|
144
208
|
debug: debug,
|
|
145
|
-
test: testMode
|
|
209
|
+
test: testMode,
|
|
210
|
+
preferredPlatform: preferredPlatform
|
|
146
211
|
}), showOverlay && storedCredentials && /*#__PURE__*/_react.default.createElement(_Portal.Portal, null, /*#__PURE__*/_react.default.createElement(_Overlay.Overlay, {
|
|
147
212
|
data: requestData || {},
|
|
148
213
|
username: storedCredentials.username,
|
|
149
214
|
modelKey: storedCredentials.userPin || '',
|
|
150
215
|
onResolved: handleOverlayResolved,
|
|
151
|
-
appName: AppName
|
|
216
|
+
appName: AppName,
|
|
217
|
+
darkMode: darkMode
|
|
152
218
|
})));
|
|
153
|
-
};
|
|
154
|
-
exports.OnairosButton = OnairosButton;
|
|
219
|
+
});
|
|
155
220
|
const styles = _reactNative.StyleSheet.create({
|
|
156
221
|
button: {
|
|
157
222
|
flexDirection: 'row',
|
|
@@ -159,29 +224,36 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
159
224
|
justifyContent: 'center',
|
|
160
225
|
paddingVertical: 12,
|
|
161
226
|
paddingHorizontal: 16,
|
|
162
|
-
borderRadius:
|
|
227
|
+
borderRadius: 8,
|
|
228
|
+
shadowColor: '#000',
|
|
229
|
+
shadowOffset: {
|
|
230
|
+
width: 0,
|
|
231
|
+
height: 2
|
|
232
|
+
},
|
|
233
|
+
shadowOpacity: 0.1,
|
|
234
|
+
shadowRadius: 4,
|
|
235
|
+
elevation: 2
|
|
236
|
+
},
|
|
237
|
+
buttonContent: {
|
|
238
|
+
flexDirection: 'row',
|
|
239
|
+
alignItems: 'center',
|
|
240
|
+
justifyContent: 'center'
|
|
241
|
+
},
|
|
242
|
+
logo: {
|
|
243
|
+
marginRight: 8
|
|
163
244
|
},
|
|
164
245
|
pillButton: {
|
|
165
246
|
borderRadius: 24
|
|
166
247
|
},
|
|
167
248
|
strokedButton: {
|
|
168
249
|
backgroundColor: 'transparent',
|
|
169
|
-
borderWidth: 1
|
|
170
|
-
borderColor: '#000'
|
|
250
|
+
borderWidth: 1
|
|
171
251
|
},
|
|
172
252
|
swervButton: {
|
|
173
253
|
transform: [{
|
|
174
254
|
rotate: '-2deg'
|
|
175
255
|
}]
|
|
176
256
|
},
|
|
177
|
-
darkButton: {
|
|
178
|
-
backgroundColor: '#000',
|
|
179
|
-
borderColor: '#000'
|
|
180
|
-
},
|
|
181
|
-
lightButton: {
|
|
182
|
-
backgroundColor: '#fff',
|
|
183
|
-
borderColor: '#000'
|
|
184
|
-
},
|
|
185
257
|
disabledButton: {
|
|
186
258
|
opacity: 0.6
|
|
187
259
|
},
|
|
@@ -189,15 +261,6 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
189
261
|
fontSize: 16,
|
|
190
262
|
fontWeight: '600',
|
|
191
263
|
textAlign: 'center'
|
|
192
|
-
},
|
|
193
|
-
lightText: {
|
|
194
|
-
color: '#fff'
|
|
195
|
-
},
|
|
196
|
-
darkText: {
|
|
197
|
-
color: '#000'
|
|
198
|
-
},
|
|
199
|
-
disabledText: {
|
|
200
|
-
opacity: 0.7
|
|
201
264
|
}
|
|
202
265
|
});
|
|
203
266
|
//# sourceMappingURL=OnairosButton.js.map
|