@youversion/platform-core 0.8.1 → 0.9.0

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,5 +1,5 @@
1
1
 
2
- > @youversion/platform-core@0.8.1 build /home/runner/work/platform-sdk-react/platform-sdk-react/packages/core
2
+ > @youversion/platform-core@0.9.0 build /home/runner/work/platform-sdk-react/platform-sdk-react/packages/core
3
3
  > tsup src/index.ts --format cjs,esm --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,11 +8,11 @@
8
8
  CLI Target: es2022
9
9
  CJS Build start
10
10
  ESM Build start
11
- ESM dist/index.js 41.62 KB
12
- ESM ⚡️ Build success in 37ms
13
- CJS dist/index.cjs 43.46 KB
14
- CJS ⚡️ Build success in 38ms
11
+ ESM dist/index.js 40.66 KB
12
+ ESM ⚡️ Build success in 31ms
13
+ CJS dist/index.cjs 42.47 KB
14
+ CJS ⚡️ Build success in 32ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 1904ms
17
- DTS dist/index.d.cts 33.54 KB
18
- DTS dist/index.d.ts 33.54 KB
16
+ DTS ⚡️ Build success in 1699ms
17
+ DTS dist/index.d.cts 31.83 KB
18
+ DTS dist/index.d.ts 31.83 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @youversion/platform-core
2
2
 
3
+ ## 0.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e4f93b6: Update authentication system with enhanced OAuth scopes and API schema alignment
8
+
9
+ Key Changes:
10
+ - Added profile and email scopes to OAuth authentication
11
+ - Updated book resource schema to match new API endpoints
12
+ - Removed deprecated URLBuilder functionality
13
+
14
+ Breaking Changes:
15
+ - Book Schema: Must use the new updated book schema in any APIs returning bible book data Please enter a summary for your changes.
16
+
17
+ ## 0.8.2
18
+
19
+ ### Patch Changes
20
+
21
+ - 93be9ef: Update types, zod schemas, and test mocks for the following updated endpoints:
22
+ - get bible books
23
+ - get bible chapters
24
+ - get bible verses
25
+
3
26
  ## 0.8.1
4
27
 
5
28
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -30,7 +30,6 @@ __export(index_exports, {
30
30
  SessionStorageStrategy: () => SessionStorageStrategy,
31
31
  SignInWithYouVersionPermission: () => SignInWithYouVersionPermission,
32
32
  SignInWithYouVersionResult: () => SignInWithYouVersionResult,
33
- URLBuilder: () => URLBuilder,
34
33
  YouVersionAPI: () => YouVersionAPI,
35
34
  YouVersionAPIUsers: () => YouVersionAPIUsers,
36
35
  YouVersionPlatformConfiguration: () => YouVersionPlatformConfiguration,
@@ -232,7 +231,7 @@ var BibleClient = class {
232
231
  /**
233
232
  * Fetches all books for a given Bible version.
234
233
  * @param versionId The version ID.
235
- * @param canon Optional canon filter ('ot', 'nt', 'deuterocanon').
234
+ * @param canon Optional canon filter ("old_testament", 'new_testament', 'deuterocanon').
236
235
  * @returns An array of BibleBook objects.
237
236
  */
238
237
  async getBooks(versionId, canon) {
@@ -732,7 +731,7 @@ var YouVersionUserInfo = class {
732
731
 
733
732
  // src/SignInWithYouVersionPKCE.ts
734
733
  var SignInWithYouVersionPKCEAuthorizationRequestBuilder = class {
735
- static async make(appKey, permissions, redirectURL) {
734
+ static async make(appKey, redirectURL, scopes) {
736
735
  const codeVerifier = this.randomURLSafeString(32);
737
736
  const codeChallenge = await this.codeChallenge(codeVerifier);
738
737
  const state = this.randomURLSafeString(24);
@@ -743,10 +742,10 @@ var SignInWithYouVersionPKCEAuthorizationRequestBuilder = class {
743
742
  state,
744
743
  nonce
745
744
  };
746
- const url = this.authorizeURL(appKey, permissions, redirectURL, parameters);
745
+ const url = this.authorizeURL(appKey, redirectURL, parameters, scopes);
747
746
  return { url, parameters };
748
747
  }
749
- static authorizeURL(appKey, permissions, redirectURL, parameters) {
748
+ static authorizeURL(appKey, redirectURL, parameters, scopes) {
750
749
  const components = new URL(`https://${YouVersionPlatformConfiguration.apiHost}/auth/authorize`);
751
750
  const redirectUrlString = redirectURL.toString().endsWith("/") ? redirectURL.toString().slice(0, -1) : redirectURL.toString();
752
751
  const queryParams = new URLSearchParams({
@@ -762,7 +761,7 @@ var SignInWithYouVersionPKCEAuthorizationRequestBuilder = class {
762
761
  if (installId) {
763
762
  queryParams.set("x-yvp-installation-id", installId);
764
763
  }
765
- const scopeValue = this.scopeValue(permissions);
764
+ const scopeValue = this.scopeValue(scopes || []);
766
765
  if (scopeValue) {
767
766
  queryParams.set("scope", scopeValue);
768
767
  }
@@ -802,8 +801,8 @@ var SignInWithYouVersionPKCEAuthorizationRequestBuilder = class {
802
801
  const base64 = btoa(String.fromCharCode.apply(null, Array.from(data)));
803
802
  return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
804
803
  }
805
- static scopeValue(permissions) {
806
- const scopeArray = Array.from(permissions).sort();
804
+ static scopeValue(scopes) {
805
+ const scopeArray = Array.from(scopes).sort();
807
806
  let scopeWithOpenID = scopeArray.join(" ");
808
807
  if (!scopeWithOpenID.split(" ").includes("openid")) {
809
808
  scopeWithOpenID += (scopeWithOpenID === "" ? "" : " ") + "openid";
@@ -825,7 +824,6 @@ var SignInWithYouVersionResult = class {
825
824
  expiryDate;
826
825
  refreshToken;
827
826
  idToken;
828
- permissions;
829
827
  yvpUserId;
830
828
  name;
831
829
  profilePicture;
@@ -835,7 +833,6 @@ var SignInWithYouVersionResult = class {
835
833
  expiresIn,
836
834
  refreshToken,
837
835
  idToken,
838
- permissions,
839
836
  yvpUserId,
840
837
  name,
841
838
  profilePicture,
@@ -845,7 +842,6 @@ var SignInWithYouVersionResult = class {
845
842
  this.expiryDate = expiresIn ? new Date(Date.now() + expiresIn * 1e3) : /* @__PURE__ */ new Date();
846
843
  this.refreshToken = refreshToken;
847
844
  this.idToken = idToken;
848
- this.permissions = permissions;
849
845
  this.yvpUserId = yvpUserId;
850
846
  this.name = name;
851
847
  this.profilePicture = profilePicture;
@@ -858,22 +854,22 @@ var YouVersionAPIUsers = class {
858
854
  /**
859
855
  * Presents the YouVersion login flow to the user and returns the login result upon completion.
860
856
  *
861
- * This function authenticates the user with YouVersion, requesting the specified required and optional permissions.
857
+ * This function authenticates the user with YouVersion.
862
858
  * The function redirects to the YouVersion authorization URL and expects the callback to be handled separately.
863
859
  *
864
- * @param permissions - The set of permissions that must be granted by the user for successful login.
860
+ * @param scopes - The scopes given to the authentication call.
865
861
  * @param redirectURL - The URL to redirect back to after authentication.
866
862
  * @throws An error if authentication fails or configuration is invalid.
867
863
  */
868
- static async signIn(permissions, redirectURL) {
864
+ static async signIn(redirectURL, scopes) {
869
865
  const appKey = YouVersionPlatformConfiguration.appKey;
870
866
  if (!appKey) {
871
867
  throw new Error("YouVersionPlatformConfiguration.appKey must be set before calling signIn");
872
868
  }
873
869
  const authorizationRequest = await SignInWithYouVersionPKCEAuthorizationRequestBuilder.make(
874
870
  appKey,
875
- permissions,
876
- new URL(redirectURL)
871
+ new URL(redirectURL),
872
+ scopes
877
873
  );
878
874
  localStorage.setItem(
879
875
  "youversion-auth-code-verifier",
@@ -973,17 +969,11 @@ var YouVersionAPIUsers = class {
973
969
  */
974
970
  static extractSignInResult(tokens) {
975
971
  const idClaims = this.decodeJWT(tokens.id_token);
976
- const permissions = tokens.scope.split(" ").map((p) => p.trim()).filter((p) => p.length > 0).filter(
977
- (p) => Object.values(SignInWithYouVersionPermission).includes(
978
- p
979
- )
980
- );
981
972
  const resultData = {
982
973
  accessToken: tokens.access_token,
983
974
  expiresIn: tokens.expires_in,
984
975
  refreshToken: tokens.refresh_token,
985
976
  idToken: tokens.id_token,
986
- permissions,
987
977
  yvpUserId: idClaims.sub,
988
978
  name: idClaims.name,
989
979
  profilePicture: idClaims.profile_picture,
@@ -1102,12 +1092,7 @@ var YouVersionAPIUsers = class {
1102
1092
  accessToken: tokens.access_token,
1103
1093
  expiresIn: tokens.expires_in,
1104
1094
  refreshToken: tokens.refresh_token,
1105
- idToken: existingIdToken,
1106
- permissions: tokens.scope.split(" ").map((p) => p.trim()).filter((p) => p.length > 0).filter(
1107
- (p) => Object.values(SignInWithYouVersionPermission).includes(
1108
- p
1109
- )
1110
- )
1095
+ idToken: existingIdToken
1111
1096
  });
1112
1097
  YouVersionPlatformConfiguration.saveAuthData(
1113
1098
  result.accessToken || null,
@@ -1177,43 +1162,6 @@ var YouVersionAPI = class {
1177
1162
  }
1178
1163
  };
1179
1164
 
1180
- // src/URLBuilder.ts
1181
- var URLBuilder = class {
1182
- static get baseURL() {
1183
- return new URL(`https://${YouVersionPlatformConfiguration.apiHost}`);
1184
- }
1185
- static authURL(appKey, requiredPermissions = /* @__PURE__ */ new Set(), optionalPermissions = /* @__PURE__ */ new Set()) {
1186
- if (typeof appKey !== "string" || appKey.trim().length === 0) {
1187
- throw new Error("appKey must be a non-empty string");
1188
- }
1189
- try {
1190
- const url = new URL(this.baseURL);
1191
- url.pathname = "/auth/login";
1192
- const searchParams = new URLSearchParams();
1193
- searchParams.append("APP_KEY", appKey);
1194
- searchParams.append("language", "en");
1195
- if (requiredPermissions.size > 0) {
1196
- const requiredList = Array.from(requiredPermissions).map((p) => p.toString());
1197
- searchParams.append("required_perms", requiredList.join(","));
1198
- }
1199
- if (optionalPermissions.size > 0) {
1200
- const optionalList = Array.from(optionalPermissions).map((p) => p.toString());
1201
- searchParams.append("opt_perms", optionalList.join(","));
1202
- }
1203
- const installationId = YouVersionPlatformConfiguration.installationId;
1204
- if (installationId) {
1205
- searchParams.append("x-yvp-installation-id", installationId);
1206
- }
1207
- url.search = searchParams.toString();
1208
- return url;
1209
- } catch (error) {
1210
- throw new Error(
1211
- `Failed to construct auth URL: ${error instanceof Error ? error.message : "Unknown error"}`
1212
- );
1213
- }
1214
- }
1215
- };
1216
-
1217
1165
  // src/utils/constants.ts
1218
1166
  var BOOK_IDS = [
1219
1167
  "GEN",
@@ -1323,109 +1271,109 @@ var BOOK_IDS = [
1323
1271
  "LKA"
1324
1272
  ];
1325
1273
  var BOOK_CANON = {
1326
- GEN: "ot",
1327
- EXO: "ot",
1328
- LEV: "ot",
1329
- NUM: "ot",
1330
- DEU: "ot",
1331
- JOS: "ot",
1332
- JDG: "ot",
1333
- RUT: "ot",
1334
- "1SA": "ot",
1335
- "2SA": "ot",
1336
- "1KI": "ot",
1337
- "2KI": "ot",
1338
- "1CH": "ot",
1339
- "2CH": "ot",
1340
- EZR: "ot",
1341
- NEH: "ot",
1342
- EST: "ot",
1343
- JOB: "ot",
1344
- PSA: "ot",
1345
- PRO: "ot",
1346
- ECC: "ot",
1347
- SNG: "ot",
1348
- ISA: "ot",
1349
- JER: "ot",
1350
- LAM: "ot",
1351
- EZK: "ot",
1352
- DAN: "ot",
1353
- HOS: "ot",
1354
- JOL: "ot",
1355
- AMO: "ot",
1356
- OBA: "ot",
1357
- JON: "ot",
1358
- MIC: "ot",
1359
- NAM: "ot",
1360
- HAB: "ot",
1361
- ZEP: "ot",
1362
- HAG: "ot",
1363
- ZEC: "ot",
1364
- MAL: "ot",
1365
- MAT: "nt",
1366
- MRK: "nt",
1367
- LUK: "nt",
1368
- JHN: "nt",
1369
- ACT: "nt",
1370
- ROM: "nt",
1371
- "1CO": "nt",
1372
- "2CO": "nt",
1373
- GAL: "nt",
1374
- EPH: "nt",
1375
- PHP: "nt",
1376
- COL: "nt",
1377
- "1TH": "nt",
1378
- "2TH": "nt",
1379
- "1TI": "nt",
1380
- "2TI": "nt",
1381
- TIT: "nt",
1382
- PHM: "nt",
1383
- HEB: "nt",
1384
- JAS: "nt",
1385
- "1PE": "nt",
1386
- "2PE": "nt",
1387
- "1JN": "nt",
1388
- "2JN": "nt",
1389
- "3JN": "nt",
1390
- JUD: "nt",
1391
- REV: "nt",
1392
- TOB: "dc",
1393
- JDT: "dc",
1394
- ESG: "dc",
1395
- WIS: "dc",
1396
- SIR: "dc",
1397
- BAR: "dc",
1398
- LJE: "dc",
1399
- S3Y: "dc",
1400
- SUS: "dc",
1401
- BEL: "dc",
1402
- "1MA": "dc",
1403
- "2MA": "dc",
1404
- "3MA": "dc",
1405
- "4MA": "dc",
1406
- "1ES": "dc",
1407
- "2ES": "dc",
1408
- MAN: "dc",
1409
- PS2: "dc",
1410
- ODA: "dc",
1411
- PSS: "dc",
1412
- "3ES": "dc",
1413
- EZA: "dc",
1414
- "5EZ": "dc",
1415
- "6EZ": "dc",
1416
- DAG: "dc",
1417
- PS3: "dc",
1418
- "2BA": "dc",
1419
- LBA: "dc",
1420
- JUB: "dc",
1421
- ENO: "dc",
1422
- "1MQ": "dc",
1423
- "2MQ": "dc",
1424
- "3MQ": "dc",
1425
- REP: "dc",
1426
- "4BA": "dc",
1427
- LAO: "dc",
1428
- LKA: "nt"
1274
+ GEN: "old_testament",
1275
+ EXO: "old_testament",
1276
+ LEV: "old_testament",
1277
+ NUM: "old_testament",
1278
+ DEU: "old_testament",
1279
+ JOS: "old_testament",
1280
+ JDG: "old_testament",
1281
+ RUT: "old_testament",
1282
+ "1SA": "old_testament",
1283
+ "2SA": "old_testament",
1284
+ "1KI": "old_testament",
1285
+ "2KI": "old_testament",
1286
+ "1CH": "old_testament",
1287
+ "2CH": "old_testament",
1288
+ EZR: "old_testament",
1289
+ NEH: "old_testament",
1290
+ EST: "old_testament",
1291
+ JOB: "old_testament",
1292
+ PSA: "old_testament",
1293
+ PRO: "old_testament",
1294
+ ECC: "old_testament",
1295
+ SNG: "old_testament",
1296
+ ISA: "old_testament",
1297
+ JER: "old_testament",
1298
+ LAM: "old_testament",
1299
+ EZK: "old_testament",
1300
+ DAN: "old_testament",
1301
+ HOS: "old_testament",
1302
+ JOL: "old_testament",
1303
+ AMO: "old_testament",
1304
+ OBA: "old_testament",
1305
+ JON: "old_testament",
1306
+ MIC: "old_testament",
1307
+ NAM: "old_testament",
1308
+ HAB: "old_testament",
1309
+ ZEP: "old_testament",
1310
+ HAG: "old_testament",
1311
+ ZEC: "old_testament",
1312
+ MAL: "old_testament",
1313
+ MAT: "new_testament",
1314
+ MRK: "new_testament",
1315
+ LUK: "new_testament",
1316
+ JHN: "new_testament",
1317
+ ACT: "new_testament",
1318
+ ROM: "new_testament",
1319
+ "1CO": "new_testament",
1320
+ "2CO": "new_testament",
1321
+ GAL: "new_testament",
1322
+ EPH: "new_testament",
1323
+ PHP: "new_testament",
1324
+ COL: "new_testament",
1325
+ "1TH": "new_testament",
1326
+ "2TH": "new_testament",
1327
+ "1TI": "new_testament",
1328
+ "2TI": "new_testament",
1329
+ TIT: "new_testament",
1330
+ PHM: "new_testament",
1331
+ HEB: "new_testament",
1332
+ JAS: "new_testament",
1333
+ "1PE": "new_testament",
1334
+ "2PE": "new_testament",
1335
+ "1JN": "new_testament",
1336
+ "2JN": "new_testament",
1337
+ "3JN": "new_testament",
1338
+ JUD: "new_testament",
1339
+ REV: "new_testament",
1340
+ TOB: "deuterocanon",
1341
+ JDT: "deuterocanon",
1342
+ ESG: "deuterocanon",
1343
+ WIS: "deuterocanon",
1344
+ SIR: "deuterocanon",
1345
+ BAR: "deuterocanon",
1346
+ LJE: "deuterocanon",
1347
+ S3Y: "deuterocanon",
1348
+ SUS: "deuterocanon",
1349
+ BEL: "deuterocanon",
1350
+ "1MA": "deuterocanon",
1351
+ "2MA": "deuterocanon",
1352
+ "3MA": "deuterocanon",
1353
+ "4MA": "deuterocanon",
1354
+ "1ES": "deuterocanon",
1355
+ "2ES": "deuterocanon",
1356
+ MAN: "deuterocanon",
1357
+ PS2: "deuterocanon",
1358
+ ODA: "deuterocanon",
1359
+ PSS: "deuterocanon",
1360
+ "3ES": "deuterocanon",
1361
+ EZA: "deuterocanon",
1362
+ "5EZ": "deuterocanon",
1363
+ "6EZ": "deuterocanon",
1364
+ DAG: "deuterocanon",
1365
+ PS3: "deuterocanon",
1366
+ "2BA": "deuterocanon",
1367
+ LBA: "deuterocanon",
1368
+ JUB: "deuterocanon",
1369
+ ENO: "deuterocanon",
1370
+ "1MQ": "deuterocanon",
1371
+ "2MQ": "deuterocanon",
1372
+ "3MQ": "deuterocanon",
1373
+ REP: "deuterocanon",
1374
+ "4BA": "deuterocanon",
1375
+ LAO: "deuterocanon",
1376
+ LKA: "new_testament"
1429
1377
  // Luke-Acts combo, treated canonically as New Testament
1430
1378
  };
1431
1379
  // Annotate the CommonJS export names for ESM import in node:
@@ -1440,7 +1388,6 @@ var BOOK_CANON = {
1440
1388
  SessionStorageStrategy,
1441
1389
  SignInWithYouVersionPermission,
1442
1390
  SignInWithYouVersionResult,
1443
- URLBuilder,
1444
1391
  YouVersionAPI,
1445
1392
  YouVersionAPIUsers,
1446
1393
  YouVersionPlatformConfiguration,
package/dist/index.d.cts CHANGED
@@ -8,8 +8,8 @@ declare const BibleVersionSchema: z.ZodObject<{
8
8
  info: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9
9
  publisher_url: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
10
10
  language_tag: z.ZodString;
11
- local_abbreviation: z.ZodString;
12
- local_title: z.ZodString;
11
+ localized_abbreviation: z.ZodString;
12
+ localized_title: z.ZodString;
13
13
  organization_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
14
  title: z.ZodString;
15
15
  books: z.ZodArray<z.ZodUnion<readonly [...z.ZodLiteral<"GEN" | "EXO" | "LEV" | "NUM" | "DEU" | "JOS" | "JDG" | "RUT" | "1SA" | "2SA" | "1KI" | "2KI" | "1CH" | "2CH" | "EZR" | "NEH" | "EST" | "JOB" | "PSA" | "PRO" | "ECC" | "SNG" | "ISA" | "JER" | "LAM" | "EZK" | "DAN" | "HOS" | "JOL" | "AMO" | "OBA" | "JON" | "MIC" | "NAM" | "HAB" | "ZEP" | "HAG" | "ZEC" | "MAL" | "MAT" | "MRK" | "LUK" | "JHN" | "ACT" | "ROM" | "1CO" | "2CO" | "GAL" | "EPH" | "PHP" | "COL" | "1TH" | "2TH" | "1TI" | "2TI" | "TIT" | "PHM" | "HEB" | "JAS" | "1PE" | "2PE" | "1JN" | "2JN" | "3JN" | "JUD" | "REV" | "TOB" | "JDT" | "ESG" | "WIS" | "SIR" | "BAR" | "LJE" | "S3Y" | "SUS" | "BEL" | "1MA" | "2MA" | "3MA" | "4MA" | "1ES" | "2ES" | "MAN" | "PS2" | "ODA" | "PSS" | "3ES" | "EZA" | "5EZ" | "6EZ" | "DAG" | "PS3" | "2BA" | "LBA" | "JUB" | "ENO" | "1MQ" | "2MQ" | "3MQ" | "REP" | "4BA" | "LAO" | "LKA">[], z.ZodType<string & {}, unknown, z.core.$ZodTypeInternals<string & {}, unknown>>]>>;
@@ -18,9 +18,9 @@ declare const BibleVersionSchema: z.ZodObject<{
18
18
  type BibleVersion = z.infer<typeof BibleVersionSchema>;
19
19
 
20
20
  declare const CanonSchema: z.ZodEnum<{
21
- ot: "ot";
22
- nt: "nt";
23
- dc: "dc";
21
+ old_testament: "old_testament";
22
+ new_testament: "new_testament";
23
+ deuterocanon: "deuterocanon";
24
24
  }>;
25
25
  type Canon = z.infer<typeof CanonSchema>;
26
26
  declare const BookUsfmSchema: z.ZodUnion<readonly [...z.ZodLiteral<"GEN" | "EXO" | "LEV" | "NUM" | "DEU" | "JOS" | "JDG" | "RUT" | "1SA" | "2SA" | "1KI" | "2KI" | "1CH" | "2CH" | "EZR" | "NEH" | "EST" | "JOB" | "PSA" | "PRO" | "ECC" | "SNG" | "ISA" | "JER" | "LAM" | "EZK" | "DAN" | "HOS" | "JOL" | "AMO" | "OBA" | "JON" | "MIC" | "NAM" | "HAB" | "ZEP" | "HAG" | "ZEC" | "MAL" | "MAT" | "MRK" | "LUK" | "JHN" | "ACT" | "ROM" | "1CO" | "2CO" | "GAL" | "EPH" | "PHP" | "COL" | "1TH" | "2TH" | "1TI" | "2TI" | "TIT" | "PHM" | "HEB" | "JAS" | "1PE" | "2PE" | "1JN" | "2JN" | "3JN" | "JUD" | "REV" | "TOB" | "JDT" | "ESG" | "WIS" | "SIR" | "BAR" | "LJE" | "S3Y" | "SUS" | "BEL" | "1MA" | "2MA" | "3MA" | "4MA" | "1ES" | "2ES" | "MAN" | "PS2" | "ODA" | "PSS" | "3ES" | "EZA" | "5EZ" | "6EZ" | "DAG" | "PS3" | "2BA" | "LBA" | "JUB" | "ENO" | "1MQ" | "2MQ" | "3MQ" | "REP" | "4BA" | "LAO" | "LKA">[], z.ZodType<string & {}, unknown, z.core.$ZodTypeInternals<string & {}, unknown>>]>;
@@ -28,40 +28,50 @@ type BookUsfm = z.infer<typeof BookUsfmSchema>;
28
28
  declare const BibleBookSchema: z.ZodObject<{
29
29
  id: z.ZodUnion<readonly [...z.ZodLiteral<"GEN" | "EXO" | "LEV" | "NUM" | "DEU" | "JOS" | "JDG" | "RUT" | "1SA" | "2SA" | "1KI" | "2KI" | "1CH" | "2CH" | "EZR" | "NEH" | "EST" | "JOB" | "PSA" | "PRO" | "ECC" | "SNG" | "ISA" | "JER" | "LAM" | "EZK" | "DAN" | "HOS" | "JOL" | "AMO" | "OBA" | "JON" | "MIC" | "NAM" | "HAB" | "ZEP" | "HAG" | "ZEC" | "MAL" | "MAT" | "MRK" | "LUK" | "JHN" | "ACT" | "ROM" | "1CO" | "2CO" | "GAL" | "EPH" | "PHP" | "COL" | "1TH" | "2TH" | "1TI" | "2TI" | "TIT" | "PHM" | "HEB" | "JAS" | "1PE" | "2PE" | "1JN" | "2JN" | "3JN" | "JUD" | "REV" | "TOB" | "JDT" | "ESG" | "WIS" | "SIR" | "BAR" | "LJE" | "S3Y" | "SUS" | "BEL" | "1MA" | "2MA" | "3MA" | "4MA" | "1ES" | "2ES" | "MAN" | "PS2" | "ODA" | "PSS" | "3ES" | "EZA" | "5EZ" | "6EZ" | "DAG" | "PS3" | "2BA" | "LBA" | "JUB" | "ENO" | "1MQ" | "2MQ" | "3MQ" | "REP" | "4BA" | "LAO" | "LKA">[], z.ZodType<string & {}, unknown, z.core.$ZodTypeInternals<string & {}, unknown>>]>;
30
30
  title: z.ZodString;
31
+ full_title: z.ZodString;
31
32
  abbreviation: z.ZodOptional<z.ZodString>;
32
33
  canon: z.ZodEnum<{
33
- ot: "ot";
34
- nt: "nt";
35
- dc: "dc";
34
+ old_testament: "old_testament";
35
+ new_testament: "new_testament";
36
+ deuterocanon: "deuterocanon";
36
37
  }>;
37
- chapters: z.ZodOptional<z.ZodArray<z.ZodString>>;
38
+ chapters: z.ZodOptional<z.ZodArray<z.ZodObject<{
39
+ id: z.ZodString;
40
+ passage_id: z.ZodString;
41
+ title: z.ZodString;
42
+ verses: z.ZodOptional<z.ZodArray<z.ZodObject<{
43
+ id: z.ZodString;
44
+ passage_id: z.ZodString;
45
+ title: z.ZodString;
46
+ }, z.core.$strip>>>;
47
+ }, z.core.$strip>>>;
38
48
  }, z.core.$strip>;
39
49
  type BibleBook = z.infer<typeof BibleBookSchema>;
40
50
  type CANON = z.infer<typeof CanonSchema>;
41
51
 
42
52
  declare const BibleChapterSchema: z.ZodObject<{
43
53
  id: z.ZodString;
44
- book_id: z.ZodUnion<readonly [...z.ZodLiteral<"GEN" | "EXO" | "LEV" | "NUM" | "DEU" | "JOS" | "JDG" | "RUT" | "1SA" | "2SA" | "1KI" | "2KI" | "1CH" | "2CH" | "EZR" | "NEH" | "EST" | "JOB" | "PSA" | "PRO" | "ECC" | "SNG" | "ISA" | "JER" | "LAM" | "EZK" | "DAN" | "HOS" | "JOL" | "AMO" | "OBA" | "JON" | "MIC" | "NAM" | "HAB" | "ZEP" | "HAG" | "ZEC" | "MAL" | "MAT" | "MRK" | "LUK" | "JHN" | "ACT" | "ROM" | "1CO" | "2CO" | "GAL" | "EPH" | "PHP" | "COL" | "1TH" | "2TH" | "1TI" | "2TI" | "TIT" | "PHM" | "HEB" | "JAS" | "1PE" | "2PE" | "1JN" | "2JN" | "3JN" | "JUD" | "REV" | "TOB" | "JDT" | "ESG" | "WIS" | "SIR" | "BAR" | "LJE" | "S3Y" | "SUS" | "BEL" | "1MA" | "2MA" | "3MA" | "4MA" | "1ES" | "2ES" | "MAN" | "PS2" | "ODA" | "PSS" | "3ES" | "EZA" | "5EZ" | "6EZ" | "DAG" | "PS3" | "2BA" | "LBA" | "JUB" | "ENO" | "1MQ" | "2MQ" | "3MQ" | "REP" | "4BA" | "LAO" | "LKA">[], z.ZodType<string & {}, unknown, z.core.$ZodTypeInternals<string & {}, unknown>>]>;
45
54
  passage_id: z.ZodString;
46
55
  title: z.ZodString;
47
- verses: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`${number}`, string>>>>;
56
+ verses: z.ZodOptional<z.ZodArray<z.ZodObject<{
57
+ id: z.ZodString;
58
+ passage_id: z.ZodString;
59
+ title: z.ZodString;
60
+ }, z.core.$strip>>>;
48
61
  }, z.core.$strip>;
49
62
  type BibleChapter = z.infer<typeof BibleChapterSchema>;
50
63
 
51
64
  declare const BibleVerseSchema: z.ZodObject<{
52
65
  id: z.ZodString;
53
- book_id: z.ZodUnion<readonly [...z.ZodLiteral<"GEN" | "EXO" | "LEV" | "NUM" | "DEU" | "JOS" | "JDG" | "RUT" | "1SA" | "2SA" | "1KI" | "2KI" | "1CH" | "2CH" | "EZR" | "NEH" | "EST" | "JOB" | "PSA" | "PRO" | "ECC" | "SNG" | "ISA" | "JER" | "LAM" | "EZK" | "DAN" | "HOS" | "JOL" | "AMO" | "OBA" | "JON" | "MIC" | "NAM" | "HAB" | "ZEP" | "HAG" | "ZEC" | "MAL" | "MAT" | "MRK" | "LUK" | "JHN" | "ACT" | "ROM" | "1CO" | "2CO" | "GAL" | "EPH" | "PHP" | "COL" | "1TH" | "2TH" | "1TI" | "2TI" | "TIT" | "PHM" | "HEB" | "JAS" | "1PE" | "2PE" | "1JN" | "2JN" | "3JN" | "JUD" | "REV" | "TOB" | "JDT" | "ESG" | "WIS" | "SIR" | "BAR" | "LJE" | "S3Y" | "SUS" | "BEL" | "1MA" | "2MA" | "3MA" | "4MA" | "1ES" | "2ES" | "MAN" | "PS2" | "ODA" | "PSS" | "3ES" | "EZA" | "5EZ" | "6EZ" | "DAG" | "PS3" | "2BA" | "LBA" | "JUB" | "ENO" | "1MQ" | "2MQ" | "3MQ" | "REP" | "4BA" | "LAO" | "LKA">[], z.ZodType<string & {}, unknown, z.core.$ZodTypeInternals<string & {}, unknown>>]>;
54
- chapter_id: z.ZodString;
55
66
  passage_id: z.ZodString;
56
- reference: z.ZodString;
67
+ title: z.ZodString;
57
68
  }, z.core.$strip>;
58
69
  type BibleVerse = z.infer<typeof BibleVerseSchema>;
59
70
 
60
71
  declare const BiblePassageSchema: z.ZodObject<{
61
72
  id: z.ZodString;
62
73
  content: z.ZodString;
63
- bible_id: z.ZodNumber;
64
- human_reference: z.ZodString;
74
+ reference: z.ZodString;
65
75
  }, z.core.$strip>;
66
76
  type BiblePassage = z.infer<typeof BiblePassageSchema>;
67
77
 
@@ -91,9 +101,9 @@ declare const BibleIndexBookSchema: z.ZodObject<{
91
101
  full_title: z.ZodString;
92
102
  abbreviation: z.ZodString;
93
103
  canon: z.ZodEnum<{
94
- ot: "ot";
95
- nt: "nt";
96
- dc: "dc";
104
+ old_testament: "old_testament";
105
+ new_testament: "new_testament";
106
+ deuterocanon: "deuterocanon";
97
107
  }>;
98
108
  chapters: z.ZodArray<z.ZodObject<{
99
109
  id: z.ZodString;
@@ -113,9 +123,9 @@ declare const _BibleIndexSchema: z.ZodObject<{
113
123
  full_title: z.ZodString;
114
124
  abbreviation: z.ZodString;
115
125
  canon: z.ZodEnum<{
116
- ot: "ot";
117
- nt: "nt";
118
- dc: "dc";
126
+ old_testament: "old_testament";
127
+ new_testament: "new_testament";
128
+ deuterocanon: "deuterocanon";
119
129
  }>;
120
130
  chapters: z.ZodArray<z.ZodObject<{
121
131
  id: z.ZodString;
@@ -199,7 +209,6 @@ type SignInWithYouVersionResultProps = {
199
209
  expiresIn?: number;
200
210
  refreshToken?: string;
201
211
  idToken?: string;
202
- permissions?: SignInWithYouVersionPermissionValues[];
203
212
  yvpUserId?: string;
204
213
  name?: string;
205
214
  profilePicture?: string;
@@ -210,12 +219,11 @@ declare class SignInWithYouVersionResult {
210
219
  readonly expiryDate: Date | undefined;
211
220
  readonly refreshToken: string | undefined;
212
221
  readonly idToken: string | undefined;
213
- readonly permissions: SignInWithYouVersionPermissionValues[] | undefined;
214
222
  readonly yvpUserId: string | undefined;
215
223
  readonly name: string | undefined;
216
224
  readonly profilePicture: string | undefined;
217
225
  readonly email: string | undefined;
218
- constructor({ accessToken, expiresIn, refreshToken, idToken, permissions, yvpUserId, name, profilePicture, email, }: SignInWithYouVersionResultProps);
226
+ constructor({ accessToken, expiresIn, refreshToken, idToken, yvpUserId, name, profilePicture, email, }: SignInWithYouVersionResultProps);
219
227
  }
220
228
 
221
229
  type SignInWithYouVersionPermissionValues = (typeof SignInWithYouVersionPermission)[keyof typeof SignInWithYouVersionPermission];
@@ -227,6 +235,7 @@ interface AuthenticationState {
227
235
  result: SignInWithYouVersionResult | null;
228
236
  error: Error | null;
229
237
  }
238
+ type AuthenticationScopes = 'profile' | 'email';
230
239
 
231
240
  /**
232
241
  * Legacy type for highlight colors (constants only)
@@ -327,7 +336,7 @@ declare class BibleClient {
327
336
  /**
328
337
  * Fetches all books for a given Bible version.
329
338
  * @param versionId The version ID.
330
- * @param canon Optional canon filter ('ot', 'nt', 'deuterocanon').
339
+ * @param canon Optional canon filter ("old_testament", 'new_testament', 'deuterocanon').
331
340
  * @returns An array of BibleBook objects.
332
341
  */
333
342
  getBooks(versionId: number, canon?: CANON): Promise<Collection<BibleBook>>;
@@ -583,14 +592,14 @@ declare class YouVersionAPIUsers {
583
592
  /**
584
593
  * Presents the YouVersion login flow to the user and returns the login result upon completion.
585
594
  *
586
- * This function authenticates the user with YouVersion, requesting the specified required and optional permissions.
595
+ * This function authenticates the user with YouVersion.
587
596
  * The function redirects to the YouVersion authorization URL and expects the callback to be handled separately.
588
597
  *
589
- * @param permissions - The set of permissions that must be granted by the user for successful login.
598
+ * @param scopes - The scopes given to the authentication call.
590
599
  * @param redirectURL - The URL to redirect back to after authentication.
591
600
  * @throws An error if authentication fails or configuration is invalid.
592
601
  */
593
- static signIn(permissions: Set<SignInWithYouVersionPermissionValues>, redirectURL: string): Promise<void>;
602
+ static signIn(redirectURL: string, scopes?: AuthenticationScopes[]): Promise<void>;
594
603
  /**
595
604
  * Handles the OAuth callback after user authentication.
596
605
  *
@@ -658,11 +667,6 @@ declare class YouVersionAPI {
658
667
  static addStandardHeaders(url: URL): Request;
659
668
  }
660
669
 
661
- declare class URLBuilder {
662
- private static get baseURL();
663
- static authURL(appKey: string, requiredPermissions?: Set<SignInWithYouVersionPermissionValues>, optionalPermissions?: Set<SignInWithYouVersionPermissionValues>): URL;
664
- }
665
-
666
670
  /**
667
671
  * Security Note: Tokens are stored in localStorage for persistence.
668
672
  * Ensure your application follows XSS prevention best practices:
@@ -702,4 +706,4 @@ declare const BOOK_IDS: readonly ["GEN", "EXO", "LEV", "NUM", "DEU", "JOS", "JDG
702
706
  */
703
707
  declare const BOOK_CANON: Record<BookUsfm, Canon>;
704
708
 
705
- export { ApiClient, type ApiConfig, type AuthenticationState, BOOK_CANON, BOOK_IDS, type BibleBook, type BibleChapter, BibleClient, type BibleIndex, type BibleIndexBook, type BibleIndexChapter, type BibleIndexVerse, type BiblePassage, type BibleVerse, type BibleVersion, type CANON, type Collection, type CreateHighlight, type DeleteHighlightOptions, type GetHighlightsOptions, type GetLanguagesOptions, type Highlight, type HighlightColor, HighlightsClient, type Language, LanguagesClient, MemoryStorageStrategy, SessionStorageStrategy, SignInWithYouVersionPermission, type SignInWithYouVersionPermissionValues, SignInWithYouVersionResult, type StorageStrategy, URLBuilder, type User, type VOTD, YouVersionAPI, YouVersionAPIUsers, YouVersionPlatformConfiguration, YouVersionUserInfo, type YouVersionUserInfoJSON };
709
+ export { ApiClient, type ApiConfig, type AuthenticationScopes, type AuthenticationState, BOOK_CANON, BOOK_IDS, type BibleBook, type BibleChapter, BibleClient, type BibleIndex, type BibleIndexBook, type BibleIndexChapter, type BibleIndexVerse, type BiblePassage, type BibleVerse, type BibleVersion, type CANON, type Collection, type CreateHighlight, type DeleteHighlightOptions, type GetHighlightsOptions, type GetLanguagesOptions, type Highlight, type HighlightColor, HighlightsClient, type Language, LanguagesClient, MemoryStorageStrategy, SessionStorageStrategy, SignInWithYouVersionPermission, type SignInWithYouVersionPermissionValues, SignInWithYouVersionResult, type StorageStrategy, type User, type VOTD, YouVersionAPI, YouVersionAPIUsers, YouVersionPlatformConfiguration, YouVersionUserInfo, type YouVersionUserInfoJSON };