@churchapps/apphelper 0.5.0 → 0.5.2
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/dist/components/Loading.js +36 -36
- package/dist/components/notes/Notes.js +27 -27
- package/dist/helpers/AnalyticsHelper.d.ts.map +1 -1
- package/dist/helpers/AnalyticsHelper.js +21 -6
- package/dist/helpers/AnalyticsHelper.js.map +1 -1
- package/dist/helpers/UserHelper.d.ts.map +1 -1
- package/dist/helpers/UserHelper.js +4 -1
- package/dist/helpers/UserHelper.js.map +1 -1
- package/dist/public/css/cropper.css +309 -309
- package/dist/public/css/styles.css +111 -111
- package/dist/public/locales/de.json +270 -0
- package/dist/public/locales/en.json +277 -0
- package/dist/public/locales/es.json +272 -0
- package/dist/public/locales/fr.json +270 -0
- package/dist/public/locales/hi.json +270 -0
- package/dist/public/locales/it.json +270 -0
- package/dist/public/locales/ko.json +270 -0
- package/dist/public/locales/no.json +270 -0
- package/dist/public/locales/pt.json +270 -0
- package/dist/public/locales/ru.json +270 -0
- package/dist/public/locales/tl.json +270 -0
- package/dist/public/locales/zh.json +270 -0
- package/package.json +72 -72
- package/public/css/cropper.css +309 -309
- package/public/css/styles.css +111 -111
- package/public/locales/de.json +269 -269
- package/public/locales/en.json +276 -276
- package/public/locales/es.json +272 -272
- package/public/locales/fr.json +269 -269
- package/public/locales/hi.json +269 -269
- package/public/locales/it.json +269 -269
- package/public/locales/ko.json +269 -269
- package/public/locales/no.json +269 -269
- package/public/locales/pt.json +269 -269
- package/public/locales/ru.json +269 -269
- package/public/locales/tl.json +269 -269
- package/public/locales/zh.json +269 -269
- package/src/components/DisplayBox.tsx +83 -83
- package/src/components/ErrorMessages.tsx +28 -28
- package/src/components/ExportLink.tsx +81 -81
- package/src/components/FloatingSupport.tsx +18 -18
- package/src/components/FormCardPayment.tsx +184 -184
- package/src/components/FormSubmissionEdit.tsx +168 -168
- package/src/components/HelpIcon.tsx +12 -12
- package/src/components/ImageEditor.tsx +161 -161
- package/src/components/InputBox.tsx +96 -96
- package/src/components/Loading.tsx +77 -77
- package/src/components/PageHeader.tsx +110 -110
- package/src/components/PersonAvatar.tsx +77 -77
- package/src/components/QuestionEdit.tsx +99 -99
- package/src/components/SmallButton.tsx +42 -42
- package/src/components/SupportModal.tsx +32 -32
- package/src/components/TabPanel.tsx +28 -28
- package/src/components/gallery/GalleryModal.tsx +173 -173
- package/src/components/gallery/StockPhotos.tsx +95 -95
- package/src/components/gallery/index.ts +1 -1
- package/src/components/header/Banner.tsx +11 -11
- package/src/components/header/PrimaryMenu.tsx +100 -100
- package/src/components/header/SecondaryMenu.tsx +23 -23
- package/src/components/header/SecondaryMenuAlt.tsx +40 -40
- package/src/components/header/SiteHeader.tsx +207 -207
- package/src/components/header/SupportDrawer.tsx +111 -111
- package/src/components/header/index.tsx +2 -2
- package/src/components/index.tsx +20 -20
- package/src/components/notes/AddNote.tsx +180 -180
- package/src/components/notes/Note.tsx +68 -68
- package/src/components/notes/Notes.tsx +208 -208
- package/src/components/notes/index.ts +3 -3
- package/src/components/wrapper/AppList.tsx +19 -19
- package/src/components/wrapper/ChurchList.tsx +154 -154
- package/src/components/wrapper/NavItem.tsx +47 -47
- package/src/components/wrapper/NewPrivateMessage.tsx +253 -253
- package/src/components/wrapper/Notifications.tsx +223 -223
- package/src/components/wrapper/PrivateMessageDetails.tsx +112 -112
- package/src/components/wrapper/PrivateMessages.tsx +576 -576
- package/src/components/wrapper/UserMenu.tsx +383 -383
- package/src/components/wrapper/index.tsx +8 -8
- package/src/helpers/AnalyticsHelper.ts +44 -32
- package/src/helpers/AppearanceHelper.ts +73 -73
- package/src/helpers/ArrayHelper.ts +87 -87
- package/src/helpers/CurrencyHelper.ts +10 -10
- package/src/helpers/DateHelper.ts +104 -104
- package/src/helpers/ErrorHelper.ts +43 -43
- package/src/helpers/EventHelper.ts +49 -49
- package/src/helpers/FileHelper.ts +31 -31
- package/src/helpers/Locale.ts +457 -457
- package/src/helpers/NotificationService.ts +296 -296
- package/src/helpers/PersonHelper.ts +62 -62
- package/src/helpers/SlugHelper.ts +37 -37
- package/src/helpers/SocketHelper.ts +296 -296
- package/src/helpers/UniqueIdHelper.ts +36 -36
- package/src/helpers/UserHelper.ts +107 -104
- package/src/helpers/createEmotionCache.ts +17 -17
- package/src/helpers/index.ts +58 -58
- package/src/hooks/index.ts +3 -3
- package/src/hooks/useMountedState.ts +16 -16
- package/src/hooks/useNotifications.ts +93 -93
- package/src/index.ts +2 -2
- package/src/types/interface-extensions.d.ts +11 -11
- package/tsconfig.json +31 -31
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
import React, { useState, useEffect, useCallback } from 'react';
|
|
2
|
-
import { NotificationService, NotificationCounts } from '../helpers/NotificationService';
|
|
3
|
-
import { UserContextInterface } from '@churchapps/helpers';
|
|
4
|
-
|
|
5
|
-
export interface UseNotificationsResult {
|
|
6
|
-
counts: NotificationCounts;
|
|
7
|
-
isLoading: boolean;
|
|
8
|
-
isReady: boolean;
|
|
9
|
-
refresh: () => Promise<void>;
|
|
10
|
-
error: string | null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Custom hook for managing real-time notifications
|
|
15
|
-
*
|
|
16
|
-
* @param context - User context containing person and church information
|
|
17
|
-
* @returns Object containing notification counts and management functions
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```tsx
|
|
21
|
-
* const { counts, isLoading, refresh } = useNotifications(context);
|
|
22
|
-
*
|
|
23
|
-
* return (
|
|
24
|
-
* <UserMenu
|
|
25
|
-
* notificationCounts={counts}
|
|
26
|
-
* loadCounts={refresh}
|
|
27
|
-
* // ... other props
|
|
28
|
-
* />
|
|
29
|
-
* );
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export function useNotifications(context: UserContextInterface | null): UseNotificationsResult {
|
|
33
|
-
const [counts, setCounts] = useState<NotificationCounts>({ notificationCount: 0, pmCount: 0 });
|
|
34
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
35
|
-
const [error, setError] = useState<string | null>(null);
|
|
36
|
-
|
|
37
|
-
// Get the singleton instance only once
|
|
38
|
-
const notificationService = React.useMemo(() => NotificationService.getInstance(), []);
|
|
39
|
-
|
|
40
|
-
// Initialize the service when context becomes available
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
if (!context?.person?.id || !context?.userChurch?.church?.id) {
|
|
43
|
-
setIsLoading(false);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const initializeService = async () => {
|
|
48
|
-
try {
|
|
49
|
-
setIsLoading(true);
|
|
50
|
-
setError(null);
|
|
51
|
-
|
|
52
|
-
await notificationService.initialize(context);
|
|
53
|
-
} catch (err) {
|
|
54
|
-
console.error("❌ useNotifications: Failed to initialize:", err);
|
|
55
|
-
setError(err instanceof Error ? err.message : 'Failed to initialize notifications');
|
|
56
|
-
} finally {
|
|
57
|
-
setIsLoading(false);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
initializeService();
|
|
62
|
-
}, [context?.person?.id, context?.userChurch?.church?.id]);
|
|
63
|
-
|
|
64
|
-
// Subscribe to notification count changes
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
const unsubscribe = notificationService.subscribe((newCounts) => {
|
|
67
|
-
setCounts(newCounts);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
// Cleanup subscription on unmount
|
|
71
|
-
return () => {
|
|
72
|
-
unsubscribe();
|
|
73
|
-
};
|
|
74
|
-
}, [notificationService]);
|
|
75
|
-
|
|
76
|
-
// Refresh function - memoized without dependencies for stable reference
|
|
77
|
-
const refresh = useCallback(async () => {
|
|
78
|
-
try {
|
|
79
|
-
setError(null);
|
|
80
|
-
await NotificationService.getInstance().refresh();
|
|
81
|
-
} catch (err) {
|
|
82
|
-
console.error("❌ useNotifications: Refresh failed:", err);
|
|
83
|
-
setError(err instanceof Error ? err.message : 'Failed to refresh notifications');
|
|
84
|
-
}
|
|
85
|
-
}, []);
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
counts,
|
|
89
|
-
isLoading,
|
|
90
|
-
isReady: notificationService.isReady(),
|
|
91
|
-
refresh,
|
|
92
|
-
error
|
|
93
|
-
};
|
|
1
|
+
import React, { useState, useEffect, useCallback } from 'react';
|
|
2
|
+
import { NotificationService, NotificationCounts } from '../helpers/NotificationService';
|
|
3
|
+
import { UserContextInterface } from '@churchapps/helpers';
|
|
4
|
+
|
|
5
|
+
export interface UseNotificationsResult {
|
|
6
|
+
counts: NotificationCounts;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
isReady: boolean;
|
|
9
|
+
refresh: () => Promise<void>;
|
|
10
|
+
error: string | null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Custom hook for managing real-time notifications
|
|
15
|
+
*
|
|
16
|
+
* @param context - User context containing person and church information
|
|
17
|
+
* @returns Object containing notification counts and management functions
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { counts, isLoading, refresh } = useNotifications(context);
|
|
22
|
+
*
|
|
23
|
+
* return (
|
|
24
|
+
* <UserMenu
|
|
25
|
+
* notificationCounts={counts}
|
|
26
|
+
* loadCounts={refresh}
|
|
27
|
+
* // ... other props
|
|
28
|
+
* />
|
|
29
|
+
* );
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export function useNotifications(context: UserContextInterface | null): UseNotificationsResult {
|
|
33
|
+
const [counts, setCounts] = useState<NotificationCounts>({ notificationCount: 0, pmCount: 0 });
|
|
34
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
35
|
+
const [error, setError] = useState<string | null>(null);
|
|
36
|
+
|
|
37
|
+
// Get the singleton instance only once
|
|
38
|
+
const notificationService = React.useMemo(() => NotificationService.getInstance(), []);
|
|
39
|
+
|
|
40
|
+
// Initialize the service when context becomes available
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (!context?.person?.id || !context?.userChurch?.church?.id) {
|
|
43
|
+
setIsLoading(false);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const initializeService = async () => {
|
|
48
|
+
try {
|
|
49
|
+
setIsLoading(true);
|
|
50
|
+
setError(null);
|
|
51
|
+
|
|
52
|
+
await notificationService.initialize(context);
|
|
53
|
+
} catch (err) {
|
|
54
|
+
console.error("❌ useNotifications: Failed to initialize:", err);
|
|
55
|
+
setError(err instanceof Error ? err.message : 'Failed to initialize notifications');
|
|
56
|
+
} finally {
|
|
57
|
+
setIsLoading(false);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
initializeService();
|
|
62
|
+
}, [context?.person?.id, context?.userChurch?.church?.id]);
|
|
63
|
+
|
|
64
|
+
// Subscribe to notification count changes
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
const unsubscribe = notificationService.subscribe((newCounts) => {
|
|
67
|
+
setCounts(newCounts);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Cleanup subscription on unmount
|
|
71
|
+
return () => {
|
|
72
|
+
unsubscribe();
|
|
73
|
+
};
|
|
74
|
+
}, [notificationService]);
|
|
75
|
+
|
|
76
|
+
// Refresh function - memoized without dependencies for stable reference
|
|
77
|
+
const refresh = useCallback(async () => {
|
|
78
|
+
try {
|
|
79
|
+
setError(null);
|
|
80
|
+
await NotificationService.getInstance().refresh();
|
|
81
|
+
} catch (err) {
|
|
82
|
+
console.error("❌ useNotifications: Refresh failed:", err);
|
|
83
|
+
setError(err instanceof Error ? err.message : 'Failed to refresh notifications');
|
|
84
|
+
}
|
|
85
|
+
}, []);
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
counts,
|
|
89
|
+
isLoading,
|
|
90
|
+
isReady: notificationService.isReady(),
|
|
91
|
+
refresh,
|
|
92
|
+
error
|
|
93
|
+
};
|
|
94
94
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./helpers";
|
|
2
|
-
export * from "./components";
|
|
1
|
+
export * from "./helpers";
|
|
2
|
+
export * from "./components";
|
|
3
3
|
export * from "./hooks";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// Interface extensions for donation functionality - DISABLED DUE TO TYPESCRIPT CONFLICT
|
|
2
|
-
// The module augmentation breaks TypeScript's ability to resolve exports from @churchapps/helpers
|
|
3
|
-
|
|
4
|
-
// declare module "@churchapps/helpers" {
|
|
5
|
-
// interface PaymentMethodInterface {
|
|
6
|
-
// gatewayId?: string;
|
|
7
|
-
// }
|
|
8
|
-
|
|
9
|
-
// interface SubscriptionInterface {
|
|
10
|
-
// gatewayId?: string;
|
|
11
|
-
// }
|
|
1
|
+
// Interface extensions for donation functionality - DISABLED DUE TO TYPESCRIPT CONFLICT
|
|
2
|
+
// The module augmentation breaks TypeScript's ability to resolve exports from @churchapps/helpers
|
|
3
|
+
|
|
4
|
+
// declare module "@churchapps/helpers" {
|
|
5
|
+
// interface PaymentMethodInterface {
|
|
6
|
+
// gatewayId?: string;
|
|
7
|
+
// }
|
|
8
|
+
|
|
9
|
+
// interface SubscriptionInterface {
|
|
10
|
+
// gatewayId?: string;
|
|
11
|
+
// }
|
|
12
12
|
// }
|
package/tsconfig.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "ESNext",
|
|
4
|
-
"esModuleInterop": true,
|
|
5
|
-
"lib": ["ES2021", "DOM"],
|
|
6
|
-
"typeRoots": ["node_modules/@types"],
|
|
7
|
-
"experimentalDecorators": true,
|
|
8
|
-
"emitDecoratorMetadata": true,
|
|
9
|
-
"target": "ES2020",
|
|
10
|
-
"noImplicitAny": false,
|
|
11
|
-
"moduleResolution": "node",
|
|
12
|
-
"sourceMap": true,
|
|
13
|
-
"outDir": "dist",
|
|
14
|
-
"baseUrl": ".",
|
|
15
|
-
"strict": false,
|
|
16
|
-
"allowSyntheticDefaultImports": true,
|
|
17
|
-
"declaration": true,
|
|
18
|
-
"declarationMap": true,
|
|
19
|
-
"jsx": "react-jsx",
|
|
20
|
-
"skipLibCheck": true,
|
|
21
|
-
"forceConsistentCasingInFileNames": false,
|
|
22
|
-
"resolveJsonModule": true,
|
|
23
|
-
"isolatedModules": true
|
|
24
|
-
},
|
|
25
|
-
"include": [
|
|
26
|
-
"src/**/*"
|
|
27
|
-
],
|
|
28
|
-
"exclude": [
|
|
29
|
-
"node_modules",
|
|
30
|
-
"dist"
|
|
31
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "ESNext",
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"lib": ["ES2021", "DOM"],
|
|
6
|
+
"typeRoots": ["node_modules/@types"],
|
|
7
|
+
"experimentalDecorators": true,
|
|
8
|
+
"emitDecoratorMetadata": true,
|
|
9
|
+
"target": "ES2020",
|
|
10
|
+
"noImplicitAny": false,
|
|
11
|
+
"moduleResolution": "node",
|
|
12
|
+
"sourceMap": true,
|
|
13
|
+
"outDir": "dist",
|
|
14
|
+
"baseUrl": ".",
|
|
15
|
+
"strict": false,
|
|
16
|
+
"allowSyntheticDefaultImports": true,
|
|
17
|
+
"declaration": true,
|
|
18
|
+
"declarationMap": true,
|
|
19
|
+
"jsx": "react-jsx",
|
|
20
|
+
"skipLibCheck": true,
|
|
21
|
+
"forceConsistentCasingInFileNames": false,
|
|
22
|
+
"resolveJsonModule": true,
|
|
23
|
+
"isolatedModules": true
|
|
24
|
+
},
|
|
25
|
+
"include": [
|
|
26
|
+
"src/**/*"
|
|
27
|
+
],
|
|
28
|
+
"exclude": [
|
|
29
|
+
"node_modules",
|
|
30
|
+
"dist"
|
|
31
|
+
]
|
|
32
32
|
}
|