@lightdash/common 0.1899.1-alpha.2 → 0.1901.0

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.
@@ -150,9 +150,57 @@ const OAUTH_ICONS = {
150
150
  error: '<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2"/><path d="M15 9l-6 6M9 9l6 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',
151
151
  sessionExpired: '<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2"/><path d="M12 6v6l4 2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',
152
152
  };
153
+ // OAuth redirect page template
154
+ const OAUTH_REDIRECT_TEMPLATE = `
155
+ <html>
156
+ <head>
157
+ <title>Redirecting...</title>
158
+ <style>
159
+ {{{styles}}}
160
+ .spinner {
161
+ width: 32px;
162
+ height: 32px;
163
+ margin: 0 auto 16px auto;
164
+ border: 3px solid #e9ecef;
165
+ border-top: 3px solid #00B26F;
166
+ border-radius: 50%;
167
+ animation: spin 1s linear infinite;
168
+ }
169
+ @keyframes spin {
170
+ 0% { transform: rotate(0deg); }
171
+ 100% { transform: rotate(360deg); }
172
+ }
173
+ .redirect-link {
174
+ color: #00B26F;
175
+ text-decoration: none;
176
+ font-weight: 600;
177
+ }
178
+ .redirect-link:hover {
179
+ text-decoration: underline;
180
+ }
181
+ </style>
182
+ <script>
183
+ setTimeout(function() {
184
+ window.location.href = "{{{redirectUrl}}}";
185
+ }, 2000);
186
+ </script>
187
+ </head>
188
+ <body>
189
+ <div class="stack">
190
+ <div class="container">
191
+ <div class="spinner"></div>
192
+ <h1>Redirecting...</h1>
193
+ <p>{{message}}</p>
194
+ <p>If you are not redirected automatically, <a href="{{{redirectUrl}}}" class="redirect-link">click here</a>.</p>
195
+ </div>
196
+ </div>
197
+ </body>
198
+ </html>
199
+ `;
153
200
  // Compile the templates once with proper type safety
154
201
  const compiledResponseTemplate = compile(OAUTH_RESPONSE_TEMPLATE);
155
202
  const compiledAuthorizeTemplate = compile(OAUTH_AUTHORIZE_TEMPLATE);
203
+ const compiledRedirectTemplate = compile(OAUTH_REDIRECT_TEMPLATE);
156
204
  /**
157
205
  * Generates an OAuth response HTML page using Handlebars templating
158
206
  * This prevents XSS issues by auto-escaping content while still allowing safe HTML in icons and styles
@@ -183,4 +231,12 @@ export const generateOAuthAuthorizePage = (params) => compiledAuthorizeTemplate(
183
231
  styles: oauthPageStyles,
184
232
  ...params,
185
233
  });
234
+ /**
235
+ * Generates an OAuth redirect page HTML using JavaScript redirect
236
+ * This prevents CSP errors by using JavaScript-based redirection instead of HTTP redirects
237
+ */
238
+ export const generateOAuthRedirectPage = (params) => compiledRedirectTemplate({
239
+ styles: oauthPageStyles,
240
+ ...params,
241
+ });
186
242
  //# sourceMappingURL=oauth.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../../src/utils/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2D9B,CAAC;AAEF,+BAA+B;AAC/B,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;CAmB/B,CAAC;AAEF,oCAAoC;AACpC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DhC,CAAC;AAEF,yCAAyC;AACzC,MAAM,WAAW,GAAG;IAChB,OAAO,EACH,wLAAwL;IAC5L,KAAK,EAAE,6LAA6L;IACpM,cAAc,EACV,sLAAsL;CACpL,CAAC;AAEX,qDAAqD;AACrD,MAAM,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAClE,MAAM,yBAAyB,GAAG,OAAO,CA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