@pontive/pontkit-core 1.22.1 → 1.24.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.
@@ -16,6 +16,10 @@ export declare class PontRecoveryCodes extends BaseElement implements RecoveryCo
16
16
  title: string;
17
17
  subtitle: string;
18
18
  codes: string[];
19
+ emptyText: string;
20
+ copyLabel: string;
21
+ downloadLabel: string;
22
+ copiedText: string;
19
23
  disabled: boolean;
20
24
  private _copied;
21
25
  private _copyTimeout;
@@ -2,6 +2,10 @@ export type RecoveryCodesProps = {
2
2
  title: string;
3
3
  subtitle: string;
4
4
  codes: string[];
5
+ emptyText: string;
6
+ copyLabel: string;
7
+ downloadLabel: string;
8
+ copiedText: string;
5
9
  disabled: boolean;
6
10
  };
7
11
  export type RecoveryCodesParts = "root" | "card" | "title" | "subtitle" | "codesList" | "codeItem" | "buttons" | "copyButton" | "downloadButton" | "tooltip";
@@ -17,6 +17,9 @@ export declare class PontSecret extends BaseElement implements SecretProps {
17
17
  issuer: string;
18
18
  account: string;
19
19
  secretLabel: string;
20
+ issuerLabel: string;
21
+ accountLabel: string;
22
+ copiedText: string;
20
23
  disabled: boolean;
21
24
  private _copied;
22
25
  private _copyTimeout;
@@ -4,6 +4,9 @@ export type SecretProps = {
4
4
  issuer: string;
5
5
  account: string;
6
6
  secretLabel: string;
7
+ issuerLabel: string;
8
+ accountLabel: string;
9
+ copiedText: string;
7
10
  disabled: boolean;
8
11
  };
9
12
  export type SecretParts = "root" | "card" | "title" | "inputGroup" | "copyButton" | "metadata" | "issuer" | "account" | "tooltip";
@@ -29,6 +29,7 @@ export declare class PontUserSnippet extends LitElement {
29
29
  render(): TemplateResult<1>;
30
30
  }
31
31
  export declare class PontAccountMenu extends LitElement {
32
+ private readonly _messages;
32
33
  protected createRenderRoot(): HTMLElement | DocumentFragment;
33
34
  accountSettingsPath: string;
34
35
  menuItems: MenuItem[];
@@ -2,6 +2,7 @@ import { LitElement } from 'lit';
2
2
  import { USER_ACCOUNT_SETTINGS_MODE, USER_ACCOUNT_SETTINGS_ORIENTATION, USER_ACCOUNT_SETTINGS_SIDEBAR_DISPLAY_TYPE, USER_ACCOUNT_SETTINGS_WIDGETS_LAYOUT, IProfileContentCustomizations } from '../../../types';
3
3
  import { AuthState } from '../../../context';
4
4
  export declare class PontAccountSettings extends LitElement {
5
+ private readonly _messages;
5
6
  showAvatarMenu: boolean;
6
7
  orientation: USER_ACCOUNT_SETTINGS_ORIENTATION;
7
8
  mobileDisplay: USER_ACCOUNT_SETTINGS_SIDEBAR_DISPLAY_TYPE;
@@ -6,6 +6,7 @@ export interface Account {
6
6
  avatar: string;
7
7
  }
8
8
  export declare class PontAccountInfo extends LitElement {
9
+ private readonly _messages;
9
10
  account: Account;
10
11
  showAvatarMenu: boolean;
11
12
  toggleAvatarMenu: (e: Event) => void;
@@ -5,6 +5,7 @@ export interface LocationInfo {
5
5
  zoneInfo: string;
6
6
  }
7
7
  export declare class PontLocationInfo extends LitElement {
8
+ private readonly _messages;
8
9
  locationInfo: LocationInfo;
9
10
  showIcons: boolean;
10
11
  layout: USER_ACCOUNT_SETTINGS_WIDGETS_LAYOUT;
@@ -10,6 +10,7 @@ export interface PersonalInfo {
10
10
  bio: string;
11
11
  }
12
12
  export declare class PontPersonalInfo extends LitElement {
13
+ private readonly _messages;
13
14
  personal: PersonalInfo;
14
15
  showIcons: boolean;
15
16
  layout: USER_ACCOUNT_SETTINGS_WIDGETS_LAYOUT;
@@ -4,6 +4,7 @@ export interface URLsInfo {
4
4
  website: string;
5
5
  }
6
6
  export declare class PontUrlsInfo extends LitElement {
7
+ private readonly _messages;
7
8
  URLsInfo: URLsInfo;
8
9
  showIcons: boolean;
9
10
  layout: USER_ACCOUNT_SETTINGS_WIDGETS_LAYOUT;
@@ -1,5 +1,6 @@
1
1
  import { LitElement } from 'lit';
2
2
  export declare class PontSecuritySettings extends LitElement {
3
+ private readonly _messages;
3
4
  loading: boolean;
4
5
  render(): import('lit-html').TemplateResult<1>;
5
6
  createRenderRoot(): this;
@@ -5,6 +5,7 @@ export interface SidebarConfig {
5
5
  modalIcon?: TemplateResult;
6
6
  }
7
7
  export declare class PontProfileSidebar extends LitElement {
8
+ private readonly _messages;
8
9
  orientation: USER_ACCOUNT_SETTINGS_ORIENTATION;
9
10
  displayType: USER_ACCOUNT_SETTINGS_SIDEBAR_DISPLAY_TYPE;
10
11
  mode: USER_ACCOUNT_SETTINGS_MODE;
@@ -28,6 +28,7 @@ export interface OrganizationChangedDetail {
28
28
  * reads the new access token from the cookie on the next request.
29
29
  */
30
30
  export declare class PontOrganizationSwitcher extends LitElement {
31
+ private readonly _messages;
31
32
  protected createRenderRoot(): HTMLElement | DocumentFragment;
32
33
  /** Reload the page after a successful switch. */
33
34
  reloadOnSwitch: boolean;
@@ -20,6 +20,12 @@ export declare class PontProvider extends LitElement {
20
20
  private loadBrandingCss;
21
21
  private configureAuth;
22
22
  private updateLocaleAndAuth;
23
+ /**
24
+ * The signed-in widgets' own text, in the language negotiated for this
25
+ * instance (GET /auth/v1/widget-messages). Asked once per configuration,
26
+ * signed in or not: a widget mounted later reads what has already arrived.
27
+ */
28
+ private loadWidgetText;
23
29
  updated(changedProperties: PropertyValues): void;
24
30
  private handleAuthStateChange;
25
31
  /**
@@ -0,0 +1,60 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ /**
3
+ * What the widget says in its own words — text no widget's markup carries, so
4
+ * no copy overlay can reach it: a connection error, "Start again", an aria
5
+ * label.
6
+ *
7
+ * The sign-in runtime sends this text with every view, already in the view's
8
+ * language and the instance's wording (branding-svc pkg/message, the codes it
9
+ * marks Client; identity-svc puts them in each flow response's data.messages).
10
+ * The provider hands each set it receives to `setMessages`, and every place
11
+ * that used to write English reads `msg(code)` instead.
12
+ *
13
+ * ENGLISH is the fallback, and it is only ever needed for a page that has not
14
+ * heard from the server yet — a flow that fails to start because the network is
15
+ * down. Once a set has arrived it is kept, so a later failure that never reaches
16
+ * the server is still said in the language the page was already in. It mirrors
17
+ * the catalog's English; the catalog wins wherever they differ, since that is
18
+ * what arrives.
19
+ */
20
+ export type MessageCode = "connection_failed" | "too_many_attempts" | "server_error" | "generic_error" | "flow_ended" | "passkey_cancelled" | "start_again" | "continued_elsewhere_title" | "continued_elsewhere_subtitle" | "continue_here" | "show_password" | "hide_password" | "loading" | "account_settings" | "log_out" | "tab_profile" | "tab_security" | "not_added" | "field_email" | "field_phone" | "field_photo" | "field_photo_url" | "avatar_alt" | "change_photo" | "login_info" | "personal_info" | "location_section" | "links_section" | "field_username" | "field_first_name" | "field_middle_name" | "field_last_name" | "field_nickname" | "field_gender" | "field_bio" | "field_location" | "field_timezone" | "field_website" | "select_gender" | "gender_male" | "gender_female" | "gender_other" | "select_timezone" | "timezone_hint" | "username_hint" | "url_hint" | "url_scheme_invalid" | "action_save" | "action_saving" | "action_cancel" | "action_edit" | "action_submit" | "action_submitting" | "photo_update_failed" | "personal_update_failed" | "location_update_failed" | "website_update_failed" | "security_title" | "security_coming_soon" | "security_loading" | "select_organization" | "organization_switch_failed";
21
+ /**
22
+ * Record a set the server sent: a flow response's (sign-in text) or the
23
+ * widget-messages read (the signed-in widgets' text). Sets merge, since the two
24
+ * carry different codes for the same language. An empty or missing set changes
25
+ * nothing: a response that carries none (an error, a poll) says nothing about
26
+ * the language having changed.
27
+ */
28
+ export declare function setMessages(messages?: Record<string, string>, locale?: string): void;
29
+ /**
30
+ * The language the page was last served in, for formatting dates and numbers;
31
+ * undefined until the server has said, which lets Intl use the browser's.
32
+ */
33
+ export declare function currentLocale(): string | undefined;
34
+ /**
35
+ * Be told when the server's text arrives, so a widget rendered before it can
36
+ * render again. Returns the unsubscribe.
37
+ */
38
+ export declare function onMessagesChanged(listener: () => void): () => void;
39
+ /** The text for a code, in the language the page was last served in. */
40
+ export declare function msg(code: MessageCode): string;
41
+ /** Forget what the server sent. For tests. */
42
+ export declare function resetMessages(): void;
43
+ /**
44
+ * Re-renders its host whenever the server's text arrives. Add it to any element
45
+ * that renders msg(): text fetched after the element first rendered would
46
+ * otherwise never reach it.
47
+ */
48
+ export declare class MessagesController implements ReactiveController {
49
+ private readonly host;
50
+ private unsubscribe?;
51
+ constructor(host: ReactiveControllerHost);
52
+ hostConnected(): void;
53
+ hostDisconnected(): void;
54
+ }
55
+ /**
56
+ * Fetch the signed-in widgets' text for this instance, in the language
57
+ * negotiated from `locales` and the browser's, and record it. Failures are
58
+ * quiet: the widgets keep the text they have.
59
+ */
60
+ export declare function loadWidgetMessages(authBaseUrl: string, locales?: string): Promise<void>;