This repository was archived by the owner on Mar 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5555 "dependencies" : {
5656 "@r2wc/react-to-web-component" : " ^2.0.2" ,
5757 "@react-hook/resize-observer" : " ^1.2.6" ,
58- "@userfront/core" : " ^0.6.8 " ,
58+ "@userfront/core" : " 1.0.0 " ,
5959 "@xstate/react" : " 3.0.1" ,
6060 "lodash" : " ^4.17.21" ,
6161 "react-icons" : " ^4.4.0" ,
Original file line number Diff line number Diff line change @@ -24,6 +24,23 @@ Userfront.build = (toolId) => {
2424 See https://userfront.com/dashboard/toolkit for more information about upgrading to the new toolkit.` ) ;
2525} ;
2626
27+ /**
28+ * Override Userfront.init to pass toolkit userfrontSource param into it
29+ */
30+ const UserfrontProxy = new Proxy ( Userfront , {
31+ get ( target , prop ) {
32+ if ( prop === "init" ) {
33+ return ( tenantId , options = { } ) => {
34+ Userfront . init ( tenantId , {
35+ ...options ,
36+ userfrontSource : "toolkit" ,
37+ } ) ;
38+ } ;
39+ }
40+ return target [ prop ] ;
41+ } ,
42+ } ) ;
43+
2744/*
2845 * Dev tools.
2946 * You probably only want these if you're developing this library.
@@ -47,4 +64,4 @@ export const _devTools = {
4764 overrideUserfrontSingleton,
4865} ;
4966
50- export default Userfront ;
67+ export default UserfrontProxy ;
Original file line number Diff line number Diff line change @@ -82,10 +82,12 @@ export const readQueryParams = assign((context: AuthContext<View>) => {
8282 }
8383 const uuid = getQueryAttr ( "uuid" ) ;
8484 const token = getQueryAttr ( "token" ) ;
85+ const linkType = getQueryAttr ( "type" ) ;
8586 return {
8687 query : {
8788 uuid,
8889 token,
90+ linkType,
8991 isValid : true ,
9092 } ,
9193 } ;
Original file line number Diff line number Diff line change @@ -329,7 +329,10 @@ const universalMachineConfig: AuthMachineConfig = {
329329 // @ts -ignore
330330 callUserfrontSync ( {
331331 method : "init" ,
332- args : [ context . config . tenantId ! ] ,
332+ args : [
333+ context . config . tenantId ! ,
334+ { options : { userfrontSource : "toolkit" } } ,
335+ ] ,
333336 } ) ;
334337 return context . config . tenantId ;
335338 } ,
@@ -696,6 +699,7 @@ const universalMachineConfig: AuthMachineConfig = {
696699 method : "link" ,
697700 token : context . query . token ,
698701 uuid : context . query . uuid ,
702+ linkType : context . query . linkType ,
699703 redirect : context . config ?. redirect ,
700704 } ,
701705 ] ,
Original file line number Diff line number Diff line change @@ -150,6 +150,7 @@ export type View =
150150export type Query = {
151151 token ?: string ;
152152 uuid ?: string ;
153+ linkType ?: string ;
153154 isValid ?: boolean ;
154155} ;
155156
You can’t perform that action at this time.
0 commit comments