@pontive/react 0.0.0-stage → 1.23.1

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.
@@ -0,0 +1,77 @@
1
+ import { default as React } from 'react';
2
+ import { PontProviderElement, ProviderElementEvents } from './elements.generated.cjs';
3
+ import { AccountClient, AuthState, ProviderInputProps, ProviderSdk, SessionChange } from './types.cjs';
4
+ /**
5
+ * `<Provider>`: `<pont-provider>` for React.
6
+ *
7
+ * What the element can't do for itself is get the SDK: core never imports the
8
+ * auth client, it is injected (`provider.sdk = Auth`, pontkit-core
9
+ * docs/kit/provider.md). This injects it, and turns the element's
10
+ * `pont-auth-changed` / `pont-session-changed` into React context.
11
+ *
12
+ * **Which `Auth`.** `@pontive/oidc-client`'s, a dependency of this package, so
13
+ * the app bundles exactly one copy (shared with the app's own, when it imports
14
+ * the same package). An app with another client passes `sdk` instead. `Auth`
15
+ * is a singleton whose constructor touches nothing, so importing it on a
16
+ * server is safe; the element only calls it in the browser.
17
+ */
18
+ export interface ProviderProps extends ProviderInputProps, ProviderElementEvents {
19
+ children?: React.ReactNode;
20
+ /** The auth SDK. Default: `Auth` from `@pontive/oidc-client`. */
21
+ sdk?: ProviderSdk;
22
+ }
23
+ export declare const Provider: React.ForwardRefExoticComponent<ProviderProps & React.RefAttributes<PontProviderElement>>;
24
+ /**
25
+ * The session as the nearest `<Provider>` knows it. `resolved` is false until
26
+ * `restoreSession()` has come back; act on nothing before it.
27
+ */
28
+ export declare function useAuthState(): AuthState;
29
+ /**
30
+ * The last session change (`reason`: `signed-in`, `restored`, `refreshed`,
31
+ * `organization-changed`, `signed-out`, `expired`), here or in another tab.
32
+ * Null before the first. Use it to reload what depends on the organization.
33
+ */
34
+ export declare function useSession(): SessionChange | null;
35
+ /**
36
+ * The SDK the provider injected, for the calls the widgets don't make
37
+ * (`signOut()`, `getManagementToken()` …).
38
+ */
39
+ export declare function useSdk(): ProviderSdk;
40
+ /**
41
+ * The account client the widgets use (the provider's `accountClient`, else the
42
+ * default one it builds from the SDK and `apiBaseUrl`), for the calls an app
43
+ * makes beside them: `listBillingAccounts()` and `listMyContracts()` to choose
44
+ * between `<Checkout>` and `<BillingPortal>`, for example. Undefined until the
45
+ * provider has configured the SDK; read again on every auth and session change,
46
+ * since the default client exists once the session has resolved.
47
+ */
48
+ export declare function useAccountClient(): AccountClient | undefined;
49
+ export interface ControlProps {
50
+ children?: React.ReactNode;
51
+ /** Rendered until the session is known (default: nothing). */
52
+ fallback?: React.ReactNode | null;
53
+ }
54
+ /**
55
+ * Children for a signed-in user. A React component rather than a wrapper over
56
+ * `<pont-signed-in>`, which detaches its children: nodes React must keep
57
+ * owning (provider.md: framework hosts branch on `pont-auth-changed`).
58
+ */
59
+ export declare function SignedIn({ children, fallback }: ControlProps): React.ReactNode;
60
+ /** Children for everyone else, once the session is known. */
61
+ export declare function SignedOut({ children, fallback }: ControlProps): React.ReactNode;
62
+ /** Children once the session is known; `fallback` until then. */
63
+ export declare function AuthResolved({ children, fallback }: ControlProps): React.ReactNode;
64
+ export interface AuthenticatedProps {
65
+ children?: React.ReactNode;
66
+ /** Rendered while the session is being resolved. */
67
+ loading?: React.ReactNode;
68
+ /** Where to send a signed-out visitor. Default: the provider's `signinUrl`. */
69
+ redirectUrl?: string;
70
+ /** Navigate with the app's router (`router.push`) instead of a page load. */
71
+ onRedirect?: (url: string) => void;
72
+ }
73
+ /**
74
+ * Children for a signed-in user; everyone else is sent to the sign-in page,
75
+ * once the session has resolved (never on the interim "signed out").
76
+ */
77
+ export declare function Authenticated({ children, loading, redirectUrl, onRedirect, }: AuthenticatedProps): React.ReactNode;
@@ -0,0 +1,77 @@
1
+ import { default as React } from 'react';
2
+ import { PontProviderElement, ProviderElementEvents } from './elements.generated.js';
3
+ import { AccountClient, AuthState, ProviderInputProps, ProviderSdk, SessionChange } from './types.js';
4
+ /**
5
+ * `<Provider>`: `<pont-provider>` for React.
6
+ *
7
+ * What the element can't do for itself is get the SDK: core never imports the
8
+ * auth client, it is injected (`provider.sdk = Auth`, pontkit-core
9
+ * docs/kit/provider.md). This injects it, and turns the element's
10
+ * `pont-auth-changed` / `pont-session-changed` into React context.
11
+ *
12
+ * **Which `Auth`.** `@pontive/oidc-client`'s, a dependency of this package, so
13
+ * the app bundles exactly one copy (shared with the app's own, when it imports
14
+ * the same package). An app with another client passes `sdk` instead. `Auth`
15
+ * is a singleton whose constructor touches nothing, so importing it on a
16
+ * server is safe; the element only calls it in the browser.
17
+ */
18
+ export interface ProviderProps extends ProviderInputProps, ProviderElementEvents {
19
+ children?: React.ReactNode;
20
+ /** The auth SDK. Default: `Auth` from `@pontive/oidc-client`. */
21
+ sdk?: ProviderSdk;
22
+ }
23
+ export declare const Provider: React.ForwardRefExoticComponent<ProviderProps & React.RefAttributes<PontProviderElement>>;
24
+ /**
25
+ * The session as the nearest `<Provider>` knows it. `resolved` is false until
26
+ * `restoreSession()` has come back; act on nothing before it.
27
+ */
28
+ export declare function useAuthState(): AuthState;
29
+ /**
30
+ * The last session change (`reason`: `signed-in`, `restored`, `refreshed`,
31
+ * `organization-changed`, `signed-out`, `expired`), here or in another tab.
32
+ * Null before the first. Use it to reload what depends on the organization.
33
+ */
34
+ export declare function useSession(): SessionChange | null;
35
+ /**
36
+ * The SDK the provider injected, for the calls the widgets don't make
37
+ * (`signOut()`, `getManagementToken()` …).
38
+ */
39
+ export declare function useSdk(): ProviderSdk;
40
+ /**
41
+ * The account client the widgets use (the provider's `accountClient`, else the
42
+ * default one it builds from the SDK and `apiBaseUrl`), for the calls an app
43
+ * makes beside them: `listBillingAccounts()` and `listMyContracts()` to choose
44
+ * between `<Checkout>` and `<BillingPortal>`, for example. Undefined until the
45
+ * provider has configured the SDK; read again on every auth and session change,
46
+ * since the default client exists once the session has resolved.
47
+ */
48
+ export declare function useAccountClient(): AccountClient | undefined;
49
+ export interface ControlProps {
50
+ children?: React.ReactNode;
51
+ /** Rendered until the session is known (default: nothing). */
52
+ fallback?: React.ReactNode | null;
53
+ }
54
+ /**
55
+ * Children for a signed-in user. A React component rather than a wrapper over
56
+ * `<pont-signed-in>`, which detaches its children: nodes React must keep
57
+ * owning (provider.md: framework hosts branch on `pont-auth-changed`).
58
+ */
59
+ export declare function SignedIn({ children, fallback }: ControlProps): React.ReactNode;
60
+ /** Children for everyone else, once the session is known. */
61
+ export declare function SignedOut({ children, fallback }: ControlProps): React.ReactNode;
62
+ /** Children once the session is known; `fallback` until then. */
63
+ export declare function AuthResolved({ children, fallback }: ControlProps): React.ReactNode;
64
+ export interface AuthenticatedProps {
65
+ children?: React.ReactNode;
66
+ /** Rendered while the session is being resolved. */
67
+ loading?: React.ReactNode;
68
+ /** Where to send a signed-out visitor. Default: the provider's `signinUrl`. */
69
+ redirectUrl?: string;
70
+ /** Navigate with the app's router (`router.push`) instead of a page load. */
71
+ onRedirect?: (url: string) => void;
72
+ }
73
+ /**
74
+ * Children for a signed-in user; everyone else is sent to the sign-in page,
75
+ * once the session has resolved (never on the interim "signed out").
76
+ */
77
+ export declare function Authenticated({ children, loading, redirectUrl, onRedirect, }: AuthenticatedProps): React.ReactNode;
@@ -0,0 +1,158 @@
1
+ import { ReactNode } from 'react';
2
+ import { AccountClient, AccountMenuItem, AccountSettingsContent, AccountSettingsLayout, AccountSettingsMode, AccountSettingsOrientation, AppSdkConfig, BrandingEntitlements, CheckoutPackageRequest, MemberManagementMode, ProviderSdk, SessionChange, WidgetClient } from './pontkit-core.cjs';
3
+ export type { AccountClient, AccountMenuItem, AuthState, BillingAccount, BillingContract, BillingSubject, CheckoutPackageRequest, ProviderSdk, SessionChange, WidgetClient, } from './pontkit-core.cjs';
4
+ /**
5
+ * Events core declares on `HTMLElementEventMap` are typed from there; this
6
+ * covers the ones it fires without declaring.
7
+ */
8
+ interface UndeclaredEvents {
9
+ "pont-session-changed": CustomEvent<SessionChange>;
10
+ }
11
+ /** The event a generated `on…` callback receives: the DOM event itself. */
12
+ export type PontEvent<K extends string> = K extends keyof HTMLElementEventMap ? HTMLElementEventMap[K] : K extends keyof UndeclaredEvents ? UndeclaredEvents[K] : CustomEvent<unknown>;
13
+ /** The inputs of `<pont-provider>` (pontkit-core docs/kit/provider.md). */
14
+ export interface ProviderInputProps {
15
+ /** Required. */
16
+ appId: string;
17
+ /** Required: a hostname, a `/path` on this origin (the auth proxy, `/__pontive`), or a base URL. */
18
+ domain: string;
19
+ /** BCP-47 tags in preference order; empty lets the server negotiate. */
20
+ locales?: string;
21
+ signinUrl?: string;
22
+ signupUrl?: string;
23
+ invitationUrl?: string;
24
+ /** Where a signed-in user is sent from the sign-in, sign-up and invitation pages. */
25
+ signinRedirectUrl?: string;
26
+ /** "Continue here instead" (default: `signinRedirectUrl`). */
27
+ continueHereUrl?: string;
28
+ /** The OAuth scopes every flow asks for. Member management needs `pontive:org:member:*`. */
29
+ scope?: string | string[];
30
+ /** The organization a sign-in starts in. */
31
+ organizationId?: string;
32
+ /**
33
+ * The regional API the default account client calls for organization
34
+ * management (`https://api.us.pontive.com`, routes under `/v1`). Absolute
35
+ * http(s) only: the auth proxy forwards the auth domain's `/v1/me`, not the
36
+ * API host's routes.
37
+ */
38
+ apiBaseUrl?: string;
39
+ /** The identifier to pre-fill (default: the URL's `login_hint`). */
40
+ loginHint?: string;
41
+ /** Default on. `false` keeps a signed-in user on the auth pages. */
42
+ autoRedirect?: boolean;
43
+ /** `"none"` opts out of linking the published theme. */
44
+ theme?: string;
45
+ /**
46
+ * Where the development banner's *Claim it* goes on an unclaimed
47
+ * development instance (pontkit-core 1.86.0+). @pontive/nextjs's
48
+ * `providerProps()` sets it in keyless mode; leave it unset otherwise, and
49
+ * the banner links to the docs on claiming.
50
+ */
51
+ claimUrl?: string;
52
+ /** Extra request headers for the SDK and the default account client. */
53
+ headers?: Record<string, string>;
54
+ /** The app's own account client; wins over the default one. */
55
+ accountClient?: AccountClient;
56
+ /**
57
+ * The app's own SDK options and callbacks (`onFlowStateChange`,
58
+ * `onAuthenticated` …). The provider chains them after its own; don't call
59
+ * `Auth.configure()` yourself.
60
+ */
61
+ config?: AppSdkConfig;
62
+ }
63
+ /** The raw `<pont-provider>` wrapper's props: the inputs plus the SDK. */
64
+ export interface ProviderElementProps extends ProviderInputProps {
65
+ children?: ReactNode;
66
+ sdk?: ProviderSdk;
67
+ }
68
+ /** `pont-signin`, `pont-signup`, `pont-invitation`. */
69
+ export interface FlowWidgetProps {
70
+ /**
71
+ * Shown until the first screen renders, then removed by the widget.
72
+ */
73
+ fallback?: ReactNode | null;
74
+ /** The widget's own client. Inside a `Provider` it uses the provider's. */
75
+ client?: WidgetClient;
76
+ /** Its own branding entitlements. Inside a `Provider` it uses the provider's. */
77
+ branding?: BrandingEntitlements;
78
+ /** Default `sys_signin-flow-passkey` / `sys_signup-flow`; none for the invitation. */
79
+ flowId?: string;
80
+ }
81
+ /** `pont-consent` (the OAuth consent page). */
82
+ export interface ConsentProps {
83
+ /** The page's `consent_request` parameter. */
84
+ consentRequest: string;
85
+ /** Where auth-api is (default: this origin, which the session cookie needs). */
86
+ baseUrl?: string;
87
+ locales?: string;
88
+ branding?: BrandingEntitlements;
89
+ }
90
+ /** What every account widget takes. */
91
+ interface AccountWidgetProps {
92
+ /** Its own account client. Inside a `Provider` it uses the provider's. */
93
+ client?: AccountClient;
94
+ }
95
+ export interface AccountMenuProps extends AccountWidgetProps {
96
+ /** Where "Account settings" goes when `onAccountSettings` doesn't cancel. */
97
+ accountSettingsUrl?: string;
98
+ /** Entries between "Account settings" and "Log out". */
99
+ items?: AccountMenuItem[];
100
+ }
101
+ export interface OrganizationSwitcherProps extends AccountWidgetProps {
102
+ /** Reload the page after a switch (for server-rendered pages). */
103
+ reloadOnSwitch?: boolean;
104
+ /** The button's text while the session acts in no organization. */
105
+ emptyLabel?: string;
106
+ }
107
+ export interface AccountSettingsProps extends AccountWidgetProps {
108
+ mode?: AccountSettingsMode;
109
+ orientation?: AccountSettingsOrientation;
110
+ widgetsLayout?: AccountSettingsLayout;
111
+ /** Modal mode: whether the dialog is open. */
112
+ open?: boolean;
113
+ content?: AccountSettingsContent | null;
114
+ }
115
+ export interface MemberManagementProps extends AccountWidgetProps {
116
+ /** The organization to manage (default: the session's). */
117
+ organizationId?: string;
118
+ mode?: MemberManagementMode;
119
+ /** Modal mode: whether the dialog is open. */
120
+ open?: boolean;
121
+ heading?: string;
122
+ description?: string;
123
+ /** 5, 10 or 25. */
124
+ pageSize?: number;
125
+ }
126
+ /**
127
+ * `pont-checkout` (beta: needs the instance's `billing` capability; pontkit-core
128
+ * docs/kit/checkout.md).
129
+ */
130
+ export interface CheckoutProps extends AccountWidgetProps {
131
+ /**
132
+ * The packages offered: ids or keys, each with `:` and its frequencies
133
+ * (`"pkg_pro:monthly,annual pkg_team"`), or the same as an array.
134
+ */
135
+ packages?: string | CheckoutPackageRequest[];
136
+ /** Where the browser goes once the session completes (default: this page). */
137
+ successUrl?: string;
138
+ /** Where "Cancel" goes; no Cancel button without it. */
139
+ cancelUrl?: string;
140
+ /** A checkout session the client's server created (`chks_...`); `packages` is then ignored. */
141
+ session?: string;
142
+ /** The Customer's subject, `org_...` or `usr_...` (default: as billing-svc resolves it). */
143
+ subject?: string;
144
+ heading?: string;
145
+ }
146
+ /**
147
+ * `pont-billing-portal` (beta: needs the instance's `billing` capability;
148
+ * pontkit-core docs/kit/billing-portal.md).
149
+ */
150
+ export interface BillingPortalProps extends AccountWidgetProps {
151
+ /**
152
+ * The Customer's subject, `org_...` or `usr_...` (default: as billing-svc
153
+ * resolves it). A suspended organization's owner reaches it this way.
154
+ */
155
+ subject?: string;
156
+ heading?: string;
157
+ description?: string;
158
+ }
@@ -0,0 +1,158 @@
1
+ import { ReactNode } from 'react';
2
+ import { AccountClient, AccountMenuItem, AccountSettingsContent, AccountSettingsLayout, AccountSettingsMode, AccountSettingsOrientation, AppSdkConfig, BrandingEntitlements, CheckoutPackageRequest, MemberManagementMode, ProviderSdk, SessionChange, WidgetClient } from './pontkit-core.cjs';
3
+ export type { AccountClient, AccountMenuItem, AuthState, BillingAccount, BillingContract, BillingSubject, CheckoutPackageRequest, ProviderSdk, SessionChange, WidgetClient, } from './pontkit-core.cjs';
4
+ /**
5
+ * Events core declares on `HTMLElementEventMap` are typed from there; this
6
+ * covers the ones it fires without declaring.
7
+ */
8
+ interface UndeclaredEvents {
9
+ "pont-session-changed": CustomEvent<SessionChange>;
10
+ }
11
+ /** The event a generated `on…` callback receives: the DOM event itself. */
12
+ export type PontEvent<K extends string> = K extends keyof HTMLElementEventMap ? HTMLElementEventMap[K] : K extends keyof UndeclaredEvents ? UndeclaredEvents[K] : CustomEvent<unknown>;
13
+ /** The inputs of `<pont-provider>` (pontkit-core docs/kit/provider.md). */
14
+ export interface ProviderInputProps {
15
+ /** Required. */
16
+ appId: string;
17
+ /** Required: a hostname, a `/path` on this origin (the auth proxy, `/__pontive`), or a base URL. */
18
+ domain: string;
19
+ /** BCP-47 tags in preference order; empty lets the server negotiate. */
20
+ locales?: string;
21
+ signinUrl?: string;
22
+ signupUrl?: string;
23
+ invitationUrl?: string;
24
+ /** Where a signed-in user is sent from the sign-in, sign-up and invitation pages. */
25
+ signinRedirectUrl?: string;
26
+ /** "Continue here instead" (default: `signinRedirectUrl`). */
27
+ continueHereUrl?: string;
28
+ /** The OAuth scopes every flow asks for. Member management needs `pontive:org:member:*`. */
29
+ scope?: string | string[];
30
+ /** The organization a sign-in starts in. */
31
+ organizationId?: string;
32
+ /**
33
+ * The regional API the default account client calls for organization
34
+ * management (`https://api.us.pontive.com`, routes under `/v1`). Absolute
35
+ * http(s) only: the auth proxy forwards the auth domain's `/v1/me`, not the
36
+ * API host's routes.
37
+ */
38
+ apiBaseUrl?: string;
39
+ /** The identifier to pre-fill (default: the URL's `login_hint`). */
40
+ loginHint?: string;
41
+ /** Default on. `false` keeps a signed-in user on the auth pages. */
42
+ autoRedirect?: boolean;
43
+ /** `"none"` opts out of linking the published theme. */
44
+ theme?: string;
45
+ /**
46
+ * Where the development banner's *Claim it* goes on an unclaimed
47
+ * development instance (pontkit-core 1.86.0+). @pontive/nextjs's
48
+ * `providerProps()` sets it in keyless mode; leave it unset otherwise, and
49
+ * the banner links to the docs on claiming.
50
+ */
51
+ claimUrl?: string;
52
+ /** Extra request headers for the SDK and the default account client. */
53
+ headers?: Record<string, string>;
54
+ /** The app's own account client; wins over the default one. */
55
+ accountClient?: AccountClient;
56
+ /**
57
+ * The app's own SDK options and callbacks (`onFlowStateChange`,
58
+ * `onAuthenticated` …). The provider chains them after its own; don't call
59
+ * `Auth.configure()` yourself.
60
+ */
61
+ config?: AppSdkConfig;
62
+ }
63
+ /** The raw `<pont-provider>` wrapper's props: the inputs plus the SDK. */
64
+ export interface ProviderElementProps extends ProviderInputProps {
65
+ children?: ReactNode;
66
+ sdk?: ProviderSdk;
67
+ }
68
+ /** `pont-signin`, `pont-signup`, `pont-invitation`. */
69
+ export interface FlowWidgetProps {
70
+ /**
71
+ * Shown until the first screen renders, then removed by the widget.
72
+ */
73
+ fallback?: ReactNode | null;
74
+ /** The widget's own client. Inside a `Provider` it uses the provider's. */
75
+ client?: WidgetClient;
76
+ /** Its own branding entitlements. Inside a `Provider` it uses the provider's. */
77
+ branding?: BrandingEntitlements;
78
+ /** Default `sys_signin-flow-passkey` / `sys_signup-flow`; none for the invitation. */
79
+ flowId?: string;
80
+ }
81
+ /** `pont-consent` (the OAuth consent page). */
82
+ export interface ConsentProps {
83
+ /** The page's `consent_request` parameter. */
84
+ consentRequest: string;
85
+ /** Where auth-api is (default: this origin, which the session cookie needs). */
86
+ baseUrl?: string;
87
+ locales?: string;
88
+ branding?: BrandingEntitlements;
89
+ }
90
+ /** What every account widget takes. */
91
+ interface AccountWidgetProps {
92
+ /** Its own account client. Inside a `Provider` it uses the provider's. */
93
+ client?: AccountClient;
94
+ }
95
+ export interface AccountMenuProps extends AccountWidgetProps {
96
+ /** Where "Account settings" goes when `onAccountSettings` doesn't cancel. */
97
+ accountSettingsUrl?: string;
98
+ /** Entries between "Account settings" and "Log out". */
99
+ items?: AccountMenuItem[];
100
+ }
101
+ export interface OrganizationSwitcherProps extends AccountWidgetProps {
102
+ /** Reload the page after a switch (for server-rendered pages). */
103
+ reloadOnSwitch?: boolean;
104
+ /** The button's text while the session acts in no organization. */
105
+ emptyLabel?: string;
106
+ }
107
+ export interface AccountSettingsProps extends AccountWidgetProps {
108
+ mode?: AccountSettingsMode;
109
+ orientation?: AccountSettingsOrientation;
110
+ widgetsLayout?: AccountSettingsLayout;
111
+ /** Modal mode: whether the dialog is open. */
112
+ open?: boolean;
113
+ content?: AccountSettingsContent | null;
114
+ }
115
+ export interface MemberManagementProps extends AccountWidgetProps {
116
+ /** The organization to manage (default: the session's). */
117
+ organizationId?: string;
118
+ mode?: MemberManagementMode;
119
+ /** Modal mode: whether the dialog is open. */
120
+ open?: boolean;
121
+ heading?: string;
122
+ description?: string;
123
+ /** 5, 10 or 25. */
124
+ pageSize?: number;
125
+ }
126
+ /**
127
+ * `pont-checkout` (beta: needs the instance's `billing` capability; pontkit-core
128
+ * docs/kit/checkout.md).
129
+ */
130
+ export interface CheckoutProps extends AccountWidgetProps {
131
+ /**
132
+ * The packages offered: ids or keys, each with `:` and its frequencies
133
+ * (`"pkg_pro:monthly,annual pkg_team"`), or the same as an array.
134
+ */
135
+ packages?: string | CheckoutPackageRequest[];
136
+ /** Where the browser goes once the session completes (default: this page). */
137
+ successUrl?: string;
138
+ /** Where "Cancel" goes; no Cancel button without it. */
139
+ cancelUrl?: string;
140
+ /** A checkout session the client's server created (`chks_...`); `packages` is then ignored. */
141
+ session?: string;
142
+ /** The Customer's subject, `org_...` or `usr_...` (default: as billing-svc resolves it). */
143
+ subject?: string;
144
+ heading?: string;
145
+ }
146
+ /**
147
+ * `pont-billing-portal` (beta: needs the instance's `billing` capability;
148
+ * pontkit-core docs/kit/billing-portal.md).
149
+ */
150
+ export interface BillingPortalProps extends AccountWidgetProps {
151
+ /**
152
+ * The Customer's subject, `org_...` or `usr_...` (default: as billing-svc
153
+ * resolves it). A suspended organization's owner reaches it this way.
154
+ */
155
+ subject?: string;
156
+ heading?: string;
157
+ description?: string;
158
+ }
@@ -0,0 +1,22 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * What a wrapper says about its element (generated, see tools/gen-wrappers).
4
+ */
5
+ export interface WrapOptions {
6
+ /**
7
+ * Callback prop -> DOM event. The elements report through events, so these
8
+ * props are listened for instead of assigned, and the callback gets the
9
+ * event itself (a cancelable one can be `preventDefault()`ed).
10
+ */
11
+ events?: Readonly<Record<string, string>>;
12
+ /** Whether the element honours the `[part="fallback"]` contract. */
13
+ fallback?: boolean;
14
+ /** Starts the CDN load on mount. */
15
+ provider?: boolean;
16
+ }
17
+ /**
18
+ * A React component over the custom element `tagName`, typed by `P` alone:
19
+ * children and `fallback` are whatever its props type says, because only the
20
+ * provider takes children and only the flow widgets honour a fallback.
21
+ */
22
+ export declare function wrap<T extends HTMLElement, P = {}>(tagName: string, options?: WrapOptions): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
package/dist/wrap.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * What a wrapper says about its element (generated, see tools/gen-wrappers).
4
+ */
5
+ export interface WrapOptions {
6
+ /**
7
+ * Callback prop -> DOM event. The elements report through events, so these
8
+ * props are listened for instead of assigned, and the callback gets the
9
+ * event itself (a cancelable one can be `preventDefault()`ed).
10
+ */
11
+ events?: Readonly<Record<string, string>>;
12
+ /** Whether the element honours the `[part="fallback"]` contract. */
13
+ fallback?: boolean;
14
+ /** Starts the CDN load on mount. */
15
+ provider?: boolean;
16
+ }
17
+ /**
18
+ * A React component over the custom element `tagName`, typed by `P` alone:
19
+ * children and `fallback` are whatever its props type says, because only the
20
+ * provider takes children and only the flow widgets honour a fallback.
21
+ */
22
+ export declare function wrap<T extends HTMLElement, P = {}>(tagName: string, options?: WrapOptions): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
package/package.json CHANGED
@@ -1,6 +1,49 @@
1
1
  {
2
2
  "name": "@pontive/react",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.23.1",
4
+ "license": "MIT",
5
+ "description": "React components over the PontKit (pont-*) custom elements.",
6
+ "type": "module",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "require": {
17
+ "types": "./dist/index.d.cts",
18
+ "default": "./dist/index.cjs"
19
+ }
20
+ }
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "sideEffects": false,
26
+ "scripts": {
27
+ "build": "vite build && node ../../scripts/core-types.mjs && node ../../scripts/declarations.mjs",
28
+ "test": "vitest run",
29
+ "typecheck": "tsc --noEmit"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "peerDependencies": {
35
+ "react": "^18 || ^19",
36
+ "react-dom": "^18 || ^19"
37
+ },
38
+ "dependencies": {
39
+ "@pontive/oidc-client": "^1.9.0",
40
+ "@pontive/pontkit-loader": "^1.23.1"
41
+ },
42
+ "devDependencies": {
43
+ "@pontive/pontkit-core": "1.89.0",
44
+ "@testing-library/dom": "^10.4.1",
45
+ "@testing-library/react": "^16.3.3",
46
+ "@types/react-dom": "^19.2.5",
47
+ "jsdom": "^29.1.1"
48
+ }
49
+ }