@pontive/pontkit-core 1.23.0 → 1.24.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.
@@ -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
  /**
@@ -1,3 +1,4 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
1
2
  /**
2
3
  * What the widget says in its own words — text no widget's markup carries, so
3
4
  * no copy overlay can reach it: a connection error, "Start again", an aria
@@ -16,14 +17,44 @@
16
17
  * the catalog's English; the catalog wins wherever they differ, since that is
17
18
  * what arrives.
18
19
  */
19
- 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";
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";
20
21
  /**
21
- * Record the set a flow response carried. An empty or missing set keeps the
22
- * last one: a response that carries none (an error, a poll) says nothing about
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
23
26
  * the language having changed.
24
27
  */
25
- export declare function setMessages(messages?: Record<string, string>): void;
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;
26
39
  /** The text for a code, in the language the page was last served in. */
27
40
  export declare function msg(code: MessageCode): string;
28
41
  /** Forget what the server sent. For tests. */
29
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>;