@youversion/platform-react-native 0.7.2

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 (116) hide show
  1. package/.releaserc.json +104 -0
  2. package/CHANGELOG.md +29 -0
  3. package/CONTRIBUTING.md +319 -0
  4. package/LICENSE +201 -0
  5. package/README.md +562 -0
  6. package/RELEASING.md +85 -0
  7. package/android/build.gradle +43 -0
  8. package/android/src/main/AndroidManifest.xml +2 -0
  9. package/assets/github-reactNative-sdk-banner.png +0 -0
  10. package/build/api/bible.d.ts +26 -0
  11. package/build/api/bible.d.ts.map +1 -0
  12. package/build/api/bible.js +32 -0
  13. package/build/api/bible.js.map +1 -0
  14. package/build/api/highlights.d.ts +109 -0
  15. package/build/api/highlights.d.ts.map +1 -0
  16. package/build/api/highlights.js +49 -0
  17. package/build/api/highlights.js.map +1 -0
  18. package/build/api/index.d.ts +27 -0
  19. package/build/api/index.d.ts.map +1 -0
  20. package/build/api/index.js +13 -0
  21. package/build/api/index.js.map +1 -0
  22. package/build/api/languages.d.ts +11 -0
  23. package/build/api/languages.d.ts.map +1 -0
  24. package/build/api/languages.js +13 -0
  25. package/build/api/languages.js.map +1 -0
  26. package/build/api/users.d.ts +20 -0
  27. package/build/api/users.d.ts.map +1 -0
  28. package/build/api/users.js +26 -0
  29. package/build/api/users.js.map +1 -0
  30. package/build/api/votd.d.ts +15 -0
  31. package/build/api/votd.d.ts.map +1 -0
  32. package/build/api/votd.js +13 -0
  33. package/build/api/votd.js.map +1 -0
  34. package/build/components/BibleReaderView.d.ts +22 -0
  35. package/build/components/BibleReaderView.d.ts.map +1 -0
  36. package/build/components/BibleReaderView.js +18 -0
  37. package/build/components/BibleReaderView.js.map +1 -0
  38. package/build/components/BibleTextView.d.ts +18 -0
  39. package/build/components/BibleTextView.d.ts.map +1 -0
  40. package/build/components/BibleTextView.js +25 -0
  41. package/build/components/BibleTextView.js.map +1 -0
  42. package/build/components/BibleWidgetView.d.ts +23 -0
  43. package/build/components/BibleWidgetView.d.ts.map +1 -0
  44. package/build/components/BibleWidgetView.js +17 -0
  45. package/build/components/BibleWidgetView.js.map +1 -0
  46. package/build/components/SignInWithYouVersionButton.d.ts +37 -0
  47. package/build/components/SignInWithYouVersionButton.d.ts.map +1 -0
  48. package/build/components/SignInWithYouVersionButton.js +12 -0
  49. package/build/components/SignInWithYouVersionButton.js.map +1 -0
  50. package/build/components/VotdView.d.ts +11 -0
  51. package/build/components/VotdView.d.ts.map +1 -0
  52. package/build/components/VotdView.js +12 -0
  53. package/build/components/VotdView.js.map +1 -0
  54. package/build/components/index.d.ts +6 -0
  55. package/build/components/index.d.ts.map +1 -0
  56. package/build/components/index.js +6 -0
  57. package/build/components/index.js.map +1 -0
  58. package/build/index.d.ts +5 -0
  59. package/build/index.d.ts.map +1 -0
  60. package/build/index.js +6 -0
  61. package/build/index.js.map +1 -0
  62. package/build/native.d.ts +22 -0
  63. package/build/native.d.ts.map +1 -0
  64. package/build/native.js +3 -0
  65. package/build/native.js.map +1 -0
  66. package/build/platform.d.ts +21 -0
  67. package/build/platform.d.ts.map +1 -0
  68. package/build/platform.js +28 -0
  69. package/build/platform.js.map +1 -0
  70. package/build/types.d.ts +320 -0
  71. package/build/types.d.ts.map +1 -0
  72. package/build/types.js +2 -0
  73. package/build/types.js.map +1 -0
  74. package/commitlint.config.js +23 -0
  75. package/dist/youversion-platform-react-native-0.7.2.tgz +0 -0
  76. package/eslint.config.js +4 -0
  77. package/expo-module.config.json +17 -0
  78. package/ios/APIs/YVPBibleAPI.swift +197 -0
  79. package/ios/APIs/YVPHighlightsAPI.swift +105 -0
  80. package/ios/APIs/YVPLanguagesAPI.swift +70 -0
  81. package/ios/RNBibleReaderViewModule.swift +9 -0
  82. package/ios/RNBibleTextViewModule.swift +9 -0
  83. package/ios/RNBibleWidgetViewModule.swift +9 -0
  84. package/ios/RNSignInWithYouVersionButtonModule.swift +9 -0
  85. package/ios/RNVotdViewModule.swift +9 -0
  86. package/ios/RNYouVersionPlatformModule.swift +79 -0
  87. package/ios/Views/YVPBibleReaderView.swift +57 -0
  88. package/ios/Views/YVPBibleTextView.swift +114 -0
  89. package/ios/Views/YVPBibleWidgetView.swift +64 -0
  90. package/ios/Views/YVPSignInWithYouVersionButton.swift +52 -0
  91. package/ios/Views/YVPVotdView.swift +35 -0
  92. package/ios/YVPAuthAPI.swift +77 -0
  93. package/ios/YVPVotdAPI.swift +20 -0
  94. package/ios/YVPlatform.swift +17 -0
  95. package/ios/YouVersionReactNative.podspec +33 -0
  96. package/mocks/RNYouVersionPlatform.ts +146 -0
  97. package/package.json +58 -0
  98. package/scripts/release-local.sh +224 -0
  99. package/scripts/sync-android-version.js +75 -0
  100. package/src/api/bible.ts +35 -0
  101. package/src/api/highlights.ts +145 -0
  102. package/src/api/index.ts +13 -0
  103. package/src/api/languages.ts +14 -0
  104. package/src/api/users.ts +35 -0
  105. package/src/api/votd.ts +20 -0
  106. package/src/components/BibleReaderView.tsx +52 -0
  107. package/src/components/BibleTextView.tsx +63 -0
  108. package/src/components/BibleWidgetView.tsx +45 -0
  109. package/src/components/SignInWithYouVersionButton.tsx +70 -0
  110. package/src/components/VotdView.tsx +36 -0
  111. package/src/components/index.ts +5 -0
  112. package/src/index.ts +5 -0
  113. package/src/native.ts +58 -0
  114. package/src/platform.ts +30 -0
  115. package/src/types.ts +382 -0
  116. package/tsconfig.json +9 -0
package/README.md ADDED
@@ -0,0 +1,562 @@
1
+ ![Platform React Native SDK](./assets/github-reactNative-sdk-banner.png)
2
+
3
+ # YouVersion React Native SDK
4
+
5
+ [![npm version](https://badge.fury.io/js/@youversion%2Freact-native-sdk.svg)](https://www.npmjs.com/package/@youversion/platform-sdk-reactnative)
6
+ [![CI Status](https://github.com/youversion/platform-sdk-reactnative/workflows/CI/badge.svg)](https://github.com/youversion/platform-sdk-reactnative/actions)
7
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
8
+
9
+ A lightweight React Native SDK for integrating YouVersion Platform features into React Native applications.
10
+
11
+ ## Documentation
12
+
13
+ - [Installation & Usage](#installation)
14
+ - [API Reference](#api)
15
+ - [Contributing Guide](CONTRIBUTING.md)
16
+ - [Changelog](CHANGELOG.md)
17
+
18
+ > [!important]
19
+ > The React Native SDK is currently **iOS-only**. Android support is under active development and not yet available for use.
20
+
21
+ ## Installation
22
+
23
+ **Prerequisites:**
24
+
25
+ This project uses the underlying YouVersion SDKs for [Swift](https://github.com/youversion/platform-sdk-swift) and [Kotlin](https://github.com/youversion/platform-sdk-kotlin), with UI components written in SwiftUI and Jetpack Compose, respectively.
26
+
27
+ Because support for Jetpack Compose and SwiftUI is a recent development in the React Native ecosystem, this SDK requires recent versions of iOS, Expo, and React Native to work.
28
+
29
+ > The minimum supported version of iOS is 17.
30
+ > The minimum supported version of Expo is SDK 54.
31
+
32
+ **Using bare React Native?**
33
+ Follow these instructions to [set up Expo modules in a bare React Native project](https://docs.expo.dev/bare/installing-expo-modules/) before installing this package.
34
+
35
+ **Install the package:**
36
+
37
+ Using npm:
38
+
39
+ ```sh
40
+ npm install @youversion/platform-sdk-reactnative
41
+ ```
42
+
43
+ Using Yarn:
44
+
45
+ ```sh
46
+ yarn add @youversion/platform-sdk-reactnative
47
+ ```
48
+
49
+ Using pnpm:
50
+
51
+ ```sh
52
+ pnpm add @youversion/platform-sdk-reactnative
53
+ ```
54
+
55
+ iOS (bare React Native):
56
+
57
+ ```sh
58
+ npx pod-install
59
+ ```
60
+
61
+ Expo managed workflow (requires a development build or prebuild):
62
+
63
+ ```sh
64
+ npx expo install @youversion/platform-sdk-reactnative
65
+ npx expo prebuild
66
+ ```
67
+
68
+ Rebuild your app after installing the package.
69
+
70
+ ## Usage
71
+
72
+ ### Configure the SDK
73
+
74
+ Configure the SDK with you app key once, typically in your app's entry point.
75
+
76
+ ```typescript
77
+ // App.tsx
78
+ import React, { useEffect } from 'react';
79
+ import { YouVersionPlatform } from '@youversion/platform-sdk-reactnative';
80
+
81
+ export default function App() {
82
+ useEffect(() => {
83
+ // Replace with your app key from YouVersion Platform
84
+ YouVersionPlatform.configure('YOUR_APP_KEY');
85
+ }, []);
86
+
87
+ return null; // ...your app UI...
88
+ }
89
+ ```
90
+
91
+ ## API Reference
92
+
93
+ ### UI Components
94
+
95
+ ### `<SignInWithYouVersionButton />`
96
+
97
+ A branded button view show the user to sign in with YouVersion. Provide an `onPress` handler to initiate the sign-in flow.
98
+
99
+ ```tsx
100
+ import { SignInWithYouVersionButton } from '@youversion/platform-sdk-reactnative';
101
+
102
+ <SignInWithYouVersionButton
103
+ isStroked
104
+ mode="full"
105
+ shape="capsule"
106
+ onPress={handleSignIn}
107
+ />;
108
+ ```
109
+
110
+ | Property | Type | Description |
111
+ | ------------- | --------------------------------------- | -------------------------------------------------------------------------------- |
112
+ | `isStroked` | `boolean` | If true, give the button an outline/border |
113
+ | `mode` | `"full"` or `"compact"` or `"iconOnly"` | Controls the length of the sign in text on the button |
114
+ | `shape` | `"rectangle"` or `"capsule"` | Controls the button's border radius |
115
+ | `onPress` | `() => void` | Handler called when the button is pressed |
116
+ | `colorScheme` | `"light"` or `"dark"` or `undefined` | Controls the button's color scheme. Defaults to system color scheme if undefined |
117
+
118
+ ### `<BibleTextView />`
119
+
120
+ A text view for displaying a Bible passage with customizable font settings. This component
121
+ supports displaying an entire chapter, a specific verse or a range of verses. It also accepts
122
+ an `onPress` handler when the user taps a verse.
123
+
124
+ ```tsx
125
+ import { BibleTextView } from '@youversion/platform-sdk-reactnative';
126
+
127
+ <BibleTextView
128
+ bibleReference={{
129
+ versionId: 1,
130
+ bookUSFM: 'JHN',
131
+ chapter: 3,
132
+ verse: 16,
133
+ }}
134
+ onPress={e => {
135
+ console.log('Verse pressed:', e.bibleReference);
136
+ }}
137
+ />;
138
+ ```
139
+
140
+ | Property | Type | Description |
141
+ | -------------------- | ------------------------------------ | --------------------------------------------------------------------------------------- |
142
+ | `bibleReference` | `BibleReference` | The Bible reference to display |
143
+ | `onPress` | `(e: BibleTextPressEvent) => void` | Handler called when a verse is pressed |
144
+ | `fontFamily` | `string?` | Controls the font family of the text. The font family must be available on the platform |
145
+ | `fontSize` | `number?` | Controls the font size of the text |
146
+ | `lineSpacing` | `number?` | Controls the line spacing of the text |
147
+ | `paragraphSpacing` | `number?` | Controls the spacing between paragraphs in the text |
148
+ | `textColor` | `ColorValue?` | Controls the text color of the text |
149
+ | `wocColor` | `ColorValue?` | Controls the color of the words of Christ (WOC) in the Bible text |
150
+ | `renderVerseNumbers` | `boolean?` | Controls whether verse numbers are shown |
151
+ | `footnoteMode` | `"none"` or `"inline"` or `"marker"` | Controls how footnotes are displayed in the Bible text |
152
+
153
+ A `BibleReference` can look 1 of 3 ways to represent a single verse, a range of verses, or an entire chapter:
154
+
155
+ ```typescript
156
+ // Single verse
157
+ type BibleReferenceVerse = {
158
+ versionId: number;
159
+ bookUSFM: string;
160
+ chapter: number;
161
+ verse: number;
162
+ type: 'verse';
163
+ };
164
+
165
+ // Range of verses
166
+ type BibleReferenceVerseRange = {
167
+ versionId: number;
168
+ bookUSFM: string;
169
+ chapter: number;
170
+ verseStart: number;
171
+ verseEnd: number;
172
+ type: 'range';
173
+ };
174
+
175
+ // Entire chapter
176
+ type BibleReferenceChapter = {
177
+ versionId: number;
178
+ bookUSFM: string;
179
+ chapter: number;
180
+ type: 'chapter';
181
+ };
182
+ ```
183
+
184
+ `BibleReference` properties:
185
+
186
+ | Property | Type | Description |
187
+ | ------------ | ------------------------------------- | ----------------------------------------------- |
188
+ | `versionId` | `number` | The ID of the Bible version to use |
189
+ | `bookUSFM` | `string` | The book identifier (e.g., "GEN", "JHN") |
190
+ | `chapter` | `number` | The chapter number |
191
+ | `verse` | `number?` | The verse number (for `type: "verse"`) |
192
+ | `verseStart` | `number?` | The starting verse number (for `type: "range"`) |
193
+ | `verseEnd` | `number?` | The ending verse number (for `type: "range"`) |
194
+ | `type` | `"verse"` or `"range"` or `"chapter"` | The type of reference being represented |
195
+
196
+ `BibleTextPressEvent` properties:
197
+ | Property | Type | Description |
198
+ | --------------- | --------------- | -------------------------------------------- |
199
+ | `bibleReference` | `BibleReference` | The Bible reference that was pressed |
200
+ | `point` | `{ x: number; y: number }` | The screen coordinates of the press event |
201
+
202
+ ### `<VotdView />`
203
+
204
+ A view for displaying the verse of the day (VOTD) with Bible reference and text. It can be configured to fetch the VOTD from YouVersion, or passed a custom verse of the day object.
205
+
206
+ ```tsx
207
+ import { VotdView } from '@youversion/platform-sdk-reactnative';
208
+
209
+ <VotdView colorScheme="dark" bibleVersionId={111} />;
210
+ ```
211
+
212
+ | Property | Type | Description |
213
+ | ---------------- | ------------------------------------ | ------------------------------------------------------------------------------- |
214
+ | `colorScheme` | `"light"` or `"dark"` or `undefined` | Controls the view's color scheme. Defaults to system color scheme if undefined. |
215
+ | `bibleVersionId` | `number` | The ID of the Bible version to use for the verse of the day. |
216
+
217
+ See `YouVersionVerseOfTheDay` properties under the `verseOfTheDay` API section above.
218
+
219
+ ### `<BibleReaderView />`
220
+
221
+ A full-featured Bible reader component that supports font customizations, version switching, offline downloads, verse highlights and more. It is designed to provide a similar experience to the YouVersion Bible reader found in the YouVersion app. It accepts an optional initial Bible reference to display.
222
+
223
+ ```tsx
224
+ import { BibleReaderView } from '@youversion/platform-sdk-reactnative';
225
+
226
+ <BibleReaderView
227
+ appName="YouVersion RN SDK"
228
+ signInMessage="Sign in to access your highlights"
229
+ />;
230
+ ```
231
+
232
+ | Property | Type | Description |
233
+ | --------------- | ----------------- | ---------------------------------------------------------------------------------------------------------- |
234
+ | `reference` | `BibleReference?` | Initial Bible reference to display when the view loads. This can be a single verse, verse range or chapter |
235
+ | `appName` | `string` | Name of your app to display in the Bible reader UI when prompting the user to sign in |
236
+ | `signInMessage` | `string` | Custom message to display to the user from the sign-in sheet, letting them know why they should sign in |
237
+
238
+ See `BibleReference` properties under the `BibleTextView` component section above.
239
+
240
+ ### `<BibleWidgetView />`
241
+
242
+ A more opinionated view for displaying a Bible passage. It also displays the book, chapter and version name above the passage. Below the passage text, it displays copyright information and the YouVersion logo.
243
+
244
+ ```tsx
245
+ import { BibleWidgetView } from '@youversion/platform-sdk-reactnative';
246
+
247
+ <BibleWidgetView
248
+ reference={{
249
+ bookUSFM: 'JHN',
250
+ chapter: 3,
251
+ type: 'chapter',
252
+ versionId: 206,
253
+ }}
254
+ colorScheme="light"
255
+ />;
256
+ ```
257
+
258
+ | Property | Type | Description |
259
+ | ------------- | ------------------------------------ | ------------------------------------------------------------------------------ |
260
+ | `reference` | `BibleReference` | The Bible reference to display |
261
+ | `colorScheme` | `"light"` or `"dark"` or `undefined` | Controls the view's color scheme. Defaults to system color scheme if undefined |
262
+ | `fontSize` | `number?` | Controls the font size of the passage text |
263
+
264
+ See `BibleReference` properties under the `BibleTextView` component section above.
265
+
266
+ ## SDK Methods
267
+
268
+ ### Authentication
269
+
270
+ #### `signIn`
271
+
272
+ Presents the YouVersion login flow to the user and resolves with the login result on completion.
273
+
274
+ **Parameters:**
275
+ An array of permissions you're requesting from the user when they sign in.
276
+
277
+ Enum values for `SignInWithYouVersionPermission`:
278
+
279
+ - `bibles`
280
+ - `highlights`
281
+ - `votd`
282
+ - `demographics`
283
+ - `bibleActivity`
284
+
285
+ **Returns:**
286
+ `Promise<SignInWithYouVersionResult>` - An object containing the following details:
287
+
288
+ | Property | Type | Description |
289
+ | ---------------- | ---------------------------------- | -------------------------------------------- |
290
+ | `accessToken` | `string` | Access token for the authenticated user. |
291
+ | `permissions` | `SignInWithYouVersionPermission[]` | Permissions granted by the user. |
292
+ | `yvpUserId` | `string` | YouVersion Platform user ID. |
293
+ | `expiryDate` | `string` | Expiration date of the access token. |
294
+ | `refreshToken` | `string` | Refresh token for renewing the access token. |
295
+ | `name` | `string` | Name of the authenticated user. |
296
+ | `profilePicture` | `string` | URL to the user's profile picture. |
297
+ | `email` | `string` | Email address of the authenticated user. |
298
+
299
+ #### `signOut`
300
+
301
+ Deletes the user's access token from memory.
302
+
303
+ ```tsx
304
+ import { YouVersionAPI } from '@youversion/platform-sdk-reactnative';
305
+
306
+ YouVersionAPI.Users.signOut();
307
+ ```
308
+
309
+ #### `userInfo`
310
+
311
+ Retrieves user information for the authenticated user
312
+
313
+ ```tsx
314
+ import { YouVersionAPI } from '@youversion/platform-sdk-reactnative';
315
+
316
+ const userInfo = await YouVersionAPI.Users.userInfo();
317
+ ```
318
+
319
+ **Parameters:**
320
+
321
+ - `accessToken?: string` - The access token of the authenticated user. If not provided, the SDK will use the last authenticated user's token.
322
+
323
+ **Returns:**
324
+ `Promise<YouVersionUserInfo>` - An object containing the user's profile information:
325
+
326
+ | Property | Type | Description |
327
+ | ----------- | -------- | ------------------------------- |
328
+ | `userId` | `string` | The user's account ID. |
329
+ | `firstName` | `string` | The user's first name. |
330
+ | `lastName` | `string` | The user's last name. |
331
+ | `avatarUrl` | `string` | URL to the user's avatar image. |
332
+
333
+ The SDK also provides utility functions to call the API manually. The documentation is broken up by feature area.
334
+
335
+ ### Verse of the Day
336
+
337
+ #### `verseOfTheDay`
338
+
339
+ Retrieves the verse of the day passage id for a specified day of the year
340
+
341
+ ```tsx
342
+ import { YouVersionAPI } from '@youversion/platform-sdk-reactnative';
343
+
344
+ const votd = await YouVersionAPI.Verses.verseOfTheDay(150);
345
+ ```
346
+
347
+ **Parameters:**
348
+
349
+ - `dayOfYear: number` - The day of the year for which to retrieve the verse of the day.
350
+
351
+ **Returns:**
352
+ `Promise<YouVersionVerseOfTheDay>` - A promise containing the verse of the day details. Use this with a `BibleTextView` to display the passage.
353
+
354
+ | Property | Type | Description |
355
+ | ----------- | -------- | ---------------------------------------------- |
356
+ | `passageId` | `string` | The reference of the verse (e.g., "JHN.3.16"). |
357
+ | `day` | `number` | The day of the year for the verse. |
358
+
359
+ ### Languages
360
+
361
+ #### `getLanguages`
362
+
363
+ Retrieves a list of available languages. It accepts an optional country code to filter the results.
364
+
365
+ ```tsx
366
+ import { YouVersionAPI } from '@youversion/platform-sdk-reactnative';
367
+
368
+ const languages = await YouVersionAPI.Languages.getLanguages('US');
369
+ ```
370
+
371
+ **Parameters:**
372
+
373
+ - `countryCode?: string` - An optional alpha-2 country code to filter languages by country.
374
+
375
+ **Returns:**
376
+ `Promise<LanguageOverview[]>` - An array of language objects.
377
+
378
+ | Property | Type | Description |
379
+ | ----------------------- | ------------------------ | -------------------------------------------------------------------------------------- |
380
+ | `id` | `string` | Unique ID of the language (e.g., "en") |
381
+ | `language` | `string` | ISO 639 canonical language subtag (e.g., "sr") |
382
+ | `script` | `string?` | ISO 15924 script subtag (e.g., "Latn") |
383
+ | `scriptName` | `string?` | Name of the script (e.g., "Latin") |
384
+ | `aliases` | `string[]` | Array of deprecated or legacy subtags mapped during canonicalization for this language |
385
+ | `displayName` | `Record<string, string>` | Object whose keys are language ids and values are script names |
386
+ | `scripts` | `string[]` | Array of all known scripts for this language |
387
+ | `variants` | `string[]` | Array of variants associated with this language |
388
+ | `countries` | `string[]` | Array of alpha-2 country codes where this language is used |
389
+ | `textDirection` | `string` | Text direction ("ltr" or "rtl") of the language |
390
+ | `defaultBibleVersionId` | `number?` | The default Bible version ID for this language |
391
+
392
+ ### Bible
393
+
394
+ #### `getVersions`
395
+
396
+ Retrieves a list of available Bible versions. It accepts an optional language tag to filter the results.
397
+
398
+ ```tsx
399
+ import { YouVersionAPI } from '@youversion/platform-sdk-reactnative';
400
+
401
+ const versions = await YouVersionAPI.Bible.getVersions('en');
402
+ ```
403
+
404
+ **Parameters:**
405
+
406
+ - `languageTag?: string` - An optional BCP 47 language tag to filter Bible versions by language.
407
+
408
+ **Returns:**
409
+ `Promise<BibleVersion[]>` - An array of Bible version objects.
410
+
411
+ | Property | Type | Description |
412
+ | ----------------------- | ---------- | ------------------------------------------------ |
413
+ | `id` | `number` | Unique ID of the Bible version |
414
+ | `abbreviation` | `string` | Abbreviation of the Bible version |
415
+ | `copyrightLong` | `string` | HTML string containing the copyright information |
416
+ | `copyrightShort` | `string` | Short copyright string |
417
+ | `languageTag` | `string` | BCP 47 language tag of the Bible version |
418
+ | `localizedAbbreviation` | `string` | Localized abbreviation of the Bible version |
419
+ | `localizedTitle` | `string` | Localized title of the Bible version |
420
+ | `title` | `string` | Title of the Bible version |
421
+ | `bookCodes` | `string[]` | Array of USFM book codes included in the version |
422
+ | `textDirection` | `string` | Text direction ("ltr" or "rtl") of the version |
423
+
424
+ #### `getVersion`
425
+
426
+ Retrieves details for a specific Bible version by its ID.
427
+
428
+ ```tsx
429
+ import { YouVersionAPI } from '@youversion/platform-sdk-reactnative';
430
+
431
+ const version = await YouVersionAPI.Bible.getVersion(111);
432
+ ```
433
+
434
+ **Parameters:**
435
+
436
+ - `versionId: number` - The unique ID of the Bible version to retrieve.
437
+
438
+ **Returns:**
439
+ `Promise<BibleVersion>` - A Bible version object. See `getVersions` for property details. This also includes an additional field called `books` containing an array of `BibleBook` objects.
440
+
441
+ `BibleBook` properties:
442
+
443
+ | Property | Type | Description |
444
+ | -------------- | ---------------- | ----------------------------------- |
445
+ | `usfm` | `string` | USFM book code (e.g., "GEN", "JHN") |
446
+ | `abbreviation` | `string` | Abbreviation of the book |
447
+ | `title` | `string` | Title of the book |
448
+ | `titleLong` | `string` | Full title of the book |
449
+ | `chapters` | `BibleChapter[]` | Array of chapters in the book |
450
+
451
+ `BibleChapter` properties:
452
+
453
+ | Property | Type | Description |
454
+ | ------------- | --------- | --------------------------------------- |
455
+ | `bookUSFM` | `string` | USFM book code |
456
+ | `isCanonical` | `boolean` | Whether the chapter is canonical |
457
+ | `passageId` | `string` | USFM passage identifier (e.g., "GEN.1") |
458
+ | `title` | `string` | Title of the chapter (e.g., "1") |
459
+
460
+ ### Highlights
461
+
462
+ #### `getHighlights`
463
+
464
+ Retrieves a list of highlights for the authenticated user.
465
+
466
+ ```tsx
467
+ import { YouVersionAPI } from '@youversion/platform-sdk-reactnative';
468
+
469
+ const highlights = await YouVersionAPI.Highlights.getHighlights({
470
+ bibleId: 111,
471
+ passageId: 'JHN.3.16',
472
+ });
473
+ ```
474
+
475
+ **Parameters:**
476
+
477
+ An object with the following optional properties:
478
+
479
+ - `bibleId?: number` - Bible version ID.
480
+ - `passageId?: string` - Passage identifier (e.g., "JHN.3.16").
481
+
482
+ **Returns:**
483
+
484
+ `Promise<HighlightResponse[]>` - An array of highlight objects.
485
+
486
+ | Property | Type | Description |
487
+ | ----------- | -------- | ----------------------------------------------- |
488
+ | `id` | `string` | Unique ID of the highlight |
489
+ | `bibleId` | `number` | Bible version ID |
490
+ | `passageId` | `string` | Passage identifier (e.g., "JHN.3.16") |
491
+ | `color` | `string` | Highlight color in hex format (e.g., "#FFFF00") |
492
+ | `userId` | `string` | User ID of the highlight owner |
493
+
494
+ #### `createHighlight`
495
+
496
+ Creates a new highlight for the authenticated user.
497
+
498
+ ```tsx
499
+ import { YouVersionAPI } from '@youversion/platform-sdk-reactnative';
500
+
501
+ const wasSuccess = await YouVersionAPI.Highlights.createHighlight({
502
+ bibleId: 111,
503
+ passageId: 'JHN.3.16',
504
+ color: '#FFFF00',
505
+ });
506
+ ```
507
+
508
+ **Parameters:**
509
+ An object with the following properties:
510
+
511
+ - `bibleId: number` - Bible version ID.
512
+ - `passageId: string` - Passage identifier (e.g., "JHN.3.16").
513
+ - `color: string` - Highlight color in hex format (e.g., "#FFFF00").
514
+
515
+ **Returns:**
516
+ `Promise<boolean>` - Boolean representing if the creation was successful.
517
+
518
+ #### `deleteHighlight`
519
+
520
+ Deletes a highlight for the authenticated user.
521
+
522
+ ```tsx
523
+ import { YouVersionAPI } from '@youversion/platform-sdk-reactnative';
524
+
525
+ const wasSuccess = await YouVersionAPI.Highlights.deleteHighlight({
526
+ bibleId: 111,
527
+ passageId: 'JHN.3.16',
528
+ });
529
+ ```
530
+
531
+ **Parameters:**
532
+ An object with the following properties:
533
+
534
+ - `bibleId: number` - Bible version ID.
535
+ - `passageId: string` - Passage identifier (e.g., "JHN.3.16").
536
+
537
+ **Returns:**
538
+ `Promise<boolean>` - Boolean representing if the deletion was successful.
539
+
540
+ #### `updateHighlight`
541
+
542
+ Updates a highlight's color for the authenticated user.
543
+
544
+ ```tsx
545
+ import { YouVersionAPI } from '@youversion/platform-sdk-reactnative';
546
+
547
+ const wasSuccess = await YouVersionAPI.Highlights.updateHighlight({
548
+ bibleId: 111,
549
+ passageId: 'JHN.3.16',
550
+ color: '#FF0000',
551
+ });
552
+ ```
553
+
554
+ **Parameters:**
555
+ An object with the following properties:
556
+
557
+ - `bibleId: number` - Bible version ID.
558
+ - `passageId: string` - Passage identifier (e.g., "JHN.3.16").
559
+ - `color: string` - New highlight color in hex format (e.g., "#FF0000").
560
+
561
+ **Returns:**
562
+ `Promise<boolean>` - Boolean representing if the update was successful.
package/RELEASING.md ADDED
@@ -0,0 +1,85 @@
1
+ # Release Process
2
+
3
+ > **Note**: This document is for YouVersion team members. External contributors should submit PRs with [conventional commits](https://www.conventionalcommits.org/) - releases happen automatically.
4
+
5
+ ## Automated Release (Default)
6
+
7
+ Releases happen automatically via CI when PRs are merged to `main`.
8
+
9
+ **What triggers a release:**
10
+ - `feat:` → MINOR bump (0.5.0 → 0.6.0)
11
+ - `fix:`, `perf:`, `refactor:` → PATCH bump (0.5.0 → 0.5.1)
12
+ - `BREAKING CHANGE:` or `feat!:` → MAJOR bump (0.5.0 → 1.0.0)
13
+
14
+ **What does NOT trigger a release:**
15
+ - `docs:`, `style:`, `test:`, `build:`, `ci:`, `chore:`
16
+
17
+ ## Manual Release (Branch Protection)
18
+
19
+ Use when you need manual control over release timing. Since `main` branch requires PRs, use this workflow:
20
+
21
+ ### Quick Method
22
+
23
+ ```bash
24
+ # Set up environment
25
+ export GITHUB_TOKEN=your_token
26
+ export NPM_TOKEN=your_token
27
+
28
+ # Run helper script
29
+ ./scripts/release-local.sh
30
+ ```
31
+
32
+ The script will preview, publish, and create a PR for you to merge.
33
+
34
+ ### Manual Steps
35
+
36
+ ```bash
37
+ # 1. Create release branch
38
+ git checkout main && git pull
39
+ git checkout -b release/prepare
40
+
41
+ # 2. Preview (from main)
42
+ git checkout main && npm run release:dry-run
43
+ git checkout release/prepare
44
+
45
+ # 3. Create config
46
+ cat > .releaserc.local.json << 'EOF'
47
+ {"extends": "./.releaserc.json", "branches": ["main", {"name": "release/*", "channel": false}]}
48
+ EOF
49
+
50
+ # 4. Release and publish to npm
51
+ npx semantic-release --extends ./.releaserc.local.json
52
+
53
+ # 5. Push and create PR
54
+ git push origin release/prepare --tags
55
+ gh pr create --base main --title "chore(release): x.y.z"
56
+
57
+ # 6. Get approval and merge PR
58
+
59
+ # 7. Cleanup
60
+ git checkout main && git pull
61
+ git branch -D release/prepare
62
+ rm .releaserc.local.json
63
+ ```
64
+
65
+ **Note**: Package publishes to npm in step 4, before PR merge. This is intentional.
66
+
67
+ ## Troubleshooting
68
+
69
+ ### "No release published"
70
+ No commits since last release warrant a version bump. Check:
71
+ ```bash
72
+ git log $(git describe --tags --abbrev=0)..HEAD --oneline
73
+ ```
74
+
75
+ ### "GITHUB_TOKEN not set"
76
+ ```bash
77
+ export GITHUB_TOKEN=your_token
78
+ ```
79
+
80
+ ### "npm requires 2FA"
81
+ Have your authenticator app ready during the publish step.
82
+
83
+ ---
84
+
85
+ **Last Updated**: 2025-11-19
@@ -0,0 +1,43 @@
1
+ apply plugin: 'com.android.library'
2
+
3
+ group = 'com.youversion.reactnativesdk'
4
+ version = '0.7.2'
5
+
6
+ def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
7
+ apply from: expoModulesCorePlugin
8
+ applyKotlinExpoModulesCorePlugin()
9
+ useCoreDependencies()
10
+ useExpoPublishing()
11
+
12
+ // If you want to use the managed Android SDK versions from expo-modules-core, set this to true.
13
+ // The Android SDK versions will be bumped from time to time in SDK releases and may introduce breaking changes in your module code.
14
+ // Most of the time, you may like to manage the Android SDK versions yourself.
15
+ def useManagedAndroidSdkVersions = false
16
+ if (useManagedAndroidSdkVersions) {
17
+ useDefaultAndroidSdkVersions()
18
+ } else {
19
+ buildscript {
20
+ // Simple helper that allows the root project to override versions declared by this library.
21
+ ext.safeExtGet = { prop, fallback ->
22
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
23
+ }
24
+ }
25
+ project.android {
26
+ compileSdkVersion safeExtGet("compileSdkVersion", 36)
27
+ defaultConfig {
28
+ minSdkVersion safeExtGet("minSdkVersion", 24)
29
+ targetSdkVersion safeExtGet("targetSdkVersion", 36)
30
+ }
31
+ }
32
+ }
33
+
34
+ android {
35
+ namespace "com.youversion.reactnativesdk"
36
+ defaultConfig {
37
+ versionCode 1
38
+ versionName "0.7.2"
39
+ }
40
+ lintOptions {
41
+ abortOnError false
42
+ }
43
+ }
@@ -0,0 +1,2 @@
1
+ <manifest>
2
+ </manifest>