@churchapps/apphelper 0.2.75 → 0.2.77

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.
@@ -22,7 +22,7 @@ const useMountedState_1 = require("../../hooks/useMountedState");
22
22
  const SocketHelper_1 = require("../../helpers/SocketHelper");
23
23
  const Drawers_1 = require("./Drawers");
24
24
  const SiteWrapper = props => {
25
- var _a, _b, _c, _d, _e;
25
+ var _a, _b, _c, _d, _e, _f, _g;
26
26
  const [churchLogo, setChurchLogo] = react_1.default.useState();
27
27
  const [open, setOpen] = react_1.default.useState(false);
28
28
  const [notificationCounts, setNotificationCounts] = react_1.default.useState({ notificationCount: 0, pmCount: 0 });
@@ -69,14 +69,14 @@ const SiteWrapper = props => {
69
69
  boxStyle.overflow = "auto";
70
70
  return react_1.default.createElement(react_1.default.Fragment, null,
71
71
  react_1.default.createElement(CustomAppBar, { position: "absolute" },
72
- react_1.default.createElement(material_1.Toolbar, { sx: { pr: "24px" } },
72
+ react_1.default.createElement(material_1.Toolbar, { sx: { pr: "24px", backgroundColor: (_a = props.appearance) === null || _a === void 0 ? void 0 : _a.wrapperBackground } },
73
73
  react_1.default.createElement(material_1.IconButton, { edge: "start", color: "inherit", "aria-label": "open drawer", onClick: toggleDrawer, sx: Object.assign({ marginRight: "36px" }, (open && { display: "none" })) },
74
74
  react_1.default.createElement(material_1.Icon, null, "menu")),
75
- react_1.default.createElement(material_1.Typography, { variant: "h6", noWrap: true }, ((_b = (_a = helpers_1.UserHelper.currentUserChurch) === null || _a === void 0 ? void 0 : _a.church) === null || _b === void 0 ? void 0 : _b.name) || ""),
75
+ react_1.default.createElement(material_1.Typography, { variant: "h6", noWrap: true }, ((_c = (_b = helpers_1.UserHelper.currentUserChurch) === null || _b === void 0 ? void 0 : _b.church) === null || _c === void 0 ? void 0 : _c.name) || ""),
76
76
  react_1.default.createElement("div", { style: { flex: 1 } }),
77
- helpers_1.UserHelper.user && react_1.default.createElement(UserMenu_1.UserMenu, { profilePicture: helpers_1.PersonHelper.getPhotoUrl((_c = props.context) === null || _c === void 0 ? void 0 : _c.person), userName: `${(_d = helpers_1.UserHelper.user) === null || _d === void 0 ? void 0 : _d.firstName} ${(_e = helpers_1.UserHelper.user) === null || _e === void 0 ? void 0 : _e.lastName}`, userChurches: helpers_1.UserHelper.userChurches, currentUserChurch: helpers_1.UserHelper.currentUserChurch, context: props.context, appName: props.appName, router: props.router, loadCounts: loadCounts, notificationCounts: notificationCounts }),
77
+ helpers_1.UserHelper.user && react_1.default.createElement(UserMenu_1.UserMenu, { profilePicture: helpers_1.PersonHelper.getPhotoUrl((_d = props.context) === null || _d === void 0 ? void 0 : _d.person), userName: `${(_e = helpers_1.UserHelper.user) === null || _e === void 0 ? void 0 : _e.firstName} ${(_f = helpers_1.UserHelper.user) === null || _f === void 0 ? void 0 : _f.lastName}`, userChurches: helpers_1.UserHelper.userChurches, currentUserChurch: helpers_1.UserHelper.currentUserChurch, context: props.context, appName: props.appName, router: props.router, loadCounts: loadCounts, notificationCounts: notificationCounts }),
78
78
  !helpers_1.UserHelper.user && react_1.default.createElement(material_1.Link, { href: "/login", color: "inherit", style: { textDecoration: "none" } }, "Login"))),
79
- react_1.default.createElement(CustomDrawer, { variant: "permanent", open: open, onMouseOver: () => setOpen(true), onMouseLeave: () => setOpen(false) },
79
+ react_1.default.createElement(CustomDrawer, { style: { backgroundColor: (_g = props.appearance) === null || _g === void 0 ? void 0 : _g.wrapperBackground }, variant: "permanent", open: open, onMouseOver: () => setOpen(true), onMouseLeave: () => setOpen(false) },
80
80
  react_1.default.createElement(material_1.Toolbar, { sx: { display: "flex", alignItems: "center", width: "100%", px: [1] } },
81
81
  react_1.default.createElement("img", { src: churchLogo || "/images/logo-wrapper.png", alt: "logo", style: { maxWidth: 170 } }),
82
82
  react_1.default.createElement("div", { style: { justifyContent: "flex-end", flex: 1, display: "flex" } },
@@ -1 +1 @@
1
- {"version":3,"file":"SiteWrapper.js","sourceRoot":"","sources":["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C,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"}
@@ -1,4 +1,3 @@
1
- export { DonationPage } from "./DonationPage";
2
1
  export { FundDonations } from "./components/FundDonations";
3
2
  export { NonAuthDonation } from "./components/NonAuthDonation";
4
3
  //# 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,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,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"}
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NonAuthDonation = exports.FundDonations = exports.DonationPage = void 0;
4
- var DonationPage_1 = require("./DonationPage");
5
- Object.defineProperty(exports, "DonationPage", { enumerable: true, get: function () { return DonationPage_1.DonationPage; } });
3
+ exports.NonAuthDonation = exports.FundDonations = void 0;
6
4
  var FundDonations_1 = require("./components/FundDonations");
7
5
  Object.defineProperty(exports, "FundDonations", { enumerable: true, get: function () { return FundDonations_1.FundDonations; } });
8
6
  var NonAuthDonation_1 = require("./components/NonAuthDonation");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/donationComponents/index.ts"],"names":[],"mappings":";;;AAAA,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,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"}
@@ -1,8 +1,5 @@
1
1
  export interface AppearanceInterface {
2
- primaryColor?: string;
3
- primaryContrast?: string;
4
- secondaryColor?: string;
5
- secondaryContrast?: string;
2
+ wrapperBackground?: string;
6
3
  logoLight?: string;
7
4
  logoDark?: string;
8
5
  favicon_400x400?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"AppearanceHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/AppearanceHelper.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,mBAAmB;IAAG,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;AAExP,qBAAa,gBAAgB;WAEb,WAAW,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM;WAIxE,YAAY,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM;WAIzE,UAAU,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI;WAYtE,OAAO,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;WAM3H,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAIvF,OAAO,CAAC,MAAM,CAAC,MAAM;IA+BrB,OAAO,CAAC,MAAM,CAAC,WAAW;CAM3B"}
1
+ {"version":3,"file":"AppearanceHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/AppearanceHelper.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,mBAAmB;IAAG,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;AAE9K,qBAAa,gBAAgB;WAEb,WAAW,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM;WAIxE,YAAY,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM;WAIzE,UAAU,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI;WAYtE,OAAO,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;WAM3H,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAIvF,OAAO,CAAC,MAAM,CAAC,MAAM;IA+BrB,OAAO,CAAC,MAAM,CAAC,WAAW;CAM3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@churchapps/apphelper",
3
- "version": "0.2.75",
3
+ "version": "0.2.77",
4
4
  "description": "Library of helper functions for React and NextJS ChurchApps",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -73,7 +73,7 @@ export const SiteWrapper: React.FC<Props> = props => {
73
73
 
74
74
  return <>
75
75
  <CustomAppBar position="absolute">
76
- <Toolbar sx={{ pr: "24px" }}>
76
+ <Toolbar sx={{ pr: "24px", backgroundColor: props.appearance?.wrapperBackground }}>
77
77
  <IconButton edge="start" color="inherit" aria-label="open drawer" onClick={toggleDrawer} sx={{ marginRight: "36px", ...(open && { display: "none" }) }}>
78
78
  <Icon>menu</Icon>
79
79
  </IconButton>
@@ -84,7 +84,7 @@ export const SiteWrapper: React.FC<Props> = props => {
84
84
  </Toolbar>
85
85
  </CustomAppBar>
86
86
 
87
- <CustomDrawer variant="permanent" open={open} onMouseOver={() => setOpen(true)} onMouseLeave={() => setOpen(false)}>
87
+ <CustomDrawer style={{ backgroundColor: props.appearance?.wrapperBackground }} variant="permanent" open={open} onMouseOver={() => setOpen(true)} onMouseLeave={() => setOpen(false)}>
88
88
  <Toolbar sx={{ display: "flex", alignItems: "center", width: "100%", px: [1] }}>
89
89
  <img src={churchLogo || "/images/logo-wrapper.png"} alt="logo" style={{ maxWidth: 170 }} />
90
90
  <div style={{ justifyContent: "flex-end", flex: 1, display: "flex" }}>
@@ -1,3 +1,2 @@
1
- export { DonationPage } from "./DonationPage";
2
1
  export { FundDonations } from "./components/FundDonations";
3
2
  export { NonAuthDonation } from "./components/NonAuthDonation";
@@ -1,5 +1,5 @@
1
1
 
2
- export interface AppearanceInterface { primaryColor?: string, primaryContrast?: string, secondaryColor?: string, secondaryContrast?: string, logoLight?: string, logoDark?: string, favicon_400x400?: string, favicon_16x16?: string, ogImage?: string }
2
+ export interface AppearanceInterface { wrapperBackground?: string, logoLight?: string, logoDark?: string, favicon_400x400?: string, favicon_16x16?: string, ogImage?: string }
3
3
 
4
4
  export class AppearanceHelper {
5
5
 
@@ -1,11 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,166 +0,0 @@
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
@@ -1 +0,0 @@
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,CAAC,OAAO,EAAE,UAAU,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C,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,189 +0,0 @@
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
- }