@base316/react 0.6.0 → 0.8.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.
@@ -41,12 +41,12 @@
41
41
  },
42
42
  {
43
43
  "name": "appearance",
44
- "summary": "Colours, radius and font as tokens. Restyles everything at once.",
44
+ "summary": "Colors, radius and font as tokens. Restyles everything at once.",
45
45
  "required": false
46
46
  },
47
47
  {
48
48
  "name": "tenant",
49
- "summary": "White-label everything inside for one tenant — `{ organizationId }` or `{ organizationExternalId }`. A firm's name, logo and colours on the screens it runs its clients on; its own branding, then its parent's, then the environment's. Change it when the user switches team.",
49
+ "summary": "White-label everything inside for one tenant — `{ organizationId }` or `{ organizationExternalId }`. A firm's name, logo and colors on the screens it runs its clients on; its own branding, then its parent's, then the environment's. Change it when the user switches team.",
50
50
  "required": false
51
51
  },
52
52
  {
@@ -87,7 +87,7 @@
87
87
  {
88
88
  "name": "SignIn",
89
89
  "kind": "component",
90
- "summary": "Password, passkey, magic-link and text-message sign-in in one form.",
90
+ "summary": "Sign in the ways the environment offers — password, magic link, passkeys, text message, social providers and SSO, as switched on in the dashboard (`GET /v1/auth/methods`).",
91
91
  "useWhen": "The application renders its own sign-in rather than redirecting to the hosted page.",
92
92
  "requires": [],
93
93
  "props": [
@@ -96,24 +96,59 @@
96
96
  "summary": "Called once a session exists.",
97
97
  "required": false
98
98
  },
99
+ {
100
+ "name": "password",
101
+ "summary": "`false` hides the password form. Every method prop can only turn a method off.",
102
+ "required": false
103
+ },
99
104
  {
100
105
  "name": "passkeys",
101
- "summary": "Offer passkeys where supported. On by default.",
106
+ "summary": "`false` hides passkeys; otherwise offered where the environment and browser allow.",
107
+ "required": false
108
+ },
109
+ {
110
+ "name": "magicLink",
111
+ "summary": "`false` hides the emailed sign-in link.",
102
112
  "required": false
103
113
  },
104
114
  {
105
115
  "name": "magicLinkRedirectUrl",
106
- "summary": "Where an emailed link lands, which must be registered on the environment. Without it, magic link is not offered at all.",
116
+ "summary": "Where an emailed link lands; defaults to the page rendering the form, which redeems `?token=`. Must be on the environment's redirect allow-list.",
107
117
  "required": false
108
118
  },
109
119
  {
110
120
  "name": "phone",
111
- "summary": "Offer signing in with a code sent by text message. Needs text messages switched on for the environment, and its own Twilio account in production.",
121
+ "summary": "`false` hides text-message codes.",
122
+ "required": false
123
+ },
124
+ {
125
+ "name": "social",
126
+ "summary": "`false` hides the social buttons; a list of slugs keeps only those providers.",
127
+ "required": false
128
+ },
129
+ {
130
+ "name": "sso",
131
+ "summary": "`false` hides \"Sign in with SSO\".",
132
+ "required": false
133
+ },
134
+ {
135
+ "name": "socialRedirectUrl",
136
+ "summary": "Your server route a social or SSO sign-in returns to with `?code=&state=`: check `state` against the `b316_oauth_state` cookie (`readOAuthState`), then `base316.auth.exchangeCode` with the secret key. On the redirect allow-list. Without it no social or SSO button is shown.",
137
+ "required": false
138
+ },
139
+ {
140
+ "name": "socialState",
141
+ "summary": "A short value carried through a social or SSO sign-in, returned by `readOAuthState`.",
142
+ "required": false
143
+ },
144
+ {
145
+ "name": "labels",
146
+ "summary": "Wording for the form, for translation.",
112
147
  "required": false
113
148
  },
114
149
  {
115
150
  "name": "secondFactorLabels",
116
- "summary": "Wording for the second-factor step (code box, or enrolment when the environment requires a factor and the user has none), for translation. English when omitted.",
151
+ "summary": "Wording for the second-factor step (code box, or enrollment when the environment requires a factor and the user has none), for translation. English when omitted.",
117
152
  "required": false
118
153
  },
119
154
  {
@@ -133,6 +168,49 @@
133
168
  "SecondFactorStep"
134
169
  ]
135
170
  },
171
+ {
172
+ "name": "SocialSignIn",
173
+ "kind": "component",
174
+ "summary": "The environment's social sign-in buttons alone (\"Continue with Google\"), for a sign-in or sign-up form you draw yourself.",
175
+ "useWhen": "Your own form needs the social providers switched on in the dashboard. SignIn and SignUp already include them.",
176
+ "requires": [],
177
+ "props": [
178
+ {
179
+ "name": "socialRedirectUrl",
180
+ "summary": "Your server route the code lands on with `?code=&state=`; check with `readOAuthState`, redeem with `exchangeCode`. On the redirect allow-list. Without it nothing is drawn.",
181
+ "required": false
182
+ },
183
+ {
184
+ "name": "socialState",
185
+ "summary": "A short value carried through, returned by `readOAuthState`.",
186
+ "required": false
187
+ },
188
+ {
189
+ "name": "social",
190
+ "summary": "`false` hides every button; a list of slugs keeps only those providers.",
191
+ "required": false
192
+ },
193
+ {
194
+ "name": "intent",
195
+ "summary": "`sign-up` hides the buttons when the environment is closed to new accounts.",
196
+ "required": false
197
+ },
198
+ {
199
+ "name": "divider",
200
+ "summary": "Draw an \"or\" rule under the buttons.",
201
+ "required": false
202
+ },
203
+ {
204
+ "name": "labels",
205
+ "summary": "`continueWith` and `or`, for translation.",
206
+ "required": false
207
+ }
208
+ ],
209
+ "seeAlso": [
210
+ "SignIn",
211
+ "SignUp"
212
+ ]
213
+ },
136
214
  {
137
215
  "name": "SignUp",
138
216
  "kind": "component",
@@ -165,6 +243,21 @@
165
243
  "summary": "Wording for the second-factor step, for translation.",
166
244
  "required": false
167
245
  },
246
+ {
247
+ "name": "social",
248
+ "summary": "`false` hides the social buttons; a list of slugs keeps only those providers.",
249
+ "required": false
250
+ },
251
+ {
252
+ "name": "socialRedirectUrl",
253
+ "summary": "Where a social sign-up returns with `?code=&state=`, as on SignIn. Without it no social button is shown.",
254
+ "required": false
255
+ },
256
+ {
257
+ "name": "socialState",
258
+ "summary": "A short value carried through a social sign-up, returned by `readOAuthState`.",
259
+ "required": false
260
+ },
168
261
  {
169
262
  "name": "className",
170
263
  "summary": "Your own classes on the wrapper.",
@@ -699,10 +792,25 @@
699
792
  "PricingTable"
700
793
  ]
701
794
  },
795
+ {
796
+ "name": "useAddons",
797
+ "kind": "hook",
798
+ "summary": "The signed-in user's addons and the ones on sale for their plan, with buy, resize and remove — settled by the API (more now and charged for the rest of the period, fewer at the period end). No markup.",
799
+ "useWhen": "You sell extras on top of a plan (more apps, seats, storage) as self-serve addons.",
800
+ "requires": [
801
+ "session"
802
+ ],
803
+ "props": [],
804
+ "whenUnmet": "Loads nothing without a session; `lastError` carries the API's code.",
805
+ "seeAlso": [
806
+ "usePlans",
807
+ "SubscriptionManager"
808
+ ]
809
+ },
702
810
  {
703
811
  "name": "SubscriptionManager",
704
812
  "kind": "component",
705
- "summary": "The current plan, its renewal date, a scheduled plan change with its undo, cancelling at the period end — asking why, and showing the environment's retention offer when it makes one — and resuming a cancelled one.",
813
+ "summary": "The current plan, its renewal date, a scheduled plan change with its undo, canceling at the period end — asking why, and showing the environment's retention offer when it makes one — and resuming a canceled one.",
706
814
  "useWhen": "A billing settings page.",
707
815
  "requires": [
708
816
  "session"
@@ -1230,7 +1338,7 @@
1230
1338
  {
1231
1339
  "name": "Chart",
1232
1340
  "kind": "component",
1233
- "summary": "Records over time, counted or totalled.",
1341
+ "summary": "Records over time, counted or totaled.",
1234
1342
  "useWhen": "The question is how many or how much, by day, week or month.",
1235
1343
  "requires": [
1236
1344
  "session",
@@ -0,0 +1,22 @@
1
+ interface Turnstile {
2
+ render: (container: HTMLElement, options: {
3
+ sitekey: string;
4
+ size?: "normal" | "flexible" | "compact";
5
+ callback: (token: string) => void;
6
+ "expired-callback": () => void;
7
+ "error-callback": () => void;
8
+ }) => string;
9
+ remove: (widgetId: string) => void;
10
+ }
11
+ declare global {
12
+ interface Window {
13
+ turnstile?: Turnstile;
14
+ }
15
+ }
16
+ export declare function CaptchaWidget({ siteKey, onToken, }: {
17
+ siteKey: string;
18
+ /** Called with a token, and with null when it expires or the widget fails. */
19
+ onToken: (token: string | null) => void;
20
+ }): import("react").JSX.Element;
21
+ export {};
22
+ //# sourceMappingURL=CaptchaWidget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CaptchaWidget.d.ts","sourceRoot":"","sources":["../../src/CaptchaWidget.tsx"],"names":[],"mappings":"AAmBA,UAAU,SAAS;IAClB,MAAM,EAAE,CACP,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;QACzC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QAClC,kBAAkB,EAAE,MAAM,IAAI,CAAC;QAC/B,gBAAgB,EAAE,MAAM,IAAI,CAAC;KAC7B,KACG,MAAM,CAAC;IACZ,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,SAAS,CAAC,EAAE,SAAS,CAAC;KACtB;CACD;AAiCD,wBAAgB,aAAa,CAAC,EAC7B,OAAO,EACP,OAAO,GACP,EAAE;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACxC,+BAuCA"}
@@ -8,12 +8,12 @@ import { type CSSProperties } from "react";
8
8
  * - **A challenge** (`enroll: false`): a code box for the factor the person
9
9
  * already has — their authenticator app, or the code just sent to their inbox
10
10
  * or phone — or one of their recovery codes.
11
- * - **An enrolment** (`enroll: true`): the environment requires a second factor
11
+ * - **An enrollment** (`enroll: true`): the environment requires a second factor
12
12
  * and this person has none, so there is nothing a code box could check. They
13
13
  * choose one of `enrollMethods`, prove it with its first code, and are shown
14
14
  * their recovery codes once before the session is handed over.
15
15
  *
16
- * The enrolment branch is what used to be missing. `SignIn` showed "from your
16
+ * The enrollment branch is what used to be missing. `SignIn` showed "from your
17
17
  * authenticator app" to somebody who had never set one up, and `SignUp`
18
18
  * silently stopped — so under a required policy nobody new could ever get in.
19
19
  *
@@ -1,39 +1,100 @@
1
1
  import { type CSSProperties } from "react";
2
2
  import { type SecondFactorLabels } from "./SecondFactorStep";
3
3
  /**
4
- * Email and password sign-in, and — where the application turns them on — a
5
- * magic link or a code by text message.
4
+ * Sign in the ways the environment offers: the dashboard's sign-in switches
5
+ * (password, magic link, passkeys, text message), its enabled social providers
6
+ * and enterprise SSO, read from `GET /v1/auth/methods` — so turning a method on
7
+ * or off in Base316 changes this form without a release. Props can only turn a
8
+ * method off.
6
9
  *
7
10
  * Handles the MFA branch, because an account with a second factor gets a
8
11
  * challenge instead of a session, and a form that ignores that case appears to
9
12
  * fail for exactly the users who most need it to work. That includes the case
10
- * where the environment requires a factor and the person has none: they enrol
13
+ * where the environment requires a factor and the person has none: they enroll
11
14
  * one here (`SecondFactorStep`), see their recovery codes, and are signed in.
15
+ *
16
+ * Social and SSO sign-in leave the page: the browser goes to the provider and
17
+ * comes back to `socialRedirectUrl` with a single-use `code` (and `state`),
18
+ * which the application's server redeems with its secret key
19
+ * (`base316.auth.exchangeCode`) after checking `state` against the
20
+ * `b316_oauth_state` cookie this form writes (`readOAuthState`).
12
21
  */
13
- export declare function SignIn({ onSignedIn, passkeys, magicLinkRedirectUrl, phone, secondFactorLabels, className, style, }: {
22
+ export interface SignInLabels {
23
+ email: string;
24
+ password: string;
25
+ mobileNumber: string;
26
+ code: string;
27
+ tabPassword: string;
28
+ tabMagicLink: string;
29
+ tabPhone: string;
30
+ submit: string;
31
+ working: string;
32
+ emailMeALink: string;
33
+ textMeACode: string;
34
+ includeCountryCode: string;
35
+ codeSent: (destination: string) => string;
36
+ useDifferentNumber: string;
37
+ or: string;
38
+ passkey: string;
39
+ /** A social button: "Continue with Google". */
40
+ continueWith: (name: string, provider: string) => string;
41
+ sso: string;
42
+ ssoEmail: string;
43
+ ssoContinue: string;
44
+ back: string;
45
+ checkEmailTitle: string;
46
+ checkEmail: (email: string) => string;
47
+ backToSignIn: string;
48
+ wrongPassword: string;
49
+ passkeyFailed: string;
50
+ linkInvalid: string;
51
+ linkFailed: string;
52
+ wrongCode: string;
53
+ codeFailed: string;
54
+ /** Nothing the form can offer: every method is off, or none survives the props. */
55
+ noMethods: string;
56
+ }
57
+ export declare const DEFAULT_SIGN_IN_LABELS: SignInLabels;
58
+ export interface SignInProps {
14
59
  onSignedIn?: () => void;
15
- /** Offer passkeys alongside the password. On by default where supported. */
60
+ /** `false` hides the password form even where the environment offers it. */
61
+ password?: boolean;
62
+ /** `false` hides passkeys. Otherwise offered where the environment and the browser allow. */
16
63
  passkeys?: boolean;
64
+ /** `false` hides the emailed sign-in link. */
65
+ magicLink?: boolean;
17
66
  /**
18
- * Where an emailed sign-in link lands. Offering magic link at all requires
19
- * it, because the link has to point somewhere this application controls —
20
- * and the URL must be registered on the environment's sign-in page, the same
21
- * list that governs redirects.
22
- *
23
- * The page it names should render this component: arriving with `?token=`
24
- * redeems it automatically.
67
+ * Where an emailed sign-in link lands. Defaults to the page rendering this
68
+ * form, which redeems `?token=` on arrival. Either way the URL must be on
69
+ * the environment's redirect allow-list.
25
70
  */
26
71
  magicLinkRedirectUrl?: string;
72
+ /** `false` hides signing in with a code by text message. */
73
+ phone?: boolean;
27
74
  /**
28
- * Offer signing in with a code sent by text message.
29
- *
30
- * Off by default, because it needs the environment switched on for it and,
31
- * in production, the environment's own Twilio account.
75
+ * `false` hides the social buttons; a list (`["google", "apple"]`) keeps
76
+ * only those providers.
32
77
  */
33
- phone?: boolean;
78
+ social?: boolean | readonly string[];
79
+ /** `false` hides "Sign in with SSO". */
80
+ sso?: boolean;
81
+ /**
82
+ * Where a social or SSO sign-in comes back to, with `?code=&state=`: a
83
+ * route on your server that checks the state and redeems the code with a
84
+ * secret key. On the environment's redirect allow-list. Without it no
85
+ * social or SSO button is shown — a code has nowhere safe to land.
86
+ */
87
+ socialRedirectUrl?: string;
88
+ /**
89
+ * A short value of yours carried through a social or SSO sign-in (where to
90
+ * go next), returned as `appState` by `readOAuthState`. Treat it as input.
91
+ */
92
+ socialState?: string;
93
+ labels?: Partial<SignInLabels>;
34
94
  /** Override the second-factor step's wording, for translation. */
35
95
  secondFactorLabels?: Partial<SecondFactorLabels>;
36
96
  className?: string;
37
97
  style?: CSSProperties;
38
- }): import("react").JSX.Element;
98
+ }
99
+ export declare function SignIn({ onSignedIn, password: passwordProp, passkeys: passkeysProp, magicLink: magicLinkProp, magicLinkRedirectUrl, phone: phoneProp, social: socialProp, sso: ssoProp, socialRedirectUrl, socialState, labels: overrides, secondFactorLabels, className, style, }: SignInProps): import("react").JSX.Element;
39
100
  //# sourceMappingURL=SignIn.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SignIn.d.ts","sourceRoot":"","sources":["../../src/SignIn.tsx"],"names":[],"mappings":"AASA,OAAO,EAA+B,KAAK,aAAa,EAAkB,MAAM,OAAO,CAAC;AAIxF,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE/E;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,EACtB,UAAU,EACV,QAAe,EACf,oBAAoB,EACpB,KAAa,EACb,kBAAkB,EAClB,SAAS,EACT,KAAK,GACL,EAAE;IACF,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;;OAQG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kEAAkE;IAClE,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACtB,+BAwbA"}
1
+ {"version":3,"file":"SignIn.d.ts","sourceRoot":"","sources":["../../src/SignIn.tsx"],"names":[],"mappings":"AASA,OAAO,EAA+B,KAAK,aAAa,EAAkB,MAAM,OAAO,CAAC;AAIxF,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAI/E;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,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AC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,4DAA4D;IAC5D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAAC;IACrC,wCAAwC;IACxC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,kEAAkE;IAClE,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACtB;AAID,wBAAgB,MAAM,CAAC,EACtB,UAAU,EACV,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,aAAa,EACxB,oBAAoB,EACpB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,OAAO,EACZ,iBAAiB,EACjB,WAAW,EACX,MAAM,EAAE,SAAS,EACjB,kBAAkB,EAClB,SAAS,EACT,KAAK,GACL,EAAE,WAAW,+BAmjBb"}
@@ -22,6 +22,12 @@ import { type SecondFactorLabels } from "./SecondFactorStep";
22
22
  * into the inviting team — no personal workspace — with its address counted as
23
23
  * verified, because the token reached that mailbox. The form says which team
24
24
  * and fills in the address the invitation went to.
25
+ *
26
+ * The environment's social providers are offered above the form, as on the
27
+ * hosted sign-up page ("Continue with Google" creates the account on first
28
+ * use), when `socialRedirectUrl` says where the code may land. A closed
29
+ * sign-up (the dashboard's switch) says so instead of offering a form the
30
+ * server would refuse — unless the page carries an invitation, which admits.
25
31
  */
26
32
  export interface SignUpLabels {
27
33
  name: string;
@@ -45,6 +51,13 @@ export interface SignUpLabels {
45
51
  genericError: string;
46
52
  /** Above the form when the page came from an invitation. */
47
53
  joining: (organizationName: string, roleName: string) => string;
54
+ /** A social button: "Continue with Google". */
55
+ continueWith: (name: string, provider: string) => string;
56
+ or: string;
57
+ /** The environment is not accepting new accounts. */
58
+ closed: string;
59
+ /** Passwords off and no social provider to sign up with: nothing to offer. */
60
+ noMethods: string;
48
61
  }
49
62
  export declare const DEFAULT_SIGN_UP_LABELS: SignUpLabels;
50
63
  export interface SignUpProps {
@@ -59,8 +72,21 @@ export interface SignUpProps {
59
72
  labels?: Partial<SignUpLabels>;
60
73
  /** Override the second-factor step's wording, for translation. */
61
74
  secondFactorLabels?: Partial<SecondFactorLabels>;
75
+ /**
76
+ * `false` hides the social buttons; a list (`["google", "apple"]`) keeps
77
+ * only those providers.
78
+ */
79
+ social?: boolean | readonly string[];
80
+ /**
81
+ * Where a social sign-up comes back to with `?code=&state=`, as on
82
+ * `<SignIn>`: a route on your server that checks the state and redeems the
83
+ * code with a secret key. Without it no social button is shown.
84
+ */
85
+ socialRedirectUrl?: string;
86
+ /** A short value of yours carried through a social sign-up (`readOAuthState`). */
87
+ socialState?: string;
62
88
  className?: string;
63
89
  style?: CSSProperties;
64
90
  }
65
- export declare function SignUp({ onSignedUp, invitationToken: suppliedInvitation, onJoined, labels: overrides, secondFactorLabels, className, style, }: SignUpProps): import("react").JSX.Element;
91
+ export declare function SignUp({ onSignedUp, invitationToken: suppliedInvitation, onJoined, labels: overrides, secondFactorLabels, social, socialRedirectUrl, socialState, className, style, }: SignUpProps): import("react").JSX.Element;
66
92
  //# sourceMappingURL=SignUp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SignUp.d.ts","sourceRoot":"","sources":["../../src/SignUp.tsx"],"names":[],"mappings":"AASA,OAAO,EAAuB,KAAK,aAAa,EAAkB,MAAM,OAAO,CAAC;AAIhF,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC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MAAM,KAAK,MAAM,CAAC;IACzD,EAAE,EAAE,MAAM,CAAC;IACX,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,sBAAsB,EAAE,YAwBpC,CAAC;AAEF,MAAM,WAAW,WAAW;IAC3B,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,yEAAyE;IACzE,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,kEAAkE;IAClE,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACjD;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAAC;IACrC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACtB;AAiBD,wBAAgB,MAAM,CAAC,EACtB,UAAU,EACV,eAAe,EAAE,kBAAkB,EACnC,QAAQ,EACR,MAAM,EAAE,SAAS,EACjB,kBAAkB,EAClB,MAAM,EACN,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,KAAK,GACL,EAAE,WAAW,+BAuSb"}
@@ -0,0 +1,16 @@
1
+ import type { SocialSignInOption } from "@base316/sdk";
2
+ /**
3
+ * "Continue with Google", "Continue with Apple" — one button per enabled
4
+ * provider, drawn as each provider's guidelines ask: its own mark, its own
5
+ * colors (Google white with a gray outline, Apple black with the white logo,
6
+ * Microsoft its four squares), and a label naming it. "Continue with" is a
7
+ * title both Google's and Apple's guidelines accept, and it reads right on a
8
+ * sign-up form as well as a sign-in one.
9
+ */
10
+ export declare function SocialButtons({ options, continueWith, disabled, onChoose, }: {
11
+ options: SocialSignInOption[];
12
+ continueWith: (name: string, provider: string) => string;
13
+ disabled?: boolean;
14
+ onChoose: (option: SocialSignInOption) => void;
15
+ }): import("react").JSX.Element | null;
16
+ //# sourceMappingURL=SocialButtons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SocialButtons.d.ts","sourceRoot":"","sources":["../../src/SocialButtons.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAkB,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIvE;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,EAC7B,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,QAAQ,GACR,EAAE;IACF,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAC/C,sCAyCA"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The environment's social sign-in buttons on their own, for an application
3
+ * that draws the rest of its sign-in or sign-up form itself.
4
+ *
5
+ * The same buttons `<SignIn>` and `<SignUp>` show, from the same
6
+ * `GET /v1/auth/methods`: each enabled provider with its mark and colors,
7
+ * leaving for Base316's host with a `b316_oauth_state` cookie and the same
8
+ * value as `state`, and coming back to `socialRedirectUrl` with a single-use
9
+ * code for your server to check (`readOAuthState`) and redeem
10
+ * (`base316.auth.exchangeCode`). Renders nothing until the environment answers,
11
+ * when it has no provider on, or without `socialRedirectUrl`.
12
+ */
13
+ export declare function SocialSignIn({ socialRedirectUrl, socialState, social, intent, divider, labels, }: {
14
+ /**
15
+ * Your server route the code lands on; on the environment's redirect
16
+ * allow-list. Without it nothing is drawn: a code has nowhere safe to land.
17
+ */
18
+ socialRedirectUrl?: string;
19
+ /** A short value of yours carried through (`readOAuthState` returns it as `appState`). */
20
+ socialState?: string;
21
+ /** `false` hides every button; a list (`["google", "apple"]`) keeps only those. */
22
+ social?: boolean | readonly string[];
23
+ /** On a sign-up form the buttons disappear when the environment is closed to new accounts. */
24
+ intent?: "sign-in" | "sign-up";
25
+ /** Draw an "or" rule under the buttons, before a form of your own. */
26
+ divider?: boolean;
27
+ labels?: {
28
+ continueWith?: (name: string, provider: string) => string;
29
+ or?: string;
30
+ };
31
+ }): import("react").JSX.Element | null;
32
+ //# sourceMappingURL=SocialSignIn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SocialSignIn.d.ts","sourceRoot":"","sources":["../../src/SocialSignIn.tsx"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,EAC5B,iBAAiB,EACjB,WAAW,EACX,MAAM,EACN,MAAkB,EAClB,OAAe,EACf,MAAM,GACN,EAAE;IACF;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,0FAA0F;IAC1F,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAAC;IACrC,8FAA8F;IAC9F,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC/B,sEAAsE;IACtE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACpF,sCAmCA"}
@@ -6,7 +6,7 @@ import { type CSSProperties } from "react";
6
6
  * appear: a list of people, a list of people who have not arrived yet, a box to
7
7
  * add another, and a way to leave. Splitting them would make the common case —
8
8
  * a Team settings page — four imports and some layout, which is exactly the
9
- * assembly work the catalogue exists to remove.
9
+ * assembly work the catalog exists to remove.
10
10
  *
11
11
  * What it offers depends on what the viewer may do, and that is the server's
12
12
  * answer rather than this component's guess: inviting and removing are gated on
@@ -10,7 +10,7 @@ import { type CSSProperties } from "react";
10
10
  *
11
11
  * Three steps, kept separate because the middle one is what stops people
12
12
  * locking themselves out: enrolling produces a secret that is useless until a
13
- * code proves the app actually holds it. Activating on enrolment would mean a
13
+ * code proves the app actually holds it. Activating on enrollment would mean a
14
14
  * QR code that failed to scan leaves somebody unable to sign in, with no way
15
15
  * back.
16
16
  *