@churchapps/apphelper 0.0.14 → 0.1.1
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/.eslintignore +3 -3
- package/.eslintrc.json +22 -22
- package/LICENSE +21 -21
- package/README.md +22 -16
- package/dist/components/FormSubmissionEdit.d.ts.map +1 -1
- package/dist/components/FormSubmissionEdit.js +9 -2
- package/dist/components/FormSubmissionEdit.js.map +1 -1
- package/dist/components/QuestionEdit.d.ts.map +1 -1
- package/dist/components/QuestionEdit.js +2 -1
- package/dist/components/QuestionEdit.js.map +1 -1
- package/dist/components/iconPicker/IconNamesList.d.ts.map +1 -0
- package/dist/components/iconPicker/IconNamesList.js.map +1 -0
- package/dist/components/iconPicker/IconPicker.d.ts.map +1 -0
- package/dist/components/iconPicker/IconPicker.js.map +1 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/markdownEditor/editor.css +787 -787
- package/dist/components/markdownEditor/images/icons/arrow-clockwise.svg +3 -3
- package/dist/components/markdownEditor/images/icons/arrow-counterclockwise.svg +3 -3
- package/dist/components/markdownEditor/images/icons/chat-square-quote.svg +3 -3
- package/dist/components/markdownEditor/images/icons/chevron-down.svg +2 -2
- package/dist/components/markdownEditor/images/icons/code.svg +2 -2
- package/dist/components/markdownEditor/images/icons/journal-code.svg +4 -4
- package/dist/components/markdownEditor/images/icons/journal-text.svg +4 -4
- package/dist/components/markdownEditor/images/icons/justify.svg +2 -2
- package/dist/components/markdownEditor/images/icons/link.svg +3 -3
- package/dist/components/markdownEditor/images/icons/list-ol.svg +3 -3
- package/dist/components/markdownEditor/images/icons/list-ul.svg +2 -2
- package/dist/components/markdownEditor/images/icons/pencil-fill.svg +2 -2
- package/dist/components/markdownEditor/images/icons/text-center.svg +2 -2
- package/dist/components/markdownEditor/images/icons/text-left.svg +2 -2
- package/dist/components/markdownEditor/images/icons/text-paragraph.svg +2 -2
- package/dist/components/markdownEditor/images/icons/text-right.svg +2 -2
- package/dist/components/markdownEditor/images/icons/type-bold.svg +2 -2
- package/dist/components/markdownEditor/images/icons/type-h1.svg +2 -2
- package/dist/components/markdownEditor/images/icons/type-h2.svg +2 -2
- package/dist/components/markdownEditor/images/icons/type-h3.svg +2 -2
- package/dist/components/markdownEditor/images/icons/type-h4.svg +12 -12
- package/dist/components/markdownEditor/images/icons/type-italic.svg +2 -2
- package/dist/components/markdownEditor/images/icons/type-strikethrough.svg +2 -2
- package/dist/components/markdownEditor/images/icons/type-underline.svg +2 -2
- package/dist/components/markdownEditor/plugins/customLink/CustomLinkNodeTransformer.js +1 -1
- package/dist/components/markdownEditor/plugins/customLink/CustomLinkNodeTransformer.js.map +1 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojiNodeTransform.js +1 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojiNodeTransform.js.map +1 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojiPickerPlugin.js +1 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojiPickerPlugin.js.map +1 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojisPlugin.js +1 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojisPlugin.js.map +1 -1
- package/dist/components/notes/Notes.d.ts +1 -0
- package/dist/components/notes/Notes.d.ts.map +1 -1
- package/dist/components/notes/Notes.js +18 -1
- package/dist/components/notes/Notes.js.map +1 -1
- package/dist/components/wrapper/AppList.d.ts.map +1 -0
- package/dist/components/wrapper/AppList.js.map +1 -0
- package/dist/components/wrapper/ChurchList.d.ts.map +1 -0
- package/dist/components/wrapper/ChurchList.js.map +1 -0
- package/dist/components/wrapper/Drawers.d.ts +22 -0
- package/dist/components/wrapper/Drawers.d.ts.map +1 -0
- package/dist/components/wrapper/Drawers.js +51 -0
- package/dist/components/wrapper/Drawers.js.map +1 -0
- package/dist/components/wrapper/NavItem.d.ts.map +1 -0
- package/dist/components/wrapper/NavItem.js.map +1 -0
- package/dist/components/wrapper/NewPrivateMessage.d.ts.map +1 -0
- package/dist/components/wrapper/NewPrivateMessage.js.map +1 -0
- package/dist/components/wrapper/NotificationMenu.d.ts +14 -0
- package/dist/components/wrapper/NotificationMenu.d.ts.map +1 -0
- package/dist/components/wrapper/NotificationMenu.js +60 -0
- package/dist/components/wrapper/NotificationMenu.js.map +1 -0
- package/dist/components/wrapper/Notifications.d.ts +8 -0
- package/dist/components/wrapper/Notifications.d.ts.map +1 -0
- package/dist/components/wrapper/Notifications.js +67 -0
- package/dist/components/wrapper/Notifications.js.map +1 -0
- package/dist/components/wrapper/PrivateMessageDetails.d.ts.map +1 -0
- package/dist/components/{material → wrapper}/PrivateMessageDetails.js +1 -1
- package/dist/components/wrapper/PrivateMessageDetails.js.map +1 -0
- package/dist/components/wrapper/PrivateMessages.d.ts.map +1 -0
- package/dist/components/{material → wrapper}/PrivateMessages.js +1 -1
- package/dist/components/wrapper/PrivateMessages.js.map +1 -0
- package/dist/components/wrapper/SiteWrapper.d.ts.map +1 -0
- package/dist/components/{material → wrapper}/SiteWrapper.js +13 -49
- package/dist/components/wrapper/SiteWrapper.js.map +1 -0
- package/dist/components/wrapper/TabPanel.d.ts +9 -0
- package/dist/components/wrapper/TabPanel.d.ts.map +1 -0
- package/dist/components/wrapper/TabPanel.js +24 -0
- package/dist/components/wrapper/TabPanel.js.map +1 -0
- package/dist/components/wrapper/UserMenu.d.ts.map +1 -0
- package/dist/components/{material → wrapper}/UserMenu.js +14 -31
- package/dist/components/wrapper/UserMenu.js.map +1 -0
- package/dist/components/{material → wrapper}/index.d.ts +0 -1
- package/dist/components/wrapper/index.d.ts.map +1 -0
- package/dist/components/{material → wrapper}/index.js +1 -3
- package/dist/components/wrapper/index.js.map +1 -0
- package/dist/interfaces/Messaging.d.ts +10 -0
- package/dist/interfaces/Messaging.d.ts.map +1 -1
- package/package.json +85 -84
- package/src/components/CreatePerson.tsx +80 -80
- package/src/components/DisplayBox.tsx +68 -68
- package/src/components/ErrorMessages.tsx +26 -26
- package/src/components/ExportLink.tsx +67 -67
- package/src/components/FloatingSupport.tsx +16 -16
- package/src/components/FormSubmissionEdit.tsx +129 -120
- package/src/components/HelpIcon.tsx +10 -10
- package/src/components/ImageEditor.tsx +126 -126
- package/src/components/InputBox.tsx +73 -73
- package/src/components/Loading.tsx +29 -29
- package/src/components/PersonAdd.tsx +75 -75
- package/src/components/QuestionEdit.tsx +63 -62
- package/src/components/SmallButton.tsx +39 -39
- package/src/components/SupportModal.tsx +26 -26
- package/src/components/TabPanel.tsx +34 -34
- package/src/components/gallery/GalleryModal.tsx +102 -102
- package/src/components/gallery/StockPhotos.tsx +74 -74
- package/src/components/gallery/index.ts +1 -1
- package/src/components/{material/iconPicker → iconPicker}/IconNamesList.ts +2240 -2240
- package/src/components/{material/iconPicker → iconPicker}/IconPicker.tsx +153 -153
- package/src/components/index.tsx +24 -23
- package/src/components/markdownEditor/Editor.tsx +132 -132
- package/src/components/markdownEditor/MarkdownEditor.tsx +16 -16
- package/src/components/markdownEditor/MarkdownModal.tsx +46 -46
- package/src/components/markdownEditor/MarkdownPreview.tsx +14 -14
- package/src/components/markdownEditor/editor.css +787 -787
- package/src/components/markdownEditor/images/icons/arrow-clockwise.svg +3 -3
- package/src/components/markdownEditor/images/icons/arrow-counterclockwise.svg +3 -3
- package/src/components/markdownEditor/images/icons/chat-square-quote.svg +3 -3
- package/src/components/markdownEditor/images/icons/chevron-down.svg +2 -2
- package/src/components/markdownEditor/images/icons/code.svg +2 -2
- package/src/components/markdownEditor/images/icons/journal-code.svg +4 -4
- package/src/components/markdownEditor/images/icons/journal-text.svg +4 -4
- package/src/components/markdownEditor/images/icons/justify.svg +2 -2
- package/src/components/markdownEditor/images/icons/link.svg +3 -3
- package/src/components/markdownEditor/images/icons/list-ol.svg +3 -3
- package/src/components/markdownEditor/images/icons/list-ul.svg +2 -2
- package/src/components/markdownEditor/images/icons/pencil-fill.svg +2 -2
- package/src/components/markdownEditor/images/icons/text-center.svg +2 -2
- package/src/components/markdownEditor/images/icons/text-left.svg +2 -2
- package/src/components/markdownEditor/images/icons/text-paragraph.svg +2 -2
- package/src/components/markdownEditor/images/icons/text-right.svg +2 -2
- package/src/components/markdownEditor/images/icons/type-bold.svg +2 -2
- package/src/components/markdownEditor/images/icons/type-h1.svg +2 -2
- package/src/components/markdownEditor/images/icons/type-h2.svg +2 -2
- package/src/components/markdownEditor/images/icons/type-h3.svg +2 -2
- package/src/components/markdownEditor/images/icons/type-h4.svg +12 -12
- package/src/components/markdownEditor/images/icons/type-italic.svg +2 -2
- package/src/components/markdownEditor/images/icons/type-strikethrough.svg +2 -2
- package/src/components/markdownEditor/images/icons/type-underline.svg +2 -2
- package/src/components/markdownEditor/index.ts +2 -2
- package/src/components/markdownEditor/plugins/AutoLinkPlugin.tsx +35 -35
- package/src/components/markdownEditor/plugins/ControlledEditorPlugin.tsx +24 -24
- package/src/components/markdownEditor/plugins/ListMaxIndentLevelPlugin.tsx +68 -68
- package/src/components/markdownEditor/plugins/MarkdownTransformers.ts +106 -106
- package/src/components/markdownEditor/plugins/ReadOnlyPlugin.tsx +15 -15
- package/src/components/markdownEditor/plugins/ToolbarPlugin.tsx +401 -401
- package/src/components/markdownEditor/plugins/customLink/CustomLinkNode.tsx +224 -224
- package/src/components/markdownEditor/plugins/customLink/CustomLinkNodePlugin.tsx +32 -32
- package/src/components/markdownEditor/plugins/customLink/CustomLinkNodeTransformer.tsx +102 -102
- package/src/components/markdownEditor/plugins/customLink/FloatingLinkEditor.tsx +243 -243
- package/src/components/markdownEditor/plugins/customLink/FloatingLinkEditor.types.ts +11 -11
- package/src/components/markdownEditor/plugins/emoji/EmojiNode.tsx +95 -95
- package/src/components/markdownEditor/plugins/emoji/EmojiNodeTransform.ts +41 -41
- package/src/components/markdownEditor/plugins/emoji/EmojiPickerPlugin.tsx +152 -152
- package/src/components/markdownEditor/plugins/emoji/EmojisPlugin.tsx +65 -65
- package/src/components/markdownEditor/plugins/index.ts +6 -6
- package/src/components/markdownEditor/theme.ts +65 -65
- package/src/components/notes/AddNote.tsx +90 -90
- package/src/components/notes/Conversation.tsx +82 -82
- package/src/components/notes/Conversations.tsx +58 -58
- package/src/components/notes/NewConversation.tsx +78 -78
- package/src/components/notes/Note.tsx +44 -44
- package/src/components/notes/Notes.tsx +68 -52
- package/src/components/notes/index.ts +5 -5
- package/src/components/reporting/ChartReport.tsx +98 -98
- package/src/components/reporting/ReportFilter.tsx +54 -54
- package/src/components/reporting/ReportFilterField.tsx +160 -160
- package/src/components/reporting/ReportOutput.tsx +79 -79
- package/src/components/reporting/ReportWithFilter.tsx +70 -70
- package/src/components/reporting/TableReport.tsx +57 -57
- package/src/components/reporting/TreeReport.tsx +111 -111
- package/src/components/reporting/index.ts +4 -4
- package/src/components/{material → wrapper}/AppList.tsx +20 -20
- package/src/components/{material → wrapper}/ChurchList.tsx +22 -22
- package/src/components/wrapper/Drawers.tsx +60 -0
- package/src/components/{material → wrapper}/NavItem.tsx +41 -41
- package/src/components/{material → wrapper}/NewPrivateMessage.tsx +103 -103
- package/src/components/wrapper/NotificationMenu.tsx +85 -0
- package/src/components/wrapper/Notifications.tsx +50 -0
- package/src/components/{material → wrapper}/PrivateMessageDetails.tsx +23 -23
- package/src/components/{material → wrapper}/PrivateMessages.tsx +87 -87
- package/src/components/{material → wrapper}/SiteWrapper.tsx +96 -145
- package/src/components/wrapper/TabPanel.tsx +30 -0
- package/src/components/{material → wrapper}/UserMenu.tsx +106 -141
- package/src/components/{material → wrapper}/index.tsx +5 -6
- package/src/donationComponents/DonationPage.tsx +136 -136
- package/src/donationComponents/components/BankForm.tsx +159 -159
- package/src/donationComponents/components/CardForm.tsx +104 -104
- package/src/donationComponents/components/DonationForm.tsx +235 -235
- package/src/donationComponents/components/FundDonation.tsx +49 -49
- package/src/donationComponents/components/FundDonations.tsx +39 -39
- package/src/donationComponents/components/NonAuthDonation.tsx +31 -31
- package/src/donationComponents/components/NonAuthDonationInner.tsx +259 -259
- package/src/donationComponents/components/PaymentMethods.tsx +135 -135
- package/src/donationComponents/components/RecurringDonations.tsx +121 -121
- package/src/donationComponents/components/RecurringDonationsEdit.tsx +93 -93
- package/src/donationComponents/components/index.tsx +9 -9
- package/src/donationComponents/index.ts +3 -3
- package/src/donationComponents/modals/DonationPreviewModal.tsx +66 -66
- package/src/helpers/AnalyticsHelper.ts +33 -33
- package/src/helpers/ApiHelper.ts +125 -125
- package/src/helpers/AppearanceHelper.ts +69 -69
- package/src/helpers/ArrayHelper.ts +81 -81
- package/src/helpers/CommonEnvironmentHelper.ts +80 -80
- package/src/helpers/CurrencyHelper.ts +10 -10
- package/src/helpers/DateHelper.ts +108 -108
- package/src/helpers/DonationHelper.ts +26 -26
- package/src/helpers/ErrorHelper.ts +36 -36
- package/src/helpers/EventHelper.ts +52 -52
- package/src/helpers/FileHelper.ts +31 -31
- package/src/helpers/PersonHelper.ts +60 -60
- package/src/helpers/SocketHelper.ts +76 -76
- package/src/helpers/Themes.ts +14 -14
- package/src/helpers/UniqueIdHelper.ts +36 -36
- package/src/helpers/UserHelper.ts +59 -59
- package/src/helpers/createEmotionCache.ts +17 -17
- package/src/helpers/index.ts +18 -18
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useMountedState.ts +16 -16
- package/src/index.ts +6 -6
- package/src/interfaces/Access.ts +24 -24
- package/src/interfaces/Attendance.ts +8 -8
- package/src/interfaces/Content.ts +10 -10
- package/src/interfaces/Doing.ts +24 -24
- package/src/interfaces/Donation.ts +45 -45
- package/src/interfaces/Error.ts +17 -17
- package/src/interfaces/Membership.ts +51 -51
- package/src/interfaces/Messaging.ts +21 -20
- package/src/interfaces/Permissions.ts +68 -68
- package/src/interfaces/Reporting.ts +7 -7
- package/src/interfaces/UserContextInterface.ts +13 -13
- package/src/interfaces/index.ts +13 -13
- package/src/pageComponents/LoginPage.tsx +244 -244
- package/src/pageComponents/LogoutPage.tsx +28 -28
- package/src/pageComponents/components/Forgot.tsx +79 -79
- package/src/pageComponents/components/Login.tsx +54 -54
- package/src/pageComponents/components/LoginSetPassword.tsx +63 -63
- package/src/pageComponents/components/Register.tsx +107 -107
- package/src/pageComponents/components/SelectChurchModal.tsx +41 -41
- package/src/pageComponents/components/SelectChurchRegister.tsx +88 -88
- package/src/pageComponents/components/SelectChurchSearch.tsx +69 -69
- package/src/pageComponents/components/SelectableChurch.tsx +38 -38
- package/src/pageComponents/index.ts +3 -3
- package/tsconfig.json +34 -34
- package/tslint.json +14 -14
- package/dist/components/material/AppList.d.ts.map +0 -1
- package/dist/components/material/AppList.js.map +0 -1
- package/dist/components/material/ChurchList.d.ts.map +0 -1
- package/dist/components/material/ChurchList.js.map +0 -1
- package/dist/components/material/NavItem.d.ts.map +0 -1
- package/dist/components/material/NavItem.js.map +0 -1
- package/dist/components/material/NewPrivateMessage.d.ts.map +0 -1
- package/dist/components/material/NewPrivateMessage.js.map +0 -1
- package/dist/components/material/PrivateMessageDetails.d.ts.map +0 -1
- package/dist/components/material/PrivateMessageDetails.js.map +0 -1
- package/dist/components/material/PrivateMessages.d.ts.map +0 -1
- package/dist/components/material/PrivateMessages.js.map +0 -1
- package/dist/components/material/SiteWrapper.d.ts.map +0 -1
- package/dist/components/material/SiteWrapper.js.map +0 -1
- package/dist/components/material/UserMenu.d.ts.map +0 -1
- package/dist/components/material/UserMenu.js.map +0 -1
- package/dist/components/material/iconPicker/IconNamesList.d.ts.map +0 -1
- package/dist/components/material/iconPicker/IconNamesList.js.map +0 -1
- package/dist/components/material/iconPicker/IconPicker.d.ts.map +0 -1
- package/dist/components/material/iconPicker/IconPicker.js.map +0 -1
- package/dist/components/material/index.d.ts.map +0 -1
- package/dist/components/material/index.js.map +0 -1
- /package/dist/components/{material/iconPicker → iconPicker}/IconNamesList.d.ts +0 -0
- /package/dist/components/{material/iconPicker → iconPicker}/IconNamesList.js +0 -0
- /package/dist/components/{material/iconPicker → iconPicker}/IconPicker.d.ts +0 -0
- /package/dist/components/{material/iconPicker → iconPicker}/IconPicker.js +0 -0
- /package/dist/components/{material → wrapper}/AppList.d.ts +0 -0
- /package/dist/components/{material → wrapper}/AppList.js +0 -0
- /package/dist/components/{material → wrapper}/ChurchList.d.ts +0 -0
- /package/dist/components/{material → wrapper}/ChurchList.js +0 -0
- /package/dist/components/{material → wrapper}/NavItem.d.ts +0 -0
- /package/dist/components/{material → wrapper}/NavItem.js +0 -0
- /package/dist/components/{material → wrapper}/NewPrivateMessage.d.ts +0 -0
- /package/dist/components/{material → wrapper}/NewPrivateMessage.js +0 -0
- /package/dist/components/{material → wrapper}/PrivateMessageDetails.d.ts +0 -0
- /package/dist/components/{material → wrapper}/PrivateMessages.d.ts +0 -0
- /package/dist/components/{material → wrapper}/SiteWrapper.d.ts +0 -0
- /package/dist/components/{material → wrapper}/UserMenu.d.ts +0 -0
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
export class CommonEnvironmentHelper {
|
|
3
|
-
public static AttendanceApi = "";
|
|
4
|
-
public static DoingApi = "";
|
|
5
|
-
public static GivingApi = "";
|
|
6
|
-
public static MembershipApi = "";
|
|
7
|
-
public static ReportingApi = "";
|
|
8
|
-
public static MessagingApi = "";
|
|
9
|
-
public static MessagingApiSocket = "";
|
|
10
|
-
public static ContentApi = "";
|
|
11
|
-
public static GoogleAnalyticsTag = "";
|
|
12
|
-
|
|
13
|
-
static ContentRoot = "";
|
|
14
|
-
static B1Root = "";
|
|
15
|
-
static ChumsRoot = "";
|
|
16
|
-
static LessonsRoot = "";
|
|
17
|
-
|
|
18
|
-
static init = (stage: string) => {
|
|
19
|
-
switch (stage) {
|
|
20
|
-
case "staging": CommonEnvironmentHelper.initStaging(); break;
|
|
21
|
-
case "prod": CommonEnvironmentHelper.initProd(); break;
|
|
22
|
-
default: CommonEnvironmentHelper.initDev(); break;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
static initDev = () => {
|
|
27
|
-
this.initStaging(); //Use staging values for anything not provided
|
|
28
|
-
CommonEnvironmentHelper.AttendanceApi = process.env.REACT_APP_ATTENDANCE_API || process.env.NEXT_PUBLIC_ATTENDANCE_API || CommonEnvironmentHelper.AttendanceApi;
|
|
29
|
-
CommonEnvironmentHelper.DoingApi = process.env.REACT_APP_DOING_API || process.env.NEXT_PUBLIC_DOING_API || CommonEnvironmentHelper.DoingApi;
|
|
30
|
-
CommonEnvironmentHelper.GivingApi = process.env.REACT_APP_GIVING_API || process.env.NEXT_PUBLIC_GIVING_API || CommonEnvironmentHelper.GivingApi;
|
|
31
|
-
CommonEnvironmentHelper.MembershipApi = process.env.REACT_APP_MEMBERSHIP_API || process.env.NEXT_PUBLIC_MEMBERSHIP_API || CommonEnvironmentHelper.MembershipApi;
|
|
32
|
-
CommonEnvironmentHelper.ReportingApi = process.env.REACT_APP_REPORTING_API || process.env.NEXT_PUBLIC_REPORTING_API || CommonEnvironmentHelper.ReportingApi;
|
|
33
|
-
CommonEnvironmentHelper.MessagingApi = process.env.REACT_APP_MESSAGING_API || process.env.NEXT_PUBLIC_MESSAGING_API || CommonEnvironmentHelper.MessagingApi;
|
|
34
|
-
CommonEnvironmentHelper.MessagingApiSocket = process.env.REACT_APP_MESSAGING_API_SOCKET || process.env.NEXT_PUBLIC_MESSAGING_API_SOCKET || CommonEnvironmentHelper.MessagingApiSocket;
|
|
35
|
-
CommonEnvironmentHelper.ContentApi = process.env.REACT_APP_CONTENT_API || process.env.NEXT_PUBLIC_CONTENT_API || CommonEnvironmentHelper.ContentApi;
|
|
36
|
-
CommonEnvironmentHelper.GoogleAnalyticsTag = process.env.REACT_APP_GOOGLE_ANALYTICS || process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS || CommonEnvironmentHelper.GoogleAnalyticsTag;
|
|
37
|
-
|
|
38
|
-
CommonEnvironmentHelper.ContentRoot = process.env.REACT_APP_CONTENT_ROOT || process.env.NEXT_PUBLIC_CONTENT_ROOT || CommonEnvironmentHelper.ContentRoot;
|
|
39
|
-
CommonEnvironmentHelper.B1Root = process.env.REACT_APP_B1_ROOT || process.env.NEXT_PUBLIC_B1_ROOT || CommonEnvironmentHelper.B1Root;
|
|
40
|
-
CommonEnvironmentHelper.ChumsRoot = process.env.REACT_APP_CHUMS_ROOT || process.env.NEXT_PUBLIC_CHUMS_ROOT || CommonEnvironmentHelper.ChumsRoot;
|
|
41
|
-
CommonEnvironmentHelper.LessonsRoot = process.env.REACT_APP_LESSONS_ROOT || process.env.NEXT_PUBLIC_LESSONS_ROOT || CommonEnvironmentHelper.LessonsRoot;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
//NOTE: None of these values are secret.
|
|
45
|
-
static initStaging = () => {
|
|
46
|
-
CommonEnvironmentHelper.AttendanceApi = "https://attendanceapi.staging.churchapps.org";
|
|
47
|
-
CommonEnvironmentHelper.DoingApi = "https://doingapi.staging.churchapps.org";
|
|
48
|
-
CommonEnvironmentHelper.GivingApi = "https://givingapi.staging.churchapps.org";
|
|
49
|
-
CommonEnvironmentHelper.MembershipApi = "https://membershipapi.staging.churchapps.org";
|
|
50
|
-
CommonEnvironmentHelper.ReportingApi = "https://reportingapi.staging.churchapps.org";
|
|
51
|
-
CommonEnvironmentHelper.MessagingApi = "https://messagingapi.staging.churchapps.org";
|
|
52
|
-
CommonEnvironmentHelper.MessagingApiSocket = "wss://socket.staging.churchapps.org";
|
|
53
|
-
CommonEnvironmentHelper.ContentApi = "https://contentapi.staging.churchapps.org";
|
|
54
|
-
CommonEnvironmentHelper.GoogleAnalyticsTag = "";
|
|
55
|
-
|
|
56
|
-
CommonEnvironmentHelper.ContentRoot = "https://content.staging.churchapps.org";
|
|
57
|
-
CommonEnvironmentHelper.B1Root = "https://{key}.staging.b1.church";
|
|
58
|
-
CommonEnvironmentHelper.ChumsRoot = "https://app.staging.chums.org";
|
|
59
|
-
CommonEnvironmentHelper.LessonsRoot = "https://staging.lessons.church";
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
//NOTE: None of these values are secret.
|
|
63
|
-
static initProd = () => {
|
|
64
|
-
CommonEnvironmentHelper.AttendanceApi = "https://attendanceapi.churchapps.org";
|
|
65
|
-
CommonEnvironmentHelper.DoingApi = "https://doingapi.churchapps.org";
|
|
66
|
-
CommonEnvironmentHelper.GivingApi = "https://givingapi.churchapps.org";
|
|
67
|
-
CommonEnvironmentHelper.MembershipApi = "https://membershipapi.churchapps.org";
|
|
68
|
-
CommonEnvironmentHelper.ReportingApi = "https://reportingapi.churchapps.org";
|
|
69
|
-
CommonEnvironmentHelper.MessagingApi = "https://messagingapi.churchapps.org";
|
|
70
|
-
CommonEnvironmentHelper.MessagingApiSocket = "wss://socket.churchapps.org";
|
|
71
|
-
CommonEnvironmentHelper.ContentApi = "https://contentapi.churchapps.org";
|
|
72
|
-
|
|
73
|
-
CommonEnvironmentHelper.ContentRoot = "https://content.churchapps.org";
|
|
74
|
-
CommonEnvironmentHelper.B1Root = "https://{key}.b1.church";
|
|
75
|
-
CommonEnvironmentHelper.ChumsRoot = "https://app.chums.org";
|
|
76
|
-
CommonEnvironmentHelper.LessonsRoot = "https://lessons.church";
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
1
|
+
|
|
2
|
+
export class CommonEnvironmentHelper {
|
|
3
|
+
public static AttendanceApi = "";
|
|
4
|
+
public static DoingApi = "";
|
|
5
|
+
public static GivingApi = "";
|
|
6
|
+
public static MembershipApi = "";
|
|
7
|
+
public static ReportingApi = "";
|
|
8
|
+
public static MessagingApi = "";
|
|
9
|
+
public static MessagingApiSocket = "";
|
|
10
|
+
public static ContentApi = "";
|
|
11
|
+
public static GoogleAnalyticsTag = "";
|
|
12
|
+
|
|
13
|
+
static ContentRoot = "";
|
|
14
|
+
static B1Root = "";
|
|
15
|
+
static ChumsRoot = "";
|
|
16
|
+
static LessonsRoot = "";
|
|
17
|
+
|
|
18
|
+
static init = (stage: string) => {
|
|
19
|
+
switch (stage) {
|
|
20
|
+
case "staging": CommonEnvironmentHelper.initStaging(); break;
|
|
21
|
+
case "prod": CommonEnvironmentHelper.initProd(); break;
|
|
22
|
+
default: CommonEnvironmentHelper.initDev(); break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static initDev = () => {
|
|
27
|
+
this.initStaging(); //Use staging values for anything not provided
|
|
28
|
+
CommonEnvironmentHelper.AttendanceApi = process.env.REACT_APP_ATTENDANCE_API || process.env.NEXT_PUBLIC_ATTENDANCE_API || CommonEnvironmentHelper.AttendanceApi;
|
|
29
|
+
CommonEnvironmentHelper.DoingApi = process.env.REACT_APP_DOING_API || process.env.NEXT_PUBLIC_DOING_API || CommonEnvironmentHelper.DoingApi;
|
|
30
|
+
CommonEnvironmentHelper.GivingApi = process.env.REACT_APP_GIVING_API || process.env.NEXT_PUBLIC_GIVING_API || CommonEnvironmentHelper.GivingApi;
|
|
31
|
+
CommonEnvironmentHelper.MembershipApi = process.env.REACT_APP_MEMBERSHIP_API || process.env.NEXT_PUBLIC_MEMBERSHIP_API || CommonEnvironmentHelper.MembershipApi;
|
|
32
|
+
CommonEnvironmentHelper.ReportingApi = process.env.REACT_APP_REPORTING_API || process.env.NEXT_PUBLIC_REPORTING_API || CommonEnvironmentHelper.ReportingApi;
|
|
33
|
+
CommonEnvironmentHelper.MessagingApi = process.env.REACT_APP_MESSAGING_API || process.env.NEXT_PUBLIC_MESSAGING_API || CommonEnvironmentHelper.MessagingApi;
|
|
34
|
+
CommonEnvironmentHelper.MessagingApiSocket = process.env.REACT_APP_MESSAGING_API_SOCKET || process.env.NEXT_PUBLIC_MESSAGING_API_SOCKET || CommonEnvironmentHelper.MessagingApiSocket;
|
|
35
|
+
CommonEnvironmentHelper.ContentApi = process.env.REACT_APP_CONTENT_API || process.env.NEXT_PUBLIC_CONTENT_API || CommonEnvironmentHelper.ContentApi;
|
|
36
|
+
CommonEnvironmentHelper.GoogleAnalyticsTag = process.env.REACT_APP_GOOGLE_ANALYTICS || process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS || CommonEnvironmentHelper.GoogleAnalyticsTag;
|
|
37
|
+
|
|
38
|
+
CommonEnvironmentHelper.ContentRoot = process.env.REACT_APP_CONTENT_ROOT || process.env.NEXT_PUBLIC_CONTENT_ROOT || CommonEnvironmentHelper.ContentRoot;
|
|
39
|
+
CommonEnvironmentHelper.B1Root = process.env.REACT_APP_B1_ROOT || process.env.NEXT_PUBLIC_B1_ROOT || CommonEnvironmentHelper.B1Root;
|
|
40
|
+
CommonEnvironmentHelper.ChumsRoot = process.env.REACT_APP_CHUMS_ROOT || process.env.NEXT_PUBLIC_CHUMS_ROOT || CommonEnvironmentHelper.ChumsRoot;
|
|
41
|
+
CommonEnvironmentHelper.LessonsRoot = process.env.REACT_APP_LESSONS_ROOT || process.env.NEXT_PUBLIC_LESSONS_ROOT || CommonEnvironmentHelper.LessonsRoot;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//NOTE: None of these values are secret.
|
|
45
|
+
static initStaging = () => {
|
|
46
|
+
CommonEnvironmentHelper.AttendanceApi = "https://attendanceapi.staging.churchapps.org";
|
|
47
|
+
CommonEnvironmentHelper.DoingApi = "https://doingapi.staging.churchapps.org";
|
|
48
|
+
CommonEnvironmentHelper.GivingApi = "https://givingapi.staging.churchapps.org";
|
|
49
|
+
CommonEnvironmentHelper.MembershipApi = "https://membershipapi.staging.churchapps.org";
|
|
50
|
+
CommonEnvironmentHelper.ReportingApi = "https://reportingapi.staging.churchapps.org";
|
|
51
|
+
CommonEnvironmentHelper.MessagingApi = "https://messagingapi.staging.churchapps.org";
|
|
52
|
+
CommonEnvironmentHelper.MessagingApiSocket = "wss://socket.staging.churchapps.org";
|
|
53
|
+
CommonEnvironmentHelper.ContentApi = "https://contentapi.staging.churchapps.org";
|
|
54
|
+
CommonEnvironmentHelper.GoogleAnalyticsTag = "";
|
|
55
|
+
|
|
56
|
+
CommonEnvironmentHelper.ContentRoot = "https://content.staging.churchapps.org";
|
|
57
|
+
CommonEnvironmentHelper.B1Root = "https://{key}.staging.b1.church";
|
|
58
|
+
CommonEnvironmentHelper.ChumsRoot = "https://app.staging.chums.org";
|
|
59
|
+
CommonEnvironmentHelper.LessonsRoot = "https://staging.lessons.church";
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//NOTE: None of these values are secret.
|
|
63
|
+
static initProd = () => {
|
|
64
|
+
CommonEnvironmentHelper.AttendanceApi = "https://attendanceapi.churchapps.org";
|
|
65
|
+
CommonEnvironmentHelper.DoingApi = "https://doingapi.churchapps.org";
|
|
66
|
+
CommonEnvironmentHelper.GivingApi = "https://givingapi.churchapps.org";
|
|
67
|
+
CommonEnvironmentHelper.MembershipApi = "https://membershipapi.churchapps.org";
|
|
68
|
+
CommonEnvironmentHelper.ReportingApi = "https://reportingapi.churchapps.org";
|
|
69
|
+
CommonEnvironmentHelper.MessagingApi = "https://messagingapi.churchapps.org";
|
|
70
|
+
CommonEnvironmentHelper.MessagingApiSocket = "wss://socket.churchapps.org";
|
|
71
|
+
CommonEnvironmentHelper.ContentApi = "https://contentapi.churchapps.org";
|
|
72
|
+
|
|
73
|
+
CommonEnvironmentHelper.ContentRoot = "https://content.churchapps.org";
|
|
74
|
+
CommonEnvironmentHelper.B1Root = "https://{key}.b1.church";
|
|
75
|
+
CommonEnvironmentHelper.ChumsRoot = "https://app.chums.org";
|
|
76
|
+
CommonEnvironmentHelper.LessonsRoot = "https://lessons.church";
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export class CurrencyHelper {
|
|
2
|
-
static formatCurrency(amount: number) {
|
|
3
|
-
const formatter = new Intl.NumberFormat("en-US", {
|
|
4
|
-
style: "currency",
|
|
5
|
-
currency: "USD",
|
|
6
|
-
minimumFractionDigits: 2
|
|
7
|
-
});
|
|
8
|
-
return formatter.format(amount);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
1
|
+
export class CurrencyHelper {
|
|
2
|
+
static formatCurrency(amount: number) {
|
|
3
|
+
const formatter = new Intl.NumberFormat("en-US", {
|
|
4
|
+
style: "currency",
|
|
5
|
+
currency: "USD",
|
|
6
|
+
minimumFractionDigits: 2
|
|
7
|
+
});
|
|
8
|
+
return formatter.format(amount);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
import { format as dateFormat } from "date-fns"
|
|
2
|
-
|
|
3
|
-
export class DateHelper {
|
|
4
|
-
|
|
5
|
-
//Fixes timezone issues when you just need the date.
|
|
6
|
-
static toDate(input: any) {
|
|
7
|
-
return new Date(Date.parse(input.toString().replace("Z", "")));
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
static toDateTime(input: any) {
|
|
11
|
-
return new Date(Date.parse(input.toString()));
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
//obsolete. Do not use
|
|
15
|
-
static convertToDate(input: any) {
|
|
16
|
-
return this.toDateTime(input);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static addDays(date: Date, days: number) {
|
|
20
|
-
date.setDate(date.getDate() + days);
|
|
21
|
-
return date;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
static prettyDate(date: Date) {
|
|
25
|
-
if (date === undefined || date === null) return "";
|
|
26
|
-
return this.formatDateTime(date, "MMM d, yyyy");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static prettyDateTime(date: Date) {
|
|
30
|
-
if (date === undefined || date === null) return "";
|
|
31
|
-
return this.formatDateTime(date, "MMM d, yyyy h:mm a");
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
static prettyTime(date: Date) {
|
|
35
|
-
if (date === undefined || date === null) return "";
|
|
36
|
-
return this.formatDateTime(date, "h:mm a");
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
static getLastSunday() {
|
|
40
|
-
let result = new Date();
|
|
41
|
-
while (result.getDay() !== 0) result.setDate(result.getDate() - 1);
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
static getWeekSunday(year: number, week: number) {
|
|
46
|
-
let result = new Date(year, 0, 1);
|
|
47
|
-
while (result.getDay() !== 0) result.setDate(result.getDate() + 1);
|
|
48
|
-
result.setDate(result.getDate() + ((week - 1) * 7));
|
|
49
|
-
return result;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
static formatHtml5Date(date: Date): string {
|
|
53
|
-
let result = "";
|
|
54
|
-
if (date !== undefined && date !== null) {
|
|
55
|
-
try {
|
|
56
|
-
result = new Date(date).toISOString().split("T")[0];
|
|
57
|
-
} catch { }
|
|
58
|
-
}
|
|
59
|
-
return result;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
static formatHtml5Time(time: Date): string {
|
|
63
|
-
let h = time.getHours();
|
|
64
|
-
let m = time.getMinutes();
|
|
65
|
-
let s = time.getSeconds();
|
|
66
|
-
return `${h < 10 ? ("0" + h) : h}:${m < 10 ? ("0" + m) : m}:${s < 10 ? ("0" + s) : s}`;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
static formatHtml5DateTime(date: Date): string {
|
|
70
|
-
if (date === undefined || date === null) return "";
|
|
71
|
-
else {
|
|
72
|
-
return this.formatDateTime(date, "yyyy-MM-dd") + "T" + this.formatDateTime(date, "HH:mm");
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
static getDisplayDuration(d: Date): string {
|
|
77
|
-
let seconds = Math.round((new Date().getTime() - d.getTime()) / 1000);
|
|
78
|
-
if (seconds > 86400) {
|
|
79
|
-
let days = Math.floor(seconds / 86400);
|
|
80
|
-
return (days === 1) ? "1d" : days.toString() + "d";
|
|
81
|
-
}
|
|
82
|
-
else if (seconds > 3600) {
|
|
83
|
-
let hours = Math.floor(seconds / 3600);
|
|
84
|
-
return (hours === 1) ? "1h" : hours.toString() + "h";
|
|
85
|
-
}
|
|
86
|
-
else if (seconds > 60) {
|
|
87
|
-
let minutes = Math.floor(seconds / 60);
|
|
88
|
-
return (minutes === 1) ? "1m" : minutes.toString() + "m";
|
|
89
|
-
}
|
|
90
|
-
else return (seconds === 1) ? "1s" : Math.floor(seconds).toString() + "s";
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
static getShortDate(d: Date): string {
|
|
94
|
-
return (d.getMonth() + 1).toString() + "/" + (d.getDate()).toString() + "/" + d.getFullYear().toString();
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
static convertDatePickerFormat(d: Date): Date {
|
|
98
|
-
const date = this.formatHtml5Date(d).split("-");
|
|
99
|
-
if (date.length === 3) return new Date(`${date[1]}-${date[2]}-${date[0]}`);
|
|
100
|
-
return new Date();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
private static formatDateTime(date: Date, format: string) {
|
|
104
|
-
try {
|
|
105
|
-
return dateFormat(date, format);
|
|
106
|
-
} catch { return ""; }
|
|
107
|
-
}
|
|
108
|
-
}
|
|
1
|
+
import { format as dateFormat } from "date-fns"
|
|
2
|
+
|
|
3
|
+
export class DateHelper {
|
|
4
|
+
|
|
5
|
+
//Fixes timezone issues when you just need the date.
|
|
6
|
+
static toDate(input: any) {
|
|
7
|
+
return new Date(Date.parse(input.toString().replace("Z", "")));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static toDateTime(input: any) {
|
|
11
|
+
return new Date(Date.parse(input.toString()));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//obsolete. Do not use
|
|
15
|
+
static convertToDate(input: any) {
|
|
16
|
+
return this.toDateTime(input);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static addDays(date: Date, days: number) {
|
|
20
|
+
date.setDate(date.getDate() + days);
|
|
21
|
+
return date;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static prettyDate(date: Date) {
|
|
25
|
+
if (date === undefined || date === null) return "";
|
|
26
|
+
return this.formatDateTime(date, "MMM d, yyyy");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static prettyDateTime(date: Date) {
|
|
30
|
+
if (date === undefined || date === null) return "";
|
|
31
|
+
return this.formatDateTime(date, "MMM d, yyyy h:mm a");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static prettyTime(date: Date) {
|
|
35
|
+
if (date === undefined || date === null) return "";
|
|
36
|
+
return this.formatDateTime(date, "h:mm a");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static getLastSunday() {
|
|
40
|
+
let result = new Date();
|
|
41
|
+
while (result.getDay() !== 0) result.setDate(result.getDate() - 1);
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static getWeekSunday(year: number, week: number) {
|
|
46
|
+
let result = new Date(year, 0, 1);
|
|
47
|
+
while (result.getDay() !== 0) result.setDate(result.getDate() + 1);
|
|
48
|
+
result.setDate(result.getDate() + ((week - 1) * 7));
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static formatHtml5Date(date: Date): string {
|
|
53
|
+
let result = "";
|
|
54
|
+
if (date !== undefined && date !== null) {
|
|
55
|
+
try {
|
|
56
|
+
result = new Date(date).toISOString().split("T")[0];
|
|
57
|
+
} catch { }
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static formatHtml5Time(time: Date): string {
|
|
63
|
+
let h = time.getHours();
|
|
64
|
+
let m = time.getMinutes();
|
|
65
|
+
let s = time.getSeconds();
|
|
66
|
+
return `${h < 10 ? ("0" + h) : h}:${m < 10 ? ("0" + m) : m}:${s < 10 ? ("0" + s) : s}`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static formatHtml5DateTime(date: Date): string {
|
|
70
|
+
if (date === undefined || date === null) return "";
|
|
71
|
+
else {
|
|
72
|
+
return this.formatDateTime(date, "yyyy-MM-dd") + "T" + this.formatDateTime(date, "HH:mm");
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
static getDisplayDuration(d: Date): string {
|
|
77
|
+
let seconds = Math.round((new Date().getTime() - d.getTime()) / 1000);
|
|
78
|
+
if (seconds > 86400) {
|
|
79
|
+
let days = Math.floor(seconds / 86400);
|
|
80
|
+
return (days === 1) ? "1d" : days.toString() + "d";
|
|
81
|
+
}
|
|
82
|
+
else if (seconds > 3600) {
|
|
83
|
+
let hours = Math.floor(seconds / 3600);
|
|
84
|
+
return (hours === 1) ? "1h" : hours.toString() + "h";
|
|
85
|
+
}
|
|
86
|
+
else if (seconds > 60) {
|
|
87
|
+
let minutes = Math.floor(seconds / 60);
|
|
88
|
+
return (minutes === 1) ? "1m" : minutes.toString() + "m";
|
|
89
|
+
}
|
|
90
|
+
else return (seconds === 1) ? "1s" : Math.floor(seconds).toString() + "s";
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static getShortDate(d: Date): string {
|
|
94
|
+
return (d.getMonth() + 1).toString() + "/" + (d.getDate()).toString() + "/" + d.getFullYear().toString();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
static convertDatePickerFormat(d: Date): Date {
|
|
98
|
+
const date = this.formatHtml5Date(d).split("-");
|
|
99
|
+
if (date.length === 3) return new Date(`${date[1]}-${date[2]}-${date[0]}`);
|
|
100
|
+
return new Date();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
private static formatDateTime(date: Date, format: string) {
|
|
104
|
+
try {
|
|
105
|
+
return dateFormat(date, format);
|
|
106
|
+
} catch { return ""; }
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
export class DonationHelper {
|
|
2
|
-
|
|
3
|
-
static getInterval(intervalName:string) {
|
|
4
|
-
let intervalCount = 1;
|
|
5
|
-
let intervalType = "month";
|
|
6
|
-
let parts = intervalName.split("_");
|
|
7
|
-
if (parts.length === 2) {
|
|
8
|
-
switch (parts[0])
|
|
9
|
-
{
|
|
10
|
-
case "two": intervalCount = 2; break;
|
|
11
|
-
case "three": intervalCount = 3; break;
|
|
12
|
-
}
|
|
13
|
-
intervalType = parts[1];
|
|
14
|
-
}
|
|
15
|
-
let result = { interval_count: intervalCount, interval: intervalType };
|
|
16
|
-
return result;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static getIntervalKeyName(intervalCount: number, intervalType: string) {
|
|
20
|
-
let firstPart = "one";
|
|
21
|
-
if (intervalCount === 2) firstPart = "two";
|
|
22
|
-
else if (intervalCount === 3) firstPart = "three";
|
|
23
|
-
return firstPart + "_" + intervalType;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
}
|
|
1
|
+
export class DonationHelper {
|
|
2
|
+
|
|
3
|
+
static getInterval(intervalName:string) {
|
|
4
|
+
let intervalCount = 1;
|
|
5
|
+
let intervalType = "month";
|
|
6
|
+
let parts = intervalName.split("_");
|
|
7
|
+
if (parts.length === 2) {
|
|
8
|
+
switch (parts[0])
|
|
9
|
+
{
|
|
10
|
+
case "two": intervalCount = 2; break;
|
|
11
|
+
case "three": intervalCount = 3; break;
|
|
12
|
+
}
|
|
13
|
+
intervalType = parts[1];
|
|
14
|
+
}
|
|
15
|
+
let result = { interval_count: intervalCount, interval: intervalType };
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static getIntervalKeyName(intervalCount: number, intervalType: string) {
|
|
20
|
+
let firstPart = "one";
|
|
21
|
+
if (intervalCount === 2) firstPart = "two";
|
|
22
|
+
else if (intervalCount === 3) firstPart = "three";
|
|
23
|
+
return firstPart + "_" + intervalType;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { ErrorLogInterface, ErrrorAppDataInterface } from "../interfaces/Error";
|
|
2
|
-
import { ApiHelper } from "./ApiHelper";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export class ErrorHelper {
|
|
6
|
-
|
|
7
|
-
static getAppData:() => { churchId: string, userId: string, originUrl: string, application: string};
|
|
8
|
-
static customErrorHandler:(errorLog:ErrorLogInterface) => void;
|
|
9
|
-
|
|
10
|
-
static init = (getAppData:() => ErrrorAppDataInterface, customErrorHandler:(errorLog:ErrorLogInterface) => void) => {
|
|
11
|
-
ErrorHelper.getAppData = getAppData;
|
|
12
|
-
ErrorHelper.customErrorHandler = customErrorHandler;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
static logError = (errorType:string, message:string, details:string) => {
|
|
16
|
-
if (this.getAppData)
|
|
17
|
-
{
|
|
18
|
-
const data = this.getAppData();
|
|
19
|
-
const log:ErrorLogInterface = {
|
|
20
|
-
application: data.application,
|
|
21
|
-
errorTime: new Date(),
|
|
22
|
-
userId: data.userId,
|
|
23
|
-
churchId: data.churchId,
|
|
24
|
-
originUrl: data.originUrl,
|
|
25
|
-
errorType: errorType,
|
|
26
|
-
message: message,
|
|
27
|
-
details: details
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (log.errorType==="401" && log.message.indexOf("/users/login")===-1) return;
|
|
31
|
-
ApiHelper.postAnonymous("/errors", [log], "MembershipApi");
|
|
32
|
-
if (ErrorHelper.customErrorHandler) ErrorHelper.customErrorHandler(log);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|
|
1
|
+
import { ErrorLogInterface, ErrrorAppDataInterface } from "../interfaces/Error";
|
|
2
|
+
import { ApiHelper } from "./ApiHelper";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export class ErrorHelper {
|
|
6
|
+
|
|
7
|
+
static getAppData:() => { churchId: string, userId: string, originUrl: string, application: string};
|
|
8
|
+
static customErrorHandler:(errorLog:ErrorLogInterface) => void;
|
|
9
|
+
|
|
10
|
+
static init = (getAppData:() => ErrrorAppDataInterface, customErrorHandler:(errorLog:ErrorLogInterface) => void) => {
|
|
11
|
+
ErrorHelper.getAppData = getAppData;
|
|
12
|
+
ErrorHelper.customErrorHandler = customErrorHandler;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static logError = (errorType:string, message:string, details:string) => {
|
|
16
|
+
if (this.getAppData)
|
|
17
|
+
{
|
|
18
|
+
const data = this.getAppData();
|
|
19
|
+
const log:ErrorLogInterface = {
|
|
20
|
+
application: data.application,
|
|
21
|
+
errorTime: new Date(),
|
|
22
|
+
userId: data.userId,
|
|
23
|
+
churchId: data.churchId,
|
|
24
|
+
originUrl: data.originUrl,
|
|
25
|
+
errorType: errorType,
|
|
26
|
+
message: message,
|
|
27
|
+
details: details
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (log.errorType==="401" && log.message.indexOf("/users/login")===-1) return;
|
|
31
|
+
ApiHelper.postAnonymous("/errors", [log], "MembershipApi");
|
|
32
|
+
if (ErrorHelper.customErrorHandler) ErrorHelper.customErrorHandler(log);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
}
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { EventInterface } from "../interfaces";
|
|
2
|
-
import { RRule, datetime } from "rrule";
|
|
3
|
-
import { ParsedOptions } from "rrule/dist/esm/types";
|
|
4
|
-
|
|
5
|
-
export class EventHelper {
|
|
6
|
-
|
|
7
|
-
static getRange = (event:EventInterface, startDate:Date, endDate:Date) => {
|
|
8
|
-
const start = new Date(event.start);
|
|
9
|
-
const rrule = EventHelper.getFullRRule(event);
|
|
10
|
-
|
|
11
|
-
const dates = rrule.between(startDate, endDate);
|
|
12
|
-
|
|
13
|
-
dates.forEach(d => {
|
|
14
|
-
d.setHours(start.getHours());
|
|
15
|
-
d.setMinutes(start.getMinutes());
|
|
16
|
-
d.setSeconds(start.getSeconds());
|
|
17
|
-
})
|
|
18
|
-
return dates;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
static getFullRRule = (event:EventInterface) => {
|
|
22
|
-
let rrule = RRule.fromString(event.recurrenceRule);
|
|
23
|
-
rrule.options.dtstart = new Date(event.start);
|
|
24
|
-
console.log("START", rrule.options.dtstart, event.start, rrule)
|
|
25
|
-
return rrule;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static removeExcludeDates = (events:EventInterface[]) => {
|
|
29
|
-
for (let i=events.length-1; i>=0; i--) {
|
|
30
|
-
if (events[i].exceptionDates?.length>0)
|
|
31
|
-
{
|
|
32
|
-
const parsedDates = events[i].exceptionDates.map(d=>new Date(d).toISOString());
|
|
33
|
-
//console.log("Compare", events[i].start.toISOString(), parsedDates, parsedDates.indexOf(events[i].start.toISOString()));
|
|
34
|
-
if (parsedDates.indexOf(events[i].start.toISOString())>-1) events.splice(i,1);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
static getPartialRRuleString = (options:ParsedOptions) => {
|
|
40
|
-
const parts = new RRule(options).toString().split("RRULE:");
|
|
41
|
-
const result = parts.length===2 ? parts[1] : "";
|
|
42
|
-
console.log("getPartialRRuleString", options, new RRule(options).toString(), result);
|
|
43
|
-
return result;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
static cleanRule = (options:ParsedOptions) => {
|
|
47
|
-
options.byhour = undefined;
|
|
48
|
-
options.byminute = undefined;
|
|
49
|
-
options.bysecond = undefined;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
}
|
|
1
|
+
import { EventInterface } from "../interfaces";
|
|
2
|
+
import { RRule, datetime } from "rrule";
|
|
3
|
+
import { ParsedOptions } from "rrule/dist/esm/types";
|
|
4
|
+
|
|
5
|
+
export class EventHelper {
|
|
6
|
+
|
|
7
|
+
static getRange = (event:EventInterface, startDate:Date, endDate:Date) => {
|
|
8
|
+
const start = new Date(event.start);
|
|
9
|
+
const rrule = EventHelper.getFullRRule(event);
|
|
10
|
+
|
|
11
|
+
const dates = rrule.between(startDate, endDate);
|
|
12
|
+
|
|
13
|
+
dates.forEach(d => {
|
|
14
|
+
d.setHours(start.getHours());
|
|
15
|
+
d.setMinutes(start.getMinutes());
|
|
16
|
+
d.setSeconds(start.getSeconds());
|
|
17
|
+
})
|
|
18
|
+
return dates;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static getFullRRule = (event:EventInterface) => {
|
|
22
|
+
let rrule = RRule.fromString(event.recurrenceRule);
|
|
23
|
+
rrule.options.dtstart = new Date(event.start);
|
|
24
|
+
console.log("START", rrule.options.dtstart, event.start, rrule)
|
|
25
|
+
return rrule;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static removeExcludeDates = (events:EventInterface[]) => {
|
|
29
|
+
for (let i=events.length-1; i>=0; i--) {
|
|
30
|
+
if (events[i].exceptionDates?.length>0)
|
|
31
|
+
{
|
|
32
|
+
const parsedDates = events[i].exceptionDates.map(d=>new Date(d).toISOString());
|
|
33
|
+
//console.log("Compare", events[i].start.toISOString(), parsedDates, parsedDates.indexOf(events[i].start.toISOString()));
|
|
34
|
+
if (parsedDates.indexOf(events[i].start.toISOString())>-1) events.splice(i,1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static getPartialRRuleString = (options:ParsedOptions) => {
|
|
40
|
+
const parts = new RRule(options).toString().split("RRULE:");
|
|
41
|
+
const result = parts.length===2 ? parts[1] : "";
|
|
42
|
+
console.log("getPartialRRuleString", options, new RRule(options).toString(), result);
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static cleanRule = (options:ParsedOptions) => {
|
|
47
|
+
options.byhour = undefined;
|
|
48
|
+
options.byminute = undefined;
|
|
49
|
+
options.bysecond = undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|