@dloizides/ui-layout 1.25.0 → 1.26.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/CHANGELOG.md +20 -0
- package/dist/index.d.mts +67 -1
- package/dist/index.d.ts +67 -1
- package/dist/index.js +101 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +95 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.26.0
|
|
4
|
+
|
|
5
|
+
**New `BuildInfoFooter` — a small, themable "which build am I running?" caption for the portals.**
|
|
6
|
+
|
|
7
|
+
The FE half of the "know what's deployed" work: every RN-web portal can now show a compact,
|
|
8
|
+
unobtrusive footer like `v<buildVersion>` (optionally `· api <sha7>`). `@dloizides/pwa-sw` already
|
|
9
|
+
stamps a per-build `BUILD_VERSION` into the generated service worker, but that value lives only
|
|
10
|
+
inside `service-worker.js` and is not exposed to page runtime — so the component stays dumb and
|
|
11
|
+
takes the build id as a prop (each app inlines it at build time, e.g. `EXPO_PUBLIC_BUILD_VERSION`).
|
|
12
|
+
|
|
13
|
+
- **`BuildInfoFooter`** — props `buildVersion` (required), optional `apiBaseUrl` (best-effort GET
|
|
14
|
+
`${base}/version` → `.commit`, appended as `· api <sha7>`; any failure silently shows the version
|
|
15
|
+
alone), optional `apiCommit` (skip the fetch), `fetchImpl` (test seam), plus the usual `testID` /
|
|
16
|
+
`accessibilityLabel` / `accessibilityHint` / `style`. Muted caption via the theme's
|
|
17
|
+
`textSecondary` — no raw colours.
|
|
18
|
+
- New exports: `formatBuildInfo`, `shortenCommit`, `trimTrailingSlash`, `useApiCommit`,
|
|
19
|
+
`BUILD_INFO_PREFIX`, `API_COMMIT_SEPARATOR`, `VersionResponse`.
|
|
20
|
+
- New kit i18n key `LAYOUT_I18N.buildInfoHint` (`common.buildInfoHint`) and testID
|
|
21
|
+
`LAYOUT_TEST_IDS.buildInfoFooter` (`build-info-footer`).
|
|
22
|
+
|
|
3
23
|
## 1.24.0
|
|
4
24
|
|
|
5
25
|
**The inline dropdown popover now stays inside the viewport — a floored menu can no longer spill off the right edge.**
|
package/dist/index.d.mts
CHANGED
|
@@ -706,6 +706,68 @@ declare function useCopyToClipboard(value: string, writer?: (text: string) => vo
|
|
|
706
706
|
*/
|
|
707
707
|
declare function copyText(value: string, writer?: (text: string) => void | Promise<void>): Promise<boolean>;
|
|
708
708
|
|
|
709
|
+
/**
|
|
710
|
+
* BuildInfoFooter — a small, unobtrusive caption that shows which build the app is running:
|
|
711
|
+
* `v<buildVersion>`, optionally `· api <sha7>` when an API base (or an explicit commit) is given.
|
|
712
|
+
*
|
|
713
|
+
* The FE half of "know what's deployed": each portal reads its stamped build id (an
|
|
714
|
+
* `EXPO_PUBLIC_BUILD_VERSION` inlined at build time — the same git sha CI hands `@dloizides/pwa-sw`'s
|
|
715
|
+
* `PWA_BUILD_VERSION`) and passes it in. The API commit is OPTIONAL and prop-driven, so apps with no
|
|
716
|
+
* `/version` endpoint still get a version caption.
|
|
717
|
+
*
|
|
718
|
+
* Themable, no raw colours: the muted text uses the app theme's `textSecondary` via `useUi()`.
|
|
719
|
+
*/
|
|
720
|
+
|
|
721
|
+
interface BuildInfoFooterProps {
|
|
722
|
+
/** The app's stamped build id (git sha or timestamp), inlined at build time. */
|
|
723
|
+
buildVersion: string;
|
|
724
|
+
/**
|
|
725
|
+
* Optional API base; when set (and no explicit `apiCommit` is given) the footer GETs
|
|
726
|
+
* `${apiBaseUrl}/version` best-effort and appends `· api <sha7>`. Failures are silent.
|
|
727
|
+
*/
|
|
728
|
+
apiBaseUrl?: string;
|
|
729
|
+
/** Optional explicit API commit — supply it to skip the `/version` fetch entirely. */
|
|
730
|
+
apiCommit?: string;
|
|
731
|
+
/** Injectable `fetch` for tests; defaults to the global. */
|
|
732
|
+
fetchImpl?: typeof fetch;
|
|
733
|
+
testID?: string;
|
|
734
|
+
accessibilityLabel?: string;
|
|
735
|
+
accessibilityHint?: string;
|
|
736
|
+
style?: StyleProp<ViewStyle>;
|
|
737
|
+
}
|
|
738
|
+
declare const BuildInfoFooter: ({ buildVersion, apiBaseUrl, apiCommit, fetchImpl, testID, accessibilityLabel, accessibilityHint, style, }: BuildInfoFooterProps) => React.ReactElement;
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* Pure formatting for the build-info caption — split out of the component so the label
|
|
742
|
+
* assembly (the part with the branches: no version, version only, version + api commit) is
|
|
743
|
+
* testable without a renderer.
|
|
744
|
+
*/
|
|
745
|
+
/** Leading glyph on the build version, e.g. `v1.2.0`. */
|
|
746
|
+
declare const BUILD_INFO_PREFIX = "v";
|
|
747
|
+
/** Separator between the app build and the API commit, e.g. `v1.2.0 · api abc1234`. */
|
|
748
|
+
declare const API_COMMIT_SEPARATOR = " \u00B7 api ";
|
|
749
|
+
/** First {@link SHORT_COMMIT_LENGTH} chars of a (trimmed) commit sha. A short sha is enough to
|
|
750
|
+
* identify a build; the full 40-char hash is noise in a footer caption. */
|
|
751
|
+
declare function shortenCommit(commit: string): string;
|
|
752
|
+
/** Drop a single trailing slash so `${base}/version` never doubles up (`https://x//version`). */
|
|
753
|
+
declare function trimTrailingSlash(url: string): string;
|
|
754
|
+
/**
|
|
755
|
+
* The caption text: `v<buildVersion>`, plus ` · api <sha7>` when a non-empty commit is known.
|
|
756
|
+
* Both inputs are trimmed; an empty/whitespace commit is treated as absent (no API suffix).
|
|
757
|
+
*/
|
|
758
|
+
declare function formatBuildInfo(buildVersion: string, apiCommit?: string): string;
|
|
759
|
+
|
|
760
|
+
/** Shape of the `/version` payload this hook reads. Only `commit` is consumed. */
|
|
761
|
+
interface VersionResponse {
|
|
762
|
+
commit?: string;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* @param apiBaseUrl origin/base to read `/version` from; when absent/empty the hook stays inert.
|
|
766
|
+
* @param fetchImpl injectable `fetch` (testing seam); defaults to the global when present.
|
|
767
|
+
* @returns the API commit once resolved, else `undefined`.
|
|
768
|
+
*/
|
|
769
|
+
declare function useApiCommit(apiBaseUrl?: string, fetchImpl?: typeof fetch): string | undefined;
|
|
770
|
+
|
|
709
771
|
declare function useFocusTrap(containerRef: RefObject<View | null>, enabled: boolean): void;
|
|
710
772
|
|
|
711
773
|
/** Default testIDs — match the apps' existing values so Playwright selectors keep working. */
|
|
@@ -722,6 +784,8 @@ declare const LAYOUT_TEST_IDS: {
|
|
|
722
784
|
/** Default base testID for `ConfirmDialog`; Confirm/Cancel are `confirm-dialog-{confirm,cancel}`. */
|
|
723
785
|
readonly confirmDialog: "confirm-dialog";
|
|
724
786
|
readonly accordion: "accordion";
|
|
787
|
+
/** Default testID for the `BuildInfoFooter` caption (`v<version>`). */
|
|
788
|
+
readonly buildInfoFooter: "build-info-footer";
|
|
725
789
|
};
|
|
726
790
|
/** Route the UpgradePrompt CTA navigates to by default (the apps' billing settings path). */
|
|
727
791
|
declare const DEFAULT_BILLING_ROUTE = "/settings/billing";
|
|
@@ -791,6 +855,8 @@ declare const LAYOUT_I18N: {
|
|
|
791
855
|
readonly copyFailed: "common.copyFailed";
|
|
792
856
|
/** `CopyableId`: hint on the value itself, explaining it is shortened for display. */
|
|
793
857
|
readonly copyableIdHint: "common.copyableIdHint";
|
|
858
|
+
/** `BuildInfoFooter`: accessible hint on the version caption (the visible `v<version>` is the label). */
|
|
859
|
+
readonly buildInfoHint: "common.buildInfoHint";
|
|
794
860
|
};
|
|
795
861
|
|
|
796
|
-
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, COPY_FEEDBACK_MS, ConfirmDialog, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, Heading, type HeadingLevel, type HeadingProps, LAYOUT_I18N, LAYOUT_TEST_IDS, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, copyText, formatUrlForDisplay, truncateMiddle, useCopyToClipboard, useFocusTrap };
|
|
862
|
+
export { API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, BUILD_INFO_PREFIX, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ConfirmDialog, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, Heading, type HeadingLevel, type HeadingProps, LAYOUT_I18N, LAYOUT_TEST_IDS, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, copyText, formatBuildInfo, formatUrlForDisplay, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap };
|
package/dist/index.d.ts
CHANGED
|
@@ -706,6 +706,68 @@ declare function useCopyToClipboard(value: string, writer?: (text: string) => vo
|
|
|
706
706
|
*/
|
|
707
707
|
declare function copyText(value: string, writer?: (text: string) => void | Promise<void>): Promise<boolean>;
|
|
708
708
|
|
|
709
|
+
/**
|
|
710
|
+
* BuildInfoFooter — a small, unobtrusive caption that shows which build the app is running:
|
|
711
|
+
* `v<buildVersion>`, optionally `· api <sha7>` when an API base (or an explicit commit) is given.
|
|
712
|
+
*
|
|
713
|
+
* The FE half of "know what's deployed": each portal reads its stamped build id (an
|
|
714
|
+
* `EXPO_PUBLIC_BUILD_VERSION` inlined at build time — the same git sha CI hands `@dloizides/pwa-sw`'s
|
|
715
|
+
* `PWA_BUILD_VERSION`) and passes it in. The API commit is OPTIONAL and prop-driven, so apps with no
|
|
716
|
+
* `/version` endpoint still get a version caption.
|
|
717
|
+
*
|
|
718
|
+
* Themable, no raw colours: the muted text uses the app theme's `textSecondary` via `useUi()`.
|
|
719
|
+
*/
|
|
720
|
+
|
|
721
|
+
interface BuildInfoFooterProps {
|
|
722
|
+
/** The app's stamped build id (git sha or timestamp), inlined at build time. */
|
|
723
|
+
buildVersion: string;
|
|
724
|
+
/**
|
|
725
|
+
* Optional API base; when set (and no explicit `apiCommit` is given) the footer GETs
|
|
726
|
+
* `${apiBaseUrl}/version` best-effort and appends `· api <sha7>`. Failures are silent.
|
|
727
|
+
*/
|
|
728
|
+
apiBaseUrl?: string;
|
|
729
|
+
/** Optional explicit API commit — supply it to skip the `/version` fetch entirely. */
|
|
730
|
+
apiCommit?: string;
|
|
731
|
+
/** Injectable `fetch` for tests; defaults to the global. */
|
|
732
|
+
fetchImpl?: typeof fetch;
|
|
733
|
+
testID?: string;
|
|
734
|
+
accessibilityLabel?: string;
|
|
735
|
+
accessibilityHint?: string;
|
|
736
|
+
style?: StyleProp<ViewStyle>;
|
|
737
|
+
}
|
|
738
|
+
declare const BuildInfoFooter: ({ buildVersion, apiBaseUrl, apiCommit, fetchImpl, testID, accessibilityLabel, accessibilityHint, style, }: BuildInfoFooterProps) => React.ReactElement;
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* Pure formatting for the build-info caption — split out of the component so the label
|
|
742
|
+
* assembly (the part with the branches: no version, version only, version + api commit) is
|
|
743
|
+
* testable without a renderer.
|
|
744
|
+
*/
|
|
745
|
+
/** Leading glyph on the build version, e.g. `v1.2.0`. */
|
|
746
|
+
declare const BUILD_INFO_PREFIX = "v";
|
|
747
|
+
/** Separator between the app build and the API commit, e.g. `v1.2.0 · api abc1234`. */
|
|
748
|
+
declare const API_COMMIT_SEPARATOR = " \u00B7 api ";
|
|
749
|
+
/** First {@link SHORT_COMMIT_LENGTH} chars of a (trimmed) commit sha. A short sha is enough to
|
|
750
|
+
* identify a build; the full 40-char hash is noise in a footer caption. */
|
|
751
|
+
declare function shortenCommit(commit: string): string;
|
|
752
|
+
/** Drop a single trailing slash so `${base}/version` never doubles up (`https://x//version`). */
|
|
753
|
+
declare function trimTrailingSlash(url: string): string;
|
|
754
|
+
/**
|
|
755
|
+
* The caption text: `v<buildVersion>`, plus ` · api <sha7>` when a non-empty commit is known.
|
|
756
|
+
* Both inputs are trimmed; an empty/whitespace commit is treated as absent (no API suffix).
|
|
757
|
+
*/
|
|
758
|
+
declare function formatBuildInfo(buildVersion: string, apiCommit?: string): string;
|
|
759
|
+
|
|
760
|
+
/** Shape of the `/version` payload this hook reads. Only `commit` is consumed. */
|
|
761
|
+
interface VersionResponse {
|
|
762
|
+
commit?: string;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* @param apiBaseUrl origin/base to read `/version` from; when absent/empty the hook stays inert.
|
|
766
|
+
* @param fetchImpl injectable `fetch` (testing seam); defaults to the global when present.
|
|
767
|
+
* @returns the API commit once resolved, else `undefined`.
|
|
768
|
+
*/
|
|
769
|
+
declare function useApiCommit(apiBaseUrl?: string, fetchImpl?: typeof fetch): string | undefined;
|
|
770
|
+
|
|
709
771
|
declare function useFocusTrap(containerRef: RefObject<View | null>, enabled: boolean): void;
|
|
710
772
|
|
|
711
773
|
/** Default testIDs — match the apps' existing values so Playwright selectors keep working. */
|
|
@@ -722,6 +784,8 @@ declare const LAYOUT_TEST_IDS: {
|
|
|
722
784
|
/** Default base testID for `ConfirmDialog`; Confirm/Cancel are `confirm-dialog-{confirm,cancel}`. */
|
|
723
785
|
readonly confirmDialog: "confirm-dialog";
|
|
724
786
|
readonly accordion: "accordion";
|
|
787
|
+
/** Default testID for the `BuildInfoFooter` caption (`v<version>`). */
|
|
788
|
+
readonly buildInfoFooter: "build-info-footer";
|
|
725
789
|
};
|
|
726
790
|
/** Route the UpgradePrompt CTA navigates to by default (the apps' billing settings path). */
|
|
727
791
|
declare const DEFAULT_BILLING_ROUTE = "/settings/billing";
|
|
@@ -791,6 +855,8 @@ declare const LAYOUT_I18N: {
|
|
|
791
855
|
readonly copyFailed: "common.copyFailed";
|
|
792
856
|
/** `CopyableId`: hint on the value itself, explaining it is shortened for display. */
|
|
793
857
|
readonly copyableIdHint: "common.copyableIdHint";
|
|
858
|
+
/** `BuildInfoFooter`: accessible hint on the version caption (the visible `v<version>` is the label). */
|
|
859
|
+
readonly buildInfoHint: "common.buildInfoHint";
|
|
794
860
|
};
|
|
795
861
|
|
|
796
|
-
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, COPY_FEEDBACK_MS, ConfirmDialog, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, Heading, type HeadingLevel, type HeadingProps, LAYOUT_I18N, LAYOUT_TEST_IDS, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, copyText, formatUrlForDisplay, truncateMiddle, useCopyToClipboard, useFocusTrap };
|
|
862
|
+
export { API_COMMIT_SEPARATOR, Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, BUILD_INFO_PREFIX, BuildInfoFooter, type BuildInfoFooterProps, COPY_FEEDBACK_MS, ConfirmDialog, type ConfirmDialogProps, CopyStatus, type CopyToClipboard, CopyableId, type CopyableIdProps, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, ELLIPSIS, Heading, type HeadingLevel, type HeadingProps, LAYOUT_I18N, LAYOUT_TEST_IDS, Modal, ModalDropdown, type ModalDropdownProps, type ModalProps, ModalShell, type ModalShellProps, type ModalSize, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, type TabDescriptor, Tabs, TabsCollapsedTrigger, type TabsProps, TruncatedText, type TruncatedTextProps, UpgradePrompt, type UpgradePromptProps, type VersionResponse, copyText, formatBuildInfo, formatUrlForDisplay, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap };
|
package/dist/index.js
CHANGED
|
@@ -45,7 +45,9 @@ var LAYOUT_TEST_IDS = {
|
|
|
45
45
|
modal: "modal",
|
|
46
46
|
/** Default base testID for `ConfirmDialog`; Confirm/Cancel are `confirm-dialog-{confirm,cancel}`. */
|
|
47
47
|
confirmDialog: "confirm-dialog",
|
|
48
|
-
accordion: "accordion"
|
|
48
|
+
accordion: "accordion",
|
|
49
|
+
/** Default testID for the `BuildInfoFooter` caption (`v<version>`). */
|
|
50
|
+
buildInfoFooter: "build-info-footer"
|
|
49
51
|
};
|
|
50
52
|
var DEFAULT_BILLING_ROUTE = "/settings/billing";
|
|
51
53
|
var LAYOUT_I18N = {
|
|
@@ -99,7 +101,9 @@ var LAYOUT_I18N = {
|
|
|
99
101
|
*/
|
|
100
102
|
copyFailed: "common.copyFailed",
|
|
101
103
|
/** `CopyableId`: hint on the value itself, explaining it is shortened for display. */
|
|
102
|
-
copyableIdHint: "common.copyableIdHint"
|
|
104
|
+
copyableIdHint: "common.copyableIdHint",
|
|
105
|
+
/** `BuildInfoFooter`: accessible hint on the version caption (the visible `v<version>` is the label). */
|
|
106
|
+
buildInfoHint: "common.buildInfoHint"
|
|
103
107
|
};
|
|
104
108
|
var styles2 = reactNative.StyleSheet.create({
|
|
105
109
|
heading: {
|
|
@@ -1967,8 +1971,99 @@ var CopyableId = ({
|
|
|
1967
1971
|
] });
|
|
1968
1972
|
};
|
|
1969
1973
|
|
|
1974
|
+
// src/BuildInfoFooter/formatBuildInfo.ts
|
|
1975
|
+
var BUILD_INFO_PREFIX = "v";
|
|
1976
|
+
var API_COMMIT_SEPARATOR = " \xB7 api ";
|
|
1977
|
+
var SHORT_COMMIT_LENGTH = 7;
|
|
1978
|
+
function shortenCommit(commit) {
|
|
1979
|
+
return commit.trim().slice(0, SHORT_COMMIT_LENGTH);
|
|
1980
|
+
}
|
|
1981
|
+
function trimTrailingSlash(url) {
|
|
1982
|
+
return url.endsWith("/") ? url.slice(0, -1) : url;
|
|
1983
|
+
}
|
|
1984
|
+
function formatBuildInfo(buildVersion, apiCommit) {
|
|
1985
|
+
const base = `${BUILD_INFO_PREFIX}${buildVersion.trim()}`;
|
|
1986
|
+
const commit = apiCommit?.trim();
|
|
1987
|
+
if (commit === void 0 || commit === "") return base;
|
|
1988
|
+
return `${base}${API_COMMIT_SEPARATOR}${shortenCommit(commit)}`;
|
|
1989
|
+
}
|
|
1990
|
+
function useApiCommit(apiBaseUrl, fetchImpl) {
|
|
1991
|
+
const [commit, setCommit] = React10.useState(void 0);
|
|
1992
|
+
const mountedRef = React10.useRef(true);
|
|
1993
|
+
React10.useEffect(() => {
|
|
1994
|
+
mountedRef.current = true;
|
|
1995
|
+
return () => {
|
|
1996
|
+
mountedRef.current = false;
|
|
1997
|
+
};
|
|
1998
|
+
}, []);
|
|
1999
|
+
React10.useEffect(() => {
|
|
2000
|
+
if (apiBaseUrl === void 0 || apiBaseUrl === "") return;
|
|
2001
|
+
const doFetch = fetchImpl ?? (typeof fetch !== "undefined" ? fetch : void 0);
|
|
2002
|
+
if (doFetch === void 0) return;
|
|
2003
|
+
void (async () => {
|
|
2004
|
+
try {
|
|
2005
|
+
const res = await doFetch(`${trimTrailingSlash(apiBaseUrl)}/version`);
|
|
2006
|
+
if (!res.ok) return;
|
|
2007
|
+
const body = await res.json();
|
|
2008
|
+
const value = body.commit;
|
|
2009
|
+
if (mountedRef.current && value !== void 0 && value !== "") setCommit(value);
|
|
2010
|
+
} catch {
|
|
2011
|
+
return;
|
|
2012
|
+
}
|
|
2013
|
+
})();
|
|
2014
|
+
}, [apiBaseUrl, fetchImpl]);
|
|
2015
|
+
return commit;
|
|
2016
|
+
}
|
|
2017
|
+
var FOOTER_PADDING_V = 6;
|
|
2018
|
+
var FOOTER_PADDING_H = 12;
|
|
2019
|
+
var FOOTER_FONT_SIZE = 11;
|
|
2020
|
+
var FOOTER_OPACITY = 0.75;
|
|
2021
|
+
var styles17 = reactNative.StyleSheet.create({
|
|
2022
|
+
footer: {
|
|
2023
|
+
paddingVertical: FOOTER_PADDING_V,
|
|
2024
|
+
paddingHorizontal: FOOTER_PADDING_H,
|
|
2025
|
+
alignItems: "center"
|
|
2026
|
+
},
|
|
2027
|
+
text: {
|
|
2028
|
+
fontSize: FOOTER_FONT_SIZE,
|
|
2029
|
+
opacity: FOOTER_OPACITY
|
|
2030
|
+
}
|
|
2031
|
+
});
|
|
2032
|
+
var BuildInfoFooter = ({
|
|
2033
|
+
buildVersion,
|
|
2034
|
+
apiBaseUrl,
|
|
2035
|
+
apiCommit,
|
|
2036
|
+
fetchImpl,
|
|
2037
|
+
testID = LAYOUT_TEST_IDS.buildInfoFooter,
|
|
2038
|
+
accessibilityLabel,
|
|
2039
|
+
accessibilityHint,
|
|
2040
|
+
style
|
|
2041
|
+
}) => {
|
|
2042
|
+
const { theme, t } = uiFeedback.useUi();
|
|
2043
|
+
const fetchedCommit = useApiCommit(apiCommit === void 0 ? apiBaseUrl : void 0, fetchImpl);
|
|
2044
|
+
const commit = apiCommit ?? fetchedCommit;
|
|
2045
|
+
const label = formatBuildInfo(buildVersion, commit);
|
|
2046
|
+
const textStyle = React10.useMemo(
|
|
2047
|
+
() => [styles17.text, { color: theme.colors.textSecondary }],
|
|
2048
|
+
[theme.colors.textSecondary]
|
|
2049
|
+
);
|
|
2050
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2051
|
+
reactNative.View,
|
|
2052
|
+
{
|
|
2053
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
2054
|
+
accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.buildInfoHint),
|
|
2055
|
+
style: [styles17.footer, style],
|
|
2056
|
+
testID,
|
|
2057
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children: label })
|
|
2058
|
+
}
|
|
2059
|
+
);
|
|
2060
|
+
};
|
|
2061
|
+
|
|
2062
|
+
exports.API_COMMIT_SEPARATOR = API_COMMIT_SEPARATOR;
|
|
1970
2063
|
exports.Accordion = Accordion;
|
|
1971
2064
|
exports.AccordionItem = AccordionItem;
|
|
2065
|
+
exports.BUILD_INFO_PREFIX = BUILD_INFO_PREFIX;
|
|
2066
|
+
exports.BuildInfoFooter = BuildInfoFooter;
|
|
1972
2067
|
exports.COPY_FEEDBACK_MS = COPY_FEEDBACK_MS;
|
|
1973
2068
|
exports.ConfirmDialog = ConfirmDialog;
|
|
1974
2069
|
exports.CopyStatus = CopyStatus;
|
|
@@ -1990,8 +2085,12 @@ exports.TabsCollapsedTrigger = TabsCollapsedTrigger;
|
|
|
1990
2085
|
exports.TruncatedText = TruncatedText;
|
|
1991
2086
|
exports.UpgradePrompt = UpgradePrompt;
|
|
1992
2087
|
exports.copyText = copyText;
|
|
2088
|
+
exports.formatBuildInfo = formatBuildInfo;
|
|
1993
2089
|
exports.formatUrlForDisplay = formatUrlForDisplay;
|
|
2090
|
+
exports.shortenCommit = shortenCommit;
|
|
2091
|
+
exports.trimTrailingSlash = trimTrailingSlash;
|
|
1994
2092
|
exports.truncateMiddle = truncateMiddle;
|
|
2093
|
+
exports.useApiCommit = useApiCommit;
|
|
1995
2094
|
exports.useCopyToClipboard = useCopyToClipboard;
|
|
1996
2095
|
exports.useFocusTrap = useFocusTrap;
|
|
1997
2096
|
//# sourceMappingURL=index.js.map
|