@churchapps/helpers 1.2.23 → 1.2.24
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/ApiHelper.js +4 -4
- package/dist/ApiHelper.js.map +1 -1
- package/dist/ArrayHelper.d.ts.map +1 -1
- package/dist/ArrayHelper.js.map +1 -1
- package/dist/CommonEnvironmentHelper.d.ts.map +1 -1
- package/dist/CommonEnvironmentHelper.js.map +1 -1
- package/dist/CurrencyHelper.js +3 -3
- package/dist/DateHelper.d.ts.map +1 -1
- package/dist/DateHelper.js +22 -22
- package/dist/DateHelper.js.map +1 -1
- package/dist/DonationHelper.d.ts.map +1 -1
- package/dist/DonationHelper.js +2 -2
- package/dist/DonationHelper.js.map +1 -1
- package/dist/ErrorHelper.d.ts.map +1 -1
- package/dist/ErrorHelper.js.map +1 -1
- package/dist/EventHelper.d.ts.map +1 -1
- package/dist/EventHelper.js +1 -1
- package/dist/EventHelper.js.map +1 -1
- package/dist/FileHelper.d.ts.map +1 -1
- package/dist/FileHelper.js +11 -9
- package/dist/FileHelper.js.map +1 -1
- package/dist/PersonHelper.d.ts.map +1 -1
- package/dist/PersonHelper.js +3 -3
- package/dist/PersonHelper.js.map +1 -1
- package/dist/PlanHelper.d.ts.map +1 -1
- package/dist/PlanHelper.js +1 -3
- package/dist/PlanHelper.js.map +1 -1
- package/dist/UniqueIdHelper.d.ts.map +1 -1
- package/dist/UniqueIdHelper.js +130 -7
- package/dist/UniqueIdHelper.js.map +1 -1
- package/dist/UserHelper.d.ts.map +1 -1
- package/dist/UserHelper.js.map +1 -1
- package/dist/contentProviders/LessonsContentProvider.d.ts.map +1 -1
- package/dist/contentProviders/LessonsContentProvider.js.map +1 -1
- package/dist/interfaces/Doing.d.ts +3 -0
- package/dist/interfaces/Doing.d.ts.map +1 -1
- package/dist/interfaces/Permissions.d.ts.map +1 -1
- package/dist/interfaces/Permissions.js +7 -21
- package/dist/interfaces/Permissions.js.map +1 -1
- package/eslint.config.js +48 -0
- package/package.json +4 -7
- package/src/ApiHelper.ts +8 -8
- package/src/ArrayHelper.ts +16 -34
- package/src/CommonEnvironmentHelper.ts +5 -5
- package/src/CurrencyHelper.ts +3 -3
- package/src/DateHelper.ts +31 -34
- package/src/DonationHelper.ts +3 -4
- package/src/ErrorHelper.ts +5 -6
- package/src/EventHelper.ts +11 -12
- package/src/FileHelper.ts +11 -9
- package/src/PersonHelper.ts +11 -13
- package/src/PlanHelper.ts +1 -3
- package/src/UniqueIdHelper.ts +130 -7
- package/src/UserHelper.ts +3 -4
- package/src/contentProviders/LessonsContentProvider.ts +1 -2
- package/src/interfaces/Doing.ts +3 -0
- package/src/interfaces/Permissions.ts +7 -21
- package/.eslintrc.json +0 -29
- package/.prettierrc +0 -12
package/src/DateHelper.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import dayjs from "dayjs"
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
2
|
import utc from "dayjs/plugin/utc.js";
|
|
3
3
|
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
4
4
|
|
|
@@ -53,19 +53,19 @@ export class DateHelper {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
static getLastSunday() {
|
|
56
|
-
|
|
56
|
+
const result = new Date();
|
|
57
57
|
while (result.getDay() !== 0) result.setDate(result.getDate() - 1);
|
|
58
58
|
return result;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
static getNextSunday() {
|
|
62
|
-
|
|
62
|
+
const result = this.getLastSunday();
|
|
63
63
|
result.setDate(result.getDate() + 7);
|
|
64
64
|
return result;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
static getWeekSunday(year: number, week: number) {
|
|
68
|
-
|
|
68
|
+
const result = new Date(year, 0, 1);
|
|
69
69
|
while (result.getDay() !== 0) result.setDate(result.getDate() + 1);
|
|
70
70
|
result.setDate(result.getDate() + ((week - 1) * 7));
|
|
71
71
|
return result;
|
|
@@ -75,10 +75,10 @@ export class DateHelper {
|
|
|
75
75
|
if (!date) return "";
|
|
76
76
|
|
|
77
77
|
// If already a YYYY-MM-DD string, return as-is
|
|
78
|
-
if (typeof date ===
|
|
78
|
+
if (typeof date === "string" && /^\d{4}-\d{2}-\d{2}$/.test(date)) return date;
|
|
79
79
|
|
|
80
80
|
// If ISO string, extract date portion (ignore timezone)
|
|
81
|
-
if (typeof date ===
|
|
81
|
+
if (typeof date === "string") {
|
|
82
82
|
const match = date.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
83
83
|
if (match) return match[1];
|
|
84
84
|
}
|
|
@@ -88,8 +88,8 @@ export class DateHelper {
|
|
|
88
88
|
if (isNaN(d.getTime())) return "";
|
|
89
89
|
|
|
90
90
|
const year = d.getFullYear();
|
|
91
|
-
const month = String(d.getMonth() + 1).padStart(2,
|
|
92
|
-
const day = String(d.getDate()).padStart(2,
|
|
91
|
+
const month = String(d.getMonth() + 1).padStart(2, "0");
|
|
92
|
+
const day = String(d.getDate()).padStart(2, "0");
|
|
93
93
|
return `${year}-${month}-${day}`;
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -97,22 +97,22 @@ export class DateHelper {
|
|
|
97
97
|
static toMysqlDateOnly(date: Date | string | null | undefined): string | null {
|
|
98
98
|
if (date === null || date === undefined) return null;
|
|
99
99
|
|
|
100
|
-
if (typeof date ===
|
|
100
|
+
if (typeof date === "string") {
|
|
101
101
|
const match = date.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
102
102
|
return match ? match[1] : null;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
const year = date.getFullYear();
|
|
106
|
-
const month = String(date.getMonth() + 1).padStart(2,
|
|
107
|
-
const day = String(date.getDate()).padStart(2,
|
|
106
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
107
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
108
108
|
return `${year}-${month}-${day}`;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
static formatHtml5Time(time: Date): string {
|
|
112
112
|
if (time === undefined || time === null) return "";
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
const h = time.getHours();
|
|
114
|
+
const m = time.getMinutes();
|
|
115
|
+
const s = time.getSeconds();
|
|
116
116
|
return `${h < 10 ? ("0" + h) : h}:${m < 10 ? ("0" + m) : m}:${s < 10 ? ("0" + s) : s}`;
|
|
117
117
|
}
|
|
118
118
|
|
|
@@ -124,20 +124,17 @@ export class DateHelper {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
static getDisplayDuration(d: Date): string {
|
|
127
|
-
|
|
127
|
+
const seconds = Math.round((new Date().getTime() - d.getTime()) / 1000);
|
|
128
128
|
if (seconds > 86400) {
|
|
129
|
-
|
|
129
|
+
const days = Math.floor(seconds / 86400);
|
|
130
130
|
return (days === 1) ? "1d" : days.toString() + "d";
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
let hours = Math.floor(seconds / 3600);
|
|
131
|
+
} else if (seconds > 3600) {
|
|
132
|
+
const hours = Math.floor(seconds / 3600);
|
|
134
133
|
return (hours === 1) ? "1h" : hours.toString() + "h";
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
let minutes = Math.floor(seconds / 60);
|
|
134
|
+
} else if (seconds > 60) {
|
|
135
|
+
const minutes = Math.floor(seconds / 60);
|
|
138
136
|
return (minutes === 1) ? "1m" : minutes.toString() + "m";
|
|
139
|
-
}
|
|
140
|
-
else return (seconds === 1) ? "1s" : Math.floor(seconds).toString() + "s";
|
|
137
|
+
} else return (seconds === 1) ? "1s" : Math.floor(seconds).toString() + "s";
|
|
141
138
|
}
|
|
142
139
|
|
|
143
140
|
static getShortDate(d: Date): string {
|
|
@@ -154,26 +151,26 @@ export class DateHelper {
|
|
|
154
151
|
try {
|
|
155
152
|
// Convert date-fns format to dayjs format
|
|
156
153
|
const dayjsFormat = format
|
|
157
|
-
.replace(/yyyy/g,
|
|
158
|
-
.replace(/yy/g,
|
|
159
|
-
.replace(/d/g,
|
|
160
|
-
.replace(/DD/g,
|
|
161
|
-
.replace(/a/g,
|
|
162
|
-
|
|
154
|
+
.replace(/yyyy/g, "YYYY")
|
|
155
|
+
.replace(/yy/g, "YY")
|
|
156
|
+
.replace(/d/g, "D")
|
|
157
|
+
.replace(/DD/g, "DD")
|
|
158
|
+
.replace(/a/g, "A");
|
|
159
|
+
|
|
163
160
|
return dayjs(date).format(dayjsFormat);
|
|
164
161
|
} catch { return ""; }
|
|
165
162
|
}
|
|
166
163
|
|
|
167
164
|
public static toMysqlDate(d: Date) {
|
|
168
165
|
if (d === null || d === undefined) {
|
|
169
|
-
|
|
166
|
+
return undefined;
|
|
170
167
|
}
|
|
171
|
-
return dayjs(d).format("YYYY-MM-DD HH:mm:ss")
|
|
168
|
+
return dayjs(d).format("YYYY-MM-DD HH:mm:ss");
|
|
172
169
|
}
|
|
173
170
|
|
|
174
171
|
public static subtractHoursFromNow(hour: number) {
|
|
175
|
-
|
|
176
|
-
|
|
172
|
+
const now = new Date();
|
|
173
|
+
return new Date(now.setHours(now.getHours() - hour));
|
|
177
174
|
}
|
|
178
175
|
|
|
179
176
|
public static toUTCDate(d: Date) {
|
package/src/DonationHelper.ts
CHANGED
|
@@ -3,16 +3,15 @@ export class DonationHelper {
|
|
|
3
3
|
static getInterval(intervalName:string) {
|
|
4
4
|
let intervalCount = 1;
|
|
5
5
|
let intervalType = "month";
|
|
6
|
-
|
|
6
|
+
const parts = intervalName.split("_");
|
|
7
7
|
if (parts.length === 2) {
|
|
8
|
-
switch (parts[0])
|
|
9
|
-
{
|
|
8
|
+
switch (parts[0]) {
|
|
10
9
|
case "two": intervalCount = 2; break;
|
|
11
10
|
case "three": intervalCount = 3; break;
|
|
12
11
|
}
|
|
13
12
|
intervalType = parts[1];
|
|
14
13
|
}
|
|
15
|
-
|
|
14
|
+
const result = { interval_count: intervalCount, interval: intervalType };
|
|
16
15
|
return result;
|
|
17
16
|
}
|
|
18
17
|
|
package/src/ErrorHelper.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ErrorLogInterface, ErrorAppDataInterface } from "./interfaces/Error.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
|
|
3
|
+
|
|
5
4
|
export class ErrorHelper {
|
|
6
5
|
|
|
7
6
|
static getAppData: () => { churchId: string, userId: string, originUrl: string, application: string };
|
|
@@ -10,7 +9,7 @@ export class ErrorHelper {
|
|
|
10
9
|
static init = (getAppData: () => ErrorAppDataInterface, customErrorHandler: (errorLog: ErrorLogInterface) => void) => {
|
|
11
10
|
ErrorHelper.getAppData = getAppData;
|
|
12
11
|
ErrorHelper.customErrorHandler = customErrorHandler;
|
|
13
|
-
}
|
|
12
|
+
};
|
|
14
13
|
|
|
15
14
|
static logError = (errorType: string, message: string, details: string) => {
|
|
16
15
|
|
|
@@ -26,14 +25,14 @@ export class ErrorHelper {
|
|
|
26
25
|
errorType: errorType,
|
|
27
26
|
message: message,
|
|
28
27
|
details: details
|
|
29
|
-
}
|
|
28
|
+
};
|
|
30
29
|
|
|
31
30
|
if (log.errorType === "401" && log.message.indexOf("/users/login") > -1) return;
|
|
32
31
|
//temporarily disabled error logging
|
|
33
32
|
//ApiHelper.postAnonymous("/errors", [log], "MembershipApi");
|
|
34
33
|
if (ErrorHelper.customErrorHandler) ErrorHelper.customErrorHandler(log);
|
|
35
34
|
}
|
|
36
|
-
}
|
|
35
|
+
};
|
|
37
36
|
|
|
38
37
|
|
|
39
38
|
}
|
package/src/EventHelper.ts
CHANGED
|
@@ -45,39 +45,38 @@ export class EventHelper {
|
|
|
45
45
|
d.setHours(start.getHours());
|
|
46
46
|
d.setMinutes(start.getMinutes());
|
|
47
47
|
d.setSeconds(start.getSeconds());
|
|
48
|
-
})
|
|
48
|
+
});
|
|
49
49
|
return dates;
|
|
50
|
-
}
|
|
50
|
+
};
|
|
51
51
|
|
|
52
52
|
static getFullRRule = (event:EventInterface) => {
|
|
53
53
|
const RR = getRRule();
|
|
54
|
-
|
|
54
|
+
const rrule = RR.fromString(event.recurrenceRule);
|
|
55
55
|
rrule.options.dtstart = new Date(event.start);
|
|
56
56
|
return rrule;
|
|
57
|
-
}
|
|
57
|
+
};
|
|
58
58
|
|
|
59
59
|
static removeExcludeDates = (events:EventInterface[]) => {
|
|
60
|
-
for (let i=events.length-1; i>=0; i--) {
|
|
61
|
-
if (events[i].exceptionDates?.length>0)
|
|
62
|
-
{
|
|
60
|
+
for (let i = events.length - 1; i >= 0; i--) {
|
|
61
|
+
if (events[i].exceptionDates?.length > 0) {
|
|
63
62
|
const parsedDates = events[i].exceptionDates.map((d: string | Date)=>new Date(d).toISOString());
|
|
64
|
-
if (parsedDates.indexOf(events[i].start.toISOString())
|
|
63
|
+
if (parsedDates.indexOf(events[i].start.toISOString()) > -1) events.splice(i, 1);
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
|
-
}
|
|
66
|
+
};
|
|
68
67
|
|
|
69
68
|
static getPartialRRuleString = (options:ParsedOptions) => {
|
|
70
69
|
const RR = getRRule();
|
|
71
70
|
const parts = new RR(options).toString().split("RRULE:");
|
|
72
|
-
const result = parts.length===2 ? parts[1] : "";
|
|
71
|
+
const result = parts.length === 2 ? parts[1] : "";
|
|
73
72
|
return result;
|
|
74
|
-
}
|
|
73
|
+
};
|
|
75
74
|
|
|
76
75
|
static cleanRule = (options:ParsedOptions) => {
|
|
77
76
|
options.byhour = undefined;
|
|
78
77
|
options.byminute = undefined;
|
|
79
78
|
options.bysecond = undefined;
|
|
80
|
-
}
|
|
79
|
+
};
|
|
81
80
|
|
|
82
81
|
// Export for consumers who need to ensure initialization
|
|
83
82
|
static ensureInitialized = ensureRRule;
|
package/src/FileHelper.ts
CHANGED
|
@@ -12,14 +12,14 @@ export class FileHelper {
|
|
|
12
12
|
return new Promise((resolve, reject) => {
|
|
13
13
|
const xhr = new XMLHttpRequest();
|
|
14
14
|
|
|
15
|
-
xhr.upload.addEventListener(
|
|
15
|
+
xhr.upload.addEventListener("progress", (event) => {
|
|
16
16
|
if (event.lengthComputable) {
|
|
17
17
|
const percent = Math.round((event.loaded / event.total) * 100);
|
|
18
18
|
progressCallback(percent);
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
xhr.addEventListener(
|
|
22
|
+
xhr.addEventListener("load", () => {
|
|
23
23
|
if (xhr.status >= 200 && xhr.status < 300) {
|
|
24
24
|
resolve({
|
|
25
25
|
status: xhr.status,
|
|
@@ -31,22 +31,24 @@ export class FileHelper {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
xhr.addEventListener(
|
|
35
|
-
reject(new Error(
|
|
34
|
+
xhr.addEventListener("error", () => {
|
|
35
|
+
reject(new Error("Network error occurred"));
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
xhr.open(
|
|
38
|
+
xhr.open("POST", presigned.url);
|
|
39
39
|
xhr.send(formData);
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
static dataURLtoBlob(dataurl: string) {
|
|
44
|
-
|
|
44
|
+
const arr = dataurl.split(",");
|
|
45
45
|
if (arr.length < 2) throw new Error("Invalid data URL format");
|
|
46
|
-
|
|
46
|
+
const mimeMatch = arr[0].match(/:(.*?);/);
|
|
47
47
|
if (!mimeMatch) throw new Error("Invalid MIME type in data URL");
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
const mime = mimeMatch[1];
|
|
49
|
+
const bstr = atob(arr[1]);
|
|
50
|
+
let n = bstr.length;
|
|
51
|
+
const u8arr = new Uint8Array(n);
|
|
50
52
|
while (n--) {
|
|
51
53
|
u8arr[n] = bstr.charCodeAt(n);
|
|
52
54
|
}
|
package/src/PersonHelper.ts
CHANGED
|
@@ -7,12 +7,11 @@ export class PersonHelper {
|
|
|
7
7
|
if (!person.photoUpdated) {
|
|
8
8
|
if (person.id?.startsWith("PER0000")) return "https://app.staging.b1.church/images/demo/avatars/" + person.id + ".svg";
|
|
9
9
|
else return "";
|
|
10
|
-
}
|
|
11
|
-
else return "/" + churchId + "/membership/people/" + person.id + ".png?dt=" + new Date(person.photoUpdated).getTime().toString();
|
|
10
|
+
} else return "/" + churchId + "/membership/people/" + person.id + ".png?dt=" + new Date(person.photoUpdated).getTime().toString();
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
static getPhotoUrl(person: PersonInterface) {
|
|
15
|
-
if (!person?.photo) return "/images/sample-profile.png"
|
|
14
|
+
if (!person?.photo) return "/images/sample-profile.png";
|
|
16
15
|
else {
|
|
17
16
|
return (person?.photo?.startsWith("data:image/png;base64,") || person.photo?.indexOf("://") > -1)
|
|
18
17
|
? person.photo
|
|
@@ -22,12 +21,11 @@ export class PersonHelper {
|
|
|
22
21
|
|
|
23
22
|
static getAge(birthdate: Date): string {
|
|
24
23
|
if (birthdate !== undefined && birthdate !== null) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
const ageDifMs = Date.now() - new Date(birthdate).getTime();
|
|
25
|
+
const ageDate = new Date(ageDifMs);
|
|
26
|
+
const years = Math.abs(ageDate.getUTCFullYear() - 1970);
|
|
28
27
|
return years + " years";
|
|
29
|
-
}
|
|
30
|
-
else return "";
|
|
28
|
+
} else return "";
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
public static getDisplayNameFromPerson(person: any) {
|
|
@@ -50,13 +48,13 @@ export class PersonHelper {
|
|
|
50
48
|
const displayAddress2: string = this.addressToString(address2).trim();
|
|
51
49
|
|
|
52
50
|
if (displayAddress1 !== displayAddress2) {
|
|
53
|
-
return true
|
|
51
|
+
return true;
|
|
54
52
|
}
|
|
55
|
-
return false
|
|
53
|
+
return false;
|
|
56
54
|
}
|
|
57
55
|
|
|
58
56
|
public static addressToString(address: ContactInfoInterface): string {
|
|
59
|
-
return `${address.address1 || ""} ${address.address2 || ""} ${address.city || ""}${(address.city && address.state) ? "," : ""} ${address.state || ""} ${address.zip || ""}
|
|
57
|
+
return `${address.address1 || ""} ${address.address2 || ""} ${address.city || ""}${(address.city && address.state) ? "," : ""} ${address.state || ""} ${address.zip || ""}`;
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
public static changeOnlyAddress(contactInfo1: ContactInfoInterface, contactInfo2: ContactInfoInterface): ContactInfoInterface {
|
|
@@ -67,9 +65,9 @@ export class PersonHelper {
|
|
|
67
65
|
city: contactInfo2.city,
|
|
68
66
|
state: contactInfo2.state,
|
|
69
67
|
zip: contactInfo2.zip
|
|
70
|
-
}
|
|
68
|
+
};
|
|
71
69
|
|
|
72
|
-
return updatedAddress
|
|
70
|
+
return updatedAddress;
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
public static checkAddressAvailabilty(person: PersonInterface): boolean {
|
package/src/PlanHelper.ts
CHANGED
|
@@ -3,9 +3,7 @@ import type { ContentProviderInterface } from "./contentProviders/ContentProvide
|
|
|
3
3
|
import { LessonsContentProvider } from "./contentProviders/LessonsContentProvider.js";
|
|
4
4
|
|
|
5
5
|
export class PlanHelper {
|
|
6
|
-
private static providers: ContentProviderInterface[] = [
|
|
7
|
-
new LessonsContentProvider()
|
|
8
|
-
];
|
|
6
|
+
private static providers: ContentProviderInterface[] = [new LessonsContentProvider()];
|
|
9
7
|
|
|
10
8
|
// Register additional content providers
|
|
11
9
|
static registerProvider(provider: ContentProviderInterface): void {
|
package/src/UniqueIdHelper.ts
CHANGED
|
@@ -1,13 +1,136 @@
|
|
|
1
1
|
export class UniqueIdHelper {
|
|
2
2
|
|
|
3
|
-
static chars = [
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
3
|
+
static chars = [
|
|
4
|
+
"A",
|
|
5
|
+
"B",
|
|
6
|
+
"C",
|
|
7
|
+
"D",
|
|
8
|
+
"E",
|
|
9
|
+
"F",
|
|
10
|
+
"G",
|
|
11
|
+
"H",
|
|
12
|
+
"I",
|
|
13
|
+
"J",
|
|
14
|
+
"K",
|
|
15
|
+
"L",
|
|
16
|
+
"M",
|
|
17
|
+
"N",
|
|
18
|
+
"O",
|
|
19
|
+
"P",
|
|
20
|
+
"Q",
|
|
21
|
+
"R",
|
|
22
|
+
"S",
|
|
23
|
+
"T",
|
|
24
|
+
"U",
|
|
25
|
+
"V",
|
|
26
|
+
"W",
|
|
27
|
+
"X",
|
|
28
|
+
"Y",
|
|
29
|
+
"Z",
|
|
30
|
+
"a",
|
|
31
|
+
"b",
|
|
32
|
+
"c",
|
|
33
|
+
"d",
|
|
34
|
+
"e",
|
|
35
|
+
"f",
|
|
36
|
+
"g",
|
|
37
|
+
"h",
|
|
38
|
+
"i",
|
|
39
|
+
"j",
|
|
40
|
+
"k",
|
|
41
|
+
"l",
|
|
42
|
+
"m",
|
|
43
|
+
"n",
|
|
44
|
+
"o",
|
|
45
|
+
"p",
|
|
46
|
+
"q",
|
|
47
|
+
"r",
|
|
48
|
+
"s",
|
|
49
|
+
"t",
|
|
50
|
+
"u",
|
|
51
|
+
"v",
|
|
52
|
+
"w",
|
|
53
|
+
"x",
|
|
54
|
+
"y",
|
|
55
|
+
"z",
|
|
56
|
+
"0",
|
|
57
|
+
"1",
|
|
58
|
+
"2",
|
|
59
|
+
"3",
|
|
60
|
+
"4",
|
|
61
|
+
"5",
|
|
62
|
+
"6",
|
|
63
|
+
"7",
|
|
64
|
+
"8",
|
|
65
|
+
"9",
|
|
66
|
+
"-",
|
|
67
|
+
"_"
|
|
68
|
+
];
|
|
7
69
|
|
|
8
|
-
static alphanumericChars = [
|
|
9
|
-
"
|
|
10
|
-
"
|
|
70
|
+
static alphanumericChars = [
|
|
71
|
+
"A",
|
|
72
|
+
"B",
|
|
73
|
+
"C",
|
|
74
|
+
"D",
|
|
75
|
+
"E",
|
|
76
|
+
"F",
|
|
77
|
+
"G",
|
|
78
|
+
"H",
|
|
79
|
+
"I",
|
|
80
|
+
"J",
|
|
81
|
+
"K",
|
|
82
|
+
"L",
|
|
83
|
+
"M",
|
|
84
|
+
"N",
|
|
85
|
+
"O",
|
|
86
|
+
"P",
|
|
87
|
+
"Q",
|
|
88
|
+
"R",
|
|
89
|
+
"S",
|
|
90
|
+
"T",
|
|
91
|
+
"U",
|
|
92
|
+
"V",
|
|
93
|
+
"W",
|
|
94
|
+
"X",
|
|
95
|
+
"Y",
|
|
96
|
+
"Z",
|
|
97
|
+
"a",
|
|
98
|
+
"b",
|
|
99
|
+
"c",
|
|
100
|
+
"d",
|
|
101
|
+
"e",
|
|
102
|
+
"f",
|
|
103
|
+
"g",
|
|
104
|
+
"h",
|
|
105
|
+
"i",
|
|
106
|
+
"j",
|
|
107
|
+
"k",
|
|
108
|
+
"l",
|
|
109
|
+
"m",
|
|
110
|
+
"n",
|
|
111
|
+
"o",
|
|
112
|
+
"p",
|
|
113
|
+
"q",
|
|
114
|
+
"r",
|
|
115
|
+
"s",
|
|
116
|
+
"t",
|
|
117
|
+
"u",
|
|
118
|
+
"v",
|
|
119
|
+
"w",
|
|
120
|
+
"x",
|
|
121
|
+
"y",
|
|
122
|
+
"z",
|
|
123
|
+
"0",
|
|
124
|
+
"1",
|
|
125
|
+
"2",
|
|
126
|
+
"3",
|
|
127
|
+
"4",
|
|
128
|
+
"5",
|
|
129
|
+
"6",
|
|
130
|
+
"7",
|
|
131
|
+
"8",
|
|
132
|
+
"9"
|
|
133
|
+
];
|
|
11
134
|
|
|
12
135
|
public static isMissing(obj: any) {
|
|
13
136
|
if (obj === undefined || obj === null) return true;
|
package/src/UserHelper.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiHelper } from "./ApiHelper.js"
|
|
1
|
+
import { ApiHelper } from "./ApiHelper.js";
|
|
2
2
|
import { UserInterface, UserContextInterface, IApiPermission, PersonInterface, LoginUserChurchInterface } from "./interfaces/index.js";
|
|
3
3
|
|
|
4
4
|
export class UserHelper {
|
|
@@ -15,8 +15,7 @@ export class UserHelper {
|
|
|
15
15
|
UserHelper.userChurches.forEach(uc => {
|
|
16
16
|
if (uc.church.id === churchId) userChurch = uc;
|
|
17
17
|
});
|
|
18
|
-
}
|
|
19
|
-
else if (keyName) UserHelper.userChurches.forEach(uc => { if (uc.church.subDomain === keyName) userChurch = uc; });
|
|
18
|
+
} else if (keyName) UserHelper.userChurches.forEach(uc => { if (uc.church.subDomain === keyName) userChurch = uc; });
|
|
20
19
|
else userChurch = UserHelper.userChurches[0];
|
|
21
20
|
if (!userChurch) return;
|
|
22
21
|
else {
|
|
@@ -28,7 +27,7 @@ export class UserHelper {
|
|
|
28
27
|
context.setUserChurch(UserHelper.currentUserChurch);
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
|
-
}
|
|
30
|
+
};
|
|
32
31
|
|
|
33
32
|
static setupApiHelper(userChurch: LoginUserChurchInterface) {
|
|
34
33
|
ApiHelper.setDefaultPermissions(userChurch.jwt);
|
|
@@ -33,8 +33,7 @@ export class LessonsContentProvider implements ContentProviderInterface {
|
|
|
33
33
|
const actions = planItems.filter(p => p.itemType === "lessonAction" && p.relatedId);
|
|
34
34
|
const addOns = planItems.filter(p => p.itemType === "lessonAddOn" && p.relatedId);
|
|
35
35
|
const sections = planItems.filter(p =>
|
|
36
|
-
(p.itemType === "lessonSection" || p.itemType === "item") && p.relatedId
|
|
37
|
-
);
|
|
36
|
+
(p.itemType === "lessonSection" || p.itemType === "item") && p.relatedId);
|
|
38
37
|
|
|
39
38
|
const externalRef = this.getExternalRef(plan);
|
|
40
39
|
|
package/src/interfaces/Doing.ts
CHANGED
|
@@ -136,4 +136,7 @@ export interface PlanItemInterface {
|
|
|
136
136
|
children?: PlanItemInterface[];
|
|
137
137
|
content?: PlanItemContentInterface; // Populated by PlanHelper
|
|
138
138
|
providerId?: string; // Provider that owns this item's content
|
|
139
|
+
providerPath?: string; // Path to fetch instructions from provider
|
|
140
|
+
providerContentPath?: string; // Dot-notation path to specific content item (e.g. "0.2.1")
|
|
141
|
+
thumbnailUrl?: string;
|
|
139
142
|
}
|
|
@@ -9,9 +9,7 @@ export class Permissions {
|
|
|
9
9
|
},
|
|
10
10
|
edit: { api: "AttendanceApi", contentType: "Attendance", action: "Edit" }
|
|
11
11
|
},
|
|
12
|
-
services: {
|
|
13
|
-
edit: { api: "AttendanceApi", contentType: "Services", action: "Edit" }
|
|
14
|
-
}
|
|
12
|
+
services: { edit: { api: "AttendanceApi", contentType: "Services", action: "Edit" } }
|
|
15
13
|
};
|
|
16
14
|
|
|
17
15
|
static membershipApi = {
|
|
@@ -19,19 +17,13 @@ export class Permissions {
|
|
|
19
17
|
view: { api: "MembershipApi", contentType: "Roles", action: "View" },
|
|
20
18
|
edit: { api: "MembershipApi", contentType: "Roles", action: "Edit" }
|
|
21
19
|
},
|
|
22
|
-
settings: {
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
server: {
|
|
26
|
-
admin: { api: "MembershipApi", contentType: "Server", action: "Admin" }
|
|
27
|
-
},
|
|
20
|
+
settings: { edit: { api: "MembershipApi", contentType: "Settings", action: "Edit" } },
|
|
21
|
+
server: { admin: { api: "MembershipApi", contentType: "Server", action: "Admin" } },
|
|
28
22
|
forms: {
|
|
29
23
|
admin: { api: "MembershipApi", contentType: "Forms", action: "Admin" },
|
|
30
24
|
edit: { api: "MembershipApi", contentType: "Forms", action: "Edit" }
|
|
31
25
|
},
|
|
32
|
-
groups: {
|
|
33
|
-
edit: { api: "MembershipApi", contentType: "Groups", action: "Edit" }
|
|
34
|
-
},
|
|
26
|
+
groups: { edit: { api: "MembershipApi", contentType: "Groups", action: "Edit" } },
|
|
35
27
|
people: {
|
|
36
28
|
view: { api: "MembershipApi", contentType: "People", action: "View" },
|
|
37
29
|
viewMembers: {
|
|
@@ -41,9 +33,7 @@ export class Permissions {
|
|
|
41
33
|
},
|
|
42
34
|
edit: { api: "MembershipApi", contentType: "People", action: "Edit" }
|
|
43
35
|
},
|
|
44
|
-
plans: {
|
|
45
|
-
edit: { api: "MembershipApi", contentType: "Plans", action: "Edit" }
|
|
46
|
-
},
|
|
36
|
+
plans: { edit: { api: "MembershipApi", contentType: "Plans", action: "Edit" } },
|
|
47
37
|
groupMembers: {
|
|
48
38
|
edit: {
|
|
49
39
|
api: "MembershipApi",
|
|
@@ -75,12 +65,8 @@ export class Permissions {
|
|
|
75
65
|
};
|
|
76
66
|
|
|
77
67
|
static contentApi = {
|
|
78
|
-
chat: {
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
content: {
|
|
82
|
-
edit: { api: "ContentApi", contentType: "Content", action: "Edit" }
|
|
83
|
-
},
|
|
68
|
+
chat: { host: { api: "ContentApi", contentType: "Chat", action: "Host" } },
|
|
69
|
+
content: { edit: { api: "ContentApi", contentType: "Content", action: "Edit" } },
|
|
84
70
|
streamingServices: {
|
|
85
71
|
edit: {
|
|
86
72
|
api: "ContentApi",
|
package/.eslintrc.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"root": true,
|
|
3
|
-
"parser": "@typescript-eslint/parser",
|
|
4
|
-
"parserOptions": {
|
|
5
|
-
"ecmaVersion": 2020,
|
|
6
|
-
"sourceType": "module"
|
|
7
|
-
},
|
|
8
|
-
"plugins": [
|
|
9
|
-
"@typescript-eslint"
|
|
10
|
-
],
|
|
11
|
-
"extends": [
|
|
12
|
-
"eslint:recommended",
|
|
13
|
-
"plugin:@typescript-eslint/recommended"
|
|
14
|
-
],
|
|
15
|
-
"rules": {
|
|
16
|
-
"@typescript-eslint/no-explicit-any": "warn",
|
|
17
|
-
"@typescript-eslint/no-unused-vars": "off",
|
|
18
|
-
"no-unused-vars": "off",
|
|
19
|
-
"prefer-const": "error",
|
|
20
|
-
"no-console": "warn",
|
|
21
|
-
"comma-dangle": ["error", "never"],
|
|
22
|
-
"object-curly-newline": ["error", { "multiline": true, "consistent": true }],
|
|
23
|
-
"array-bracket-newline": ["error", "consistent"]
|
|
24
|
-
},
|
|
25
|
-
"ignorePatterns": [
|
|
26
|
-
"dist/**",
|
|
27
|
-
"node_modules/**"
|
|
28
|
-
]
|
|
29
|
-
}
|
package/.prettierrc
DELETED