@churchapps/apphelper-login 0.5.0 → 0.5.5

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.
@@ -1,114 +1,114 @@
1
- "use client";
2
-
3
- import { Grid, Paper, Box, Typography } from "@mui/material";
4
- import React from "react";
5
- import { ArrayHelper } from "@churchapps/helpers";
6
- import { ChurchInterface, GenericSettingInterface } from "@churchapps/helpers";
7
- import { LocationOn, Church } from "@mui/icons-material";
8
-
9
- interface Props {
10
- selectChurch: (churchId: string) => void,
11
- church: ChurchInterface
12
- }
13
-
14
- export const SelectableChurch: React.FC<Props> = (props) => {
15
-
16
- let logo: string | null = null;
17
- if (props.church.settings) {
18
- let l: GenericSettingInterface = ArrayHelper.getOne(props.church.settings, "keyName", "logoLight");
19
- if (l?.value) logo = l.value;
20
- }
21
- return (
22
- <Paper
23
- elevation={0}
24
- sx={{
25
- p: 1,
26
- mb: 0.75,
27
- cursor: "pointer",
28
- transition: "all 0.2s ease",
29
- border: "1px solid transparent",
30
- borderRadius: 2,
31
- "&:hover": {
32
- borderColor: "primary.main",
33
- boxShadow: 2,
34
- transform: "translateY(-2px)"
35
- }
36
- }}
37
- onClick={() => props.selectChurch(props.church.id)}
38
- >
39
- <Grid container spacing={2} alignItems="center">
40
- <Grid size={{ xs: 12, sm: 5, md: 5 }}>
41
- <Box
42
- sx={{
43
- display: "flex",
44
- justifyContent: "center",
45
- alignItems: "center",
46
- height: { xs: 60, sm: 80 },
47
- p: 0.5
48
- }}
49
- >
50
- {logo ? (
51
- <img
52
- src={logo}
53
- alt={`${props.church.name} logo`}
54
- style={{
55
- width: "100%",
56
- height: "100%",
57
- objectFit: "contain"
58
- }}
59
- />
60
- ) : (
61
- <Box
62
- sx={{
63
- display: "flex",
64
- alignItems: "center",
65
- justifyContent: "center",
66
- width: "100%",
67
- height: "100%",
68
- backgroundColor: "grey.100",
69
- borderRadius: 2
70
- }}
71
- >
72
- <Church sx={{ fontSize: { xs: 40, sm: 50 }, color: "grey.400" }} />
73
- </Box>
74
- )}
75
- </Box>
76
- </Grid>
77
- <Grid size={{ xs: 12, sm: 7, md: 7 }}>
78
- <Box>
79
- <Typography
80
- variant="h6"
81
- component="h3"
82
- sx={{
83
- color: "primary.main",
84
- fontWeight: 600,
85
- mb: 0.5
86
- }}
87
- >
88
- {props.church.name}
89
- </Typography>
90
- {(props.church.address1 || props.church.city || props.church.state) && (
91
- <Box sx={{ display: "flex", alignItems: "flex-start", color: "text.secondary" }}>
92
- <LocationOn sx={{ fontSize: 18, mr: 0.5, mt: 0.3 }} />
93
- <Box>
94
- {props.church.address1 && (
95
- <Typography variant="body2">
96
- {props.church.address1}
97
- </Typography>
98
- )}
99
- {(props.church.city || props.church.state) && (
100
- <Typography variant="body2">
101
- {props.church.city && props.church.city}
102
- {props.church.city && props.church.state && ", "}
103
- {props.church.state}
104
- </Typography>
105
- )}
106
- </Box>
107
- </Box>
108
- )}
109
- </Box>
110
- </Grid>
111
- </Grid>
112
- </Paper>
113
- );
114
- };
1
+ "use client";
2
+
3
+ import { Grid, Paper, Box, Typography } from "@mui/material";
4
+ import React from "react";
5
+ import { ArrayHelper } from "@churchapps/helpers";
6
+ import { ChurchInterface, GenericSettingInterface } from "@churchapps/helpers";
7
+ import { LocationOn, Church } from "@mui/icons-material";
8
+
9
+ interface Props {
10
+ selectChurch: (churchId: string) => void,
11
+ church: ChurchInterface
12
+ }
13
+
14
+ export const SelectableChurch: React.FC<Props> = (props) => {
15
+
16
+ let logo: string | null = null;
17
+ if (props.church.settings) {
18
+ let l: GenericSettingInterface = ArrayHelper.getOne(props.church.settings, "keyName", "logoLight");
19
+ if (l?.value) logo = l.value;
20
+ }
21
+ return (
22
+ <Paper
23
+ elevation={0}
24
+ sx={{
25
+ p: 1,
26
+ mb: 0.75,
27
+ cursor: "pointer",
28
+ transition: "all 0.2s ease",
29
+ border: "1px solid transparent",
30
+ borderRadius: 2,
31
+ "&:hover": {
32
+ borderColor: "primary.main",
33
+ boxShadow: 2,
34
+ transform: "translateY(-2px)"
35
+ }
36
+ }}
37
+ onClick={() => props.selectChurch(props.church.id)}
38
+ >
39
+ <Grid container spacing={2} alignItems="center">
40
+ <Grid size={{ xs: 12, sm: 5, md: 5 }}>
41
+ <Box
42
+ sx={{
43
+ display: "flex",
44
+ justifyContent: "center",
45
+ alignItems: "center",
46
+ height: { xs: 60, sm: 80 },
47
+ p: 0.5
48
+ }}
49
+ >
50
+ {logo ? (
51
+ <img
52
+ src={logo}
53
+ alt={`${props.church.name} logo`}
54
+ style={{
55
+ width: "100%",
56
+ height: "100%",
57
+ objectFit: "contain"
58
+ }}
59
+ />
60
+ ) : (
61
+ <Box
62
+ sx={{
63
+ display: "flex",
64
+ alignItems: "center",
65
+ justifyContent: "center",
66
+ width: "100%",
67
+ height: "100%",
68
+ backgroundColor: "grey.100",
69
+ borderRadius: 2
70
+ }}
71
+ >
72
+ <Church sx={{ fontSize: { xs: 40, sm: 50 }, color: "grey.400" }} />
73
+ </Box>
74
+ )}
75
+ </Box>
76
+ </Grid>
77
+ <Grid size={{ xs: 12, sm: 7, md: 7 }}>
78
+ <Box>
79
+ <Typography
80
+ variant="h6"
81
+ component="h3"
82
+ sx={{
83
+ color: "primary.main",
84
+ fontWeight: 600,
85
+ mb: 0.5
86
+ }}
87
+ >
88
+ {props.church.name}
89
+ </Typography>
90
+ {(props.church.address1 || props.church.city || props.church.state) && (
91
+ <Box sx={{ display: "flex", alignItems: "flex-start", color: "text.secondary" }}>
92
+ <LocationOn sx={{ fontSize: 18, mr: 0.5, mt: 0.3 }} />
93
+ <Box>
94
+ {props.church.address1 && (
95
+ <Typography variant="body2">
96
+ {props.church.address1}
97
+ </Typography>
98
+ )}
99
+ {(props.church.city || props.church.state) && (
100
+ <Typography variant="body2">
101
+ {props.church.city && props.church.city}
102
+ {props.church.city && props.church.state && ", "}
103
+ {props.church.state}
104
+ </Typography>
105
+ )}
106
+ </Box>
107
+ </Box>
108
+ )}
109
+ </Box>
110
+ </Grid>
111
+ </Grid>
112
+ </Paper>
113
+ );
114
+ };
@@ -1,32 +1,44 @@
1
- import ReactGA from "react-ga4";
2
- import { CommonEnvironmentHelper, UserHelper } from "@churchapps/helpers";
3
-
4
- export class AnalyticsHelper {
5
-
6
- static init = () => {
7
- if (CommonEnvironmentHelper.GoogleAnalyticsTag !== "" && typeof(window)!=="undefined") {
8
- ReactGA.initialize([{trackingId: CommonEnvironmentHelper.GoogleAnalyticsTag}]);
9
- AnalyticsHelper.logPageView();
10
- }
11
- }
12
-
13
- static logPageView = () => {
14
- if (CommonEnvironmentHelper.GoogleAnalyticsTag !== "" && typeof(window)!=="undefined") {
15
- this.setChurchKey();
16
- ReactGA.send({ hitType: "pageview", page: window.location.pathname + window.location.search });
17
- }
18
- }
19
-
20
- static logEvent = (category: string, action: string, label?:string) => {
21
- if (CommonEnvironmentHelper.GoogleAnalyticsTag !== "" && typeof(window)!=="undefined") {
22
- this.setChurchKey();
23
- ReactGA.event({ category, action, label });
24
- }
25
- }
26
-
27
- private static setChurchKey = () => {
28
- const churchKey = UserHelper?.currentUserChurch?.church?.subDomain;
29
- if (churchKey) ReactGA.set({church_key: churchKey });
30
- }
31
-
32
- }
1
+ import ReactGA from "react-ga4";
2
+ import { CommonEnvironmentHelper, UserHelper } from "@churchapps/helpers";
3
+
4
+ export class AnalyticsHelper {
5
+
6
+ static init = () => {
7
+ if (CommonEnvironmentHelper.GoogleAnalyticsTag !== "" && typeof(window)!=="undefined") {
8
+ try {
9
+ ReactGA.initialize([{trackingId: CommonEnvironmentHelper.GoogleAnalyticsTag}]);
10
+ AnalyticsHelper.logPageView();
11
+ } catch (error) {
12
+ console.warn('Analytics initialization failed:', error);
13
+ }
14
+ }
15
+ }
16
+
17
+ static logPageView = () => {
18
+ if (CommonEnvironmentHelper.GoogleAnalyticsTag !== "" && typeof(window)!=="undefined") {
19
+ try {
20
+ this.setChurchKey();
21
+ ReactGA.send({ hitType: "pageview", page: window.location.pathname + window.location.search });
22
+ } catch (error) {
23
+ console.warn('Analytics page view logging failed:', error);
24
+ }
25
+ }
26
+ }
27
+
28
+ static logEvent = (category: string, action: string, label?:string) => {
29
+ if (CommonEnvironmentHelper.GoogleAnalyticsTag !== "" && typeof(window)!=="undefined") {
30
+ try {
31
+ this.setChurchKey();
32
+ ReactGA.event({ category, action, label });
33
+ } catch (error) {
34
+ console.warn('Analytics event logging failed:', error);
35
+ }
36
+ }
37
+ }
38
+
39
+ private static setChurchKey = () => {
40
+ const churchKey = UserHelper?.currentUserChurch?.church?.subDomain;
41
+ if (churchKey) ReactGA.set({church_key: churchKey });
42
+ }
43
+
44
+ }