File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -75,9 +75,15 @@ export class MermaidChart {
75
75
public async getAuthorizationData ( {
76
76
state,
77
77
scope = [ 'email' ] ,
78
+ utm_source,
79
+ utm_medium,
80
+ utm_campaign
78
81
} : {
79
82
state ?: string ;
80
83
scope ?: string [ ] ;
84
+ utm_source ?: string ;
85
+ utm_medium ?: string ;
86
+ utm_campaign ?: string ;
81
87
} = { } ) : Promise < AuthorizationData > {
82
88
if ( ! this . redirectURI ) {
83
89
throw new Error ( 'redirectURI is not set' ) ;
@@ -90,12 +96,20 @@ export class MermaidChart {
90
96
this . pendingStates [ stateID ] = {
91
97
codeVerifier,
92
98
} ;
99
+
100
+ const extraParams : Record < string , string > = { } ;
101
+ if ( utm_source && utm_medium && utm_campaign ) {
102
+ extraParams . utm_source = utm_source ;
103
+ extraParams . utm_medium = utm_medium ;
104
+ extraParams . utm_campaign = utm_campaign ;
105
+ }
93
106
94
107
const url = await this . oauth . authorizationCode . getAuthorizeUri ( {
95
108
redirectUri : this . redirectURI ,
96
109
state : stateID ,
97
110
codeVerifier,
98
111
scope,
112
+ ...( Object . keys ( extraParams ) . length > 0 && { extraParams } ) ,
99
113
} ) ;
100
114
101
115
// Deletes the state after 60 seconds
You can’t perform that action at this time.
0 commit comments