@pontive/pontkit-core 1.50.0 → 1.51.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.
@@ -4,7 +4,7 @@
4
4
  * from the legacy kit), with the same English and the same message codes, so
5
5
  * a flow's localised `messages` (keyed by code) apply unchanged.
6
6
  */
7
- export type FlowMessageCode = "connection_failed" | "too_many_attempts" | "server_error" | "instance_unavailable" | "generic_error" | "flow_ended" | "passkey_cancelled" | "start_again" | "continued_elsewhere_title" | "continued_elsewhere_subtitle" | "continue_here";
7
+ export type FlowMessageCode = "connection_failed" | "too_many_attempts" | "server_error" | "instance_unavailable" | "generic_error" | "flow_ended" | "passkey_cancelled" | "start_again" | "continued_elsewhere_title" | "continued_elsewhere_subtitle" | "continue_here" | "scope_not_allowed";
8
8
  /** The flow codes' English (a subset of `KIT_MESSAGES_EN`, core/messages.ts). */
9
9
  export declare const FLOW_MESSAGES_EN: Record<FlowMessageCode, string>;
10
10
  export interface FlowErrorDescription {
@@ -20,6 +20,13 @@ export interface FlowErrorDescription {
20
20
  * reason (pontive-spec 01, "Who is told why"; carry-over §6).
21
21
  */
22
22
  export declare const INSTANCE_UNAVAILABLE = "instance_unavailable";
23
+ /**
24
+ * The sign-in runtime refused to start a flow because the app asked for a scope
25
+ * it does not allow (identity-svc's `invalid_scope`). The person can do nothing
26
+ * about it, so the kit says so in its own words; the server's detail is for the
27
+ * app's developer, and the flow widget logs the error.
28
+ */
29
+ export declare const INVALID_SCOPE = "invalid_scope";
23
30
  /** Whether a failed call was refused because the instance has stopped (its own `code`, or its body's). */
24
31
  export declare function isInstanceUnavailable(error: unknown): boolean;
25
32
  /**
@@ -33,12 +40,24 @@ export declare function rememberUnavailable(sentence?: string): void;
33
40
  /**
34
41
  * - a cancelled or timed-out WebAuthn prompt (`NotAllowedError` / `AbortError`) → passkey_cancelled
35
42
  * - `instance_unavailable` → the refusal's own sentence, kept for the page (rememberUnavailable); not restartable
36
- * - 409 → the server's sentence, else flow_ended; restartable
43
+ * - `invalid_scope` (a flow start asking for a scope the app does not allow) → scope_not_allowed
44
+ * - 409 → the code's message, else the server's sentence, else flow_ended; restartable
37
45
  * - no response at all (NETWORK_ERROR / TIMEOUT) → connection_failed
38
46
  * - 429 → too_many_attempts; ≥ 500 → server_error
39
- * - anything else → the server's sentence, else generic_error
47
+ * - anything else → the code's message, else the server's sentence, else generic_error
40
48
  *
41
49
  * Text comes from `messages` when given (a set a caller holds), else the
42
- * page-wide message table (core/messages.ts), else English.
50
+ * page-wide message table (core/messages.ts), else English. "The code's
51
+ * message" is the text for the refusal's `error.code` when the kit has one:
52
+ * that text is localised (branding-svc), the server's own is English only, so
53
+ * the server's sentence (without a leading code, serverSentence) is the
54
+ * fallback for a code the kit has no message for.
43
55
  */
44
56
  export declare function describeFlowError(error: unknown, messages?: Partial<Record<string, string>>): FlowErrorDescription;
57
+ /** `message` without a leading error code (CODE_PREFIX), when it has one. */
58
+ export declare function stripCodePrefix(message: string, code?: string): string;
59
+ /**
60
+ * A server message fit to show: a sentence, not "HTTP 400" or something with code in backticks,
61
+ * and without a leading error code (stripCodePrefix).
62
+ */
63
+ export declare function serverSentence(message?: string, code?: string): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pontive/pontkit-core",
3
- "version": "1.50.0",
3
+ "version": "1.51.0",
4
4
  "license": "MIT",
5
5
  "description": "A collection of core components for Pontive",
6
6
  "module": "dist/index.mjs",