@@ -9,15 +9,21 @@ interface WidgetUrlResponse {
99 }
1010}
1111
12- const fetchWidgetUrl = async ( widgetConfiguration : object ) => {
12+ export const fetchConnectWidgetUrl = async ( clientRedirectUrl : string ) => {
1313 const headers : Record < string , string > = {
1414 "Accept-Version" : "v20250224" ,
1515 "Content-Type" : "application/json" ,
1616 }
1717
1818 const method = "POST"
1919 const body = JSON . stringify ( {
20- widget_url : widgetConfiguration ,
20+ widget_url : {
21+ client_redirect_url : clientRedirectUrl ,
22+ is_mobile_webview : true ,
23+ ui_message_version : 4 ,
24+ widget_type : "connect_widget" ,
25+ data_request : { products : [ "identity_verification" ] } ,
26+ } ,
2127 } )
2228
2329 try {
@@ -39,24 +45,3 @@ const fetchWidgetUrl = async (widgetConfiguration: object) => {
3945 throw error
4046 }
4147}
42-
43- const createWidgetConfiguration = ( overrides : Record < string , any > ) => {
44- const baseWidgetConfiguration = {
45- is_mobile_webview : true ,
46- ui_message_version : 4 ,
47- }
48-
49- return {
50- ...baseWidgetConfiguration ,
51- ...overrides ,
52- }
53- }
54-
55- export const fetchConnectWidgetUrl = async ( clientRedirectUrl : string ) => {
56- const widgetConfiguration = createWidgetConfiguration ( {
57- client_redirect_url : clientRedirectUrl ,
58- widget_type : "connect_widget" ,
59- } )
60-
61- return fetchWidgetUrl ( widgetConfiguration )
62- }
0 commit comments