@onairos/react-native 1.0.0 → 1.0.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.
Files changed (32) hide show
  1. package/lib/commonjs/components/OnairosButton.js +6 -415
  2. package/lib/commonjs/components/OnairosButton.js.map +1 -1
  3. package/lib/commonjs/components/Overlay.js +0 -549
  4. package/lib/commonjs/components/PinInput.js +160 -0
  5. package/lib/commonjs/components/PinInput.js.map +1 -0
  6. package/lib/commonjs/components/PlatformList.js +137 -0
  7. package/lib/commonjs/components/PlatformList.js.map +1 -0
  8. package/lib/commonjs/components/TrainingModal.js +130 -0
  9. package/lib/commonjs/components/TrainingModal.js.map +1 -0
  10. package/lib/commonjs/index.js +12 -276
  11. package/lib/commonjs/index.js.map +1 -1
  12. package/lib/module/components/OnairosButton.js +121 -514
  13. package/lib/module/components/OnairosButton.js.map +1 -1
  14. package/lib/module/components/Overlay.js +0 -565
  15. package/lib/module/components/PinInput.js +151 -0
  16. package/lib/module/components/PinInput.js.map +1 -0
  17. package/lib/module/components/PlatformList.js +129 -0
  18. package/lib/module/components/PlatformList.js.map +1 -0
  19. package/lib/module/components/TrainingModal.js +122 -0
  20. package/lib/module/components/TrainingModal.js.map +1 -0
  21. package/package.json +5 -4
  22. package/src/components/OnairosButton.tsx +5 -5
  23. package/src/components/PinInput.tsx +189 -0
  24. package/src/components/PlatformList.tsx +145 -0
  25. package/src/components/TrainingModal.tsx +132 -0
  26. package/lib/commonjs/components/Notification.js +0 -106
  27. package/lib/commonjs/components/Notification.js.map +0 -1
  28. package/lib/module/components/Notification.js +0 -99
  29. package/lib/module/components/Notification.js.map +0 -1
  30. package/src/components/Notification.js +0 -101
  31. package/src/components/OnairosButton.js +0 -604
  32. package/src/components/Overlay.js +0 -854
@@ -0,0 +1,151 @@
1
+ import React, { useState, useCallback } from 'react';
2
+ import { View, Text, StyleSheet, TextInput, TouchableOpacity } from 'react-native';
3
+ import Icon from 'react-native-vector-icons/MaterialIcons';
4
+ import { COLORS } from '../constants';
5
+ export const PinInput = ({
6
+ onSubmit,
7
+ minLength = 8,
8
+ requireSpecialChar = true,
9
+ requireNumber = true
10
+ }) => {
11
+ const [pin, setPin] = useState('');
12
+ const [error, setError] = useState(null);
13
+ const [showPin, setShowPin] = useState(false);
14
+ const validatePin = useCallback(value => {
15
+ if (value.length < minLength) {
16
+ return `PIN must be at least ${minLength} characters`;
17
+ }
18
+ if (requireSpecialChar && !/[!@#$%^&*(),.?":{}|<>]/.test(value)) {
19
+ return 'PIN must include a special character';
20
+ }
21
+ if (requireNumber && !/\d/.test(value)) {
22
+ return 'PIN must include a number';
23
+ }
24
+ return null;
25
+ }, [minLength, requireSpecialChar, requireNumber]);
26
+ const handleSubmit = useCallback(() => {
27
+ const validationError = validatePin(pin);
28
+ if (validationError) {
29
+ setError(validationError);
30
+ return;
31
+ }
32
+ onSubmit(pin);
33
+ }, [pin, validatePin, onSubmit]);
34
+ const handlePinChange = useCallback(value => {
35
+ setPin(value);
36
+ setError(null);
37
+ }, []);
38
+ return /*#__PURE__*/React.createElement(View, {
39
+ style: styles.container
40
+ }, /*#__PURE__*/React.createElement(Text, {
41
+ style: styles.title
42
+ }, "Create your PIN"), /*#__PURE__*/React.createElement(Text, {
43
+ style: styles.subtitle
44
+ }, "This PIN will be used to secure your account"), /*#__PURE__*/React.createElement(View, {
45
+ style: styles.inputContainer
46
+ }, /*#__PURE__*/React.createElement(TextInput, {
47
+ style: styles.input,
48
+ value: pin,
49
+ onChangeText: handlePinChange,
50
+ secureTextEntry: !showPin,
51
+ placeholder: "Enter PIN",
52
+ keyboardType: "numeric",
53
+ maxLength: 20,
54
+ autoCapitalize: "none",
55
+ autoCorrect: false
56
+ }), /*#__PURE__*/React.createElement(TouchableOpacity, {
57
+ style: styles.visibilityButton,
58
+ onPress: () => setShowPin(!showPin)
59
+ }, /*#__PURE__*/React.createElement(Icon, {
60
+ name: showPin ? 'visibility-off' : 'visibility',
61
+ size: 24,
62
+ color: COLORS.text.secondary
63
+ }))), error && /*#__PURE__*/React.createElement(Text, {
64
+ style: styles.error
65
+ }, error), /*#__PURE__*/React.createElement(View, {
66
+ style: styles.requirements
67
+ }, /*#__PURE__*/React.createElement(Text, {
68
+ style: styles.requirementTitle
69
+ }, "PIN Requirements:"), /*#__PURE__*/React.createElement(Text, {
70
+ style: [styles.requirement, pin.length >= minLength && styles.requirementMet]
71
+ }, "\u2022 At least ", minLength, " characters"), requireSpecialChar && /*#__PURE__*/React.createElement(Text, {
72
+ style: [styles.requirement, /[!@#$%^&*(),.?":{}|<>]/.test(pin) && styles.requirementMet]
73
+ }, "\u2022 Include a special character"), requireNumber && /*#__PURE__*/React.createElement(Text, {
74
+ style: [styles.requirement, /\d/.test(pin) && styles.requirementMet]
75
+ }, "\u2022 Include a number")), /*#__PURE__*/React.createElement(TouchableOpacity, {
76
+ style: [styles.submitButton, !pin && styles.submitButtonDisabled],
77
+ onPress: handleSubmit,
78
+ disabled: !pin
79
+ }, /*#__PURE__*/React.createElement(Text, {
80
+ style: styles.submitButtonText
81
+ }, "Continue")));
82
+ };
83
+ const styles = StyleSheet.create({
84
+ container: {
85
+ flex: 1,
86
+ padding: 16
87
+ },
88
+ title: {
89
+ fontSize: 20,
90
+ fontWeight: '600',
91
+ marginBottom: 8,
92
+ color: COLORS.text.primary
93
+ },
94
+ subtitle: {
95
+ fontSize: 14,
96
+ color: COLORS.text.secondary,
97
+ marginBottom: 24
98
+ },
99
+ inputContainer: {
100
+ flexDirection: 'row',
101
+ alignItems: 'center',
102
+ borderWidth: 1,
103
+ borderColor: COLORS.border,
104
+ borderRadius: 8,
105
+ marginBottom: 16
106
+ },
107
+ input: {
108
+ flex: 1,
109
+ padding: 12,
110
+ fontSize: 16
111
+ },
112
+ visibilityButton: {
113
+ padding: 12
114
+ },
115
+ error: {
116
+ color: COLORS.error,
117
+ marginBottom: 16
118
+ },
119
+ requirements: {
120
+ marginBottom: 24
121
+ },
122
+ requirementTitle: {
123
+ fontSize: 14,
124
+ fontWeight: '600',
125
+ marginBottom: 8,
126
+ color: COLORS.text.primary
127
+ },
128
+ requirement: {
129
+ fontSize: 14,
130
+ color: COLORS.text.secondary,
131
+ marginBottom: 4
132
+ },
133
+ requirementMet: {
134
+ color: COLORS.success
135
+ },
136
+ submitButton: {
137
+ backgroundColor: COLORS.primary,
138
+ paddingVertical: 16,
139
+ borderRadius: 12,
140
+ alignItems: 'center'
141
+ },
142
+ submitButtonDisabled: {
143
+ opacity: 0.5
144
+ },
145
+ submitButtonText: {
146
+ color: '#fff',
147
+ fontSize: 16,
148
+ fontWeight: '600'
149
+ }
150
+ });
151
+ //# sourceMappingURL=PinInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useState","useCallback","View","Text","StyleSheet","TextInput","TouchableOpacity","Icon","COLORS","PinInput","onSubmit","minLength","requireSpecialChar","requireNumber","pin","setPin","error","setError","showPin","setShowPin","validatePin","value","length","test","handleSubmit","validationError","handlePinChange","createElement","style","styles","container","title","subtitle","inputContainer","input","onChangeText","secureTextEntry","placeholder","keyboardType","maxLength","autoCapitalize","autoCorrect","visibilityButton","onPress","name","size","color","text","secondary","requirements","requirementTitle","requirement","requirementMet","submitButton","submitButtonDisabled","disabled","submitButtonText","create","flex","padding","fontSize","fontWeight","marginBottom","primary","flexDirection","alignItems","borderWidth","borderColor","border","borderRadius","success","backgroundColor","paddingVertical","opacity"],"sourceRoot":"..\\..\\..\\src","sources":["components/PinInput.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,WAAW,QAAQ,OAAO;AACpD,SACEC,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,SAAS,EACTC,gBAAgB,QAEX,cAAc;AACrB,OAAOC,IAAI,MAAM,yCAAyC;AAC1D,SAASC,MAAM,QAAQ,cAAc;AAGrC,OAAO,MAAMC,QAAiC,GAAGA,CAAC;EAChDC,QAAQ;EACRC,SAAS,GAAG,CAAC;EACbC,kBAAkB,GAAG,IAAI;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AAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,129 @@
1
+ import React from 'react';
2
+ import { View, Text, StyleSheet, TouchableOpacity, ActivityIndicator } from 'react-native';
3
+ import Icon from 'react-native-vector-icons/MaterialIcons';
4
+ import { COLORS, PLATFORMS } from '../constants';
5
+ export const PlatformList = ({
6
+ connections,
7
+ onToggle,
8
+ isLoading,
9
+ canProceed,
10
+ onProceed
11
+ }) => {
12
+ const renderPlatformItem = (platform, isConnected) => {
13
+ const platformConfig = PLATFORMS[platform];
14
+ if (!platformConfig) return null;
15
+ return /*#__PURE__*/React.createElement(View, {
16
+ key: platform,
17
+ style: styles.platformContainer
18
+ }, /*#__PURE__*/React.createElement(View, {
19
+ style: styles.platformHeader
20
+ }, /*#__PURE__*/React.createElement(Icon, {
21
+ name: platformConfig.icon,
22
+ size: 24,
23
+ color: platformConfig.color
24
+ }), /*#__PURE__*/React.createElement(Text, {
25
+ style: styles.platformName
26
+ }, platformConfig.name)), platformConfig.description && /*#__PURE__*/React.createElement(Text, {
27
+ style: styles.platformDescription
28
+ }, platformConfig.description), /*#__PURE__*/React.createElement(TouchableOpacity, {
29
+ style: [styles.connectButton, isConnected ? styles.connectedButton : styles.disconnectedButton],
30
+ onPress: () => onToggle(platform, !isConnected),
31
+ disabled: isLoading
32
+ }, isLoading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
33
+ color: "#fff"
34
+ }) : /*#__PURE__*/React.createElement(Text, {
35
+ style: styles.buttonText
36
+ }, isConnected ? 'Disconnect' : 'Connect')));
37
+ };
38
+ return /*#__PURE__*/React.createElement(View, {
39
+ style: styles.container
40
+ }, /*#__PURE__*/React.createElement(Text, {
41
+ style: styles.title
42
+ }, "Connect your platforms"), /*#__PURE__*/React.createElement(Text, {
43
+ style: styles.subtitle
44
+ }, "Connect at least 2 platforms to proceed"), /*#__PURE__*/React.createElement(View, {
45
+ style: styles.platformsList
46
+ }, Object.entries(connections).map(([platform, status]) => renderPlatformItem(platform, !!status))), /*#__PURE__*/React.createElement(TouchableOpacity, {
47
+ style: [styles.proceedButton, !canProceed && styles.disabledButton],
48
+ onPress: onProceed,
49
+ disabled: !canProceed || isLoading
50
+ }, /*#__PURE__*/React.createElement(Text, {
51
+ style: styles.proceedButtonText
52
+ }, "Proceed")));
53
+ };
54
+ const styles = StyleSheet.create({
55
+ container: {
56
+ flex: 1,
57
+ padding: 16
58
+ },
59
+ title: {
60
+ fontSize: 20,
61
+ fontWeight: '600',
62
+ marginBottom: 8,
63
+ color: COLORS.text.primary
64
+ },
65
+ subtitle: {
66
+ fontSize: 14,
67
+ color: COLORS.text.secondary,
68
+ marginBottom: 24
69
+ },
70
+ platformsList: {
71
+ flex: 1
72
+ },
73
+ platformContainer: {
74
+ backgroundColor: '#fff',
75
+ borderRadius: 12,
76
+ padding: 16,
77
+ marginBottom: 16,
78
+ borderWidth: 1,
79
+ borderColor: COLORS.border
80
+ },
81
+ platformHeader: {
82
+ flexDirection: 'row',
83
+ alignItems: 'center',
84
+ marginBottom: 8
85
+ },
86
+ platformName: {
87
+ fontSize: 16,
88
+ fontWeight: '600',
89
+ marginLeft: 12,
90
+ color: COLORS.text.primary
91
+ },
92
+ platformDescription: {
93
+ fontSize: 14,
94
+ color: COLORS.text.secondary,
95
+ marginBottom: 16
96
+ },
97
+ connectButton: {
98
+ paddingVertical: 8,
99
+ paddingHorizontal: 16,
100
+ borderRadius: 8,
101
+ alignItems: 'center'
102
+ },
103
+ connectedButton: {
104
+ backgroundColor: COLORS.success
105
+ },
106
+ disconnectedButton: {
107
+ backgroundColor: COLORS.primary
108
+ },
109
+ buttonText: {
110
+ color: '#fff',
111
+ fontWeight: '600'
112
+ },
113
+ proceedButton: {
114
+ backgroundColor: COLORS.primary,
115
+ paddingVertical: 16,
116
+ borderRadius: 12,
117
+ alignItems: 'center',
118
+ marginTop: 16
119
+ },
120
+ disabledButton: {
121
+ opacity: 0.5
122
+ },
123
+ proceedButtonText: {
124
+ color: '#fff',
125
+ fontSize: 16,
126
+ fontWeight: '600'
127
+ }
128
+ });
129
+ //# sourceMappingURL=PlatformList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","View","Text","StyleSheet","TouchableOpacity","ActivityIndicator","Icon","COLORS","PLATFORMS","PlatformList","connections","onToggle","isLoading","canProceed","onProceed","renderPlatformItem","platform","isConnected","platformConfig","createElement","key","style","styles","platformContainer","platformHeader","name","icon","size","color","platformName","description","platformDescription","connectButton","connectedButton","disconnectedButton","onPress","disabled","buttonText","container","title","subtitle","platformsList","Object","entries","map","status","proceedButton","disabledButton","proceedButtonText","create","flex","padding","fontSize","fontWeight","marginBottom","text","primary","secondary","backgroundColor","borderRadius","borderWidth","borderColor","border","flexDirection","alignItems","marginLeft","paddingVertical","paddingHorizontal","success","marginTop","opacity"],"sourceRoot":"..\\..\\..\\src","sources":["components/PlatformList.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,iBAAiB,QAAQ,cAAc;AAC1F,OAAOC,IAAI,MAAM,yCAAyC;AAC1D,SAASC,MAAM,EAAEC,SAAS,QAAQ,cAAc;AAGhD,OAAO,MAAMC,YAAyC,GAAGA,CAAC;EACxDC,WAAW;EACXC,QAAQ;EACRC,SAAS;EACTC,UAAU;EACVC;AACF,CAAC,KAAK;EACJ,MAAMC,kBAAkB,GAAGA,CAACC,QAAgB,EAAEC,WAAoB,KAAK;IACrE,MAAMC,cAAc,GAAGV,SAAS,CAACQ,QAAQ,CAAC;IAC1C,IAAI,CAACE,cAAc,EAAE,OAAO,IAAI;IAEhC,oBACElB,KAAA,CAAAmB,aAAA,CAAClB,IAAI;MAACmB,GAAG,EAAEJ,QAAS;MAACK,KAAK,EAAEC,MAAM,CAACC;IAAkB,gBACnDvB,KAAA,CAAAmB,aAAA,CAAClB,IAAI;MAACoB,KAAK,EAAEC,MAAM,CAACE;IAAe,gBACjCxB,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EACDtC,cAAc,EAAE;IACduC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBV,YAAY,EAAE;EAChB,CAAC;EACDzB,YAAY,EAAE;IACZuB,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBY,UAAU,EAAE,EAAE;IACdrC,KAAK,EAAErB,MAAM,CAACgD,IAAI,CAACC;EACrB,CAAC;EACDzB,mBAAmB,EAAE;IACnBqB,QAAQ,EAAE,EAAE;IACZxB,KAAK,EAAErB,MAAM,CAACgD,IAAI,CAACE,SAAS;IAC5BH,YAAY,EAAE;EAChB,CAAC;EACDtB,aAAa,EAAE;IACbkC,eAAe,EAAE,CAAC;IAClBC,iBAAiB,EAAE,EAAE;IACrBR,YAAY,EAAE,CAAC;IACfK,UAAU,EAAE;EACd,CAAC;EACD/B,eAAe,EAAE;IACfyB,eAAe,EAAEnD,MAAM,CAAC6D;EAC1B,CAAC;EACDlC,kBAAkB,EAAE;IAClBwB,eAAe,EAAEnD,MAAM,CAACiD;EAC1B,CAAC;EACDnB,UAAU,EAAE;IACVT,KAAK,EAAE,MAAM;IACbyB,UAAU,EAAE;EACd,CAAC;EACDP,aAAa,EAAE;IACbY,eAAe,EAAEnD,MAAM,CAACiD,OAAO;IAC/BU,eAAe,EAAE,EAAE;IACnBP,YAAY,EAAE,EAAE;IAChBK,UAAU,EAAE,QAAQ;IACpBK,SAAS,EAAE;EACb,CAAC;EACDtB,cAAc,EAAE;IACduB,OAAO,EAAE;EACX,CAAC;EACDtB,iBAAiB,EAAE;IACjBpB,KAAK,EAAE,MAAM;IACbwB,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,122 @@
1
+ import React from 'react';
2
+ import { View, Text, StyleSheet, TouchableOpacity, ActivityIndicator } from 'react-native';
3
+ import Icon from 'react-native-vector-icons/MaterialIcons';
4
+ import { COLORS } from '../constants';
5
+ export const TrainingModal = ({
6
+ progress,
7
+ eta,
8
+ onCancel
9
+ }) => {
10
+ const progressPercentage = Math.round(progress * 100);
11
+ return /*#__PURE__*/React.createElement(View, {
12
+ style: styles.container
13
+ }, /*#__PURE__*/React.createElement(View, {
14
+ style: styles.content
15
+ }, /*#__PURE__*/React.createElement(Icon, {
16
+ name: "auto_awesome",
17
+ size: 48,
18
+ color: COLORS.primary
19
+ }), /*#__PURE__*/React.createElement(Text, {
20
+ style: styles.title
21
+ }, "Training Your AI Model"), /*#__PURE__*/React.createElement(Text, {
22
+ style: styles.subtitle
23
+ }, "We're analyzing your social media data to create your personalized AI model"), /*#__PURE__*/React.createElement(View, {
24
+ style: styles.progressContainer
25
+ }, /*#__PURE__*/React.createElement(View, {
26
+ style: styles.progressBar
27
+ }, /*#__PURE__*/React.createElement(View, {
28
+ style: [styles.progressFill, {
29
+ width: `${progressPercentage}%`
30
+ }]
31
+ })), /*#__PURE__*/React.createElement(Text, {
32
+ style: styles.progressText
33
+ }, progressPercentage, "%")), /*#__PURE__*/React.createElement(Text, {
34
+ style: styles.etaText
35
+ }, "Estimated time remaining: ", eta), /*#__PURE__*/React.createElement(View, {
36
+ style: styles.loadingContainer
37
+ }, /*#__PURE__*/React.createElement(ActivityIndicator, {
38
+ size: "small",
39
+ color: COLORS.primary
40
+ }), /*#__PURE__*/React.createElement(Text, {
41
+ style: styles.loadingText
42
+ }, "Processing your data...")), /*#__PURE__*/React.createElement(TouchableOpacity, {
43
+ style: styles.cancelButton,
44
+ onPress: onCancel
45
+ }, /*#__PURE__*/React.createElement(Text, {
46
+ style: styles.cancelButtonText
47
+ }, "Cancel"))));
48
+ };
49
+ const styles = StyleSheet.create({
50
+ container: {
51
+ flex: 1,
52
+ justifyContent: 'center',
53
+ alignItems: 'center',
54
+ padding: 24
55
+ },
56
+ content: {
57
+ width: '100%',
58
+ alignItems: 'center'
59
+ },
60
+ title: {
61
+ fontSize: 24,
62
+ fontWeight: '600',
63
+ marginTop: 24,
64
+ marginBottom: 8,
65
+ color: COLORS.text.primary,
66
+ textAlign: 'center'
67
+ },
68
+ subtitle: {
69
+ fontSize: 16,
70
+ color: COLORS.text.secondary,
71
+ textAlign: 'center',
72
+ marginBottom: 32
73
+ },
74
+ progressContainer: {
75
+ width: '100%',
76
+ marginBottom: 16
77
+ },
78
+ progressBar: {
79
+ height: 8,
80
+ backgroundColor: COLORS.border,
81
+ borderRadius: 4,
82
+ overflow: 'hidden'
83
+ },
84
+ progressFill: {
85
+ height: '100%',
86
+ backgroundColor: COLORS.primary,
87
+ borderRadius: 4
88
+ },
89
+ progressText: {
90
+ fontSize: 14,
91
+ color: COLORS.text.secondary,
92
+ textAlign: 'center',
93
+ marginTop: 8
94
+ },
95
+ etaText: {
96
+ fontSize: 14,
97
+ color: COLORS.text.secondary,
98
+ marginBottom: 24
99
+ },
100
+ loadingContainer: {
101
+ flexDirection: 'row',
102
+ alignItems: 'center',
103
+ marginBottom: 32
104
+ },
105
+ loadingText: {
106
+ fontSize: 14,
107
+ color: COLORS.text.secondary,
108
+ marginLeft: 8
109
+ },
110
+ cancelButton: {
111
+ paddingVertical: 12,
112
+ paddingHorizontal: 24,
113
+ borderRadius: 8,
114
+ borderWidth: 1,
115
+ borderColor: COLORS.border
116
+ },
117
+ cancelButtonText: {
118
+ fontSize: 16,
119
+ color: COLORS.text.secondary
120
+ }
121
+ });
122
+ //# sourceMappingURL=TrainingModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","View","Text","StyleSheet","TouchableOpacity","ActivityIndicator","Icon","COLORS","TrainingModal","progress","eta","onCancel","progressPercentage","Math","round","createElement","style","styles","container","content","name","size","color","primary","title","subtitle","progressContainer","progressBar","progressFill","width","progressText","etaText","loadingContainer","loadingText","cancelButton","onPress","cancelButtonText","create","flex","justifyContent","alignItems","padding","fontSize","fontWeight","marginTop","marginBottom","text","textAlign","secondary","height","backgroundColor","border","borderRadius","overflow","flexDirection","marginLeft","paddingVertical","paddingHorizontal","borderWidth","borderColor"],"sourceRoot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,CAACE;EACrB;AACF,CAAC,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onairos/react-native",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Onairos React Native SDK for social media authentication and AI model training",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -32,10 +32,11 @@
32
32
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
33
33
  "prepare": "bob build",
34
34
  "release": "release-it",
35
- "example": "yarn --cwd example",
36
- "bootstrap": "yarn example && yarn install",
35
+ "example": "npm --prefix example",
36
+ "bootstrap": "npm run example && npm install",
37
37
  "build": "bob build",
38
- "clean": "del lib"
38
+ "clean": "del-cli lib",
39
+ "prebuild": "npm run clean"
39
40
  },
40
41
  "keywords": [
41
42
  "react-native",
@@ -13,8 +13,8 @@ import * as Keychain from 'react-native-keychain';
13
13
  import { UniversalOnboarding } from './UniversalOnboarding';
14
14
  import { DataRequestModal } from './DataRequestModal';
15
15
  import { useCredentials } from '../hooks/useCredentials';
16
- import { validateCredentials } from '../utils/auth';
17
- import { COLORS } from '../constants';
16
+ // import { validateCredentials } from '../utils/auth';
17
+ // import { COLORS } from '../constants';
18
18
  import type { OnairosButtonProps } from '../types';
19
19
 
20
20
  export const OnairosButton: React.FC<OnairosButtonProps> = ({
@@ -104,9 +104,9 @@ export const OnairosButton: React.FC<OnairosButtonProps> = ({
104
104
  return () => {
105
105
  // Cleanup deep linking
106
106
  // Note: Remove event listener based on RN version
107
- if (Platform.OS === 'android') {
108
- Linking.removeEventListener('url', handleDeepLink);
109
- }
107
+ // if (Platform.OS === 'android') {
108
+ // Linking.removeEventListener('url', handleDeepLink);
109
+ // }
110
110
  };
111
111
  }, []);
112
112
 
@@ -0,0 +1,189 @@
1
+ import React, { useState, useCallback } from 'react';
2
+ import {
3
+ View,
4
+ Text,
5
+ StyleSheet,
6
+ TextInput,
7
+ TouchableOpacity,
8
+ Keyboard,
9
+ } from 'react-native';
10
+ import Icon from 'react-native-vector-icons/MaterialIcons';
11
+ import { COLORS } from '../constants';
12
+ import type { PinInputProps } from '../types';
13
+
14
+ export const PinInput: React.FC<PinInputProps> = ({
15
+ onSubmit,
16
+ minLength = 8,
17
+ requireSpecialChar = true,
18
+ requireNumber = true,
19
+ }) => {
20
+ const [pin, setPin] = useState('');
21
+ const [error, setError] = useState<string | null>(null);
22
+ const [showPin, setShowPin] = useState(false);
23
+
24
+ const validatePin = useCallback((value: string) => {
25
+ if (value.length < minLength) {
26
+ return `PIN must be at least ${minLength} characters`;
27
+ }
28
+ if (requireSpecialChar && !/[!@#$%^&*(),.?":{}|<>]/.test(value)) {
29
+ return 'PIN must include a special character';
30
+ }
31
+ if (requireNumber && !/\d/.test(value)) {
32
+ return 'PIN must include a number';
33
+ }
34
+ return null;
35
+ }, [minLength, requireSpecialChar, requireNumber]);
36
+
37
+ const handleSubmit = useCallback(() => {
38
+ const validationError = validatePin(pin);
39
+ if (validationError) {
40
+ setError(validationError);
41
+ return;
42
+ }
43
+ onSubmit(pin);
44
+ }, [pin, validatePin, onSubmit]);
45
+
46
+ const handlePinChange = useCallback((value: string) => {
47
+ setPin(value);
48
+ setError(null);
49
+ }, []);
50
+
51
+ return (
52
+ <View style={styles.container}>
53
+ <Text style={styles.title}>Create your PIN</Text>
54
+ <Text style={styles.subtitle}>
55
+ This PIN will be used to secure your account
56
+ </Text>
57
+
58
+ <View style={styles.inputContainer}>
59
+ <TextInput
60
+ style={styles.input}
61
+ value={pin}
62
+ onChangeText={handlePinChange}
63
+ secureTextEntry={!showPin}
64
+ placeholder="Enter PIN"
65
+ keyboardType="numeric"
66
+ maxLength={20}
67
+ autoCapitalize="none"
68
+ autoCorrect={false}
69
+ />
70
+ <TouchableOpacity
71
+ style={styles.visibilityButton}
72
+ onPress={() => setShowPin(!showPin)}
73
+ >
74
+ <Icon
75
+ name={showPin ? 'visibility-off' : 'visibility'}
76
+ size={24}
77
+ color={COLORS.text.secondary}
78
+ />
79
+ </TouchableOpacity>
80
+ </View>
81
+
82
+ {error && <Text style={styles.error}>{error}</Text>}
83
+
84
+ <View style={styles.requirements}>
85
+ <Text style={styles.requirementTitle}>PIN Requirements:</Text>
86
+ <Text style={[styles.requirement, pin.length >= minLength && styles.requirementMet]}>
87
+ • At least {minLength} characters
88
+ </Text>
89
+ {requireSpecialChar && (
90
+ <Text
91
+ style={[
92
+ styles.requirement,
93
+ /[!@#$%^&*(),.?":{}|<>]/.test(pin) && styles.requirementMet,
94
+ ]}
95
+ >
96
+ • Include a special character
97
+ </Text>
98
+ )}
99
+ {requireNumber && (
100
+ <Text
101
+ style={[
102
+ styles.requirement,
103
+ /\d/.test(pin) && styles.requirementMet,
104
+ ]}
105
+ >
106
+ • Include a number
107
+ </Text>
108
+ )}
109
+ </View>
110
+
111
+ <TouchableOpacity
112
+ style={[styles.submitButton, !pin && styles.submitButtonDisabled]}
113
+ onPress={handleSubmit}
114
+ disabled={!pin}
115
+ >
116
+ <Text style={styles.submitButtonText}>Continue</Text>
117
+ </TouchableOpacity>
118
+ </View>
119
+ );
120
+ };
121
+
122
+ const styles = StyleSheet.create({
123
+ container: {
124
+ flex: 1,
125
+ padding: 16,
126
+ },
127
+ title: {
128
+ fontSize: 20,
129
+ fontWeight: '600',
130
+ marginBottom: 8,
131
+ color: COLORS.text.primary,
132
+ },
133
+ subtitle: {
134
+ fontSize: 14,
135
+ color: COLORS.text.secondary,
136
+ marginBottom: 24,
137
+ },
138
+ inputContainer: {
139
+ flexDirection: 'row',
140
+ alignItems: 'center',
141
+ borderWidth: 1,
142
+ borderColor: COLORS.border,
143
+ borderRadius: 8,
144
+ marginBottom: 16,
145
+ },
146
+ input: {
147
+ flex: 1,
148
+ padding: 12,
149
+ fontSize: 16,
150
+ },
151
+ visibilityButton: {
152
+ padding: 12,
153
+ },
154
+ error: {
155
+ color: COLORS.error,
156
+ marginBottom: 16,
157
+ },
158
+ requirements: {
159
+ marginBottom: 24,
160
+ },
161
+ requirementTitle: {
162
+ fontSize: 14,
163
+ fontWeight: '600',
164
+ marginBottom: 8,
165
+ color: COLORS.text.primary,
166
+ },
167
+ requirement: {
168
+ fontSize: 14,
169
+ color: COLORS.text.secondary,
170
+ marginBottom: 4,
171
+ },
172
+ requirementMet: {
173
+ color: COLORS.success,
174
+ },
175
+ submitButton: {
176
+ backgroundColor: COLORS.primary,
177
+ paddingVertical: 16,
178
+ borderRadius: 12,
179
+ alignItems: 'center',
180
+ },
181
+ submitButtonDisabled: {
182
+ opacity: 0.5,
183
+ },
184
+ submitButtonText: {
185
+ color: '#fff',
186
+ fontSize: 16,
187
+ fontWeight: '600',
188
+ },
189
+ });