@youversion/platform-react-hooks 1.22.0 → 1.22.1
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 +21 -1
- package/CHANGELOG.md +10 -0
- package/dist/YouVersionAuthProvider-VORD6KDZ.js +80 -0
- package/dist/chunk-ITHJF2FD.js +17 -0
- package/dist/index.cjs +946 -0
- package/dist/index.js +788 -26
- package/package.json +11 -6
- package/tsconfig.build.json +4 -1
- package/dist/__tests__/mocks/auth.js +0 -43
- package/dist/__tests__/mocks/auth.js.map +0 -1
- package/dist/__tests__/mocks/bibles.js +0 -23
- package/dist/__tests__/mocks/bibles.js.map +0 -1
- package/dist/__tests__/mocks/core-mock-factory.js +0 -138
- package/dist/__tests__/mocks/core-mock-factory.js.map +0 -1
- package/dist/__tests__/utils/test-utils.js +0 -11
- package/dist/__tests__/utils/test-utils.js.map +0 -1
- package/dist/context/ReaderContext.js +0 -17
- package/dist/context/ReaderContext.js.map +0 -1
- package/dist/context/ReaderProvider.js +0 -24
- package/dist/context/ReaderProvider.js.map +0 -1
- package/dist/context/VerseSelectionContext.js +0 -6
- package/dist/context/VerseSelectionContext.js.map +0 -1
- package/dist/context/VerseSelectionProvider.js +0 -36
- package/dist/context/VerseSelectionProvider.js.map +0 -1
- package/dist/context/YouVersionAuthContext.js +0 -13
- package/dist/context/YouVersionAuthContext.js.map +0 -1
- package/dist/context/YouVersionAuthProvider.js +0 -81
- package/dist/context/YouVersionAuthProvider.js.map +0 -1
- package/dist/context/YouVersionContext.js +0 -4
- package/dist/context/YouVersionContext.js.map +0 -1
- package/dist/context/YouVersionProvider.js +0 -63
- package/dist/context/YouVersionProvider.js.map +0 -1
- package/dist/context/index.js +0 -7
- package/dist/context/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/test/setup.js +0 -9
- package/dist/test/setup.js.map +0 -1
- package/dist/test/utils.js +0 -7
- package/dist/test/utils.js.map +0 -1
- package/dist/types/auth.js +0 -2
- package/dist/types/auth.js.map +0 -1
- package/dist/useApiData.js +0 -46
- package/dist/useApiData.js.map +0 -1
- package/dist/useBibleClient.js +0 -18
- package/dist/useBibleClient.js.map +0 -1
- package/dist/useBook.js +0 -11
- package/dist/useBook.js.map +0 -1
- package/dist/useBooks.js +0 -11
- package/dist/useBooks.js.map +0 -1
- package/dist/useChapter.js +0 -11
- package/dist/useChapter.js.map +0 -1
- package/dist/useChapterNavigation.js +0 -57
- package/dist/useChapterNavigation.js.map +0 -1
- package/dist/useChapters.js +0 -13
- package/dist/useChapters.js.map +0 -1
- package/dist/useFilteredVersions.js +0 -29
- package/dist/useFilteredVersions.js.map +0 -1
- package/dist/useHighlights.js +0 -41
- package/dist/useHighlights.js.map +0 -1
- package/dist/useInitData.js +0 -29
- package/dist/useInitData.js.map +0 -1
- package/dist/useLanguage.js +0 -17
- package/dist/useLanguage.js.map +0 -1
- package/dist/useLanguageClient.js +0 -18
- package/dist/useLanguageClient.js.map +0 -1
- package/dist/useLanguages.js +0 -23
- package/dist/useLanguages.js.map +0 -1
- package/dist/usePassage.js +0 -11
- package/dist/usePassage.js.map +0 -1
- package/dist/useTheme.js +0 -21
- package/dist/useTheme.js.map +0 -1
- package/dist/useVOTD.js +0 -9
- package/dist/useVOTD.js.map +0 -1
- package/dist/useVerse.js +0 -11
- package/dist/useVerse.js.map +0 -1
- package/dist/useVerseSelection.js +0 -13
- package/dist/useVerseSelection.js.map +0 -1
- package/dist/useVerses.js +0 -11
- package/dist/useVerses.js.map +0 -1
- package/dist/useVersion.js +0 -11
- package/dist/useVersion.js.map +0 -1
- package/dist/useVersions.js +0 -35
- package/dist/useVersions.js.map +0 -1
- package/dist/useYVAuth.js +0 -144
- package/dist/useYVAuth.js.map +0 -1
- package/dist/utility/extractTextFromHTML.js +0 -21
- package/dist/utility/extractTextFromHTML.js.map +0 -1
- package/dist/utility/extractVersesFromHTML.js +0 -26
- package/dist/utility/extractVersesFromHTML.js.map +0 -1
- package/dist/utility/getDayOfYear.js +0 -5
- package/dist/utility/getDayOfYear.js.map +0 -1
- package/dist/utility/index.js +0 -6
- package/dist/utility/index.js.map +0 -1
- package/dist/utility/useDebounce.js +0 -24
- package/dist/utility/useDebounce.js.map +0 -1
- package/dist/utility/version.js +0 -4
- package/dist/utility/version.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
|
|
2
|
-
> @youversion/platform-react-hooks@1.22.
|
|
2
|
+
> @youversion/platform-react-hooks@1.22.1 build /home/runner/work/platform-sdk-react/platform-sdk-react/packages/hooks
|
|
3
|
+
> pnpm build:js && pnpm build:types
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
> @youversion/platform-react-hooks@1.22.1 build:js /home/runner/work/platform-sdk-react/platform-sdk-react/packages/hooks
|
|
7
|
+
> tsup src/index.ts --format cjs,esm
|
|
8
|
+
|
|
9
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
10
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
11
|
+
[34mCLI[39m tsup v8.5.0
|
|
12
|
+
[34mCLI[39m Target: es2022
|
|
13
|
+
[34mCJS[39m Build start
|
|
14
|
+
[34mESM[39m Build start
|
|
15
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m29.77 KB[39m
|
|
16
|
+
[32mCJS[39m ⚡️ Build success in 43ms
|
|
17
|
+
[32mESM[39m [1mdist/index.js [22m[32m22.81 KB[39m
|
|
18
|
+
[32mESM[39m [1mdist/YouVersionAuthProvider-VORD6KDZ.js [22m[32m2.43 KB[39m
|
|
19
|
+
[32mESM[39m [1mdist/chunk-ITHJF2FD.js [22m[32m631.00 B[39m
|
|
20
|
+
[32mESM[39m ⚡️ Build success in 42ms
|
|
21
|
+
|
|
22
|
+
> @youversion/platform-react-hooks@1.22.1 build:types /home/runner/work/platform-sdk-react/platform-sdk-react/packages/hooks
|
|
3
23
|
> tsc -p tsconfig.build.json
|
|
4
24
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @youversion/platform-react-hooks
|
|
2
2
|
|
|
3
|
+
## 1.22.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b8b5cf0: Fixed hooks package bundling to produce proper CJS and ESM outputs, resolving import failures in strict ESM runtimes like Deno.
|
|
8
|
+
- 2a64020: Updated the Bible App logo on the BibleCard and VerseOfTheDay React components to the latest designs.
|
|
9
|
+
- Updated dependencies [b8b5cf0]
|
|
10
|
+
- Updated dependencies [2a64020]
|
|
11
|
+
- @youversion/platform-core@1.22.1
|
|
12
|
+
|
|
3
13
|
## 1.22.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
YouVersionAuthContext
|
|
4
|
+
} from "./chunk-ITHJF2FD.js";
|
|
5
|
+
|
|
6
|
+
// src/context/YouVersionAuthProvider.tsx
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
import {
|
|
9
|
+
YouVersionAPIUsers,
|
|
10
|
+
YouVersionPlatformConfiguration
|
|
11
|
+
} from "@youversion/platform-core";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
function YouVersionAuthProvider({
|
|
14
|
+
config,
|
|
15
|
+
children
|
|
16
|
+
}) {
|
|
17
|
+
const [userInfo, setUserInfo] = useState(null);
|
|
18
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
19
|
+
const [error, setError] = useState(null);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
let mounted = true;
|
|
22
|
+
const initAuth = async () => {
|
|
23
|
+
YouVersionPlatformConfiguration.appKey = config.appKey;
|
|
24
|
+
YouVersionPlatformConfiguration.apiHost = config.apiHost ?? "api.youversion.com";
|
|
25
|
+
if (typeof window !== "undefined") {
|
|
26
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
27
|
+
const isOAuthCallback = urlParams.has("state") || urlParams.has("error");
|
|
28
|
+
if (isOAuthCallback) {
|
|
29
|
+
try {
|
|
30
|
+
const result = await YouVersionAPIUsers.handleAuthCallback();
|
|
31
|
+
if (result && YouVersionPlatformConfiguration.idToken) {
|
|
32
|
+
const info = YouVersionAPIUsers.userInfo(YouVersionPlatformConfiguration.idToken);
|
|
33
|
+
if (!mounted) return;
|
|
34
|
+
setUserInfo(info);
|
|
35
|
+
}
|
|
36
|
+
} catch (err) {
|
|
37
|
+
if (!mounted) return;
|
|
38
|
+
setError(err);
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
const refreshToken = YouVersionPlatformConfiguration.refreshToken;
|
|
42
|
+
if (refreshToken) {
|
|
43
|
+
try {
|
|
44
|
+
await YouVersionAPIUsers.refreshTokenIfNeeded();
|
|
45
|
+
const idToken = YouVersionPlatformConfiguration.idToken;
|
|
46
|
+
if (idToken) {
|
|
47
|
+
const info = YouVersionAPIUsers.userInfo(idToken);
|
|
48
|
+
if (!mounted) return;
|
|
49
|
+
setUserInfo(info);
|
|
50
|
+
} else {
|
|
51
|
+
if (!mounted) return;
|
|
52
|
+
setUserInfo(null);
|
|
53
|
+
}
|
|
54
|
+
} catch {
|
|
55
|
+
if (!mounted) return;
|
|
56
|
+
setUserInfo(null);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (!mounted) return;
|
|
62
|
+
setIsLoading(false);
|
|
63
|
+
};
|
|
64
|
+
void initAuth();
|
|
65
|
+
return () => {
|
|
66
|
+
mounted = false;
|
|
67
|
+
};
|
|
68
|
+
}, []);
|
|
69
|
+
const value = {
|
|
70
|
+
userInfo,
|
|
71
|
+
setUserInfo,
|
|
72
|
+
isLoading,
|
|
73
|
+
error,
|
|
74
|
+
redirectUri: config.redirectUri
|
|
75
|
+
};
|
|
76
|
+
return /* @__PURE__ */ jsx(YouVersionAuthContext.Provider, { value, children });
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
YouVersionAuthProvider as default
|
|
80
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/context/YouVersionAuthContext.tsx
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
var YouVersionAuthContext = createContext(null);
|
|
4
|
+
function useYouVersionAuthContext() {
|
|
5
|
+
const context = useContext(YouVersionAuthContext);
|
|
6
|
+
if (!context) {
|
|
7
|
+
throw new Error(
|
|
8
|
+
"useYouVersionAuthContext must be used within an auth provider. Make sure your app is wrapped with <YouVersionAuthProvider> from @youversion/platform-react-hooks or create your own provider using YouVersionAuthContext from @youversion/platform-react-hooks."
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
return context;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
YouVersionAuthContext,
|
|
16
|
+
useYouVersionAuthContext
|
|
17
|
+
};
|