@stytch/react 19.4.3 → 19.5.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +7 -7
  3. package/b2b/headless/package.json +6 -0
  4. package/b2b/ui/package.json +6 -0
  5. package/dist/StytchB2BContext-9c062712.d.ts +272 -0
  6. package/dist/{StytchB2BContext-081081ee.js → StytchB2BContext-9c062712.js} +94 -49
  7. package/dist/StytchB2BContext-c5062f9b.d.ts +272 -0
  8. package/dist/StytchB2BContext-c5062f9b.js +280 -0
  9. package/dist/StytchSSRProxy-34c789b5.d.ts +3 -0
  10. package/dist/StytchSSRProxy-34c789b5.js +48 -0
  11. package/dist/StytchSSRProxy-86bc42b3.d.ts +3 -0
  12. package/dist/StytchSSRProxy-86bc42b3.js +54 -0
  13. package/dist/adminPortal/index.d.ts +1 -1
  14. package/dist/adminPortal/index.esm.d.ts +1 -1
  15. package/dist/adminPortal/index.esm.js +5 -4
  16. package/dist/adminPortal/index.js +5 -4
  17. package/dist/b2b/index.d.ts +180 -19
  18. package/dist/b2b/index.esm.d.ts +180 -19
  19. package/dist/b2b/index.esm.js +91 -18
  20. package/dist/b2b/index.headless.d.ts +16 -0
  21. package/dist/b2b/index.headless.esm.d.ts +16 -0
  22. package/dist/b2b/index.headless.esm.js +24 -0
  23. package/dist/b2b/index.headless.js +28 -0
  24. package/dist/b2b/index.js +99 -26
  25. package/dist/b2b/index.ui.d.ts +17 -0
  26. package/dist/b2b/index.ui.esm.d.ts +17 -0
  27. package/dist/b2b/index.ui.esm.js +25 -0
  28. package/dist/b2b/index.ui.js +29 -0
  29. package/dist/errors-d9d5fbc8.d.ts +5 -0
  30. package/dist/index-b14d4efe.d.ts +1 -1
  31. package/dist/index.d.ts +134 -77
  32. package/dist/index.esm.d.ts +134 -77
  33. package/dist/index.esm.js +153 -94
  34. package/dist/index.headless.d.ts +16 -0
  35. package/dist/index.headless.esm.d.ts +16 -0
  36. package/dist/index.headless.esm.js +24 -0
  37. package/dist/index.headless.js +28 -0
  38. package/dist/index.js +167 -108
  39. package/dist/index.ui.d.ts +17 -0
  40. package/dist/index.ui.esm.d.ts +17 -0
  41. package/dist/index.ui.esm.js +25 -0
  42. package/dist/index.ui.js +29 -0
  43. package/dist/useIsomorphicLayoutEffect-1babb81e.d.ts +24 -0
  44. package/dist/{invariant-568a7633.js → useIsomorphicLayoutEffect-1babb81e.js} +5 -13
  45. package/dist/useIsomorphicLayoutEffect-65746ef3.d.ts +24 -0
  46. package/dist/{invariant-ae5a5bce.js → useIsomorphicLayoutEffect-65746ef3.js} +4 -16
  47. package/package.json +5 -3
  48. package/dist/StytchB2BContext-081081ee.d.ts +0 -165
  49. package/dist/StytchB2BContext-865b6947.d.ts +0 -165
  50. package/dist/StytchB2BContext-865b6947.js +0 -235
  51. package/dist/invariant-568a7633.d.ts +0 -27
  52. package/dist/invariant-ae5a5bce.d.ts +0 -27
@@ -1,14 +1,15 @@
1
- import { u as useIsMounted__INTERNAL, a as useStytchB2BClient, i as isUIClient, b as useStytchMember } from '../StytchB2BContext-081081ee.js';
2
- export { S as StytchB2BProvider, a as useStytchB2BClient, d as useStytchIsAuthorized, b as useStytchMember, c as useStytchMemberSession, e as useStytchOrganization, w as withStytchB2BClient, g as withStytchMember, f as withStytchMemberSession, h as withStytchOrganization, j as withStytchPermissions } from '../StytchB2BContext-081081ee.js';
3
- import React, { useRef, useLayoutEffect } from 'react';
4
- import { i as invariant, b as noHeadlessClientError, n as noProviderError } from '../invariant-568a7633.js';
1
+ import React, { useRef } from 'react';
2
+ import { u as useIsMounted__INTERNAL, a as useStytchB2BClient, i as isUIClient, b as useStytchMember$1, c as useStytchMemberSession$1, d as useStytchOrganization$1, e as useStytchIsAuthorized$1, w as withStytchMember$1, f as withStytchMemberSession$1, g as withStytchOrganization$1, S as StytchB2BProvider$1 } from '../StytchB2BContext-9c062712.js';
3
+ export { a as useStytchB2BClient, h as withStytchB2BClient, j as withStytchPermissions } from '../StytchB2BContext-9c062712.js';
4
+ import { i as invariant, a as useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect-1babb81e.js';
5
+ import { a as noHeadlessClientError, n as noProviderError } from '../StytchSSRProxy-34c789b5.js';
5
6
 
6
7
  /**
7
8
  * The Stytch B2B UI component.
8
- * This component can only be used with a {@link StytchB2BUIClient} client constructor
9
- * passed into the {@link StytchB2BProvider}
9
+ * This component can only be used with a Stytch B2B UI Client
10
+ * passed into the StytchB2BProvider.
10
11
  *
11
- * See the {@link https://stytch.com/docs/b2b/sdks/javascript-sdk online reference}
12
+ * See the {@link https://stytch.com/docs/b2b/sdks online reference}
12
13
  *
13
14
  * @example
14
15
  * <StytchB2B
@@ -35,13 +36,12 @@ import { i as invariant, b as noHeadlessClientError, n as noProviderError } from
35
36
  * onEvent: (event) => console.log(event)
36
37
  * }}
37
38
  * />
38
- * @param props {@link StytchB2BProps}
39
39
  */
40
40
  const StytchB2B = ({ styles, callbacks, config, }) => {
41
41
  invariant(useIsMounted__INTERNAL(), noProviderError('<StytchB2B />', 'StytchB2BProvider'));
42
42
  const stytchClient = useStytchB2BClient();
43
43
  const containerEl = useRef(null);
44
- useLayoutEffect(() => {
44
+ useIsomorphicLayoutEffect(() => {
45
45
  if (!isUIClient(stytchClient)) {
46
46
  throw Error(noHeadlessClientError);
47
47
  }
@@ -66,10 +66,10 @@ const StytchB2B = ({ styles, callbacks, config, }) => {
66
66
  * The Stytch B2B IDP component.
67
67
  * Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
68
68
  * Requires the user to be logged in.
69
- * This component can only be used with a {@link StytchB2BUIClient} client constructor
70
- * passed into the {@link StytchB2BProvider}
69
+ * This component can only be used with a Stytch B2B UI Client
70
+ * passed into the StytchB2BProvider.
71
71
  *
72
- * See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
72
+ * See the {@link https://stytch.com/docs/b2b/sdks online reference}
73
73
  *
74
74
  * @example
75
75
  * const styles = {
@@ -88,16 +88,13 @@ const StytchB2B = ({ styles, callbacks, config, }) => {
88
88
  * onEvent: (event) => console.log(event)
89
89
  * }}
90
90
  * />
91
- * @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
92
- * @param callbacks - An optional {@link Callbacks} object
93
- * @param getIDPConsentManifest - Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
94
91
  */
95
92
  const B2BIdentityProvider = ({ styles, callbacks, getIDPConsentManifest }) => {
96
93
  invariant(useIsMounted__INTERNAL(), noProviderError('<IdentityProvider />'));
97
94
  const stytchClient = useStytchB2BClient();
98
- const { member } = useStytchMember();
95
+ const { member } = useStytchMember$1();
99
96
  const containerEl = useRef(null);
100
- useLayoutEffect(() => {
97
+ useIsomorphicLayoutEffect(() => {
101
98
  if (!isUIClient(stytchClient)) {
102
99
  throw Error(noHeadlessClientError);
103
100
  }
@@ -118,4 +115,80 @@ const B2BIdentityProvider = ({ styles, callbacks, getIDPConsentManifest }) => {
118
115
  return React.createElement("div", { ref: containerEl });
119
116
  };
120
117
 
121
- export { B2BIdentityProvider, StytchB2B };
118
+ /**
119
+ * Returns the active Member.
120
+ * The Stytch SDKs are used for client-side authentication and session management.
121
+ * Check the isInitialized property to determine if the SDK has completed initialization.
122
+ * Check the fromCache property to determine if the member data is from persistent storage.
123
+ * @example
124
+ * const {member, isInitialized, fromCache} = useStytchMember();
125
+ * if (!isInitialized) {
126
+ * return <p>Loading...</p>;
127
+ * }
128
+ * return (<h1>Welcome, {member.name}</h1>);
129
+ */
130
+ const useStytchMember = useStytchMember$1;
131
+ /**
132
+ * Returns the active member's Stytch member session.
133
+ * The Stytch SDKs are used for client-side authentication and session management.
134
+ * Check the isInitialized property to determine if the SDK has completed initialization.
135
+ * Check the fromCache property to determine if the session data is from persistent storage.
136
+ * @example
137
+ * const {session, isInitialized, fromCache} = useStytchMemberSession();
138
+ * useEffect(() => {
139
+ * if (!isInitialized) {
140
+ * return;
141
+ * }
142
+ * if (!session) {
143
+ * router.replace('/login')
144
+ * }
145
+ * }, [session, isInitialized]);
146
+ */
147
+ const useStytchMemberSession = useStytchMemberSession$1;
148
+ /**
149
+ * Returns the active Stytch organization.
150
+ * The Stytch SDKs are used for client-side authentication and session management.
151
+ * Check the isInitialized property to determine if the SDK has completed initialization.
152
+ * Check the fromCache property to determine if the organization data is from persistent storage.
153
+ * @example
154
+ * const {organization, isInitialized, fromCache} = useStytchOrganization();
155
+ * if (!isInitialized) {
156
+ * return <p>Loading...</p>;
157
+ * }
158
+ * return (<p>Welcome to {organization.organization_name}</p>);
159
+ */
160
+ const useStytchOrganization = useStytchOrganization$1;
161
+ /**
162
+ * Determines whether the logged-in member is allowed to perform the specified action on the specified resource.
163
+ * Returns `true` if the member can perform the action, `false` otherwise.
164
+ *
165
+ * If the member is not logged in, this method will always return false.
166
+ * If the resource or action provided are not valid for the configured RBAC policy, this method will return false.
167
+ *
168
+ * Remember - authorization checks for sensitive actions should always occur on the backend as well.
169
+ * @example
170
+ * const { isAuthorized } = useStytchIsAuthorized<Permissions>('documents', 'edit');
171
+ * return <button disabled={!isAuthorized}>Edit</button>
172
+ */
173
+ const useStytchIsAuthorized = useStytchIsAuthorized$1;
174
+ const withStytchMember = withStytchMember$1;
175
+ const withStytchMemberSession = withStytchMemberSession$1;
176
+ const withStytchOrganization = withStytchOrganization$1;
177
+ /**
178
+ * The Stytch Context Provider.
179
+ * Wrap your application with this component in order to use Stytch everywhere in your app.
180
+ * @example
181
+ * const stytch = createStytchB2BHeadlessClient('public-token-<find yours in the stytch dashboard>')
182
+ *
183
+ * ReactDOM.render(
184
+ * <StytchB2BProvider stytch={stytch}>
185
+ * <App />
186
+ * </StytchProvider>,
187
+ * document.getElementById('root'),
188
+ * )
189
+ */
190
+ const StytchB2BProvider = ({ stytch, children, assumeHydrated = true, }) => {
191
+ return (React.createElement(StytchB2BProvider$1, { stytch: stytch, assumeHydrated: assumeHydrated }, children));
192
+ };
193
+
194
+ export { B2BIdentityProvider, StytchB2B, StytchB2BProvider, useStytchIsAuthorized, useStytchMember, useStytchMemberSession, useStytchOrganization, withStytchMember, withStytchMemberSession, withStytchOrganization };
@@ -0,0 +1,16 @@
1
+ import { StytchB2BHeadlessClient } from "@stytch/vanilla-js/b2b/headless";
2
+ /**
3
+ * Creates a Headless Stytch client object to call the stytch B2B APIs.
4
+ * The Stytch client is not available serverside.
5
+ * @example
6
+ * const stytch = createStytchB2BHeadlessClient('public-token-<find yours in the stytch dashboard>')
7
+ *
8
+ * return (
9
+ * <StytchB2BProvider stytch={stytch}>
10
+ * <App />
11
+ * </StytchB2BProvider>
12
+ * )
13
+ * @returns A {@link StytchB2BHeadlessClient}
14
+ */
15
+ declare const createStytchB2BHeadlessClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(_PUBLIC_TOKEN: string, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchB2BHeadlessClient<TProjectConfiguration>;
16
+ export { createStytchB2BHeadlessClient };
@@ -0,0 +1,16 @@
1
+ import { StytchB2BHeadlessClient } from "@stytch/vanilla-js/b2b/headless";
2
+ /**
3
+ * Creates a Headless Stytch client object to call the stytch B2B APIs.
4
+ * The Stytch client is not available serverside.
5
+ * @example
6
+ * const stytch = createStytchB2BHeadlessClient('public-token-<find yours in the stytch dashboard>')
7
+ *
8
+ * return (
9
+ * <StytchB2BProvider stytch={stytch}>
10
+ * <App />
11
+ * </StytchB2BProvider>
12
+ * )
13
+ * @returns A {@link StytchB2BHeadlessClient}
14
+ */
15
+ declare const createStytchB2BHeadlessClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(_PUBLIC_TOKEN: string, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchB2BHeadlessClient<TProjectConfiguration>;
16
+ export { createStytchB2BHeadlessClient };
@@ -0,0 +1,24 @@
1
+ import { StytchB2BHeadlessClient } from '@stytch/vanilla-js/b2b/headless';
2
+ import { c as createStytchSSRProxy } from '../StytchSSRProxy-34c789b5.js';
3
+
4
+ /**
5
+ * Creates a Headless Stytch client object to call the stytch B2B APIs.
6
+ * The Stytch client is not available serverside.
7
+ * @example
8
+ * const stytch = createStytchB2BHeadlessClient('public-token-<find yours in the stytch dashboard>')
9
+ *
10
+ * return (
11
+ * <StytchB2BProvider stytch={stytch}>
12
+ * <App />
13
+ * </StytchB2BProvider>
14
+ * )
15
+ * @returns A {@link StytchB2BHeadlessClient}
16
+ */
17
+ const createStytchB2BHeadlessClient = (...args) => {
18
+ if (typeof window === 'undefined') {
19
+ return createStytchSSRProxy();
20
+ }
21
+ return new StytchB2BHeadlessClient(...args);
22
+ };
23
+
24
+ export { createStytchB2BHeadlessClient };
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var headless = require('@stytch/vanilla-js/b2b/headless');
6
+ var StytchSSRProxy = require('../StytchSSRProxy-86bc42b3.js');
7
+
8
+ /**
9
+ * Creates a Headless Stytch client object to call the stytch B2B APIs.
10
+ * The Stytch client is not available serverside.
11
+ * @example
12
+ * const stytch = createStytchB2BHeadlessClient('public-token-<find yours in the stytch dashboard>')
13
+ *
14
+ * return (
15
+ * <StytchB2BProvider stytch={stytch}>
16
+ * <App />
17
+ * </StytchB2BProvider>
18
+ * )
19
+ * @returns A {@link StytchB2BHeadlessClient}
20
+ */
21
+ const createStytchB2BHeadlessClient = (...args) => {
22
+ if (typeof window === 'undefined') {
23
+ return StytchSSRProxy.createStytchSSRProxy();
24
+ }
25
+ return new headless.StytchB2BHeadlessClient(...args);
26
+ };
27
+
28
+ exports.createStytchB2BHeadlessClient = createStytchB2BHeadlessClient;
package/dist/b2b/index.js CHANGED
@@ -2,9 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var StytchB2BContext = require('../StytchB2BContext-865b6947.js');
6
5
  var React = require('react');
7
- var invariant = require('../invariant-ae5a5bce.js');
6
+ var StytchB2BContext = require('../StytchB2BContext-c5062f9b.js');
7
+ var useIsomorphicLayoutEffect = require('../useIsomorphicLayoutEffect-65746ef3.js');
8
+ var StytchSSRProxy = require('../StytchSSRProxy-86bc42b3.js');
8
9
 
9
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
11
 
@@ -12,10 +13,10 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
13
 
13
14
  /**
14
15
  * The Stytch B2B UI component.
15
- * This component can only be used with a {@link StytchB2BUIClient} client constructor
16
- * passed into the {@link StytchB2BProvider}
16
+ * This component can only be used with a Stytch B2B UI Client
17
+ * passed into the StytchB2BProvider.
17
18
  *
18
- * See the {@link https://stytch.com/docs/b2b/sdks/javascript-sdk online reference}
19
+ * See the {@link https://stytch.com/docs/b2b/sdks online reference}
19
20
  *
20
21
  * @example
21
22
  * <StytchB2B
@@ -42,15 +43,14 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
42
43
  * onEvent: (event) => console.log(event)
43
44
  * }}
44
45
  * />
45
- * @param props {@link StytchB2BProps}
46
46
  */
47
47
  const StytchB2B = ({ styles, callbacks, config, }) => {
48
- invariant.invariant(StytchB2BContext.useIsMounted__INTERNAL(), invariant.noProviderError('<StytchB2B />', 'StytchB2BProvider'));
48
+ useIsomorphicLayoutEffect.invariant(StytchB2BContext.useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('<StytchB2B />', 'StytchB2BProvider'));
49
49
  const stytchClient = StytchB2BContext.useStytchB2BClient();
50
50
  const containerEl = React.useRef(null);
51
- React.useLayoutEffect(() => {
51
+ useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(() => {
52
52
  if (!StytchB2BContext.isUIClient(stytchClient)) {
53
- throw Error(invariant.noHeadlessClientError);
53
+ throw Error(StytchSSRProxy.noHeadlessClientError);
54
54
  }
55
55
  if (!containerEl.current) {
56
56
  return;
@@ -73,10 +73,10 @@ const StytchB2B = ({ styles, callbacks, config, }) => {
73
73
  * The Stytch B2B IDP component.
74
74
  * Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
75
75
  * Requires the user to be logged in.
76
- * This component can only be used with a {@link StytchB2BUIClient} client constructor
77
- * passed into the {@link StytchB2BProvider}
76
+ * This component can only be used with a Stytch B2B UI Client
77
+ * passed into the StytchB2BProvider.
78
78
  *
79
- * See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
79
+ * See the {@link https://stytch.com/docs/b2b/sdks online reference}
80
80
  *
81
81
  * @example
82
82
  * const styles = {
@@ -95,18 +95,15 @@ const StytchB2B = ({ styles, callbacks, config, }) => {
95
95
  * onEvent: (event) => console.log(event)
96
96
  * }}
97
97
  * />
98
- * @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
99
- * @param callbacks - An optional {@link Callbacks} object
100
- * @param getIDPConsentManifest - Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
101
98
  */
102
99
  const B2BIdentityProvider = ({ styles, callbacks, getIDPConsentManifest }) => {
103
- invariant.invariant(StytchB2BContext.useIsMounted__INTERNAL(), invariant.noProviderError('<IdentityProvider />'));
100
+ useIsomorphicLayoutEffect.invariant(StytchB2BContext.useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('<IdentityProvider />'));
104
101
  const stytchClient = StytchB2BContext.useStytchB2BClient();
105
102
  const { member } = StytchB2BContext.useStytchMember();
106
103
  const containerEl = React.useRef(null);
107
- React.useLayoutEffect(() => {
104
+ useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(() => {
108
105
  if (!StytchB2BContext.isUIClient(stytchClient)) {
109
- throw Error(invariant.noHeadlessClientError);
106
+ throw Error(StytchSSRProxy.noHeadlessClientError);
110
107
  }
111
108
  if (!containerEl.current) {
112
109
  return;
@@ -125,16 +122,92 @@ const B2BIdentityProvider = ({ styles, callbacks, getIDPConsentManifest }) => {
125
122
  return React__default["default"].createElement("div", { ref: containerEl });
126
123
  };
127
124
 
128
- exports.StytchB2BProvider = StytchB2BContext.StytchB2BProvider;
125
+ /**
126
+ * Returns the active Member.
127
+ * The Stytch SDKs are used for client-side authentication and session management.
128
+ * Check the isInitialized property to determine if the SDK has completed initialization.
129
+ * Check the fromCache property to determine if the member data is from persistent storage.
130
+ * @example
131
+ * const {member, isInitialized, fromCache} = useStytchMember();
132
+ * if (!isInitialized) {
133
+ * return <p>Loading...</p>;
134
+ * }
135
+ * return (<h1>Welcome, {member.name}</h1>);
136
+ */
137
+ const useStytchMember = StytchB2BContext.useStytchMember;
138
+ /**
139
+ * Returns the active member's Stytch member session.
140
+ * The Stytch SDKs are used for client-side authentication and session management.
141
+ * Check the isInitialized property to determine if the SDK has completed initialization.
142
+ * Check the fromCache property to determine if the session data is from persistent storage.
143
+ * @example
144
+ * const {session, isInitialized, fromCache} = useStytchMemberSession();
145
+ * useEffect(() => {
146
+ * if (!isInitialized) {
147
+ * return;
148
+ * }
149
+ * if (!session) {
150
+ * router.replace('/login')
151
+ * }
152
+ * }, [session, isInitialized]);
153
+ */
154
+ const useStytchMemberSession = StytchB2BContext.useStytchMemberSession;
155
+ /**
156
+ * Returns the active Stytch organization.
157
+ * The Stytch SDKs are used for client-side authentication and session management.
158
+ * Check the isInitialized property to determine if the SDK has completed initialization.
159
+ * Check the fromCache property to determine if the organization data is from persistent storage.
160
+ * @example
161
+ * const {organization, isInitialized, fromCache} = useStytchOrganization();
162
+ * if (!isInitialized) {
163
+ * return <p>Loading...</p>;
164
+ * }
165
+ * return (<p>Welcome to {organization.organization_name}</p>);
166
+ */
167
+ const useStytchOrganization = StytchB2BContext.useStytchOrganization;
168
+ /**
169
+ * Determines whether the logged-in member is allowed to perform the specified action on the specified resource.
170
+ * Returns `true` if the member can perform the action, `false` otherwise.
171
+ *
172
+ * If the member is not logged in, this method will always return false.
173
+ * If the resource or action provided are not valid for the configured RBAC policy, this method will return false.
174
+ *
175
+ * Remember - authorization checks for sensitive actions should always occur on the backend as well.
176
+ * @example
177
+ * const { isAuthorized } = useStytchIsAuthorized<Permissions>('documents', 'edit');
178
+ * return <button disabled={!isAuthorized}>Edit</button>
179
+ */
180
+ const useStytchIsAuthorized = StytchB2BContext.useStytchIsAuthorized;
181
+ const withStytchMember = StytchB2BContext.withStytchMember;
182
+ const withStytchMemberSession = StytchB2BContext.withStytchMemberSession;
183
+ const withStytchOrganization = StytchB2BContext.withStytchOrganization;
184
+ /**
185
+ * The Stytch Context Provider.
186
+ * Wrap your application with this component in order to use Stytch everywhere in your app.
187
+ * @example
188
+ * const stytch = createStytchB2BHeadlessClient('public-token-<find yours in the stytch dashboard>')
189
+ *
190
+ * ReactDOM.render(
191
+ * <StytchB2BProvider stytch={stytch}>
192
+ * <App />
193
+ * </StytchProvider>,
194
+ * document.getElementById('root'),
195
+ * )
196
+ */
197
+ const StytchB2BProvider = ({ stytch, children, assumeHydrated = true, }) => {
198
+ return (React__default["default"].createElement(StytchB2BContext.StytchB2BProvider, { stytch: stytch, assumeHydrated: assumeHydrated }, children));
199
+ };
200
+
129
201
  exports.useStytchB2BClient = StytchB2BContext.useStytchB2BClient;
130
- exports.useStytchIsAuthorized = StytchB2BContext.useStytchIsAuthorized;
131
- exports.useStytchMember = StytchB2BContext.useStytchMember;
132
- exports.useStytchMemberSession = StytchB2BContext.useStytchMemberSession;
133
- exports.useStytchOrganization = StytchB2BContext.useStytchOrganization;
134
202
  exports.withStytchB2BClient = StytchB2BContext.withStytchB2BClient;
135
- exports.withStytchMember = StytchB2BContext.withStytchMember;
136
- exports.withStytchMemberSession = StytchB2BContext.withStytchMemberSession;
137
- exports.withStytchOrganization = StytchB2BContext.withStytchOrganization;
138
203
  exports.withStytchPermissions = StytchB2BContext.withStytchPermissions;
139
204
  exports.B2BIdentityProvider = B2BIdentityProvider;
140
205
  exports.StytchB2B = StytchB2B;
206
+ exports.StytchB2BProvider = StytchB2BProvider;
207
+ exports.useStytchIsAuthorized = useStytchIsAuthorized;
208
+ exports.useStytchMember = useStytchMember;
209
+ exports.useStytchMemberSession = useStytchMemberSession;
210
+ exports.useStytchOrganization = useStytchOrganization;
211
+ exports.withStytchMember = withStytchMember;
212
+ exports.withStytchMemberSession = withStytchMemberSession;
213
+ exports.withStytchOrganization = withStytchOrganization;
@@ -0,0 +1,17 @@
1
+ import { StytchB2BUIClient } from "@stytch/vanilla-js/b2b";
2
+ /**
3
+ * Creates a Stytch UI client object to call the Stytch APIs and render Stytch UI components.
4
+ * The Stytch client is not available serverside.
5
+ * If you do not use Stytch UI components, use {@link createStytchB2BHeadlessClient} to reduce your bundle size.
6
+ * @example
7
+ * const stytch = createStytchB2BUIClient('public-token-<find yours in the stytch dashboard>')
8
+ *
9
+ * return (
10
+ * <StytchB2BProvider stytch={stytch}>
11
+ * <App />
12
+ * </StytchB2BProvider>
13
+ * )
14
+ * @returns A {@link StytchB2BUIClient}
15
+ */
16
+ declare const createStytchB2BUIClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(_PUBLIC_TOKEN: string, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchB2BUIClient<TProjectConfiguration>;
17
+ export { createStytchB2BUIClient };
@@ -0,0 +1,17 @@
1
+ import { StytchB2BUIClient } from "@stytch/vanilla-js/b2b";
2
+ /**
3
+ * Creates a Stytch UI client object to call the Stytch APIs and render Stytch UI components.
4
+ * The Stytch client is not available serverside.
5
+ * If you do not use Stytch UI components, use {@link createStytchB2BHeadlessClient} to reduce your bundle size.
6
+ * @example
7
+ * const stytch = createStytchB2BUIClient('public-token-<find yours in the stytch dashboard>')
8
+ *
9
+ * return (
10
+ * <StytchB2BProvider stytch={stytch}>
11
+ * <App />
12
+ * </StytchB2BProvider>
13
+ * )
14
+ * @returns A {@link StytchB2BUIClient}
15
+ */
16
+ declare const createStytchB2BUIClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(_PUBLIC_TOKEN: string, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchB2BUIClient<TProjectConfiguration>;
17
+ export { createStytchB2BUIClient };
@@ -0,0 +1,25 @@
1
+ import { StytchB2BUIClient } from '@stytch/vanilla-js/b2b';
2
+ import { c as createStytchSSRProxy } from '../StytchSSRProxy-34c789b5.js';
3
+
4
+ /**
5
+ * Creates a Stytch UI client object to call the Stytch APIs and render Stytch UI components.
6
+ * The Stytch client is not available serverside.
7
+ * If you do not use Stytch UI components, use {@link createStytchB2BHeadlessClient} to reduce your bundle size.
8
+ * @example
9
+ * const stytch = createStytchB2BUIClient('public-token-<find yours in the stytch dashboard>')
10
+ *
11
+ * return (
12
+ * <StytchB2BProvider stytch={stytch}>
13
+ * <App />
14
+ * </StytchB2BProvider>
15
+ * )
16
+ * @returns A {@link StytchB2BUIClient}
17
+ */
18
+ const createStytchB2BUIClient = (...args) => {
19
+ if (typeof window === 'undefined') {
20
+ return createStytchSSRProxy();
21
+ }
22
+ return new StytchB2BUIClient(...args);
23
+ };
24
+
25
+ export { createStytchB2BUIClient };
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var b2b = require('@stytch/vanilla-js/b2b');
6
+ var StytchSSRProxy = require('../StytchSSRProxy-86bc42b3.js');
7
+
8
+ /**
9
+ * Creates a Stytch UI client object to call the Stytch APIs and render Stytch UI components.
10
+ * The Stytch client is not available serverside.
11
+ * If you do not use Stytch UI components, use {@link createStytchB2BHeadlessClient} to reduce your bundle size.
12
+ * @example
13
+ * const stytch = createStytchB2BUIClient('public-token-<find yours in the stytch dashboard>')
14
+ *
15
+ * return (
16
+ * <StytchB2BProvider stytch={stytch}>
17
+ * <App />
18
+ * </StytchB2BProvider>
19
+ * )
20
+ * @returns A {@link StytchB2BUIClient}
21
+ */
22
+ const createStytchB2BUIClient = (...args) => {
23
+ if (typeof window === 'undefined') {
24
+ return StytchSSRProxy.createStytchSSRProxy();
25
+ }
26
+ return new b2b.StytchB2BUIClient(...args);
27
+ };
28
+
29
+ exports.createStytchB2BUIClient = createStytchB2BUIClient;
@@ -0,0 +1,5 @@
1
+ declare const noProviderError: (item: string, provider?: string) => string;
2
+ declare const providerMustBeUniqueError = "You cannot render a <StytchProvider> inside another <StytchProvider>.";
3
+ declare const noHeadlessClientError = "Tried to create a Stytch Login UI element using the Stytch Headless SDK.\nYou must use the UI SDK to use UI elements.\nPlease make sure you are using a Stytch UI client, not a Stytch Headless client.";
4
+ declare const cannotInvokeMethodOnServerError: (path: string) => string;
5
+ export { noProviderError, providerMustBeUniqueError, noHeadlessClientError, cannotInvokeMethodOnServerError };
@@ -1,2 +1,2 @@
1
1
  export { createDeepEqual } from "./createDeepEqual-5555f2e1.js";
2
- export { mergeWithStableProps } from "./invariant-568a7633.js";
2
+ export { mergeWithStableProps } from "./useIsomorphicLayoutEffect-1babb81e.js";