@@ -13,57 +13,61 @@ if (typeof window === "object" && !window.Userfront) {
1313 window . Userfront = Userfront ;
1414}
1515
16- /* Define the <foo-form> custom elements */
17- customElements . define (
18- "signup-form" ,
19- r2wc ( SignupForm , {
20- props : {
21- tenantId : "string" ,
22- flow : "json" ,
23- compact : "boolean" ,
24- redirect : "string" ,
25- redirectOnLoadIfLoggedIn : "boolean" ,
26- xstateDevTools : "boolean" ,
27- } ,
28- } )
29- ) ;
16+ // Register custom elements if we're in the browser.
17+ // (Skip for SSR scenarios.)
18+ if ( typeof window === "object" && window . customElements ) {
19+ /* Define the <foo-form> custom elements */
20+ customElements . define (
21+ "signup-form" ,
22+ r2wc ( SignupForm , {
23+ props : {
24+ tenantId : "string" ,
25+ flow : "json" ,
26+ compact : "boolean" ,
27+ redirect : "string" ,
28+ redirectOnLoadIfLoggedIn : "boolean" ,
29+ xstateDevTools : "boolean" ,
30+ } ,
31+ } )
32+ ) ;
3033
31- customElements . define (
32- "login-form" ,
33- r2wc ( LoginForm , {
34- props : {
35- tenantId : "string" ,
36- flow : "json" ,
37- compact : "boolean" ,
38- redirect : "string" ,
39- redirectOnLoadIfLoggedIn : "boolean" ,
40- xstateDevTools : "boolean" ,
41- } ,
42- } )
43- ) ;
34+ customElements . define (
35+ "login-form" ,
36+ r2wc ( LoginForm , {
37+ props : {
38+ tenantId : "string" ,
39+ flow : "json" ,
40+ compact : "boolean" ,
41+ redirect : "string" ,
42+ redirectOnLoadIfLoggedIn : "boolean" ,
43+ xstateDevTools : "boolean" ,
44+ } ,
45+ } )
46+ ) ;
4447
45- customElements . define (
46- "password-reset-form" ,
47- r2wc ( PasswordResetForm , {
48- props : {
49- tenantId : "string" ,
50- flow : "json" ,
51- compact : "boolean" ,
52- redirect : "string" ,
53- redirectOnLoadIfLoggedIn : "boolean" ,
54- xstateDevTools : "boolean" ,
55- } ,
56- } )
57- ) ;
48+ customElements . define (
49+ "password-reset-form" ,
50+ r2wc ( PasswordResetForm , {
51+ props : {
52+ tenantId : "string" ,
53+ flow : "json" ,
54+ compact : "boolean" ,
55+ redirect : "string" ,
56+ redirectOnLoadIfLoggedIn : "boolean" ,
57+ xstateDevTools : "boolean" ,
58+ } ,
59+ } )
60+ ) ;
5861
59- customElements . define (
60- "logout-button" ,
61- r2wc ( LogoutButton , {
62- props : {
63- disabled : "boolean" ,
64- redirect : "string" ,
65- } ,
66- } )
67- ) ;
62+ customElements . define (
63+ "logout-button" ,
64+ r2wc ( LogoutButton , {
65+ props : {
66+ disabled : "boolean" ,
67+ redirect : "string" ,
68+ } ,
69+ } )
70+ ) ;
71+ }
6872
6973export default Userfront ;
0 commit comments