@churchapps/helpers 1.0.1 → 1.0.3

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 (107) hide show
  1. package/dist/ApiHelper.d.ts +18 -0
  2. package/dist/ApiHelper.d.ts.map +1 -0
  3. package/dist/ApiHelper.js +141 -0
  4. package/dist/ApiHelper.js.map +1 -0
  5. package/dist/AppearanceHelper.d.ts +19 -0
  6. package/dist/AppearanceHelper.d.ts.map +1 -0
  7. package/dist/AppearanceHelper.js +60 -0
  8. package/dist/AppearanceHelper.js.map +1 -0
  9. package/dist/ArrayHelper.d.ts +12 -0
  10. package/dist/ArrayHelper.d.ts.map +1 -0
  11. package/dist/ArrayHelper.js +83 -0
  12. package/dist/ArrayHelper.js.map +1 -0
  13. package/dist/CommonEnvironmentHelper.d.ts +20 -0
  14. package/dist/CommonEnvironmentHelper.d.ts.map +1 -0
  15. package/dist/CommonEnvironmentHelper.js +78 -0
  16. package/dist/CommonEnvironmentHelper.js.map +1 -0
  17. package/dist/CurrencyHelper.d.ts +4 -0
  18. package/dist/CurrencyHelper.d.ts.map +1 -0
  19. package/dist/CurrencyHelper.js +11 -0
  20. package/dist/CurrencyHelper.js.map +1 -0
  21. package/dist/DateHelper.d.ts +21 -0
  22. package/dist/DateHelper.d.ts.map +1 -0
  23. package/dist/DateHelper.js +115 -0
  24. package/dist/DateHelper.js.map +1 -0
  25. package/dist/DonationHelper.d.ts +8 -0
  26. package/dist/DonationHelper.d.ts.map +1 -0
  27. package/dist/DonationHelper.js +29 -0
  28. package/dist/DonationHelper.js.map +1 -0
  29. package/dist/ErrorHelper.d.ts +13 -0
  30. package/dist/ErrorHelper.d.ts.map +1 -0
  31. package/dist/ErrorHelper.js +30 -0
  32. package/dist/ErrorHelper.js.map +1 -0
  33. package/dist/EventHelper.d.ts +11 -0
  34. package/dist/EventHelper.d.ts.map +1 -0
  35. package/dist/EventHelper.js +40 -0
  36. package/dist/EventHelper.js.map +1 -0
  37. package/dist/FileHelper.d.ts +5 -0
  38. package/dist/FileHelper.d.ts.map +1 -0
  39. package/dist/FileHelper.js +27 -0
  40. package/dist/FileHelper.js.map +1 -0
  41. package/dist/PersonHelper.d.ts +11 -0
  42. package/dist/PersonHelper.d.ts.map +1 -0
  43. package/dist/PersonHelper.js +49 -0
  44. package/dist/PersonHelper.js.map +1 -0
  45. package/dist/UniqueIdHelper.d.ts +9 -0
  46. package/dist/UniqueIdHelper.d.ts.map +1 -0
  47. package/dist/UniqueIdHelper.js +33 -0
  48. package/dist/UniqueIdHelper.js.map +1 -0
  49. package/dist/UserHelper.d.ts +14 -0
  50. package/dist/UserHelper.d.ts.map +1 -0
  51. package/dist/UserHelper.js +64 -0
  52. package/dist/UserHelper.js.map +1 -0
  53. package/dist/index.d.ts +11 -0
  54. package/dist/index.d.ts.map +1 -0
  55. package/dist/index.js +11 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/interfaces/Access.d.ts +131 -0
  58. package/dist/interfaces/Access.d.ts.map +1 -0
  59. package/dist/interfaces/Access.js +2 -0
  60. package/dist/interfaces/Access.js.map +1 -0
  61. package/dist/interfaces/Attendance.d.ts +45 -0
  62. package/dist/interfaces/Attendance.d.ts.map +1 -0
  63. package/dist/interfaces/Attendance.js +2 -0
  64. package/dist/interfaces/Attendance.js.map +1 -0
  65. package/dist/interfaces/Content.d.ts +86 -0
  66. package/dist/interfaces/Content.d.ts.map +1 -0
  67. package/dist/interfaces/Content.js +2 -0
  68. package/dist/interfaces/Content.js.map +1 -0
  69. package/dist/interfaces/Doing.d.ts +50 -0
  70. package/dist/interfaces/Doing.d.ts.map +1 -0
  71. package/dist/interfaces/Doing.js +2 -0
  72. package/dist/interfaces/Doing.js.map +1 -0
  73. package/dist/interfaces/Donation.d.ts +138 -0
  74. package/dist/interfaces/Donation.d.ts.map +1 -0
  75. package/dist/interfaces/Donation.js +20 -0
  76. package/dist/interfaces/Donation.js.map +1 -0
  77. package/dist/interfaces/Error.d.ts +17 -0
  78. package/dist/interfaces/Error.d.ts.map +1 -0
  79. package/dist/interfaces/Error.js +3 -0
  80. package/dist/interfaces/Error.js.map +1 -0
  81. package/dist/interfaces/Membership.d.ts +172 -0
  82. package/dist/interfaces/Membership.d.ts.map +1 -0
  83. package/dist/interfaces/Membership.js +2 -0
  84. package/dist/interfaces/Membership.js.map +1 -0
  85. package/dist/interfaces/Messaging.d.ts +59 -0
  86. package/dist/interfaces/Messaging.d.ts.map +1 -0
  87. package/dist/interfaces/Messaging.js +2 -0
  88. package/dist/interfaces/Messaging.js.map +1 -0
  89. package/dist/interfaces/Permissions.d.ts +159 -0
  90. package/dist/interfaces/Permissions.d.ts.map +1 -0
  91. package/dist/interfaces/Permissions.js +63 -0
  92. package/dist/interfaces/Permissions.js.map +1 -0
  93. package/dist/interfaces/Reporting.d.ts +45 -0
  94. package/dist/interfaces/Reporting.d.ts.map +1 -0
  95. package/dist/interfaces/Reporting.js +2 -0
  96. package/dist/interfaces/Reporting.js.map +1 -0
  97. package/dist/interfaces/UserContextInterface.d.ts +13 -0
  98. package/dist/interfaces/UserContextInterface.d.ts.map +1 -0
  99. package/dist/interfaces/UserContextInterface.js +2 -0
  100. package/dist/interfaces/UserContextInterface.js.map +1 -0
  101. package/dist/interfaces/index.d.ts +11 -0
  102. package/dist/interfaces/index.d.ts.map +1 -0
  103. package/dist/interfaces/index.js +12 -0
  104. package/dist/interfaces/index.js.map +1 -0
  105. package/package.json +2 -1
  106. package/src/DateHelper.ts +14 -0
  107. package/tsconfig.json +0 -1
@@ -0,0 +1,18 @@
1
+ import { ApiConfig, RolePermissionInterface, ApiListType } from "./interfaces";
2
+ export declare class ApiHelper {
3
+ static apiConfigs: ApiConfig[];
4
+ static isAuthenticated: boolean;
5
+ static getConfig(keyName: string): ApiConfig;
6
+ static setDefaultPermissions(jwt: string): void;
7
+ static setPermissions(keyName: string, jwt: string, permissions: RolePermissionInterface[]): void;
8
+ static clearPermissions(): void;
9
+ static get(path: string, apiName: ApiListType): Promise<any>;
10
+ static getAnonymous(path: string, apiName: ApiListType): Promise<any>;
11
+ static post(path: string, data: any[] | {}, apiName: ApiListType): Promise<any>;
12
+ static patch(path: string, data: any[] | {}, apiName: ApiListType): Promise<any>;
13
+ static delete(path: string, apiName: ApiListType): Promise<void>;
14
+ static postAnonymous(path: string, data: any[] | {}, apiName: ApiListType): Promise<any>;
15
+ static fetchWithErrorHandling(url: string, requestOptions: any): Promise<any>;
16
+ private static throwApiError;
17
+ }
18
+ //# sourceMappingURL=ApiHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiHelper.d.ts","sourceRoot":"","sources":["../src/ApiHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG/E,qBAAa,SAAS;IAEpB,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE,CAAM;IACpC,MAAM,CAAC,eAAe,UAAS;IAE/B,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM;IAOhC,MAAM,CAAC,qBAAqB,CAAC,GAAG,EAAE,MAAM;IAQxC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,uBAAuB,EAAE;IAU1F,MAAM,CAAC,gBAAgB;WAKV,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW;WAMtC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW;WAM/C,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,WAAW;WAUzD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,WAAW;WAU1D,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW;WAezC,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,WAAW;WAWlE,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG;mBAgB/C,aAAa;CAYnC"}
@@ -0,0 +1,141 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { ErrorHelper } from "./ErrorHelper";
11
+ export class ApiHelper {
12
+ static getConfig(keyName) {
13
+ let result = null;
14
+ this.apiConfigs.forEach(config => { if (config.keyName === keyName)
15
+ result = config; });
16
+ //if (result === null) throw new Error("Unconfigured API: " + keyName);
17
+ return result;
18
+ }
19
+ static setDefaultPermissions(jwt) {
20
+ this.apiConfigs.forEach(config => {
21
+ config.jwt = jwt;
22
+ config.permisssions = [];
23
+ });
24
+ this.isAuthenticated = true;
25
+ }
26
+ static setPermissions(keyName, jwt, permissions) {
27
+ this.apiConfigs.forEach(config => {
28
+ if (config.keyName === keyName) {
29
+ config.jwt = jwt;
30
+ config.permisssions = permissions;
31
+ }
32
+ });
33
+ this.isAuthenticated = true;
34
+ }
35
+ static clearPermissions() {
36
+ this.apiConfigs.forEach(config => { config.jwt = ""; config.permisssions = []; });
37
+ this.isAuthenticated = false;
38
+ }
39
+ static get(path, apiName) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ const config = this.getConfig(apiName);
42
+ const requestOptions = { method: "GET", headers: { Authorization: "Bearer " + config.jwt } };
43
+ return yield this.fetchWithErrorHandling(config.url + path, requestOptions);
44
+ });
45
+ }
46
+ static getAnonymous(path, apiName) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ const config = this.getConfig(apiName);
49
+ const requestOptions = { method: "GET" };
50
+ return yield this.fetchWithErrorHandling(config.url + path, requestOptions);
51
+ });
52
+ }
53
+ static post(path, data, apiName) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ const config = this.getConfig(apiName);
56
+ const requestOptions = {
57
+ method: "POST",
58
+ headers: { Authorization: "Bearer " + config.jwt, "Content-Type": "application/json" },
59
+ body: JSON.stringify(data)
60
+ };
61
+ return yield this.fetchWithErrorHandling(config.url + path, requestOptions);
62
+ });
63
+ }
64
+ static patch(path, data, apiName) {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ const config = this.getConfig(apiName);
67
+ const requestOptions = {
68
+ method: "PATCH",
69
+ headers: { Authorization: "Bearer " + config.jwt, "Content-Type": "application/json" },
70
+ body: JSON.stringify(data)
71
+ };
72
+ return yield this.fetchWithErrorHandling(config.url + path, requestOptions);
73
+ });
74
+ }
75
+ static delete(path, apiName) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const config = this.getConfig(apiName);
78
+ const requestOptions = {
79
+ method: "DELETE",
80
+ headers: { Authorization: "Bearer " + config.jwt }
81
+ };
82
+ try {
83
+ const response = yield fetch(config.url + path, requestOptions);
84
+ if (!response.ok)
85
+ yield this.throwApiError(response);
86
+ }
87
+ catch (e) {
88
+ console.log(e);
89
+ throw (e);
90
+ }
91
+ });
92
+ }
93
+ static postAnonymous(path, data, apiName) {
94
+ return __awaiter(this, void 0, void 0, function* () {
95
+ const config = this.getConfig(apiName);
96
+ const requestOptions = {
97
+ method: "POST",
98
+ headers: { "Content-Type": "application/json" },
99
+ body: JSON.stringify(data)
100
+ };
101
+ console.log(config.url + path, requestOptions);
102
+ return yield this.fetchWithErrorHandling(config.url + path, requestOptions);
103
+ });
104
+ }
105
+ static fetchWithErrorHandling(url, requestOptions) {
106
+ return __awaiter(this, void 0, void 0, function* () {
107
+ try {
108
+ const response = yield fetch(url, requestOptions);
109
+ if (!response.ok)
110
+ yield this.throwApiError(response);
111
+ else {
112
+ if (response.status !== 204) {
113
+ return response.json();
114
+ }
115
+ }
116
+ }
117
+ catch (e) {
118
+ console.log("Error loading url: " + url);
119
+ console.log(e);
120
+ throw (e);
121
+ }
122
+ });
123
+ }
124
+ static throwApiError(response) {
125
+ return __awaiter(this, void 0, void 0, function* () {
126
+ console.log("THROW API ERROR");
127
+ let msg = response.statusText;
128
+ try {
129
+ const json = yield response.json();
130
+ msg = json.errors[0];
131
+ }
132
+ catch (_a) { }
133
+ console.log("RESPONSE", response);
134
+ ErrorHelper.logError(response.status.toString(), response.url, msg);
135
+ throw new Error(msg || "Error");
136
+ });
137
+ }
138
+ }
139
+ ApiHelper.apiConfigs = [];
140
+ ApiHelper.isAuthenticated = false;
141
+ //# sourceMappingURL=ApiHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiHelper.js","sourceRoot":"","sources":["../src/ApiHelper.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,OAAO,SAAS;IAKpB,MAAM,CAAC,SAAS,CAAC,OAAe;QAC9B,IAAI,MAAM,GAAc,IAAI,CAAC;QAC7B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,MAAM,CAAC,OAAO,KAAK,OAAO;YAAE,MAAM,GAAG,MAAM,CAAA,CAAC,CAAC,CAAC,CAAC;QACvF,uEAAuE;QACvE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,qBAAqB,CAAC,GAAW;QACtC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YAC/B,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC;YACjB,MAAM,CAAC,YAAY,GAAG,EAAE,C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ACF;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,GAAG,CAAC,qBAAqB,GAAG,GAAG,CAAC,CAAC;gBACzC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;gBACd,MAAM,CAAC,CAAC,CAAC,CAAC;aACX;QACH,CAAC;KAAA;IAEO,MAAM,CAAO,aAAa,CAAC,QAAkB;;YACnD,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;YAC/B,IAAI,GAAG,GAAG,QAAQ,CAAC,UAAU,CAAC;YAC9B,IAAI;gBACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACnC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;aACtB;YAAC,WAAM,GAAG;YACX,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;YACjC,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YACpE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,OAAO,CAAC,CAAC;QAClC,CAAC;KAAA;;AArHM,oBAAU,GAAgB,EAAE,CAAC;AAC7B,yBAAe,GAAG,KAAK,CAAC"}
@@ -0,0 +1,19 @@
1
+ export interface AppearanceInterface {
2
+ primaryColor?: string;
3
+ primaryContrast?: string;
4
+ secondaryColor?: string;
5
+ secondaryContrast?: string;
6
+ logoLight?: string;
7
+ logoDark?: string;
8
+ favicon_400x400?: string;
9
+ favicon_16x16?: string;
10
+ }
11
+ export declare class AppearanceHelper {
12
+ static getLogoDark(appearanceSettings: AppearanceInterface, defaultLogo: string): string;
13
+ static getLogoLight(appearanceSettings: AppearanceInterface, defaultLogo: string): string;
14
+ static getFavicon(appearanceSettings: AppearanceInterface, size: "400" | "16"): string;
15
+ static getLogo(appearanceSettings: AppearanceInterface, defaultLogoLight: string, defaultLogoDark: string, backgroundColor: string): string;
16
+ private static isDark;
17
+ private static getHexValue;
18
+ }
19
+ //# sourceMappingURL=AppearanceHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppearanceHelper.d.ts","sourceRoot":"","sources":["../src/AppearanceHelper.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,mBAAmB;IAAG,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE;AAEtO,qBAAa,gBAAgB;WAEb,WAAW,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM;WAIxE,YAAY,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM;WAIzE,UAAU,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI;WAYtE,OAAO,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAMzI,OAAO,CAAC,MAAM,CAAC,MAAM;IA+BrB,OAAO,CAAC,MAAM,CAAC,WAAW;CAM3B"}
@@ -0,0 +1,60 @@
1
+ export class AppearanceHelper {
2
+ static getLogoDark(appearanceSettings, defaultLogo) {
3
+ return (appearanceSettings === null || appearanceSettings === void 0 ? void 0 : appearanceSettings.logoDark) ? appearanceSettings.logoDark : defaultLogo;
4
+ }
5
+ static getLogoLight(appearanceSettings, defaultLogo) {
6
+ return (appearanceSettings === null || appearanceSettings === void 0 ? void 0 : appearanceSettings.logoLight) ? appearanceSettings.logoLight : defaultLogo;
7
+ }
8
+ static getFavicon(appearanceSettings, size) {
9
+ if (size === "400") {
10
+ return appearanceSettings === null || appearanceSettings === void 0 ? void 0 : appearanceSettings.favicon_400x400;
11
+ }
12
+ if (size === "16") {
13
+ return appearanceSettings === null || appearanceSettings === void 0 ? void 0 : appearanceSettings.favicon_16x16;
14
+ }
15
+ return null;
16
+ }
17
+ static getLogo(appearanceSettings, defaultLogoLight, defaultLogoDark, backgroundColor) {
18
+ const isDark = (appearanceSettings.logoDark) ? this.isDark(backgroundColor) : false;
19
+ if (isDark)
20
+ return this.getLogoDark(appearanceSettings, defaultLogoDark);
21
+ else
22
+ return this.getLogoLight(appearanceSettings, defaultLogoLight);
23
+ }
24
+ static isDark(backgroundColor) {
25
+ let valid = false;
26
+ let r = 0;
27
+ let g = 0;
28
+ let b = 0;
29
+ if (backgroundColor.match(/#[0-9a-fA-F{6}]/)) {
30
+ r = this.getHexValue(backgroundColor.substring(1, 2));
31
+ g = this.getHexValue(backgroundColor.substring(3, 4));
32
+ b = this.getHexValue(backgroundColor.substring(5, 6));
33
+ valid = true;
34
+ }
35
+ else if (backgroundColor.match(/#[0-9a-fA-F{3}]/)) {
36
+ r = this.getHexValue(backgroundColor.substring(1, 1));
37
+ g = this.getHexValue(backgroundColor.substring(2, 2));
38
+ b = this.getHexValue(backgroundColor.substring(3, 3));
39
+ valid = true;
40
+ }
41
+ if (!valid)
42
+ return false;
43
+ else {
44
+ //HSP brightness formula. Some colors have a bigger impact on our perceived brightness than others.
45
+ const rWeight = .299 * Math.pow(r, 2);
46
+ const gWeight = .587 * Math.pow(g, 2);
47
+ const bWeight = .114 * Math.pow(b, 2);
48
+ const brightness = Math.sqrt(rWeight + gWeight + bWeight);
49
+ //return brightness < 128; //
50
+ return brightness < 156;
51
+ }
52
+ }
53
+ static getHexValue(hex) {
54
+ let result = parseInt(hex, 16);
55
+ if (hex.length === 1)
56
+ result = result * 16;
57
+ return result;
58
+ }
59
+ }
60
+ //# sourceMappingURL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C,EAAE,CAAC,CAAC,CAAC;YACtC,MAAM,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACtC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC;YAC1D,8BAA8B;YAC9B,OAAO,UAAU,GAAG,GAAG,CAAC;SACzB;IAEH,CAAC;IAEO,MAAM,CAAC,WAAW,CAAC,GAAW;QACpC,IAAI,MAAM,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC/B,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC;QAC3C,OAAO,MAAM,CAAC;IAChB,CAAC;CAEF"}
@@ -0,0 +1,12 @@
1
+ export declare class ArrayHelper {
2
+ static getIds(array: any[], propertyName: string): string[];
3
+ static sortBy(array: any[], propertyName: string, descending?: boolean): void;
4
+ static getIndex(array: any[], propertyName: string, value: any): number;
5
+ static getOne(array: any[], propertyName: string, value: any): any;
6
+ static getAll(array: any[], propertyName: string, value: any): any[];
7
+ static getAllArray(array: any[], propertyName: string, values: any[]): any[];
8
+ private static compare;
9
+ static getUniqueValues(array: any[], propertyName: string): any[];
10
+ static getDeepValue(item: any, propertyName: string): any;
11
+ }
12
+ //# sourceMappingURL=ArrayHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArrayHelper.d.ts","sourceRoot":"","sources":["../src/ArrayHelper.ts"],"names":[],"mappings":"AAEA,qBAAa,WAAW;IACtB,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,MAAM;IAShD,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,GAAE,OAAe;IAS7E,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAQ9D,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAK5D,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAQ5D,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE;IAMpE,OAAO,CAAC,MAAM,CAAC,OAAO;IAYtB,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,MAAM;IAUzD,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM;CASpD"}
@@ -0,0 +1,83 @@
1
+ import { UniqueIdHelper } from "./UniqueIdHelper";
2
+ export class ArrayHelper {
3
+ static getIds(array, propertyName) {
4
+ var _a;
5
+ const result = [];
6
+ for (const item of array) {
7
+ const id = (_a = item[propertyName]) === null || _a === void 0 ? void 0 : _a.toString();
8
+ if (!UniqueIdHelper.isMissing(id) && result.indexOf(id) === -1)
9
+ result.push(id);
10
+ }
11
+ return result;
12
+ }
13
+ static sortBy(array, propertyName, descending = false) {
14
+ array.sort((a, b) => {
15
+ const valA = a[propertyName];
16
+ const valB = b[propertyName];
17
+ if (valA < valB)
18
+ return descending ? 1 : -1;
19
+ else
20
+ return descending ? -1 : 1;
21
+ });
22
+ }
23
+ static getIndex(array, propertyName, value) {
24
+ for (let i = 0; i < array.length; i++) {
25
+ const item = array[i];
26
+ if (ArrayHelper.compare(item, propertyName, value))
27
+ return i;
28
+ }
29
+ return -1;
30
+ }
31
+ static getOne(array, propertyName, value) {
32
+ for (const item of array || [])
33
+ if (ArrayHelper.compare(item, propertyName, value))
34
+ return item;
35
+ return null;
36
+ }
37
+ static getAll(array, propertyName, value) {
38
+ const result = [];
39
+ for (const item of array || []) {
40
+ if (ArrayHelper.compare(item, propertyName, value))
41
+ result.push(item);
42
+ }
43
+ return result;
44
+ }
45
+ static getAllArray(array, propertyName, values) {
46
+ const result = [];
47
+ for (const item of array || [])
48
+ if (values.indexOf(item[propertyName]) > -1)
49
+ result.push(item);
50
+ return result;
51
+ }
52
+ static compare(item, propertyName, value) {
53
+ const propChain = propertyName.split(".");
54
+ if (propChain.length === 1)
55
+ return item[propertyName] === value;
56
+ else {
57
+ let obj = item;
58
+ for (let i = 0; i < propChain.length - 1; i++) {
59
+ if (obj)
60
+ obj = item[propChain[i]];
61
+ }
62
+ return obj[propChain[propChain.length - 1]] === value;
63
+ }
64
+ }
65
+ static getUniqueValues(array, propertyName) {
66
+ const result = [];
67
+ for (const item of array) {
68
+ const val = (propertyName.indexOf(".") === -1) ? item[propertyName] : this.getDeepValue(item, propertyName);
69
+ if (result.indexOf(val) === -1)
70
+ result.push(val);
71
+ }
72
+ return result;
73
+ }
74
+ static getDeepValue(item, propertyName) {
75
+ const propertyNames = propertyName.split(".");
76
+ let result = item;
77
+ propertyNames.forEach(name => {
78
+ result = result[name];
79
+ });
80
+ return result;
81
+ }
82
+ }
83
+ //# sourceMappingURL=ArrayHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArrayHelper.js","sourceRoot":"","sources":["../src/ArrayHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,OAAO,WAAW;IACtB,MAAM,CAAC,MAAM,CAAC,KAAY,EAAE,YAAoB;;QAC9C,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,MAAM,EAAE,GAAG,MAAA,IAAI,CAAC,YAAY,CAAC,0CAAE,QAAQ,EAAE,CAAC;YAC1C,IAAI,CAAC,cAAc,CAAC,SAAS,CA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eAAe,CAAC,KAAY,EAAE,YAAoB;QACvD,MAAM,MAAM,GAAU,EAAE,CAAC;QAEzB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;YAC3G,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAClD;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,IAAS,EAAE,YAAoB;QACjD,MAAM,aAAa,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9C,IAAI,MAAM,GAAQ,IAAI,CAAC;QACvB,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC3B,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CAEF"}
@@ -0,0 +1,20 @@
1
+ export declare class CommonEnvironmentHelper {
2
+ static AttendanceApi: string;
3
+ static DoingApi: string;
4
+ static GivingApi: string;
5
+ static MembershipApi: string;
6
+ static ReportingApi: string;
7
+ static MessagingApi: string;
8
+ static MessagingApiSocket: string;
9
+ static ContentApi: string;
10
+ static GoogleAnalyticsTag: string;
11
+ static ContentRoot: string;
12
+ static B1Root: string;
13
+ static ChumsRoot: string;
14
+ static LessonsRoot: string;
15
+ static init: (stage: string) => void;
16
+ static initDev: () => void;
17
+ static initStaging: () => void;
18
+ static initProd: () => void;
19
+ }
20
+ //# sourceMappingURL=CommonEnvironmentHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommonEnvironmentHelper.d.ts","sourceRoot":"","sources":["../src/CommonEnvironmentHelper.ts"],"names":[],"mappings":"AACA,qBAAa,uBAAuB;IAClC,OAAc,aAAa,SAAM;IACjC,OAAc,QAAQ,SAAM;IAC5B,OAAc,SAAS,SAAM;IAC7B,OAAc,aAAa,SAAM;IACjC,OAAc,YAAY,SAAM;IAChC,OAAc,YAAY,SAAM;IAChC,OAAc,kBAAkB,SAAM;IACtC,OAAc,UAAU,SAAM;IAC9B,OAAc,kBAAkB,SAAM;IAEtC,MAAM,CAAC,WAAW,SAAM;IACxB,MAAM,CAAC,MAAM,SAAM;IACnB,MAAM,CAAC,SAAS,SAAM;IACtB,MAAM,CAAC,WAAW,SAAM;IAExB,MAAM,CAAC,IAAI,UAAW,MAAM,UAM3B;IAED,MAAM,CAAC,OAAO,aAgBb;IAGD,MAAM,CAAC,WAAW,aAejB;IAGD,MAAM,CAAC,QAAQ,aAcd;CAEF"}
@@ -0,0 +1,78 @@
1
+ var _a;
2
+ export class CommonEnvironmentHelper {
3
+ }
4
+ _a = CommonEnvironmentHelper;
5
+ CommonEnvironmentHelper.AttendanceApi = "";
6
+ CommonEnvironmentHelper.DoingApi = "";
7
+ CommonEnvironmentHelper.GivingApi = "";
8
+ CommonEnvironmentHelper.MembershipApi = "";
9
+ CommonEnvironmentHelper.ReportingApi = "";
10
+ CommonEnvironmentHelper.MessagingApi = "";
11
+ CommonEnvironmentHelper.MessagingApiSocket = "";
12
+ CommonEnvironmentHelper.ContentApi = "";
13
+ CommonEnvironmentHelper.GoogleAnalyticsTag = "";
14
+ CommonEnvironmentHelper.ContentRoot = "";
15
+ CommonEnvironmentHelper.B1Root = "";
16
+ CommonEnvironmentHelper.ChumsRoot = "";
17
+ CommonEnvironmentHelper.LessonsRoot = "";
18
+ CommonEnvironmentHelper.init = (stage) => {
19
+ switch (stage) {
20
+ case "staging":
21
+ _a.initStaging();
22
+ break;
23
+ case "prod":
24
+ _a.initProd();
25
+ break;
26
+ default:
27
+ _a.initDev();
28
+ break;
29
+ }
30
+ };
31
+ CommonEnvironmentHelper.initDev = () => {
32
+ _a.initStaging(); //Use staging values for anything not provided
33
+ _a.AttendanceApi = process.env.REACT_APP_ATTENDANCE_API || process.env.NEXT_PUBLIC_ATTENDANCE_API || _a.AttendanceApi;
34
+ _a.DoingApi = process.env.REACT_APP_DOING_API || process.env.NEXT_PUBLIC_DOING_API || _a.DoingApi;
35
+ _a.GivingApi = process.env.REACT_APP_GIVING_API || process.env.NEXT_PUBLIC_GIVING_API || _a.GivingApi;
36
+ _a.MembershipApi = process.env.REACT_APP_MEMBERSHIP_API || process.env.NEXT_PUBLIC_MEMBERSHIP_API || _a.MembershipApi;
37
+ _a.ReportingApi = process.env.REACT_APP_REPORTING_API || process.env.NEXT_PUBLIC_REPORTING_API || _a.ReportingApi;
38
+ _a.MessagingApi = process.env.REACT_APP_MESSAGING_API || process.env.NEXT_PUBLIC_MESSAGING_API || _a.MessagingApi;
39
+ _a.MessagingApiSocket = process.env.REACT_APP_MESSAGING_API_SOCKET || process.env.NEXT_PUBLIC_MESSAGING_API_SOCKET || _a.MessagingApiSocket;
40
+ _a.ContentApi = process.env.REACT_APP_CONTENT_API || process.env.NEXT_PUBLIC_CONTENT_API || _a.ContentApi;
41
+ _a.GoogleAnalyticsTag = process.env.REACT_APP_GOOGLE_ANALYTICS || process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS || _a.GoogleAnalyticsTag;
42
+ _a.ContentRoot = process.env.REACT_APP_CONTENT_ROOT || process.env.NEXT_PUBLIC_CONTENT_ROOT || _a.ContentRoot;
43
+ _a.B1Root = process.env.REACT_APP_B1_ROOT || process.env.NEXT_PUBLIC_B1_ROOT || _a.B1Root;
44
+ _a.ChumsRoot = process.env.REACT_APP_CHUMS_ROOT || process.env.NEXT_PUBLIC_CHUMS_ROOT || _a.ChumsRoot;
45
+ _a.LessonsRoot = process.env.REACT_APP_LESSONS_ROOT || process.env.NEXT_PUBLIC_LESSONS_ROOT || _a.LessonsRoot;
46
+ };
47
+ //NOTE: None of these values are secret.
48
+ CommonEnvironmentHelper.initStaging = () => {
49
+ _a.AttendanceApi = "https://attendanceapi.staging.churchapps.org";
50
+ _a.DoingApi = "https://doingapi.staging.churchapps.org";
51
+ _a.GivingApi = "https://givingapi.staging.churchapps.org";
52
+ _a.MembershipApi = "https://membershipapi.staging.churchapps.org";
53
+ _a.ReportingApi = "https://reportingapi.staging.churchapps.org";
54
+ _a.MessagingApi = "https://messagingapi.staging.churchapps.org";
55
+ _a.MessagingApiSocket = "wss://socket.staging.churchapps.org";
56
+ _a.ContentApi = "https://contentapi.staging.churchapps.org";
57
+ _a.GoogleAnalyticsTag = "";
58
+ _a.ContentRoot = "https://content.staging.churchapps.org";
59
+ _a.B1Root = "https://{key}.staging.b1.church";
60
+ _a.ChumsRoot = "https://app.staging.chums.org";
61
+ _a.LessonsRoot = "https://staging.lessons.church";
62
+ };
63
+ //NOTE: None of these values are secret.
64
+ CommonEnvironmentHelper.initProd = () => {
65
+ _a.AttendanceApi = "https://attendanceapi.churchapps.org";
66
+ _a.DoingApi = "https://doingapi.churchapps.org";
67
+ _a.GivingApi = "https://givingapi.churchapps.org";
68
+ _a.MembershipApi = "https://membershipapi.churchapps.org";
69
+ _a.ReportingApi = "https://reportingapi.churchapps.org";
70
+ _a.MessagingApi = "https://messagingapi.churchapps.org";
71
+ _a.MessagingApiSocket = "wss://socket.churchapps.org";
72
+ _a.ContentApi = "https://contentapi.churchapps.org";
73
+ _a.ContentRoot = "https://content.churchapps.org";
74
+ _a.B1Root = "https://{key}.b1.church";
75
+ _a.ChumsRoot = "https://app.chums.org";
76
+ _a.LessonsRoot = "https://lessons.church";
77
+ };
78
+ //# sourceMappingURL=CommonEnvironmentHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommonEnvironmentHelper.js","sourceRoot":"","sources":["../src/CommonEnvironmentHelper.ts"],"names":[],"mappings":";AACA,MAAM,OAAO,uBAAuB;;;AACpB,qCAA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AC,UAAU,GAAG,mCAAmC,CAAC;IAEzE,EAAuB,CAAC,WAAW,GAAG,gCAAgC,CAAC;IACvE,EAAuB,CAAC,MAAM,GAAG,yBAAyB,CAAC;IAC3D,EAAuB,CAAC,SAAS,GAAG,uBAAuB,CAAC;IAC5D,EAAuB,CAAC,WAAW,GAAG,wBAAwB,CAAC;AACjE,CAAC,AAdc,CAcd"}
@@ -0,0 +1,4 @@
1
+ export declare class CurrencyHelper {
2
+ static formatCurrency(amount: number): string;
3
+ }
4
+ //# sourceMappingURL=CurrencyHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CurrencyHelper.d.ts","sourceRoot":"","sources":["../src/CurrencyHelper.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAc;IACzB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM;CAQrC"}
@@ -0,0 +1,11 @@
1
+ export class CurrencyHelper {
2
+ static formatCurrency(amount) {
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
+ }
11
+ //# sourceMappingURL=CurrencyHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CurrencyHelper.js","sourceRoot":"","sources":["../src/CurrencyHelper.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAc;IACzB,MAAM,CAAC,cAAc,CAAC,MAAc;QAClC,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YAC/C,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,KAAK;YACf,qBAAqB,EAAE,CAAC;SACzB,CAAC,CAAC;QACH,OAAO,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ export declare class DateHelper {
2
+ static toDate(input: any): Date;
3
+ static toDateTime(input: any): Date;
4
+ static convertToDate(input: any): Date;
5
+ static addDays(date: Date, days: number): Date;
6
+ static prettyDate(date: Date): string;
7
+ static prettyDateTime(date: Date): string;
8
+ static prettyTime(date: Date): string;
9
+ static getLastSunday(): Date;
10
+ static getWeekSunday(year: number, week: number): Date;
11
+ static formatHtml5Date(date: Date): string;
12
+ static formatHtml5Time(time: Date): string;
13
+ static formatHtml5DateTime(date: Date): string;
14
+ static getDisplayDuration(d: Date): string;
15
+ static getShortDate(d: Date): string;
16
+ static convertDatePickerFormat(d: Date): Date;
17
+ private static formatDateTime;
18
+ static toMysqlDate(d: Date): string;
19
+ static subtractHoursFromNow(hour: number): Date;
20
+ }
21
+ //# sourceMappingURL=DateHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateHelper.d.ts","sourceRoot":"","sources":["../src/DateHelper.ts"],"names":[],"mappings":"AAGA,qBAAa,UAAU;IAGrB,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG;IAIxB,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG;IAK5B,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG;IAI/B,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM;IAKvC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI;IAK5B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI;IAKhC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI;IAK5B,MAAM,CAAC,aAAa;IAMpB,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAO/C,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAU1C,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAO1C,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAO9C,MAAM,CAAC,kBAAkB,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM;IAiB1C,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM;IAIpC,MAAM,CAAC,uBAAuB,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI;IAM7C,OAAO,CAAC,MAAM,CAAC,cAAc;WAMf,WAAW,CAAC,CAAC,EAAE,IAAI;WAOnB,oBAAoB,CAAC,IAAI,EAAE,MAAM;CAKhD"}