@pontive/pontkit-core 1.39.0 → 1.41.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.
Files changed (66) hide show
  1. package/catalog.json +1 -1
  2. package/custom-elements.json +1 -1
  3. package/dist/index.js +1846 -1289
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +17059 -12690
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/pont2/core/context-root.d.ts +1 -0
  8. package/dist/pont2/core/events.d.ts +1 -1
  9. package/dist/pont2/core/format.d.ts +46 -0
  10. package/dist/pont2/core/icons.d.ts +11 -0
  11. package/dist/pont2/core/index.d.ts +2 -0
  12. package/dist/pont2/core/messages.d.ts +128 -2
  13. package/dist/pont2/core/popup/index.d.ts +1 -0
  14. package/dist/pont2/core/popup/modal.d.ts +56 -0
  15. package/dist/pont2/core/popup/popup-content.d.ts +7 -0
  16. package/dist/pont2/core/popup/story-helpers.d.ts +6 -0
  17. package/dist/pont2/custom-elements.json +55405 -24958
  18. package/dist/pont2/index.d.ts +7 -0
  19. package/dist/pont2/index.mjs +6600 -2376
  20. package/dist/pont2/index.mjs.map +1 -1
  21. package/dist/pont2/kit/account-menu/account-menu.d.ts +115 -0
  22. package/dist/pont2/kit/account-settings/account-settings.d.ts +157 -0
  23. package/dist/pont2/kit/account-settings/profile.d.ts +74 -0
  24. package/dist/pont2/kit/badge-selector/badge-selector.d.ts +65 -0
  25. package/dist/pont2/kit/consent/consent.d.ts +3 -2
  26. package/dist/pont2/kit/data-table/data-table.d.ts +120 -0
  27. package/dist/pont2/kit/data-table/rows.d.ts +25 -0
  28. package/dist/pont2/kit/flow-widget/flow-widget.d.ts +21 -8
  29. package/dist/pont2/kit/index.d.ts +11 -0
  30. package/dist/pont2/kit/layout/layout.d.ts +7 -0
  31. package/dist/pont2/kit/member-management/errors.d.ts +60 -0
  32. package/dist/pont2/kit/member-management/member-management.d.ts +237 -0
  33. package/dist/pont2/kit/member-management/roles.d.ts +42 -0
  34. package/dist/pont2/kit/multi-email-input/emails.d.ts +19 -0
  35. package/dist/pont2/kit/multi-email-input/multi-email-input.d.ts +78 -0
  36. package/dist/pont2/kit/multi-select-filter/multi-select-filter.d.ts +53 -0
  37. package/dist/pont2/kit/organization-switcher/organization-switcher.d.ts +111 -0
  38. package/dist/pont2/kit/pagination/pagination.d.ts +61 -0
  39. package/dist/pont2/kit/pagination/range.d.ts +17 -0
  40. package/dist/pont2/kit/provider/account-client.d.ts +355 -0
  41. package/dist/pont2/kit/provider/account-controller.d.ts +47 -0
  42. package/dist/pont2/kit/provider/account-user.d.ts +16 -0
  43. package/dist/pont2/kit/provider/coexistence.d.ts +19 -0
  44. package/dist/pont2/kit/provider/contexts.d.ts +46 -0
  45. package/dist/pont2/kit/provider/provider.d.ts +219 -0
  46. package/dist/pont2/kit/provider/redirect.d.ts +122 -0
  47. package/dist/pont2/kit/provider/runtime-config.d.ts +24 -0
  48. package/dist/pont2/kit/provider/sdk.d.ts +100 -0
  49. package/dist/pont2/kit/provider/signed-in.d.ts +81 -0
  50. package/dist/pont2/kit/provider/widget-messages.d.ts +35 -0
  51. package/dist/pont2/primitives/alert-dialog/alert-dialog.d.ts +132 -0
  52. package/dist/pont2/primitives/combobox/combobox.d.ts +82 -14
  53. package/dist/pont2/primitives/dialog/dialog.d.ts +195 -0
  54. package/dist/pont2/primitives/drawer/drawer.d.ts +112 -0
  55. package/dist/pont2/primitives/hover-card/hover-card.d.ts +83 -0
  56. package/dist/pont2/primitives/pagination/pagination.d.ts +120 -0
  57. package/dist/pont2/primitives/sheet/sheet.d.ts +92 -0
  58. package/dist/pont2/primitives/sonner/sonner.d.ts +86 -0
  59. package/dist/pont2/primitives/sonner/toast-store.d.ts +81 -0
  60. package/dist/pont2/styles.css +2489 -760
  61. package/dist/pont2/theme/tokens.json.d.ts +700 -1
  62. package/dist/pont2/theme-golden.json +45 -45
  63. package/dist/pont2/theme.mjs +119 -119
  64. package/dist/pont2/tokens.json +700 -1
  65. package/dist/styles.css +2475 -746
  66. package/package.json +2 -2
@@ -0,0 +1,61 @@
1
+ import { PropertyDeclarations, PropertyValues } from 'lit';
2
+ import { MessagesController } from '../../core/messages';
3
+ import { Pagination } from '../../primitives/pagination/pagination';
4
+ export { clampPage, paginationRange, type PageSlot } from './range';
5
+ export interface PageChangeDetail {
6
+ page: number;
7
+ }
8
+ /**
9
+ * # `<pont2-pagination>`: kit composite over `<pont2-prim-pagination>`
10
+ *
11
+ * A pager from two numbers. It **is** the primitive's nav (`extends
12
+ * Pagination`) and renders shadcn's DOM inside it: the list, its items,
13
+ * Previous / page buttons / ellipses / Next. The page links are `<button>`s
14
+ * (a pager in an app pages data, it does not navigate).
15
+ *
16
+ * ```html
17
+ * <pont2-pagination page="3" page-count="12"></pont2-pagination>
18
+ * ```
19
+ *
20
+ * Which pages show is `paginationRange()` (range.ts): first and last, the
21
+ * current page with `siblings` on each side, and an ellipsis for each longer
22
+ * gap, in a constant number of slots. Page numbers are formatted for the page's
23
+ * language (`Intl.NumberFormat`), and every word is a `msg()` code: `pagination`,
24
+ * `pagination_previous` / `_next` (button text), `pagination_previous_page` /
25
+ * `_next_page` (their labels), `pagination_more`.
26
+ *
27
+ * Pressing a page fires a cancelable `pont2-page-change` `{ page }`; unless it
28
+ * is cancelled, `page` becomes the new page (uncontrolled). Set `page` from
29
+ * the handler instead (and cancel) to control it.
30
+ *
31
+ * @tag pont2-pagination
32
+ * @attr page - the current page, 1-based (default 1)
33
+ * @attr page-count - how many pages there are (default 1)
34
+ * @attr siblings - pages shown on each side of the current one (default 1)
35
+ * @attr boundaries - pages always shown at each end (default 1)
36
+ * @attr disabled - every control disabled (for example while a page loads)
37
+ * @fires pont2-page-change - cancelable `{ page }`, the user pressed a page, Previous or Next
38
+ */
39
+ export declare class KitPagination extends Pagination {
40
+ static composite: boolean;
41
+ static properties: PropertyDeclarations;
42
+ page: number;
43
+ pageCount: number;
44
+ siblings: number;
45
+ boundaries: number;
46
+ disabled: boolean;
47
+ protected readonly kitMessages: MessagesController;
48
+ constructor();
49
+ /** Request a page, as the user did. Returns false if a listener cancelled it. */
50
+ goTo(page: number): boolean;
51
+ protected willUpdate(changed: PropertyValues): void;
52
+ render(): import('lit-html').TemplateResult<1>;
53
+ }
54
+ declare global {
55
+ interface HTMLElementTagNameMap {
56
+ "pont2-pagination": KitPagination;
57
+ }
58
+ interface HTMLElementEventMap {
59
+ "pont2-page-change": CustomEvent<PageChangeDetail>;
60
+ }
61
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The page numbers a pager shows, with gaps. Pure, so it is unit-tested
3
+ * (range.test.ts).
4
+ *
5
+ * Always shows the first and last `boundaries` pages and `siblings` pages on
6
+ * each side of the current one; a run of hidden pages becomes one
7
+ * `"ellipsis"`, except that a gap of exactly one page shows that page (an
8
+ * ellipsis standing for a single number saves nothing). The number of slots
9
+ * is constant while there are enough pages, so the pager does not change
10
+ * width as you page through (the MUI / Mantine `usePagination` rule).
11
+ *
12
+ * `paginationRange(5, 10)` → `[1, "ellipsis", 4, 5, 6, "ellipsis", 10]`
13
+ */
14
+ export type PageSlot = number | "ellipsis";
15
+ export declare function paginationRange(page: number, pageCount: number, siblings?: number, boundaries?: number): PageSlot[];
16
+ /** `page` as a whole page number within `1…pageCount` (1 when there are no pages). */
17
+ export declare function clampPage(page: number, pageCount: number): number;
@@ -0,0 +1,355 @@
1
+ import { SessionChange } from './sdk';
2
+ /**
3
+ * # `AccountClient`: what the account widgets talk to (migration decision D9, tracker W-12)
4
+ *
5
+ * The signed-in widgets (account menu, organization switcher, and later
6
+ * account settings and member management) never call the auth SDK or `fetch`
7
+ * themselves. They talk to an injected `AccountClient`, the way the flow
8
+ * widgets talk to their `WidgetClient`:
9
+ *
10
+ * - `<pont2-provider>` builds the default one from its SDK and `api-base-url`
11
+ * (`createAccountClient`) and provides it as `pont2:account-client`;
12
+ * - an app can provide its own (`provider.accountClient = …`), or give one
13
+ * widget its own (`widget.client = …`), which wins.
14
+ *
15
+ * ## Shape, and how it grows
16
+ *
17
+ * The interface is the **session part** (required: every account widget needs
18
+ * it) plus the **profile** (account settings, W-8) and **members** (member
19
+ * management, W-10) parts, which are optional on `AccountClient` so that an app
20
+ * whose own client only drives the menu and the switcher need not implement
21
+ * them. The default client implements all three. Methods added later are
22
+ * added as **optional** members, so an app's own client keeps compiling; a
23
+ * widget that needs a method the client lacks says it can't do that.
24
+ *
25
+ * Every request method rejects with an {@link AccountApiError} (or the SDK's
26
+ * `ManagementTokenError`, which carries a `code` as well): read `code` and
27
+ * `status`, never the English `message`.
28
+ */
29
+ /** Who is signed in, from the session's claims (OpenID Connect names). Local: no request. */
30
+ export interface SessionUser {
31
+ sub?: string;
32
+ email?: string;
33
+ name?: string;
34
+ given_name?: string;
35
+ family_name?: string;
36
+ picture?: string;
37
+ username?: string;
38
+ }
39
+ /** The organization the session acts in (the access token's `org_id`), with the user's roles there. */
40
+ export interface SessionOrganization {
41
+ id: string;
42
+ roles: string[];
43
+ permissions: string[];
44
+ }
45
+ /** One organization the signed-in user is a direct member of (`GET /mgmt/v1/me/organizations`). */
46
+ export interface MyOrganization {
47
+ id: string;
48
+ /** The organization's display name; may be missing (show the id). */
49
+ name?: string;
50
+ roles: {
51
+ key: string;
52
+ name?: string;
53
+ }[];
54
+ }
55
+ export interface SignOutOptions {
56
+ /** Where the browser comes back to when the sign-out leaves the page (must be registered on the app). */
57
+ returnTo?: string;
58
+ }
59
+ /** The management API's list pagination. */
60
+ export interface PageInfo {
61
+ page: number;
62
+ limit: number;
63
+ total: number;
64
+ total_pages: number;
65
+ }
66
+ /** One page of a management-API list. */
67
+ export interface Page<T> {
68
+ data: T[];
69
+ pagination?: PageInfo;
70
+ }
71
+ /** The signed-in user's own profile (`GET /mgmt/v1/me`), as the management API sends it. */
72
+ export interface AccountProfile {
73
+ id: string;
74
+ email?: string;
75
+ email_verified?: boolean;
76
+ phone?: string;
77
+ phone_verified?: boolean;
78
+ username?: string;
79
+ name?: string;
80
+ given_name?: string;
81
+ middle_name?: string;
82
+ family_name?: string;
83
+ nickname?: string;
84
+ gender?: string;
85
+ birthdate?: number;
86
+ picture?: string;
87
+ profile?: string;
88
+ website?: string;
89
+ locale?: string;
90
+ zoneinfo?: string;
91
+ address?: {
92
+ country?: string;
93
+ formatted?: string;
94
+ locality?: string;
95
+ postal_code?: string;
96
+ region?: string;
97
+ street_address?: string;
98
+ };
99
+ metadata?: Record<string, unknown>;
100
+ created_at?: number;
101
+ updated_at?: number;
102
+ }
103
+ /** What `PATCH /mgmt/v1/me` takes: the fields to change. */
104
+ export type AccountProfileUpdate = Partial<Omit<AccountProfile, "id" | "email_verified" | "phone_verified" | "created_at" | "updated_at">>;
105
+ /** A role on a member or an invitation. */
106
+ export interface RoleRef {
107
+ key: string;
108
+ name?: string;
109
+ }
110
+ /** A member of an organization (`GET /mgmt/v1/organizations/{id}/members`). */
111
+ export interface OrganizationMember {
112
+ id: string;
113
+ organization_id: string;
114
+ roles: RoleRef[];
115
+ joined_at?: string;
116
+ last_active_at?: string;
117
+ created_at?: string;
118
+ updated_at?: string;
119
+ user: {
120
+ id: string;
121
+ email?: string;
122
+ email_verified?: boolean;
123
+ name?: string;
124
+ given_name?: string;
125
+ family_name?: string;
126
+ picture?: string;
127
+ status?: string;
128
+ username?: string;
129
+ };
130
+ }
131
+ /** A pending invitation (`GET /mgmt/v1/organizations/{id}/invitations`). */
132
+ export interface OrganizationInvitation {
133
+ id: string;
134
+ organization_id: string;
135
+ invitee_email: string;
136
+ roles: RoleRef[];
137
+ invited_by?: {
138
+ id: string;
139
+ name?: string;
140
+ };
141
+ created_at?: number;
142
+ updated_at?: number;
143
+ expires_at?: number;
144
+ last_sent_at?: number;
145
+ resend_count?: number;
146
+ message?: string;
147
+ }
148
+ /**
149
+ * A role a member can be given (`GET /mgmt/v1/organizations/{id}/assignable-roles`), marked with
150
+ * whether the caller may assign or remove it (carry-over §5: a locked role is shown locked).
151
+ */
152
+ export interface AssignableRole {
153
+ key: string;
154
+ name: string;
155
+ description?: string;
156
+ /** Assigning or removing it transfers ownership (`owner`). */
157
+ requires_transfer: boolean;
158
+ assignable_by_caller: boolean;
159
+ organization_scoped: boolean;
160
+ }
161
+ export interface ListParams {
162
+ search?: string;
163
+ page?: number;
164
+ limit?: number;
165
+ order?: string;
166
+ /** Comma-separated role keys. */
167
+ roles?: string;
168
+ }
169
+ export interface MemberListParams extends ListParams {
170
+ user_ids?: string[];
171
+ emails?: string[];
172
+ }
173
+ export interface InvitationListParams extends ListParams {
174
+ invitee_emails?: string[];
175
+ }
176
+ export interface InviteMembersRequest {
177
+ emails: string[];
178
+ /** Organization roles; with none, the organization's roles-on-join apply. */
179
+ roles?: string[];
180
+ message?: string;
181
+ /** The app the invitation is for. The default client fills in the provider's `app-id` (carry-over §5). */
182
+ app_id?: string;
183
+ }
184
+ /** What every account widget needs: the session, the user's organizations, switching, signing out. */
185
+ export interface AccountSessionApi {
186
+ /** Who is signed in (local), or `null`. */
187
+ getUser(): SessionUser | null;
188
+ /** The organization the session acts in (local), or `null` for none. */
189
+ getOrganization(): SessionOrganization | null;
190
+ /** The organizations the user is a direct member of. A bounded list: it is for a menu. */
191
+ listMyOrganizations(): Promise<MyOrganization[]>;
192
+ /**
193
+ * Moves the session to `organizationId` (new tokens, no sign-in) and resolves with the
194
+ * organization it now acts in. Rejects, leaving the session as it was, when refused.
195
+ */
196
+ switchOrganization(organizationId: string): Promise<SessionOrganization | null>;
197
+ /** Ends the session, here and at the authorization server (which may leave the page). */
198
+ signOut(options?: SignOutOptions): Promise<void>;
199
+ /**
200
+ * Tells `listener` about every session change, in this tab or another (sign-in, refresh,
201
+ * organization switch, sign-out, expiry). Returns the unsubscribe. Optional: a widget whose
202
+ * client lacks it re-reads the session when the window regains focus.
203
+ */
204
+ onSessionChange?(listener: (change: SessionChange) => void): () => void;
205
+ }
206
+ /** Account settings (W-8): the user's own profile, with the session's token. */
207
+ export interface AccountProfileApi {
208
+ getProfile(): Promise<AccountProfile>;
209
+ updateProfile(update: AccountProfileUpdate): Promise<AccountProfile>;
210
+ }
211
+ /**
212
+ * Member management (W-10). Every call uses a **management-API token**, drawn before each
213
+ * request (the SDK caches it), never the session's access token (carry-over §5).
214
+ */
215
+ export interface AccountMembersApi {
216
+ /** Whether the session is known to hold `scope` (the member scopes read false until a management token was drawn). */
217
+ hasScope(scope: string): boolean;
218
+ /** Draws (or reuses) a management token and resolves with its scopes. */
219
+ getManagementScopes(): Promise<string[]>;
220
+ listMembers(organizationId: string, params?: MemberListParams): Promise<Page<OrganizationMember>>;
221
+ updateMemberRoles(organizationId: string, userId: string, roles: string[]): Promise<void>;
222
+ removeMember(organizationId: string, userId: string): Promise<void>;
223
+ listInvitations(organizationId: string, params?: InvitationListParams): Promise<Page<OrganizationInvitation>>;
224
+ inviteMembers(organizationId: string, request: InviteMembersRequest): Promise<Page<OrganizationInvitation>>;
225
+ resendInvitation(organizationId: string, invitationId: string): Promise<void>;
226
+ revokeInvitation(organizationId: string, invitationId: string, options?: {
227
+ notifyInvitee?: boolean;
228
+ }): Promise<void>;
229
+ listAssignableRoles(organizationId: string): Promise<AssignableRole[]>;
230
+ /**
231
+ * The OAuth scopes the app asks for at sign-in (the provider's `scope`), so that a refused
232
+ * management token can be explained: an app that never requests the member scopes is set up
233
+ * wrong, one that does is refused for the user's roles (carry-over §5). Optional: without it the
234
+ * widget assumes they are requested.
235
+ */
236
+ requestedScopes?(): string[];
237
+ }
238
+ /** The account widgets' client: the session part, plus the parts the settings and members widgets need. */
239
+ export interface AccountClient extends AccountSessionApi, Partial<AccountProfileApi>, Partial<AccountMembersApi> {
240
+ }
241
+ /**
242
+ * `pont2:account-client`: the account widgets' client. Undefined until the provider has configured
243
+ * its SDK (or when the SDK can't serve one); an app's own `provider.accountClient` is provided as is.
244
+ */
245
+ export declare const accountClientContext: {
246
+ __context__: AccountClient | undefined;
247
+ };
248
+ /**
249
+ * A refused or failed account request. `code` is the error envelope's `error.code`
250
+ * (`role_ceiling`, `instance_unavailable` …) when the server sent one, or the client's own:
251
+ * `NETWORK_ERROR` (no answer), `NOT_AUTHENTICATED` (no session to send), `INVALID_REQUEST` (no
252
+ * usable `api-base-url`). `status` is 0 when no response came back.
253
+ */
254
+ export declare class AccountApiError extends Error {
255
+ readonly status: number;
256
+ readonly code?: string;
257
+ readonly data?: unknown;
258
+ constructor(message: string, status: number, code?: string, data?: unknown);
259
+ }
260
+ /** The code a failed account call carries: its own `code`, or its body's `error.code`. */
261
+ export declare function accountErrorCode(error: unknown): string | undefined;
262
+ /** The management token's refusal code (`ManagementTokenError.code`), or undefined for anything else. */
263
+ export declare function tokenErrorCode(error: unknown): string | undefined;
264
+ /** No answer came back at all. */
265
+ export declare function isNetworkFailure(error: unknown): boolean;
266
+ /**
267
+ * What the default client needs from the auth SDK. `Auth` (`@pontive/oidc-client` ≥ 1.7.0)
268
+ * satisfies it, pinned by `flow-widget/sdk-compat.test.ts`.
269
+ */
270
+ export interface AccountSdk {
271
+ getAuthenticatedUser(): SessionUser | null;
272
+ getCurrentSession(): {
273
+ access_token: string;
274
+ } | null;
275
+ getOrganization(): SessionOrganization | null;
276
+ switchOrganization(organizationId: string): Promise<unknown>;
277
+ signOut(options?: SignOutOptions): Promise<void>;
278
+ getManagementToken(apiBaseUrl: string): Promise<{
279
+ access_token: string;
280
+ scopes: string[];
281
+ }>;
282
+ hasScope(scope: string): boolean;
283
+ onSessionChange?(listener: (change: SessionChange) => void): () => void;
284
+ }
285
+ /** Whether `sdk` has what the default account client needs (an older SDK or a flow-only fake may not). */
286
+ export declare function isAccountSdk(sdk: unknown): sdk is AccountSdk;
287
+ export interface AccountClientOptions {
288
+ sdk: AccountSdk;
289
+ /** The management gateway (`https://api.us.pontive.com`); `/mgmt/v1` is added. */
290
+ apiBaseUrl: string;
291
+ /** The app's id, sent as an invitation's `app_id` when the caller gives none. */
292
+ appId?: string;
293
+ /** Extra request headers (the provider's `headers`, as the legacy kit sent them). */
294
+ headers?: Record<string, string>;
295
+ /** The scopes the app requests at sign-in (the provider's `scope`), for `requestedScopes()`. */
296
+ scope?: string | string[];
297
+ /** For tests. */
298
+ fetch?: typeof fetch;
299
+ }
300
+ /**
301
+ * The management gateway's path prefix. The load balancer routes on it: without it a request is
302
+ * answered by the balancer (a bare 404 without CORS headers, which a browser reports as a CORS failure).
303
+ */
304
+ export declare const MANAGEMENT_PREFIX = "/mgmt/v1";
305
+ /** `/me/organizations` page size, and how many pages a switcher reads at most: it is a menu, not a directory. */
306
+ export declare const MY_ORGANIZATIONS_PAGE_SIZE = 100;
307
+ export declare const MY_ORGANIZATIONS_MAX_PAGES = 5;
308
+ /** The gateway base without a trailing slash, or `null` unless it is an absolute http(s) URL. */
309
+ export declare function managementBase(apiBaseUrl: string | undefined): string | null;
310
+ /**
311
+ * The default {@link AccountClient}: the session from the SDK, `/me` routes with the session's
312
+ * access token, organization routes with a management token drawn before **each** request
313
+ * (`getManagementToken`, cached and coalesced by the SDK; carry-over §5). What the legacy
314
+ * `src/service/http` did, as one object.
315
+ */
316
+ export declare class SdkAccountClient implements AccountSessionApi, AccountProfileApi, AccountMembersApi {
317
+ readonly sdk: AccountSdk;
318
+ readonly apiBaseUrl: string;
319
+ readonly appId: string | undefined;
320
+ readonly headers: Record<string, string>;
321
+ readonly scope: string | string[] | undefined;
322
+ private readonly fetchImpl;
323
+ constructor(options: AccountClientOptions);
324
+ getUser(): SessionUser | null;
325
+ getOrganization(): SessionOrganization | null;
326
+ listMyOrganizations(): Promise<MyOrganization[]>;
327
+ switchOrganization(organizationId: string): Promise<SessionOrganization | null>;
328
+ signOut(options?: SignOutOptions): Promise<void>;
329
+ onSessionChange(listener: (change: SessionChange) => void): () => void;
330
+ getProfile(): Promise<AccountProfile>;
331
+ updateProfile(update: AccountProfileUpdate): Promise<AccountProfile>;
332
+ hasScope(scope: string): boolean;
333
+ getManagementScopes(): Promise<string[]>;
334
+ listMembers(organizationId: string, params?: MemberListParams): Promise<Page<OrganizationMember>>;
335
+ updateMemberRoles(organizationId: string, userId: string, roles: string[]): Promise<void>;
336
+ removeMember(organizationId: string, userId: string): Promise<void>;
337
+ listInvitations(organizationId: string, params?: InvitationListParams): Promise<Page<OrganizationInvitation>>;
338
+ inviteMembers(organizationId: string, request: InviteMembersRequest): Promise<Page<OrganizationInvitation>>;
339
+ resendInvitation(organizationId: string, invitationId: string): Promise<void>;
340
+ revokeInvitation(organizationId: string, invitationId: string, options?: {
341
+ notifyInvitee?: boolean;
342
+ }): Promise<void>;
343
+ listAssignableRoles(organizationId: string): Promise<AssignableRole[]>;
344
+ requestedScopes(): string[];
345
+ private list;
346
+ private managementToken;
347
+ private bearer;
348
+ /**
349
+ * One management-API request. No credentials and no instance header: the bearer's issuer
350
+ * names the instance, so the request needs nothing else (and no credentialed CORS).
351
+ */
352
+ private request;
353
+ }
354
+ /** The default account client over `sdk`. */
355
+ export declare function createAccountClient(options: AccountClientOptions): SdkAccountClient;
@@ -0,0 +1,47 @@
1
+ import { ReactiveController, ReactiveElement } from 'lit';
2
+ import { AccountClient } from './account-client';
3
+ import { AuthState } from './contexts';
4
+ import { SessionChange } from './sdk';
5
+ /** Why an account widget is asked to look at the session again. */
6
+ export type AccountRefreshReason = "client" | "auth" | "session" | "focus";
7
+ /**
8
+ * # AccountController: what every account widget follows
9
+ *
10
+ * - **The client:** the widget's own `client` (an app's), else the provider's
11
+ * `pont2:account-client`.
12
+ * - **The auth state:** the provider's `pont2:auth`. Nothing is decided until
13
+ * it is `resolved` (the interim answer is "signed out", so acting on it would
14
+ * flash a signed-out widget at a signed-in user). A widget given its own
15
+ * client with no provider around takes the client's `getUser()` as the answer.
16
+ * - **Session changes:** the client's `onSessionChange` (the SDK's, in this tab
17
+ * or another: an organization switch, a sign-in as someone else …). A client
18
+ * without it gets a re-read whenever the window regains focus, as the legacy
19
+ * switcher did.
20
+ *
21
+ * It calls `onRefresh(reason, change?)` whenever any of these changes; the
22
+ * widget re-reads what it shows.
23
+ */
24
+ export declare class AccountController implements ReactiveController {
25
+ private readonly host;
26
+ private readonly ownClient;
27
+ private readonly onRefresh;
28
+ private readonly clientConsumer;
29
+ private readonly authConsumer;
30
+ private subscribedTo;
31
+ private unsubscribe;
32
+ private lastAuth;
33
+ private focusListening;
34
+ constructor(host: ReactiveElement, ownClient: () => AccountClient | undefined, onRefresh: (reason: AccountRefreshReason, change?: SessionChange) => void);
35
+ /** The client the widget talks to, or undefined while there is none. */
36
+ get client(): AccountClient | undefined;
37
+ /** The auth state the widget follows. */
38
+ get auth(): AuthState;
39
+ /** Signed in, as far as the provider (or the widget's own client) has said. */
40
+ get signedIn(): boolean;
41
+ hostConnected(): void;
42
+ hostDisconnected(): void;
43
+ /** After every host update: (re)subscribe to the client, and report what changed. */
44
+ hostUpdated(): void;
45
+ private listenForFocus;
46
+ private onFocus;
47
+ }
@@ -0,0 +1,16 @@
1
+ import { SessionUser } from './account-client';
2
+ /** The name to show for a user: `name`, else given + family name, else the username. */
3
+ export declare function displayName(user: SessionUser | null | undefined): string;
4
+ /** Whether `href` names the page already open (same path and query): following it would only reload. */
5
+ export declare function isCurrentPage(href: string, here?: {
6
+ href: string;
7
+ pathname: string;
8
+ search: string;
9
+ }): boolean;
10
+ /**
11
+ * Up to two letters for an avatar fallback: the first and last words' initials ("Ada Lovelace" →
12
+ * "AL"), two letters of a single word ("acme" → "AC"). An email is reduced to its local part first
13
+ * (the domain is shared by every colleague), split on `.`, `_` and `-` ("ada.lovelace@…" → "AL"),
14
+ * as the legacy `getInitials` does.
15
+ */
16
+ export declare function accountInitials(text: string | undefined | null): string;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `<pont-provider>` (the legacy kit) and `<pont2-provider>` drive **one** SDK:
3
+ * `Auth` is a singleton, and `configure()` replaces its whole configuration. On
4
+ * one page, whichever configures last owns the callbacks, the locale and the
5
+ * flow-state events, and the other's widgets stop hearing them. So the two must
6
+ * never be mounted together (migration tracker W-15). Each provider warns, once
7
+ * per page, when it finds the other.
8
+ *
9
+ * This file is the one place pont2 names a legacy tag (a guardrail exception
10
+ * with this reason). It goes when the legacy kit does (migration plan S7, R-3).
11
+ */
12
+ export declare const LEGACY_PROVIDER_TAG = "pont-provider";
13
+ /**
14
+ * Warns (once per page) when `root` holds the legacy provider. Returns whether
15
+ * it found one.
16
+ */
17
+ export declare function warnIfLegacyProvider(root?: Pick<ParentNode, "querySelector"> | undefined): boolean;
18
+ /** Forgets that the warning was given. For tests. */
19
+ export declare function resetCoexistenceWarning(): void;
@@ -0,0 +1,46 @@
1
+ import { WidgetClient } from '../flow-widget/flow-widget';
2
+ /**
3
+ * The contexts `<pont2-provider>` provides (docs/kit/provider.md), beside the
4
+ * `pont2:branding` one the block reads (`kit/block/branding.ts`).
5
+ *
6
+ * They are the Context Community Protocol (`context-request` events) through
7
+ * `@lit/context`, keyed `pont2:*`, apart from the legacy `pont:*` keys
8
+ * (docs/08-parallel-constraints.md §4). A consumer that connects before the
9
+ * provider is defined still finds it: `core/context-root.ts` replays the
10
+ * requests nobody answered.
11
+ */
12
+ /**
13
+ * Whether this browser is signed in, as the provider knows it.
14
+ *
15
+ * `resolved` is the provider's knowledge, not the SDK's: it means
16
+ * `restoreSession()` has come back. Until then `isAuthenticated` is `false` for
17
+ * everyone, so nothing may act on it (a signed-in user with an HttpOnly refresh
18
+ * cookie holds no session locally on a fresh page).
19
+ */
20
+ export interface AuthState {
21
+ isAuthenticated: boolean;
22
+ resolved: boolean;
23
+ }
24
+ /** Before the provider has asked: nobody is known to be signed in, and nobody may act on it. */
25
+ export declare const UNRESOLVED_AUTH: AuthState;
26
+ /** `pont2:auth`: the auth state, read by `pont2-signed-in` / `pont2-signed-out`. */
27
+ export declare const authStateContext: {
28
+ __context__: AuthState;
29
+ };
30
+ /**
31
+ * `pont2:client`: the flow widgets' client (the injected SDK). A widget given
32
+ * its own `client` keeps it; one without uses this. Undefined until the
33
+ * provider has configured the SDK, so no widget starts a flow on an
34
+ * unconfigured one.
35
+ */
36
+ export declare const clientContext: {
37
+ __context__: WidgetClient | undefined;
38
+ };
39
+ /**
40
+ * `pont2:login-hint`: the identifier the page was opened with (OpenID Connect's
41
+ * `login_hint`), which the flow host pre-fills the email and identifier fields
42
+ * with (migration tracker F-11).
43
+ */
44
+ export declare const loginHintContext: {
45
+ __context__: string | undefined;
46
+ };