@churchapps/helpers 1.2.3 → 1.2.5

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.
Files changed (53) hide show
  1. package/.eslintrc.json +28 -28
  2. package/.github/FUNDING.yml +1 -1
  3. package/.prettierrc +11 -11
  4. package/.yarnrc.yml +5 -5
  5. package/LICENSE +21 -21
  6. package/README.md +15 -15
  7. package/dist/ApiHelper.d.ts.map +1 -1
  8. package/dist/ApiHelper.js +4 -10
  9. package/dist/ApiHelper.js.map +1 -1
  10. package/dist/ArrayHelper.js +2 -1
  11. package/dist/ArrayHelper.js.map +1 -1
  12. package/dist/CommonEnvironmentHelper.d.ts +1 -1
  13. package/dist/CommonEnvironmentHelper.d.ts.map +1 -1
  14. package/dist/CommonEnvironmentHelper.js +5 -5
  15. package/dist/CommonEnvironmentHelper.js.map +1 -1
  16. package/dist/DateHelper.d.ts.map +1 -1
  17. package/dist/DateHelper.js +2 -0
  18. package/dist/DateHelper.js.map +1 -1
  19. package/dist/PersonHelper.js +2 -2
  20. package/dist/PersonHelper.js.map +1 -1
  21. package/dist/UserHelper.d.ts.map +1 -1
  22. package/dist/UserHelper.js +6 -2
  23. package/dist/UserHelper.js.map +1 -1
  24. package/package.json +50 -49
  25. package/scripts/build-cjs.js +32 -32
  26. package/src/ApiHelper.ts +169 -176
  27. package/src/AppearanceHelper.ts +69 -69
  28. package/src/ArrayHelper.ts +157 -157
  29. package/src/CommonEnvironmentHelper.ts +104 -104
  30. package/src/CurrencyHelper.ts +10 -10
  31. package/src/DateHelper.ts +154 -153
  32. package/src/DonationHelper.ts +26 -26
  33. package/src/ErrorHelper.ts +39 -39
  34. package/src/EventHelper.ts +49 -49
  35. package/src/FileHelper.ts +55 -55
  36. package/src/PersonHelper.ts +82 -82
  37. package/src/UniqueIdHelper.ts +36 -36
  38. package/src/UserHelper.ts +62 -59
  39. package/src/index.ts +15 -15
  40. package/src/interfaces/Access.ts +138 -138
  41. package/src/interfaces/Attendance.ts +45 -45
  42. package/src/interfaces/Content.ts +84 -84
  43. package/src/interfaces/Doing.ts +93 -93
  44. package/src/interfaces/Donation.ts +190 -190
  45. package/src/interfaces/Error.ts +17 -17
  46. package/src/interfaces/Membership.ts +184 -184
  47. package/src/interfaces/Messaging.ts +96 -96
  48. package/src/interfaces/Permissions.ts +92 -92
  49. package/src/interfaces/Reporting.ts +41 -41
  50. package/src/interfaces/UserContextInterface.ts +13 -13
  51. package/src/interfaces/index.ts +13 -13
  52. package/tsconfig.json +36 -36
  53. package/CLAUDE.md +0 -98
@@ -1,157 +1,157 @@
1
- import { UniqueIdHelper } from "./UniqueIdHelper";
2
-
3
- export class ArrayHelper {
4
- static getIds(array: any[], propertyName: string) {
5
- const result: string[] = [];
6
- for (const item of array) {
7
- const id = item[propertyName]?.toString();
8
- if (!UniqueIdHelper.isMissing(id) && result.indexOf(id) === -1) result.push(id);
9
- }
10
- return result;
11
- }
12
-
13
- static sortBy(array: any[], propertyName: string, descending: boolean = false) {
14
- array.sort((a, b) => {
15
- const valA = a[propertyName];
16
- const valB = b[propertyName];
17
- if (valA < valB) return descending ? 1 : -1;
18
- else return descending ? -1 : 1;
19
- });
20
- }
21
-
22
- static getIndex(array: any[], propertyName: string, value: any) {
23
- for (let i = 0; i < array.length; i++) {
24
- const item = array[i];
25
- if (ArrayHelper.compare(item, propertyName, value)) return i;
26
- }
27
- return -1;
28
- }
29
-
30
- static getOne(array: any[], propertyName: string, value: any) {
31
- for (const item of array || []) if (ArrayHelper.compare(item, propertyName, value)) return item;
32
- return null
33
- }
34
-
35
- static getAll(array: any[], propertyName: string, value: any) {
36
- const result: any[] = []
37
- for (const item of array || []) {
38
- if (ArrayHelper.compare(item, propertyName, value)) result.push(item);
39
- }
40
- return result;
41
- }
42
-
43
- static getAllArray(array: any[], propertyName: string, values: any[]) {
44
- const result: any[] = []
45
- for (const item of array || []) if (values.indexOf(item[propertyName]) > -1) result.push(item);
46
- return result;
47
- }
48
-
49
- private static compare(item: any, propertyName: string, value: any) {
50
- const propChain = propertyName.split(".");
51
- if (propChain.length === 1) return item[propertyName] === value;
52
- else {
53
- let obj = item;
54
- for (let i = 0; i < propChain.length - 1; i++) {
55
- if (obj && obj[propChain[i]] !== undefined) obj = obj[propChain[i]];
56
- else return false;
57
- }
58
- return obj[propChain[propChain.length - 1]] === value;
59
- }
60
- }
61
-
62
- static getUniqueValues(array: any[], propertyName: string) {
63
- const result: any[] = [];
64
-
65
- for (const item of array) {
66
- const val = (propertyName.indexOf(".") === -1) ? item[propertyName] : this.getDeepValue(item, propertyName)
67
- if (result.indexOf(val) === -1) result.push(val);
68
- }
69
- return result;
70
- }
71
-
72
- static getUnique(array: any[]) {
73
- const result: any[] = []
74
- const jsonList: string[] = [];
75
- for (const item of array) {
76
- const json = JSON.stringify(item);
77
- if (jsonList.indexOf(json) === -1) {
78
- result.push(item);
79
- jsonList.push(json);
80
- }
81
- }
82
- return result;
83
- }
84
-
85
- static getAllOperatorArray(array: any[], propertyName: string, values: any[], operator: string, dataType = "string") {
86
- const result: any[] = [];
87
- values.forEach(v => {
88
- const filtered = this.getAllOperator(array, propertyName, v, operator.replace("notIn", "notEqual").replace("in", "equals").replace("donatedToAny", "equals").replace("donatedTo", "equals").replace("attendedCampus", "equals").replace("attendedAny", "equals").replace("attendedServiceTime", "equals").replace("attendedService", "equals").replace("attendedGroup", "equals"), dataType);
89
- filtered.forEach(f => result.push(f));
90
- })
91
- return result;
92
- }
93
-
94
- static getAllOperator(array: any[], propertyName: string, value: any, operator: string, dataType = "string") {
95
- const result: any[] = []
96
- for (const item of array) {
97
-
98
-
99
- let propVal = item[propertyName] || "";
100
- let compVal = value || "";
101
- if (dataType === "number") {
102
- propVal = parseFloat(propVal);
103
- compVal = parseFloat(compVal);
104
- } else if (dataType === "string") {
105
- propVal = propVal.toLowerCase();
106
- compVal = compVal.toLowerCase();
107
- }
108
-
109
- switch (operator) {
110
- case "equals":
111
- if (propVal === compVal) result.push(item);
112
- break;
113
- case "startsWith":
114
- if (propVal.indexOf(compVal) === 0) result.push(item);
115
- break;
116
- case "endsWith":
117
- if (propVal.indexOf(compVal) === propVal.length - compVal.length) result.push(item);
118
- break;
119
- case "contains":
120
- if (propVal.indexOf(compVal) > -1) result.push(item);
121
- break;
122
- case "greaterThan":
123
- if (propVal > compVal) result.push(item);
124
- break;
125
- case "greaterThanEqual":
126
- if (propVal >= compVal) result.push(item);
127
- break;
128
- case "lessThan":
129
- if (propVal < compVal) result.push(item);
130
- break;
131
- case "lessThanEqual":
132
- if (propVal <= compVal) result.push(item);
133
- break;
134
- case "notEqual":
135
- if (propVal !== compVal) result.push(item);
136
- break;
137
- }
138
- }
139
- return result;
140
- }
141
-
142
- static getDeepValue(item: any, propertyName: string) {
143
- const propertyNames = propertyName.split(".");
144
- let result: any = item;
145
- propertyNames.forEach(name => {
146
- result = result[name];
147
- });
148
- return result;
149
- }
150
-
151
- static fillArray(contents: string, length: number) {
152
- const result = [];
153
- for (let i = 0; i < length; i++) result.push(contents);
154
- return result;
155
- }
156
-
157
- }
1
+ import { UniqueIdHelper } from "./UniqueIdHelper";
2
+
3
+ export class ArrayHelper {
4
+ static getIds(array: any[], propertyName: string) {
5
+ const result: string[] = [];
6
+ for (const item of array) {
7
+ const id = item[propertyName]?.toString();
8
+ if (!UniqueIdHelper.isMissing(id) && result.indexOf(id) === -1) result.push(id);
9
+ }
10
+ return result;
11
+ }
12
+
13
+ static sortBy(array: any[], propertyName: string, descending: boolean = false) {
14
+ array.sort((a, b) => {
15
+ const valA = a[propertyName];
16
+ const valB = b[propertyName];
17
+ if (valA < valB) return descending ? 1 : -1;
18
+ else return descending ? -1 : 1;
19
+ });
20
+ }
21
+
22
+ static getIndex(array: any[], propertyName: string, value: any) {
23
+ for (let i = 0; i < array.length; i++) {
24
+ const item = array[i];
25
+ if (ArrayHelper.compare(item, propertyName, value)) return i;
26
+ }
27
+ return -1;
28
+ }
29
+
30
+ static getOne(array: any[], propertyName: string, value: any) {
31
+ for (const item of array || []) if (ArrayHelper.compare(item, propertyName, value)) return item;
32
+ return null
33
+ }
34
+
35
+ static getAll(array: any[], propertyName: string, value: any) {
36
+ const result: any[] = []
37
+ for (const item of array || []) {
38
+ if (ArrayHelper.compare(item, propertyName, value)) result.push(item);
39
+ }
40
+ return result;
41
+ }
42
+
43
+ static getAllArray(array: any[], propertyName: string, values: any[]) {
44
+ const result: any[] = []
45
+ for (const item of array || []) if (values.indexOf(item[propertyName]) > -1) result.push(item);
46
+ return result;
47
+ }
48
+
49
+ private static compare(item: any, propertyName: string, value: any) {
50
+ const propChain = propertyName.split(".");
51
+ if (propChain.length === 1) return item[propertyName] === value;
52
+ else {
53
+ let obj = item;
54
+ for (let i = 0; i < propChain.length - 1; i++) {
55
+ if (obj && obj[propChain[i]] !== undefined) obj = obj[propChain[i]];
56
+ else return false;
57
+ }
58
+ return obj[propChain[propChain.length - 1]] === value;
59
+ }
60
+ }
61
+
62
+ static getUniqueValues(array: any[], propertyName: string) {
63
+ const result: any[] = [];
64
+
65
+ for (const item of array) {
66
+ const val = (propertyName.indexOf(".") === -1) ? item[propertyName] : this.getDeepValue(item, propertyName)
67
+ if (result.indexOf(val) === -1) result.push(val);
68
+ }
69
+ return result;
70
+ }
71
+
72
+ static getUnique(array: any[]) {
73
+ const result: any[] = []
74
+ const jsonList: string[] = [];
75
+ for (const item of array) {
76
+ const json = JSON.stringify(item);
77
+ if (jsonList.indexOf(json) === -1) {
78
+ result.push(item);
79
+ jsonList.push(json);
80
+ }
81
+ }
82
+ return result;
83
+ }
84
+
85
+ static getAllOperatorArray(array: any[], propertyName: string, values: any[], operator: string, dataType = "string") {
86
+ const result: any[] = [];
87
+ values.forEach(v => {
88
+ const filtered = this.getAllOperator(array, propertyName, v, operator.replace("notIn", "notEqual").replace("in", "equals").replace("donatedToAny", "equals").replace("donatedTo", "equals").replace("attendedCampus", "equals").replace("attendedAny", "equals").replace("attendedServiceTime", "equals").replace("attendedService", "equals").replace("attendedGroup", "equals"), dataType);
89
+ filtered.forEach(f => result.push(f));
90
+ })
91
+ return result;
92
+ }
93
+
94
+ static getAllOperator(array: any[], propertyName: string, value: any, operator: string, dataType = "string") {
95
+ const result: any[] = []
96
+ for (const item of array) {
97
+
98
+
99
+ let propVal = item[propertyName] || "";
100
+ let compVal = value || "";
101
+ if (dataType === "number") {
102
+ propVal = parseFloat(propVal);
103
+ compVal = parseFloat(compVal);
104
+ } else if (dataType === "string") {
105
+ propVal = propVal.toLowerCase();
106
+ compVal = compVal.toLowerCase();
107
+ }
108
+
109
+ switch (operator) {
110
+ case "equals":
111
+ if (propVal === compVal) result.push(item);
112
+ break;
113
+ case "startsWith":
114
+ if (propVal.indexOf(compVal) === 0) result.push(item);
115
+ break;
116
+ case "endsWith":
117
+ if (propVal.indexOf(compVal) === propVal.length - compVal.length) result.push(item);
118
+ break;
119
+ case "contains":
120
+ if (propVal.indexOf(compVal) > -1) result.push(item);
121
+ break;
122
+ case "greaterThan":
123
+ if (propVal > compVal) result.push(item);
124
+ break;
125
+ case "greaterThanEqual":
126
+ if (propVal >= compVal) result.push(item);
127
+ break;
128
+ case "lessThan":
129
+ if (propVal < compVal) result.push(item);
130
+ break;
131
+ case "lessThanEqual":
132
+ if (propVal <= compVal) result.push(item);
133
+ break;
134
+ case "notEqual":
135
+ if (propVal !== compVal) result.push(item);
136
+ break;
137
+ }
138
+ }
139
+ return result;
140
+ }
141
+
142
+ static getDeepValue(item: any, propertyName: string) {
143
+ const propertyNames = propertyName.split(".");
144
+ let result: any = item;
145
+ propertyNames.forEach(name => {
146
+ if (result != null) result = result[name];
147
+ });
148
+ return result;
149
+ }
150
+
151
+ static fillArray(contents: string, length: number) {
152
+ const result = [];
153
+ for (let i = 0; i < length; i++) result.push(contents);
154
+ return result;
155
+ }
156
+
157
+ }
@@ -1,104 +1,104 @@
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 AskApi = "";
12
- public static GoogleAnalyticsTag = "";
13
-
14
- static ContentRoot = "";
15
- static B1Root = "";
16
- static ChumsRoot = "";
17
- static LessonsRoot = "";
18
-
19
- static init = (stage: string) => {
20
- switch (stage) {
21
- case "demo": CommonEnvironmentHelper.initDemo(); break;
22
- case "staging": CommonEnvironmentHelper.initStaging(); break;
23
- case "prod": CommonEnvironmentHelper.initProd(); break;
24
- default: CommonEnvironmentHelper.initDev(); break;
25
- }
26
- }
27
-
28
- static initDev = () => {
29
- this.initStaging(); //Use staging values for anything not provided
30
- CommonEnvironmentHelper.AttendanceApi = process.env.REACT_APP_ATTENDANCE_API || process.env.NEXT_PUBLIC_ATTENDANCE_API || CommonEnvironmentHelper.AttendanceApi;
31
- CommonEnvironmentHelper.DoingApi = process.env.REACT_APP_DOING_API || process.env.NEXT_PUBLIC_DOING_API || CommonEnvironmentHelper.DoingApi;
32
- CommonEnvironmentHelper.GivingApi = process.env.REACT_APP_GIVING_API || process.env.NEXT_PUBLIC_GIVING_API || CommonEnvironmentHelper.GivingApi;
33
- CommonEnvironmentHelper.MembershipApi = process.env.REACT_APP_MEMBERSHIP_API || process.env.NEXT_PUBLIC_MEMBERSHIP_API || CommonEnvironmentHelper.MembershipApi;
34
- CommonEnvironmentHelper.ReportingApi = process.env.REACT_APP_REPORTING_API || process.env.NEXT_PUBLIC_REPORTING_API || CommonEnvironmentHelper.ReportingApi;
35
- CommonEnvironmentHelper.MessagingApi = process.env.REACT_APP_MESSAGING_API || process.env.NEXT_PUBLIC_MESSAGING_API || CommonEnvironmentHelper.MessagingApi;
36
- CommonEnvironmentHelper.MessagingApiSocket = process.env.REACT_APP_MESSAGING_API_SOCKET || process.env.NEXT_PUBLIC_MESSAGING_API_SOCKET || CommonEnvironmentHelper.MessagingApiSocket;
37
- CommonEnvironmentHelper.ContentApi = process.env.REACT_APP_CONTENT_API || process.env.NEXT_PUBLIC_CONTENT_API || CommonEnvironmentHelper.ContentApi;
38
- CommonEnvironmentHelper.AskApi = process.env.REACT_APP_ASK_API || process.env.NEXT_PUBLIC_ASK_API || CommonEnvironmentHelper.AskApi;
39
- CommonEnvironmentHelper.GoogleAnalyticsTag = process.env.REACT_APP_GOOGLE_ANALYTICS || process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS || CommonEnvironmentHelper.GoogleAnalyticsTag;
40
-
41
- CommonEnvironmentHelper.ContentRoot = process.env.REACT_APP_CONTENT_ROOT || process.env.NEXT_PUBLIC_CONTENT_ROOT || CommonEnvironmentHelper.ContentRoot;
42
- CommonEnvironmentHelper.B1Root = process.env.REACT_APP_B1_ROOT || process.env.NEXT_PUBLIC_B1_ROOT || CommonEnvironmentHelper.B1Root;
43
- CommonEnvironmentHelper.ChumsRoot = process.env.REACT_APP_CHUMS_ROOT || process.env.NEXT_PUBLIC_CHUMS_ROOT || CommonEnvironmentHelper.ChumsRoot;
44
- CommonEnvironmentHelper.LessonsRoot = process.env.REACT_APP_LESSONS_ROOT || process.env.NEXT_PUBLIC_LESSONS_ROOT || CommonEnvironmentHelper.LessonsRoot;
45
- }
46
-
47
- //NOTE: None of these values are secret.
48
- static initDemo = () => {
49
- CommonEnvironmentHelper.AttendanceApi = "https://api.demo.churchapps.org/attendance";
50
- CommonEnvironmentHelper.DoingApi = "https://api.demo.churchapps.org/doing";
51
- CommonEnvironmentHelper.GivingApi = "https://api.demo.churchapps.org/giving";
52
- CommonEnvironmentHelper.MembershipApi = "https://api.demo.churchapps.org/membership";
53
- CommonEnvironmentHelper.ReportingApi = "https://api.demo.churchapps.org/reporting";
54
- CommonEnvironmentHelper.MessagingApi = "https://api.demo.churchapps.org/messaging";
55
- CommonEnvironmentHelper.MessagingApiSocket = "wss://socket.demo.churchapps.org";
56
- CommonEnvironmentHelper.ContentApi = "https://api.demo.churchapps.org/content";
57
- CommonEnvironmentHelper.AskApi = "https://askapi.demo.churchapps.org";
58
- CommonEnvironmentHelper.GoogleAnalyticsTag = "";
59
-
60
- CommonEnvironmentHelper.ContentRoot = "https://democontent.churchapps.org";
61
- CommonEnvironmentHelper.B1Root = "https://{key}.demo.b1.church";
62
- CommonEnvironmentHelper.ChumsRoot = "https://app.demo.chums.org";
63
- CommonEnvironmentHelper.LessonsRoot = "https://demo.lessons.church";
64
- }
65
-
66
- //NOTE: None of these values are secret.
67
- static initStaging = () => {
68
- CommonEnvironmentHelper.AttendanceApi = "https://api.staging.churchapps.org/attendance";
69
- CommonEnvironmentHelper.DoingApi = "https://api.staging.churchapps.org/doing";
70
- CommonEnvironmentHelper.GivingApi = "https://api.staging.churchapps.org/giving";
71
- CommonEnvironmentHelper.MembershipApi = "https://api.staging.churchapps.org/membership";
72
- CommonEnvironmentHelper.ReportingApi = "https://api.staging.churchapps.org/reporting";
73
- CommonEnvironmentHelper.MessagingApi = "https://api.staging.churchapps.org/messaging";
74
- CommonEnvironmentHelper.MessagingApiSocket = "wss://socket.staging.churchapps.org";
75
- CommonEnvironmentHelper.ContentApi = "https://api.staging.churchapps.org/content";
76
- CommonEnvironmentHelper.AskApi = "https://askapi.staging.churchapps.org";
77
- CommonEnvironmentHelper.GoogleAnalyticsTag = "";
78
-
79
- CommonEnvironmentHelper.ContentRoot = "https://content.staging.churchapps.org";
80
- CommonEnvironmentHelper.B1Root = "https://{key}.staging.b1.church";
81
- CommonEnvironmentHelper.ChumsRoot = "https://app.staging.chums.org";
82
- CommonEnvironmentHelper.LessonsRoot = "https://staging.lessons.church";
83
- }
84
-
85
- //NOTE: None of these values are secret.
86
- static initProd = () => {
87
- CommonEnvironmentHelper.AttendanceApi = "https://api.churchapps.org/attendance";
88
- CommonEnvironmentHelper.DoingApi = "https://api.churchapps.org/doing";
89
- CommonEnvironmentHelper.GivingApi = "https://api.churchapps.org/giving";
90
- CommonEnvironmentHelper.MembershipApi = "https://api.churchapps.org/membership";
91
- CommonEnvironmentHelper.ReportingApi = "https://api.churchapps.org/reporting";
92
- CommonEnvironmentHelper.MessagingApi = "https://api.churchapps.org/messaging";
93
- CommonEnvironmentHelper.MessagingApiSocket = "wss://socket.churchapps.org";
94
- CommonEnvironmentHelper.ContentApi = "https://api.churchapps.org/content";
95
- CommonEnvironmentHelper.AskApi = "https://askapi.churchapps.org";
96
-
97
- CommonEnvironmentHelper.ContentRoot = "https://content.churchapps.org";
98
- CommonEnvironmentHelper.B1Root = "https://{key}.b1.church";
99
- CommonEnvironmentHelper.ChumsRoot = "https://app.chums.org";
100
- CommonEnvironmentHelper.LessonsRoot = "https://lessons.church";
101
- }
102
-
103
- }
104
-
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 AskApi = "";
12
+ public static GoogleAnalyticsTag = "";
13
+
14
+ static ContentRoot = "";
15
+ static B1Root = "";
16
+ static B1AdminRoot = "";
17
+ static LessonsRoot = "";
18
+
19
+ static init = (stage: string) => {
20
+ switch (stage) {
21
+ case "demo": CommonEnvironmentHelper.initDemo(); break;
22
+ case "staging": CommonEnvironmentHelper.initStaging(); break;
23
+ case "prod": CommonEnvironmentHelper.initProd(); break;
24
+ default: CommonEnvironmentHelper.initDev(); break;
25
+ }
26
+ }
27
+
28
+ static initDev = () => {
29
+ this.initStaging(); //Use staging values for anything not provided
30
+ CommonEnvironmentHelper.AttendanceApi = process.env.REACT_APP_ATTENDANCE_API || process.env.NEXT_PUBLIC_ATTENDANCE_API || CommonEnvironmentHelper.AttendanceApi;
31
+ CommonEnvironmentHelper.DoingApi = process.env.REACT_APP_DOING_API || process.env.NEXT_PUBLIC_DOING_API || CommonEnvironmentHelper.DoingApi;
32
+ CommonEnvironmentHelper.GivingApi = process.env.REACT_APP_GIVING_API || process.env.NEXT_PUBLIC_GIVING_API || CommonEnvironmentHelper.GivingApi;
33
+ CommonEnvironmentHelper.MembershipApi = process.env.REACT_APP_MEMBERSHIP_API || process.env.NEXT_PUBLIC_MEMBERSHIP_API || CommonEnvironmentHelper.MembershipApi;
34
+ CommonEnvironmentHelper.ReportingApi = process.env.REACT_APP_REPORTING_API || process.env.NEXT_PUBLIC_REPORTING_API || CommonEnvironmentHelper.ReportingApi;
35
+ CommonEnvironmentHelper.MessagingApi = process.env.REACT_APP_MESSAGING_API || process.env.NEXT_PUBLIC_MESSAGING_API || CommonEnvironmentHelper.MessagingApi;
36
+ CommonEnvironmentHelper.MessagingApiSocket = process.env.REACT_APP_MESSAGING_API_SOCKET || process.env.NEXT_PUBLIC_MESSAGING_API_SOCKET || CommonEnvironmentHelper.MessagingApiSocket;
37
+ CommonEnvironmentHelper.ContentApi = process.env.REACT_APP_CONTENT_API || process.env.NEXT_PUBLIC_CONTENT_API || CommonEnvironmentHelper.ContentApi;
38
+ CommonEnvironmentHelper.AskApi = process.env.REACT_APP_ASK_API || process.env.NEXT_PUBLIC_ASK_API || CommonEnvironmentHelper.AskApi;
39
+ CommonEnvironmentHelper.GoogleAnalyticsTag = process.env.REACT_APP_GOOGLE_ANALYTICS || process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS || CommonEnvironmentHelper.GoogleAnalyticsTag;
40
+
41
+ CommonEnvironmentHelper.ContentRoot = process.env.REACT_APP_CONTENT_ROOT || process.env.NEXT_PUBLIC_CONTENT_ROOT || CommonEnvironmentHelper.ContentRoot;
42
+ CommonEnvironmentHelper.B1Root = process.env.REACT_APP_B1_ROOT || process.env.NEXT_PUBLIC_B1_ROOT || CommonEnvironmentHelper.B1Root;
43
+ CommonEnvironmentHelper.B1AdminRoot = process.env.REACT_APP_B1ADMIN_ROOT || process.env.NEXT_PUBLIC_B1ADMIN_ROOT || CommonEnvironmentHelper.B1AdminRoot;
44
+ CommonEnvironmentHelper.LessonsRoot = process.env.REACT_APP_LESSONS_ROOT || process.env.NEXT_PUBLIC_LESSONS_ROOT || CommonEnvironmentHelper.LessonsRoot;
45
+ }
46
+
47
+ //NOTE: None of these values are secret.
48
+ static initDemo = () => {
49
+ CommonEnvironmentHelper.AttendanceApi = "https://api.demo.churchapps.org/attendance";
50
+ CommonEnvironmentHelper.DoingApi = "https://api.demo.churchapps.org/doing";
51
+ CommonEnvironmentHelper.GivingApi = "https://api.demo.churchapps.org/giving";
52
+ CommonEnvironmentHelper.MembershipApi = "https://api.demo.churchapps.org/membership";
53
+ CommonEnvironmentHelper.ReportingApi = "https://api.demo.churchapps.org/reporting";
54
+ CommonEnvironmentHelper.MessagingApi = "https://api.demo.churchapps.org/messaging";
55
+ CommonEnvironmentHelper.MessagingApiSocket = "wss://socket.demo.churchapps.org";
56
+ CommonEnvironmentHelper.ContentApi = "https://api.demo.churchapps.org/content";
57
+ CommonEnvironmentHelper.AskApi = "https://askapi.demo.churchapps.org";
58
+ CommonEnvironmentHelper.GoogleAnalyticsTag = "";
59
+
60
+ CommonEnvironmentHelper.ContentRoot = "https://democontent.churchapps.org";
61
+ CommonEnvironmentHelper.B1Root = "https://{key}.demo.b1.church";
62
+ CommonEnvironmentHelper.B1AdminRoot = "https://demo.b1.church";
63
+ CommonEnvironmentHelper.LessonsRoot = "https://demo.lessons.church";
64
+ }
65
+
66
+ //NOTE: None of these values are secret.
67
+ static initStaging = () => {
68
+ CommonEnvironmentHelper.AttendanceApi = "https://api.staging.churchapps.org/attendance";
69
+ CommonEnvironmentHelper.DoingApi = "https://api.staging.churchapps.org/doing";
70
+ CommonEnvironmentHelper.GivingApi = "https://api.staging.churchapps.org/giving";
71
+ CommonEnvironmentHelper.MembershipApi = "https://api.staging.churchapps.org/membership";
72
+ CommonEnvironmentHelper.ReportingApi = "https://api.staging.churchapps.org/reporting";
73
+ CommonEnvironmentHelper.MessagingApi = "https://api.staging.churchapps.org/messaging";
74
+ CommonEnvironmentHelper.MessagingApiSocket = "wss://socket.staging.churchapps.org";
75
+ CommonEnvironmentHelper.ContentApi = "https://api.staging.churchapps.org/content";
76
+ CommonEnvironmentHelper.AskApi = "https://askapi.staging.churchapps.org";
77
+ CommonEnvironmentHelper.GoogleAnalyticsTag = "";
78
+
79
+ CommonEnvironmentHelper.ContentRoot = "https://content.staging.churchapps.org";
80
+ CommonEnvironmentHelper.B1Root = "https://{key}.staging.b1.church";
81
+ CommonEnvironmentHelper.B1AdminRoot = "https://admin.staging.b1.church";
82
+ CommonEnvironmentHelper.LessonsRoot = "https://staging.lessons.church";
83
+ }
84
+
85
+ //NOTE: None of these values are secret.
86
+ static initProd = () => {
87
+ CommonEnvironmentHelper.AttendanceApi = "https://api.churchapps.org/attendance";
88
+ CommonEnvironmentHelper.DoingApi = "https://api.churchapps.org/doing";
89
+ CommonEnvironmentHelper.GivingApi = "https://api.churchapps.org/giving";
90
+ CommonEnvironmentHelper.MembershipApi = "https://api.churchapps.org/membership";
91
+ CommonEnvironmentHelper.ReportingApi = "https://api.churchapps.org/reporting";
92
+ CommonEnvironmentHelper.MessagingApi = "https://api.churchapps.org/messaging";
93
+ CommonEnvironmentHelper.MessagingApiSocket = "wss://socket.churchapps.org";
94
+ CommonEnvironmentHelper.ContentApi = "https://api.churchapps.org/content";
95
+ CommonEnvironmentHelper.AskApi = "https://askapi.churchapps.org";
96
+
97
+ CommonEnvironmentHelper.ContentRoot = "https://content.churchapps.org";
98
+ CommonEnvironmentHelper.B1Root = "https://{key}.b1.church";
99
+ CommonEnvironmentHelper.B1AdminRoot = "https://admin.b1.church";
100
+ CommonEnvironmentHelper.LessonsRoot = "https://lessons.church";
101
+ }
102
+
103
+ }
104
+
@@ -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
+ }