@pontive/pontkit-core 1.29.0 → 1.31.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 (47) hide show
  1. package/README.md +40 -0
  2. package/catalog.json +1 -1
  3. package/custom-elements.json +1 -1
  4. package/dist/components/ui/badge-selector/badge-selector.d.ts +5 -0
  5. package/dist/components/widgets/pont-member-management/components/action-modal.d.ts +2 -0
  6. package/dist/components/widgets/pont-member-management/components/index.d.ts +0 -1
  7. package/dist/components/widgets/pont-member-management/components/invitations-panel.d.ts +3 -0
  8. package/dist/components/widgets/pont-member-management/components/invite-members-form.d.ts +5 -6
  9. package/dist/components/widgets/pont-member-management/components/manage-roles-form.d.ts +11 -5
  10. package/dist/components/widgets/pont-member-management/components/members-panel.d.ts +5 -1
  11. package/dist/components/widgets/pont-member-management/components/page-range.d.ts +5 -0
  12. package/dist/components/widgets/pont-member-management/components/role-badges.d.ts +5 -0
  13. package/dist/components/widgets/pont-member-management/components/role-options.d.ts +9 -0
  14. package/dist/components/widgets/pont-member-management/errors.d.ts +24 -0
  15. package/dist/components/widgets/pont-member-management/pont-member-management.d.ts +69 -17
  16. package/dist/components/widgets/pont-member-management/types.d.ts +4 -3
  17. package/dist/i18n/messages.d.ts +1 -1
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.js +936 -1019
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +6543 -6713
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/pont2/globals.css +3 -3
  24. package/dist/pont2/index.mjs +678 -617
  25. package/dist/pont2/index.mjs.map +1 -1
  26. package/dist/pont2/kit/flow-widget/preview.d.ts +46 -0
  27. package/dist/pont2/kit/index.d.ts +1 -0
  28. package/dist/pont2/styles.css +390 -149
  29. package/dist/pont2/theme/tokens.json.d.ts +1020 -440
  30. package/dist/pont2/theme/types.d.ts +4 -0
  31. package/dist/pont2/theme.mjs +172 -157
  32. package/dist/pont2/theme.mjs.map +1 -1
  33. package/dist/pont2/tokens.json +1020 -440
  34. package/dist/primitives/components/ui/data-table/data-table.d.ts +4 -0
  35. package/dist/service/http/fetch.d.ts +6 -3
  36. package/dist/service/http/organization/assignable-roles.d.ts +8 -0
  37. package/dist/service/http/organization/index.d.ts +2 -1
  38. package/dist/service/http/organization/management-token.d.ts +13 -0
  39. package/dist/service/http/organization/members.d.ts +0 -1
  40. package/dist/styles.css +5 -43
  41. package/dist/types/core/index.d.ts +19 -2
  42. package/dist/types/service/http/invitation/index.d.ts +7 -2
  43. package/dist/types/service/http/roles/index.d.ts +16 -35
  44. package/package.json +2 -2
  45. package/dist/components/widgets/pont-member-management/components/monitoring-cards.d.ts +0 -20
  46. package/dist/components/widgets/pont-member-management/mock-data.d.ts +0 -4
  47. package/dist/service/http/organization/roles.d.ts +0 -7
@@ -67,6 +67,10 @@ export declare class DataTable extends BaseElement {
67
67
  columnOrder: string[];
68
68
  /** Function that determines if a row should be disabled. Returns true for disabled rows. */
69
69
  isRowDisabled?: (row: any) => boolean;
70
+ /** Shown in place of the rows when there are none. */
71
+ emptyLabel: string;
72
+ /** Screen-reader label of a row's actions menu. */
73
+ actionsLabel: string;
70
74
  private get _chevronDownIcon();
71
75
  private get _ellipsisIcon();
72
76
  protected getAttributesToExclude(): string[];
@@ -1,14 +1,17 @@
1
1
  export declare class ApiError extends Error {
2
2
  status: number;
3
+ /** The error envelope's `error.code`, e.g. `role_ceiling`, when it has one. */
4
+ code?: string;
3
5
  data?: unknown;
4
- constructor(message: string, status: number, data?: unknown);
6
+ constructor(message: string, status: number, data?: unknown, code?: string);
5
7
  }
6
8
  export interface RequestOptions extends RequestInit {
7
9
  token?: string;
8
10
  }
9
11
  /**
10
- * Calls the management API on `apiBaseUrl` with the signed-in user's access
11
- * token.
12
+ * Calls the management API on `apiBaseUrl` with the bearer token it is given:
13
+ * the session's access token for `/me` routes, a management-API token
14
+ * (`managementToken()`) for an organization's members and invitations.
12
15
  *
13
16
  * No instance header is sent. The token's issuer is the instance's own auth
14
17
  * domain, and that is what the gateway resolves the instance from — a header
@@ -0,0 +1,8 @@
1
+ import { AssignableRole } from '../../../types';
2
+ /**
3
+ * The roles a member of this organization can be given, each marked with
4
+ * whether the caller may assign (or remove) it: a role whose permissions the
5
+ * caller does not hold, and `owner` without the right to transfer ownership,
6
+ * are not theirs to hand out (pontive-spec 41 §5.5, §6).
7
+ */
8
+ export declare function getAssignableRoles(organizationId: string): Promise<AssignableRole[]>;
@@ -1,3 +1,4 @@
1
1
  export * from './members';
2
2
  export * from './invitations';
3
- export * from './roles';
3
+ export * from './assignable-roles';
4
+ export * from './management-token';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A bearer for an organization's member and invitation routes.
3
+ *
4
+ * Those routes take a management-API token, never the session's access token:
5
+ * the organization-member scopes stay on the grant, and the SDK draws a
6
+ * short-lived token for the management API's audience from a refresh
7
+ * (pontive-spec 41 §5.4). The SDK caches it and shares one request between
8
+ * concurrent callers, so asking before every call is cheap.
9
+ *
10
+ * Rejects with the SDK's ManagementTokenError — `invalid_scope` when the
11
+ * session holds no organization-member scope here.
12
+ */
13
+ export declare function managementToken(): Promise<string>;
@@ -2,6 +2,5 @@ import { GetMembersParams, MembersResponse } from '../../../types';
2
2
  export declare function getMembers(organizationId: string, params?: GetMembersParams): Promise<MembersResponse>;
3
3
  export declare function updateMemberRoles(organizationId: string, userId: string, data: {
4
4
  roles: string[];
5
- actor_id?: string;
6
5
  }): Promise<void>;
7
6
  export declare function removeMember(organizationId: string, userId: string): Promise<void>;
package/dist/styles.css CHANGED
@@ -17839,10 +17839,8 @@ DIVIDER
17839
17839
  --pont-member-management-badge-radius: var(--pont-ref-radius-md);
17840
17840
  }
17841
17841
 
17842
- /* Membermanagement Monitoring */
17842
+ /* Member management */
17843
17843
  :root {
17844
- --pont-monitoring-cards-width-border: var(--pont-sem-width-border);
17845
- --pont-monitoring-cards-color-border: hsl(var(--pont-sem-color-border));
17846
17844
  --pont-member-management-danger-action-color-text: hsl(
17847
17845
  var(--pont-sem-color-role-destructive)
17848
17846
  );
@@ -20621,43 +20619,6 @@ pont-member-management pont-typography-muted[part="subtitle"] {
20621
20619
  );
20622
20620
  }
20623
20621
 
20624
- .pont-monitoring-cards-container {
20625
- display: grid;
20626
- gap: 1rem;
20627
-
20628
- /* Desktop: up to 4 columns */
20629
- grid-template-columns: repeat(4, minmax(0, 328px));
20630
- }
20631
-
20632
- pont-monitoring-cards pont-card {
20633
- max-width: 328px;
20634
- }
20635
-
20636
- pont-monitoring-cards .pont-statistic-block-header {
20637
- display: flex;
20638
- align-items: center;
20639
- justify-content: space-between;
20640
- color: hsl(var(--pont-sem-color-text-secondary));
20641
- }
20642
-
20643
- pont-monitoring-cards pont-card {
20644
- --pont-card-border-style: solid;
20645
- --pont-card-border-color: var(--pont-monitoring-cards-color-border);
20646
- --pont-card-border-width-t: var(--pont-monitoring-cards-width-border);
20647
- --pont-card-border-width-r: var(--pont-monitoring-cards-width-border);
20648
- --pont-card-border-width-b: var(--pont-monitoring-cards-width-border);
20649
- --pont-card-border-width-l: var(--pont-monitoring-cards-width-border);
20650
-
20651
- --pont-card-effect-shadow: 0 4px 4px -2px hsla(0, 0%, 0%, 0.1);
20652
- --pont-card-effect-ring-w: 0px;
20653
- --pont-card-effect-ring-color: transparent;
20654
- }
20655
- /* Mobile: 2 columns */
20656
- @media (max-width: 728px) {
20657
- .pont-monitoring-cards-container {
20658
- grid-template-columns: repeat(2, minmax(0, 1fr));
20659
- }
20660
- }
20661
20622
  pont-invite-members-form div[part="container"] {
20662
20623
  padding: var(--pont-member-management-invite-members-form-space-p);
20663
20624
  }
@@ -23190,6 +23151,10 @@ video {
23190
23151
  padding-top: 0.375rem;
23191
23152
  padding-bottom: 0.375rem;
23192
23153
  }
23154
+ .pont-py-10{
23155
+ padding-top: 2.5rem;
23156
+ padding-bottom: 2.5rem;
23157
+ }
23193
23158
  .pont-py-2{
23194
23159
  padding-top: 0.5rem;
23195
23160
  padding-bottom: 0.5rem;
@@ -25245,9 +25210,6 @@ body {
25245
25210
  .md\:pont-flex{
25246
25211
  display: flex;
25247
25212
  }
25248
- .md\:pont-hidden{
25249
- display: none;
25250
- }
25251
25213
  .md\:pont-h-1\/2{
25252
25214
  height: 50%;
25253
25215
  }
@@ -37,8 +37,25 @@ export interface EnvConfig {
37
37
  locales?: string;
38
38
  /**
39
39
  * The management gateway, e.g. `"https://api.us.pontive.com"`. Called directly
40
- * from the browser with the signed-in user's bearer token; the SDK adds the
41
- * `/mgmt/v1` prefix itself.
40
+ * from the browser with a management-API token (`Auth.getManagementToken`);
41
+ * the SDK adds the `/mgmt/v1` prefix itself.
42
42
  */
43
43
  apiBaseUrl: string;
44
+ /**
45
+ * The OAuth scopes every embedded sign-in, sign-up and invitation flow asks
46
+ * for, as a space-separated string or an array. It REPLACES the server's
47
+ * default of `openid email profile`, so list those too.
48
+ *
49
+ * `pont-member-management` needs the organization-member scopes here, and a
50
+ * refresh token (`offline_access`, unless the app's refresh setting already
51
+ * issues one), and the app must allow the scopes:
52
+ *
53
+ * ```ts
54
+ * scope: ["openid", "email", "profile", "offline_access",
55
+ * ...Object.values(ORGANIZATION_MEMBER_SCOPES)]
56
+ * ```
57
+ *
58
+ * Omit it to keep the server's default.
59
+ */
60
+ scope?: string | string[];
44
61
  }
@@ -36,7 +36,12 @@ export interface GetInvitationsParams {
36
36
  }
37
37
  export interface InviteMembersRequest {
38
38
  emails: string[];
39
- invited_by?: string;
40
- message?: string;
39
+ /** Organization roles; with none, the organization's roles-on-join apply. */
41
40
  roles?: string[];
41
+ message?: string;
42
+ /**
43
+ * The app the invitation is for: its sign-in domain, branding and flows are
44
+ * what the invitee sees. Required when several apps admit the organization.
45
+ */
46
+ app_id?: string;
42
47
  }
@@ -1,38 +1,19 @@
1
- import { Pagination } from '../../..';
2
- export interface GetRolesParams {
3
- type?: "system" | "custom";
4
- name?: string;
5
- resource_type?: string;
6
- resource_id?: string;
7
- include_instance_scoped?: boolean;
8
- permission?: string;
9
- page?: number;
10
- limit?: number;
11
- order?: string;
12
- }
13
- export interface RoleInheritance {
14
- parent_type: string;
15
- parent_role_keys: string[];
16
- }
17
- export interface Role {
18
- assignment_count: number;
19
- created_at: number;
20
- description: string;
21
- inheritance: RoleInheritance[];
1
+ /**
2
+ * A role a member of an organization can be given
3
+ * (GET /organizations/{org_id}/assignable-roles).
4
+ */
5
+ export interface AssignableRole {
22
6
  key: string;
23
- metadata: Record<string, any>;
24
7
  name: string;
25
- object: string;
26
- permission_count: number;
27
- permissions: string[];
28
- resource_id: string;
29
- resource_type: string;
30
- type: "system" | "custom";
31
- updated_at: number;
32
- }
33
- export interface ListRolesResponse {
34
- data: Role[];
35
- object: string;
36
- pagination: Pagination;
8
+ description?: string;
9
+ /** Assigning or removing it transfers ownership (`owner`). */
10
+ requires_transfer: boolean;
11
+ /**
12
+ * Whether the caller may assign or remove it: false for a role carrying
13
+ * permissions the caller does not hold, and for `owner` without the right to
14
+ * transfer ownership. A role picker shows it locked.
15
+ */
16
+ assignable_by_caller: boolean;
17
+ /** A custom role defined for this organization alone, not the instance. */
18
+ organization_scoped: boolean;
37
19
  }
38
- export type RolesResponse = ListRolesResponse;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pontive/pontkit-core",
3
- "version": "1.29.0",
3
+ "version": "1.31.0",
4
4
  "license": "MIT",
5
5
  "description": "A collection of core components for Pontive",
6
6
  "main": "dist/index.js",
@@ -97,7 +97,7 @@
97
97
  "@lit/context": "^1.1.0",
98
98
  "@lit/reactive-element": "^2.1.0",
99
99
  "@open-wc/lit-helpers": "^0.7.0",
100
- "@pontive/oidc-client": "^1.5.0",
100
+ "@pontive/oidc-client": "^1.6.0",
101
101
  "class-variance-authority": "^0.7.0",
102
102
  "clsx": "^2.1.0",
103
103
  "jsoneditor": "^10.2.0",
@@ -1,20 +0,0 @@
1
- import { LitElement, TemplateResult } from 'lit';
2
- export declare class PontMonitoringCards extends LitElement {
3
- protected createRenderRoot(): HTMLElement | DocumentFragment;
4
- generateBlockProps(type: "total-members" | "active-members" | "pending-invites" | "inactive-members"): {
5
- title: string;
6
- content: string;
7
- icon: () => TemplateResult<2>;
8
- };
9
- statisticBlock({ title, content, icon, }: {
10
- title: string;
11
- content: string;
12
- icon: () => TemplateResult<2>;
13
- }): TemplateResult<1>;
14
- render(): TemplateResult<1>;
15
- }
16
- declare global {
17
- interface HTMLElementTagNameMap {
18
- "pont-monitoring-cards": PontMonitoringCards;
19
- }
20
- }
@@ -1,4 +0,0 @@
1
- import { MembersResponse, InvitationsResponse, RolesResponse } from '../../../types';
2
- export declare function getMockRoles(params?: any): RolesResponse;
3
- export declare function getMockMembers(params?: any): MembersResponse;
4
- export declare function getMockInvitations(params?: any): InvitationsResponse;
@@ -1,7 +0,0 @@
1
- import { GetRolesParams, RolesResponse } from '../../../types';
2
- /**
3
- * The organization resource type: an organization's roles and memberships are
4
- * scoped to it (pontive-spec 28 §3).
5
- */
6
- export declare const ORGANIZATION_RESOURCE_TYPE = "org";
7
- export declare function getRoles(params?: GetRolesParams): Promise<RolesResponse>;