@stytch/nextjs 0.4.4 → 0.4.6
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 +14 -0
- package/dist/index.d.ts +41 -1
- package/dist/index.esm.d.ts +41 -1
- package/dist/index.esm.js +64 -1
- package/dist/index.js +64 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @stytch/nextjs
|
|
2
2
|
|
|
3
|
+
## 0.4.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add support for custom email domains in magic link confirmation screen
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @stytch/vanilla-js@0.4.6
|
|
10
|
+
|
|
11
|
+
## 0.4.5
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Reset Password component
|
|
16
|
+
|
|
3
17
|
## 0.4.4
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -200,5 +200,45 @@ interface StytchProps {
|
|
|
200
200
|
* @param callbacks - An optional {@link Callbacks} object
|
|
201
201
|
*/
|
|
202
202
|
declare const StytchLogin: ({ config, styles, callbacks }: StytchProps) => JSX.Element;
|
|
203
|
-
|
|
203
|
+
interface StytchResetPasswordProps extends StytchProps {
|
|
204
|
+
passwordResetToken: string;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* The Stytch Reset Password component.
|
|
208
|
+
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
209
|
+
* passed into the {@link StytchProvider}
|
|
210
|
+
*
|
|
211
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
212
|
+
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* <StytchPasswordReset
|
|
216
|
+
* config={{
|
|
217
|
+
* products: ['emailMagicLinks', 'oauth'],
|
|
218
|
+
* emailMagicLinksOptions: {
|
|
219
|
+
* loginRedirectURL: 'https://example.com/authenticate',
|
|
220
|
+
* signupRedirectURL: 'https://example.com/authenticate',
|
|
221
|
+
* },
|
|
222
|
+
* oauthOptions: {
|
|
223
|
+
* providers: [{ type: OAuthProviders.Google }, { type: OAuthProviders.Microsoft }],
|
|
224
|
+
* },
|
|
225
|
+
* }}
|
|
226
|
+
* passwordResetToken="PvC5UudZ7TPZbELt95yXAQ-8MeEUCRob8bUQ-g52fIJs"
|
|
227
|
+
* styles={{
|
|
228
|
+
* fontFamily: '"Helvetica New", Helvetica, sans-serif',
|
|
229
|
+
* primaryColor: '#0577CA',
|
|
230
|
+
* width: '321px',
|
|
231
|
+
* }}
|
|
232
|
+
* callbacks={{
|
|
233
|
+
* onEvent: (event) => console.log(event)
|
|
234
|
+
* }}
|
|
235
|
+
* />
|
|
236
|
+
*
|
|
237
|
+
* @param config - A {@link StytchLoginConfig} object
|
|
238
|
+
* @param passwordResetToken - A Stytch password reset token
|
|
239
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
240
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
241
|
+
*/
|
|
242
|
+
declare const StytchPasswordReset: ({ config, styles, callbacks, passwordResetToken }: StytchResetPasswordProps) => JSX.Element;
|
|
243
|
+
export { StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser, StytchLogin, StytchPasswordReset };
|
|
204
244
|
export type { StytchProviderProps };
|
package/dist/index.esm.d.ts
CHANGED
|
@@ -200,5 +200,45 @@ interface StytchProps {
|
|
|
200
200
|
* @param callbacks - An optional {@link Callbacks} object
|
|
201
201
|
*/
|
|
202
202
|
declare const StytchLogin: ({ config, styles, callbacks }: StytchProps) => JSX.Element;
|
|
203
|
-
|
|
203
|
+
interface StytchResetPasswordProps extends StytchProps {
|
|
204
|
+
passwordResetToken: string;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* The Stytch Reset Password component.
|
|
208
|
+
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
209
|
+
* passed into the {@link StytchProvider}
|
|
210
|
+
*
|
|
211
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
212
|
+
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* <StytchPasswordReset
|
|
216
|
+
* config={{
|
|
217
|
+
* products: ['emailMagicLinks', 'oauth'],
|
|
218
|
+
* emailMagicLinksOptions: {
|
|
219
|
+
* loginRedirectURL: 'https://example.com/authenticate',
|
|
220
|
+
* signupRedirectURL: 'https://example.com/authenticate',
|
|
221
|
+
* },
|
|
222
|
+
* oauthOptions: {
|
|
223
|
+
* providers: [{ type: OAuthProviders.Google }, { type: OAuthProviders.Microsoft }],
|
|
224
|
+
* },
|
|
225
|
+
* }}
|
|
226
|
+
* passwordResetToken="PvC5UudZ7TPZbELt95yXAQ-8MeEUCRob8bUQ-g52fIJs"
|
|
227
|
+
* styles={{
|
|
228
|
+
* fontFamily: '"Helvetica New", Helvetica, sans-serif',
|
|
229
|
+
* primaryColor: '#0577CA',
|
|
230
|
+
* width: '321px',
|
|
231
|
+
* }}
|
|
232
|
+
* callbacks={{
|
|
233
|
+
* onEvent: (event) => console.log(event)
|
|
234
|
+
* }}
|
|
235
|
+
* />
|
|
236
|
+
*
|
|
237
|
+
* @param config - A {@link StytchLoginConfig} object
|
|
238
|
+
* @param passwordResetToken - A Stytch password reset token
|
|
239
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
240
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
241
|
+
*/
|
|
242
|
+
declare const StytchPasswordReset: ({ config, styles, callbacks, passwordResetToken }: StytchResetPasswordProps) => JSX.Element;
|
|
243
|
+
export { StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser, StytchLogin, StytchPasswordReset };
|
|
204
244
|
export type { StytchProviderProps };
|
package/dist/index.esm.js
CHANGED
|
@@ -234,5 +234,68 @@ const StytchLogin = ({ config, styles, callbacks }) => {
|
|
|
234
234
|
}, [stytchClient, config, styles, callbacks]);
|
|
235
235
|
return React.createElement("div", { ref: containerEl });
|
|
236
236
|
};
|
|
237
|
+
/**
|
|
238
|
+
* The Stytch Reset Password component.
|
|
239
|
+
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
240
|
+
* passed into the {@link StytchProvider}
|
|
241
|
+
*
|
|
242
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
243
|
+
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* <StytchPasswordReset
|
|
247
|
+
* config={{
|
|
248
|
+
* products: ['emailMagicLinks', 'oauth'],
|
|
249
|
+
* emailMagicLinksOptions: {
|
|
250
|
+
* loginRedirectURL: 'https://example.com/authenticate',
|
|
251
|
+
* signupRedirectURL: 'https://example.com/authenticate',
|
|
252
|
+
* },
|
|
253
|
+
* oauthOptions: {
|
|
254
|
+
* providers: [{ type: OAuthProviders.Google }, { type: OAuthProviders.Microsoft }],
|
|
255
|
+
* },
|
|
256
|
+
* }}
|
|
257
|
+
* passwordResetToken="PvC5UudZ7TPZbELt95yXAQ-8MeEUCRob8bUQ-g52fIJs"
|
|
258
|
+
* styles={{
|
|
259
|
+
* fontFamily: '"Helvetica New", Helvetica, sans-serif',
|
|
260
|
+
* primaryColor: '#0577CA',
|
|
261
|
+
* width: '321px',
|
|
262
|
+
* }}
|
|
263
|
+
* callbacks={{
|
|
264
|
+
* onEvent: (event) => console.log(event)
|
|
265
|
+
* }}
|
|
266
|
+
* />
|
|
267
|
+
*
|
|
268
|
+
* @param config - A {@link StytchLoginConfig} object
|
|
269
|
+
* @param passwordResetToken - A Stytch password reset token
|
|
270
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
271
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
272
|
+
*/
|
|
273
|
+
const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken }) => {
|
|
274
|
+
invariant(useIsMounted__INTERNAL(), noProviderError('<StytchResetPassword />'));
|
|
275
|
+
const stytchClient = useStytch();
|
|
276
|
+
const containerEl = useRef(null);
|
|
277
|
+
useIsomorphicLayoutEffect(() => {
|
|
278
|
+
if (!isUIClient(stytchClient)) {
|
|
279
|
+
throw Error(noHeadlessClientError);
|
|
280
|
+
}
|
|
281
|
+
if (!containerEl.current) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
if (!containerEl.current.id) {
|
|
285
|
+
const randId = Math.floor(Math.random() * 1e6);
|
|
286
|
+
containerEl.current.id = `stytch-reset-password-${randId}`;
|
|
287
|
+
}
|
|
288
|
+
if (passwordResetToken) {
|
|
289
|
+
stytchClient.mountResetPassword({
|
|
290
|
+
config,
|
|
291
|
+
callbacks,
|
|
292
|
+
elementId: `#${containerEl.current.id}`,
|
|
293
|
+
styles,
|
|
294
|
+
passwordResetToken,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}, [stytchClient, config, styles, callbacks, passwordResetToken]);
|
|
298
|
+
return React.createElement("div", { ref: containerEl });
|
|
299
|
+
};
|
|
237
300
|
|
|
238
|
-
export { StytchLogin, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
|
301
|
+
export { StytchLogin, StytchPasswordReset, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
package/dist/index.js
CHANGED
|
@@ -242,8 +242,72 @@ const StytchLogin = ({ config, styles, callbacks }) => {
|
|
|
242
242
|
}, [stytchClient, config, styles, callbacks]);
|
|
243
243
|
return React__default['default'].createElement("div", { ref: containerEl });
|
|
244
244
|
};
|
|
245
|
+
/**
|
|
246
|
+
* The Stytch Reset Password component.
|
|
247
|
+
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
248
|
+
* passed into the {@link StytchProvider}
|
|
249
|
+
*
|
|
250
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
251
|
+
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* <StytchPasswordReset
|
|
255
|
+
* config={{
|
|
256
|
+
* products: ['emailMagicLinks', 'oauth'],
|
|
257
|
+
* emailMagicLinksOptions: {
|
|
258
|
+
* loginRedirectURL: 'https://example.com/authenticate',
|
|
259
|
+
* signupRedirectURL: 'https://example.com/authenticate',
|
|
260
|
+
* },
|
|
261
|
+
* oauthOptions: {
|
|
262
|
+
* providers: [{ type: OAuthProviders.Google }, { type: OAuthProviders.Microsoft }],
|
|
263
|
+
* },
|
|
264
|
+
* }}
|
|
265
|
+
* passwordResetToken="PvC5UudZ7TPZbELt95yXAQ-8MeEUCRob8bUQ-g52fIJs"
|
|
266
|
+
* styles={{
|
|
267
|
+
* fontFamily: '"Helvetica New", Helvetica, sans-serif',
|
|
268
|
+
* primaryColor: '#0577CA',
|
|
269
|
+
* width: '321px',
|
|
270
|
+
* }}
|
|
271
|
+
* callbacks={{
|
|
272
|
+
* onEvent: (event) => console.log(event)
|
|
273
|
+
* }}
|
|
274
|
+
* />
|
|
275
|
+
*
|
|
276
|
+
* @param config - A {@link StytchLoginConfig} object
|
|
277
|
+
* @param passwordResetToken - A Stytch password reset token
|
|
278
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
279
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
280
|
+
*/
|
|
281
|
+
const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken }) => {
|
|
282
|
+
invariant(useIsMounted__INTERNAL(), noProviderError('<StytchResetPassword />'));
|
|
283
|
+
const stytchClient = useStytch();
|
|
284
|
+
const containerEl = React.useRef(null);
|
|
285
|
+
useIsomorphicLayoutEffect(() => {
|
|
286
|
+
if (!isUIClient(stytchClient)) {
|
|
287
|
+
throw Error(noHeadlessClientError);
|
|
288
|
+
}
|
|
289
|
+
if (!containerEl.current) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (!containerEl.current.id) {
|
|
293
|
+
const randId = Math.floor(Math.random() * 1e6);
|
|
294
|
+
containerEl.current.id = `stytch-reset-password-${randId}`;
|
|
295
|
+
}
|
|
296
|
+
if (passwordResetToken) {
|
|
297
|
+
stytchClient.mountResetPassword({
|
|
298
|
+
config,
|
|
299
|
+
callbacks,
|
|
300
|
+
elementId: `#${containerEl.current.id}`,
|
|
301
|
+
styles,
|
|
302
|
+
passwordResetToken,
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
}, [stytchClient, config, styles, callbacks, passwordResetToken]);
|
|
306
|
+
return React__default['default'].createElement("div", { ref: containerEl });
|
|
307
|
+
};
|
|
245
308
|
|
|
246
309
|
exports.StytchLogin = StytchLogin;
|
|
310
|
+
exports.StytchPasswordReset = StytchPasswordReset;
|
|
247
311
|
exports.StytchProvider = StytchProvider;
|
|
248
312
|
exports.useStytch = useStytch;
|
|
249
313
|
exports.useStytchSession = useStytchSession;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stytch/nextjs",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Stytch's official Next.js Library",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"author": "Stytch",
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@babel/runtime": "7.18.6",
|
|
24
|
-
"@stytch/vanilla-js": "0.4.
|
|
24
|
+
"@stytch/vanilla-js": "0.4.6",
|
|
25
25
|
"eslint-config-custom": "0.0.0",
|
|
26
26
|
"rollup": "2.56.3",
|
|
27
27
|
"typescript": "4.7.4"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@stytch/vanilla-js": "^0.4.
|
|
30
|
+
"@stytch/vanilla-js": "^0.4.6",
|
|
31
31
|
"react": ">= 17.0.2",
|
|
32
32
|
"react-dom": ">= 17.0.2"
|
|
33
33
|
},
|