@youversion/platform-core 0.8.2 → 0.10.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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +35 -0
- package/dist/index.cjs +116 -169
- package/dist/index.d.cts +19 -25
- package/dist/index.d.ts +19 -25
- package/dist/index.js +116 -168
- package/package.json +1 -1
- package/src/SignInWithYouVersionPKCE.ts +7 -7
- package/src/SignInWithYouVersionResult.ts +0 -6
- package/src/Users.ts +5 -29
- package/src/__tests__/MockBibles.ts +67 -67
- package/src/__tests__/SignInWithYouVersionPKCE.test.ts +8 -77
- package/src/__tests__/SignInWithYouVersionResult.test.ts +0 -2
- package/src/__tests__/Users.test.ts +4 -38
- package/src/__tests__/bible.test.ts +2 -2
- package/src/bible.ts +1 -1
- package/src/index.ts +0 -1
- package/src/schemas/book.ts +1 -5
- package/src/types/auth.ts +2 -0
- package/src/types/index.ts +5 -1
- package/src/utils/constants.ts +103 -103
- package/src/URLBuilder.ts +0 -50
- package/src/__tests__/URLBuilder.test.ts +0 -190
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @youversion/platform-core@0.
|
|
2
|
+
> @youversion/platform-core@0.10.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
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
[34mCLI[39m Target: es2022
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[32mESM[39m ⚡️ Build success in 36ms
|
|
13
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m43.46 KB[39m
|
|
11
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m42.47 KB[39m
|
|
14
12
|
[32mCJS[39m ⚡️ Build success in 36ms
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m40.66 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 36ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[32m31.
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m31.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 1827ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m31.83 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m31.83 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @youversion/platform-core
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- df2082d: Added version picker functionality to BibleWidgetView component with enhanced UI theming and user experience improvements.
|
|
8
|
+
|
|
9
|
+
New Features
|
|
10
|
+
- BibleWidgetView Version Picker: Added showVersionPicker prop enabling dynamic Bible version switching within the widget
|
|
11
|
+
- Enhanced Version Display: Improved version abbreviation presentation (e.g., "KJV1984" displays as "KJV" over "1984" in stacked format)
|
|
12
|
+
- Auto-Scroll Navigation: Bible chapter picker now automatically scrolls to and expands the current book when opened
|
|
13
|
+
- Added the ability to customize the text on the YouVersionAuthButton
|
|
14
|
+
- Add theme to the YouVersionProvider to specify light or dark mode to the SDK
|
|
15
|
+
|
|
16
|
+
UI/UX Improvements
|
|
17
|
+
- Consistent Button Styling: Updated all picker buttons to use secondary variant with bold typography
|
|
18
|
+
- Better Theme Support: Added comprehensive dark/light mode theming with data-yv-theme attributes
|
|
19
|
+
- Improved Accessibility: Enhanced search functionality with proper ARIA labels
|
|
20
|
+
- Cleaner DOM Structure: Simplified component hierarchy by removing unnecessary wrapper elements
|
|
21
|
+
- Improve component theming to apply theme to the ui components and improve
|
|
22
|
+
isolating the sdk css.
|
|
23
|
+
|
|
24
|
+
## 0.9.0
|
|
25
|
+
|
|
26
|
+
### Minor Changes
|
|
27
|
+
|
|
28
|
+
- e4f93b6: Update authentication system with enhanced OAuth scopes and API schema alignment
|
|
29
|
+
|
|
30
|
+
Key Changes:
|
|
31
|
+
- Added profile and email scopes to OAuth authentication
|
|
32
|
+
- Updated book resource schema to match new API endpoints
|
|
33
|
+
- Removed deprecated URLBuilder functionality
|
|
34
|
+
|
|
35
|
+
Breaking Changes:
|
|
36
|
+
- Book Schema: Must use the new updated book schema in any APIs returning bible book data Please enter a summary for your changes.
|
|
37
|
+
|
|
3
38
|
## 0.8.2
|
|
4
39
|
|
|
5
40
|
### 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 (
|
|
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,
|
|
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,
|
|
745
|
+
const url = this.authorizeURL(appKey, redirectURL, parameters, scopes);
|
|
747
746
|
return { url, parameters };
|
|
748
747
|
}
|
|
749
|
-
static authorizeURL(appKey,
|
|
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(
|
|
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(
|
|
806
|
-
const scopeArray = Array.from(
|
|
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
|
|
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
|
|
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(
|
|
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
|
-
|
|
876
|
-
|
|
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: "
|
|
1327
|
-
EXO: "
|
|
1328
|
-
LEV: "
|
|
1329
|
-
NUM: "
|
|
1330
|
-
DEU: "
|
|
1331
|
-
JOS: "
|
|
1332
|
-
JDG: "
|
|
1333
|
-
RUT: "
|
|
1334
|
-
"1SA": "
|
|
1335
|
-
"2SA": "
|
|
1336
|
-
"1KI": "
|
|
1337
|
-
"2KI": "
|
|
1338
|
-
"1CH": "
|
|
1339
|
-
"2CH": "
|
|
1340
|
-
EZR: "
|
|
1341
|
-
NEH: "
|
|
1342
|
-
EST: "
|
|
1343
|
-
JOB: "
|
|
1344
|
-
PSA: "
|
|
1345
|
-
PRO: "
|
|
1346
|
-
ECC: "
|
|
1347
|
-
SNG: "
|
|
1348
|
-
ISA: "
|
|
1349
|
-
JER: "
|
|
1350
|
-
LAM: "
|
|
1351
|
-
EZK: "
|
|
1352
|
-
DAN: "
|
|
1353
|
-
HOS: "
|
|
1354
|
-
JOL: "
|
|
1355
|
-
AMO: "
|
|
1356
|
-
OBA: "
|
|
1357
|
-
JON: "
|
|
1358
|
-
MIC: "
|
|
1359
|
-
NAM: "
|
|
1360
|
-
HAB: "
|
|
1361
|
-
ZEP: "
|
|
1362
|
-
HAG: "
|
|
1363
|
-
ZEC: "
|
|
1364
|
-
MAL: "
|
|
1365
|
-
MAT: "
|
|
1366
|
-
MRK: "
|
|
1367
|
-
LUK: "
|
|
1368
|
-
JHN: "
|
|
1369
|
-
ACT: "
|
|
1370
|
-
ROM: "
|
|
1371
|
-
"1CO": "
|
|
1372
|
-
"2CO": "
|
|
1373
|
-
GAL: "
|
|
1374
|
-
EPH: "
|
|
1375
|
-
PHP: "
|
|
1376
|
-
COL: "
|
|
1377
|
-
"1TH": "
|
|
1378
|
-
"2TH": "
|
|
1379
|
-
"1TI": "
|
|
1380
|
-
"2TI": "
|
|
1381
|
-
TIT: "
|
|
1382
|
-
PHM: "
|
|
1383
|
-
HEB: "
|
|
1384
|
-
JAS: "
|
|
1385
|
-
"1PE": "
|
|
1386
|
-
"2PE": "
|
|
1387
|
-
"1JN": "
|
|
1388
|
-
"2JN": "
|
|
1389
|
-
"3JN": "
|
|
1390
|
-
JUD: "
|
|
1391
|
-
REV: "
|
|
1392
|
-
TOB: "
|
|
1393
|
-
JDT: "
|
|
1394
|
-
ESG: "
|
|
1395
|
-
WIS: "
|
|
1396
|
-
SIR: "
|
|
1397
|
-
BAR: "
|
|
1398
|
-
LJE: "
|
|
1399
|
-
S3Y: "
|
|
1400
|
-
SUS: "
|
|
1401
|
-
BEL: "
|
|
1402
|
-
"1MA": "
|
|
1403
|
-
"2MA": "
|
|
1404
|
-
"3MA": "
|
|
1405
|
-
"4MA": "
|
|
1406
|
-
"1ES": "
|
|
1407
|
-
"2ES": "
|
|
1408
|
-
MAN: "
|
|
1409
|
-
PS2: "
|
|
1410
|
-
ODA: "
|
|
1411
|
-
PSS: "
|
|
1412
|
-
"3ES": "
|
|
1413
|
-
EZA: "
|
|
1414
|
-
"5EZ": "
|
|
1415
|
-
"6EZ": "
|
|
1416
|
-
DAG: "
|
|
1417
|
-
PS3: "
|
|
1418
|
-
"2BA": "
|
|
1419
|
-
LBA: "
|
|
1420
|
-
JUB: "
|
|
1421
|
-
ENO: "
|
|
1422
|
-
"1MQ": "
|
|
1423
|
-
"2MQ": "
|
|
1424
|
-
"3MQ": "
|
|
1425
|
-
REP: "
|
|
1426
|
-
"4BA": "
|
|
1427
|
-
LAO: "
|
|
1428
|
-
LKA: "
|
|
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
|
@@ -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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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>>]>;
|
|
@@ -31,9 +31,9 @@ declare const BibleBookSchema: z.ZodObject<{
|
|
|
31
31
|
full_title: z.ZodString;
|
|
32
32
|
abbreviation: z.ZodOptional<z.ZodString>;
|
|
33
33
|
canon: z.ZodEnum<{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
old_testament: "old_testament";
|
|
35
|
+
new_testament: "new_testament";
|
|
36
|
+
deuterocanon: "deuterocanon";
|
|
37
37
|
}>;
|
|
38
38
|
chapters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
39
39
|
id: z.ZodString;
|
|
@@ -101,9 +101,9 @@ declare const BibleIndexBookSchema: z.ZodObject<{
|
|
|
101
101
|
full_title: z.ZodString;
|
|
102
102
|
abbreviation: z.ZodString;
|
|
103
103
|
canon: z.ZodEnum<{
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
old_testament: "old_testament";
|
|
105
|
+
new_testament: "new_testament";
|
|
106
|
+
deuterocanon: "deuterocanon";
|
|
107
107
|
}>;
|
|
108
108
|
chapters: z.ZodArray<z.ZodObject<{
|
|
109
109
|
id: z.ZodString;
|
|
@@ -123,9 +123,9 @@ declare const _BibleIndexSchema: z.ZodObject<{
|
|
|
123
123
|
full_title: z.ZodString;
|
|
124
124
|
abbreviation: z.ZodString;
|
|
125
125
|
canon: z.ZodEnum<{
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
old_testament: "old_testament";
|
|
127
|
+
new_testament: "new_testament";
|
|
128
|
+
deuterocanon: "deuterocanon";
|
|
129
129
|
}>;
|
|
130
130
|
chapters: z.ZodArray<z.ZodObject<{
|
|
131
131
|
id: z.ZodString;
|
|
@@ -209,7 +209,6 @@ type SignInWithYouVersionResultProps = {
|
|
|
209
209
|
expiresIn?: number;
|
|
210
210
|
refreshToken?: string;
|
|
211
211
|
idToken?: string;
|
|
212
|
-
permissions?: SignInWithYouVersionPermissionValues[];
|
|
213
212
|
yvpUserId?: string;
|
|
214
213
|
name?: string;
|
|
215
214
|
profilePicture?: string;
|
|
@@ -220,12 +219,11 @@ declare class SignInWithYouVersionResult {
|
|
|
220
219
|
readonly expiryDate: Date | undefined;
|
|
221
220
|
readonly refreshToken: string | undefined;
|
|
222
221
|
readonly idToken: string | undefined;
|
|
223
|
-
readonly permissions: SignInWithYouVersionPermissionValues[] | undefined;
|
|
224
222
|
readonly yvpUserId: string | undefined;
|
|
225
223
|
readonly name: string | undefined;
|
|
226
224
|
readonly profilePicture: string | undefined;
|
|
227
225
|
readonly email: string | undefined;
|
|
228
|
-
constructor({ accessToken, expiresIn, refreshToken, idToken,
|
|
226
|
+
constructor({ accessToken, expiresIn, refreshToken, idToken, yvpUserId, name, profilePicture, email, }: SignInWithYouVersionResultProps);
|
|
229
227
|
}
|
|
230
228
|
|
|
231
229
|
type SignInWithYouVersionPermissionValues = (typeof SignInWithYouVersionPermission)[keyof typeof SignInWithYouVersionPermission];
|
|
@@ -237,6 +235,7 @@ interface AuthenticationState {
|
|
|
237
235
|
result: SignInWithYouVersionResult | null;
|
|
238
236
|
error: Error | null;
|
|
239
237
|
}
|
|
238
|
+
type AuthenticationScopes = 'profile' | 'email';
|
|
240
239
|
|
|
241
240
|
/**
|
|
242
241
|
* Legacy type for highlight colors (constants only)
|
|
@@ -337,7 +336,7 @@ declare class BibleClient {
|
|
|
337
336
|
/**
|
|
338
337
|
* Fetches all books for a given Bible version.
|
|
339
338
|
* @param versionId The version ID.
|
|
340
|
-
* @param canon Optional canon filter (
|
|
339
|
+
* @param canon Optional canon filter ("old_testament", 'new_testament', 'deuterocanon').
|
|
341
340
|
* @returns An array of BibleBook objects.
|
|
342
341
|
*/
|
|
343
342
|
getBooks(versionId: number, canon?: CANON): Promise<Collection<BibleBook>>;
|
|
@@ -593,14 +592,14 @@ declare class YouVersionAPIUsers {
|
|
|
593
592
|
/**
|
|
594
593
|
* Presents the YouVersion login flow to the user and returns the login result upon completion.
|
|
595
594
|
*
|
|
596
|
-
* This function authenticates the user with YouVersion
|
|
595
|
+
* This function authenticates the user with YouVersion.
|
|
597
596
|
* The function redirects to the YouVersion authorization URL and expects the callback to be handled separately.
|
|
598
597
|
*
|
|
599
|
-
* @param
|
|
598
|
+
* @param scopes - The scopes given to the authentication call.
|
|
600
599
|
* @param redirectURL - The URL to redirect back to after authentication.
|
|
601
600
|
* @throws An error if authentication fails or configuration is invalid.
|
|
602
601
|
*/
|
|
603
|
-
static signIn(
|
|
602
|
+
static signIn(redirectURL: string, scopes?: AuthenticationScopes[]): Promise<void>;
|
|
604
603
|
/**
|
|
605
604
|
* Handles the OAuth callback after user authentication.
|
|
606
605
|
*
|
|
@@ -668,11 +667,6 @@ declare class YouVersionAPI {
|
|
|
668
667
|
static addStandardHeaders(url: URL): Request;
|
|
669
668
|
}
|
|
670
669
|
|
|
671
|
-
declare class URLBuilder {
|
|
672
|
-
private static get baseURL();
|
|
673
|
-
static authURL(appKey: string, requiredPermissions?: Set<SignInWithYouVersionPermissionValues>, optionalPermissions?: Set<SignInWithYouVersionPermissionValues>): URL;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
670
|
/**
|
|
677
671
|
* Security Note: Tokens are stored in localStorage for persistence.
|
|
678
672
|
* Ensure your application follows XSS prevention best practices:
|
|
@@ -712,4 +706,4 @@ declare const BOOK_IDS: readonly ["GEN", "EXO", "LEV", "NUM", "DEU", "JOS", "JDG
|
|
|
712
706
|
*/
|
|
713
707
|
declare const BOOK_CANON: Record<BookUsfm, Canon>;
|
|
714
708
|
|
|
715
|
-
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,
|
|
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 };
|