@churchapps/apphelper 0.22.1 → 1.0.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/gallery/GalleryModal.js +1 -1
- package/dist/components/gallery/GalleryModal.js.map +1 -1
- package/dist/components/header/SiteHeader.js +1 -1
- package/dist/components/header/SiteHeader.js.map +1 -1
- package/dist/components/notes/EmojiPicker.d.ts.map +1 -1
- package/dist/components/notes/EmojiPicker.js +76 -11
- package/dist/components/notes/EmojiPicker.js.map +1 -1
- package/dist/components/wrapper/ChurchList.js +1 -1
- package/dist/components/wrapper/ChurchList.js.map +1 -1
- package/dist/components/wrapper/UserMenu.d.ts.map +1 -1
- package/dist/components/wrapper/UserMenu.js +5 -0
- package/dist/components/wrapper/UserMenu.js.map +1 -1
- package/dist/donations/components/FundDonations.d.ts.map +1 -1
- package/dist/donations/components/FundDonations.js +2 -0
- package/dist/donations/components/FundDonations.js.map +1 -1
- package/dist/login/LogoutPage.js.map +1 -1
- package/dist/login/components/Forgot.js.map +1 -1
- package/dist/login/components/LoginSetPassword.js.map +1 -1
- package/dist/login/components/Register.js +1 -1
- package/dist/login/components/Register.js.map +1 -1
- package/dist/login/components/SelectChurchModal.js.map +1 -1
- package/dist/login/components/SelectChurchSearch.js.map +1 -1
- package/dist/markdown/components/markdownEditor/plugins/ListMaxIndentLevelPlugin.d.ts.map +1 -1
- package/dist/markdown/components/markdownEditor/plugins/ListMaxIndentLevelPlugin.js +0 -1
- package/dist/markdown/components/markdownEditor/plugins/ListMaxIndentLevelPlugin.js.map +1 -1
- package/dist/public/locales/en.json +1 -0
- package/dist/website/components/admin/calendar/EditCalendarEventModal.js +2 -1
- package/dist/website/components/admin/calendar/EditCalendarEventModal.js.map +1 -1
- package/dist/website/components/elementTypes/CardElement.js.map +1 -1
- package/dist/website/components/elementTypes/TextWithPhoto.js.map +1 -1
- package/dist/website/components/eventCalendar/EditEventModal.d.ts.map +1 -1
- package/dist/website/components/eventCalendar/EditEventModal.js +14 -6
- package/dist/website/components/eventCalendar/EditEventModal.js.map +1 -1
- package/dist/website/components/groups/GroupList.js.map +1 -1
- package/package.json +3 -3
- package/dist/helpers/ArrayHelper.d.ts +0 -13
- package/dist/helpers/ArrayHelper.d.ts.map +0 -1
- package/dist/helpers/ArrayHelper.js +0 -89
- package/dist/helpers/ArrayHelper.js.map +0 -1
- package/dist/helpers/CurrencyHelper.d.ts +0 -21
- package/dist/helpers/CurrencyHelper.d.ts.map +0 -1
- package/dist/helpers/CurrencyHelper.js +0 -133
- package/dist/helpers/CurrencyHelper.js.map +0 -1
- package/dist/helpers/ErrorHelper.d.ts +0 -13
- package/dist/helpers/ErrorHelper.d.ts.map +0 -1
- package/dist/helpers/ErrorHelper.js +0 -37
- package/dist/helpers/ErrorHelper.js.map +0 -1
- package/dist/helpers/EventHelper.d.ts +0 -11
- package/dist/helpers/EventHelper.d.ts.map +0 -1
- package/dist/helpers/EventHelper.js +0 -39
- package/dist/helpers/EventHelper.js.map +0 -1
- package/dist/helpers/FileHelper.d.ts +0 -5
- package/dist/helpers/FileHelper.d.ts.map +0 -1
- package/dist/helpers/FileHelper.js +0 -29
- package/dist/helpers/FileHelper.js.map +0 -1
- package/dist/helpers/PersonHelper.d.ts +0 -11
- package/dist/helpers/PersonHelper.d.ts.map +0 -1
- package/dist/helpers/PersonHelper.js +0 -59
- package/dist/helpers/PersonHelper.js.map +0 -1
- package/dist/helpers/UniqueIdHelper.d.ts +0 -9
- package/dist/helpers/UniqueIdHelper.d.ts.map +0 -1
- package/dist/helpers/UniqueIdHelper.js +0 -158
- package/dist/helpers/UniqueIdHelper.js.map +0 -1
- package/dist/helpers/UserHelper.d.ts +0 -15
- package/dist/helpers/UserHelper.d.ts.map +0 -1
- package/dist/helpers/UserHelper.js +0 -97
- package/dist/helpers/UserHelper.js.map +0 -1
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
var _a;
|
|
2
|
-
export class ErrorHelper {
|
|
3
|
-
}
|
|
4
|
-
_a = ErrorHelper;
|
|
5
|
-
ErrorHelper.init = (getAppData, customErrorHandler) => {
|
|
6
|
-
_a.getAppData = getAppData;
|
|
7
|
-
_a.customErrorHandler = customErrorHandler;
|
|
8
|
-
};
|
|
9
|
-
ErrorHelper.logError = (errorType, message, details) => {
|
|
10
|
-
if (_a.getAppData) {
|
|
11
|
-
const data = _a.getAppData();
|
|
12
|
-
const log = {
|
|
13
|
-
application: data.application,
|
|
14
|
-
errorTime: new Date(),
|
|
15
|
-
userId: data.userId,
|
|
16
|
-
churchId: data.churchId,
|
|
17
|
-
originUrl: data.originUrl,
|
|
18
|
-
errorType: errorType,
|
|
19
|
-
message: message,
|
|
20
|
-
details: details
|
|
21
|
-
};
|
|
22
|
-
if (log.errorType === "401" && log.message.indexOf("/users/login") > -1)
|
|
23
|
-
return;
|
|
24
|
-
if (log.message.indexOf("clientErrors") > -1)
|
|
25
|
-
return;
|
|
26
|
-
try {
|
|
27
|
-
// Error posting to /errors endpoint disabled
|
|
28
|
-
// ApiHelper.postAnonymous("/clientErrors", [log], "MembershipApi");
|
|
29
|
-
}
|
|
30
|
-
catch (_error) {
|
|
31
|
-
// Error posting disabled
|
|
32
|
-
}
|
|
33
|
-
if (_a.customErrorHandler)
|
|
34
|
-
_a.customErrorHandler(log);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=ErrorHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorHelper.js","sourceRoot":"","sources":["../../src/helpers/ErrorHelper.ts"],"names":[],"mappings":";AAGA,MAAM,OAAO,WAAW;;;AAKf,gBAAI,GAAG,CAAC,UAAuC,EAAE,kBAAyD,EAAE,EAAE;IACnH,EAAW,CAAC,UAAU,GAAG,UAAU,CAAC;IACpC,EAAW,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AACtD,CAAC,AAHU,CAGT;AAEK,oBAAQ,GAAG,CAAC,SAAiB,EAAE,OAAe,EAAE,OAAe,EAAE,EAAE;IACxE,IAAI,EAAI,CAAC,UAAU,EAAE,CAAC;QACpB,MAAM,IAAI,GAAG,EAAI,CAAC,UAAU,EAAE,CAAC;QAC/B,MAAM,GAAG,GAAsB;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE,OAAO;SACjB,CAAC;QAGF,IAAI,GAAG,CAAC,SAAS,KAAK,KAAK,IAAI,GAAG,CAAC,OAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;YAAE,OAAO;QACjF,IAAI,GAAG,CAAC,OAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;YAAE,OAAO;QACtD,IAAI,CAAC;YACH,6CAA6C;YAC7C,oEAAoE;QACtE,CAAC;QAAC,OAAO,MAAM,EAAE,CAAC;YAChB,yBAAyB;QAC3B,CAAC;QACD,IAAI,EAAW,CAAC,kBAAkB;YAAE,EAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC,AAzBc,CAyBb"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { EventInterface } from "@churchapps/helpers";
|
|
2
|
-
import { RRule } from "rrule";
|
|
3
|
-
import { ParsedOptions } from "rrule/dist/esm/types";
|
|
4
|
-
export declare class EventHelper {
|
|
5
|
-
static getRange: (event: EventInterface, startDate: Date, endDate: Date) => Date[];
|
|
6
|
-
static getFullRRule: (event: EventInterface) => RRule;
|
|
7
|
-
static removeExcludeDates: (events: EventInterface[]) => void;
|
|
8
|
-
static getPartialRRuleString: (options: ParsedOptions) => string;
|
|
9
|
-
static cleanRule: (options: ParsedOptions) => void;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=EventHelper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/EventHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,qBAAa,WAAW;IAEtB,MAAM,CAAC,QAAQ,GAAI,OAAM,cAAc,EAAE,WAAU,IAAI,EAAE,SAAQ,IAAI,YAYnE;IAEF,MAAM,CAAC,YAAY,GAAI,OAAM,cAAc,WAIzC;IAEF,MAAM,CAAC,kBAAkB,GAAI,QAAO,cAAc,EAAE,UAOlD;IAEF,MAAM,CAAC,qBAAqB,GAAI,SAAQ,aAAa,YAInD;IAEF,MAAM,CAAC,SAAS,GAAI,SAAQ,aAAa,UAIvC;CAEH"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { RRule } from "rrule";
|
|
2
|
-
export class EventHelper {
|
|
3
|
-
}
|
|
4
|
-
EventHelper.getRange = (event, startDate, endDate) => {
|
|
5
|
-
const start = new Date(event.start);
|
|
6
|
-
const rrule = EventHelper.getFullRRule(event);
|
|
7
|
-
const dates = rrule.between(startDate, endDate);
|
|
8
|
-
dates.forEach(d => {
|
|
9
|
-
d.setHours(start.getHours());
|
|
10
|
-
d.setMinutes(start.getMinutes());
|
|
11
|
-
d.setSeconds(start.getSeconds());
|
|
12
|
-
});
|
|
13
|
-
return dates;
|
|
14
|
-
};
|
|
15
|
-
EventHelper.getFullRRule = (event) => {
|
|
16
|
-
const rrule = RRule.fromString(event.recurrenceRule);
|
|
17
|
-
rrule.options.dtstart = new Date(event.start);
|
|
18
|
-
return rrule;
|
|
19
|
-
};
|
|
20
|
-
EventHelper.removeExcludeDates = (events) => {
|
|
21
|
-
for (let i = events.length - 1; i >= 0; i--) {
|
|
22
|
-
if ((events[i].exceptionDates?.length ?? 0) > 0) {
|
|
23
|
-
const parsedDates = events[i].exceptionDates.map(d => new Date(d).toISOString());
|
|
24
|
-
if (parsedDates.indexOf(events[i].start.toISOString()) > -1)
|
|
25
|
-
events.splice(i, 1);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
EventHelper.getPartialRRuleString = (options) => {
|
|
30
|
-
const parts = new RRule(options).toString().split("RRULE:");
|
|
31
|
-
const result = parts.length === 2 ? parts[1] : "";
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
EventHelper.cleanRule = (options) => {
|
|
35
|
-
options.byhour = undefined;
|
|
36
|
-
options.byminute = undefined;
|
|
37
|
-
options.bysecond = undefined;
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=EventHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventHelper.js","sourceRoot":"","sources":["../../src/helpers/EventHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAG9B,MAAM,OAAO,WAAW;;AAEf,oBAAQ,GAAG,CAAC,KAAoB,EAAE,SAAc,EAAE,OAAY,EAAE,EAAE;IACvE,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,KAAM,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,WAAW,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAE9C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAEhD,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QAChB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC7B,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;QACj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AK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEK,qBAAS,GAAG,CAAC,OAAqB,EAAE,EAAE;IAC3C,OAAO,CAAC,MAAM,GAAG,SAAgC,CAAC;IAClD,OAAO,CAAC,QAAQ,GAAG,SAAgC,CAAC;IACpD,OAAO,CAAC,QAAQ,GAAG,SAAgC,CAAC;AACtD,CAAC,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare class FileHelper {
|
|
2
|
-
static postPresignedFile: (presigned: any, uploadedFile: File, progressCallback: (percent: number) => void) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
3
|
-
static dataURLtoBlob(dataurl: string): Blob;
|
|
4
|
-
}
|
|
5
|
-
//# sourceMappingURL=FileHelper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/FileHelper.ts"],"names":[],"mappings":"AAEA,qBAAa,UAAU;IAErB,MAAM,CAAC,iBAAiB,GAAI,WAAW,GAAG,EAAE,cAAc,IAAI,EAAE,kBAAkB,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,0DAgBzG;IAEF,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM;CAUrC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
export class FileHelper {
|
|
3
|
-
static dataURLtoBlob(dataurl) {
|
|
4
|
-
const arr = dataurl.split(","), mime = arr[0].match(/:(.*?);/)[1], bstr = atob(arr[1]);
|
|
5
|
-
let n = bstr.length;
|
|
6
|
-
const u8arr = new Uint8Array(n);
|
|
7
|
-
while (n--) {
|
|
8
|
-
u8arr[n] = bstr.charCodeAt(n);
|
|
9
|
-
}
|
|
10
|
-
return new Blob([u8arr], { type: mime });
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
FileHelper.postPresignedFile = (presigned, uploadedFile, progressCallback) => {
|
|
14
|
-
const formData = new FormData();
|
|
15
|
-
//formData.append("key", presigned.key); //no longer needed with new aws sdk
|
|
16
|
-
formData.append("acl", "public-read");
|
|
17
|
-
formData.append("Content-Type", uploadedFile.type);
|
|
18
|
-
for (const property in presigned.fields)
|
|
19
|
-
formData.append(property, presigned.fields[property]);
|
|
20
|
-
formData.append("file", uploadedFile);
|
|
21
|
-
const axiosConfig = {
|
|
22
|
-
headers: { "Content-Type": "multipart/form-data" },
|
|
23
|
-
onUploadProgress: (data) => {
|
|
24
|
-
progressCallback(Math.round((100 * data.loaded) / data.total));
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
return axios.post(presigned.url, formData, axiosConfig);
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=FileHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileHelper.js","sourceRoot":"","sources":["../../src/helpers/FileHelper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,OAAO,UAAU;IAoBrB,MAAM,CAAC,aAAa,CAAC,OAAe;QAClC,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAE,CAAC,CAAC,CAAC,EAChE,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACpB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;QAChC,OAAO,CAAC,EAAE,EAAE,CAAC;YACX,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAChC,CAAC;QACD,OAAO,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;;AA3BM,4BAAiB,GAAG,CAAC,SAAc,EAAE,YAAkB,EAAE,gBAA2C,EAAE,EAAE;IAC7G,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,4EAA4E;IAC5E,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IACtC,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IACnD,KAAK,MAAM,QAAQ,IAAI,SAAS,CAAC,MAAM;QAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/F,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAEtC,MAAM,WAAW,GAAG;QAClB,OAAO,EAAE,EAAE,cAAc,EAAE,qBAAqB,EAAE;QAClD,gBAAgB,EAAE,CAAC,IAAS,EAAE,EAAE;YAC9B,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACjE,CAAC;KACF,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AAC1D,CAAC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { PersonInterface, ContactInfoInterface } from "@churchapps/helpers";
|
|
2
|
-
export declare class PersonHelper {
|
|
3
|
-
static getPhotoUrl(person: PersonInterface): string;
|
|
4
|
-
static getAge(birthdate: Date): string;
|
|
5
|
-
static getDisplayName(firstName: string, lastName: string, nickName: string): string;
|
|
6
|
-
static compareAddress(address1: ContactInfoInterface, address2: ContactInfoInterface): boolean;
|
|
7
|
-
static addressToString(address: ContactInfoInterface): string;
|
|
8
|
-
static changeOnlyAddress(contactInfo1: ContactInfoInterface, contactInfo2: ContactInfoInterface): ContactInfoInterface;
|
|
9
|
-
static checkAddressAvailabilty(person: PersonInterface): boolean;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=PersonHelper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PersonHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/PersonHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAA2B,MAAM,qBAAqB,CAAC;AAGrG,qBAAa,YAAY;IAEvB,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,eAAe;IAS1C,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM;IAStC,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;WAKtE,cAAc,CAAC,QAAQ,EAAE,oBAAoB,EAAE,QAAQ,EAAE,oBAAoB,GAAG,OAAO;WAUvF,eAAe,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM;WAItD,iBAAiB,CAAC,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,oBAAoB,GAAG,oBAAoB;WAa/G,uBAAuB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO;CAOxE"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { CommonEnvironmentHelper } from "@churchapps/helpers";
|
|
2
|
-
import { Locale } from "./Locale";
|
|
3
|
-
export class PersonHelper {
|
|
4
|
-
static getPhotoUrl(person) {
|
|
5
|
-
if (!person?.photo)
|
|
6
|
-
return "/images/sample-profile.png";
|
|
7
|
-
else {
|
|
8
|
-
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) {
|
|
14
|
-
if (birthdate !== undefined && birthdate !== null) {
|
|
15
|
-
const ageDifMs = Date.now() - new Date(birthdate).getTime();
|
|
16
|
-
const ageDate = new Date(ageDifMs);
|
|
17
|
-
const years = Math.abs(ageDate.getUTCFullYear() - 1970);
|
|
18
|
-
return years + " " + Locale.label("person.years");
|
|
19
|
-
}
|
|
20
|
-
else
|
|
21
|
-
return "";
|
|
22
|
-
}
|
|
23
|
-
static getDisplayName(firstName, lastName, nickName) {
|
|
24
|
-
if (nickName !== undefined && nickName !== null && nickName.length > 0)
|
|
25
|
-
return firstName + ' "' + nickName + '" ' + lastName;
|
|
26
|
-
else
|
|
27
|
-
return firstName + " " + lastName;
|
|
28
|
-
}
|
|
29
|
-
static compareAddress(address1, address2) {
|
|
30
|
-
const displayAddress1 = this.addressToString(address1).trim();
|
|
31
|
-
const displayAddress2 = this.addressToString(address2).trim();
|
|
32
|
-
if (displayAddress1 !== displayAddress2) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
static addressToString(address) {
|
|
38
|
-
return `${address.address1 || ""} ${address.address2 || ""} ${address.city || ""}${(address.city && address.state) ? "," : ""} ${address.state || ""} ${address.zip || ""}`;
|
|
39
|
-
}
|
|
40
|
-
static changeOnlyAddress(contactInfo1, contactInfo2) {
|
|
41
|
-
const updatedAddress = {
|
|
42
|
-
...contactInfo1,
|
|
43
|
-
address1: contactInfo2.address1,
|
|
44
|
-
address2: contactInfo2.address2,
|
|
45
|
-
city: contactInfo2.city,
|
|
46
|
-
state: contactInfo2.state,
|
|
47
|
-
zip: contactInfo2.zip
|
|
48
|
-
};
|
|
49
|
-
return updatedAddress;
|
|
50
|
-
}
|
|
51
|
-
static checkAddressAvailabilty(person) {
|
|
52
|
-
const addressString = this.addressToString(person.contactInfo).trim();
|
|
53
|
-
if (addressString !== "") {
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=PersonHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PersonHelper.js","sourceRoot":"","sources":["../../src/helpers/PersonHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACrG,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,OAAO,YAAY;IAEvB,MAAM,CAAC,WAAW,CAAC,MAAuB;QACxC,IAAI,CAAC,MAAM,EAAE,KAAK;YAAE,OAAO,4BAA4B,CAAC;aACnD,CAAC;YACJ,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,wBAAwB,CAAC,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC/F,CAAC,CAAC,MAAM,CAAC,KAAK;gBACd,CAAC,CAAC,uBAAuB,CAAC,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC;QACzD,CAAC;IACH,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,SAAe;QAC3B,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;YAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC;YAC5D,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC;YACnC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,CAAC;YACxD,OAAO,KAAK,GAAG,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACpD,CAAC;;YAAM,OA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YACvB,KAAK,EAAE,YAAY,CAAC,KAAK;YACzB,GAAG,EAAE,YAAY,CAAC,GAAG;SACtB,CAAC;QAEF,OAAO,cAAc,CAAC;IACxB,CAAC;IAEM,MAAM,CAAC,uBAAuB,CAAC,MAAuB;QAC3D,MAAM,aAAa,GAAW,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9E,IAAI,aAAa,KAAK,EAAE,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare class UniqueIdHelper {
|
|
2
|
-
static chars: string[];
|
|
3
|
-
static alphanumericChars: string[];
|
|
4
|
-
static isMissing(obj: any): boolean;
|
|
5
|
-
static shortId(): string;
|
|
6
|
-
static generateAlphanumeric(): string;
|
|
7
|
-
static generate(charList: string[], length: number): string;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=UniqueIdHelper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UniqueIdHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/UniqueIdHelper.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAc;IAEzB,MAAM,CAAC,KAAK,WAkEV;IAEF,MAAM,CAAC,iBAAiB,WAgEtB;WAEY,SAAS,CAAC,GAAG,EAAE,GAAG;WAMlB,OAAO;WAIP,oBAAoB;WAIpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM;CAU1D"}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
export class UniqueIdHelper {
|
|
2
|
-
static isMissing(obj) {
|
|
3
|
-
if (obj === undefined || obj === null)
|
|
4
|
-
return true;
|
|
5
|
-
else if (obj.toString() === "")
|
|
6
|
-
return true;
|
|
7
|
-
else
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
static shortId() {
|
|
11
|
-
return this.generate(UniqueIdHelper.chars, 11);
|
|
12
|
-
}
|
|
13
|
-
static generateAlphanumeric() {
|
|
14
|
-
return this.generate(UniqueIdHelper.alphanumericChars, 11);
|
|
15
|
-
}
|
|
16
|
-
static generate(charList, length) {
|
|
17
|
-
let result = "";
|
|
18
|
-
for (let i = 0; i < length; i++) {
|
|
19
|
-
const idx = Math.floor(Math.random() * charList.length);
|
|
20
|
-
const c = charList[idx];
|
|
21
|
-
result += c;
|
|
22
|
-
}
|
|
23
|
-
return result;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
UniqueIdHelper.chars = [
|
|
27
|
-
"A",
|
|
28
|
-
"B",
|
|
29
|
-
"C",
|
|
30
|
-
"D",
|
|
31
|
-
"E",
|
|
32
|
-
"F",
|
|
33
|
-
"G",
|
|
34
|
-
"H",
|
|
35
|
-
"I",
|
|
36
|
-
"J",
|
|
37
|
-
"K",
|
|
38
|
-
"L",
|
|
39
|
-
"M",
|
|
40
|
-
"N",
|
|
41
|
-
"O",
|
|
42
|
-
"P",
|
|
43
|
-
"Q",
|
|
44
|
-
"R",
|
|
45
|
-
"S",
|
|
46
|
-
"T",
|
|
47
|
-
"U",
|
|
48
|
-
"V",
|
|
49
|
-
"W",
|
|
50
|
-
"X",
|
|
51
|
-
"Y",
|
|
52
|
-
"Z",
|
|
53
|
-
"a",
|
|
54
|
-
"b",
|
|
55
|
-
"c",
|
|
56
|
-
"d",
|
|
57
|
-
"e",
|
|
58
|
-
"f",
|
|
59
|
-
"g",
|
|
60
|
-
"h",
|
|
61
|
-
"i",
|
|
62
|
-
"j",
|
|
63
|
-
"k",
|
|
64
|
-
"l",
|
|
65
|
-
"m",
|
|
66
|
-
"n",
|
|
67
|
-
"o",
|
|
68
|
-
"p",
|
|
69
|
-
"q",
|
|
70
|
-
"r",
|
|
71
|
-
"s",
|
|
72
|
-
"t",
|
|
73
|
-
"u",
|
|
74
|
-
"v",
|
|
75
|
-
"w",
|
|
76
|
-
"x",
|
|
77
|
-
"y",
|
|
78
|
-
"z",
|
|
79
|
-
"0",
|
|
80
|
-
"1",
|
|
81
|
-
"2",
|
|
82
|
-
"3",
|
|
83
|
-
"4",
|
|
84
|
-
"5",
|
|
85
|
-
"6",
|
|
86
|
-
"7",
|
|
87
|
-
"8",
|
|
88
|
-
"9",
|
|
89
|
-
"0",
|
|
90
|
-
"-",
|
|
91
|
-
"_"
|
|
92
|
-
];
|
|
93
|
-
UniqueIdHelper.alphanumericChars = [
|
|
94
|
-
"A",
|
|
95
|
-
"B",
|
|
96
|
-
"C",
|
|
97
|
-
"D",
|
|
98
|
-
"E",
|
|
99
|
-
"F",
|
|
100
|
-
"G",
|
|
101
|
-
"H",
|
|
102
|
-
"I",
|
|
103
|
-
"J",
|
|
104
|
-
"K",
|
|
105
|
-
"L",
|
|
106
|
-
"M",
|
|
107
|
-
"N",
|
|
108
|
-
"O",
|
|
109
|
-
"P",
|
|
110
|
-
"Q",
|
|
111
|
-
"R",
|
|
112
|
-
"S",
|
|
113
|
-
"T",
|
|
114
|
-
"U",
|
|
115
|
-
"V",
|
|
116
|
-
"W",
|
|
117
|
-
"X",
|
|
118
|
-
"Y",
|
|
119
|
-
"Z",
|
|
120
|
-
"a",
|
|
121
|
-
"b",
|
|
122
|
-
"c",
|
|
123
|
-
"d",
|
|
124
|
-
"e",
|
|
125
|
-
"f",
|
|
126
|
-
"g",
|
|
127
|
-
"h",
|
|
128
|
-
"i",
|
|
129
|
-
"j",
|
|
130
|
-
"k",
|
|
131
|
-
"l",
|
|
132
|
-
"m",
|
|
133
|
-
"n",
|
|
134
|
-
"o",
|
|
135
|
-
"p",
|
|
136
|
-
"q",
|
|
137
|
-
"r",
|
|
138
|
-
"s",
|
|
139
|
-
"t",
|
|
140
|
-
"u",
|
|
141
|
-
"v",
|
|
142
|
-
"w",
|
|
143
|
-
"x",
|
|
144
|
-
"y",
|
|
145
|
-
"z",
|
|
146
|
-
"0",
|
|
147
|
-
"1",
|
|
148
|
-
"2",
|
|
149
|
-
"3",
|
|
150
|
-
"4",
|
|
151
|
-
"5",
|
|
152
|
-
"6",
|
|
153
|
-
"7",
|
|
154
|
-
"8",
|
|
155
|
-
"9",
|
|
156
|
-
"0"
|
|
157
|
-
];
|
|
158
|
-
//# sourceMappingURL=UniqueIdHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UniqueIdHelper.js","sourceRoot":"","sources":["../../src/helpers/UniqueIdHelper.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAc;IAwIlB,MAAM,CAAC,SAAS,CAAC,GAAQ;QAC9B,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;aAC9C,IAAI,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE;YAAE,OAAO,IAAI,CAAC;;YACvC,OAAO,KAAK,CAAC;IACpB,CAAC;IAEM,MAAM,CAAC,OAAO;QACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACjD,CAAC;IAEM,MAAM,CAAC,oBAAoB;QAChC,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,QAAkB,EAAE,MAAc;QACvD,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAChC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;YACxD,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;YACxB,MAAM,IAAI,CAAC,CAAC;QACd,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;;AA5JM,oBAAK,GAAG;IACb,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;CACJ,CAAC;AAEK,gCAAiB,GAAG;IACzB,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;CACJ,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { UserInterface, UserContextInterface, IApiPermission, PersonInterface, LoginUserChurchInterface } from "@churchapps/helpers";
|
|
2
|
-
export declare class UserHelper {
|
|
3
|
-
static currentUserChurch: LoginUserChurchInterface;
|
|
4
|
-
static userChurches: LoginUserChurchInterface[];
|
|
5
|
-
static user: UserInterface;
|
|
6
|
-
static churchChanged: boolean;
|
|
7
|
-
static person: PersonInterface;
|
|
8
|
-
static selectChurch: (context?: UserContextInterface, churchId?: string, keyName?: string) => Promise<void>;
|
|
9
|
-
static setupApiHelper(userChurch: LoginUserChurchInterface): void;
|
|
10
|
-
static setupApiHelperNoChurch(user: LoginUserChurchInterface): void;
|
|
11
|
-
static checkAccess({ api, contentType, action }: IApiPermission): boolean;
|
|
12
|
-
static createAppUrl(appUrl: string, returnUrl: string): string;
|
|
13
|
-
static redirectToLogin(returnUrl?: string, handleRedirect?: (url: string) => void): void;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=UserHelper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UserHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/UserHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,cAAc,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAErI,qBAAa,UAAU;IACrB,MAAM,CAAC,iBAAiB,EAAE,wBAAwB,CAAC;IACnD,MAAM,CAAC,YAAY,EAAE,wBAAwB,EAAE,CAAC;IAChD,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC;IAC3B,MAAM,CAAC,aAAa,EAAE,OAAO,CAAS;IACtC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAE/B,MAAM,CAAC,YAAY,GAAU,UAAU,oBAAoB,EAAE,WAAW,MAAM,EAAE,UAAU,MAAM,mBAyC9F;IAEF,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,wBAAwB;IAK1D,MAAM,CAAC,sBAAsB,CAAC,IAAI,EAAE,wBAAwB;IAI5D,MAAM,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,cAAc,GAAG,OAAO;IAezE,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAUrD,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI;CAclF"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
var _a;
|
|
2
|
-
import { ApiHelper } from "@churchapps/helpers";
|
|
3
|
-
export class UserHelper {
|
|
4
|
-
static setupApiHelper(userChurch) {
|
|
5
|
-
ApiHelper.setDefaultPermissions(userChurch.jwt);
|
|
6
|
-
(userChurch.apis || []).forEach(api => { ApiHelper.setPermissions(api.keyName || "", api.jwt, api.permissions); });
|
|
7
|
-
}
|
|
8
|
-
static setupApiHelperNoChurch(user) {
|
|
9
|
-
ApiHelper.setDefaultPermissions(user.jwt);
|
|
10
|
-
}
|
|
11
|
-
static checkAccess({ api, contentType, action }) {
|
|
12
|
-
const config = ApiHelper.getConfig(api);
|
|
13
|
-
if (!config)
|
|
14
|
-
return false;
|
|
15
|
-
const permissions = config.permissions || [];
|
|
16
|
-
let result = false;
|
|
17
|
-
if (permissions !== undefined) {
|
|
18
|
-
permissions.forEach((element) => {
|
|
19
|
-
if (element.contentType === contentType && element.action === action)
|
|
20
|
-
result = true;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return result;
|
|
24
|
-
}
|
|
25
|
-
static createAppUrl(appUrl, returnUrl) {
|
|
26
|
-
const jwt = ApiHelper.getConfig("MembershipApi")?.jwt;
|
|
27
|
-
if (jwt) {
|
|
28
|
-
return `${appUrl}/login/?jwt=${jwt}&returnUrl=${encodeURIComponent(returnUrl)}`;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
return `${appUrl}/login/?returnUrl=${encodeURIComponent(returnUrl)}`;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
static redirectToLogin(returnUrl, handleRedirect) {
|
|
35
|
-
if (typeof window !== "undefined") {
|
|
36
|
-
const currentUrl = returnUrl || window.location.pathname + window.location.search;
|
|
37
|
-
const encodedReturnUrl = encodeURIComponent(currentUrl);
|
|
38
|
-
const loginUrl = `/login?returnUrl=${encodedReturnUrl}`;
|
|
39
|
-
// Use handleRedirect function if available, otherwise fallback to window.location
|
|
40
|
-
if (handleRedirect) {
|
|
41
|
-
handleRedirect(loginUrl);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
window.location.href = loginUrl;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
_a = UserHelper;
|
|
50
|
-
UserHelper.churchChanged = false;
|
|
51
|
-
UserHelper.selectChurch = async (context, churchId, keyName) => {
|
|
52
|
-
let userChurch = null;
|
|
53
|
-
// Ensure userChurches is initialized
|
|
54
|
-
if (!_a.userChurches || !Array.isArray(_a.userChurches)) {
|
|
55
|
-
console.error("UserHelper.userChurches is not initialized or not an array:", _a.userChurches);
|
|
56
|
-
// Try to get userChurches from context if available
|
|
57
|
-
if (context?.userChurches && Array.isArray(context.userChurches)) {
|
|
58
|
-
_a.userChurches = context.userChurches;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
console.error("Cannot select church: no valid userChurches available");
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if (churchId) {
|
|
66
|
-
_a.userChurches.forEach(uc => {
|
|
67
|
-
if (uc.church.id === churchId)
|
|
68
|
-
userChurch = uc;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
else if (keyName)
|
|
72
|
-
_a.userChurches.forEach(uc => { if (uc.church.subDomain === keyName)
|
|
73
|
-
userChurch = uc; });
|
|
74
|
-
else
|
|
75
|
-
userChurch = _a.userChurches[0];
|
|
76
|
-
if (!userChurch)
|
|
77
|
-
return;
|
|
78
|
-
else {
|
|
79
|
-
_a.currentUserChurch = userChurch;
|
|
80
|
-
_a.setupApiHelper(_a.currentUserChurch);
|
|
81
|
-
// TODO - remove context code from here and perform the logic in the component itself.
|
|
82
|
-
if (context) {
|
|
83
|
-
if (context.userChurch !== null)
|
|
84
|
-
_a.churchChanged = true;
|
|
85
|
-
context.setUserChurch(_a.currentUserChurch);
|
|
86
|
-
// Also ensure user is still set in context
|
|
87
|
-
if (_a.user && context.setUser) {
|
|
88
|
-
context.setUser(_a.user);
|
|
89
|
-
}
|
|
90
|
-
// Update person if available
|
|
91
|
-
if (_a.person && context.setPerson) {
|
|
92
|
-
context.setPerson(_a.person);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
//# sourceMappingURL=UserHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UserHelper.js","sourceRoot":"","sources":["../../src/helpers/UserHelper.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD,MAAM,OAAO,UAAU;IAkDrB,MAAM,CAAC,cAAc,CAAC,UAAoC;QACxD,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAChD,CAAC,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,CAAC,cAAc,CAAC,GAAG,CAAC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