react-native-salespanda 0.5.3 → 0.7.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 (131) hide show
  1. package/README.md +50 -102
  2. package/android/build.gradle +15 -198
  3. package/package.json +3 -4
  4. package/lib/module/NativeSalespanda.js.map +0 -1
  5. package/lib/module/SalespandaApp.js.map +0 -1
  6. package/lib/module/assets/images/index.js.map +0 -1
  7. package/lib/module/components/BottomSheet.js.map +0 -1
  8. package/lib/module/components/ContactViaModal.js.map +0 -1
  9. package/lib/module/components/Loader.js.map +0 -1
  10. package/lib/module/components/ScreenHeader.js.map +0 -1
  11. package/lib/module/components/SearchBar.js.map +0 -1
  12. package/lib/module/components/TabsHeader.js.map +0 -1
  13. package/lib/module/components/index.js.map +0 -1
  14. package/lib/module/config/FlavorConfig.js.map +0 -1
  15. package/lib/module/config/SalespandaConfig.js.map +0 -1
  16. package/lib/module/constants/Colors.js.map +0 -1
  17. package/lib/module/constants/GetPlatorm.js.map +0 -1
  18. package/lib/module/index.js.map +0 -1
  19. package/lib/module/navigation/AppNavigator.js.map +0 -1
  20. package/lib/module/navigation/BottomTabNavigator.js.map +0 -1
  21. package/lib/module/navigation/DrawerNavigator.js.map +0 -1
  22. package/lib/module/navigation/StackNavigator.js.map +0 -1
  23. package/lib/module/screens/CRM/AddContactModal.js.map +0 -1
  24. package/lib/module/screens/CRM/CategoryTabs.js.map +0 -1
  25. package/lib/module/screens/CRM/ContactItem.js.map +0 -1
  26. package/lib/module/screens/CRM/FilterDropdown.js.map +0 -1
  27. package/lib/module/screens/CRM/FunnelChart.js.map +0 -1
  28. package/lib/module/screens/CRM/InfoCard.js.map +0 -1
  29. package/lib/module/screens/CRM/LeadCard.js.map +0 -1
  30. package/lib/module/screens/CRM/LogCallScreen.js.map +0 -1
  31. package/lib/module/screens/CRM/TopTabs.js.map +0 -1
  32. package/lib/module/screens/CRM/index.js.map +0 -1
  33. package/lib/module/screens/ReportsScreen.js.map +0 -1
  34. package/lib/module/screens/Tabs/ActivityAnalytics.js.map +0 -1
  35. package/lib/module/screens/Tabs/CRMScreen.js.map +0 -1
  36. package/lib/module/screens/Tabs/DigitalDiary.js.map +0 -1
  37. package/lib/module/screens/Tabs/HomeScreen.js.map +0 -1
  38. package/lib/module/screens/Tabs/NotificationsScreen.js.map +0 -1
  39. package/lib/module/screens/contentliberary/contentliberary.js.map +0 -1
  40. package/lib/module/services/api.js.map +0 -1
  41. package/lib/module/services/authService.js.map +0 -1
  42. package/lib/module/store/index.js.map +0 -1
  43. package/lib/typescript/src/NativeSalespanda.d.ts.map +0 -1
  44. package/lib/typescript/src/SalespandaApp.d.ts.map +0 -1
  45. package/lib/typescript/src/assets/images/index.d.ts.map +0 -1
  46. package/lib/typescript/src/components/BottomSheet.d.ts.map +0 -1
  47. package/lib/typescript/src/components/ContactViaModal.d.ts.map +0 -1
  48. package/lib/typescript/src/components/Loader.d.ts.map +0 -1
  49. package/lib/typescript/src/components/ScreenHeader.d.ts.map +0 -1
  50. package/lib/typescript/src/components/SearchBar.d.ts.map +0 -1
  51. package/lib/typescript/src/components/TabsHeader.d.ts.map +0 -1
  52. package/lib/typescript/src/components/index.d.ts.map +0 -1
  53. package/lib/typescript/src/config/FlavorConfig.d.ts.map +0 -1
  54. package/lib/typescript/src/config/SalespandaConfig.d.ts.map +0 -1
  55. package/lib/typescript/src/constants/Colors.d.ts.map +0 -1
  56. package/lib/typescript/src/constants/GetPlatorm.d.ts.map +0 -1
  57. package/lib/typescript/src/index.d.ts.map +0 -1
  58. package/lib/typescript/src/navigation/AppNavigator.d.ts.map +0 -1
  59. package/lib/typescript/src/navigation/BottomTabNavigator.d.ts.map +0 -1
  60. package/lib/typescript/src/navigation/DrawerNavigator.d.ts.map +0 -1
  61. package/lib/typescript/src/navigation/StackNavigator.d.ts.map +0 -1
  62. package/lib/typescript/src/screens/CRM/AddContactModal.d.ts.map +0 -1
  63. package/lib/typescript/src/screens/CRM/CategoryTabs.d.ts.map +0 -1
  64. package/lib/typescript/src/screens/CRM/ContactItem.d.ts.map +0 -1
  65. package/lib/typescript/src/screens/CRM/FilterDropdown.d.ts.map +0 -1
  66. package/lib/typescript/src/screens/CRM/FunnelChart.d.ts.map +0 -1
  67. package/lib/typescript/src/screens/CRM/InfoCard.d.ts.map +0 -1
  68. package/lib/typescript/src/screens/CRM/LeadCard.d.ts.map +0 -1
  69. package/lib/typescript/src/screens/CRM/LogCallScreen.d.ts.map +0 -1
  70. package/lib/typescript/src/screens/CRM/TopTabs.d.ts.map +0 -1
  71. package/lib/typescript/src/screens/CRM/index.d.ts.map +0 -1
  72. package/lib/typescript/src/screens/ReportsScreen.d.ts.map +0 -1
  73. package/lib/typescript/src/screens/Tabs/ActivityAnalytics.d.ts.map +0 -1
  74. package/lib/typescript/src/screens/Tabs/CRMScreen.d.ts.map +0 -1
  75. package/lib/typescript/src/screens/Tabs/DigitalDiary.d.ts.map +0 -1
  76. package/lib/typescript/src/screens/Tabs/HomeScreen.d.ts.map +0 -1
  77. package/lib/typescript/src/screens/Tabs/NotificationsScreen.d.ts.map +0 -1
  78. package/lib/typescript/src/screens/contentliberary/contentliberary.d.ts.map +0 -1
  79. package/lib/typescript/src/services/api.d.ts.map +0 -1
  80. package/lib/typescript/src/services/authService.d.ts.map +0 -1
  81. package/lib/typescript/src/store/index.d.ts.map +0 -1
  82. package/src/NativeSalespanda.ts +0 -7
  83. package/src/SalespandaApp.tsx +0 -141
  84. package/src/assets/images/bottomtabs/analytics.png +0 -0
  85. package/src/assets/images/bottomtabs/analyticsactive.png +0 -0
  86. package/src/assets/images/bottomtabs/crm.png +0 -0
  87. package/src/assets/images/bottomtabs/crmactive.png +0 -0
  88. package/src/assets/images/bottomtabs/diary.png +0 -0
  89. package/src/assets/images/bottomtabs/diaryactive.png +0 -0
  90. package/src/assets/images/bottomtabs/home.png +0 -0
  91. package/src/assets/images/bottomtabs/homeactive.png +0 -0
  92. package/src/assets/images/bottomtabs/notification.png +0 -0
  93. package/src/assets/images/bottomtabs/notificationactive.png +0 -0
  94. package/src/assets/images/index.js +0 -11
  95. package/src/assets/images/index.ts +0 -40
  96. package/src/components/BottomSheet.tsx +0 -146
  97. package/src/components/ContactViaModal.tsx +0 -80
  98. package/src/components/Loader.tsx +0 -48
  99. package/src/components/ScreenHeader.tsx +0 -57
  100. package/src/components/SearchBar.tsx +0 -59
  101. package/src/components/TabsHeader.tsx +0 -72
  102. package/src/components/index.ts +0 -5
  103. package/src/config/FlavorConfig.ts +0 -55
  104. package/src/config/SalespandaConfig.ts +0 -142
  105. package/src/constants/Colors.ts +0 -17
  106. package/src/constants/GetPlatorm.ts +0 -29
  107. package/src/index.tsx +0 -31
  108. package/src/navigation/AppNavigator.tsx +0 -24
  109. package/src/navigation/BottomTabNavigator.tsx +0 -181
  110. package/src/navigation/DrawerNavigator.tsx +0 -306
  111. package/src/navigation/StackNavigator.tsx +0 -32
  112. package/src/screens/CRM/AddContactModal.tsx +0 -57
  113. package/src/screens/CRM/CategoryTabs.tsx +0 -109
  114. package/src/screens/CRM/ContactItem.tsx +0 -168
  115. package/src/screens/CRM/FilterDropdown.tsx +0 -34
  116. package/src/screens/CRM/FunnelChart.tsx +0 -103
  117. package/src/screens/CRM/InfoCard.tsx +0 -51
  118. package/src/screens/CRM/LeadCard.tsx +0 -69
  119. package/src/screens/CRM/LogCallScreen.tsx +0 -318
  120. package/src/screens/CRM/TopTabs.tsx +0 -95
  121. package/src/screens/CRM/index.ts +0 -10
  122. package/src/screens/ReportsScreen.tsx +0 -37
  123. package/src/screens/Tabs/ActivityAnalytics.tsx +0 -25
  124. package/src/screens/Tabs/CRMScreen.tsx +0 -381
  125. package/src/screens/Tabs/DigitalDiary.tsx +0 -35
  126. package/src/screens/Tabs/HomeScreen.tsx +0 -379
  127. package/src/screens/Tabs/NotificationsScreen.tsx +0 -25
  128. package/src/screens/contentliberary/contentliberary.tsx +0 -268
  129. package/src/services/api.ts +0 -173
  130. package/src/services/authService.ts +0 -75
  131. package/src/store/index.ts +0 -16
@@ -1,173 +0,0 @@
1
- import AsyncStorage from '@react-native-async-storage/async-storage';
2
- import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
3
-
4
- const BASE_URL = 'https://app.sptestmfp.com/';
5
- const DEFAULT_CLIENT_ID = 'vPUz1fFucjlNAV8rujFg7AfGbS3Ay/4=';
6
- const DEFAULT_AGENT_ID = '3pYw3fp0iTwOge6wjf4i+Fm7QBbx';
7
- const TOKENS_KEY = '@salespanda/sdk/tokens';
8
-
9
- export type RuntimeTokens = {
10
- token: string | null;
11
- accessToken: string | null;
12
- };
13
-
14
- export type AuthenticateResponse = {
15
- statusCode: string;
16
- status: string;
17
- message: string;
18
- expire_datetime?: string;
19
- access_token: string;
20
- };
21
-
22
- export type SsoLoginResponse = {
23
- statusCode: string;
24
- status: string;
25
- message: string;
26
- token: string;
27
- response?: unknown;
28
- };
29
-
30
- export type HomeMenuItem = {
31
- title: string;
32
- desciption?: string | null;
33
- image?: string | null;
34
- banner_image?: string | null;
35
- page_key?: string | null;
36
- link?: string | null;
37
- };
38
-
39
- export type HomeBannerItem = {
40
- title?: string | null;
41
- desciption?: string | null;
42
- image: string;
43
- page_key?: string | null;
44
- link?: string | null;
45
- user_type?: string | null;
46
- app_page?: number;
47
- };
48
-
49
- export type HomeResponse = {
50
- statusCode: string;
51
- status: string;
52
- message: string;
53
- response: {
54
- menu: HomeMenuItem[];
55
- home_banner: HomeBannerItem[];
56
- [key: string]: unknown;
57
- };
58
- };
59
-
60
- let runtimeTokens: RuntimeTokens = {
61
- token: null,
62
- accessToken: null,
63
- };
64
-
65
- export const setRuntimeTokens = (tokens: Partial<RuntimeTokens>) => {
66
- runtimeTokens = { ...runtimeTokens, ...tokens };
67
- };
68
-
69
- export const getRuntimeTokens = (): RuntimeTokens => runtimeTokens;
70
-
71
- export const loadPersistedTokens = async (): Promise<RuntimeTokens> => {
72
- try {
73
- const stored = await AsyncStorage.getItem(TOKENS_KEY);
74
- if (stored) {
75
- const parsed = JSON.parse(stored) as RuntimeTokens;
76
- runtimeTokens = {
77
- token: parsed.token || null,
78
- accessToken: parsed.accessToken || null,
79
- };
80
- return runtimeTokens;
81
- }
82
- } catch {
83
- // ignore storage failures
84
- }
85
- return { token: null, accessToken: null };
86
- };
87
-
88
- export const persistTokens = async (tokens: Partial<RuntimeTokens>) => {
89
- const next = { ...runtimeTokens, ...tokens };
90
- runtimeTokens = next;
91
- try {
92
- await AsyncStorage.setItem(TOKENS_KEY, JSON.stringify(next));
93
- } catch {
94
- // ignore storage failures
95
- }
96
- };
97
-
98
- export const clearPersistedTokens = async () => {
99
- runtimeTokens = { token: null, accessToken: null };
100
- try {
101
- await AsyncStorage.removeItem(TOKENS_KEY);
102
- } catch {
103
- // ignore storage failures
104
- }
105
- };
106
-
107
- const baseQuery = fetchBaseQuery({
108
- baseUrl: BASE_URL,
109
- prepareHeaders: (headers) => {
110
- if (runtimeTokens.token) {
111
- headers.set('Token', runtimeTokens.token);
112
- }
113
- return headers;
114
- },
115
- });
116
-
117
- export const salespandaApi = createApi({
118
- reducerPath: 'salespandaApi',
119
- baseQuery,
120
- endpoints: (builder) => ({
121
- authenticate: builder.mutation<
122
- AuthenticateResponse,
123
- { agent_id?: string; clientId?: string }
124
- >({
125
- query: ({ agent_id = DEFAULT_AGENT_ID, clientId }) => ({
126
- url: 'framework/api/authenticate',
127
- method: 'POST',
128
- headers: {
129
- 'Content-Type': 'application/json',
130
- 'Client-Id': clientId || DEFAULT_CLIENT_ID,
131
- },
132
- body: { agent_id },
133
- }),
134
- }),
135
- spssoLogin: builder.mutation<
136
- SsoLoginResponse,
137
- { access_token: string; app_version?: string }
138
- >({
139
- query: ({ access_token, app_version = '1.0' }) => ({
140
- url: 'framework/api/spssologin',
141
- method: 'POST',
142
- headers: {
143
- 'Content-Type': 'application/json',
144
- },
145
- body: { app_version, access_token },
146
- }),
147
- }),
148
- getHome: builder.query<
149
- HomeResponse,
150
- { app_version?: string; tokenOverride?: string }
151
- >({
152
- query: ({ app_version = '5.0.1', tokenOverride } = {}) => ({
153
- url: 'manager/apis/V2/app-home-screen.php',
154
- method: 'POST',
155
- headers: tokenOverride
156
- ? {
157
- 'Token': tokenOverride,
158
- 'Content-Type': 'application/json',
159
- }
160
- : {
161
- 'Content-Type': 'application/json',
162
- },
163
- body: { app_version },
164
- }),
165
- }),
166
- }),
167
- });
168
-
169
- export const {
170
- useAuthenticateMutation,
171
- useSpssoLoginMutation,
172
- useLazyGetHomeQuery,
173
- } = salespandaApi;
@@ -1,75 +0,0 @@
1
- import AsyncStorage from '@react-native-async-storage/async-storage';
2
- import {
3
- clearPersistedTokens,
4
- getRuntimeTokens,
5
- setRuntimeTokens,
6
- } from './api';
7
-
8
- const USER_KEY = '@salespanda/sdk/user';
9
-
10
- export type AuthUser = {
11
- id?: string;
12
- name?: string;
13
- email?: string;
14
- phone?: string;
15
- raw?: unknown;
16
- };
17
-
18
- let runtimeUser: AuthUser | null = null;
19
-
20
- export const login = async (
21
- user?: AuthUser,
22
- token?: string,
23
- accessToken?: string
24
- ) => {
25
- if (token) {
26
- setRuntimeTokens({ token });
27
- }
28
- if (accessToken) {
29
- setRuntimeTokens({ accessToken });
30
- }
31
- if (user) {
32
- runtimeUser = user;
33
- try {
34
- await AsyncStorage.setItem(USER_KEY, JSON.stringify(user));
35
- } catch {
36
- // ignore storage failures
37
- }
38
- }
39
- };
40
-
41
- export const logout = async () => {
42
- runtimeUser = null;
43
- await clearPersistedTokens();
44
- try {
45
- await AsyncStorage.removeItem(USER_KEY);
46
- } catch {
47
- // ignore storage failures
48
- }
49
- };
50
-
51
- export const isAuthenticated = (): boolean => {
52
- const tokens = getRuntimeTokens();
53
- return Boolean(tokens.token || tokens.accessToken);
54
- };
55
-
56
- export const getCurrentUser = async (): Promise<AuthUser | null> => {
57
- if (runtimeUser) {
58
- return runtimeUser;
59
- }
60
- try {
61
- const stored = await AsyncStorage.getItem(USER_KEY);
62
- if (stored) {
63
- runtimeUser = JSON.parse(stored) as AuthUser;
64
- return runtimeUser;
65
- }
66
- } catch {
67
- // ignore storage failures
68
- }
69
- return null;
70
- };
71
-
72
- export const getCurrentToken = (): string | null => {
73
- const tokens = getRuntimeTokens();
74
- return tokens.token || tokens.accessToken;
75
- };
@@ -1,16 +0,0 @@
1
- import { configureStore } from '@reduxjs/toolkit';
2
- import { setupListeners } from '@reduxjs/toolkit/query';
3
- import { salespandaApi } from '../services/api';
4
-
5
- export const store = configureStore({
6
- reducer: {
7
- [salespandaApi.reducerPath]: salespandaApi.reducer,
8
- },
9
- middleware: (getDefaultMiddleware) =>
10
- getDefaultMiddleware().concat(salespandaApi.middleware),
11
- });
12
-
13
- setupListeners(store.dispatch);
14
-
15
- export type RootState = ReturnType<typeof store.getState>;
16
- export type AppDispatch = typeof store.dispatch;