@atlasauth/embed 0.1.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/appearance.d.ts +293 -0
- package/dist/appearance.js +206 -0
- package/dist/appearance.js.map +1 -0
- package/dist/client.d.ts +12 -0
- package/dist/client.js +49 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +27 -0
- package/dist/config.js +61 -0
- package/dist/config.js.map +1 -0
- package/dist/element.d.ts +23 -0
- package/dist/element.js +51 -0
- package/dist/element.js.map +1 -0
- package/dist/embed.js +361 -0
- package/dist/icons.d.ts +17 -0
- package/dist/icons.js +53 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/mount.d.ts +7 -0
- package/dist/mount.js +33 -0
- package/dist/mount.js.map +1 -0
- package/dist/redirect.d.ts +17 -0
- package/dist/redirect.js +51 -0
- package/dist/redirect.js.map +1 -0
- package/dist/standalone.d.ts +25 -0
- package/dist/standalone.js +34 -0
- package/dist/standalone.js.map +1 -0
- package/dist/styles.d.ts +17 -0
- package/dist/styles.js +389 -0
- package/dist/styles.js.map +1 -0
- package/dist/widget/captcha.d.ts +21 -0
- package/dist/widget/captcha.js +197 -0
- package/dist/widget/captcha.js.map +1 -0
- package/dist/widget/constants.d.ts +16 -0
- package/dist/widget/constants.js +14 -0
- package/dist/widget/constants.js.map +1 -0
- package/dist/widget/dom.d.ts +18 -0
- package/dist/widget/dom.js +71 -0
- package/dist/widget/dom.js.map +1 -0
- package/dist/widget/flow.d.ts +41 -0
- package/dist/widget/flow.js +424 -0
- package/dist/widget/flow.js.map +1 -0
- package/dist/widget/forms.d.ts +35 -0
- package/dist/widget/forms.js +499 -0
- package/dist/widget/forms.js.map +1 -0
- package/dist/widget/passkey.d.ts +18 -0
- package/dist/widget/passkey.js +88 -0
- package/dist/widget/passkey.js.map +1 -0
- package/dist/widget/render.d.ts +21 -0
- package/dist/widget/render.js +210 -0
- package/dist/widget/render.js.map +1 -0
- package/dist/widget/social.d.ts +44 -0
- package/dist/widget/social.js +331 -0
- package/dist/widget/social.js.map +1 -0
- package/dist/widget.d.ts +124 -0
- package/dist/widget.js +182 -0
- package/dist/widget.js.map +1 -0
- package/package.json +27 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type FieldError } from '@atlasauth/js';
|
|
2
|
+
import type { AtlasWidget } from '../widget';
|
|
3
|
+
export declare function renderNote(w: AtlasWidget, text: string): void;
|
|
4
|
+
/**
|
|
5
|
+
* A proper loading state — shown while /v1/appearance resolves, while an
|
|
6
|
+
* OAuth/hosted ticket is exchanged on redirect-back, and (via `busy`) while a
|
|
7
|
+
* form submits. Replaces the old bare "Loading…" text so the widget never
|
|
8
|
+
* flashes blank. The indicator style is the tenant's `interaction.loading`
|
|
9
|
+
* (spinner | skeleton | dots | bar); `role="status"` announces it to AT.
|
|
10
|
+
*/
|
|
11
|
+
export declare function renderLoading(w: AtlasWidget): void;
|
|
12
|
+
export declare function renderErrors(w: AtlasWidget, errors: readonly FieldError[]): void;
|
|
13
|
+
export declare function render(w: AtlasWidget): void;
|
|
14
|
+
/**
|
|
15
|
+
* The continuation line under the title on a non-start step: what to do, where
|
|
16
|
+
* the code went, and (where it makes sense) a way back to the email panel — so
|
|
17
|
+
* the step reads as the SAME panel spawning the next field, not a new screen.
|
|
18
|
+
*/
|
|
19
|
+
export declare function renderStepContext(w: AtlasWidget, stepKind: string): HTMLElement | null;
|
|
20
|
+
/** Back to the start — a fresh identifier panel (the "use a different email" action). */
|
|
21
|
+
export declare function restart(w: AtlasWidget): void;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderNote = renderNote;
|
|
4
|
+
exports.renderLoading = renderLoading;
|
|
5
|
+
exports.renderErrors = renderErrors;
|
|
6
|
+
exports.render = render;
|
|
7
|
+
exports.renderStepContext = renderStepContext;
|
|
8
|
+
exports.restart = restart;
|
|
9
|
+
const js_1 = require("@atlasauth/js");
|
|
10
|
+
const constants_1 = require("./constants");
|
|
11
|
+
const dom_1 = require("./dom");
|
|
12
|
+
const forms_1 = require("./forms");
|
|
13
|
+
const social_1 = require("./social");
|
|
14
|
+
// ---- rendering -----------------------------------------------------------
|
|
15
|
+
function renderNote(w, text) {
|
|
16
|
+
w.root.textContent = '';
|
|
17
|
+
const card = (0, dom_1.el)(w, 'div', (0, dom_1.cls)(w, 'card', 'atlas-embed-card'));
|
|
18
|
+
card.appendChild((0, dom_1.el)(w, 'p', 'atlas-embed-note', text));
|
|
19
|
+
w.root.appendChild(card);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A proper loading state — shown while /v1/appearance resolves, while an
|
|
23
|
+
* OAuth/hosted ticket is exchanged on redirect-back, and (via `busy`) while a
|
|
24
|
+
* form submits. Replaces the old bare "Loading…" text so the widget never
|
|
25
|
+
* flashes blank. The indicator style is the tenant's `interaction.loading`
|
|
26
|
+
* (spinner | skeleton | dots | bar); `role="status"` announces it to AT.
|
|
27
|
+
*/
|
|
28
|
+
function renderLoading(w) {
|
|
29
|
+
w.root.textContent = '';
|
|
30
|
+
const card = (0, dom_1.el)(w, 'div', (0, dom_1.cls)(w, 'card', 'atlas-embed-card'));
|
|
31
|
+
const style = w.interaction.loading;
|
|
32
|
+
const box = (0, dom_1.el)(w, 'div', 'atlas-embed-loading');
|
|
33
|
+
box.setAttribute('data-loading', style);
|
|
34
|
+
box.setAttribute('role', 'status');
|
|
35
|
+
box.setAttribute('aria-label', 'Loading');
|
|
36
|
+
if (style === 'skeleton') {
|
|
37
|
+
for (const kind of ['title', 'sub', 'input', 'input', 'button']) {
|
|
38
|
+
box.appendChild((0, dom_1.el)(w, 'div', `atlas-embed-skel atlas-embed-skel-${kind}`));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else if (style === 'dots') {
|
|
42
|
+
for (let i = 0; i < 3; i += 1)
|
|
43
|
+
box.appendChild((0, dom_1.el)(w, 'span', 'atlas-embed-dot'));
|
|
44
|
+
}
|
|
45
|
+
else if (style === 'bar') {
|
|
46
|
+
box.appendChild((0, dom_1.el)(w, 'span', 'atlas-embed-loadbar'));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
box.appendChild((0, dom_1.el)(w, 'span', 'atlas-embed-spinner'));
|
|
50
|
+
}
|
|
51
|
+
// A visually-hidden label so a screen reader announces progress for every style.
|
|
52
|
+
const sr = (0, dom_1.el)(w, 'span', 'atlas-embed-sr', 'Loading…');
|
|
53
|
+
box.appendChild(sr);
|
|
54
|
+
card.appendChild(box);
|
|
55
|
+
w.root.appendChild(card);
|
|
56
|
+
}
|
|
57
|
+
function renderErrors(w, errors) {
|
|
58
|
+
// Re-render then surface the errors on the current step.
|
|
59
|
+
w.state = { ...w.state, errors: [...errors] };
|
|
60
|
+
render(w);
|
|
61
|
+
}
|
|
62
|
+
function render(w) {
|
|
63
|
+
w.root.textContent = '';
|
|
64
|
+
const card = (0, dom_1.el)(w, 'div', (0, dom_1.cls)(w, 'card', 'atlas-embed-card'));
|
|
65
|
+
const logoUrl = w.appearance?.logoUrl ?? null;
|
|
66
|
+
if (logoUrl) {
|
|
67
|
+
const img = (0, dom_1.doc)(w).createElement('img');
|
|
68
|
+
img.className = 'atlas-embed-logo';
|
|
69
|
+
img.src = logoUrl;
|
|
70
|
+
img.alt = w.appearance?.applicationName ?? '';
|
|
71
|
+
card.appendChild(img);
|
|
72
|
+
}
|
|
73
|
+
// §5.4 the "forgot password" sub-flow takes over the whole panel until it
|
|
74
|
+
// completes or the user goes back to sign in.
|
|
75
|
+
if (w.resetFlow) {
|
|
76
|
+
const rk = `reset_${(0, js_1.resetStep)(w.resetFlow)}`;
|
|
77
|
+
card.setAttribute('data-step', rk);
|
|
78
|
+
if (rk !== w.lastStepKind)
|
|
79
|
+
card.setAttribute('data-enter', '');
|
|
80
|
+
w.lastStepKind = rk;
|
|
81
|
+
card.appendChild((0, forms_1.renderReset)(w));
|
|
82
|
+
if (w.appearance?.footer) {
|
|
83
|
+
card.appendChild((0, dom_1.el)(w, 'p', (0, dom_1.cls)(w, 'footer', 'atlas-embed-footer'), w.appearance.footer));
|
|
84
|
+
}
|
|
85
|
+
w.root.appendChild(card);
|
|
86
|
+
if (card.hasAttribute('data-enter')) {
|
|
87
|
+
const focusTarget = card.querySelector('[data-atlas-autofocus]');
|
|
88
|
+
if (focusTarget instanceof HTMLElement)
|
|
89
|
+
focusTarget.focus();
|
|
90
|
+
}
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const step = w.state.attempt
|
|
94
|
+
? (0, js_1.nextStep)(w.state.attempt)
|
|
95
|
+
: { kind: 'collect_identifier' };
|
|
96
|
+
// Sign-up mode with no attempt yet: the create-account form — the tenant's
|
|
97
|
+
// configured fields + email + password — posted to /v1/client/sign_ups.
|
|
98
|
+
const isSignUpStart = w.mode === 'sign-up' && !w.state.attempt;
|
|
99
|
+
const atStart = isSignUpStart || step.kind === 'collect_identifier';
|
|
100
|
+
// Mark the card with the step so it can be styled + animate ONLY when the
|
|
101
|
+
// step actually changes (not on every error/busy re-render), so a code step
|
|
102
|
+
// spawns in once rather than flickering on each keystroke.
|
|
103
|
+
const stepKind = w.handlePrompt ? 'handle' : step.kind;
|
|
104
|
+
card.setAttribute('data-step', stepKind);
|
|
105
|
+
if (stepKind !== w.lastStepKind)
|
|
106
|
+
card.setAttribute('data-enter', '');
|
|
107
|
+
w.lastStepKind = stepKind;
|
|
108
|
+
const title = w.appearance?.headline ?? constants_1.COPY[w.mode].title;
|
|
109
|
+
card.appendChild((0, dom_1.el)(w, 'h1', (0, dom_1.cls)(w, 'title', 'atlas-embed-title'), title));
|
|
110
|
+
// At the start, the tenant's own subheadline. On a later step, a context line
|
|
111
|
+
// that ties it back to the email panel ("Enter the code we sent to …") plus a
|
|
112
|
+
// way back — so the code/password step reads as a continuation of the same
|
|
113
|
+
// panel, not a brand-new screen.
|
|
114
|
+
const context = atStart ? null : renderStepContext(w, step.kind);
|
|
115
|
+
if (context) {
|
|
116
|
+
card.appendChild(context);
|
|
117
|
+
}
|
|
118
|
+
else if (w.appearance?.subheadline) {
|
|
119
|
+
card.appendChild((0, dom_1.el)(w, 'p', (0, dom_1.cls)(w, 'subtitle', 'atlas-embed-subtitle'), w.appearance.subheadline));
|
|
120
|
+
}
|
|
121
|
+
// A one-time confirmation banner (e.g. after a force-login password reset).
|
|
122
|
+
if (w.flash)
|
|
123
|
+
card.appendChild((0, dom_1.el)(w, 'div', 'atlas-embed-flash', w.flash));
|
|
124
|
+
// Handle-first provider (Bluesky): a dedicated sub-screen collecting the
|
|
125
|
+
// handle, in place of the normal identifier form + social buttons.
|
|
126
|
+
if (w.handlePrompt) {
|
|
127
|
+
card.appendChild((0, social_1.renderHandlePrompt)(w, w.handlePrompt));
|
|
128
|
+
if (w.appearance?.footer) {
|
|
129
|
+
card.appendChild((0, dom_1.el)(w, 'p', (0, dom_1.cls)(w, 'footer', 'atlas-embed-footer'), w.appearance.footer));
|
|
130
|
+
}
|
|
131
|
+
w.root.appendChild(card);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
// Social buttons (and "Sign in with Atlas") only make sense at the very start.
|
|
135
|
+
if (atStart && ((0, social_1.socialProviders)(w).length > 0 || w.signInWithAtlas.enabled)) {
|
|
136
|
+
card.appendChild((0, social_1.renderSocial)(w));
|
|
137
|
+
card.appendChild((0, dom_1.el)(w, 'div', (0, dom_1.cls)(w, 'divider', 'atlas-embed-divider'), 'or'));
|
|
138
|
+
}
|
|
139
|
+
card.appendChild(isSignUpStart ? (0, forms_1.renderSignUpForm)(w) : (0, forms_1.renderForm)(w, step.kind));
|
|
140
|
+
// §5.5 passkey sign-in: a usernameless/discoverable-credential button at the
|
|
141
|
+
// start of a sign-in, shown only when the instance offers passkeys and the
|
|
142
|
+
// browser supports WebAuthn. The server-side finish sets the session cookie
|
|
143
|
+
// directly (no ticket exchange).
|
|
144
|
+
if (atStart && w.mode === 'sign-in' && w.passkeyEnabled && (0, js_1.passkeysSupported)()) {
|
|
145
|
+
card.appendChild((0, social_1.renderPasskeyButton)(w));
|
|
146
|
+
}
|
|
147
|
+
if (w.appearance?.footer) {
|
|
148
|
+
card.appendChild((0, dom_1.el)(w, 'p', (0, dom_1.cls)(w, 'footer', 'atlas-embed-footer'), w.appearance.footer));
|
|
149
|
+
}
|
|
150
|
+
w.root.appendChild(card);
|
|
151
|
+
// Focus the first code box (or single field) once it is in the DOM, so a code
|
|
152
|
+
// step is ready to type into — but only when the step just changed, never on a
|
|
153
|
+
// busy/error re-render (which would steal focus mid-typing).
|
|
154
|
+
if (card.hasAttribute('data-enter')) {
|
|
155
|
+
const focusTarget = card.querySelector('[data-atlas-autofocus]');
|
|
156
|
+
if (focusTarget instanceof HTMLElement)
|
|
157
|
+
focusTarget.focus();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The continuation line under the title on a non-start step: what to do, where
|
|
162
|
+
* the code went, and (where it makes sense) a way back to the email panel — so
|
|
163
|
+
* the step reads as the SAME panel spawning the next field, not a new screen.
|
|
164
|
+
*/
|
|
165
|
+
function renderStepContext(w, stepKind) {
|
|
166
|
+
const email = w.enteredIdentifier;
|
|
167
|
+
let text = null;
|
|
168
|
+
let back = false;
|
|
169
|
+
switch (stepKind) {
|
|
170
|
+
case 'collect_email_code':
|
|
171
|
+
text = email ? `Enter the code we sent to ${email}` : 'Enter the code we sent to your email';
|
|
172
|
+
back = true;
|
|
173
|
+
break;
|
|
174
|
+
case 'collect_first_factor':
|
|
175
|
+
text = email ? `Enter the password for ${email}` : 'Enter your password';
|
|
176
|
+
back = true;
|
|
177
|
+
break;
|
|
178
|
+
case 'collect_second_factor':
|
|
179
|
+
text = w.backupCodeMode
|
|
180
|
+
? 'Enter one of your backup codes'
|
|
181
|
+
: 'Enter the code from your authenticator app';
|
|
182
|
+
break;
|
|
183
|
+
case 'collect_new_password':
|
|
184
|
+
text = 'Choose a new password';
|
|
185
|
+
break;
|
|
186
|
+
case 'enroll_second_factor':
|
|
187
|
+
text = 'Enter two codes from your authenticator app to finish setup';
|
|
188
|
+
break;
|
|
189
|
+
default:
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
const wrap = (0, dom_1.el)(w, 'div', 'atlas-embed-step-context');
|
|
193
|
+
wrap.appendChild((0, dom_1.el)(w, 'p', (0, dom_1.cls)(w, 'subtitle', 'atlas-embed-subtitle'), text));
|
|
194
|
+
if (back) {
|
|
195
|
+
const button = (0, dom_1.el)(w, 'button', 'atlas-embed-step-back', 'Use a different email');
|
|
196
|
+
button.type = 'button';
|
|
197
|
+
button.addEventListener('click', () => restart(w));
|
|
198
|
+
wrap.appendChild(button);
|
|
199
|
+
}
|
|
200
|
+
return wrap;
|
|
201
|
+
}
|
|
202
|
+
/** Back to the start — a fresh identifier panel (the "use a different email" action). */
|
|
203
|
+
function restart(w) {
|
|
204
|
+
w.state = js_1.initialFlow;
|
|
205
|
+
w.backupCodeMode = false;
|
|
206
|
+
w.handlePrompt = null;
|
|
207
|
+
w.enteredIdentifier = null;
|
|
208
|
+
render(w);
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/widget/render.ts"],"names":[],"mappings":";;AASA,gCAKC;AASD,sCAwBC;AAED,oCAIC;AAED,wBA4GC;AAOD,8CAqCC;AAGD,0BAMC;AAxND,sCAAqG;AAErG,2CAAmC;AACnC,+BAAqC;AACrC,mCAAoE;AACpE,qCAAkG;AAElG,6EAA6E;AAE7E,SAAgB,UAAU,CAAC,CAAc,EAAE,IAAY;IACrD,CAAC,CAAC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,MAAM,IAAI,GAAG,IAAA,QAAE,EAAC,CAAC,EAAE,KAAK,EAAE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AC,IAAI,GAAG,QAAQ,CAAC;QAC9C,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,yFAAyF;AACzF,SAAgB,OAAO,CAAC,CAAc;IACpC,CAAC,CAAC,KAAK,GAAG,gBAAW,CAAC;IACtB,CAAC,CAAC,cAAc,GAAG,KAAK,CAAC;IACzB,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC;IACtB,CAAC,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAC3B,MAAM,CAAC,CAAC,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { AtlasWidget } from '../widget';
|
|
2
|
+
/** §5.5 the "Sign in with a passkey" button on the identifier screen. */
|
|
3
|
+
export declare function renderPasskeyButton(w: AtlasWidget): HTMLElement;
|
|
4
|
+
/**
|
|
5
|
+
* All providers to render as buttons: the redirect providers PLUS any native
|
|
6
|
+
* provider (e.g. Google GSI) not already among them. A native-only provider —
|
|
7
|
+
* one configured with a client_id but absent from `strategies.oauthProviders`
|
|
8
|
+
* — must still get a button, or an instance whose only social login is Google
|
|
9
|
+
* would render none at all.
|
|
10
|
+
*/
|
|
11
|
+
export declare function socialProviders(w: AtlasWidget): string[];
|
|
12
|
+
/**
|
|
13
|
+
* The "Sign in with Atlas" button — starts the preset OIDC connection's SSO
|
|
14
|
+
* flow. It is a first-class social login: it lives in the provider grid and
|
|
15
|
+
* takes the same layout/size/variant as every other provider button (a full
|
|
16
|
+
* bar in `block`, a tile in `grid`, icon-only in `icon`), so it reads as one
|
|
17
|
+
* of the grid, not a banner bolted above it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function atlasButton(w: AtlasWidget, connectionId: string): HTMLElement;
|
|
20
|
+
export declare function renderSocial(w: AtlasWidget): HTMLElement;
|
|
21
|
+
/**
|
|
22
|
+
* Wrap a carousel scroll-row with prev/next arrow buttons. The arrows page the
|
|
23
|
+
* row left/right, hide themselves entirely when everything already fits, and
|
|
24
|
+
* disable at each end — so a long row reads as a real, clickable carousel
|
|
25
|
+
* rather than a bare overflow the user might not notice they can scroll. State
|
|
26
|
+
* is recomputed on scroll and on resize (via ResizeObserver when available).
|
|
27
|
+
*/
|
|
28
|
+
export declare function carouselShell(w: AtlasWidget, row: HTMLElement): HTMLElement;
|
|
29
|
+
/** The uniform, always-styled visual button (no click behaviour of its own). */
|
|
30
|
+
export declare function styledSocialButton(w: AtlasWidget, provider: string, tag?: 'button' | 'div'): HTMLElement;
|
|
31
|
+
export declare function redirectButton(w: AtlasWidget, provider: string): HTMLElement;
|
|
32
|
+
/**
|
|
33
|
+
* The handle-first sub-screen (Bluesky). AT-Proto resolves the user's PDS from
|
|
34
|
+
* their handle, so we collect it here, then hand it to startOAuth. A Back link
|
|
35
|
+
* returns to the normal start screen.
|
|
36
|
+
*/
|
|
37
|
+
export declare function renderHandlePrompt(w: AtlasWidget, provider: string): HTMLElement;
|
|
38
|
+
/**
|
|
39
|
+
* Our uniform Google button, backed by Google's invisible real button. A DIV
|
|
40
|
+
* (role=button), not a <button>, so Google's own button can be nested legally.
|
|
41
|
+
* If GSI can't load, the same element falls back to the redirect flow so it is
|
|
42
|
+
* never a dead button.
|
|
43
|
+
*/
|
|
44
|
+
export declare function googleOverlayButton(w: AtlasWidget, clientId: string): HTMLElement;
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderPasskeyButton = renderPasskeyButton;
|
|
4
|
+
exports.socialProviders = socialProviders;
|
|
5
|
+
exports.atlasButton = atlasButton;
|
|
6
|
+
exports.renderSocial = renderSocial;
|
|
7
|
+
exports.carouselShell = carouselShell;
|
|
8
|
+
exports.styledSocialButton = styledSocialButton;
|
|
9
|
+
exports.redirectButton = redirectButton;
|
|
10
|
+
exports.renderHandlePrompt = renderHandlePrompt;
|
|
11
|
+
exports.googleOverlayButton = googleOverlayButton;
|
|
12
|
+
const js_1 = require("@atlasauth/js");
|
|
13
|
+
const appearance_1 = require("../appearance");
|
|
14
|
+
const icons_1 = require("../icons");
|
|
15
|
+
const constants_1 = require("./constants");
|
|
16
|
+
const dom_1 = require("./dom");
|
|
17
|
+
const render_1 = require("./render");
|
|
18
|
+
const flow_1 = require("./flow");
|
|
19
|
+
const passkey_1 = require("./passkey");
|
|
20
|
+
/** §5.5 the "Sign in with a passkey" button on the identifier screen. */
|
|
21
|
+
function renderPasskeyButton(w) {
|
|
22
|
+
const btn = (0, dom_1.el)(w, 'button', (0, dom_1.cls)(w, 'socialButton', 'atlas-embed-social-button'), 'Sign in with a passkey');
|
|
23
|
+
btn.type = 'button';
|
|
24
|
+
btn.setAttribute('data-atlas-passkey', '');
|
|
25
|
+
btn.disabled = w.busy;
|
|
26
|
+
btn.addEventListener('click', () => {
|
|
27
|
+
void (0, passkey_1.passkeySignIn)(w);
|
|
28
|
+
});
|
|
29
|
+
return btn;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* All providers to render as buttons: the redirect providers PLUS any native
|
|
33
|
+
* provider (e.g. Google GSI) not already among them. A native-only provider —
|
|
34
|
+
* one configured with a client_id but absent from `strategies.oauthProviders`
|
|
35
|
+
* — must still get a button, or an instance whose only social login is Google
|
|
36
|
+
* would render none at all.
|
|
37
|
+
*/
|
|
38
|
+
function socialProviders(w) {
|
|
39
|
+
const ids = [...w.providers];
|
|
40
|
+
for (const native of w.nativeProviders) {
|
|
41
|
+
if (!ids.includes(native.provider))
|
|
42
|
+
ids.push(native.provider);
|
|
43
|
+
}
|
|
44
|
+
return ids;
|
|
45
|
+
}
|
|
46
|
+
// The Atlas mark — a trusted, static, first-party SVG (never tenant input).
|
|
47
|
+
const ATLAS_MARK = '<svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true" fill="none">' +
|
|
48
|
+
'<path d="M12 2 3 21h4l5-11 5 11h4L12 2z" fill="currentColor"/>' +
|
|
49
|
+
'</svg>';
|
|
50
|
+
/**
|
|
51
|
+
* The "Sign in with Atlas" button — starts the preset OIDC connection's SSO
|
|
52
|
+
* flow. It is a first-class social login: it lives in the provider grid and
|
|
53
|
+
* takes the same layout/size/variant as every other provider button (a full
|
|
54
|
+
* bar in `block`, a tile in `grid`, icon-only in `icon`), so it reads as one
|
|
55
|
+
* of the grid, not a banner bolted above it.
|
|
56
|
+
*/
|
|
57
|
+
function atlasButton(w, connectionId) {
|
|
58
|
+
const { variant, labels } = w.social;
|
|
59
|
+
// Mirror styledSocialButton's copy rules: "Continue with Atlas" for the bar,
|
|
60
|
+
// "Atlas" for the tile/compact forms, with a per-provider label override.
|
|
61
|
+
const text = labels.atlas ?? (variant === 'block' ? 'Continue with Atlas' : 'Atlas');
|
|
62
|
+
const button = (0, dom_1.el)(w, 'button', (0, dom_1.cls)(w, 'socialButton', 'atlas-embed-social-button'));
|
|
63
|
+
button.type = 'button';
|
|
64
|
+
button.setAttribute('data-atlas-provider', 'atlas');
|
|
65
|
+
button.setAttribute('data-variant', variant);
|
|
66
|
+
const icon = (0, dom_1.doc)(w).createElement('span');
|
|
67
|
+
icon.className = 'atlas-embed-social-icon';
|
|
68
|
+
icon.innerHTML = ATLAS_MARK;
|
|
69
|
+
button.appendChild(icon);
|
|
70
|
+
if (variant === 'icon') {
|
|
71
|
+
// Icon-only: the name lives in the tooltip and the a11y label instead.
|
|
72
|
+
button.setAttribute('aria-label', 'Continue with Atlas');
|
|
73
|
+
button.setAttribute('title', 'Atlas');
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const label = (0, dom_1.doc)(w).createElement('span');
|
|
77
|
+
label.className = 'atlas-embed-social-label';
|
|
78
|
+
label.textContent = text;
|
|
79
|
+
button.appendChild(label);
|
|
80
|
+
}
|
|
81
|
+
// GSI-style: open the Atlas sign-in in a popup (with a redirect fallback when
|
|
82
|
+
// popups are blocked) so the host page never loses its own state.
|
|
83
|
+
button.addEventListener('click', () => {
|
|
84
|
+
void (0, flow_1.startSso)(w, connectionId, { popup: true });
|
|
85
|
+
});
|
|
86
|
+
return button;
|
|
87
|
+
}
|
|
88
|
+
function renderSocial(w) {
|
|
89
|
+
const providers = socialProviders(w);
|
|
90
|
+
const wrap = (0, dom_1.el)(w, 'div', 'atlas-embed-social');
|
|
91
|
+
// The layout/size/variant drive the CSS: list vs grid vs a scroll-snap
|
|
92
|
+
// carousel, button scale, and whether each button is a full bar or icon-only.
|
|
93
|
+
wrap.setAttribute('data-layout', w.social.layout);
|
|
94
|
+
wrap.setAttribute('data-size', w.social.size);
|
|
95
|
+
wrap.setAttribute('data-variant', w.social.variant);
|
|
96
|
+
// "Sign in with Atlas" leads the provider grid as its first tile — a social
|
|
97
|
+
// login among the rest, taking the same layout/variant (not a banner above).
|
|
98
|
+
if (w.signInWithAtlas.enabled && w.signInWithAtlas.connection_id) {
|
|
99
|
+
wrap.appendChild(atlasButton(w, w.signInWithAtlas.connection_id));
|
|
100
|
+
}
|
|
101
|
+
for (const provider of providers) {
|
|
102
|
+
// A native provider (Google GSI) shows OUR uniform button with Google's
|
|
103
|
+
// real button invisibly overlaid — the user sees our design, the click
|
|
104
|
+
// drives the secretless id_token flow (no redirect, no Google styling).
|
|
105
|
+
// Every other provider uses the redirect button.
|
|
106
|
+
const native = w.nativeProviders.find((n) => n.provider === provider);
|
|
107
|
+
const button = provider === 'google' && native?.client_id
|
|
108
|
+
? googleOverlayButton(w, native.client_id)
|
|
109
|
+
: redirectButton(w, provider);
|
|
110
|
+
// Guarantee the filter can find the provider even on the Google overlay.
|
|
111
|
+
if (!button.getAttribute('data-atlas-provider')) {
|
|
112
|
+
button.setAttribute('data-atlas-provider', provider);
|
|
113
|
+
}
|
|
114
|
+
wrap.appendChild(button);
|
|
115
|
+
}
|
|
116
|
+
// Carousel layout: wrap the scroll row in prev/next controls so a long row
|
|
117
|
+
// is obviously scrollable AND clickable, not just swipeable, with the arrows
|
|
118
|
+
// auto-hiding when everything already fits and disabling at each end.
|
|
119
|
+
const body = w.social.layout === 'carousel' ? carouselShell(w, wrap) : wrap;
|
|
120
|
+
// §customization: a search box to narrow a long provider list. `always`
|
|
121
|
+
// forces it; `auto` (default) shows it only past the threshold so a common
|
|
122
|
+
// handful stays button-only while a wall of 20 becomes filterable; `never`
|
|
123
|
+
// hides it. Pure client-side filter over the already-rendered buttons — it
|
|
124
|
+
// adds no request and touches no config, so it cannot expose a provider the
|
|
125
|
+
// instance has not enabled.
|
|
126
|
+
const showSearch = w.social.search === 'always' ||
|
|
127
|
+
(w.social.search === 'auto' && providers.length > appearance_1.SEARCH_AUTO_THRESHOLD);
|
|
128
|
+
if (!showSearch)
|
|
129
|
+
return body;
|
|
130
|
+
const field = (0, dom_1.el)(w, 'div', 'atlas-embed-social-field');
|
|
131
|
+
const input = (0, dom_1.doc)(w).createElement('input');
|
|
132
|
+
input.type = 'search';
|
|
133
|
+
input.className = 'atlas-embed-social-search';
|
|
134
|
+
input.setAttribute('placeholder', 'Search sign-in options…');
|
|
135
|
+
input.setAttribute('aria-label', 'Search sign-in options');
|
|
136
|
+
input.autocomplete = 'off';
|
|
137
|
+
const empty = (0, dom_1.el)(w, 'div', 'atlas-embed-social-empty');
|
|
138
|
+
empty.textContent = 'No matching sign-in options.';
|
|
139
|
+
empty.setAttribute('hidden', '');
|
|
140
|
+
const buttons = Array.from(wrap.children);
|
|
141
|
+
input.addEventListener('input', () => {
|
|
142
|
+
const q = input.value.trim().toLowerCase();
|
|
143
|
+
let visible = 0;
|
|
144
|
+
for (const b of buttons) {
|
|
145
|
+
const key = b.getAttribute('data-atlas-provider') ?? '';
|
|
146
|
+
// Match on both the display name ("GitHub") and the key ("github"), so
|
|
147
|
+
// typing either narrows correctly regardless of a label override.
|
|
148
|
+
const match = q === '' || (0, appearance_1.providerLabel)(key).toLowerCase().includes(q) || key.toLowerCase().includes(q);
|
|
149
|
+
b.toggleAttribute('hidden', !match);
|
|
150
|
+
if (match)
|
|
151
|
+
visible += 1;
|
|
152
|
+
}
|
|
153
|
+
empty.toggleAttribute('hidden', visible !== 0);
|
|
154
|
+
// Hiding buttons changes the scrollable width, so nudge the carousel to
|
|
155
|
+
// re-evaluate its arrows (a no-op for the non-carousel layouts).
|
|
156
|
+
wrap.dispatchEvent(new Event('scroll'));
|
|
157
|
+
});
|
|
158
|
+
field.appendChild(input);
|
|
159
|
+
field.appendChild(body);
|
|
160
|
+
field.appendChild(empty);
|
|
161
|
+
return field;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Wrap a carousel scroll-row with prev/next arrow buttons. The arrows page the
|
|
165
|
+
* row left/right, hide themselves entirely when everything already fits, and
|
|
166
|
+
* disable at each end — so a long row reads as a real, clickable carousel
|
|
167
|
+
* rather than a bare overflow the user might not notice they can scroll. State
|
|
168
|
+
* is recomputed on scroll and on resize (via ResizeObserver when available).
|
|
169
|
+
*/
|
|
170
|
+
function carouselShell(w, row) {
|
|
171
|
+
const win = (0, dom_1.doc)(w).defaultView ?? (typeof window !== 'undefined' ? window : null);
|
|
172
|
+
const shell = (0, dom_1.el)(w, 'div', 'atlas-embed-carousel');
|
|
173
|
+
const nav = (dir) => {
|
|
174
|
+
const b = (0, dom_1.el)(w, 'button', 'atlas-embed-carousel-nav');
|
|
175
|
+
b.type = 'button';
|
|
176
|
+
b.setAttribute('data-dir', dir);
|
|
177
|
+
b.setAttribute('aria-label', dir === 'prev' ? 'Scroll to previous sign-in options' : 'Scroll to more sign-in options');
|
|
178
|
+
b.innerHTML = dir === 'prev' ? constants_1.CHEVRON_LEFT : constants_1.CHEVRON_RIGHT;
|
|
179
|
+
b.addEventListener('click', () => {
|
|
180
|
+
const amount = Math.max(row.clientWidth * 0.8, 140);
|
|
181
|
+
// Guarded: not every host (jsdom in tests) implements scrollBy.
|
|
182
|
+
if (typeof row.scrollBy === 'function') {
|
|
183
|
+
row.scrollBy({ left: (dir === 'prev' ? -1 : 1) * amount, behavior: 'smooth' });
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
return b;
|
|
187
|
+
};
|
|
188
|
+
const prev = nav('prev');
|
|
189
|
+
const next = nav('next');
|
|
190
|
+
const update = () => {
|
|
191
|
+
const max = row.scrollWidth - row.clientWidth;
|
|
192
|
+
const overflow = max > 2;
|
|
193
|
+
shell.setAttribute('data-overflow', overflow ? 'true' : 'false');
|
|
194
|
+
prev.disabled = !overflow || row.scrollLeft <= 1;
|
|
195
|
+
next.disabled = !overflow || row.scrollLeft >= max - 1;
|
|
196
|
+
};
|
|
197
|
+
row.addEventListener('scroll', update, { passive: true });
|
|
198
|
+
const RO = win && win.ResizeObserver;
|
|
199
|
+
if (RO)
|
|
200
|
+
new RO(update).observe(row);
|
|
201
|
+
else if (win)
|
|
202
|
+
win.addEventListener('resize', update);
|
|
203
|
+
// Measure once the row has real dimensions (it is still detached here).
|
|
204
|
+
if (win?.requestAnimationFrame)
|
|
205
|
+
win.requestAnimationFrame(update);
|
|
206
|
+
update();
|
|
207
|
+
shell.appendChild(prev);
|
|
208
|
+
shell.appendChild(row);
|
|
209
|
+
shell.appendChild(next);
|
|
210
|
+
return shell;
|
|
211
|
+
}
|
|
212
|
+
/** The uniform, always-styled visual button (no click behaviour of its own). */
|
|
213
|
+
function styledSocialButton(w, provider, tag = 'button') {
|
|
214
|
+
const { variant, labels } = w.social;
|
|
215
|
+
const name = (0, appearance_1.providerLabel)(provider);
|
|
216
|
+
// `block` → "Continue with Google"; `compact`/`icon` → "Google". A per-provider
|
|
217
|
+
// label override wins for the text variants.
|
|
218
|
+
const text = labels[provider] ?? (variant === 'block' ? `Continue with ${name}` : name);
|
|
219
|
+
const element = (0, dom_1.el)(w, tag, (0, dom_1.cls)(w, 'socialButton', 'atlas-embed-social-button'));
|
|
220
|
+
if (tag === 'button')
|
|
221
|
+
element.type = 'button';
|
|
222
|
+
element.setAttribute('data-atlas-provider', provider);
|
|
223
|
+
element.setAttribute('data-variant', variant);
|
|
224
|
+
const iconSvg = (0, icons_1.providerIcon)(provider);
|
|
225
|
+
if (iconSvg) {
|
|
226
|
+
const icon = (0, dom_1.doc)(w).createElement('span');
|
|
227
|
+
icon.className = 'atlas-embed-social-icon';
|
|
228
|
+
// Trusted, static, first-party SVG (see icons.ts) — never tenant input.
|
|
229
|
+
icon.innerHTML = iconSvg;
|
|
230
|
+
element.appendChild(icon);
|
|
231
|
+
}
|
|
232
|
+
if (variant === 'icon') {
|
|
233
|
+
// Icon-only: the name lives in the tooltip and the a11y label instead.
|
|
234
|
+
element.setAttribute('aria-label', `Continue with ${name}`);
|
|
235
|
+
element.setAttribute('title', name);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
const label = (0, dom_1.doc)(w).createElement('span');
|
|
239
|
+
label.className = 'atlas-embed-social-label';
|
|
240
|
+
label.textContent = text;
|
|
241
|
+
element.appendChild(label);
|
|
242
|
+
}
|
|
243
|
+
return element;
|
|
244
|
+
}
|
|
245
|
+
function redirectButton(w, provider) {
|
|
246
|
+
const button = styledSocialButton(w, provider);
|
|
247
|
+
button.addEventListener('click', () => {
|
|
248
|
+
// Handle-first providers (Bluesky) need the user's handle to resolve their
|
|
249
|
+
// PDS before the redirect — show the small prompt instead of navigating.
|
|
250
|
+
if (constants_1.HANDLE_PROVIDERS.has(provider)) {
|
|
251
|
+
w.handlePrompt = provider;
|
|
252
|
+
(0, render_1.render)(w);
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
void (0, flow_1.startOAuth)(w, provider);
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
return button;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* The handle-first sub-screen (Bluesky). AT-Proto resolves the user's PDS from
|
|
262
|
+
* their handle, so we collect it here, then hand it to startOAuth. A Back link
|
|
263
|
+
* returns to the normal start screen.
|
|
264
|
+
*/
|
|
265
|
+
function renderHandlePrompt(w, provider) {
|
|
266
|
+
const name = (0, appearance_1.providerLabel)(provider);
|
|
267
|
+
const form = (0, dom_1.doc)(w).createElement('form');
|
|
268
|
+
form.className = 'atlas-embed-form';
|
|
269
|
+
form.setAttribute('novalidate', 'true');
|
|
270
|
+
for (const err of w.state.errors.filter((e) => !e.param)) {
|
|
271
|
+
form.appendChild((0, dom_1.el)(w, 'div', 'atlas-embed-form-error', err.message));
|
|
272
|
+
}
|
|
273
|
+
const field = (0, dom_1.el)(w, 'label', (0, dom_1.cls)(w, 'field', 'atlas-embed-field'));
|
|
274
|
+
field.appendChild((0, dom_1.el)(w, 'span', (0, dom_1.cls)(w, 'label', 'atlas-embed-label'), `${name} handle`));
|
|
275
|
+
const input = (0, dom_1.doc)(w).createElement('input');
|
|
276
|
+
input.className = (0, dom_1.cls)(w, 'input', 'atlas-embed-input');
|
|
277
|
+
input.type = 'text';
|
|
278
|
+
input.name = 'identifier';
|
|
279
|
+
input.placeholder = 'you.bsky.social';
|
|
280
|
+
input.setAttribute('autocomplete', 'username');
|
|
281
|
+
input.setAttribute('autocapitalize', 'none');
|
|
282
|
+
input.setAttribute('spellcheck', 'false');
|
|
283
|
+
field.appendChild(input);
|
|
284
|
+
form.appendChild(field);
|
|
285
|
+
const button = (0, dom_1.submitButton)(w, constants_1.COPY[w.mode].submit);
|
|
286
|
+
form.appendChild(button);
|
|
287
|
+
const back = (0, dom_1.el)(w, 'button', 'atlas-embed-handle-back', 'Back');
|
|
288
|
+
back.type = 'button';
|
|
289
|
+
back.addEventListener('click', () => {
|
|
290
|
+
w.handlePrompt = null;
|
|
291
|
+
w.state = { ...w.state, errors: [] };
|
|
292
|
+
(0, render_1.render)(w);
|
|
293
|
+
});
|
|
294
|
+
form.appendChild(back);
|
|
295
|
+
form.addEventListener('submit', (event) => {
|
|
296
|
+
event.preventDefault();
|
|
297
|
+
const handle = input.value.trim();
|
|
298
|
+
if (!handle) {
|
|
299
|
+
w.state = {
|
|
300
|
+
...w.state,
|
|
301
|
+
errors: [{ code: 'validation_error', message: `Enter your ${name} handle.` }],
|
|
302
|
+
};
|
|
303
|
+
(0, render_1.render)(w);
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
void (0, flow_1.startOAuth)(w, provider, handle);
|
|
307
|
+
});
|
|
308
|
+
return form;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Our uniform Google button, backed by Google's invisible real button. A DIV
|
|
312
|
+
* (role=button), not a <button>, so Google's own button can be nested legally.
|
|
313
|
+
* If GSI can't load, the same element falls back to the redirect flow so it is
|
|
314
|
+
* never a dead button.
|
|
315
|
+
*/
|
|
316
|
+
function googleOverlayButton(w, clientId) {
|
|
317
|
+
const element = styledSocialButton(w, 'google', 'div');
|
|
318
|
+
element.setAttribute('role', 'button');
|
|
319
|
+
element.setAttribute('tabindex', '0');
|
|
320
|
+
void (0, js_1.renderGoogleOverlayButton)({
|
|
321
|
+
wrapper: element,
|
|
322
|
+
clientId,
|
|
323
|
+
onCredential: (idToken) => void (0, flow_1.completeIdToken)(w, 'google', idToken),
|
|
324
|
+
onError: () => (0, render_1.renderNote)(w, 'Google sign-in could not start.'),
|
|
325
|
+
}).catch(() => {
|
|
326
|
+
// GSI blocked/offline — make the same button do the redirect flow instead.
|
|
327
|
+
element.addEventListener('click', () => void (0, flow_1.startOAuth)(w, 'google'));
|
|
328
|
+
});
|
|
329
|
+
return element;
|
|
330
|
+
}
|
|
331
|
+
//# sourceMappingURL=social.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"social.js","sourceRoot":"","sources":["../../src/widget/social.ts"],"names":[],"mappings":";;AAWA,kDAcC;AASD,0CAMC;AAeD,kCAqCC;AAED,oCAiFC;AASD,sCA4CC;AAGD,gDAqCC;AAED,wCAaC;AAOD,gDAkDC;AAQD,kDAcC;AA1WD,sCAA0D;AAC1D,8CAAqE;AACrE,oCAAwC;AAExC,2CAAkF;AAClF,+BAAmD;AACnD,qCAA8C;AAC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