@churchapps/apphelper 0.2.77 → 0.2.79

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,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- export declare const OpenDrawer: import("@emotion/styled").StyledComponent<import("@mui/material").DrawerProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
3
- export declare const ClosedDrawer: import("@emotion/styled").StyledComponent<import("@mui/material").DrawerProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
2
+ export declare const OpenDrawer: (styles: any) => import("@emotion/styled").StyledComponent<import("@mui/material").DrawerProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
3
+ export declare const ClosedDrawer: (styles: any) => import("@emotion/styled").StyledComponent<import("@mui/material").DrawerProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
4
4
  export declare const ClosedDrawerAppBar: import("@emotion/styled").StyledComponent<{
5
5
  classes?: Partial<import("@mui/material").AppBarClasses>;
6
6
  color?: import("@mui/types").OverridableStringUnion<"transparent" | import("@mui/material").PropTypes.Color, import("@mui/material").AppBarPropsColorOverrides>;
@@ -1 +1 @@
1
- {"version":3,"file":"Drawers.d.ts","sourceRoot":"","sources":["../../../src/components/wrapper/Drawers.tsx"],"names":[],"mappings":";AAIA,eAAO,MAAM,UAAU,oKAkBtB,CAAC;AAEF,eAAO,MAAM,YAAY,oKAcxB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;6PAS9B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;6PAS5B,CAAC"}
1
+ {"version":3,"file":"Drawers.d.ts","sourceRoot":"","sources":["../../../src/components/wrapper/Drawers.tsx"],"names":[],"mappings":";AAIA,eAAO,MAAM,UAAU,WAAW,GAAG,uKAkBpC,CAAC;AAEF,eAAO,MAAM,YAAY,WAAW,GAAG,uKActC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;6PAS9B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;6PAS5B,CAAC"}
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.OpenDrawerAppBar = exports.ClosedDrawerAppBar = exports.ClosedDrawer = exports.OpenDrawer = void 0;
5
5
  const material_1 = require("@mui/material");
6
- exports.OpenDrawer = (0, material_1.styled)(material_1.Drawer)(({ theme }) => ({
6
+ const OpenDrawer = (styles) => (0, material_1.styled)(material_1.Drawer)(({ theme }) => ({
7
7
  "& .MuiDrawer-paper": {
8
8
  position: "relative",
9
- backgroundColor: theme.palette.primary.main,
9
+ backgroundColor: styles.backgroundColor || theme.palette.primary.main,
10
10
  color: "#FFFFFF",
11
11
  whiteSpace: "nowrap",
12
12
  width: "100vw",
@@ -20,7 +20,8 @@ exports.OpenDrawer = (0, material_1.styled)(material_1.Drawer)(({ theme }) => ({
20
20
  },
21
21
  "& .MuiListItemButton-root, & .MuiListItemIcon-root": { color: "#FFFFFF" }
22
22
  }));
23
- exports.ClosedDrawer = (0, material_1.styled)(exports.OpenDrawer)(({ theme }) => ({
23
+ exports.OpenDrawer = OpenDrawer;
24
+ const ClosedDrawer = (styles) => (0, material_1.styled)((0, exports.OpenDrawer)(styles))(({ theme }) => ({
24
25
  overflowX: "hidden",
25
26
  transition: theme.transitions.create("width", {
26
27
  easing: theme.transitions.easing.sharp,
@@ -33,6 +34,7 @@ exports.ClosedDrawer = (0, material_1.styled)(exports.OpenDrawer)(({ theme }) =>
33
34
  opacity: 0
34
35
  }
35
36
  }));
37
+ exports.ClosedDrawer = ClosedDrawer;
36
38
  exports.ClosedDrawerAppBar = (0, material_1.styled)(material_1.AppBar)(({ theme }) => ({
37
39
  zIndex: theme.zIndex.drawer + 1,
38
40
  transition: theme.transitions.create(["width", "margin"], {
@@ -1 +1 @@
1
- {"version":3,"file":"Drawers.js","sourceRoot":"","sources":["../../../src/components/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CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;IACzD,0BAA0B,EAAE;QAC1B,OAAO,EAAE,CAAC;KACX;CACF,CAAC,CACH,CAAC;AAdW,QAAA,YAAY,gBAcvB;AAEW,QAAA,kBAAkB,GAAG,IAAA,iBAAM,EAAC,iBAAM,CAAC,CAC9C,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IACd,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;IAC/B,UAAU,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;QACxD,MAAM,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK;QACtC,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa;KACnD,CAAC;IACF,iBAAiB,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;CACxC,CAAC,CACH,CAAC;AAEW,QAAA,gBAAgB,GAAG,IAAA,iBAAM,EAAC,0BAAkB,CAAC,CACxD,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IACd,UAAU,EAAE,GAAG;IACf,KAAK,EAAE,eAAe,GAAG,KAAK;IAC9B,UAAU,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;QACxD,MAAM,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK;QACtC,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc;KACpD,CAAC;CACH,CAAC,CACH,CAAC"}
@@ -28,7 +28,7 @@ const SiteWrapper = props => {
28
28
  const [notificationCounts, setNotificationCounts] = react_1.default.useState({ notificationCount: 0, pmCount: 0 });
29
29
  const toggleDrawer = () => { setOpen(!open); };
30
30
  const isMounted = (0, useMountedState_1.useMountedState)();
31
- const CustomDrawer = (open) ? Drawers_1.OpenDrawer : Drawers_1.ClosedDrawer;
31
+ const CustomDrawer = (open) ? (0, Drawers_1.OpenDrawer)({ backgroundColor: props.appearance.wrapperBackground }) : (0, Drawers_1.ClosedDrawer)({ backgroundColor: props.appearance.wrapperBackground });
32
32
  const CustomAppBar = (open) ? Drawers_1.OpenDrawerAppBar : Drawers_1.ClosedDrawerAppBar;
33
33
  const loadCounts = () => {
34
34
  helpers_1.ApiHelper.get("/notifications/unreadCount", "MessagingApi").then(data => {
@@ -1 +1 @@
1
- {"version":3,"file":"SiteWrapper.js","sourceRoot":"","sources":["../../../src/components/wrapper/SiteWrapper.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;AAEb,kDAA6C;AAC7C,4CAA4F;AAC5F,2CAA2G;AAC3G,yCAAsC;AAEtC,iEAA8D;AAC9D,6DAA0D;AAC1D,uCAA2F;AAYpF,MAAM,WAAW,GAAoB,KAAK,CAAC,EAAE;;IAClD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,eAAK,CAAC,QAAQ,EAAU,CAAC;IAC7D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAC,EAAC,iBAAiB,EAAC,CAAC,EAAE,OAAO,EAAC,CAAC,EAAC,CAAC,CAAC;IACrG,MAAM,YAAY,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,IAAA,iCAAe,GAAE,CAAC;IAEpC,MAAM,YAAY,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,oBAAU,CAAC,CAAC,CAAC,sB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AAC,WAAW,EAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;YACjL,8BAAC,kBAAO,IAAC,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE;gBAC5E,uCAAK,GAAG,EAAE,UAAU,IAAI,0BAA0B,EAAE,GAAG,EAAC,MAAM,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAI;gBAC3F,uCAAK,KAAK,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE;oBAClE,8BAAC,qBAAU,IAAC,OAAO,EAAE,YAAY;wBAAE,8BAAC,eAAI,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,mBAAqB,CAAa,CAClG,CACE;YACT,KAAK,CAAC,UAAU,CACJ;QACf,8BAAC,cAAG,IAAC,SAAS,EAAC,MAAM,EAAC,EAAE,EAAE,QAAQ;YAChC,8BAAC,oBAAS,IAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAC7C,KAAK,CAAC,QAAQ,CACL,CACR,CACL,CAAA;AACL,CAAC,CAAC;AAhFW,QAAA,WAAW,eAgFtB"}
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { ChurchInterface } from "@churchapps/helpers";
3
+ interface Props {
4
+ personId: string;
5
+ appName?: string;
6
+ church?: ChurchInterface;
7
+ churchLogo?: string;
8
+ }
9
+ export declare const DonationPage: React.FC<Props>;
10
+ export {};
11
+ //# sourceMappingURL=DonationPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DonationPage.d.ts","sourceRoot":"","sources":["../../src/donationComponents/DonationPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAA2D,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAK/G,UAAU,KAAK;IAAG,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE;AAErG,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA8KxC,CAAA"}
@@ -0,0 +1,166 @@
1
+ "use client";
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.DonationPage = void 0;
8
+ const react_1 = __importDefault(require("react"));
9
+ const stripe_js_1 = require("@stripe/stripe-js");
10
+ const components_1 = require("./components");
11
+ const components_2 = require("../components");
12
+ const helpers_1 = require("../helpers");
13
+ const helpers_2 = require("@churchapps/helpers");
14
+ const react_router_dom_1 = require("react-router-dom");
15
+ const material_1 = require("@mui/material");
16
+ const useMountedState_1 = require("../hooks/useMountedState");
17
+ const DonationPage = (props) => {
18
+ const [donations, setDonations] = react_1.default.useState(null);
19
+ const [stripePromise, setStripe] = react_1.default.useState(null);
20
+ const [paymentMethods, setPaymentMethods] = react_1.default.useState(null);
21
+ const [customerId, setCustomerId] = react_1.default.useState(null);
22
+ const [person, setPerson] = react_1.default.useState(null);
23
+ const [message, setMessage] = react_1.default.useState(null);
24
+ const [appName, setAppName] = react_1.default.useState("");
25
+ const [anchorEl, setAnchorEl] = react_1.default.useState(null);
26
+ const open = Boolean(anchorEl);
27
+ const isMounted = (0, useMountedState_1.useMountedState)();
28
+ const handleClose = () => {
29
+ setAnchorEl(null);
30
+ };
31
+ const loadData = () => {
32
+ if (props === null || props === void 0 ? void 0 : props.appName)
33
+ setAppName(props.appName);
34
+ if (!helpers_1.UniqueIdHelper.isMissing(props.personId)) {
35
+ helpers_1.ApiHelper.get("/donations?personId=" + props.personId, "GivingApi").then(data => {
36
+ if (isMounted()) {
37
+ setDonations(data);
38
+ }
39
+ });
40
+ helpers_1.ApiHelper.get("/gateways", "GivingApi").then(data => {
41
+ var _a;
42
+ if (data.length && ((_a = data[0]) === null || _a === void 0 ? void 0 : _a.publicKey)) {
43
+ if (isMounted()) {
44
+ setStripe((0, stripe_js_1.loadStripe)(data[0].publicKey));
45
+ }
46
+ helpers_1.ApiHelper.get("/paymentmethods/personid/" + props.personId, "GivingApi").then(results => {
47
+ if (!isMounted()) {
48
+ return;
49
+ }
50
+ if (!results.length)
51
+ setPaymentMethods([]);
52
+ else {
53
+ let cards = results[0].cards.data.map((card) => new helpers_2.StripePaymentMethod(card));
54
+ let banks = results[0].banks.data.map((bank) => new helpers_2.StripePaymentMethod(bank));
55
+ let methods = cards.concat(banks);
56
+ setCustomerId(results[0].customer.id);
57
+ setPaymentMethods(methods);
58
+ }
59
+ });
60
+ helpers_1.ApiHelper.get("/people/" + props.personId, "MembershipApi").then(data => {
61
+ if (isMounted()) {
62
+ setPerson(data);
63
+ }
64
+ });
65
+ }
66
+ else
67
+ setPaymentMethods([]);
68
+ });
69
+ }
70
+ };
71
+ const handleDataUpdate = (message) => {
72
+ setMessage(message);
73
+ setPaymentMethods(null);
74
+ loadData();
75
+ };
76
+ const getEditContent = () => {
77
+ const result = [];
78
+ const date = new Date();
79
+ const currentY = date.getFullYear();
80
+ const lastY = date.getFullYear() - 1;
81
+ const current_year = donations.filter(d => new Date(d.donationDate).getFullYear() === currentY);
82
+ const last_year = donations.filter(d => new Date(d.donationDate).getFullYear() === lastY);
83
+ const customHeaders = [
84
+ { label: "amount", key: "amount" },
85
+ { label: "donationDate", key: "donationDate" },
86
+ { label: "fundName", key: "fund.name" },
87
+ { label: "method", key: "method" },
88
+ { label: "methodDetails", key: "methodDetails" },
89
+ ];
90
+ result.push(react_1.default.createElement(react_1.default.Fragment, null,
91
+ react_1.default.createElement(material_1.Button, { id: "download-button", "aria-controls": open ? "download-menu" : undefined, "aria-haspopup": "true", "aria-expanded": open ? "true" : undefined, onClick: (e) => {
92
+ setAnchorEl(e.currentTarget);
93
+ } },
94
+ react_1.default.createElement(material_1.Icon, null, "download")),
95
+ react_1.default.createElement(material_1.Menu, { id: "download-menu", anchorEl: anchorEl, open: open, onClose: handleClose, MenuListProps: { 'aria-labelledby': "download-button" } },
96
+ react_1.default.createElement(material_1.MenuItem, { onClick: handleClose, dense: true },
97
+ react_1.default.createElement(components_2.ExportLink, { data: current_year, filename: "current_year_donations", customHeaders: customHeaders, text: "Current Year", icon: "csv" })),
98
+ react_1.default.createElement(material_1.MenuItem, { href: "/member/donate/print" },
99
+ react_1.default.createElement(material_1.Icon, null, "print"),
100
+ " Current Year"),
101
+ react_1.default.createElement(material_1.MenuItem, { onClick: handleClose, dense: true },
102
+ react_1.default.createElement(components_2.ExportLink, { data: last_year, filename: "last_year_donations", customHeaders: customHeaders, text: "Last Year", icon: "csv" })),
103
+ react_1.default.createElement(material_1.MenuItem, { href: "/member/donate/print?prev=1" },
104
+ react_1.default.createElement(material_1.Icon, null, "print"),
105
+ " Last Year"))));
106
+ return result;
107
+ };
108
+ const getRows = () => {
109
+ let rows = [];
110
+ if (donations.length === 0) {
111
+ rows.push(react_1.default.createElement(material_1.TableRow, { key: "0" },
112
+ react_1.default.createElement(material_1.TableCell, null, helpers_1.Locale.label("donation.page.willAppear"))));
113
+ return rows;
114
+ }
115
+ for (let i = 0; i < donations.length; i++) {
116
+ let d = donations[i];
117
+ rows.push(react_1.default.createElement(material_1.TableRow, { key: i },
118
+ appName !== "B1App" && react_1.default.createElement(material_1.TableCell, null,
119
+ react_1.default.createElement(react_router_dom_1.Link, { to: "/donations/" + d.batchId }, d.batchId)),
120
+ react_1.default.createElement(material_1.TableCell, null, helpers_1.DateHelper.prettyDate(new Date(d.donationDate))),
121
+ react_1.default.createElement(material_1.TableCell, null,
122
+ d.method,
123
+ " - ",
124
+ d.methodDetails),
125
+ react_1.default.createElement(material_1.TableCell, null, d.fund.name),
126
+ react_1.default.createElement(material_1.TableCell, null, helpers_1.CurrencyHelper.formatCurrency(d.fund.amount))));
127
+ }
128
+ return rows;
129
+ };
130
+ const getTableHeader = () => {
131
+ const rows = [];
132
+ if (donations.length > 0) {
133
+ rows.push(react_1.default.createElement(material_1.TableRow, { key: "header", sx: { textAlign: "left" } },
134
+ appName !== "B1App" && react_1.default.createElement("th", null, helpers_1.Locale.label("donation.page.batch")),
135
+ react_1.default.createElement("th", null, helpers_1.Locale.label("donation.page.date")),
136
+ react_1.default.createElement("th", null, helpers_1.Locale.label("donation.page.method")),
137
+ react_1.default.createElement("th", null, helpers_1.Locale.label("donation.page.fund")),
138
+ react_1.default.createElement("th", null, helpers_1.Locale.label("donation.page.amount"))));
139
+ }
140
+ return rows;
141
+ };
142
+ react_1.default.useEffect(loadData, [isMounted]); //eslint-disable-line
143
+ const getTable = () => {
144
+ if (!donations)
145
+ return react_1.default.createElement(components_2.Loading, null);
146
+ else
147
+ return (react_1.default.createElement(material_1.Table, null,
148
+ react_1.default.createElement(material_1.TableHead, null, getTableHeader()),
149
+ react_1.default.createElement(material_1.TableBody, null, getRows())));
150
+ };
151
+ const getPaymentMethodComponents = () => {
152
+ if (!paymentMethods)
153
+ return react_1.default.createElement(components_2.Loading, null);
154
+ else
155
+ return (react_1.default.createElement(react_1.default.Fragment, null,
156
+ react_1.default.createElement(components_1.DonationForm, { person: person, customerId: customerId, paymentMethods: paymentMethods, stripePromise: stripePromise, donationSuccess: handleDataUpdate, church: props === null || props === void 0 ? void 0 : props.church, churchLogo: props === null || props === void 0 ? void 0 : props.churchLogo }),
157
+ react_1.default.createElement(components_2.DisplayBox, { headerIcon: "payments", headerText: "Donations", editContent: getEditContent() }, getTable()),
158
+ react_1.default.createElement(components_1.RecurringDonations, { customerId: customerId, paymentMethods: paymentMethods, appName: appName, dataUpdate: handleDataUpdate }),
159
+ react_1.default.createElement(components_1.PaymentMethods, { person: person, customerId: customerId, paymentMethods: paymentMethods, appName: appName, stripePromise: stripePromise, dataUpdate: handleDataUpdate })));
160
+ };
161
+ return (react_1.default.createElement(react_1.default.Fragment, null,
162
+ paymentMethods && message && react_1.default.createElement(material_1.Alert, { severity: "success" }, message),
163
+ getPaymentMethodComponents()));
164
+ };
165
+ exports.DonationPage = DonationPage;
166
+ //# sourceMappingURL=DonationPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DonationPage.js","sourceRoot":"","sources":["../../src/donationComponents/DonationPage.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AAEb,kDAA0B;AAC1B,iDAAuD;AACvD,6CAAgF;AAChF,8CAAgE;AAChE,wCAA2F;AAC3F,iDAA+G;AAC/G,uDAAuC;AACvC,4CAAqH;AACrH,8DAA2D;AAIpD,MAAM,YAAY,GAAoB,CAAC,KAAK,EAAE,EAAE;IACrD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAsB,IAAI,CAAC,CAAC;IAC5E,MAAM,CAAC,aAAa,EAAE,SAAS,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAkB,IAAI,CAAC,CAAC;IACzE,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAwB,IAAI,CAAC,CAAC;IACxF,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACzD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAkB,IAAI,CAAC,CAAC;IAClE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAS,IAAI,CAAC,CAAC;IAC3D,MAAM,CA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CACJ,CAAC;IACJ,CAAC,CAAA;IAED,OAAO,CACL;QACG,cAAc,IAAI,OAAO,IAAI,8BAAC,gBAAK,IAAC,QAAQ,EAAC,SAAS,IAAE,OAAO,CAAS;QACxE,0BAA0B,EAAE,CAC5B,CACJ,CAAC;AACJ,CAAC,CAAA;AA9KY,QAAA,YAAY,gBA8KxB"}
@@ -1,3 +1,4 @@
1
1
  export { FundDonations } from "./components/FundDonations";
2
2
  export { NonAuthDonation } from "./components/NonAuthDonation";
3
+ export { DonationPage } from "./DonationPage";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/donationComponents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/donationComponents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NonAuthDonation = exports.FundDonations = void 0;
3
+ exports.DonationPage = exports.NonAuthDonation = exports.FundDonations = void 0;
4
4
  var FundDonations_1 = require("./components/FundDonations");
5
5
  Object.defineProperty(exports, "FundDonations", { enumerable: true, get: function () { return FundDonations_1.FundDonations; } });
6
6
  var NonAuthDonation_1 = require("./components/NonAuthDonation");
7
7
  Object.defineProperty(exports, "NonAuthDonation", { enumerable: true, get: function () { return NonAuthDonation_1.NonAuthDonation; } });
8
+ var DonationPage_1 = require("./DonationPage");
9
+ Object.defineProperty(exports, "DonationPage", { enumerable: true, get: function () { return DonationPage_1.DonationPage; } });
8
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/donationComponents/index.ts"],"names":[],"mappings":";;;AAAA,4DAA2D;AAAlD,8GAAA,aAAa,OAAA;AACtB,gEAA+D;AAAtD,kHAAA,eAAe,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/donationComponents/index.ts"],"names":[],"mappings":";;;AAAA,4DAA2D;AAAlD,8GAAA,aAAa,OAAA;AACtB,gEAA+D;AAAtD,kHAAA,eAAe,OAAA;AACxB,+CAA8C;AAArC,4GAAA,YAAY,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@churchapps/apphelper",
3
- "version": "0.2.77",
3
+ "version": "0.2.79",
4
4
  "description": "Library of helper functions for React and NextJS ChurchApps",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -2,11 +2,11 @@
2
2
 
3
3
  import { AppBar, Drawer, styled } from "@mui/material";
4
4
 
5
- export const OpenDrawer = styled(Drawer)(
5
+ export const OpenDrawer = (styles:any) => styled(Drawer)(
6
6
  ({ theme }) => ({
7
7
  "& .MuiDrawer-paper": {
8
8
  position: "relative",
9
- backgroundColor: theme.palette.primary.main,
9
+ backgroundColor: styles.backgroundColor || theme.palette.primary.main,
10
10
  color: "#FFFFFF",
11
11
  whiteSpace: "nowrap",
12
12
  width: "100vw",
@@ -22,7 +22,7 @@ export const OpenDrawer = styled(Drawer)(
22
22
  })
23
23
  );
24
24
 
25
- export const ClosedDrawer = styled(OpenDrawer)(
25
+ export const ClosedDrawer = (styles:any) => styled(OpenDrawer(styles))(
26
26
  ({ theme }) => ({
27
27
  overflowX: "hidden",
28
28
  transition: theme.transitions.create("width", {
@@ -26,7 +26,7 @@ export const SiteWrapper: React.FC<Props> = props => {
26
26
  const toggleDrawer = () => { setOpen(!open); };
27
27
  const isMounted = useMountedState();
28
28
 
29
- const CustomDrawer = (open) ? OpenDrawer : ClosedDrawer;
29
+ const CustomDrawer = (open) ? OpenDrawer({backgroundColor:props.appearance.wrapperBackground}) : ClosedDrawer({backgroundColor:props.appearance.wrapperBackground});
30
30
  const CustomAppBar = (open) ? OpenDrawerAppBar : ClosedDrawerAppBar;
31
31
 
32
32
  const loadCounts = () => {
@@ -0,0 +1,189 @@
1
+ "use client";
2
+
3
+ import React from "react";
4
+ import { loadStripe, Stripe } from "@stripe/stripe-js";
5
+ import { DonationForm, RecurringDonations, PaymentMethods } from "./components";
6
+ import { DisplayBox, ExportLink, Loading } from "../components";
7
+ import { ApiHelper, DateHelper, UniqueIdHelper, CurrencyHelper, Locale } from "../helpers";
8
+ import { DonationInterface, PersonInterface, StripePaymentMethod, ChurchInterface } from "@churchapps/helpers";
9
+ import { Link } from "react-router-dom"
10
+ import { Table, TableBody, TableRow, TableCell, TableHead, Alert, Button, Icon, Menu, MenuItem } from "@mui/material"
11
+ import { useMountedState } from "../hooks/useMountedState";
12
+
13
+ interface Props { personId: string, appName?: string, church?: ChurchInterface, churchLogo?: string }
14
+
15
+ export const DonationPage: React.FC<Props> = (props) => {
16
+ const [donations, setDonations] = React.useState<DonationInterface[]>(null);
17
+ const [stripePromise, setStripe] = React.useState<Promise<Stripe>>(null);
18
+ const [paymentMethods, setPaymentMethods] = React.useState<StripePaymentMethod[]>(null);
19
+ const [customerId, setCustomerId] = React.useState(null);
20
+ const [person, setPerson] = React.useState<PersonInterface>(null);
21
+ const [message, setMessage] = React.useState<string>(null);
22
+ const [appName, setAppName] = React.useState<string>("");
23
+ const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
24
+ const open = Boolean(anchorEl);
25
+ const isMounted = useMountedState();
26
+
27
+ const handleClose = () => {
28
+ setAnchorEl(null);
29
+ }
30
+
31
+ const loadData = () => {
32
+ if (props?.appName) setAppName(props.appName);
33
+ if (!UniqueIdHelper.isMissing(props.personId)) {
34
+ ApiHelper.get("/donations?personId=" + props.personId, "GivingApi").then(data => {
35
+ if(isMounted()) {
36
+ setDonations(data);
37
+ }});
38
+ ApiHelper.get("/gateways", "GivingApi").then(data => {
39
+ if (data.length && data[0]?.publicKey) {
40
+ if(isMounted()) {
41
+ setStripe(loadStripe(data[0].publicKey));
42
+ }
43
+ ApiHelper.get("/paymentmethods/personid/" + props.personId, "GivingApi").then(results => {
44
+ if(!isMounted()) {
45
+ return;
46
+ }
47
+ if (!results.length) setPaymentMethods([]);
48
+ else {
49
+ let cards = results[0].cards.data.map((card: any) => new StripePaymentMethod(card));
50
+ let banks = results[0].banks.data.map((bank: any) => new StripePaymentMethod(bank));
51
+ let methods = cards.concat(banks);
52
+ setCustomerId(results[0].customer.id);
53
+ setPaymentMethods(methods);
54
+ }
55
+ });
56
+ ApiHelper.get("/people/" + props.personId, "MembershipApi").then(data => {
57
+ if(isMounted()) {
58
+ setPerson(data);
59
+ }
60
+ });
61
+ }
62
+ else setPaymentMethods([]);
63
+ });
64
+ }
65
+ }
66
+
67
+ const handleDataUpdate = (message?: string) => {
68
+ setMessage(message)
69
+ setPaymentMethods(null);
70
+ loadData();
71
+ }
72
+
73
+ const getEditContent = () => {
74
+ const result: JSX.Element[] = [];
75
+ const date = new Date();
76
+ const currentY = date.getFullYear();
77
+ const lastY = date.getFullYear() - 1;
78
+
79
+ const current_year = donations.filter(d => new Date(d.donationDate).getFullYear() === currentY);
80
+ const last_year = donations.filter(d => new Date(d.donationDate).getFullYear() === lastY);
81
+ const customHeaders = [
82
+ { label: "amount", key: "amount" },
83
+ { label: "donationDate", key: "donationDate" },
84
+ { label: "fundName", key: "fund.name" },
85
+ { label: "method", key: "method"},
86
+ { label: "methodDetails", key: "methodDetails"},
87
+ ]
88
+
89
+ result.push(<>
90
+ <Button
91
+ id="download-button"
92
+ aria-controls={open ? "download-menu" : undefined}
93
+ aria-haspopup="true"
94
+ aria-expanded={open ? "true" : undefined}
95
+ onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
96
+ setAnchorEl(e.currentTarget);
97
+ }}
98
+ >
99
+ <Icon>download</Icon>
100
+ </Button>
101
+ <Menu
102
+ id="download-menu"
103
+ anchorEl={anchorEl}
104
+ open={open}
105
+ onClose={handleClose}
106
+ MenuListProps={{ 'aria-labelledby': "download-button" }}
107
+ >
108
+ <MenuItem onClick={handleClose} dense><ExportLink data={current_year} filename="current_year_donations" customHeaders={customHeaders} text="Current Year" icon="csv" /></MenuItem>
109
+ <MenuItem href="/member/donate/print"><Icon>print</Icon> Current Year</MenuItem>
110
+ <MenuItem onClick={handleClose} dense><ExportLink data={last_year} filename="last_year_donations" customHeaders={customHeaders} text="Last Year" icon="csv" /></MenuItem>
111
+ <MenuItem href="/member/donate/print?prev=1"><Icon>print</Icon> Last Year</MenuItem>
112
+ </Menu>
113
+ </>);
114
+
115
+ return result;
116
+ }
117
+
118
+ const getRows = () => {
119
+ let rows: JSX.Element[] = [];
120
+
121
+ if (donations.length === 0) {
122
+ rows.push(<TableRow key="0"><TableCell>{Locale.label("donation.page.willAppear")}</TableCell></TableRow>);
123
+ return rows;
124
+ }
125
+
126
+ for (let i = 0; i < donations.length; i++) {
127
+ let d = donations[i];
128
+ rows.push(
129
+ <TableRow key={i}>
130
+ {appName !== "B1App" && <TableCell><Link to={"/donations/" + d.batchId}>{d.batchId}</Link></TableCell>}
131
+ <TableCell>{DateHelper.prettyDate(new Date(d.donationDate))}</TableCell>
132
+ <TableCell>{d.method} - {d.methodDetails}</TableCell>
133
+ <TableCell>{d.fund.name}</TableCell>
134
+ <TableCell>{CurrencyHelper.formatCurrency(d.fund.amount)}</TableCell>
135
+ </TableRow>
136
+ );
137
+ }
138
+ return rows;
139
+ }
140
+
141
+ const getTableHeader = () => {
142
+ const rows: JSX.Element[] = []
143
+
144
+ if (donations.length > 0) {
145
+ rows.push(
146
+ <TableRow key="header" sx={{textAlign: "left"}}>
147
+ {appName !== "B1App" && <th>{Locale.label("donation.page.batch")}</th>}
148
+ <th>{Locale.label("donation.page.date")}</th>
149
+ <th>{Locale.label("donation.page.method")}</th>
150
+ <th>{Locale.label("donation.page.fund")}</th>
151
+ <th>{Locale.label("donation.page.amount")}</th>
152
+ </TableRow>
153
+ );
154
+ }
155
+
156
+ return rows;
157
+ }
158
+
159
+ React.useEffect(loadData, [isMounted]); //eslint-disable-line
160
+
161
+ const getTable = () => {
162
+ if (!donations) return <Loading />;
163
+ else return (<Table>
164
+ <TableHead>{getTableHeader()}</TableHead>
165
+ <TableBody>{getRows()}</TableBody>
166
+ </Table>);
167
+ }
168
+
169
+ const getPaymentMethodComponents = () => {
170
+ if (!paymentMethods) return <Loading />;
171
+ else return (
172
+ <>
173
+ <DonationForm person={person} customerId={customerId} paymentMethods={paymentMethods} stripePromise={stripePromise} donationSuccess={handleDataUpdate} church={props?.church} churchLogo={props?.churchLogo} />
174
+ <DisplayBox headerIcon="payments" headerText="Donations" editContent={getEditContent()}>
175
+ {getTable()}
176
+ </DisplayBox>
177
+ <RecurringDonations customerId={customerId} paymentMethods={paymentMethods} appName={appName} dataUpdate={handleDataUpdate} />
178
+ <PaymentMethods person={person} customerId={customerId} paymentMethods={paymentMethods} appName={appName} stripePromise={stripePromise} dataUpdate={handleDataUpdate} />
179
+ </>
180
+ );
181
+ }
182
+
183
+ return (
184
+ <>
185
+ {paymentMethods && message && <Alert severity="success">{message}</Alert>}
186
+ {getPaymentMethodComponents()}
187
+ </>
188
+ );
189
+ }
@@ -1,2 +1,3 @@
1
1
  export { FundDonations } from "./components/FundDonations";
2
2
  export { NonAuthDonation } from "./components/NonAuthDonation";
3
+ export { DonationPage } from "./DonationPage";