@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
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ work.
|
|
|
32
32
|
|
|
33
33
|
| Layer | Count | What it is |
|
|
34
34
|
|---|---|---|
|
|
35
|
-
| **Widgets** |
|
|
35
|
+
| **Widgets** | 65 | The composed surfaces: `pont-signin`, `pont-signup`, `pont-provider`, `pont-account-settings`, `pont-member-management`, `pont-organization-switcher`, … |
|
|
36
36
|
| **Primitives** | 206 | The internal component library the widgets are built from — buttons, inputs, popovers, tables. Absorbed from the Revotech UI kit, which this package used to depend on. |
|
|
37
37
|
| **Catalog** | 29 | The subset a brand author may place in a widget. See below. |
|
|
38
38
|
|
|
@@ -40,6 +40,34 @@ Everything shares the `pont-` prefix. Everything renders into **light DOM**
|
|
|
40
40
|
(`createRenderRoot() { return this }`), which is why the Tailwind utilities are
|
|
41
41
|
prefixed too — those class names land in the host application's stylesheet.
|
|
42
42
|
|
|
43
|
+
## Organization switcher
|
|
44
|
+
|
|
45
|
+
A session acts in one organization at a time, and nobody is asked to pick one
|
|
46
|
+
at sign-in. `<pont-organization-switcher>` is where an app offers the choice,
|
|
47
|
+
wherever it wants it:
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<pont-provider>
|
|
51
|
+
<pont-organization-switcher reload-on-switch></pont-organization-switcher>
|
|
52
|
+
</pont-provider>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
It lists the organizations the user belongs to (`GET /me/organizations`),
|
|
56
|
+
marks the current one (`Auth.getOrganization()`), and switches with
|
|
57
|
+
`Auth.switchOrganization(id)` — new tokens for that organization, no sign-in.
|
|
58
|
+
It renders nothing for a signed-out user or one with no organizations, so a B2C
|
|
59
|
+
app can include it harmlessly.
|
|
60
|
+
|
|
61
|
+
- `pont-organization-changed` (detail `{ organizationId, roles, permissions }`)
|
|
62
|
+
fires after a switch; reload whatever depends on the organization.
|
|
63
|
+
- `reload-on-switch` reloads the page instead — what a server-rendered page
|
|
64
|
+
wants, since its server reads the new access token on the next request.
|
|
65
|
+
- `pont-organization-switch-failed` fires when a switch is refused; the session
|
|
66
|
+
is unchanged.
|
|
67
|
+
- `empty-label` is shown when the session acts in no organization yet.
|
|
68
|
+
- `onOrganizationChanged` / `onSwitchFailed` are the same two as callback
|
|
69
|
+
properties, which is how the React and Vue bindings take them.
|
|
70
|
+
|
|
43
71
|
## How it is delivered
|
|
44
72
|
|
|
45
73
|
Not bundled by the app. `@pontive/pontkit-loader` fetches this package at
|
package/catalog.json
CHANGED