react-native-salespanda 0.1.1 → 0.3.0

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 (55) hide show
  1. package/lib/module/SalespandaApp.js +56 -0
  2. package/lib/module/SalespandaApp.js.map +1 -0
  3. package/lib/module/config/SalespandaConfig.js +68 -0
  4. package/lib/module/config/SalespandaConfig.js.map +1 -0
  5. package/lib/module/index.js +35 -5
  6. package/lib/module/index.js.map +1 -1
  7. package/lib/module/navigation/AppNavigator.js +18 -0
  8. package/lib/module/navigation/AppNavigator.js.map +1 -0
  9. package/lib/module/navigation/BottomTabNavigator.js +97 -0
  10. package/lib/module/navigation/BottomTabNavigator.js.map +1 -0
  11. package/lib/module/navigation/DrawerNavigator.js +223 -0
  12. package/lib/module/navigation/DrawerNavigator.js.map +1 -0
  13. package/lib/module/screens/HomeScreen.js +68 -152
  14. package/lib/module/screens/HomeScreen.js.map +1 -1
  15. package/lib/module/screens/NotificationsScreen.js +127 -0
  16. package/lib/module/screens/NotificationsScreen.js.map +1 -0
  17. package/lib/module/screens/PremiumScreen.js +222 -0
  18. package/lib/module/screens/PremiumScreen.js.map +1 -0
  19. package/lib/module/screens/ProfileScreen.js +147 -0
  20. package/lib/module/screens/ProfileScreen.js.map +1 -0
  21. package/lib/module/screens/ReportsScreen.js +217 -0
  22. package/lib/module/screens/ReportsScreen.js.map +1 -0
  23. package/lib/typescript/src/SalespandaApp.d.ts +39 -0
  24. package/lib/typescript/src/SalespandaApp.d.ts.map +1 -0
  25. package/lib/typescript/src/config/SalespandaConfig.d.ts +52 -0
  26. package/lib/typescript/src/config/SalespandaConfig.d.ts.map +1 -0
  27. package/lib/typescript/src/index.d.ts +24 -1
  28. package/lib/typescript/src/index.d.ts.map +1 -1
  29. package/lib/typescript/src/navigation/AppNavigator.d.ts +2 -0
  30. package/lib/typescript/src/navigation/AppNavigator.d.ts.map +1 -0
  31. package/lib/typescript/src/navigation/BottomTabNavigator.d.ts +2 -0
  32. package/lib/typescript/src/navigation/BottomTabNavigator.d.ts.map +1 -0
  33. package/lib/typescript/src/navigation/DrawerNavigator.d.ts +2 -0
  34. package/lib/typescript/src/navigation/DrawerNavigator.d.ts.map +1 -0
  35. package/lib/typescript/src/screens/HomeScreen.d.ts.map +1 -1
  36. package/lib/typescript/src/screens/NotificationsScreen.d.ts +2 -0
  37. package/lib/typescript/src/screens/NotificationsScreen.d.ts.map +1 -0
  38. package/lib/typescript/src/screens/PremiumScreen.d.ts +2 -0
  39. package/lib/typescript/src/screens/PremiumScreen.d.ts.map +1 -0
  40. package/lib/typescript/src/screens/ProfileScreen.d.ts +2 -0
  41. package/lib/typescript/src/screens/ProfileScreen.d.ts.map +1 -0
  42. package/lib/typescript/src/screens/ReportsScreen.d.ts +2 -0
  43. package/lib/typescript/src/screens/ReportsScreen.d.ts.map +1 -0
  44. package/package.json +18 -2
  45. package/src/SalespandaApp.tsx +92 -0
  46. package/src/config/SalespandaConfig.ts +105 -0
  47. package/src/index.tsx +42 -5
  48. package/src/navigation/AppNavigator.tsx +13 -0
  49. package/src/navigation/BottomTabNavigator.tsx +68 -0
  50. package/src/navigation/DrawerNavigator.tsx +242 -0
  51. package/src/screens/HomeScreen.tsx +39 -117
  52. package/src/screens/NotificationsScreen.tsx +135 -0
  53. package/src/screens/PremiumScreen.tsx +250 -0
  54. package/src/screens/ProfileScreen.tsx +121 -0
  55. package/src/screens/ReportsScreen.tsx +191 -0
@@ -0,0 +1,92 @@
1
+ import React from 'react';
2
+ import { NavigationContainer } from '@react-navigation/native';
3
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
4
+ import DrawerNavigator from './navigation/DrawerNavigator';
5
+ import BottomTabNavigator from './navigation/BottomTabNavigator';
6
+ import { SafeAreaProvider } from 'react-native-safe-area-context';
7
+
8
+ export interface SalespandaAppProps {
9
+ /**
10
+ * Custom navigation container ref for external navigation control
11
+ */
12
+ navigationRef?: React.RefObject<any>;
13
+
14
+ /**
15
+ * Optional theme configuration
16
+ */
17
+ theme?: {
18
+ primaryColor?: string;
19
+ backgroundColor?: string;
20
+ };
21
+
22
+ /**
23
+ * If true, the app will not render NavigationContainer
24
+ * (useful when embedding in an existing navigation structure)
25
+ */
26
+ standalone?: boolean;
27
+
28
+ /**
29
+ * Callback when app is ready
30
+ */
31
+ onReady?: () => void;
32
+
33
+ /**
34
+ * If true, uses drawer navigation (default), otherwise uses bottom tabs only
35
+ */
36
+ useDrawer?: boolean;
37
+
38
+ /**
39
+ * If false, will not wrap with GestureHandlerRootView
40
+ * Set to false if your app already has gesture handler imported at the entry point
41
+ * @default true
42
+ */
43
+ wrapWithGestureHandler?: boolean;
44
+ }
45
+
46
+ /**
47
+ * Main Salespanda App Component
48
+ * Can be used as a standalone app or embedded in another React Native app
49
+ */
50
+ export default function SalespandaApp({
51
+ navigationRef,
52
+ theme,
53
+ standalone = false,
54
+ onReady,
55
+ useDrawer = true,
56
+ wrapWithGestureHandler = false,
57
+ }: SalespandaAppProps = {}) {
58
+ // TODO: Apply theme to app (future enhancement)
59
+ // Currently theme is managed through SalespandaConfig
60
+ void theme;
61
+
62
+ // Use drawer navigation by default, or bottom tabs only if specified
63
+ const AppContent = () =>
64
+ useDrawer ? <DrawerNavigator /> : <BottomTabNavigator />;
65
+
66
+ // If standalone mode, don't wrap with NavigationContainer
67
+ // (parent app will provide it)
68
+ if (standalone) {
69
+ return <AppContent />;
70
+ }
71
+
72
+ // Navigation content with SafeAreaProvider
73
+ const NavigationContent = (
74
+ <NavigationContainer ref={navigationRef} onReady={onReady}>
75
+ <SafeAreaProvider>
76
+ <AppContent />
77
+ </SafeAreaProvider>
78
+ </NavigationContainer>
79
+ );
80
+
81
+ // Wrap with GestureHandlerRootView only if requested
82
+ // (default is false since most apps already have gesture handler imported)
83
+ if (wrapWithGestureHandler) {
84
+ return (
85
+ <GestureHandlerRootView style={{ flex: 1 }}>
86
+ {NavigationContent}
87
+ </GestureHandlerRootView>
88
+ );
89
+ }
90
+
91
+ return NavigationContent;
92
+ }
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Salespanda SDK Configuration
3
+ */
4
+
5
+ export interface SalespandaConfig {
6
+ /**
7
+ * Theme configuration
8
+ */
9
+ theme?: {
10
+ primaryColor?: string;
11
+ secondaryColor?: string;
12
+ backgroundColor?: string;
13
+ textColor?: string;
14
+ accentColor?: string;
15
+ };
16
+
17
+ /**
18
+ * API configuration
19
+ */
20
+ api?: {
21
+ baseUrl?: string;
22
+ apiKey?: string;
23
+ timeout?: number;
24
+ };
25
+
26
+ /**
27
+ * Feature flags
28
+ */
29
+ features?: {
30
+ enablePremium?: boolean;
31
+ enableNotifications?: boolean;
32
+ enableReports?: boolean;
33
+ enableDrawer?: boolean;
34
+ };
35
+
36
+ /**
37
+ * Analytics configuration
38
+ */
39
+ analytics?: {
40
+ enabled?: boolean;
41
+ trackingId?: string;
42
+ };
43
+ }
44
+
45
+ let globalConfig: SalespandaConfig = {
46
+ theme: {
47
+ primaryColor: '#4a148c',
48
+ secondaryColor: '#25D366',
49
+ backgroundColor: '#fff',
50
+ textColor: '#333',
51
+ accentColor: '#999',
52
+ },
53
+ features: {
54
+ enablePremium: true,
55
+ enableNotifications: true,
56
+ enableReports: true,
57
+ enableDrawer: true,
58
+ },
59
+ };
60
+
61
+ /**
62
+ * Initialize Salespanda SDK with custom configuration
63
+ */
64
+ export function initializeSalespanda(config: SalespandaConfig): void {
65
+ globalConfig = {
66
+ ...globalConfig,
67
+ ...config,
68
+ theme: {
69
+ ...globalConfig.theme,
70
+ ...config.theme,
71
+ },
72
+ features: {
73
+ ...globalConfig.features,
74
+ ...config.features,
75
+ },
76
+ };
77
+ }
78
+
79
+ /**
80
+ * Get current Salespanda configuration
81
+ */
82
+ export function getSalespandaConfig(): SalespandaConfig {
83
+ return globalConfig;
84
+ }
85
+
86
+ /**
87
+ * Reset configuration to defaults
88
+ */
89
+ export function resetSalespandaConfig(): void {
90
+ globalConfig = {
91
+ theme: {
92
+ primaryColor: '#4a148c',
93
+ secondaryColor: '#25D366',
94
+ backgroundColor: '#fff',
95
+ textColor: '#333',
96
+ accentColor: '#999',
97
+ },
98
+ features: {
99
+ enablePremium: true,
100
+ enableNotifications: true,
101
+ enableReports: true,
102
+ enableDrawer: true,
103
+ },
104
+ };
105
+ }
package/src/index.tsx CHANGED
@@ -1,8 +1,45 @@
1
- import Salespanda from './NativeSalespanda';
1
+ /**
2
+ * Salespanda SDK
3
+ *
4
+ * This SDK can be used in two ways:
5
+ *
6
+ * 1. As a complete standalone app:
7
+ * import SalespandaApp from 'react-native-salespanda';
8
+ * <SalespandaApp />
9
+ *
10
+ * 2. As individual components/screens in your app:
11
+ * import { HomeScreen, ProfileScreen } from 'react-native-salespanda';
12
+ */
2
13
 
3
- export function multiply(a: number, b: number): number {
4
- return Salespanda.multiply(a, b);
5
- }
14
+ // ============================================
15
+ // MAIN APP EXPORT (Default)
16
+ // ============================================
17
+ export { default } from './SalespandaApp';
18
+ export { default as SalespandaApp } from './SalespandaApp';
19
+ export type { SalespandaAppProps } from './SalespandaApp';
6
20
 
7
- // Export screens
21
+ // ============================================
22
+ // CONFIGURATION
23
+ // ============================================
24
+ export {
25
+ initializeSalespanda,
26
+ getSalespandaConfig,
27
+ resetSalespandaConfig,
28
+ } from './config/SalespandaConfig';
29
+ export type { SalespandaConfig } from './config/SalespandaConfig';
30
+
31
+ // ============================================
32
+ // NAVIGATION COMPONENTS
33
+ // ============================================
34
+ export { default as AppNavigator } from './navigation/AppNavigator';
35
+ export { default as DrawerNavigator } from './navigation/DrawerNavigator';
36
+ export { default as BottomTabNavigator } from './navigation/BottomTabNavigator';
37
+
38
+ // ============================================
39
+ // SCREEN COMPONENTS (Library Mode)
40
+ // ============================================
8
41
  export { default as HomeScreen } from './screens/HomeScreen';
42
+ export { default as ProfileScreen } from './screens/ProfileScreen';
43
+ export { default as NotificationsScreen } from './screens/NotificationsScreen';
44
+ export { default as ReportsScreen } from './screens/ReportsScreen';
45
+ export { default as PremiumScreen } from './screens/PremiumScreen';
@@ -0,0 +1,13 @@
1
+ import { NavigationContainer } from '@react-navigation/native';
2
+ import BottomTabNavigator from './BottomTabNavigator';
3
+ import { SafeAreaView } from 'react-native-safe-area-context';
4
+
5
+ export default function AppNavigator() {
6
+ return (
7
+ <NavigationContainer>
8
+ <SafeAreaView style={{ flex: 1 }} edges={['bottom', 'top']}>
9
+ <BottomTabNavigator />
10
+ </SafeAreaView>
11
+ </NavigationContainer>
12
+ );
13
+ }
@@ -0,0 +1,68 @@
1
+ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
2
+ import { Text } from 'react-native';
3
+ import HomeScreen from '../screens/HomeScreen';
4
+ import PremiumScreen from '../screens/PremiumScreen';
5
+ import NotificationsScreen from '../screens/NotificationsScreen';
6
+ import ReportsScreen from '../screens/ReportsScreen';
7
+ import { SafeAreaView } from 'react-native-safe-area-context';
8
+
9
+ const Tab = createBottomTabNavigator();
10
+
11
+ export default function BottomTabNavigator() {
12
+ return (
13
+ <SafeAreaView style={{ flex: 1 }} edges={['bottom']}>
14
+ <Tab.Navigator
15
+ screenOptions={{
16
+ headerShown: false, // Hide headers as drawer provides them
17
+ tabBarActiveTintColor: '#4a148c',
18
+ tabBarInactiveTintColor: '#999',
19
+ tabBarStyle: {
20
+ borderTopWidth: 1,
21
+ borderTopColor: '#e0e0e0',
22
+ paddingBottom: 8,
23
+ paddingTop: 8,
24
+ height: 60,
25
+ },
26
+ }}
27
+ >
28
+ <Tab.Screen
29
+ name="Home"
30
+ component={HomeScreen}
31
+ options={{
32
+ tabBarIcon: ({ color, size }) => (
33
+ <Text style={{ fontSize: size, color }}>🏠</Text>
34
+ ),
35
+ headerShown: false,
36
+ }}
37
+ />
38
+ <Tab.Screen
39
+ name="Premium"
40
+ component={PremiumScreen}
41
+ options={{
42
+ tabBarIcon: ({ color, size }) => (
43
+ <Text style={{ fontSize: size, color }}>💎</Text>
44
+ ),
45
+ }}
46
+ />
47
+ <Tab.Screen
48
+ name="Notifications"
49
+ component={NotificationsScreen}
50
+ options={{
51
+ tabBarIcon: ({ color, size }) => (
52
+ <Text style={{ fontSize: size, color }}>🔔</Text>
53
+ ),
54
+ }}
55
+ />
56
+ <Tab.Screen
57
+ name="Reports"
58
+ component={ReportsScreen}
59
+ options={{
60
+ tabBarIcon: ({ color, size }) => (
61
+ <Text style={{ fontSize: size, color }}>📊</Text>
62
+ ),
63
+ }}
64
+ />
65
+ </Tab.Navigator>
66
+ </SafeAreaView>
67
+ );
68
+ }
@@ -0,0 +1,242 @@
1
+ import * as React from 'react';
2
+ import { createDrawerNavigator } from '@react-navigation/drawer';
3
+ import {
4
+ View,
5
+ Text,
6
+ StyleSheet,
7
+ TouchableOpacity,
8
+ Image,
9
+ ScrollView,
10
+ } from 'react-native';
11
+ import BottomTabNavigator from './BottomTabNavigator';
12
+ import ProfileScreen from '../screens/ProfileScreen';
13
+
14
+ const Drawer = createDrawerNavigator();
15
+
16
+ interface DrawerItemProps {
17
+ label: string;
18
+ icon: string;
19
+ onPress: () => void;
20
+ active?: boolean;
21
+ }
22
+
23
+ const DrawerItem: React.FC<DrawerItemProps> = ({
24
+ label,
25
+ icon,
26
+ onPress,
27
+ active = false,
28
+ }) => {
29
+ return (
30
+ <TouchableOpacity
31
+ style={[styles.drawerItem, active && styles.activeDrawerItem]}
32
+ onPress={onPress}
33
+ >
34
+ <Text style={styles.drawerIcon}>{icon}</Text>
35
+ <Text style={[styles.drawerLabel, active && styles.activeDrawerLabel]}>
36
+ {label}
37
+ </Text>
38
+ </TouchableOpacity>
39
+ );
40
+ };
41
+
42
+ function CustomDrawerContent(props: any) {
43
+ const { navigation, state } = props;
44
+ const currentRoute = state.routes[state.index].name;
45
+
46
+ return (
47
+ <View style={styles.drawerContainer}>
48
+ <View style={styles.drawerHeader}>
49
+ <Image
50
+ source={{ uri: 'https://via.placeholder.com/80x80' }}
51
+ style={styles.drawerAvatar}
52
+ />
53
+ <Text style={styles.drawerName}>John Doe</Text>
54
+ <Text style={styles.drawerEmail}>john.doe@example.com</Text>
55
+ </View>
56
+
57
+ <ScrollView style={styles.drawerContent}>
58
+ <DrawerItem
59
+ label="Home"
60
+ icon="🏠"
61
+ active={currentRoute === 'HomeTabs'}
62
+ onPress={() => navigation.navigate('HomeTabs')}
63
+ />
64
+ <DrawerItem
65
+ label="Profile"
66
+ icon="👤"
67
+ active={currentRoute === 'Profile'}
68
+ onPress={() => navigation.navigate('Profile')}
69
+ />
70
+ <DrawerItem
71
+ label="Social Setup"
72
+ icon="📢"
73
+ onPress={() => {
74
+ /* Add navigation */
75
+ }}
76
+ />
77
+ <DrawerItem
78
+ label="Microsite Setup"
79
+ icon="⚙️"
80
+ onPress={() => {
81
+ /* Add navigation */
82
+ }}
83
+ />
84
+ <DrawerItem
85
+ label="Proposal"
86
+ icon="📋"
87
+ onPress={() => {
88
+ /* Add navigation */
89
+ }}
90
+ />
91
+ <DrawerItem
92
+ label="Email Campaign"
93
+ icon="📧"
94
+ onPress={() => {
95
+ /* Add navigation */
96
+ }}
97
+ />
98
+ <DrawerItem
99
+ label="View Microsite"
100
+ icon="🎵"
101
+ onPress={() => {
102
+ /* Add navigation */
103
+ }}
104
+ />
105
+ <DrawerItem
106
+ label="Import Contact"
107
+ icon="📄"
108
+ onPress={() => {
109
+ /* Add navigation */
110
+ }}
111
+ />
112
+
113
+ <View style={styles.drawerDivider} />
114
+
115
+ <DrawerItem
116
+ label="Settings"
117
+ icon="⚙️"
118
+ onPress={() => {
119
+ /* Add navigation */
120
+ }}
121
+ />
122
+ <DrawerItem
123
+ label="Help & Support"
124
+ icon="❓"
125
+ onPress={() => {
126
+ /* Add navigation */
127
+ }}
128
+ />
129
+ <DrawerItem
130
+ label="Logout"
131
+ icon="🚪"
132
+ onPress={() => {
133
+ /* Add logout logic */
134
+ }}
135
+ />
136
+ </ScrollView>
137
+ </View>
138
+ );
139
+ }
140
+
141
+ export default function DrawerNavigator() {
142
+ return (
143
+ <Drawer.Navigator
144
+ drawerContent={(props) => <CustomDrawerContent {...props} />}
145
+ screenOptions={{
146
+ headerShown: true,
147
+ drawerType: 'slide', // Changed from 'front' for better UX
148
+ swipeEdgeWidth: 100, // Width from edge to start swipe
149
+ drawerStyle: {
150
+ width: 280,
151
+ },
152
+ headerStyle: {
153
+ backgroundColor: '#4a148c',
154
+ },
155
+ headerTintColor: '#fff',
156
+ headerTitleStyle: {
157
+ fontWeight: '600',
158
+ },
159
+ }}
160
+ >
161
+ <Drawer.Screen
162
+ name="HomeTabs"
163
+ component={BottomTabNavigator}
164
+ options={{
165
+ title: 'Salespanda',
166
+ }}
167
+ />
168
+ <Drawer.Screen
169
+ name="Profile"
170
+ component={ProfileScreen}
171
+ options={{
172
+ title: 'Profile',
173
+ }}
174
+ />
175
+ </Drawer.Navigator>
176
+ );
177
+ }
178
+
179
+ const styles = StyleSheet.create({
180
+ drawerContainer: {
181
+ flex: 1,
182
+ backgroundColor: '#fff',
183
+ },
184
+ drawerHeader: {
185
+ backgroundColor: '#4a148c',
186
+ padding: 20,
187
+ paddingTop: 50,
188
+ alignItems: 'center',
189
+ },
190
+ drawerAvatar: {
191
+ width: 80,
192
+ height: 80,
193
+ borderRadius: 40,
194
+ marginBottom: 12,
195
+ borderWidth: 3,
196
+ borderColor: '#fff',
197
+ },
198
+ drawerName: {
199
+ fontSize: 18,
200
+ fontWeight: '600',
201
+ color: '#fff',
202
+ marginBottom: 4,
203
+ },
204
+ drawerEmail: {
205
+ fontSize: 14,
206
+ color: '#fff',
207
+ opacity: 0.8,
208
+ },
209
+ drawerContent: {
210
+ flex: 1,
211
+ paddingTop: 8,
212
+ },
213
+ drawerItem: {
214
+ flexDirection: 'row',
215
+ alignItems: 'center',
216
+ padding: 16,
217
+ paddingHorizontal: 20,
218
+ },
219
+ activeDrawerItem: {
220
+ backgroundColor: '#f5f5f5',
221
+ borderLeftWidth: 4,
222
+ borderLeftColor: '#4a148c',
223
+ },
224
+ drawerIcon: {
225
+ fontSize: 20,
226
+ marginRight: 16,
227
+ width: 24,
228
+ },
229
+ drawerLabel: {
230
+ fontSize: 16,
231
+ color: '#333',
232
+ },
233
+ activeDrawerLabel: {
234
+ fontWeight: '600',
235
+ color: '#4a148c',
236
+ },
237
+ drawerDivider: {
238
+ height: 1,
239
+ backgroundColor: '#e0e0e0',
240
+ marginVertical: 8,
241
+ },
242
+ });