@churchapps/apphelper 0.4.25 → 0.4.27

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.
@@ -1,10 +1,14 @@
1
1
  export declare class Locale {
2
2
  private static readonly supportedLanguages;
3
3
  private static readonly extraCodes;
4
+ private static readonly englishFallbacks;
4
5
  static init: (backends: string[]) => Promise<void>;
5
6
  private static deepMerge;
6
7
  private static isObject;
8
+ private static getNestedValue;
7
9
  static t(key: string, options?: Record<string, unknown>): string;
8
10
  static label(key: string, fallback?: string): string;
11
+ static isInitialized(): boolean;
12
+ static setupFallbackMode(): void;
9
13
  }
10
14
  //# sourceMappingURL=Locale.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Locale.d.ts","sourceRoot":"","sources":["../../src/helpers/Locale.ts"],"names":[],"mappings":"AAgBA,qBAAa,MAAM;IAClB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAaxC;IACF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAA4C;IAE9E,MAAM,CAAC,IAAI,GAAU,UAAU,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAAC,CA4CrD;IAEF,OAAO,CAAC,MAAM,CAAC,SAAS;IAgBxB,OAAO,CAAC,MAAM,CAAC,QAAQ;IAKvB,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;IAKhE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;CAQpD"}
1
+ {"version":3,"file":"Locale.d.ts","sourceRoot":"","sources":["../../src/helpers/Locale.ts"],"names":[],"mappings":"AAgBA,qBAAa,MAAM;IAClB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAaxC;IACF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAA4C;IAG9E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CA0RtC;IAEF,MAAM,CAAC,IAAI,GAAU,UAAU,MAAM,EAAE,KAAG,OAAO,CAAC,IAAI,CAAC,CAiDrD;IAEF,OAAO,CAAC,MAAM,CAAC,SAAS;IAgBxB,OAAO,CAAC,MAAM,CAAC,QAAQ;IAKvB,OAAO,CAAC,MAAM,CAAC,cAAc;IAO7B,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;IAyChE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAUpD,MAAM,CAAC,aAAa,IAAI,OAAO;IAK/B,MAAM,CAAC,iBAAiB,IAAI,IAAI;CAIhC"}
@@ -19,9 +19,50 @@ export class Locale {
19
19
  static isObject(obj) {
20
20
  return obj !== null && typeof obj === "object" && !Array.isArray(obj);
21
21
  }
22
- // New helper method that uses i18n
22
+ // Helper method to get value from nested object using dot notation
23
+ static getNestedValue(obj, path) {
24
+ return path.split('.').reduce((current, key) => {
25
+ return current && current[key] !== undefined ? current[key] : undefined;
26
+ }, obj);
27
+ }
28
+ // New helper method that uses i18n with hard-coded English fallback
23
29
  static t(key, options) {
24
- return i18n.t(key, options);
30
+ try {
31
+ // Check if i18n is initialized and has the key
32
+ if (i18n && i18n.isInitialized && i18n.exists(key)) {
33
+ const translation = i18n.t(key, options);
34
+ // If translation is not the same as the key, return it
35
+ if (translation !== key) {
36
+ return translation;
37
+ }
38
+ }
39
+ }
40
+ catch (error) {
41
+ // If i18n fails, fall through to hard-coded fallback
42
+ console.warn(`i18n translation failed for key "${key}":`, error);
43
+ }
44
+ // Fallback to hard-coded English translations
45
+ const fallbackValue = this.getNestedValue(this.englishFallbacks, key);
46
+ if (fallbackValue !== undefined) {
47
+ // Handle simple string interpolation for options
48
+ if (typeof fallbackValue === 'string' && options) {
49
+ let result = fallbackValue;
50
+ Object.keys(options).forEach(optionKey => {
51
+ const placeholder = `{{${optionKey}}}`;
52
+ if (result.includes(placeholder)) {
53
+ result = result.replace(new RegExp(placeholder, 'g'), String(options[optionKey]));
54
+ }
55
+ // Also handle {} placeholder for backward compatibility
56
+ if (result.includes('{}')) {
57
+ result = result.replace('{}', String(options[optionKey]));
58
+ }
59
+ });
60
+ return result;
61
+ }
62
+ return String(fallbackValue);
63
+ }
64
+ // If no fallback found, return the key itself
65
+ return key;
25
66
  }
26
67
  // Keep the old method for backward compatibility
27
68
  static label(key, fallback) {
@@ -32,6 +73,15 @@ export class Locale {
32
73
  }
33
74
  return translation;
34
75
  }
76
+ // Helper method to check if i18n is initialized
77
+ static isInitialized() {
78
+ return i18n && i18n.isInitialized;
79
+ }
80
+ // Method to set up basic fallback-only mode (no i18n)
81
+ static setupFallbackMode() {
82
+ // This method can be called if apps want to use only the hard-coded fallbacks
83
+ // without initializing the full i18n system
84
+ }
35
85
  }
36
86
  _a = Locale;
37
87
  Locale.supportedLanguages = [
@@ -49,6 +99,290 @@ Locale.supportedLanguages = [
49
99
  "zh",
50
100
  ];
51
101
  Locale.extraCodes = { no: ["nb", "nn"] };
102
+ // Hard-coded English fallbacks for when locale files are not available
103
+ Locale.englishFallbacks = {
104
+ "b1Share": {
105
+ "comment": "Comment",
106
+ "commentPlaceholder": "Include a comment with your post.",
107
+ "contentShared": "Content Shared",
108
+ "group": "Group",
109
+ "sharingToGroup": "Sharing {} to B1 Group",
110
+ "validate": {
111
+ "addComment": "Please add a comment.",
112
+ "loginFirst": "Please login first.",
113
+ "notMember": "You are not currently a member of any groups on B1.",
114
+ "selectGroup": "Please select a group."
115
+ }
116
+ },
117
+ "common": {
118
+ "add": "Add",
119
+ "cancel": "Cancel",
120
+ "close": "Close",
121
+ "date": "Date",
122
+ "delete": "Delete",
123
+ "edit": "Edit",
124
+ "error": "Error",
125
+ "pleaseWait": "Please wait...",
126
+ "save": "Save",
127
+ "search": "Search",
128
+ "submit": "Submit",
129
+ "update": "Update"
130
+ },
131
+ "createPerson": {
132
+ "addNewPerson": "Add a New Person",
133
+ "firstName": "First Name",
134
+ "lastName": "Last Name",
135
+ "email": "Email"
136
+ },
137
+ "donation": {
138
+ "bankForm": {
139
+ "accountNumber": "Account Number",
140
+ "added": "Bank account added. Verify your bank account to make a donation.",
141
+ "company": "Company",
142
+ "firstDeposit": "First Deposit",
143
+ "holderName": "Account holder name is required.",
144
+ "individual": "Individual",
145
+ "name": "Account Holder Name",
146
+ "needVerified": "Bank accounts will need to be verified before making any donations. Your account will receive two small deposits in approximately 1-3 business days. You will need to enter those deposit amounts to finish verifying your account by selecting the verify account link next to your bank account under the payment methods section.",
147
+ "routingNumber": "Routing Number",
148
+ "secondDeposit": "Second Deposit",
149
+ "twoDeposits": "Enter the two deposits you received in your account to finish verifying your bank account.",
150
+ "updated": "Bank account updated.",
151
+ "verified": "Bank account verified.",
152
+ "validate": {
153
+ "accountNumber": "Routing and account number are required.",
154
+ "holderName": "Account holder name is required."
155
+ }
156
+ },
157
+ "cardForm": {
158
+ "addNew": "Add New Card",
159
+ "added": "Card added successfully.",
160
+ "expirationMonth": "Expiration Month:",
161
+ "expirationYear": "Expiration Year:",
162
+ "updated": "Card updated successfully."
163
+ },
164
+ "common": {
165
+ "cancel": "Cancel",
166
+ "error": "Error"
167
+ },
168
+ "donationForm": {
169
+ "annually": "Annually",
170
+ "biWeekly": "Bi-Weekly",
171
+ "cancelled": "Recurring donation cancelled.",
172
+ "confirmDelete": "Are you sure you wish to delete this recurring donation?",
173
+ "cover": "I'll generously add {} to cover the transaction fees so you can keep 100% of my donation.",
174
+ "donate": "Donate",
175
+ "editRecurring": "Edit Recurring Donation",
176
+ "fees": "Transaction fees of {} are applied.",
177
+ "frequency": "Frequency",
178
+ "fund": "Fund",
179
+ "funds": "Funds",
180
+ "make": "Make a Donation",
181
+ "makeRecurring": "Make a Recurring Donation",
182
+ "method": "Method",
183
+ "monthly": "Monthly",
184
+ "notes": "Notes",
185
+ "preview": "Preview Donation",
186
+ "quarterly": "Quarterly",
187
+ "recurringUpdated": "Recurring donation updated.",
188
+ "startDate": "Start Date",
189
+ "thankYou": "Thank you for your donation!",
190
+ "tooLow": "Donation amount must be greater than $0.50",
191
+ "total": "Total Donation Amount",
192
+ "validate": {
193
+ "amount": "Amount cannot be $0.",
194
+ "email": "Please enter your email address.",
195
+ "firstName": "Please enter your first name.",
196
+ "lastName": "Please enter your last name.",
197
+ "validEmail": "Please enter a valid email address."
198
+ },
199
+ "weekly": "Weekly"
200
+ },
201
+ "fundDonations": {
202
+ "addMore": "Add More",
203
+ "amount": "Amount",
204
+ "fund": "Fund"
205
+ },
206
+ "paymentMethods": {
207
+ "addBank": "Add Bank Account",
208
+ "addCard": "Add Card",
209
+ "confirmDelete": "Are you sure you wish to delete this payment method?",
210
+ "deleted": "Payment method deleted.",
211
+ "noMethod": "No payment methods. Add a payment method to make a donation.",
212
+ "verify": "Verify Account"
213
+ },
214
+ "page": {
215
+ "amount": "Amount",
216
+ "batch": "Batch",
217
+ "date": "Date",
218
+ "fund": "Fund",
219
+ "method": "Method",
220
+ "willAppear": "Donations will appear once a donation has been entered."
221
+ },
222
+ "preview": {
223
+ "date": "Donation Date",
224
+ "donate": "Donate",
225
+ "every": "Recurring Every",
226
+ "fee": "Transaction Fee",
227
+ "funds": "Funds",
228
+ "method": "Donation Method",
229
+ "notes": "Notes",
230
+ "startingOn": "Starting On",
231
+ "total": "Total",
232
+ "type": "Donation Type",
233
+ "weekly": "Weekly"
234
+ },
235
+ "recurring": {
236
+ "amount": "Amount",
237
+ "every": "Every",
238
+ "interval": "Interval",
239
+ "notFound": "Payment method not found.",
240
+ "paymentMethod": "Payment Method",
241
+ "startDate": "Start Date"
242
+ }
243
+ },
244
+ "formSubmissionEdit": {
245
+ "confirmDelete": "Are you sure you wish to delete this form data?",
246
+ "editForm": "Edit Form",
247
+ "isRequired": "is required",
248
+ "submit": "Submit"
249
+ },
250
+ "gallery": {
251
+ "aspectRatio": "Aspect Ratio",
252
+ "confirmDelete": "Are you sure you wish to delete this image from gallery?",
253
+ "freeForm": "Free Form"
254
+ },
255
+ "iconPicker": {
256
+ "iconsAvailable": "icons available",
257
+ "matchingResults": "matching results",
258
+ "search": "Search icons..."
259
+ },
260
+ "login": {
261
+ "createAccount": "Create an Account",
262
+ "email": "Email",
263
+ "expiredLink": "The current link is expired.",
264
+ "forgot": "Forgot Password",
265
+ "goLogin": "Go to Login",
266
+ "login": "Login",
267
+ "password": "Password",
268
+ "register": "Register",
269
+ "registerThankYou": "Thank you for registering! Please check your email to verify your account.",
270
+ "requestLink": "Request a new reset link",
271
+ "reset": "Reset",
272
+ "resetInstructions": "Enter your email address to request a password reset.",
273
+ "resetPassword": "Reset Password",
274
+ "resetSent": "Password reset email sent!",
275
+ "setPassword": "Set Password",
276
+ "signIn": "Sign In",
277
+ "signInTitle": "Please Sign In",
278
+ "verifyPassword": "Verify Password",
279
+ "validate": {
280
+ "email": "Please enter a valid email address.",
281
+ "firstName": "Please enter your first name.",
282
+ "invalid": "Invalid login. Please check your email or password.",
283
+ "lastName": "Please enter your last name.",
284
+ "password": "Please enter a password.",
285
+ "passwordLength": "Password must be at least 8 characters long.",
286
+ "passwordMatch": "Passwords do not match.",
287
+ "selectingChurch": "Error in selecting church. Please verify and try again"
288
+ },
289
+ "welcomeBack": "Welcome back",
290
+ "welcomeName": "Welcome back, <b>{}</b>! Please wait while we load your data."
291
+ },
292
+ "markdownEditor": {
293
+ "content": "Content",
294
+ "markdownEditor": "Markdown Editor",
295
+ "markdownGuide": "Markdown Guide"
296
+ },
297
+ "month": {
298
+ "april": "April",
299
+ "august": "August",
300
+ "december": "December",
301
+ "february": "February",
302
+ "january": "January",
303
+ "july": "July",
304
+ "june": "June",
305
+ "march": "March",
306
+ "may": "May",
307
+ "november": "November",
308
+ "october": "October",
309
+ "september": "September"
310
+ },
311
+ "notes": {
312
+ "comment": "comment",
313
+ "comments": "comments",
314
+ "notes": "Notes",
315
+ "startConversation": "Start a conversation",
316
+ "validate": {
317
+ "content": "Please enter a note."
318
+ },
319
+ "viewAll": "View all"
320
+ },
321
+ "person": {
322
+ "email": "Email",
323
+ "firstName": "First Name",
324
+ "lastName": "Last Name",
325
+ "name": "Name",
326
+ "person": "Person",
327
+ "years": "years",
328
+ "noRec": "Don't have a person record?"
329
+ },
330
+ "reporting": {
331
+ "detailed": "Detailed Report",
332
+ "summary": "Summary",
333
+ "sampleTemplate": "Sample Word Template",
334
+ "downloadOptions": "Download Options",
335
+ "noData": "There is no data to display.",
336
+ "runReport": "Run Report",
337
+ "useFilter": "Use the filter to run the report."
338
+ },
339
+ "selectChurch": {
340
+ "address1": "Address Line 1",
341
+ "address2": "Address Line 2",
342
+ "another": "Choose another church",
343
+ "city": "City",
344
+ "confirmRegister": "Are you sure you wish to register a new church?",
345
+ "country": "Country",
346
+ "name": "Church Name",
347
+ "noMatches": "No matches found.",
348
+ "register": "Register a New Church",
349
+ "selectChurch": "Select a Church",
350
+ "state": "State / Province",
351
+ "zip": "Zip / Postal Code",
352
+ "validate": {
353
+ "address": "Address cannot be blank.",
354
+ "city": "City cannot be blank.",
355
+ "country": "Country cannot be blank.",
356
+ "name": "Church name cannot be blank.",
357
+ "state": "State/Province cannot be blank.",
358
+ "zip": "Zip/Postal code cannot be blank."
359
+ }
360
+ },
361
+ "stockPhotos": {
362
+ "photoBy": "Photo by:",
363
+ "providedBy": "Stock photos provided by"
364
+ },
365
+ "support": {
366
+ "documentation": "Documentation",
367
+ "discussions": "Support Forum"
368
+ },
369
+ "wrapper": {
370
+ "chatWith": "Chat with",
371
+ "deleteChurch": "Delete",
372
+ "logout": "Logout",
373
+ "messages": "Messages",
374
+ "newPrivateMessage": "New Private Message",
375
+ "notifications": "Notifications",
376
+ "privateMessage": "Private Message",
377
+ "privateConversation": "Private Conversation",
378
+ "profile": "Profile",
379
+ "searchForPerson": "Search for a person",
380
+ "support": "Support",
381
+ "sureRemoveChurch": "Are you sure you wish to delete this church? You no longer will be a member of {}.",
382
+ "switchApp": "Switch App",
383
+ "switchChurch": "Switch Church"
384
+ }
385
+ };
52
386
  Locale.init = async (backends) => {
53
387
  const resources = {};
54
388
  let langs = ["en"];
@@ -63,8 +397,14 @@ Locale.init = async (backends) => {
63
397
  resources[lang] = { translation: {} };
64
398
  for (const backend of backends) {
65
399
  const url = backend.replace("{{lng}}", lang);
66
- const data = await fetch(url).then((response) => response.json());
67
- resources[lang].translation = _a.deepMerge(resources[lang].translation, data);
400
+ try {
401
+ const data = await fetch(url).then((response) => response.json());
402
+ resources[lang].translation = _a.deepMerge(resources[lang].translation, data);
403
+ }
404
+ catch (error) {
405
+ // If fetching fails, we'll rely on the hard-coded fallbacks
406
+ console.warn(`Failed to load translations from ${url}:`, error);
407
+ }
68
408
  }
69
409
  }
70
410
  // Initialize i18n
@@ -1 +1 @@
1
- {"version":3,"file":"Locale.js","sourceRoot":"","sources":["../../src/helpers/Locale.ts"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,gBAAgB,MAAM,kCAAkC,CAAC;AAChE,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAa9C,MAAM,OAAO,MAAM;IA+DV,MAAM,CAAC,SAAS,CACvB,MAA+B,EAC/B,MAA+B;QAE/B,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;YAC1B,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBAChC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;oBAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gBACvD,IAAI,CAAC,SAAS,CACb,MAAM,CAAC,GAAG,C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;IAED,sCAAsC;IACtC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;QACtC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAChC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YAC7C,IAAI,CAAC;gBACJ,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;gBAClE,SAAS,CAAC,IAAI,CAAC,CAAC,WAAW,GAAG,EAAI,CAAC,SAAS,CAC3C,SAAS,CAAC,IAAI,CAAC,CAAC,WAAW,EAC3B,IAAI,CACJ,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,4DAA4D;gBAC5D,OAAO,CAAC,IAAI,CAAC,oCAAoC,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC;YACjE,CAAC;QACF,CAAC;IACF,CAAC;IAED,kBAAkB;IAClB,MAAM,IAAI;SACR,GAAG,CAAC,OAAO,CAAC;SACZ,GAAG,CAAC,gBAAgB,CAAC;SACrB,GAAG,CAAC,gBAAgB,CAAC;SACrB,IAAI,CAAC;QACL,SAAS;QACT,WAAW,EAAE,IAAI;QACjB,KAAK,EAAE,KAAK;QACZ,aAAa,EAAE;YACd,WAAW,EAAE,KAAK;SAClB;QACD,SAAS,EAAE;YACV,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,MAAM,EAAE,CAAC,cAAc,CAAC;SACxB;KACD,CAAC,CAAC;AACL,CAAC,AAjDU,CAiDT"}
package/package.json CHANGED
@@ -1,73 +1,73 @@
1
- {
2
- "name": "@churchapps/apphelper",
3
- "version": "0.4.25",
4
- "description": "Library of helper functions for React and NextJS ChurchApps",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "scripts": {
9
- "test": "echo \"Error: no test specified\" && exit 1",
10
- "clean": "rimraf dist",
11
- "copy-languages": "copyfiles -a public/** dist",
12
- "copy-css": "copyfiles -a public/css/** dist",
13
- "copy-assets": "npm-run-all copy-languages copy-css",
14
- "tsc": "tsc",
15
- "build": "npm-run-all clean tsc copy-assets"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "git+https://github.com/LiveChurchSolutions/AppHelper.git"
20
- },
21
- "keywords": [
22
- "ChurchApps"
23
- ],
24
- "author": "ChurchApps.org",
25
- "license": "MIT",
26
- "bugs": {
27
- "url": "https://github.com/LiveChurchSolutions/AppHelper/issues"
28
- },
29
- "homepage": "https://github.com/LiveChurchSolutions/AppHelper#readme",
30
- "peerDependencies": {
31
- "react": "^18.0.0 || ^19.0.0",
32
- "react-dom": "^18.0.0 || ^19.0.0",
33
- "react-router-dom": "^7.6.3"
34
- },
35
- "dependencies": {
36
- "@churchapps/helpers": "^1.0.45",
37
- "@emotion/cache": "^11.13.5",
38
- "@emotion/react": "^11.14.0",
39
- "@emotion/styled": "^11.14.1",
40
- "@mui/lab": "^7.0.0-beta.14",
41
- "@mui/material": "^7.2.0",
42
- "axios": "^1.10.0",
43
- "cropperjs": "^2.0.0",
44
- "date-fns": "^4.1.0",
45
- "flexsearch": "0.8.205",
46
- "i18next": "^25.3.1",
47
- "i18next-browser-languagedetector": "^8.1.0",
48
- "i18next-chained-backend": "^4.6.2",
49
- "i18next-http-backend": "^3.0.2",
50
- "jwt-decode": "^4.0.0",
51
- "mui-tel-input": "^9.0.1",
52
- "react-activity": "^2.1.3",
53
- "react-cookie": "^8.0.1",
54
- "react-cropper": "^2.3.3",
55
- "react-csv": "^2.2.2",
56
- "react-ga4": "^2.1.0",
57
- "react-google-charts": "^5.2.1",
58
- "react-i18next": "^15.6.0",
59
- "react-to-print": "^3.1.1",
60
- "slug": "^11.0.0"
61
- },
62
- "devDependencies": {
63
- "@types/node": "^24.0.10",
64
- "@types/react": "^19.1.8",
65
- "@types/react-csv": "^1.1.10",
66
- "@types/react-dom": "^19.1.6",
67
- "@types/slug": "^5.0.7",
68
- "copyfiles": "^2.4.1",
69
- "npm-run-all2": "^8.0.4",
70
- "rimraf": "^6.0.1",
71
- "typescript": "^5.8.3"
72
- }
73
- }
1
+ {
2
+ "name": "@churchapps/apphelper",
3
+ "version": "0.4.27",
4
+ "description": "Library of helper functions for React and NextJS ChurchApps",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\" && exit 1",
10
+ "clean": "rimraf dist",
11
+ "copy-languages": "copyfiles -a public/** dist",
12
+ "copy-css": "copyfiles -a public/css/** dist",
13
+ "copy-assets": "npm-run-all copy-languages copy-css",
14
+ "tsc": "tsc",
15
+ "build": "npm-run-all clean tsc copy-assets"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/LiveChurchSolutions/AppHelper.git"
20
+ },
21
+ "keywords": [
22
+ "ChurchApps"
23
+ ],
24
+ "author": "ChurchApps.org",
25
+ "license": "MIT",
26
+ "bugs": {
27
+ "url": "https://github.com/LiveChurchSolutions/AppHelper/issues"
28
+ },
29
+ "homepage": "https://github.com/LiveChurchSolutions/AppHelper#readme",
30
+ "peerDependencies": {
31
+ "react": "^18.0.0 || ^19.0.0",
32
+ "react-dom": "^18.0.0 || ^19.0.0",
33
+ "react-router-dom": "^7.6.3"
34
+ },
35
+ "dependencies": {
36
+ "@churchapps/helpers": "^1.0.46",
37
+ "@emotion/cache": "^11.13.5",
38
+ "@emotion/react": "^11.14.0",
39
+ "@emotion/styled": "^11.14.1",
40
+ "@mui/lab": "^7.0.0-beta.14",
41
+ "@mui/material": "^7.2.0",
42
+ "axios": "^1.10.0",
43
+ "cropperjs": "^2.0.0",
44
+ "date-fns": "^4.1.0",
45
+ "flexsearch": "0.8.205",
46
+ "i18next": "^25.3.1",
47
+ "i18next-browser-languagedetector": "^8.1.0",
48
+ "i18next-chained-backend": "^4.6.2",
49
+ "i18next-http-backend": "^3.0.2",
50
+ "jwt-decode": "^4.0.0",
51
+ "mui-tel-input": "^9.0.1",
52
+ "react-activity": "^2.1.3",
53
+ "react-cookie": "^8.0.1",
54
+ "react-cropper": "^2.3.3",
55
+ "react-csv": "^2.2.2",
56
+ "react-ga4": "^2.1.0",
57
+ "react-google-charts": "^5.2.1",
58
+ "react-i18next": "^15.6.0",
59
+ "react-to-print": "^3.1.1",
60
+ "slug": "^11.0.0"
61
+ },
62
+ "devDependencies": {
63
+ "@types/node": "^24.0.10",
64
+ "@types/react": "^19.1.8",
65
+ "@types/react-csv": "^1.1.10",
66
+ "@types/react-dom": "^19.1.6",
67
+ "@types/slug": "^5.0.7",
68
+ "copyfiles": "^2.4.1",
69
+ "npm-run-all2": "^8.0.4",
70
+ "rimraf": "^6.0.1",
71
+ "typescript": "^5.8.3"
72
+ }
73
+ }
@@ -31,6 +31,291 @@ export class Locale {
31
31
  ];
32
32
  private static readonly extraCodes: ExtraLanguageCodes = { no: ["nb", "nn"] };
33
33
 
34
+ // Hard-coded English fallbacks for when locale files are not available
35
+ private static readonly englishFallbacks: Record<string, any> = {
36
+ "b1Share": {
37
+ "comment": "Comment",
38
+ "commentPlaceholder": "Include a comment with your post.",
39
+ "contentShared": "Content Shared",
40
+ "group": "Group",
41
+ "sharingToGroup": "Sharing {} to B1 Group",
42
+ "validate": {
43
+ "addComment": "Please add a comment.",
44
+ "loginFirst": "Please login first.",
45
+ "notMember": "You are not currently a member of any groups on B1.",
46
+ "selectGroup": "Please select a group."
47
+ }
48
+ },
49
+ "common": {
50
+ "add": "Add",
51
+ "cancel": "Cancel",
52
+ "close": "Close",
53
+ "date": "Date",
54
+ "delete": "Delete",
55
+ "edit": "Edit",
56
+ "error": "Error",
57
+ "pleaseWait": "Please wait...",
58
+ "save": "Save",
59
+ "search": "Search",
60
+ "submit": "Submit",
61
+ "update": "Update"
62
+ },
63
+ "createPerson": {
64
+ "addNewPerson": "Add a New Person",
65
+ "firstName": "First Name",
66
+ "lastName": "Last Name",
67
+ "email": "Email"
68
+ },
69
+ "donation": {
70
+ "bankForm": {
71
+ "accountNumber": "Account Number",
72
+ "added": "Bank account added. Verify your bank account to make a donation.",
73
+ "company": "Company",
74
+ "firstDeposit": "First Deposit",
75
+ "holderName": "Account holder name is required.",
76
+ "individual": "Individual",
77
+ "name": "Account Holder Name",
78
+ "needVerified": "Bank accounts will need to be verified before making any donations. Your account will receive two small deposits in approximately 1-3 business days. You will need to enter those deposit amounts to finish verifying your account by selecting the verify account link next to your bank account under the payment methods section.",
79
+ "routingNumber": "Routing Number",
80
+ "secondDeposit": "Second Deposit",
81
+ "twoDeposits": "Enter the two deposits you received in your account to finish verifying your bank account.",
82
+ "updated": "Bank account updated.",
83
+ "verified": "Bank account verified.",
84
+ "validate": {
85
+ "accountNumber": "Routing and account number are required.",
86
+ "holderName": "Account holder name is required."
87
+ }
88
+ },
89
+ "cardForm": {
90
+ "addNew": "Add New Card",
91
+ "added": "Card added successfully.",
92
+ "expirationMonth": "Expiration Month:",
93
+ "expirationYear": "Expiration Year:",
94
+ "updated": "Card updated successfully."
95
+ },
96
+ "common": {
97
+ "cancel": "Cancel",
98
+ "error": "Error"
99
+ },
100
+ "donationForm": {
101
+ "annually": "Annually",
102
+ "biWeekly": "Bi-Weekly",
103
+ "cancelled": "Recurring donation cancelled.",
104
+ "confirmDelete": "Are you sure you wish to delete this recurring donation?",
105
+ "cover": "I'll generously add {} to cover the transaction fees so you can keep 100% of my donation.",
106
+ "donate": "Donate",
107
+ "editRecurring": "Edit Recurring Donation",
108
+ "fees": "Transaction fees of {} are applied.",
109
+ "frequency": "Frequency",
110
+ "fund": "Fund",
111
+ "funds": "Funds",
112
+ "make": "Make a Donation",
113
+ "makeRecurring": "Make a Recurring Donation",
114
+ "method": "Method",
115
+ "monthly": "Monthly",
116
+ "notes": "Notes",
117
+ "preview": "Preview Donation",
118
+ "quarterly": "Quarterly",
119
+ "recurringUpdated": "Recurring donation updated.",
120
+ "startDate": "Start Date",
121
+ "thankYou": "Thank you for your donation!",
122
+ "tooLow": "Donation amount must be greater than $0.50",
123
+ "total": "Total Donation Amount",
124
+ "validate": {
125
+ "amount": "Amount cannot be $0.",
126
+ "email": "Please enter your email address.",
127
+ "firstName": "Please enter your first name.",
128
+ "lastName": "Please enter your last name.",
129
+ "validEmail": "Please enter a valid email address."
130
+ },
131
+ "weekly": "Weekly"
132
+ },
133
+ "fundDonations": {
134
+ "addMore": "Add More",
135
+ "amount": "Amount",
136
+ "fund": "Fund"
137
+ },
138
+ "paymentMethods": {
139
+ "addBank": "Add Bank Account",
140
+ "addCard": "Add Card",
141
+ "confirmDelete": "Are you sure you wish to delete this payment method?",
142
+ "deleted": "Payment method deleted.",
143
+ "noMethod": "No payment methods. Add a payment method to make a donation.",
144
+ "verify": "Verify Account"
145
+ },
146
+ "page": {
147
+ "amount": "Amount",
148
+ "batch": "Batch",
149
+ "date": "Date",
150
+ "fund": "Fund",
151
+ "method": "Method",
152
+ "willAppear": "Donations will appear once a donation has been entered."
153
+ },
154
+ "preview": {
155
+ "date": "Donation Date",
156
+ "donate": "Donate",
157
+ "every": "Recurring Every",
158
+ "fee": "Transaction Fee",
159
+ "funds": "Funds",
160
+ "method": "Donation Method",
161
+ "notes": "Notes",
162
+ "startingOn": "Starting On",
163
+ "total": "Total",
164
+ "type": "Donation Type",
165
+ "weekly": "Weekly"
166
+ },
167
+ "recurring": {
168
+ "amount": "Amount",
169
+ "every": "Every",
170
+ "interval": "Interval",
171
+ "notFound": "Payment method not found.",
172
+ "paymentMethod": "Payment Method",
173
+ "startDate": "Start Date"
174
+ }
175
+ },
176
+ "formSubmissionEdit": {
177
+ "confirmDelete": "Are you sure you wish to delete this form data?",
178
+ "editForm": "Edit Form",
179
+ "isRequired": "is required",
180
+ "submit": "Submit"
181
+ },
182
+ "gallery": {
183
+ "aspectRatio": "Aspect Ratio",
184
+ "confirmDelete": "Are you sure you wish to delete this image from gallery?",
185
+ "freeForm": "Free Form"
186
+ },
187
+ "iconPicker": {
188
+ "iconsAvailable": "icons available",
189
+ "matchingResults": "matching results",
190
+ "search": "Search icons..."
191
+ },
192
+ "login": {
193
+ "createAccount": "Create an Account",
194
+ "email": "Email",
195
+ "expiredLink": "The current link is expired.",
196
+ "forgot": "Forgot Password",
197
+ "goLogin": "Go to Login",
198
+ "login": "Login",
199
+ "password": "Password",
200
+ "register": "Register",
201
+ "registerThankYou": "Thank you for registering! Please check your email to verify your account.",
202
+ "requestLink": "Request a new reset link",
203
+ "reset": "Reset",
204
+ "resetInstructions": "Enter your email address to request a password reset.",
205
+ "resetPassword": "Reset Password",
206
+ "resetSent": "Password reset email sent!",
207
+ "setPassword": "Set Password",
208
+ "signIn": "Sign In",
209
+ "signInTitle": "Please Sign In",
210
+ "verifyPassword": "Verify Password",
211
+ "validate": {
212
+ "email": "Please enter a valid email address.",
213
+ "firstName": "Please enter your first name.",
214
+ "invalid": "Invalid login. Please check your email or password.",
215
+ "lastName": "Please enter your last name.",
216
+ "password": "Please enter a password.",
217
+ "passwordLength": "Password must be at least 8 characters long.",
218
+ "passwordMatch": "Passwords do not match.",
219
+ "selectingChurch": "Error in selecting church. Please verify and try again"
220
+ },
221
+ "welcomeBack": "Welcome back",
222
+ "welcomeName": "Welcome back, <b>{}</b>! Please wait while we load your data."
223
+ },
224
+ "markdownEditor": {
225
+ "content": "Content",
226
+ "markdownEditor": "Markdown Editor",
227
+ "markdownGuide": "Markdown Guide"
228
+ },
229
+ "month": {
230
+ "april": "April",
231
+ "august": "August",
232
+ "december": "December",
233
+ "february": "February",
234
+ "january": "January",
235
+ "july": "July",
236
+ "june": "June",
237
+ "march": "March",
238
+ "may": "May",
239
+ "november": "November",
240
+ "october": "October",
241
+ "september": "September"
242
+ },
243
+ "notes": {
244
+ "comment": "comment",
245
+ "comments": "comments",
246
+ "notes": "Notes",
247
+ "startConversation": "Start a conversation",
248
+ "validate": {
249
+ "content": "Please enter a note."
250
+ },
251
+ "viewAll": "View all"
252
+ },
253
+ "person": {
254
+ "email": "Email",
255
+ "firstName": "First Name",
256
+ "lastName": "Last Name",
257
+ "name": "Name",
258
+ "person": "Person",
259
+ "years": "years",
260
+ "noRec": "Don't have a person record?"
261
+ },
262
+ "reporting": {
263
+ "detailed": "Detailed Report",
264
+ "summary": "Summary",
265
+ "sampleTemplate": "Sample Word Template",
266
+ "downloadOptions": "Download Options",
267
+ "noData": "There is no data to display.",
268
+ "runReport": "Run Report",
269
+ "useFilter": "Use the filter to run the report."
270
+ },
271
+ "selectChurch": {
272
+ "address1": "Address Line 1",
273
+ "address2": "Address Line 2",
274
+ "another": "Choose another church",
275
+ "city": "City",
276
+ "confirmRegister": "Are you sure you wish to register a new church?",
277
+ "country": "Country",
278
+ "name": "Church Name",
279
+ "noMatches": "No matches found.",
280
+ "register": "Register a New Church",
281
+ "selectChurch": "Select a Church",
282
+ "state": "State / Province",
283
+ "zip": "Zip / Postal Code",
284
+ "validate": {
285
+ "address": "Address cannot be blank.",
286
+ "city": "City cannot be blank.",
287
+ "country": "Country cannot be blank.",
288
+ "name": "Church name cannot be blank.",
289
+ "state": "State/Province cannot be blank.",
290
+ "zip": "Zip/Postal code cannot be blank."
291
+ }
292
+ },
293
+ "stockPhotos": {
294
+ "photoBy": "Photo by:",
295
+ "providedBy": "Stock photos provided by"
296
+ },
297
+ "support": {
298
+ "documentation": "Documentation",
299
+ "discussions": "Support Forum"
300
+ },
301
+ "wrapper": {
302
+ "chatWith": "Chat with",
303
+ "deleteChurch": "Delete",
304
+ "logout": "Logout",
305
+ "messages": "Messages",
306
+ "newPrivateMessage": "New Private Message",
307
+ "notifications": "Notifications",
308
+ "privateMessage": "Private Message",
309
+ "privateConversation": "Private Conversation",
310
+ "profile": "Profile",
311
+ "searchForPerson": "Search for a person",
312
+ "support": "Support",
313
+ "sureRemoveChurch": "Are you sure you wish to delete this church? You no longer will be a member of {}.",
314
+ "switchApp": "Switch App",
315
+ "switchChurch": "Switch Church"
316
+ }
317
+ };
318
+
34
319
  static init = async (backends: string[]): Promise<void> => {
35
320
  const resources: TranslationResources = {};
36
321
  let langs = ["en"];
@@ -50,11 +335,16 @@ export class Locale {
50
335
  resources[lang] = { translation: {} };
51
336
  for (const backend of backends) {
52
337
  const url = backend.replace("{{lng}}", lang);
53
- const data = await fetch(url).then((response) => response.json());
54
- resources[lang].translation = this.deepMerge(
55
- resources[lang].translation,
56
- data,
57
- );
338
+ try {
339
+ const data = await fetch(url).then((response) => response.json());
340
+ resources[lang].translation = this.deepMerge(
341
+ resources[lang].translation,
342
+ data,
343
+ );
344
+ } catch (error) {
345
+ // If fetching fails, we'll rely on the hard-coded fallbacks
346
+ console.warn(`Failed to load translations from ${url}:`, error);
347
+ }
58
348
  }
59
349
  }
60
350
 
@@ -97,9 +387,52 @@ export class Locale {
97
387
  return obj !== null && typeof obj === "object" && !Array.isArray(obj);
98
388
  }
99
389
 
100
- // New helper method that uses i18n
390
+ // Helper method to get value from nested object using dot notation
391
+ private static getNestedValue(obj: Record<string, any>, path: string): any {
392
+ return path.split('.').reduce((current, key) => {
393
+ return current && current[key] !== undefined ? current[key] : undefined;
394
+ }, obj);
395
+ }
396
+
397
+ // New helper method that uses i18n with hard-coded English fallback
101
398
  static t(key: string, options?: Record<string, unknown>): string {
102
- return i18n.t(key, options);
399
+ try {
400
+ // Check if i18n is initialized and has the key
401
+ if (i18n && i18n.isInitialized && i18n.exists(key)) {
402
+ const translation = i18n.t(key, options);
403
+ // If translation is not the same as the key, return it
404
+ if (translation !== key) {
405
+ return translation;
406
+ }
407
+ }
408
+ } catch (error) {
409
+ // If i18n fails, fall through to hard-coded fallback
410
+ console.warn(`i18n translation failed for key "${key}":`, error);
411
+ }
412
+
413
+ // Fallback to hard-coded English translations
414
+ const fallbackValue = this.getNestedValue(this.englishFallbacks, key);
415
+ if (fallbackValue !== undefined) {
416
+ // Handle simple string interpolation for options
417
+ if (typeof fallbackValue === 'string' && options) {
418
+ let result = fallbackValue;
419
+ Object.keys(options).forEach(optionKey => {
420
+ const placeholder = `{{${optionKey}}}`;
421
+ if (result.includes(placeholder)) {
422
+ result = result.replace(new RegExp(placeholder, 'g'), String(options[optionKey]));
423
+ }
424
+ // Also handle {} placeholder for backward compatibility
425
+ if (result.includes('{}')) {
426
+ result = result.replace('{}', String(options[optionKey]));
427
+ }
428
+ });
429
+ return result;
430
+ }
431
+ return String(fallbackValue);
432
+ }
433
+
434
+ // If no fallback found, return the key itself
435
+ return key;
103
436
  }
104
437
 
105
438
  // Keep the old method for backward compatibility
@@ -111,4 +444,15 @@ export class Locale {
111
444
  }
112
445
  return translation;
113
446
  }
447
+
448
+ // Helper method to check if i18n is initialized
449
+ static isInitialized(): boolean {
450
+ return i18n && i18n.isInitialized;
451
+ }
452
+
453
+ // Method to set up basic fallback-only mode (no i18n)
454
+ static setupFallbackMode(): void {
455
+ // This method can be called if apps want to use only the hard-coded fallbacks
456
+ // without initializing the full i18n system
457
+ }
114
458
  }