@stytch/react 0.0.0-rc.2 → 0.0.2-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/dist/index.d.ts CHANGED
@@ -29,4 +29,5 @@ type StytchProviderProps = {
29
29
  children?: React.ReactNode;
30
30
  };
31
31
  declare const StytchProvider: ({ stytch, children }: StytchProviderProps) => JSX.Element;
32
- export { Stytch, useStytchUser, useStytchSession, useStytch, withStytch, withStytchUser, withStytchSession, StytchProviderProps, StytchProvider };
32
+ export { Stytch, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
33
+ export type { StytchProviderProps };
@@ -29,4 +29,5 @@ type StytchProviderProps = {
29
29
  children?: React.ReactNode;
30
30
  };
31
31
  declare const StytchProvider: ({ stytch, children }: StytchProviderProps) => JSX.Element;
32
- export { Stytch, useStytchUser, useStytchSession, useStytch, withStytch, withStytchUser, withStytchSession, StytchProviderProps, StytchProvider };
32
+ export { Stytch, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
33
+ export type { StytchProviderProps };
package/dist/index.esm.js CHANGED
@@ -1,9 +1,11 @@
1
1
  import * as React from 'react';
2
- import { StytchUIClient } from '@stytch/vanilla-js';
3
2
 
4
3
  const StytchUserContext = React.createContext(null);
5
4
  const StytchSessionContext = React.createContext(null);
6
5
  const StytchContext = React.createContext({});
6
+ const isUIClient = (client) => {
7
+ return client.mount !== undefined;
8
+ };
7
9
  const useStytchUser = () => {
8
10
  return React.useContext(StytchUserContext);
9
11
  };
@@ -76,7 +78,7 @@ const Stytch = ({ config, styles }) => {
76
78
  if (!stytchClient || !elementId) {
77
79
  return;
78
80
  }
79
- if (!(stytchClient instanceof StytchUIClient)) {
81
+ if (!isUIClient(stytchClient)) {
80
82
  throw Error(`Tried to create a Stytch Login UI element using the Stytch Headless SDK.
81
83
  You must use the UI SDK to use UI elements.
82
84
  Please make sure you are importing from @stytch/vanilla-js and not from the @stytch/vanilla-js/headless.
package/dist/index.js CHANGED
@@ -3,7 +3,6 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
- var vanillaJs = require('@stytch/vanilla-js');
7
6
 
8
7
  function _interopNamespace(e) {
9
8
  if (e && e.__esModule) return e;
@@ -28,6 +27,9 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
27
  const StytchUserContext = React__namespace.createContext(null);
29
28
  const StytchSessionContext = React__namespace.createContext(null);
30
29
  const StytchContext = React__namespace.createContext({});
30
+ const isUIClient = (client) => {
31
+ return client.mount !== undefined;
32
+ };
31
33
  const useStytchUser = () => {
32
34
  return React__namespace.useContext(StytchUserContext);
33
35
  };
@@ -100,7 +102,7 @@ const Stytch = ({ config, styles }) => {
100
102
  if (!stytchClient || !elementId) {
101
103
  return;
102
104
  }
103
- if (!(stytchClient instanceof vanillaJs.StytchUIClient)) {
105
+ if (!isUIClient(stytchClient)) {
104
106
  throw Error(`Tried to create a Stytch Login UI element using the Stytch Headless SDK.
105
107
  You must use the UI SDK to use UI elements.
106
108
  Please make sure you are importing from @stytch/vanilla-js and not from the @stytch/vanilla-js/headless.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stytch/react",
3
- "version": "0.0.0-rc.2",
3
+ "version": "0.0.2-0",
4
4
  "description": "Stytch's official React Library",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",
@@ -18,15 +18,15 @@
18
18
  "author": "Stytch",
19
19
  "devDependencies": {
20
20
  "@babel/runtime": "^7.18.6",
21
- "@stytch/vanilla-js": "0.0.0-rc.3",
21
+ "@stytch/vanilla-js": "0.0.1",
22
22
  "eslint-config-custom": "0.0.0",
23
23
  "rollup": "^2.56.3",
24
24
  "typescript": "^4.5.3"
25
25
  },
26
26
  "peerDependencies": {
27
- "@stytch/vanilla-js": "workspace:^0.0.0",
27
+ "@stytch/vanilla-js": "^0.0.1",
28
28
  "react": ">= 17.0.2",
29
29
  "react-dom": ">= 17.0.2"
30
30
  },
31
- "stableVersion": "0.0.0"
31
+ "stableVersion": "0.0.1"
32
32
  }