@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,36 +1,36 @@
|
|
|
1
|
-
export class UniqueIdHelper {
|
|
2
|
-
|
|
3
|
-
static chars = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
|
|
4
|
-
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
|
|
5
|
-
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0",
|
|
6
|
-
"-", "_"];
|
|
7
|
-
|
|
8
|
-
static alphanumericChars = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
|
|
9
|
-
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
|
|
10
|
-
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"];
|
|
11
|
-
|
|
12
|
-
public static isMissing(obj: any) {
|
|
13
|
-
if (obj === undefined || obj === null) return true;
|
|
14
|
-
else if (obj.toString() === "") return true;
|
|
15
|
-
else return false;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public static shortId() {
|
|
19
|
-
return this.generate(UniqueIdHelper.chars, 11);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public static generateAlphanumeric() {
|
|
23
|
-
return this.generate(UniqueIdHelper.alphanumericChars, 11);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public static generate(charList: string[], length: number) {
|
|
27
|
-
let result = "";
|
|
28
|
-
for (let i = 0; i < length; i++) {
|
|
29
|
-
const idx = Math.floor(Math.random() * charList.length);
|
|
30
|
-
const c = charList[idx];
|
|
31
|
-
result += c;
|
|
32
|
-
}
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|
|
1
|
+
export class UniqueIdHelper {
|
|
2
|
+
|
|
3
|
+
static chars = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
|
|
4
|
+
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
|
|
5
|
+
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0",
|
|
6
|
+
"-", "_"];
|
|
7
|
+
|
|
8
|
+
static alphanumericChars = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
|
|
9
|
+
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
|
|
10
|
+
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"];
|
|
11
|
+
|
|
12
|
+
public static isMissing(obj: any) {
|
|
13
|
+
if (obj === undefined || obj === null) return true;
|
|
14
|
+
else if (obj.toString() === "") return true;
|
|
15
|
+
else return false;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public static shortId() {
|
|
19
|
+
return this.generate(UniqueIdHelper.chars, 11);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public static generateAlphanumeric() {
|
|
23
|
+
return this.generate(UniqueIdHelper.alphanumericChars, 11);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public static generate(charList: string[], length: number) {
|
|
27
|
+
let result = "";
|
|
28
|
+
for (let i = 0; i < length; i++) {
|
|
29
|
+
const idx = Math.floor(Math.random() * charList.length);
|
|
30
|
+
const c = charList[idx];
|
|
31
|
+
result += c;
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
}
|
|
@@ -1,104 +1,107 @@
|
|
|
1
|
-
import { ApiHelper } from "@churchapps/helpers"
|
|
2
|
-
import { UserInterface, UserContextInterface, IApiPermission, PersonInterface, LoginUserChurchInterface } from "@churchapps/helpers";
|
|
3
|
-
|
|
4
|
-
export class UserHelper {
|
|
5
|
-
static currentUserChurch: LoginUserChurchInterface;
|
|
6
|
-
static userChurches: LoginUserChurchInterface[];
|
|
7
|
-
static user: UserInterface;
|
|
8
|
-
static churchChanged: boolean = false;
|
|
9
|
-
static person: PersonInterface;
|
|
10
|
-
|
|
11
|
-
static selectChurch = async (context?: UserContextInterface, churchId?: string, keyName?: string) => {
|
|
12
|
-
let userChurch = null;
|
|
13
|
-
|
|
14
|
-
// Ensure userChurches is initialized
|
|
15
|
-
if (!UserHelper.userChurches || !Array.isArray(UserHelper.userChurches)) {
|
|
16
|
-
console.error('UserHelper.userChurches is not initialized or not an array:', UserHelper.userChurches);
|
|
17
|
-
// Try to get userChurches from context if available
|
|
18
|
-
if (context?.userChurches && Array.isArray(context.userChurches)) {
|
|
19
|
-
console.log('Using userChurches from context');
|
|
20
|
-
UserHelper.userChurches = context.userChurches;
|
|
21
|
-
} else {
|
|
22
|
-
console.error('Cannot select church: no valid userChurches available');
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (churchId) {
|
|
28
|
-
UserHelper.userChurches.forEach(uc => {
|
|
29
|
-
if (uc.church.id === churchId) userChurch = uc;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
else if (keyName) UserHelper.userChurches.forEach(uc => { if (uc.church.subDomain === keyName) userChurch = uc; });
|
|
33
|
-
else userChurch = UserHelper.userChurches[0];
|
|
34
|
-
if (!userChurch) return;
|
|
35
|
-
else {
|
|
36
|
-
UserHelper.currentUserChurch = userChurch;
|
|
37
|
-
UserHelper.setupApiHelper(UserHelper.currentUserChurch);
|
|
38
|
-
// TODO - remove context code from here and perform the logic in the component itself.
|
|
39
|
-
if (context) {
|
|
40
|
-
if (context.userChurch !== null) UserHelper.churchChanged = true;
|
|
41
|
-
console.log('UserHelper.selectChurch - Setting userChurch in context:', userChurch);
|
|
42
|
-
context.setUserChurch(UserHelper.currentUserChurch);
|
|
43
|
-
|
|
44
|
-
// Also ensure user is still set in context
|
|
45
|
-
if (UserHelper.user && context.setUser) {
|
|
46
|
-
console.log('UserHelper.selectChurch - Ensuring user is set in context:', UserHelper.user);
|
|
47
|
-
context.setUser(UserHelper.user);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Update person if available
|
|
51
|
-
if (UserHelper.person && context.setPerson) {
|
|
52
|
-
console.log('UserHelper.selectChurch - Ensuring person is set in context:', UserHelper.person);
|
|
53
|
-
context.setPerson(UserHelper.person);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
static setupApiHelper(userChurch: LoginUserChurchInterface) {
|
|
60
|
-
ApiHelper.setDefaultPermissions(userChurch.jwt);
|
|
61
|
-
userChurch.apis.forEach(api => { ApiHelper.setPermissions(api.keyName, api.jwt, api.permissions); });
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
static setupApiHelperNoChurch(user: LoginUserChurchInterface) {
|
|
65
|
-
ApiHelper.setDefaultPermissions(user.jwt);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
static checkAccess({ api, contentType, action }: IApiPermission): boolean {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
1
|
+
import { ApiHelper } from "@churchapps/helpers"
|
|
2
|
+
import { UserInterface, UserContextInterface, IApiPermission, PersonInterface, LoginUserChurchInterface } from "@churchapps/helpers";
|
|
3
|
+
|
|
4
|
+
export class UserHelper {
|
|
5
|
+
static currentUserChurch: LoginUserChurchInterface;
|
|
6
|
+
static userChurches: LoginUserChurchInterface[];
|
|
7
|
+
static user: UserInterface;
|
|
8
|
+
static churchChanged: boolean = false;
|
|
9
|
+
static person: PersonInterface;
|
|
10
|
+
|
|
11
|
+
static selectChurch = async (context?: UserContextInterface, churchId?: string, keyName?: string) => {
|
|
12
|
+
let userChurch = null;
|
|
13
|
+
|
|
14
|
+
// Ensure userChurches is initialized
|
|
15
|
+
if (!UserHelper.userChurches || !Array.isArray(UserHelper.userChurches)) {
|
|
16
|
+
console.error('UserHelper.userChurches is not initialized or not an array:', UserHelper.userChurches);
|
|
17
|
+
// Try to get userChurches from context if available
|
|
18
|
+
if (context?.userChurches && Array.isArray(context.userChurches)) {
|
|
19
|
+
console.log('Using userChurches from context');
|
|
20
|
+
UserHelper.userChurches = context.userChurches;
|
|
21
|
+
} else {
|
|
22
|
+
console.error('Cannot select church: no valid userChurches available');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (churchId) {
|
|
28
|
+
UserHelper.userChurches.forEach(uc => {
|
|
29
|
+
if (uc.church.id === churchId) userChurch = uc;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
else if (keyName) UserHelper.userChurches.forEach(uc => { if (uc.church.subDomain === keyName) userChurch = uc; });
|
|
33
|
+
else userChurch = UserHelper.userChurches[0];
|
|
34
|
+
if (!userChurch) return;
|
|
35
|
+
else {
|
|
36
|
+
UserHelper.currentUserChurch = userChurch;
|
|
37
|
+
UserHelper.setupApiHelper(UserHelper.currentUserChurch);
|
|
38
|
+
// TODO - remove context code from here and perform the logic in the component itself.
|
|
39
|
+
if (context) {
|
|
40
|
+
if (context.userChurch !== null) UserHelper.churchChanged = true;
|
|
41
|
+
console.log('UserHelper.selectChurch - Setting userChurch in context:', userChurch);
|
|
42
|
+
context.setUserChurch(UserHelper.currentUserChurch);
|
|
43
|
+
|
|
44
|
+
// Also ensure user is still set in context
|
|
45
|
+
if (UserHelper.user && context.setUser) {
|
|
46
|
+
console.log('UserHelper.selectChurch - Ensuring user is set in context:', UserHelper.user);
|
|
47
|
+
context.setUser(UserHelper.user);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Update person if available
|
|
51
|
+
if (UserHelper.person && context.setPerson) {
|
|
52
|
+
console.log('UserHelper.selectChurch - Ensuring person is set in context:', UserHelper.person);
|
|
53
|
+
context.setPerson(UserHelper.person);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static setupApiHelper(userChurch: LoginUserChurchInterface) {
|
|
60
|
+
ApiHelper.setDefaultPermissions(userChurch.jwt);
|
|
61
|
+
userChurch.apis.forEach(api => { ApiHelper.setPermissions(api.keyName, api.jwt, api.permissions); });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static setupApiHelperNoChurch(user: LoginUserChurchInterface) {
|
|
65
|
+
ApiHelper.setDefaultPermissions(user.jwt);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static checkAccess({ api, contentType, action }: IApiPermission): boolean {
|
|
69
|
+
const config = ApiHelper.getConfig(api);
|
|
70
|
+
if (!config) return false;
|
|
71
|
+
|
|
72
|
+
const permissions = config.permissions || [];
|
|
73
|
+
|
|
74
|
+
let result = false;
|
|
75
|
+
if (permissions !== undefined) {
|
|
76
|
+
permissions.forEach((element: any) => {
|
|
77
|
+
if (element.contentType === contentType && element.action === action) result = true;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
static createAppUrl(appUrl: string, returnUrl: string) {
|
|
84
|
+
const jwt = ApiHelper.getConfig("MembershipApi")?.jwt;
|
|
85
|
+
|
|
86
|
+
if (jwt) {
|
|
87
|
+
return `${appUrl}/login/?jwt=${jwt}&returnUrl=${encodeURIComponent(returnUrl)}`;
|
|
88
|
+
} else {
|
|
89
|
+
return `${appUrl}/login/?returnUrl=${encodeURIComponent(returnUrl)}`;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static redirectToLogin(returnUrl?: string, handleRedirect?: (url: string) => void) {
|
|
94
|
+
if (typeof window !== "undefined") {
|
|
95
|
+
const currentUrl = returnUrl || window.location.pathname + window.location.search;
|
|
96
|
+
const encodedReturnUrl = encodeURIComponent(currentUrl);
|
|
97
|
+
const loginUrl = `/login?returnUrl=${encodedReturnUrl}`;
|
|
98
|
+
|
|
99
|
+
// Use handleRedirect function if available, otherwise fallback to window.location
|
|
100
|
+
if (handleRedirect) {
|
|
101
|
+
handleRedirect(loginUrl);
|
|
102
|
+
} else {
|
|
103
|
+
window.location.href = loginUrl;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import createCache from "@emotion/cache";
|
|
2
|
-
|
|
3
|
-
const isBrowser = typeof document !== "undefined";
|
|
4
|
-
|
|
5
|
-
// On the client side, Create a meta tag at the top of the <head> and set it as insertionPoint.
|
|
6
|
-
// This assures that MUI styles are loaded first.
|
|
7
|
-
// It allows developers to easily override MUI styles with other styling solutions, like CSS modules.
|
|
8
|
-
export function createEmotionCache() {
|
|
9
|
-
let insertionPoint;
|
|
10
|
-
|
|
11
|
-
if (isBrowser) {
|
|
12
|
-
const emotionInsertionPoint = document.querySelector<HTMLMetaElement>('meta[name="emotion-insertion-point"]');
|
|
13
|
-
insertionPoint = emotionInsertionPoint ?? undefined;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return createCache({ key: "mui-style", insertionPoint });
|
|
17
|
-
}
|
|
1
|
+
import createCache from "@emotion/cache";
|
|
2
|
+
|
|
3
|
+
const isBrowser = typeof document !== "undefined";
|
|
4
|
+
|
|
5
|
+
// On the client side, Create a meta tag at the top of the <head> and set it as insertionPoint.
|
|
6
|
+
// This assures that MUI styles are loaded first.
|
|
7
|
+
// It allows developers to easily override MUI styles with other styling solutions, like CSS modules.
|
|
8
|
+
export function createEmotionCache() {
|
|
9
|
+
let insertionPoint;
|
|
10
|
+
|
|
11
|
+
if (isBrowser) {
|
|
12
|
+
const emotionInsertionPoint = document.querySelector<HTMLMetaElement>('meta[name="emotion-insertion-point"]');
|
|
13
|
+
insertionPoint = emotionInsertionPoint ?? undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return createCache({ key: "mui-style", insertionPoint });
|
|
17
|
+
}
|
package/src/helpers/index.ts
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
// Re-export helpers from @churchapps/helpers
|
|
2
|
-
export {
|
|
3
|
-
ApiHelper,
|
|
4
|
-
AppearanceHelper as BaseAppearanceHelper,
|
|
5
|
-
ArrayHelper,
|
|
6
|
-
CommonEnvironmentHelper,
|
|
7
|
-
CurrencyHelper,
|
|
8
|
-
DateHelper,
|
|
9
|
-
ErrorHelper,
|
|
10
|
-
EventHelper,
|
|
11
|
-
FileHelper,
|
|
12
|
-
PersonHelper,
|
|
13
|
-
UserHelper,
|
|
14
|
-
UniqueIdHelper,
|
|
15
|
-
Permissions
|
|
16
|
-
} from "@churchapps/helpers";
|
|
17
|
-
|
|
18
|
-
// Re-export interfaces from @churchapps/helpers
|
|
19
|
-
export type {
|
|
20
|
-
ErrorLogInterface,
|
|
21
|
-
UserContextInterface,
|
|
22
|
-
PermissionInterface,
|
|
23
|
-
ChurchInterface,
|
|
24
|
-
PersonInterface,
|
|
25
|
-
UserInterface,
|
|
26
|
-
LoginUserChurchInterface,
|
|
27
|
-
ContactInfoInterface,
|
|
28
|
-
DonationInterface,
|
|
29
|
-
FundInterface,
|
|
30
|
-
PaymentMethodInterface,
|
|
31
|
-
StripeDonationInterface,
|
|
32
|
-
FundDonationInterface,
|
|
33
|
-
ResetPasswordRequestInterface,
|
|
34
|
-
ResetPasswordResponseInterface,
|
|
35
|
-
ConnectionInterface,
|
|
36
|
-
SocketActionHandlerInterface,
|
|
37
|
-
SocketPayloadInterface,
|
|
38
|
-
UserChurchInterface,
|
|
39
|
-
QuestionInterface,
|
|
40
|
-
AnswerInterface,
|
|
41
|
-
FormSubmissionInterface,
|
|
42
|
-
MessageInterface,
|
|
43
|
-
ConversationInterface,
|
|
44
|
-
PrivateMessageInterface,
|
|
45
|
-
IApiPermission,
|
|
46
|
-
NotificationInterface
|
|
47
|
-
} from "@churchapps/helpers";
|
|
48
|
-
|
|
49
|
-
// Export local helpers
|
|
50
|
-
export { AnalyticsHelper } from "./AnalyticsHelper";
|
|
51
|
-
export { AppearanceHelper } from "./AppearanceHelper";
|
|
52
|
-
export type { AppearanceInterface } from "./AppearanceHelper";
|
|
53
|
-
export { createEmotionCache } from "./createEmotionCache";
|
|
54
|
-
export { Locale } from "./Locale";
|
|
55
|
-
export { SlugHelper } from "./SlugHelper";
|
|
56
|
-
export { SocketHelper } from "./SocketHelper";
|
|
57
|
-
export { NotificationService } from "./NotificationService";
|
|
58
|
-
export type { NotificationCounts } from "./NotificationService";
|
|
1
|
+
// Re-export helpers from @churchapps/helpers
|
|
2
|
+
export {
|
|
3
|
+
ApiHelper,
|
|
4
|
+
AppearanceHelper as BaseAppearanceHelper,
|
|
5
|
+
ArrayHelper,
|
|
6
|
+
CommonEnvironmentHelper,
|
|
7
|
+
CurrencyHelper,
|
|
8
|
+
DateHelper,
|
|
9
|
+
ErrorHelper,
|
|
10
|
+
EventHelper,
|
|
11
|
+
FileHelper,
|
|
12
|
+
PersonHelper,
|
|
13
|
+
UserHelper,
|
|
14
|
+
UniqueIdHelper,
|
|
15
|
+
Permissions
|
|
16
|
+
} from "@churchapps/helpers";
|
|
17
|
+
|
|
18
|
+
// Re-export interfaces from @churchapps/helpers
|
|
19
|
+
export type {
|
|
20
|
+
ErrorLogInterface,
|
|
21
|
+
UserContextInterface,
|
|
22
|
+
PermissionInterface,
|
|
23
|
+
ChurchInterface,
|
|
24
|
+
PersonInterface,
|
|
25
|
+
UserInterface,
|
|
26
|
+
LoginUserChurchInterface,
|
|
27
|
+
ContactInfoInterface,
|
|
28
|
+
DonationInterface,
|
|
29
|
+
FundInterface,
|
|
30
|
+
PaymentMethodInterface,
|
|
31
|
+
StripeDonationInterface,
|
|
32
|
+
FundDonationInterface,
|
|
33
|
+
ResetPasswordRequestInterface,
|
|
34
|
+
ResetPasswordResponseInterface,
|
|
35
|
+
ConnectionInterface,
|
|
36
|
+
SocketActionHandlerInterface,
|
|
37
|
+
SocketPayloadInterface,
|
|
38
|
+
UserChurchInterface,
|
|
39
|
+
QuestionInterface,
|
|
40
|
+
AnswerInterface,
|
|
41
|
+
FormSubmissionInterface,
|
|
42
|
+
MessageInterface,
|
|
43
|
+
ConversationInterface,
|
|
44
|
+
PrivateMessageInterface,
|
|
45
|
+
IApiPermission,
|
|
46
|
+
NotificationInterface
|
|
47
|
+
} from "@churchapps/helpers";
|
|
48
|
+
|
|
49
|
+
// Export local helpers
|
|
50
|
+
export { AnalyticsHelper } from "./AnalyticsHelper";
|
|
51
|
+
export { AppearanceHelper } from "./AppearanceHelper";
|
|
52
|
+
export type { AppearanceInterface } from "./AppearanceHelper";
|
|
53
|
+
export { createEmotionCache } from "./createEmotionCache";
|
|
54
|
+
export { Locale } from "./Locale";
|
|
55
|
+
export { SlugHelper } from "./SlugHelper";
|
|
56
|
+
export { SocketHelper } from "./SocketHelper";
|
|
57
|
+
export { NotificationService } from "./NotificationService";
|
|
58
|
+
export type { NotificationCounts } from "./NotificationService";
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { useMountedState } from "./useMountedState";
|
|
2
|
-
export { useNotifications } from "./useNotifications";
|
|
3
|
-
export type { UseNotificationsResult } from "./useNotifications";
|
|
1
|
+
export { useMountedState } from "./useMountedState";
|
|
2
|
+
export { useNotifications } from "./useNotifications";
|
|
3
|
+
export type { UseNotificationsResult } from "./useNotifications";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { useEffect, useRef, useCallback } from "react";
|
|
2
|
-
|
|
3
|
-
export const useMountedState = () => {
|
|
4
|
-
const mountedRef = useRef(false)
|
|
5
|
-
const isMounted = useCallback(() => mountedRef.current, [])
|
|
6
|
-
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
mountedRef.current = true
|
|
9
|
-
|
|
10
|
-
return () => {
|
|
11
|
-
mountedRef.current = false
|
|
12
|
-
}
|
|
13
|
-
}, [])
|
|
14
|
-
|
|
15
|
-
return isMounted
|
|
16
|
-
}
|
|
1
|
+
import { useEffect, useRef, useCallback } from "react";
|
|
2
|
+
|
|
3
|
+
export const useMountedState = () => {
|
|
4
|
+
const mountedRef = useRef(false)
|
|
5
|
+
const isMounted = useCallback(() => mountedRef.current, [])
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
mountedRef.current = true
|
|
9
|
+
|
|
10
|
+
return () => {
|
|
11
|
+
mountedRef.current = false
|
|
12
|
+
}
|
|
13
|
+
}, [])
|
|
14
|
+
|
|
15
|
+
return isMounted
|
|
16
|
+
}
|