@drmhse/authos-react 0.1.4 → 0.2.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.
package/dist/index.js CHANGED
@@ -5,6 +5,490 @@ var ssoSdk = require('@drmhse/sso-sdk');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
 
7
7
  // src/context.tsx
8
+
9
+ // src/styles.ts
10
+ var AUTHOS_STYLES = `
11
+ /* ==========================================================================
12
+ AuthOS Component Styles
13
+ CSS Variables + Default Theme
14
+ ========================================================================== */
15
+
16
+ :root {
17
+ /* Primary Colors */
18
+ --authos-color-primary: #6366f1;
19
+ --authos-color-primary-hover: #4f46e5;
20
+ --authos-color-primary-foreground: #ffffff;
21
+
22
+ /* Semantic Colors */
23
+ --authos-color-danger: #ef4444;
24
+ --authos-color-danger-foreground: #ffffff;
25
+ --authos-color-success: #22c55e;
26
+ --authos-color-warning: #f59e0b;
27
+
28
+ /* Surface Colors */
29
+ --authos-color-background: #ffffff;
30
+ --authos-color-surface: #ffffff;
31
+ --authos-color-foreground: #0f172a;
32
+ --authos-color-muted: #64748b;
33
+ --authos-color-muted-foreground: #64748b;
34
+
35
+ /* Component Colors */
36
+ --authos-color-border: #e2e8f0;
37
+ --authos-color-input: #ffffff;
38
+ --authos-color-input-border: #cbd5e1;
39
+ --authos-color-input-focus: #6366f1;
40
+ --authos-color-ring: rgba(99, 102, 241, 0.25);
41
+
42
+ /* Typography */
43
+ --authos-font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
44
+ --authos-font-size-xs: 0.75rem;
45
+ --authos-font-size-sm: 0.875rem;
46
+ --authos-font-size-base: 1rem;
47
+ --authos-font-size-lg: 1.125rem;
48
+
49
+ /* Spacing & Shape */
50
+ --authos-border-radius: 0.5rem;
51
+ --authos-border-radius-sm: 0.375rem;
52
+ --authos-border-radius-lg: 0.75rem;
53
+ --authos-spacing-xs: 0.25rem;
54
+ --authos-spacing-sm: 0.5rem;
55
+ --authos-spacing-md: 1rem;
56
+ --authos-spacing-lg: 1.5rem;
57
+
58
+ /* Shadows */
59
+ --authos-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
60
+ --authos-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
61
+ --authos-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
62
+
63
+ /* Transitions */
64
+ --authos-transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
65
+ }
66
+
67
+ /* Dark Mode */
68
+ @media (prefers-color-scheme: dark) {
69
+ :root {
70
+ --authos-color-primary: #818cf8;
71
+ --authos-color-primary-hover: #a5b4fc;
72
+
73
+ --authos-color-background: #0f172a;
74
+ --authos-color-surface: #1e293b;
75
+ --authos-color-foreground: #f1f5f9;
76
+ --authos-color-muted: #94a3b8;
77
+ --authos-color-muted-foreground: #94a3b8;
78
+
79
+ --authos-color-border: #334155;
80
+ --authos-color-input: #1e293b;
81
+ --authos-color-input-border: #475569;
82
+
83
+ --authos-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
84
+ --authos-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
85
+ --authos-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
86
+ }
87
+ }
88
+
89
+ /* ==========================================================================
90
+ Base Form Styles
91
+ ========================================================================== */
92
+
93
+ [data-authos-signin],
94
+ [data-authos-signup],
95
+ [data-authos-magiclink],
96
+ [data-authos-passkey] {
97
+ font-family: var(--authos-font-family);
98
+ font-size: var(--authos-font-size-sm);
99
+ color: var(--authos-color-foreground);
100
+ width: 100%;
101
+ }
102
+
103
+ [data-authos-signin] form,
104
+ [data-authos-signup] form,
105
+ [data-authos-magiclink] form,
106
+ [data-authos-passkey] form {
107
+ display: flex;
108
+ flex-direction: column;
109
+ gap: var(--authos-spacing-md);
110
+ }
111
+
112
+ /* ==========================================================================
113
+ Field Styles
114
+ ========================================================================== */
115
+
116
+ [data-authos-field] {
117
+ display: flex;
118
+ flex-direction: column;
119
+ gap: var(--authos-spacing-xs);
120
+ }
121
+
122
+ [data-authos-field] label {
123
+ font-size: var(--authos-font-size-sm);
124
+ font-weight: 500;
125
+ color: var(--authos-color-foreground);
126
+ }
127
+
128
+ [data-authos-field] input {
129
+ width: 100%;
130
+ padding: 0.625rem 0.875rem;
131
+ font-size: var(--authos-font-size-sm);
132
+ font-family: inherit;
133
+ color: var(--authos-color-foreground);
134
+ background-color: var(--authos-color-input);
135
+ border: 1px solid var(--authos-color-input-border);
136
+ border-radius: var(--authos-border-radius);
137
+ outline: none;
138
+ transition: border-color var(--authos-transition), box-shadow var(--authos-transition);
139
+ }
140
+
141
+ [data-authos-field] input::placeholder {
142
+ color: var(--authos-color-muted);
143
+ }
144
+
145
+ [data-authos-field] input:focus {
146
+ border-color: var(--authos-color-input-focus);
147
+ box-shadow: 0 0 0 3px var(--authos-color-ring);
148
+ }
149
+
150
+ [data-authos-field] input:disabled {
151
+ opacity: 0.6;
152
+ cursor: not-allowed;
153
+ }
154
+
155
+ /* ==========================================================================
156
+ Button Styles
157
+ ========================================================================== */
158
+
159
+ [data-authos-submit] {
160
+ display: inline-flex;
161
+ align-items: center;
162
+ justify-content: center;
163
+ gap: var(--authos-spacing-sm);
164
+ width: 100%;
165
+ padding: 0.625rem 1rem;
166
+ font-size: var(--authos-font-size-sm);
167
+ font-weight: 500;
168
+ font-family: inherit;
169
+ color: var(--authos-color-primary-foreground);
170
+ background-color: var(--authos-color-primary);
171
+ border: none;
172
+ border-radius: var(--authos-border-radius);
173
+ cursor: pointer;
174
+ outline: none;
175
+ transition: background-color var(--authos-transition), box-shadow var(--authos-transition);
176
+ }
177
+
178
+ [data-authos-submit]:hover:not(:disabled) {
179
+ background-color: var(--authos-color-primary-hover);
180
+ }
181
+
182
+ [data-authos-submit]:focus-visible {
183
+ box-shadow: 0 0 0 3px var(--authos-color-ring);
184
+ }
185
+
186
+ [data-authos-submit]:disabled {
187
+ opacity: 0.6;
188
+ cursor: not-allowed;
189
+ }
190
+
191
+ [data-authos-back] {
192
+ display: inline-flex;
193
+ align-items: center;
194
+ justify-content: center;
195
+ padding: 0.5rem 1rem;
196
+ font-size: var(--authos-font-size-sm);
197
+ font-weight: 500;
198
+ font-family: inherit;
199
+ color: var(--authos-color-muted);
200
+ background: transparent;
201
+ border: none;
202
+ border-radius: var(--authos-border-radius);
203
+ cursor: pointer;
204
+ transition: color var(--authos-transition);
205
+ }
206
+
207
+ [data-authos-back]:hover {
208
+ color: var(--authos-color-foreground);
209
+ }
210
+
211
+ /* ==========================================================================
212
+ OAuth Button Styles
213
+ ========================================================================== */
214
+
215
+ [data-authos-oauth] {
216
+ display: inline-flex;
217
+ align-items: center;
218
+ justify-content: center;
219
+ gap: 0.75rem;
220
+ width: 100%;
221
+ padding: 0.625rem 1rem;
222
+ font-size: var(--authos-font-size-sm);
223
+ font-weight: 500;
224
+ font-family: var(--authos-font-family);
225
+ color: var(--authos-color-foreground);
226
+ background-color: var(--authos-color-surface);
227
+ border: 1px solid var(--authos-color-border);
228
+ border-radius: var(--authos-border-radius);
229
+ cursor: pointer;
230
+ outline: none;
231
+ transition: background-color var(--authos-transition), border-color var(--authos-transition), box-shadow var(--authos-transition);
232
+ }
233
+
234
+ [data-authos-oauth]:hover:not(:disabled) {
235
+ background-color: var(--authos-color-background);
236
+ border-color: var(--authos-color-input-border);
237
+ }
238
+
239
+ [data-authos-oauth]:focus-visible {
240
+ box-shadow: 0 0 0 3px var(--authos-color-ring);
241
+ }
242
+
243
+ [data-authos-oauth]:disabled {
244
+ opacity: 0.6;
245
+ cursor: not-allowed;
246
+ }
247
+
248
+ [data-authos-oauth] svg {
249
+ width: 1.25rem;
250
+ height: 1.25rem;
251
+ flex-shrink: 0;
252
+ }
253
+
254
+ /* ==========================================================================
255
+ Divider Styles
256
+ ========================================================================== */
257
+
258
+ [data-authos-divider] {
259
+ display: flex;
260
+ align-items: center;
261
+ gap: var(--authos-spacing-md);
262
+ margin: var(--authos-spacing-sm) 0;
263
+ }
264
+
265
+ [data-authos-divider]::before,
266
+ [data-authos-divider]::after {
267
+ content: '';
268
+ flex: 1;
269
+ height: 1px;
270
+ background-color: var(--authos-color-border);
271
+ }
272
+
273
+ [data-authos-divider] span {
274
+ font-size: var(--authos-font-size-xs);
275
+ color: var(--authos-color-muted);
276
+ text-transform: uppercase;
277
+ letter-spacing: 0.05em;
278
+ }
279
+
280
+ /* ==========================================================================
281
+ Error Styles
282
+ ========================================================================== */
283
+
284
+ [data-authos-error] {
285
+ display: flex;
286
+ align-items: center;
287
+ gap: var(--authos-spacing-sm);
288
+ padding: 0.75rem 1rem;
289
+ font-size: var(--authos-font-size-sm);
290
+ color: var(--authos-color-danger);
291
+ background-color: rgba(239, 68, 68, 0.1);
292
+ border: 1px solid rgba(239, 68, 68, 0.2);
293
+ border-radius: var(--authos-border-radius);
294
+ }
295
+
296
+ /* ==========================================================================
297
+ Link Styles
298
+ ========================================================================== */
299
+
300
+ [data-authos-link] {
301
+ font-size: var(--authos-font-size-sm);
302
+ color: var(--authos-color-primary);
303
+ text-decoration: none;
304
+ transition: color var(--authos-transition);
305
+ }
306
+
307
+ [data-authos-link]:hover {
308
+ color: var(--authos-color-primary-hover);
309
+ text-decoration: underline;
310
+ }
311
+
312
+ [data-authos-signup-prompt],
313
+ [data-authos-signin-prompt] {
314
+ text-align: center;
315
+ font-size: var(--authos-font-size-sm);
316
+ color: var(--authos-color-muted);
317
+ margin-top: var(--authos-spacing-sm);
318
+ }
319
+
320
+ /* ==========================================================================
321
+ OAuth Section
322
+ ========================================================================== */
323
+
324
+ [data-authos-oauth-section] {
325
+ display: flex;
326
+ flex-direction: column;
327
+ gap: var(--authos-spacing-sm);
328
+ }
329
+
330
+ /* ==========================================================================
331
+ User Button Styles
332
+ ========================================================================== */
333
+
334
+ [data-authos-userbutton] {
335
+ position: relative;
336
+ display: inline-flex;
337
+ font-family: var(--authos-font-family);
338
+ font-size: var(--authos-font-size-sm);
339
+ color: var(--authos-color-foreground);
340
+ }
341
+
342
+ [data-authos-user-trigger] {
343
+ display: flex;
344
+ align-items: center;
345
+ gap: var(--authos-spacing-sm);
346
+ padding: 0;
347
+ background: transparent;
348
+ border: none;
349
+ cursor: pointer;
350
+ outline: none;
351
+ }
352
+
353
+ [data-authos-avatar] {
354
+ display: flex;
355
+ align-items: center;
356
+ justify-content: center;
357
+ width: 2rem;
358
+ height: 2rem;
359
+ font-size: var(--authos-font-size-xs);
360
+ font-weight: 600;
361
+ color: var(--authos-color-primary-foreground);
362
+ background-color: var(--authos-color-primary);
363
+ border-radius: 50%;
364
+ flex-shrink: 0;
365
+ }
366
+
367
+ [data-authos-user-menu] {
368
+ position: absolute;
369
+ top: 100%;
370
+ right: 0;
371
+ margin-top: var(--authos-spacing-sm);
372
+ width: 240px;
373
+ background-color: var(--authos-color-surface);
374
+ border: 1px solid var(--authos-color-border);
375
+ border-radius: var(--authos-border-radius);
376
+ box-shadow: var(--authos-shadow-lg);
377
+ z-index: 50;
378
+ overflow: hidden;
379
+ animation: authos-fade-in 150ms ease-out;
380
+ }
381
+
382
+ @keyframes authos-fade-in {
383
+ from { opacity: 0; transform: translateY(-4px); }
384
+ to { opacity: 1; transform: translateY(0); }
385
+ }
386
+
387
+ [data-authos-user-info] {
388
+ padding: var(--authos-spacing-md);
389
+ display: flex;
390
+ flex-direction: column;
391
+ gap: 0.25rem;
392
+ }
393
+
394
+ [data-authos-user-info] [data-authos-email] {
395
+ font-weight: 500;
396
+ color: var(--authos-color-foreground);
397
+ word-break: break-all;
398
+ }
399
+
400
+ [data-authos-badge] {
401
+ display: inline-flex;
402
+ align-self: flex-start;
403
+ padding: 0.125rem 0.375rem;
404
+ font-size: 0.7rem;
405
+ font-weight: 500;
406
+ color: var(--authos-color-primary);
407
+ background-color: rgba(99, 102, 241, 0.1);
408
+ border-radius: 9999px;
409
+ }
410
+
411
+ [data-authos-user-menu] [data-authos-logout] {
412
+ width: 100%;
413
+ text-align: left;
414
+ padding: 0.75rem 1rem;
415
+ font-size: var(--authos-font-size-sm);
416
+ color: var(--authos-color-danger);
417
+ background: transparent;
418
+ border: none;
419
+ border-top: 1px solid var(--authos-color-border);
420
+ cursor: pointer;
421
+ transition: background-color var(--authos-transition);
422
+ }
423
+
424
+ [data-authos-user-menu] [data-authos-logout]:hover {
425
+ background-color: rgba(239, 68, 68, 0.05);
426
+ }
427
+
428
+ /* ==========================================================================
429
+ Organization Switcher Styles
430
+ ========================================================================== */
431
+
432
+ [data-authos-orgswitcher] {
433
+ font-family: var(--authos-font-family);
434
+ font-size: var(--authos-font-size-sm);
435
+ }
436
+
437
+ [data-authos-orgswitcher] select {
438
+ padding: 0.5rem 2rem 0.5rem 0.75rem;
439
+ font-size: var(--authos-font-size-sm);
440
+ font-family: inherit;
441
+ color: var(--authos-color-foreground);
442
+ background-color: var(--authos-color-input);
443
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
444
+ background-repeat: no-repeat;
445
+ background-position: right 0.5rem center;
446
+ border: 1px solid var(--authos-color-input-border);
447
+ border-radius: var(--authos-border-radius);
448
+ cursor: pointer;
449
+ outline: none;
450
+ appearance: none;
451
+ -webkit-appearance: none;
452
+ -moz-appearance: none;
453
+ transition: border-color var(--authos-transition), box-shadow var(--authos-transition);
454
+ }
455
+
456
+ [data-authos-orgswitcher] select:focus {
457
+ border-color: var(--authos-color-input-focus);
458
+ box-shadow: 0 0 0 3px var(--authos-color-ring);
459
+ }
460
+
461
+ [data-authos-orgswitcher] select:disabled {
462
+ opacity: 0.6;
463
+ cursor: not-allowed;
464
+ }
465
+
466
+ /* ==========================================================================
467
+ Loading State
468
+ ========================================================================== */
469
+
470
+ [data-state="loading"] {
471
+ opacity: 0.6;
472
+ }
473
+ `;
474
+ var stylesInjected = false;
475
+ function injectStyles() {
476
+ if (stylesInjected) return;
477
+ if (typeof document === "undefined") return;
478
+ const styleElement = document.createElement("style");
479
+ styleElement.setAttribute("data-authos-styles", "");
480
+ styleElement.textContent = AUTHOS_STYLES;
481
+ document.head.appendChild(styleElement);
482
+ stylesInjected = true;
483
+ }
484
+ function applyVariables(variables) {
485
+ if (typeof document === "undefined") return;
486
+ const root = document.documentElement;
487
+ for (const [key, value] of Object.entries(variables)) {
488
+ const cssVar = `--authos-${key.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
489
+ root.style.setProperty(cssVar, value);
490
+ }
491
+ }
8
492
  var AuthOSContext = react.createContext(null);
9
493
  function AuthOSProvider({ config, children, client: externalClient, initialSessionToken }) {
10
494
  const clientRef = react.useRef(null);
@@ -12,6 +496,12 @@ function AuthOSProvider({ config, children, client: externalClient, initialSessi
12
496
  clientRef.current = externalClient ?? new ssoSdk.SsoClient(config);
13
497
  }
14
498
  const client = clientRef.current;
499
+ react.useEffect(() => {
500
+ injectStyles();
501
+ if (config.appearance?.variables) {
502
+ applyVariables(config.appearance.variables);
503
+ }
504
+ }, [config.appearance]);
15
505
  const hasInitialToken = react.useRef(!!initialSessionToken);
16
506
  react.useEffect(() => {
17
507
  if (initialSessionToken && hasInitialToken.current) {
@@ -124,6 +614,26 @@ var PROVIDER_NAMES = {
124
614
  google: "Google",
125
615
  microsoft: "Microsoft"
126
616
  };
617
+ function getProviderIcon(provider) {
618
+ switch (provider) {
619
+ case "github":
620
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 0C5.374 0 0 5.373 0 12c0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z" }) });
621
+ case "google":
622
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
623
+ /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "#4285F4", d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z" }),
624
+ /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "#34A853", d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" }),
625
+ /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "#FBBC05", d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" }),
626
+ /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "#EA4335", d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" })
627
+ ] });
628
+ case "microsoft":
629
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 23 23", "aria-hidden": "true", children: [
630
+ /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "#f35325", d: "M1 1h10v10H1z" }),
631
+ /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "#81bc06", d: "M12 1h10v10H12z" }),
632
+ /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "#05a6f0", d: "M1 12h10v10H1z" }),
633
+ /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "#ffba08", d: "M12 12h10v10H12z" })
634
+ ] });
635
+ }
636
+ }
127
637
  function OAuthButton({
128
638
  provider,
129
639
  children,
@@ -167,7 +677,13 @@ See: https://docs.authos.dev/react/oauth-setup`
167
677
  disabled,
168
678
  "data-authos-oauth": "",
169
679
  "data-provider": provider,
170
- children: children ?? `Continue with ${PROVIDER_NAMES[provider]}`
680
+ children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
681
+ getProviderIcon(provider),
682
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
683
+ "Continue with ",
684
+ PROVIDER_NAMES[provider]
685
+ ] })
686
+ ] })
171
687
  }
172
688
  );
173
689
  }
@@ -197,7 +713,12 @@ function SignIn({
197
713
  setError(null);
198
714
  setIsLoading(true);
199
715
  try {
200
- const result = await client.auth.login({ email, password });
716
+ const result = await client.auth.login({
717
+ email,
718
+ password,
719
+ org_slug: config.org,
720
+ service_slug: config.service
721
+ });
201
722
  if (result.expires_in === MFA_PREAUTH_EXPIRY) {
202
723
  setPreauthToken(result.access_token);
203
724
  setState("mfa");
@@ -214,7 +735,7 @@ function SignIn({
214
735
  setIsLoading(false);
215
736
  }
216
737
  },
217
- [client, email, password, setUser, onSuccess, onError]
738
+ [client, email, password, config.org, config.service, setUser, onSuccess, onError]
218
739
  );
219
740
  const handleMfaSubmit = react.useCallback(
220
741
  async (e) => {
@@ -322,7 +843,7 @@ function SignIn({
322
843
  ] })
323
844
  ] });
324
845
  }
325
- function SignUp({ onSuccess, onError, orgSlug, showSignIn = true, className }) {
846
+ function SignUp({ onSuccess, onError, orgSlug, serviceSlug, showSignIn = true, className }) {
326
847
  const { client } = useAuthOSContext();
327
848
  const [email, setEmail] = react.useState("");
328
849
  const [password, setPassword] = react.useState("");
@@ -347,7 +868,8 @@ function SignUp({ onSuccess, onError, orgSlug, showSignIn = true, className }) {
347
868
  await client.auth.register({
348
869
  email,
349
870
  password,
350
- org_slug: orgSlug
871
+ org_slug: orgSlug,
872
+ service_slug: serviceSlug
351
873
  });
352
874
  setIsSuccess(true);
353
875
  onSuccess?.();
@@ -359,7 +881,7 @@ function SignUp({ onSuccess, onError, orgSlug, showSignIn = true, className }) {
359
881
  setIsLoading(false);
360
882
  }
361
883
  },
362
- [client, email, password, confirmPassword, orgSlug, onSuccess, onError]
884
+ [client, email, password, confirmPassword, orgSlug, serviceSlug, onSuccess, onError]
363
885
  );
364
886
  if (isSuccess) {
365
887
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className, "data-authos-signup": true, "data-state": "success", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-authos-success": true, children: [
@@ -547,33 +1069,33 @@ function UserButton({ className, showEmail = false, onLogout }) {
547
1069
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className, "data-authos-userbutton": true, "data-state": "signed-out", children: /* @__PURE__ */ jsxRuntime.jsx("span", { "data-authos-user-placeholder": true, children: "Not signed in" }) });
548
1070
  }
549
1071
  const initials = user.email.split("@")[0].split(".").map((part) => part[0]?.toUpperCase() ?? "").slice(0, 2).join("");
550
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, "data-authos-userbutton": true, "data-state": isOpen ? "open" : "closed", children: [
1072
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, "data-authos-userbutton": "", "data-state": isOpen ? "open" : "closed", children: [
551
1073
  /* @__PURE__ */ jsxRuntime.jsxs(
552
1074
  "button",
553
1075
  {
554
1076
  type: "button",
555
1077
  onClick: () => setIsOpen(!isOpen),
556
1078
  disabled: isLoggingOut,
557
- "data-authos-user-trigger": true,
1079
+ "data-authos-user-trigger": "",
558
1080
  children: [
559
- /* @__PURE__ */ jsxRuntime.jsx("span", { "data-authos-user-avatar": true, "aria-hidden": "true", children: initials }),
560
- showEmail && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-authos-user-email": true, children: user.email })
1081
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "data-authos-avatar": "", "aria-hidden": "true", children: initials }),
1082
+ showEmail && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-authos-email": "", children: user.email })
561
1083
  ]
562
1084
  }
563
1085
  ),
564
- isOpen && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-authos-user-menu": true, children: [
565
- /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-authos-user-info": true, children: [
566
- /* @__PURE__ */ jsxRuntime.jsx("span", { "data-authos-user-email": true, children: user.email }),
567
- user.is_platform_owner && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-authos-user-badge": true, children: "Platform Owner" })
1086
+ isOpen && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-authos-user-menu": "", children: [
1087
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-authos-user-info": "", children: [
1088
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "data-authos-email": "", children: user.email }),
1089
+ user.is_platform_owner && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-authos-badge": "", children: "Platform Owner" })
568
1090
  ] }),
569
- /* @__PURE__ */ jsxRuntime.jsx("hr", { "data-authos-divider": true }),
1091
+ /* @__PURE__ */ jsxRuntime.jsx("div", { "data-authos-divider": "" }),
570
1092
  /* @__PURE__ */ jsxRuntime.jsx(
571
1093
  "button",
572
1094
  {
573
1095
  type: "button",
574
1096
  onClick: handleLogout,
575
1097
  disabled: isLoggingOut,
576
- "data-authos-logout": true,
1098
+ "data-authos-logout": "",
577
1099
  children: isLoggingOut ? "Signing out..." : "Sign out"
578
1100
  }
579
1101
  )