@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.
package/dist/index.d.ts 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 };
package/dist/index.js CHANGED
@@ -192,7 +192,7 @@ var BibleClient = class {
192
192
  /**
193
193
  * Fetches all books for a given Bible version.
194
194
  * @param versionId The version ID.
195
- * @param canon Optional canon filter ('ot', 'nt', 'deuterocanon').
195
+ * @param canon Optional canon filter ("old_testament", 'new_testament', 'deuterocanon').
196
196
  * @returns An array of BibleBook objects.
197
197
  */
198
198
  async getBooks(versionId, canon) {
@@ -692,7 +692,7 @@ var YouVersionUserInfo = class {
692
692
 
693
693
  // src/SignInWithYouVersionPKCE.ts
694
694
  var SignInWithYouVersionPKCEAuthorizationRequestBuilder = class {
695
- static async make(appKey, permissions, redirectURL) {
695
+ static async make(appKey, redirectURL, scopes) {
696
696
  const codeVerifier = this.randomURLSafeString(32);
697
697
  const codeChallenge = await this.codeChallenge(codeVerifier);
698
698
  const state = this.randomURLSafeString(24);
@@ -703,10 +703,10 @@ var SignInWithYouVersionPKCEAuthorizationRequestBuilder = class {
703
703
  state,
704
704
  nonce
705
705
  };
706
- const url = this.authorizeURL(appKey, permissions, redirectURL, parameters);
706
+ const url = this.authorizeURL(appKey, redirectURL, parameters, scopes);
707
707
  return { url, parameters };
708
708
  }
709
- static authorizeURL(appKey, permissions, redirectURL, parameters) {
709
+ static authorizeURL(appKey, redirectURL, parameters, scopes) {
710
710
  const components = new URL(`https://${YouVersionPlatformConfiguration.apiHost}/auth/authorize`);
711
711
  const redirectUrlString = redirectURL.toString().endsWith("/") ? redirectURL.toString().slice(0, -1) : redirectURL.toString();
712
712
  const queryParams = new URLSearchParams({
@@ -722,7 +722,7 @@ var SignInWithYouVersionPKCEAuthorizationRequestBuilder = class {
722
722
  if (installId) {
723
723
  queryParams.set("x-yvp-installation-id", installId);
724
724
  }
725
- const scopeValue = this.scopeValue(permissions);
725
+ const scopeValue = this.scopeValue(scopes || []);
726
726
  if (scopeValue) {
727
727
  queryParams.set("scope", scopeValue);
728
728
  }
@@ -762,8 +762,8 @@ var SignInWithYouVersionPKCEAuthorizationRequestBuilder = class {
762
762
  const base64 = btoa(String.fromCharCode.apply(null, Array.from(data)));
763
763
  return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
764
764
  }
765
- static scopeValue(permissions) {
766
- const scopeArray = Array.from(permissions).sort();
765
+ static scopeValue(scopes) {
766
+ const scopeArray = Array.from(scopes).sort();
767
767
  let scopeWithOpenID = scopeArray.join(" ");
768
768
  if (!scopeWithOpenID.split(" ").includes("openid")) {
769
769
  scopeWithOpenID += (scopeWithOpenID === "" ? "" : " ") + "openid";
@@ -785,7 +785,6 @@ var SignInWithYouVersionResult = class {
785
785
  expiryDate;
786
786
  refreshToken;
787
787
  idToken;
788
- permissions;
789
788
  yvpUserId;
790
789
  name;
791
790
  profilePicture;
@@ -795,7 +794,6 @@ var SignInWithYouVersionResult = class {
795
794
  expiresIn,
796
795
  refreshToken,
797
796
  idToken,
798
- permissions,
799
797
  yvpUserId,
800
798
  name,
801
799
  profilePicture,
@@ -805,7 +803,6 @@ var SignInWithYouVersionResult = class {
805
803
  this.expiryDate = expiresIn ? new Date(Date.now() + expiresIn * 1e3) : /* @__PURE__ */ new Date();
806
804
  this.refreshToken = refreshToken;
807
805
  this.idToken = idToken;
808
- this.permissions = permissions;
809
806
  this.yvpUserId = yvpUserId;
810
807
  this.name = name;
811
808
  this.profilePicture = profilePicture;
@@ -818,22 +815,22 @@ var YouVersionAPIUsers = class {
818
815
  /**
819
816
  * Presents the YouVersion login flow to the user and returns the login result upon completion.
820
817
  *
821
- * This function authenticates the user with YouVersion, requesting the specified required and optional permissions.
818
+ * This function authenticates the user with YouVersion.
822
819
  * The function redirects to the YouVersion authorization URL and expects the callback to be handled separately.
823
820
  *
824
- * @param permissions - The set of permissions that must be granted by the user for successful login.
821
+ * @param scopes - The scopes given to the authentication call.
825
822
  * @param redirectURL - The URL to redirect back to after authentication.
826
823
  * @throws An error if authentication fails or configuration is invalid.
827
824
  */
828
- static async signIn(permissions, redirectURL) {
825
+ static async signIn(redirectURL, scopes) {
829
826
  const appKey = YouVersionPlatformConfiguration.appKey;
830
827
  if (!appKey) {
831
828
  throw new Error("YouVersionPlatformConfiguration.appKey must be set before calling signIn");
832
829
  }
833
830
  const authorizationRequest = await SignInWithYouVersionPKCEAuthorizationRequestBuilder.make(
834
831
  appKey,
835
- permissions,
836
- new URL(redirectURL)
832
+ new URL(redirectURL),
833
+ scopes
837
834
  );
838
835
  localStorage.setItem(
839
836
  "youversion-auth-code-verifier",
@@ -933,17 +930,11 @@ var YouVersionAPIUsers = class {
933
930
  */
934
931
  static extractSignInResult(tokens) {
935
932
  const idClaims = this.decodeJWT(tokens.id_token);
936
- const permissions = tokens.scope.split(" ").map((p) => p.trim()).filter((p) => p.length > 0).filter(
937
- (p) => Object.values(SignInWithYouVersionPermission).includes(
938
- p
939
- )
940
- );
941
933
  const resultData = {
942
934
  accessToken: tokens.access_token,
943
935
  expiresIn: tokens.expires_in,
944
936
  refreshToken: tokens.refresh_token,
945
937
  idToken: tokens.id_token,
946
- permissions,
947
938
  yvpUserId: idClaims.sub,
948
939
  name: idClaims.name,
949
940
  profilePicture: idClaims.profile_picture,
@@ -1062,12 +1053,7 @@ var YouVersionAPIUsers = class {
1062
1053
  accessToken: tokens.access_token,
1063
1054
  expiresIn: tokens.expires_in,
1064
1055
  refreshToken: tokens.refresh_token,
1065
- idToken: existingIdToken,
1066
- permissions: tokens.scope.split(" ").map((p) => p.trim()).filter((p) => p.length > 0).filter(
1067
- (p) => Object.values(SignInWithYouVersionPermission).includes(
1068
- p
1069
- )
1070
- )
1056
+ idToken: existingIdToken
1071
1057
  });
1072
1058
  YouVersionPlatformConfiguration.saveAuthData(
1073
1059
  result.accessToken || null,
@@ -1137,43 +1123,6 @@ var YouVersionAPI = class {
1137
1123
  }
1138
1124
  };
1139
1125
 
1140
- // src/URLBuilder.ts
1141
- var URLBuilder = class {
1142
- static get baseURL() {
1143
- return new URL(`https://${YouVersionPlatformConfiguration.apiHost}`);
1144
- }
1145
- static authURL(appKey, requiredPermissions = /* @__PURE__ */ new Set(), optionalPermissions = /* @__PURE__ */ new Set()) {
1146
- if (typeof appKey !== "string" || appKey.trim().length === 0) {
1147
- throw new Error("appKey must be a non-empty string");
1148
- }
1149
- try {
1150
- const url = new URL(this.baseURL);
1151
- url.pathname = "/auth/login";
1152
- const searchParams = new URLSearchParams();
1153
- searchParams.append("APP_KEY", appKey);
1154
- searchParams.append("language", "en");
1155
- if (requiredPermissions.size > 0) {
1156
- const requiredList = Array.from(requiredPermissions).map((p) => p.toString());
1157
- searchParams.append("required_perms", requiredList.join(","));
1158
- }
1159
- if (optionalPermissions.size > 0) {
1160
- const optionalList = Array.from(optionalPermissions).map((p) => p.toString());
1161
- searchParams.append("opt_perms", optionalList.join(","));
1162
- }
1163
- const installationId = YouVersionPlatformConfiguration.installationId;
1164
- if (installationId) {
1165
- searchParams.append("x-yvp-installation-id", installationId);
1166
- }
1167
- url.search = searchParams.toString();
1168
- return url;
1169
- } catch (error) {
1170
- throw new Error(
1171
- `Failed to construct auth URL: ${error instanceof Error ? error.message : "Unknown error"}`
1172
- );
1173
- }
1174
- }
1175
- };
1176
-
1177
1126
  // src/utils/constants.ts
1178
1127
  var BOOK_IDS = [
1179
1128
  "GEN",
@@ -1283,109 +1232,109 @@ var BOOK_IDS = [
1283
1232
  "LKA"
1284
1233
  ];
1285
1234
  var BOOK_CANON = {
1286
- GEN: "ot",
1287
- EXO: "ot",
1288
- LEV: "ot",
1289
- NUM: "ot",
1290
- DEU: "ot",
1291
- JOS: "ot",
1292
- JDG: "ot",
1293
- RUT: "ot",
1294
- "1SA": "ot",
1295
- "2SA": "ot",
1296
- "1KI": "ot",
1297
- "2KI": "ot",
1298
- "1CH": "ot",
1299
- "2CH": "ot",
1300
- EZR: "ot",
1301
- NEH: "ot",
1302
- EST: "ot",
1303
- JOB: "ot",
1304
- PSA: "ot",
1305
- PRO: "ot",
1306
- ECC: "ot",
1307
- SNG: "ot",
1308
- ISA: "ot",
1309
- JER: "ot",
1310
- LAM: "ot",
1311
- EZK: "ot",
1312
- DAN: "ot",
1313
- HOS: "ot",
1314
- JOL: "ot",
1315
- AMO: "ot",
1316
- OBA: "ot",
1317
- JON: "ot",
1318
- MIC: "ot",
1319
- NAM: "ot",
1320
- HAB: "ot",
1321
- ZEP: "ot",
1322
- HAG: "ot",
1323
- ZEC: "ot",
1324
- MAL: "ot",
1325
- MAT: "nt",
1326
- MRK: "nt",
1327
- LUK: "nt",
1328
- JHN: "nt",
1329
- ACT: "nt",
1330
- ROM: "nt",
1331
- "1CO": "nt",
1332
- "2CO": "nt",
1333
- GAL: "nt",
1334
- EPH: "nt",
1335
- PHP: "nt",
1336
- COL: "nt",
1337
- "1TH": "nt",
1338
- "2TH": "nt",
1339
- "1TI": "nt",
1340
- "2TI": "nt",
1341
- TIT: "nt",
1342
- PHM: "nt",
1343
- HEB: "nt",
1344
- JAS: "nt",
1345
- "1PE": "nt",
1346
- "2PE": "nt",
1347
- "1JN": "nt",
1348
- "2JN": "nt",
1349
- "3JN": "nt",
1350
- JUD: "nt",
1351
- REV: "nt",
1352
- TOB: "dc",
1353
- JDT: "dc",
1354
- ESG: "dc",
1355
- WIS: "dc",
1356
- SIR: "dc",
1357
- BAR: "dc",
1358
- LJE: "dc",
1359
- S3Y: "dc",
1360
- SUS: "dc",
1361
- BEL: "dc",
1362
- "1MA": "dc",
1363
- "2MA": "dc",
1364
- "3MA": "dc",
1365
- "4MA": "dc",
1366
- "1ES": "dc",
1367
- "2ES": "dc",
1368
- MAN: "dc",
1369
- PS2: "dc",
1370
- ODA: "dc",
1371
- PSS: "dc",
1372
- "3ES": "dc",
1373
- EZA: "dc",
1374
- "5EZ": "dc",
1375
- "6EZ": "dc",
1376
- DAG: "dc",
1377
- PS3: "dc",
1378
- "2BA": "dc",
1379
- LBA: "dc",
1380
- JUB: "dc",
1381
- ENO: "dc",
1382
- "1MQ": "dc",
1383
- "2MQ": "dc",
1384
- "3MQ": "dc",
1385
- REP: "dc",
1386
- "4BA": "dc",
1387
- LAO: "dc",
1388
- LKA: "nt"
1235
+ GEN: "old_testament",
1236
+ EXO: "old_testament",
1237
+ LEV: "old_testament",
1238
+ NUM: "old_testament",
1239
+ DEU: "old_testament",
1240
+ JOS: "old_testament",
1241
+ JDG: "old_testament",
1242
+ RUT: "old_testament",
1243
+ "1SA": "old_testament",
1244
+ "2SA": "old_testament",
1245
+ "1KI": "old_testament",
1246
+ "2KI": "old_testament",
1247
+ "1CH": "old_testament",
1248
+ "2CH": "old_testament",
1249
+ EZR: "old_testament",
1250
+ NEH: "old_testament",
1251
+ EST: "old_testament",
1252
+ JOB: "old_testament",
1253
+ PSA: "old_testament",
1254
+ PRO: "old_testament",
1255
+ ECC: "old_testament",
1256
+ SNG: "old_testament",
1257
+ ISA: "old_testament",
1258
+ JER: "old_testament",
1259
+ LAM: "old_testament",
1260
+ EZK: "old_testament",
1261
+ DAN: "old_testament",
1262
+ HOS: "old_testament",
1263
+ JOL: "old_testament",
1264
+ AMO: "old_testament",
1265
+ OBA: "old_testament",
1266
+ JON: "old_testament",
1267
+ MIC: "old_testament",
1268
+ NAM: "old_testament",
1269
+ HAB: "old_testament",
1270
+ ZEP: "old_testament",
1271
+ HAG: "old_testament",
1272
+ ZEC: "old_testament",
1273
+ MAL: "old_testament",
1274
+ MAT: "new_testament",
1275
+ MRK: "new_testament",
1276
+ LUK: "new_testament",
1277
+ JHN: "new_testament",
1278
+ ACT: "new_testament",
1279
+ ROM: "new_testament",
1280
+ "1CO": "new_testament",
1281
+ "2CO": "new_testament",
1282
+ GAL: "new_testament",
1283
+ EPH: "new_testament",
1284
+ PHP: "new_testament",
1285
+ COL: "new_testament",
1286
+ "1TH": "new_testament",
1287
+ "2TH": "new_testament",
1288
+ "1TI": "new_testament",
1289
+ "2TI": "new_testament",
1290
+ TIT: "new_testament",
1291
+ PHM: "new_testament",
1292
+ HEB: "new_testament",
1293
+ JAS: "new_testament",
1294
+ "1PE": "new_testament",
1295
+ "2PE": "new_testament",
1296
+ "1JN": "new_testament",
1297
+ "2JN": "new_testament",
1298
+ "3JN": "new_testament",
1299
+ JUD: "new_testament",
1300
+ REV: "new_testament",
1301
+ TOB: "deuterocanon",
1302
+ JDT: "deuterocanon",
1303
+ ESG: "deuterocanon",
1304
+ WIS: "deuterocanon",
1305
+ SIR: "deuterocanon",
1306
+ BAR: "deuterocanon",
1307
+ LJE: "deuterocanon",
1308
+ S3Y: "deuterocanon",
1309
+ SUS: "deuterocanon",
1310
+ BEL: "deuterocanon",
1311
+ "1MA": "deuterocanon",
1312
+ "2MA": "deuterocanon",
1313
+ "3MA": "deuterocanon",
1314
+ "4MA": "deuterocanon",
1315
+ "1ES": "deuterocanon",
1316
+ "2ES": "deuterocanon",
1317
+ MAN: "deuterocanon",
1318
+ PS2: "deuterocanon",
1319
+ ODA: "deuterocanon",
1320
+ PSS: "deuterocanon",
1321
+ "3ES": "deuterocanon",
1322
+ EZA: "deuterocanon",
1323
+ "5EZ": "deuterocanon",
1324
+ "6EZ": "deuterocanon",
1325
+ DAG: "deuterocanon",
1326
+ PS3: "deuterocanon",
1327
+ "2BA": "deuterocanon",
1328
+ LBA: "deuterocanon",
1329
+ JUB: "deuterocanon",
1330
+ ENO: "deuterocanon",
1331
+ "1MQ": "deuterocanon",
1332
+ "2MQ": "deuterocanon",
1333
+ "3MQ": "deuterocanon",
1334
+ REP: "deuterocanon",
1335
+ "4BA": "deuterocanon",
1336
+ LAO: "deuterocanon",
1337
+ LKA: "new_testament"
1389
1338
  // Luke-Acts combo, treated canonically as New Testament
1390
1339
  };
1391
1340
  export {
@@ -1399,7 +1348,6 @@ export {
1399
1348
  SessionStorageStrategy,
1400
1349
  SignInWithYouVersionPermission,
1401
1350
  SignInWithYouVersionResult,
1402
- URLBuilder,
1403
1351
  YouVersionAPI,
1404
1352
  YouVersionAPIUsers,
1405
1353
  YouVersionPlatformConfiguration,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@youversion/platform-core",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -42,6 +42,7 @@
42
42
  "lint": "eslint . --max-warnings 0",
43
43
  "typecheck": "tsc --noEmit",
44
44
  "test": "dotenv -e .env.local -- vitest run",
45
+ "test:integration": "INTEGRATION_TESTS=true dotenv -e .env.local -- vitest run",
45
46
  "test:watch": "dotenv -e .env.local -- vitest",
46
47
  "test:coverage": "dotenv -e .env.local -- vitest run --coverage"
47
48
  }