@outseta/react 0.2.4 → 0.3.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 +24 -16
- package/dist/index.js +2363 -16
- package/package.json +2 -2
- package/src/components/AuthCta.tsx +35 -0
- package/src/components/ProtectedRoute.tsx +25 -11
- package/src/components/UpgradeCta.tsx +33 -0
- package/src/components/index.ts +4 -0
- package/src/generated/outsetaAPI.schemas.ts +2 -0
- package/src/index.ts +7 -2
package/README.md
CHANGED
|
@@ -1,29 +1,37 @@
|
|
|
1
1
|
# @outseta/react
|
|
2
2
|
|
|
3
|
-
React
|
|
3
|
+
React components plus generated TanStack Query hooks for Outseta.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Notes
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
- The embed components depend on `window.Outseta`; load Outseta's script in your app shell before using `OutsetaProvider`.
|
|
8
|
+
- In browser apps, create API clients with a user bearer `accessToken`, not API key credentials.
|
|
9
|
+
- Generated hooks require a TanStack `QueryClientProvider` and an Outseta client passed through each hook's `request` option.
|
|
10
|
+
- `ProtectedRoute` renders generic login/signup and manage-subscription CTAs by default. Replace them with `unauthenticated` and `accessDenied` props when your app needs custom UX.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
## Outseta script
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
```html
|
|
15
|
+
<script>
|
|
16
|
+
var o_options = {
|
|
17
|
+
domain: "your-company.outseta.com",
|
|
18
|
+
load: "auth,nocode",
|
|
19
|
+
};
|
|
20
|
+
</script>
|
|
21
|
+
<script src="https://cdn.outseta.com/outseta.min.js" data-options="o_options"></script>
|
|
22
|
+
```
|
|
14
23
|
|
|
15
|
-
##
|
|
24
|
+
## Generated hook request client
|
|
16
25
|
|
|
17
|
-
```
|
|
18
|
-
import { createClient } from "@outseta/react";
|
|
26
|
+
```tsx
|
|
27
|
+
import { createClient, useAccountGetAllAccounts } from "@outseta/react";
|
|
19
28
|
|
|
20
29
|
const client = createClient({
|
|
21
30
|
subdomain: "your-company",
|
|
22
|
-
|
|
23
|
-
apiSecret: "your-api-secret",
|
|
31
|
+
accessToken,
|
|
24
32
|
});
|
|
25
|
-
```
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
const accounts = useAccountGetAllAccounts(undefined, {
|
|
35
|
+
request: client,
|
|
36
|
+
});
|
|
37
|
+
```
|