@pontive/pontkit-core 1.4.0 → 1.6.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/README.md +29 -1
- package/catalog.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/components/widgets/index.d.ts +1 -0
- package/dist/components/widgets/pont-organization-switcher/index.d.ts +1 -0
- package/dist/components/widgets/pont-organization-switcher/pont-organization-switcher.d.ts +63 -0
- package/dist/element-tag-map.d.ts +2 -0
- package/dist/index.js +532 -500
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3956 -3790
- package/dist/index.mjs.map +1 -1
- package/dist/service/http/user/index.d.ts +1 -0
- package/dist/service/http/user/organizations.d.ts +16 -0
- package/dist/styles.css +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './pont-organization-switcher';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
import { AuthState } from '../../../context';
|
|
3
|
+
/** Fired on the element (bubbling, composed) after the session moved. */
|
|
4
|
+
export declare const ORGANIZATION_CHANGED_EVENT = "pont-organization-changed";
|
|
5
|
+
/** Fired when a switch was refused; the session is unchanged. */
|
|
6
|
+
export declare const ORGANIZATION_SWITCH_FAILED_EVENT = "pont-organization-switch-failed";
|
|
7
|
+
export interface OrganizationChangedDetail {
|
|
8
|
+
organizationId: string;
|
|
9
|
+
roles: string[];
|
|
10
|
+
permissions: string[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Lets a signed-in user move their session to another organization they
|
|
14
|
+
* belong to.
|
|
15
|
+
*
|
|
16
|
+
* The session acts in one organization at a time; the access token says which
|
|
17
|
+
* (org_id) and what the user holds there. Nobody is asked to pick at sign-in,
|
|
18
|
+
* so this is where an app offers the choice, wherever it wants it — typically
|
|
19
|
+
* the header. Choosing one is a refresh that names the organization
|
|
20
|
+
* (Auth.switchOrganization): new tokens, same session, no sign-in.
|
|
21
|
+
*
|
|
22
|
+
* Renders nothing until the session is known, for a signed-out user, and for a
|
|
23
|
+
* user with no organizations — a B2C app can include it and never show it.
|
|
24
|
+
*
|
|
25
|
+
* After a switch it fires `pont-organization-changed` so the app can reload
|
|
26
|
+
* what it shows for the old organization. With `reload-on-switch` it reloads
|
|
27
|
+
* the page instead, which is what a server-rendered page needs: the server
|
|
28
|
+
* reads the new access token from the cookie on the next request.
|
|
29
|
+
*/
|
|
30
|
+
export declare class PontOrganizationSwitcher extends LitElement {
|
|
31
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
32
|
+
/** Reload the page after a successful switch. */
|
|
33
|
+
reloadOnSwitch: boolean;
|
|
34
|
+
/** Label shown when the session acts in no organization. */
|
|
35
|
+
emptyLabel: string;
|
|
36
|
+
/**
|
|
37
|
+
* Called after a switch, with the same detail as `pont-organization-changed`.
|
|
38
|
+
* A property rather than only an event so framework bindings that pass props
|
|
39
|
+
* (the React and Vue wrappers) can take it as `onOrganizationChanged`.
|
|
40
|
+
*/
|
|
41
|
+
onOrganizationChanged?: (detail: OrganizationChangedDetail) => void;
|
|
42
|
+
/** Called when a switch is refused; the session is unchanged. */
|
|
43
|
+
onSwitchFailed?: (detail: {
|
|
44
|
+
organizationId: string;
|
|
45
|
+
error: unknown;
|
|
46
|
+
}) => void;
|
|
47
|
+
auth?: AuthState;
|
|
48
|
+
private organizations;
|
|
49
|
+
private currentId;
|
|
50
|
+
private loaded;
|
|
51
|
+
private switching;
|
|
52
|
+
private error;
|
|
53
|
+
private readonly onFocus;
|
|
54
|
+
private readonly onChangedElsewhere;
|
|
55
|
+
connectedCallback(): void;
|
|
56
|
+
disconnectedCallback(): void;
|
|
57
|
+
protected updated(changed: PropertyValues): void;
|
|
58
|
+
private readCurrent;
|
|
59
|
+
private load;
|
|
60
|
+
private select;
|
|
61
|
+
private nameOf;
|
|
62
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
63
|
+
}
|
|
@@ -22,6 +22,7 @@ import { PontLink } from './components/renderers/navigation/link/_link';
|
|
|
22
22
|
import { PontLogo } from './components/renderers/visuals/logo/_logo';
|
|
23
23
|
import { PontModal } from './components/ui/modal/index';
|
|
24
24
|
import { PontNameField } from './components/renderers/auth/field/_name-field';
|
|
25
|
+
import { PontOrganizationSwitcher } from './components/widgets/pont-organization-switcher/pont-organization-switcher';
|
|
25
26
|
import { PontOtp } from './components/renderers/auth/otp/_otp';
|
|
26
27
|
import { PontOtpResend } from './components/renderers/auth/otp/_otp-resend';
|
|
27
28
|
import { PontPasskeyButton } from './components/renderers/auth/button/_passkey-button';
|
|
@@ -69,6 +70,7 @@ declare global {
|
|
|
69
70
|
"pont-logo": PontLogo;
|
|
70
71
|
"pont-modal": PontModal;
|
|
71
72
|
"pont-name-field": PontNameField;
|
|
73
|
+
"pont-organization-switcher": PontOrganizationSwitcher;
|
|
72
74
|
"pont-otp": PontOtp;
|
|
73
75
|
"pont-otp-resend": PontOtpResend;
|
|
74
76
|
"pont-passkey-button": PontPasskeyButton;
|