@churchapps/apphelper 0.4.49 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/FormCardPayment.d.ts +1 -1
- package/dist/components/FormCardPayment.d.ts.map +1 -1
- package/dist/components/FormCardPayment.js +27 -10
- package/dist/components/FormCardPayment.js.map +1 -1
- package/dist/components/Loading.js +36 -36
- package/dist/components/notes/Notes.js +27 -27
- package/dist/helpers/index.d.ts +1 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/index.js.map +1 -1
- package/dist/public/css/cropper.css +309 -309
- package/dist/public/css/styles.css +111 -111
- package/package.json +72 -73
- package/public/css/cropper.css +309 -309
- package/public/css/styles.css +111 -111
- package/public/locales/de.json +269 -269
- package/public/locales/en.json +276 -276
- package/public/locales/es.json +272 -272
- package/public/locales/fr.json +269 -269
- package/public/locales/hi.json +269 -269
- package/public/locales/it.json +269 -269
- package/public/locales/ko.json +269 -269
- package/public/locales/no.json +269 -269
- package/public/locales/pt.json +269 -269
- package/public/locales/ru.json +269 -269
- package/public/locales/tl.json +269 -269
- package/public/locales/zh.json +269 -269
- package/src/components/DisplayBox.tsx +83 -83
- package/src/components/ErrorMessages.tsx +28 -28
- package/src/components/ExportLink.tsx +81 -81
- package/src/components/FloatingSupport.tsx +18 -18
- package/src/components/FormCardPayment.tsx +184 -169
- package/src/components/FormSubmissionEdit.tsx +168 -168
- package/src/components/HelpIcon.tsx +12 -12
- package/src/components/ImageEditor.tsx +161 -161
- package/src/components/InputBox.tsx +96 -96
- package/src/components/Loading.tsx +77 -77
- package/src/components/PageHeader.tsx +110 -110
- package/src/components/PersonAvatar.tsx +77 -77
- package/src/components/QuestionEdit.tsx +99 -99
- package/src/components/SmallButton.tsx +42 -42
- package/src/components/SupportModal.tsx +32 -32
- package/src/components/TabPanel.tsx +28 -28
- package/src/components/gallery/GalleryModal.tsx +173 -173
- package/src/components/gallery/StockPhotos.tsx +95 -95
- package/src/components/gallery/index.ts +1 -1
- package/src/components/header/Banner.tsx +11 -11
- package/src/components/header/PrimaryMenu.tsx +100 -100
- package/src/components/header/SecondaryMenu.tsx +23 -23
- package/src/components/header/SecondaryMenuAlt.tsx +40 -40
- package/src/components/header/SiteHeader.tsx +207 -207
- package/src/components/header/SupportDrawer.tsx +111 -111
- package/src/components/header/index.tsx +2 -2
- package/src/components/index.tsx +20 -20
- package/src/components/notes/AddNote.tsx +180 -180
- package/src/components/notes/Note.tsx +68 -68
- package/src/components/notes/Notes.tsx +208 -208
- package/src/components/notes/index.ts +3 -3
- package/src/components/wrapper/AppList.tsx +19 -19
- package/src/components/wrapper/ChurchList.tsx +154 -154
- package/src/components/wrapper/NavItem.tsx +47 -47
- package/src/components/wrapper/NewPrivateMessage.tsx +253 -253
- package/src/components/wrapper/Notifications.tsx +223 -223
- package/src/components/wrapper/PrivateMessageDetails.tsx +112 -112
- package/src/components/wrapper/PrivateMessages.tsx +576 -576
- package/src/components/wrapper/UserMenu.tsx +383 -383
- package/src/components/wrapper/index.tsx +8 -8
- package/src/helpers/AnalyticsHelper.ts +32 -32
- package/src/helpers/AppearanceHelper.ts +73 -73
- package/src/helpers/ArrayHelper.ts +87 -87
- package/src/helpers/CurrencyHelper.ts +10 -10
- package/src/helpers/DateHelper.ts +104 -104
- package/src/helpers/ErrorHelper.ts +43 -43
- package/src/helpers/EventHelper.ts +49 -49
- package/src/helpers/FileHelper.ts +31 -31
- package/src/helpers/Locale.ts +457 -457
- package/src/helpers/NotificationService.ts +296 -296
- package/src/helpers/PersonHelper.ts +62 -62
- package/src/helpers/SlugHelper.ts +37 -37
- package/src/helpers/SocketHelper.ts +296 -296
- package/src/helpers/UniqueIdHelper.ts +36 -36
- package/src/helpers/UserHelper.ts +104 -104
- package/src/helpers/createEmotionCache.ts +17 -17
- package/src/helpers/index.ts +58 -50
- package/src/hooks/index.ts +3 -3
- package/src/hooks/useMountedState.ts +16 -16
- package/src/hooks/useNotifications.ts +93 -93
- package/src/index.ts +2 -2
- package/src/types/interface-extensions.d.ts +12 -0
- package/tsconfig.json +31 -31
- package/dist/public/locales/de.json +0 -270
- package/dist/public/locales/en.json +0 -277
- package/dist/public/locales/es.json +0 -272
- package/dist/public/locales/fr.json +0 -270
- package/dist/public/locales/hi.json +0 -270
- package/dist/public/locales/it.json +0 -270
- package/dist/public/locales/ko.json +0 -270
- package/dist/public/locales/no.json +0 -270
- package/dist/public/locales/pt.json +0 -270
- package/dist/public/locales/ru.json +0 -270
- package/dist/public/locales/tl.json +0 -270
- package/dist/public/locales/zh.json +0 -270
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { PersonInterface, ContactInfoInterface, CommonEnvironmentHelper } from "@churchapps/helpers";
|
|
2
|
-
import { Locale } from "./Locale";
|
|
3
|
-
|
|
4
|
-
export class PersonHelper {
|
|
5
|
-
|
|
6
|
-
static getPhotoUrl(person: PersonInterface) {
|
|
7
|
-
if (!person?.photo) return "/images/sample-profile.png"
|
|
8
|
-
else return (person?.photo?.startsWith("data:image/png;base64,") || person.photo?.indexOf("://") > -1)
|
|
9
|
-
? person.photo
|
|
10
|
-
: CommonEnvironmentHelper.ContentRoot + person.photo;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
static getAge(birthdate: Date): string {
|
|
14
|
-
if (birthdate !== undefined && birthdate !== null) {
|
|
15
|
-
let ageDifMs = Date.now() - new Date(birthdate).getTime();
|
|
16
|
-
let ageDate = new Date(ageDifMs);
|
|
17
|
-
let years = Math.abs(ageDate.getUTCFullYear() - 1970);
|
|
18
|
-
return years + " " + Locale.label("person.years");
|
|
19
|
-
}
|
|
20
|
-
else return "";
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static getDisplayName(firstName: string, lastName: string, nickName: string): string {
|
|
24
|
-
if (nickName !== undefined && nickName !== null && nickName.length > 0) return firstName + ' "' + nickName + '" ' + lastName;
|
|
25
|
-
else return firstName + " " + lastName;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public static compareAddress(address1: ContactInfoInterface, address2: ContactInfoInterface): boolean {
|
|
29
|
-
const displayAddress1: string = this.addressToString(address1).trim();
|
|
30
|
-
const displayAddress2: string = this.addressToString(address2).trim();
|
|
31
|
-
|
|
32
|
-
if (displayAddress1 !== displayAddress2) {
|
|
33
|
-
return true
|
|
34
|
-
}
|
|
35
|
-
return false
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public static addressToString(address: ContactInfoInterface): string {
|
|
39
|
-
return `${address.address1 || ""} ${address.address2 || ""} ${address.city || ""}${(address.city && address.state) ? "," : ""} ${address.state || ""} ${address.zip || ""}`
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public static changeOnlyAddress(contactInfo1: ContactInfoInterface, contactInfo2: ContactInfoInterface): ContactInfoInterface {
|
|
43
|
-
const updatedAddress: ContactInfoInterface = {
|
|
44
|
-
...contactInfo1,
|
|
45
|
-
address1: contactInfo2.address1,
|
|
46
|
-
address2: contactInfo2.address2,
|
|
47
|
-
city: contactInfo2.city,
|
|
48
|
-
state: contactInfo2.state,
|
|
49
|
-
zip: contactInfo2.zip
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return updatedAddress
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public static checkAddressAvailabilty(person: PersonInterface): boolean {
|
|
56
|
-
const addressString: string = this.addressToString(person.contactInfo).trim();
|
|
57
|
-
if (addressString !== "") {
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
1
|
+
import { PersonInterface, ContactInfoInterface, CommonEnvironmentHelper } from "@churchapps/helpers";
|
|
2
|
+
import { Locale } from "./Locale";
|
|
3
|
+
|
|
4
|
+
export class PersonHelper {
|
|
5
|
+
|
|
6
|
+
static getPhotoUrl(person: PersonInterface) {
|
|
7
|
+
if (!person?.photo) return "/images/sample-profile.png"
|
|
8
|
+
else return (person?.photo?.startsWith("data:image/png;base64,") || person.photo?.indexOf("://") > -1)
|
|
9
|
+
? person.photo
|
|
10
|
+
: CommonEnvironmentHelper.ContentRoot + person.photo;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static getAge(birthdate: Date): string {
|
|
14
|
+
if (birthdate !== undefined && birthdate !== null) {
|
|
15
|
+
let ageDifMs = Date.now() - new Date(birthdate).getTime();
|
|
16
|
+
let ageDate = new Date(ageDifMs);
|
|
17
|
+
let years = Math.abs(ageDate.getUTCFullYear() - 1970);
|
|
18
|
+
return years + " " + Locale.label("person.years");
|
|
19
|
+
}
|
|
20
|
+
else return "";
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static getDisplayName(firstName: string, lastName: string, nickName: string): string {
|
|
24
|
+
if (nickName !== undefined && nickName !== null && nickName.length > 0) return firstName + ' "' + nickName + '" ' + lastName;
|
|
25
|
+
else return firstName + " " + lastName;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public static compareAddress(address1: ContactInfoInterface, address2: ContactInfoInterface): boolean {
|
|
29
|
+
const displayAddress1: string = this.addressToString(address1).trim();
|
|
30
|
+
const displayAddress2: string = this.addressToString(address2).trim();
|
|
31
|
+
|
|
32
|
+
if (displayAddress1 !== displayAddress2) {
|
|
33
|
+
return true
|
|
34
|
+
}
|
|
35
|
+
return false
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public static addressToString(address: ContactInfoInterface): string {
|
|
39
|
+
return `${address.address1 || ""} ${address.address2 || ""} ${address.city || ""}${(address.city && address.state) ? "," : ""} ${address.state || ""} ${address.zip || ""}`
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public static changeOnlyAddress(contactInfo1: ContactInfoInterface, contactInfo2: ContactInfoInterface): ContactInfoInterface {
|
|
43
|
+
const updatedAddress: ContactInfoInterface = {
|
|
44
|
+
...contactInfo1,
|
|
45
|
+
address1: contactInfo2.address1,
|
|
46
|
+
address2: contactInfo2.address2,
|
|
47
|
+
city: contactInfo2.city,
|
|
48
|
+
state: contactInfo2.state,
|
|
49
|
+
zip: contactInfo2.zip
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return updatedAddress
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public static checkAddressAvailabilty(person: PersonInterface): boolean {
|
|
56
|
+
const addressString: string = this.addressToString(person.contactInfo).trim();
|
|
57
|
+
if (addressString !== "") {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import slug from "slug";
|
|
2
|
-
|
|
3
|
-
export class SlugHelper {
|
|
4
|
-
|
|
5
|
-
static slugifyString(string: string, type: "urlPath" | "urlSlug", removeCharacters?: string[]) {
|
|
6
|
-
const charactersToRemove = removeCharacters ? removeCharacters : ["for", "and", "nor", "but", "or", "yet", "so", "the", "a", "an"];
|
|
7
|
-
const characStr = charactersToRemove.join("|");
|
|
8
|
-
if (type === "urlPath") {
|
|
9
|
-
slug.extend({'/': '/'}); //To keep '/' in the url since it's a special character.
|
|
10
|
-
}
|
|
11
|
-
const initialSlug = slug(string, { remove: new RegExp('\\b(' + characStr + ')\\b', 'gi') });
|
|
12
|
-
const verfiedSlug = this.numerifySlug(initialSlug);
|
|
13
|
-
return verfiedSlug;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
//remove multiple numbers in sequence
|
|
17
|
-
static numerifySlug(slug: string) {
|
|
18
|
-
let initialString = slug;
|
|
19
|
-
const regex = /\d+(?:-\d+)+|\d+/g;
|
|
20
|
-
const matchedArray = initialString.match(regex);
|
|
21
|
-
|
|
22
|
-
if (matchedArray) {
|
|
23
|
-
matchedArray.forEach((data) => {
|
|
24
|
-
const length = data.length;
|
|
25
|
-
let splitResult = data;
|
|
26
|
-
if (length > 1) {
|
|
27
|
-
const array = data.split("");
|
|
28
|
-
splitResult = array[0];
|
|
29
|
-
}
|
|
30
|
-
const replacedString = initialString.replace(data, splitResult);
|
|
31
|
-
initialString = replacedString;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return initialString;
|
|
36
|
-
}
|
|
37
|
-
|
|
1
|
+
import slug from "slug";
|
|
2
|
+
|
|
3
|
+
export class SlugHelper {
|
|
4
|
+
|
|
5
|
+
static slugifyString(string: string, type: "urlPath" | "urlSlug", removeCharacters?: string[]) {
|
|
6
|
+
const charactersToRemove = removeCharacters ? removeCharacters : ["for", "and", "nor", "but", "or", "yet", "so", "the", "a", "an"];
|
|
7
|
+
const characStr = charactersToRemove.join("|");
|
|
8
|
+
if (type === "urlPath") {
|
|
9
|
+
slug.extend({'/': '/'}); //To keep '/' in the url since it's a special character.
|
|
10
|
+
}
|
|
11
|
+
const initialSlug = slug(string, { remove: new RegExp('\\b(' + characStr + ')\\b', 'gi') });
|
|
12
|
+
const verfiedSlug = this.numerifySlug(initialSlug);
|
|
13
|
+
return verfiedSlug;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//remove multiple numbers in sequence
|
|
17
|
+
static numerifySlug(slug: string) {
|
|
18
|
+
let initialString = slug;
|
|
19
|
+
const regex = /\d+(?:-\d+)+|\d+/g;
|
|
20
|
+
const matchedArray = initialString.match(regex);
|
|
21
|
+
|
|
22
|
+
if (matchedArray) {
|
|
23
|
+
matchedArray.forEach((data) => {
|
|
24
|
+
const length = data.length;
|
|
25
|
+
let splitResult = data;
|
|
26
|
+
if (length > 1) {
|
|
27
|
+
const array = data.split("");
|
|
28
|
+
splitResult = array[0];
|
|
29
|
+
}
|
|
30
|
+
const replacedString = initialString.replace(data, splitResult);
|
|
31
|
+
initialString = replacedString;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return initialString;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
38
|
}
|