@youversion/platform-react-ui 0.6.0 → 0.7.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/README.md +6 -6
- package/dist/components/SignInButton.d.ts +5 -15
- package/dist/components/SignInButton.d.ts.map +1 -1
- package/dist/components/SignInButton.stories.d.ts +2 -12
- package/dist/components/SignInButton.stories.d.ts.map +1 -1
- package/dist/components/verse-of-the-day.stories.d.ts.map +1 -1
- package/dist/index.cjs +600 -645
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +592 -634
- package/dist/tailwind.css +1 -1
- package/package.json +5 -5
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/useAuthentication.d.ts +0 -8
- package/dist/hooks/useAuthentication.d.ts.map +0 -1
- package/dist/providers/YVPErrorBoundary.d.ts +0 -17
- package/dist/providers/YVPErrorBoundary.d.ts.map +0 -1
- package/dist/providers/YVPErrorBoundary.test.d.ts +0 -2
- package/dist/providers/YVPErrorBoundary.test.d.ts.map +0 -1
- package/dist/providers/YVPProvider.d.ts +0 -20
- package/dist/providers/YVPProvider.d.ts.map +0 -1
- package/dist/providers/index.d.ts +0 -3
- package/dist/providers/index.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -30,13 +30,13 @@ Get your App Key at [platform.youversion.com](https://platform.youversion.com/)
|
|
|
30
30
|
Wrap your app with the provider and use components:
|
|
31
31
|
|
|
32
32
|
```tsx
|
|
33
|
-
import {
|
|
33
|
+
import { YouVersionProvider, BibleTextView } from '@youversion/platform-react-ui';
|
|
34
34
|
|
|
35
35
|
function App() {
|
|
36
36
|
return (
|
|
37
|
-
<
|
|
37
|
+
<YouVersionProvider appKey={"YOUR_APP_KEY"}>
|
|
38
38
|
<BibleTextView reference="JHN.1.1-4" versionId={111} />
|
|
39
|
-
</
|
|
39
|
+
</YouVersionProvider>
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
```
|
|
@@ -47,20 +47,20 @@ Toggle theme via the `YVPProvider`:
|
|
|
47
47
|
|
|
48
48
|
```tsx
|
|
49
49
|
import { useState } from 'react';
|
|
50
|
-
import {
|
|
50
|
+
import { YouVersionProvider, YVPProvider, BibleTextView } from '@youversion/platform-react-ui';
|
|
51
51
|
|
|
52
52
|
export default function App() {
|
|
53
53
|
const [theme, setTheme] = useState<'light' | 'dark'>('light');
|
|
54
54
|
|
|
55
55
|
return (
|
|
56
|
-
<
|
|
56
|
+
<YouVersionProvider appKey="YOUR_APP_KEY">
|
|
57
57
|
<YVPProvider config={{ appKey: "YOUR_APP_KEY" }} theme={theme}>
|
|
58
58
|
<button onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}>
|
|
59
59
|
Toggle theme
|
|
60
60
|
</button>
|
|
61
61
|
<BibleTextView reference="JHN.1.1-4" versionId={111} />
|
|
62
62
|
</YVPProvider>
|
|
63
|
-
</
|
|
63
|
+
</YouVersionProvider>
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
66
|
```
|
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type SignInWithYouVersionPermissionValues
|
|
2
|
+
import { type SignInWithYouVersionPermissionValues } from '@youversion/platform-core';
|
|
3
3
|
interface SignInAuthProps {
|
|
4
4
|
/**
|
|
5
5
|
* Called when the sign-in flow fails.
|
|
6
6
|
* @param error - The error thrown by the sign-in flow.
|
|
7
7
|
*/
|
|
8
8
|
onAuthError?: (error: Error) => void;
|
|
9
|
-
/**
|
|
10
|
-
* Called when the sign-in flow succeeds.
|
|
11
|
-
* @param result - The result of the sign-in flow.
|
|
12
|
-
*/
|
|
13
|
-
onSuccess?: (result: SignInWithYouVersionResult) => void;
|
|
14
9
|
/**
|
|
15
10
|
* Permissions that are requested but not required for sign-in to succeed.
|
|
16
11
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* Permissions that must be granted for sign-in to succeed.
|
|
20
|
-
*/
|
|
21
|
-
requiredPermissions?: SignInWithYouVersionPermissionValues[];
|
|
12
|
+
permissions?: SignInWithYouVersionPermissionValues[];
|
|
13
|
+
redirectUrl: string;
|
|
22
14
|
}
|
|
23
15
|
export interface SignInButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, SignInAuthProps {
|
|
24
16
|
/**
|
|
@@ -55,7 +47,6 @@ export interface SignInButtonProps extends React.ButtonHTMLAttributes<HTMLButton
|
|
|
55
47
|
*
|
|
56
48
|
* Key behaviors:
|
|
57
49
|
* - Prevents default click behavior and triggers the SDK `signIn` method.
|
|
58
|
-
* - Calls `onSuccess` with the SignInWithYouVersionResult when sign-in succeeds.
|
|
59
50
|
* - Calls `onAuthError` when the underlying sign-in flow throws.
|
|
60
51
|
*
|
|
61
52
|
* @param {SignInButtonProps} props - Component props (see {@link SignInButtonProps}).
|
|
@@ -63,10 +54,10 @@ export interface SignInButtonProps extends React.ButtonHTMLAttributes<HTMLButton
|
|
|
63
54
|
*
|
|
64
55
|
* @example
|
|
65
56
|
* import { SignInButton, SignInWithYouVersionPermission } from '@youversion/platform-react-ui';
|
|
66
|
-
* import {
|
|
57
|
+
* import { useYVAuth } from '@youversion/platform-react-hooks';
|
|
67
58
|
*
|
|
68
59
|
* export default function UnauthenticatedView() {
|
|
69
|
-
* const auth =
|
|
60
|
+
* const { auth } = useYVAuth();
|
|
70
61
|
*
|
|
71
62
|
* return (
|
|
72
63
|
* <div>
|
|
@@ -74,7 +65,6 @@ export interface SignInButtonProps extends React.ButtonHTMLAttributes<HTMLButton
|
|
|
74
65
|
* <SignInButton
|
|
75
66
|
* requiredPermissions={[SignInWithYouVersionPermission.bibles]}
|
|
76
67
|
* optionalPermissions={[SignInWithYouVersionPermission.highlights]}
|
|
77
|
-
* onSuccess={(result) => console.log('signed in', result)}
|
|
78
68
|
* onAuthError={(err) => console.error(err)}
|
|
79
69
|
* />
|
|
80
70
|
* </div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignInButton.d.ts","sourceRoot":"","sources":["../../src/components/SignInButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,
|
|
1
|
+
{"version":3,"file":"SignInButton.d.ts","sourceRoot":"","sources":["../../src/components/SignInButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,oCAAoC,EAAE,MAAM,2BAA2B,CAAC;AAMtF,UAAU,eAAe;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACrC;;OAEG;IACH,WAAW,CAAC,EAAE,oCAAoC,EAAE,CAAC;IACrD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,eAAe;IACjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;IACnC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IACpC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAO,MAAM,YAAY,6FA+GxB,CAAC"}
|
|
@@ -8,7 +8,7 @@ declare const meta: {
|
|
|
8
8
|
tags: string[];
|
|
9
9
|
beforeEach(): Promise<void>;
|
|
10
10
|
args: {
|
|
11
|
-
|
|
11
|
+
redirectUrl: string;
|
|
12
12
|
onAuthError: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
13
13
|
};
|
|
14
14
|
argTypes: {
|
|
@@ -17,17 +17,7 @@ declare const meta: {
|
|
|
17
17
|
disable: true;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
table: {
|
|
22
|
-
disable: true;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
optionalPermissions: {
|
|
26
|
-
table: {
|
|
27
|
-
disable: true;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
requiredPermissions: {
|
|
20
|
+
permissions: {
|
|
31
21
|
table: {
|
|
32
22
|
disable: true;
|
|
33
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignInButton.stories.d.ts","sourceRoot":"","sources":["../../src/components/SignInButton.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQ5D,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"SignInButton.stories.d.ts","sourceRoot":"","sources":["../../src/components/SignInButton.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQ5D,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0D2B,CAAC;AAEtC,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,YAAY,EAAE,KAI1B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAIxB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAK/B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAIvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAK9B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAI5B,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KAKnC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAKjC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,"file":"verse-of-the-day.stories.d.ts","sourceRoot":"","sources":["../../src/components/verse-of-the-day.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,QAAA,MAAM,IAAI;;;;;;;;;yBA2CE,KAAK,CAAC,aAAa,KAAG,KAAK,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCd,CAAC;AAEvC,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAmCrB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAInB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC"}
|