@stytch/vanilla-js 2.2.2 → 3.0.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/CHANGELOG.md +22 -0
- package/README.md +55 -3
- package/b2b/headless/package.json +6 -0
- package/dist/b2b/index.d.ts +1 -1
- package/dist/b2b/index.esm.d.ts +1 -1
- package/dist/b2b/index.esm.js +4 -7
- package/dist/b2b/index.headless.d.ts +634 -0
- package/dist/b2b/index.headless.esm.d.ts +634 -0
- package/dist/b2b/index.headless.esm.js +3811 -0
- package/dist/b2b/index.headless.js +3811 -0
- package/dist/b2b/index.js +4 -7
- package/dist/index.esm.js +1 -1
- package/dist/index.headless.esm.js +36 -39
- package/dist/index.headless.js +18 -21
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @stytch/vanilla-js
|
|
2
2
|
|
|
3
|
+
## 3.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b402097: Bug fix for clearing the local storage state and cookies when a stale session exists while using the SDK across subdomains
|
|
8
|
+
|
|
9
|
+
## 3.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- 5dd9d24: Change export of B2B Headless Client to separate subpackage to improve tree-shaking performance
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import { StytchB2BHeadlessClient } from '@stytch/vanilla-js/b2b';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Is now updated to
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
import { StytchB2BHeadlessClient } from '@stytch/vanilla-js/b2b/headless';
|
|
23
|
+
```
|
|
24
|
+
|
|
3
25
|
## 2.2.2
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ npm install @stytch/vanilla-js
|
|
|
12
12
|
|
|
13
13
|
The vanilla Stytch Javascript SDK is built on open web standards and is compatible with all Javascript frameworks.
|
|
14
14
|
|
|
15
|
-
### `StytchUIClient`
|
|
15
|
+
### **B2C** `StytchUIClient`
|
|
16
16
|
|
|
17
17
|
The Stytch UI Client provides methods for interacting with the Stytch API from a browser environment, along with prebuilt UI components such as our login form.
|
|
18
18
|
|
|
@@ -45,9 +45,9 @@ stytch.mountLogin({
|
|
|
45
45
|
});
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
### `StytchHeadlessClient`
|
|
48
|
+
### **B2C** `StytchHeadlessClient`
|
|
49
49
|
|
|
50
|
-
Developers that don't use Stytch UI elements can use the `StytchHeadlessClient` instead, which is _significantly_ smaller
|
|
50
|
+
Developers that don't use Stytch UI elements can use the `StytchHeadlessClient` instead, which is _significantly_ smaller!
|
|
51
51
|
|
|
52
52
|
```js
|
|
53
53
|
import { StytchHeadlessClient } from '@stytch/vanilla-js/headless';
|
|
@@ -58,6 +58,58 @@ const stytch = new StytchHeadlessClient('public-token-test-xxxxxxxx-xxxx-xxxx-xx
|
|
|
58
58
|
stytch.magicLinks.email.loginOrCreate('charles.babbage@example.com');
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
### **B2B** `StytchB2BUIClient`
|
|
62
|
+
|
|
63
|
+
The Stytch UI Client provides methods for interacting with the Stytch API from a browser environment, along with prebuilt UI components such as our login form.
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
import { StytchB2BUIClient } from '@stytch/vanilla-js/b2b';
|
|
67
|
+
|
|
68
|
+
const stytch = new StytchB2BUIClient('public-token-test-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
|
|
69
|
+
|
|
70
|
+
// Call Stytch APIs from the browser
|
|
71
|
+
stytch.magicLinks.email.loginOrSignup({
|
|
72
|
+
email_address: 'charles.babbage@example.com',
|
|
73
|
+
organization_id: 'organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931',
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Render prebuilt UI
|
|
77
|
+
stytch.mountLogin({
|
|
78
|
+
elementId: '#magic-link',
|
|
79
|
+
config: {
|
|
80
|
+
products: ['emailMagicLinks', 'oauth'],
|
|
81
|
+
emailMagicLinksOptions: {
|
|
82
|
+
loginRedirectURL: 'https://example.com/authenticate',
|
|
83
|
+
loginExpirationMinutes: 30,
|
|
84
|
+
signupRedirectURL: 'https://example.com/authenticate',
|
|
85
|
+
signupExpirationMinutes: 30,
|
|
86
|
+
createUserAsPending: true,
|
|
87
|
+
},
|
|
88
|
+
oauthOptions: {
|
|
89
|
+
providers: [{ type: 'google' }, { type: 'microsoft' }],
|
|
90
|
+
loginRedirectURL: 'https://example.com/authenticate',
|
|
91
|
+
signupRedirectURL: 'https://example.com/authenticate',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### **B2C** `StytchB2BHeadlessClient`
|
|
98
|
+
|
|
99
|
+
Developers that don't use Stytch UI elements can use the `StytchB2BHeadlessClient` instead, which is _significantly_ smaller!
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
import { StytchB2BHeadlessClient } from '@stytch/vanilla-js/b2b/headless';
|
|
103
|
+
|
|
104
|
+
const stytch = new StytchB2BHeadlessClient('public-token-test-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
|
|
105
|
+
|
|
106
|
+
// Call Stytch APIs from the browser
|
|
107
|
+
stytch.magicLinks.email.loginOrSignup({
|
|
108
|
+
email_address: 'charles.babbage@example.com',
|
|
109
|
+
organization_id: 'organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931',
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
61
113
|
For more information on how to use the Stytch SDK, please refer to the
|
|
62
114
|
[docs](https://stytch.com/docs/javascript-sdk).
|
|
63
115
|
|
package/dist/b2b/index.d.ts
CHANGED
package/dist/b2b/index.esm.d.ts
CHANGED
package/dist/b2b/index.esm.js
CHANGED
|
@@ -2887,7 +2887,7 @@ var Re = /*#__PURE__*/function () {
|
|
|
2887
2887
|
},
|
|
2888
2888
|
sdk: {
|
|
2889
2889
|
identifier: "Stytch.js Javascript SDK",
|
|
2890
|
-
version: "
|
|
2890
|
+
version: "3.0.1"
|
|
2891
2891
|
}
|
|
2892
2892
|
});
|
|
2893
2893
|
}
|
|
@@ -3436,18 +3436,15 @@ var Ge = /*#__PURE__*/function () {
|
|
|
3436
3436
|
function Ge(e, t) {
|
|
3437
3437
|
var _this6 = this;
|
|
3438
3438
|
_classCallCheck(this, Ge);
|
|
3439
|
-
var n;
|
|
3440
3439
|
this._publicToken = e, this._datalayer = t, this._listen = function (e) {
|
|
3441
3440
|
if (e.key !== Qe(_this6._publicToken)) return;
|
|
3442
3441
|
if (null === e.newValue || "null" === e.newValue) return void _this6.destroyState();
|
|
3443
3442
|
var t = JSON.parse(e.newValue);
|
|
3444
3443
|
_this6.updateState(t);
|
|
3445
3444
|
}, window.addEventListener("storage", this._listen);
|
|
3446
|
-
var r = null === (n = this._datalayer.state) || void 0 === n ? void 0 : n.session;
|
|
3447
|
-
if (r && Date.parse(r.expires_at) < Date.now()) return void this.destroyState();
|
|
3448
3445
|
var _this$_datalayer$read = this._datalayer.readSessionCookie(),
|
|
3449
|
-
|
|
3450
|
-
|
|
3446
|
+
n = _this$_datalayer$read.session_token;
|
|
3447
|
+
n || this.destroyState();
|
|
3451
3448
|
}
|
|
3452
3449
|
_createClass(Ge, [{
|
|
3453
3450
|
key: "getTokens",
|
|
@@ -15600,4 +15597,4 @@ var KA = /*#__PURE__*/function (_Xe) {
|
|
|
15600
15597
|
}]);
|
|
15601
15598
|
return KA;
|
|
15602
15599
|
}(Xe);
|
|
15603
|
-
export { em as AuthFlowType, tm as B2BOAuthProviders, Xh as B2BProducts, Zh as BiometricsErrors, Lh as OAuthProviders, zh as OTPMethods, Dh as OneTapPositions, Rh as Products, nm as SDKAPIUnreachableError,
|
|
15600
|
+
export { em as AuthFlowType, tm as B2BOAuthProviders, Xh as B2BProducts, Zh as BiometricsErrors, Lh as OAuthProviders, zh as OTPMethods, Dh as OneTapPositions, Rh as Products, nm as SDKAPIUnreachableError, KA as StytchB2BUIClient, Nh as StytchEventType, im as StytchSDKAPIError, am as StytchSDKNativeError, om as StytchSDKSchemaError, rm as StytchSDKUsageError, sm as UNRECOVERABLE_ERROR_TYPES, Mh as Wallets };
|