waha-shared 1.0.249 → 1.0.251

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,6 +1,30 @@
1
1
  import { BibleChapter, BibleChapters } from '../types/bibleChapters';
2
2
  import type { LanguageInfo } from '../types/languages';
3
3
  import { ScripturePassage } from '../types/scripturePassages';
4
+ export interface VerseRangeInfo {
5
+ startBook: string;
6
+ startChapter: string;
7
+ startVerse: string;
8
+ endBook: string;
9
+ endChapter: string;
10
+ endVerse: string;
11
+ startChapterId: string;
12
+ endChapterId: string;
13
+ }
14
+ /**
15
+ * Parses a verse range string like "GEN.1.1-GEN.1.25" or "JHN.3.16" or "REV.22"
16
+ * Returns the start and end verse IDs
17
+ */
18
+ export declare function parseVerseRange(passageId: string): VerseRangeInfo;
19
+ type GetChapterUrlParams = {
20
+ bibleAudioId: string;
21
+ passageId: string;
22
+ } | {
23
+ startBook: string;
24
+ startChapter: string;
25
+ bibleAudioId: string;
26
+ };
27
+ export declare function getChapterUrl(params: GetChapterUrlParams): string;
4
28
  /**
5
29
  * Condenses a list of USFM passage IDs into a readable string format. Groups
6
30
  * consecutive passages from the same book together.
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseVerseRange = parseVerseRange;
4
+ exports.getChapterUrl = getChapterUrl;
3
5
  exports.getPassagesString = getPassagesString;
4
6
  exports.getScripturePassage = getScripturePassage;
5
7
  exports.getLessonScripture = getLessonScripture;
@@ -8,17 +10,24 @@ exports.verseToSuperscript = verseToSuperscript;
8
10
  const bibleStatuses_1 = require("../data/bibleStatuses");
9
11
  const languages_1 = require("../functions/languages");
10
12
  const bibleChapters_1 = require("../types/bibleChapters");
13
+ const sets_1 = require("./sets");
11
14
  /**
12
- * Parses a verse range string like "GEN.1.1-GEN.1.25" or "JHN.3.16" Returns the
13
- * start and end verse IDs
15
+ * Parses a verse range string like "GEN.1.1-GEN.1.25" or "JHN.3.16" or "REV.22"
16
+ * Returns the start and end verse IDs
14
17
  */
15
18
  function parseVerseRange(passageId) {
16
19
  // Handle single verse: "GEN.1.1" -> "GEN.1.1-GEN.1.1"
17
20
  const parts = passageId.includes('-')
18
21
  ? passageId.split('-')
19
22
  : [passageId, passageId];
20
- const [startBook, startChapter, startVerse] = parts[0].split('.');
21
- const [endBook, endChapter, endVerse] = parts[1].split('.');
23
+ const startParts = parts[0].split('.');
24
+ const endParts = parts[1].split('.');
25
+ const startBook = startParts[0];
26
+ const startChapter = startParts[1];
27
+ const startVerse = startParts.length > 2 ? startParts[2] : '1';
28
+ const endBook = endParts[0];
29
+ const endChapter = endParts[1];
30
+ const endVerse = endParts.length > 2 ? endParts[2] : '1';
22
31
  return {
23
32
  startBook,
24
33
  startChapter,
@@ -26,8 +35,24 @@ function parseVerseRange(passageId) {
26
35
  endBook,
27
36
  endChapter,
28
37
  endVerse,
38
+ startChapterId: `${startBook}.${startChapter}`,
39
+ endChapterId: `${endBook}.${endChapter}`,
29
40
  };
30
41
  }
42
+ function getChapterUrl(params) {
43
+ const startBook = 'startBook' in params
44
+ ? params.startBook
45
+ : parseVerseRange(params.passageId).startBook;
46
+ const startChapter = 'startChapter' in params
47
+ ? params.startChapter
48
+ : parseVerseRange(params.passageId).startChapter;
49
+ return (sets_1.firebaseUrl +
50
+ encodeURIComponent('audio_bibles' +
51
+ `/${params.bibleAudioId}` +
52
+ `/${startBook}` +
53
+ `/${startBook}_${startChapter.padStart(3, '0')}.mp3`) +
54
+ `?alt=media`);
55
+ }
31
56
  /** Extracts verses from a chapter based on verse numbers */
32
57
  function extractVersesFromChapter(chapter, startVerse, endVerse) {
33
58
  const verses = chapter.verses.filter((verse) => {
@@ -58,10 +58,16 @@ type Misc = {
58
58
  payload: {
59
59
  enabled: boolean;
60
60
  };
61
+ } | {
62
+ name: 'StartOnboarding';
63
+ payload: {
64
+ usedOldOnboarding?: boolean;
65
+ };
61
66
  } | {
62
67
  name: 'FinishOnboarding';
63
68
  payload: {
64
- skipped: boolean;
69
+ skippedFromPage: number | undefined;
70
+ usedOldOnboarding?: boolean;
65
71
  };
66
72
  } | {
67
73
  name: 'ClickNotification';
@@ -128,23 +134,17 @@ type Bible = {
128
134
  name: 'BibleSession';
129
135
  payload: BibleSession;
130
136
  };
131
- type Worksheets = {
132
- name: 'WorksheetNotificationResponse';
133
- payload: {
134
- worksheetId: string;
135
- didApply: boolean;
136
- };
137
- } | {
138
- name: 'WorksheetStart';
137
+ type MicroLessons = {
138
+ name: 'MicroLessonStart';
139
139
  payload: {
140
- worksheetId: string;
140
+ microLessonId: string;
141
141
  };
142
142
  } | {
143
- name: 'WorksheetComplete';
143
+ name: 'MicroLessonComplete';
144
144
  payload: {
145
- worksheetId: string;
145
+ microLessonId: string;
146
146
  timeToCompletion: number;
147
147
  };
148
148
  };
149
- export type AnalyticsEvent = Meeting | Share | Misc | Article | Bible | Note | Worksheets | Give;
149
+ export type AnalyticsEvent = Meeting | Share | Misc | Article | Bible | Note | MicroLessons | Give;
150
150
  export {};
@@ -146,3 +146,7 @@ export declare const ArticlesResponseSchema: z.ZodObject<{
146
146
  body: z.ZodString;
147
147
  }, z.core.$strip>>;
148
148
  }, z.core.$strip>;
149
+ export declare const ArticleLanguagesResponseSchema: z.ZodObject<{
150
+ data: z.ZodArray<z.ZodString>;
151
+ }, z.core.$strip>;
152
+ export type ArticleCategory = z.infer<typeof ArticleSchema>['category'];
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ArticlesResponseSchema = exports.ResponseArticleSchema = exports.ArticleSchema = void 0;
6
+ exports.ArticleLanguagesResponseSchema = exports.ArticlesResponseSchema = exports.ResponseArticleSchema = exports.ArticleSchema = void 0;
7
7
  const v4_1 = __importDefault(require("zod/v4"));
8
8
  const webContent_1 = require("./webContent");
9
9
  exports.ArticleSchema = v4_1.default.object({
@@ -50,3 +50,6 @@ exports.ResponseArticleSchema = v4_1.default.object({
50
50
  exports.ArticlesResponseSchema = v4_1.default.object({
51
51
  data: v4_1.default.array(exports.ResponseArticleSchema),
52
52
  });
53
+ exports.ArticleLanguagesResponseSchema = v4_1.default.object({
54
+ data: v4_1.default.array(v4_1.default.string()),
55
+ });
@@ -204,3 +204,7 @@ export declare const MicroLessonSubmissionSchema: z.ZodObject<{
204
204
  }>;
205
205
  }, z.core.$strip>;
206
206
  export type MicroLessonSubmission = z.infer<typeof MicroLessonSubmissionSchema>;
207
+ export declare const MicroLessonLanguagesResponseSchema: z.ZodObject<{
208
+ data: z.ZodArray<z.ZodString>;
209
+ }, z.core.$strip>;
210
+ export type MicroLessonCategory = z.infer<typeof MicroLessonSchema>['category'];
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.MicroLessonSubmissionSchema = exports.MicroLessonsResponse = exports.ResponseMicroLessonSchema = exports.MicroLessonSchema = void 0;
6
+ exports.MicroLessonLanguagesResponseSchema = exports.MicroLessonSubmissionSchema = exports.MicroLessonsResponse = exports.ResponseMicroLessonSchema = exports.MicroLessonSchema = void 0;
7
7
  const v4_1 = __importDefault(require("zod/v4"));
8
8
  const users_1 = require("./users");
9
9
  const webContent_1 = require("./webContent");
@@ -78,3 +78,6 @@ exports.MicroLessonSubmissionSchema = users_1.WahaUserLocationSchema.extend({
78
78
  timeSubmitted: v4_1.default.number(),
79
79
  platform: v4_1.default.enum(['ios', 'android', 'web']),
80
80
  });
81
+ exports.MicroLessonLanguagesResponseSchema = v4_1.default.object({
82
+ data: v4_1.default.array(v4_1.default.string()),
83
+ });
@@ -94,32 +94,12 @@ export declare const CompletionEventSchema: z.ZodObject<{
94
94
  manual: z.ZodOptional<z.ZodBoolean>;
95
95
  }, z.core.$strip>;
96
96
  export type CompletionEvent = z.infer<typeof CompletionEventSchema>;
97
- declare const WorksheetAnswerSchema: z.ZodObject<{
98
- question: z.ZodString;
99
- answer: z.ZodString;
100
- }, z.core.$strip>;
101
- export type WorksheetAnswer = z.infer<typeof WorksheetAnswerSchema>;
102
- declare const WorksheetCompletionEventSchema: z.ZodObject<{
103
- startTime: z.ZodNumber;
104
- completionTime: z.ZodOptional<z.ZodNumber>;
105
- worksheetId: z.ZodString;
106
- answers: z.ZodArray<z.ZodObject<{
107
- question: z.ZodString;
108
- answer: z.ZodString;
109
- }, z.core.$strip>>;
110
- country: z.ZodOptional<z.ZodString>;
111
- region: z.ZodOptional<z.ZodString>;
112
- city: z.ZodOptional<z.ZodString>;
113
- didApply: z.ZodOptional<z.ZodBoolean>;
114
- notificationText: z.ZodOptional<z.ZodString>;
115
- feedback: z.ZodOptional<z.ZodString>;
116
- }, z.core.$strip>;
117
- export type WorksheetCompletionEvent = z.infer<typeof WorksheetCompletionEventSchema>;
118
97
  export declare const WahaShareContentSchema: z.ZodEnum<{
119
98
  lesson: "lesson";
120
99
  note: "note";
121
100
  setLink: "setLink";
122
101
  lessonLink: "lessonLink";
102
+ notification: "notification";
123
103
  app: "app";
124
104
  passcode: "passcode";
125
105
  lessonAudio: "lessonAudio";
@@ -129,7 +109,6 @@ export declare const WahaShareContentSchema: z.ZodEnum<{
129
109
  meetingInvite: "meetingInvite";
130
110
  articleLink: "articleLink";
131
111
  videoLink: "videoLink";
132
- notification: "notification";
133
112
  meetingSchedule: "meetingSchedule";
134
113
  scriptureText: "scriptureText";
135
114
  mt: "mt";
@@ -147,6 +126,7 @@ export declare const ShareLogEventSchema: z.ZodObject<{
147
126
  note: "note";
148
127
  setLink: "setLink";
149
128
  lessonLink: "lessonLink";
129
+ notification: "notification";
150
130
  app: "app";
151
131
  passcode: "passcode";
152
132
  lessonAudio: "lessonAudio";
@@ -156,7 +136,6 @@ export declare const ShareLogEventSchema: z.ZodObject<{
156
136
  meetingInvite: "meetingInvite";
157
137
  articleLink: "articleLink";
158
138
  videoLink: "videoLink";
159
- notification: "notification";
160
139
  meetingSchedule: "meetingSchedule";
161
140
  scriptureText: "scriptureText";
162
141
  mt: "mt";
@@ -168,6 +147,7 @@ export declare const ShareLogEventSchema: z.ZodObject<{
168
147
  }>;
169
148
  lessonId: z.ZodOptional<z.ZodString>;
170
149
  articleSlug: z.ZodOptional<z.ZodString>;
150
+ microLessonSlug: z.ZodOptional<z.ZodString>;
171
151
  }, z.core.$strip>;
172
152
  export type ShareLogEvent = z.infer<typeof ShareLogEventSchema>;
173
153
  export declare const BibleSessionSchema: z.ZodObject<{
@@ -269,6 +249,7 @@ export declare const WahaUserSchema: z.ZodObject<{
269
249
  note: "note";
270
250
  setLink: "setLink";
271
251
  lessonLink: "lessonLink";
252
+ notification: "notification";
272
253
  app: "app";
273
254
  passcode: "passcode";
274
255
  lessonAudio: "lessonAudio";
@@ -278,7 +259,6 @@ export declare const WahaUserSchema: z.ZodObject<{
278
259
  meetingInvite: "meetingInvite";
279
260
  articleLink: "articleLink";
280
261
  videoLink: "videoLink";
281
- notification: "notification";
282
262
  meetingSchedule: "meetingSchedule";
283
263
  scriptureText: "scriptureText";
284
264
  mt: "mt";
@@ -290,6 +270,7 @@ export declare const WahaUserSchema: z.ZodObject<{
290
270
  }>;
291
271
  lessonId: z.ZodOptional<z.ZodString>;
292
272
  articleSlug: z.ZodOptional<z.ZodString>;
273
+ microLessonSlug: z.ZodOptional<z.ZodString>;
293
274
  }, z.core.$strip>>>;
294
275
  bibleSessions: z.ZodOptional<z.ZodArray<z.ZodObject<{
295
276
  chapter: z.ZodString;
@@ -303,16 +284,22 @@ export declare const WahaUserSchema: z.ZodObject<{
303
284
  startTime: z.ZodNumber;
304
285
  }, z.core.$strip>>>;
305
286
  activated: z.ZodOptional<z.ZodBoolean>;
306
- worksheetCompletions: z.ZodOptional<z.ZodArray<z.ZodObject<{
287
+ microLessonCompletions: z.ZodOptional<z.ZodArray<z.ZodObject<{
307
288
  city: z.ZodOptional<z.ZodString>;
308
289
  country: z.ZodOptional<z.ZodString>;
309
290
  region: z.ZodOptional<z.ZodString>;
310
- startTime: z.ZodNumber;
311
- completionTime: z.ZodOptional<z.ZodNumber>;
312
- worksheetId: z.ZodString;
313
- didApply: z.ZodOptional<z.ZodBoolean>;
314
- notificationText: z.ZodOptional<z.ZodString>;
315
- feedback: z.ZodOptional<z.ZodString>;
291
+ microLessonId: z.ZodString;
292
+ userId: z.ZodString;
293
+ microLessonTitle: z.ZodString;
294
+ languageId: z.ZodString;
295
+ campaign: z.ZodOptional<z.ZodString>;
296
+ timeStarted: z.ZodNumber;
297
+ timeSubmitted: z.ZodNumber;
298
+ platform: z.ZodEnum<{
299
+ web: "web";
300
+ ios: "ios";
301
+ android: "android";
302
+ }>;
316
303
  }, z.core.$strip>>>;
317
304
  }, z.core.$strip>;
318
305
  export declare const PushEnabledWahaUserSchema: z.ZodObject<{
@@ -320,6 +307,7 @@ export declare const PushEnabledWahaUserSchema: z.ZodObject<{
320
307
  appInterface: z.ZodString;
321
308
  email: z.ZodOptional<z.ZodEmail>;
322
309
  meet: z.ZodString;
310
+ platform: z.ZodString;
323
311
  location: z.ZodOptional<z.ZodObject<{
324
312
  city: z.ZodOptional<z.ZodString>;
325
313
  country: z.ZodOptional<z.ZodString>;
@@ -373,7 +361,6 @@ export declare const PushEnabledWahaUserSchema: z.ZodObject<{
373
361
  securityModeOn: z.ZodOptional<z.ZodBoolean>;
374
362
  appVersion: z.ZodString;
375
363
  lastUpdate: z.ZodNumber;
376
- platform: z.ZodString;
377
364
  completions: z.ZodArray<z.ZodObject<{
378
365
  lessonId: z.ZodString;
379
366
  meetLanguageId: z.ZodString;
@@ -394,6 +381,7 @@ export declare const PushEnabledWahaUserSchema: z.ZodObject<{
394
381
  note: "note";
395
382
  setLink: "setLink";
396
383
  lessonLink: "lessonLink";
384
+ notification: "notification";
397
385
  app: "app";
398
386
  passcode: "passcode";
399
387
  lessonAudio: "lessonAudio";
@@ -403,7 +391,6 @@ export declare const PushEnabledWahaUserSchema: z.ZodObject<{
403
391
  meetingInvite: "meetingInvite";
404
392
  articleLink: "articleLink";
405
393
  videoLink: "videoLink";
406
- notification: "notification";
407
394
  meetingSchedule: "meetingSchedule";
408
395
  scriptureText: "scriptureText";
409
396
  mt: "mt";
@@ -415,6 +402,7 @@ export declare const PushEnabledWahaUserSchema: z.ZodObject<{
415
402
  }>;
416
403
  lessonId: z.ZodOptional<z.ZodString>;
417
404
  articleSlug: z.ZodOptional<z.ZodString>;
405
+ microLessonSlug: z.ZodOptional<z.ZodString>;
418
406
  }, z.core.$strip>>>;
419
407
  bibleSessions: z.ZodOptional<z.ZodArray<z.ZodObject<{
420
408
  chapter: z.ZodString;
@@ -428,16 +416,22 @@ export declare const PushEnabledWahaUserSchema: z.ZodObject<{
428
416
  startTime: z.ZodNumber;
429
417
  }, z.core.$strip>>>;
430
418
  activated: z.ZodOptional<z.ZodBoolean>;
431
- worksheetCompletions: z.ZodOptional<z.ZodArray<z.ZodObject<{
419
+ microLessonCompletions: z.ZodOptional<z.ZodArray<z.ZodObject<{
432
420
  city: z.ZodOptional<z.ZodString>;
433
421
  country: z.ZodOptional<z.ZodString>;
434
422
  region: z.ZodOptional<z.ZodString>;
435
- startTime: z.ZodNumber;
436
- completionTime: z.ZodOptional<z.ZodNumber>;
437
- worksheetId: z.ZodString;
438
- didApply: z.ZodOptional<z.ZodBoolean>;
439
- notificationText: z.ZodOptional<z.ZodString>;
440
- feedback: z.ZodOptional<z.ZodString>;
423
+ microLessonId: z.ZodString;
424
+ userId: z.ZodString;
425
+ microLessonTitle: z.ZodString;
426
+ languageId: z.ZodString;
427
+ campaign: z.ZodOptional<z.ZodString>;
428
+ timeStarted: z.ZodNumber;
429
+ timeSubmitted: z.ZodNumber;
430
+ platform: z.ZodEnum<{
431
+ web: "web";
432
+ ios: "ios";
433
+ android: "android";
434
+ }>;
441
435
  }, z.core.$strip>>>;
442
436
  wahaUserId: z.ZodString;
443
437
  pushToken: z.ZodString;
@@ -445,4 +439,3 @@ export declare const PushEnabledWahaUserSchema: z.ZodObject<{
445
439
  }, z.core.$strip>;
446
440
  export type PushEnabledWahaUser = z.infer<typeof PushEnabledWahaUserSchema>;
447
441
  export type WahaUser = z.infer<typeof WahaUserSchema>;
448
- export {};
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PushEnabledWahaUserSchema = exports.WahaUserSchema = exports.ArticleSessionSchema = exports.BibleSessionSchema = exports.ShareLogEventSchema = exports.WahaShareContentSchema = exports.CompletionEventSchema = exports.WahaAppVersionSchema = exports.WahaUserStateSchema = exports.DesireIdSchema = exports.WahaUserLocationSchema = void 0;
4
4
  const zod_1 = require("zod");
5
+ const microLessons_1 = require("./microLessons");
5
6
  exports.WahaUserLocationSchema = zod_1.z.object({
6
7
  city: zod_1.z.string().optional(),
7
8
  country: zod_1.z.string().optional(),
@@ -73,22 +74,6 @@ exports.CompletionEventSchema = zod_1.z.object({
73
74
  */
74
75
  manual: zod_1.z.boolean().optional(),
75
76
  });
76
- const WorksheetAnswerSchema = zod_1.z.object({
77
- question: zod_1.z.string(),
78
- answer: zod_1.z.string(),
79
- });
80
- const WorksheetCompletionEventSchema = zod_1.z.object({
81
- startTime: zod_1.z.number(),
82
- completionTime: zod_1.z.number().optional(),
83
- worksheetId: zod_1.z.string(),
84
- answers: zod_1.z.array(WorksheetAnswerSchema),
85
- country: zod_1.z.string().optional(),
86
- region: zod_1.z.string().optional(),
87
- city: zod_1.z.string().optional(),
88
- didApply: zod_1.z.boolean().optional(),
89
- notificationText: zod_1.z.string().optional(),
90
- feedback: zod_1.z.string().optional(),
91
- });
92
77
  exports.WahaShareContentSchema = zod_1.z.enum([
93
78
  'app',
94
79
  'passcode',
@@ -118,6 +103,7 @@ exports.ShareLogEventSchema = zod_1.z.object({
118
103
  content: exports.WahaShareContentSchema,
119
104
  lessonId: zod_1.z.string().optional(),
120
105
  articleSlug: zod_1.z.string().optional(),
106
+ microLessonSlug: zod_1.z.string().optional(),
121
107
  });
122
108
  exports.BibleSessionSchema = zod_1.z.object({
123
109
  chapter: zod_1.z.string(),
@@ -148,9 +134,7 @@ exports.WahaUserSchema = exports.WahaUserStateSchema.extend({
148
134
  bibleSessions: zod_1.z.array(exports.BibleSessionSchema).optional(),
149
135
  articleSessions: zod_1.z.array(exports.ArticleSessionSchema).optional(),
150
136
  activated: zod_1.z.boolean().optional(),
151
- worksheetCompletions: zod_1.z
152
- .array(WorksheetCompletionEventSchema.omit({ answers: true }))
153
- .optional(),
137
+ microLessonCompletions: zod_1.z.array(microLessons_1.MicroLessonSubmissionSchema).optional(),
154
138
  });
155
139
  exports.PushEnabledWahaUserSchema = exports.WahaUserSchema.omit({
156
140
  wahaUserId: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waha-shared",
3
- "version": "1.0.249",
3
+ "version": "1.0.251",
4
4
  "author": "Waha",
5
5
  "dependencies": {
6
6
  "@types/signale": "^1.4.7",