@the-seeker/changes-react-native 0.0.0-stage → 0.1.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.
Files changed (70) hide show
  1. package/README.md +136 -2
  2. package/dist/core/cache.d.ts +14 -0
  3. package/dist/core/cache.js +34 -0
  4. package/dist/core/client.d.ts +163 -0
  5. package/dist/core/client.js +98 -0
  6. package/dist/core/decide.d.ts +16 -0
  7. package/dist/core/decide.js +57 -0
  8. package/dist/core/rating.d.ts +7 -0
  9. package/dist/core/rating.js +18 -0
  10. package/dist/core/storage.d.ts +20 -0
  11. package/dist/core/storage.js +73 -0
  12. package/dist/core/types.d.ts +332 -0
  13. package/dist/core/types.js +126 -0
  14. package/dist/core/versions.d.ts +2 -0
  15. package/dist/core/versions.js +20 -0
  16. package/dist/index.d.ts +22 -0
  17. package/dist/index.js +44 -0
  18. package/dist/native/Blocks.d.ts +7 -0
  19. package/dist/native/Blocks.js +45 -0
  20. package/dist/native/ChangelogButton.d.ts +6 -0
  21. package/dist/native/ChangelogButton.js +16 -0
  22. package/dist/native/ChangelogScreen.d.ts +6 -0
  23. package/dist/native/ChangelogScreen.js +52 -0
  24. package/dist/native/CommentComposer.d.ts +11 -0
  25. package/dist/native/CommentComposer.js +40 -0
  26. package/dist/native/CommentItem.d.ts +15 -0
  27. package/dist/native/CommentItem.js +35 -0
  28. package/dist/native/CommentsThread.d.ts +9 -0
  29. package/dist/native/CommentsThread.js +24 -0
  30. package/dist/native/Provider.d.ts +11 -0
  31. package/dist/native/Provider.js +67 -0
  32. package/dist/native/ReleaseView.d.ts +11 -0
  33. package/dist/native/ReleaseView.js +37 -0
  34. package/dist/native/WhatsNewSheet.d.ts +6 -0
  35. package/dist/native/WhatsNewSheet.js +52 -0
  36. package/dist/native/community.d.ts +18 -0
  37. package/dist/native/community.js +39 -0
  38. package/dist/native/context.d.ts +125 -0
  39. package/dist/native/context.js +26 -0
  40. package/dist/native/default-texts.d.ts +89 -0
  41. package/dist/native/default-texts.js +92 -0
  42. package/dist/native/format.d.ts +5 -0
  43. package/dist/native/format.js +34 -0
  44. package/dist/native/messages.d.ts +44 -0
  45. package/dist/native/messages.js +83 -0
  46. package/dist/native/primitives.d.ts +39 -0
  47. package/dist/native/primitives.js +78 -0
  48. package/dist/native/rating-plan.d.ts +31 -0
  49. package/dist/native/rating-plan.js +101 -0
  50. package/dist/native/resolve.d.ts +21 -0
  51. package/dist/native/resolve.js +73 -0
  52. package/dist/native/session.d.ts +48 -0
  53. package/dist/native/session.js +83 -0
  54. package/dist/native/styles-community.d.ts +1447 -0
  55. package/dist/native/styles-community.js +117 -0
  56. package/dist/native/styles-scale.d.ts +66 -0
  57. package/dist/native/styles-scale.js +22 -0
  58. package/dist/native/styles.d.ts +2584 -0
  59. package/dist/native/styles.js +161 -0
  60. package/dist/native/tokens.d.ts +51 -0
  61. package/dist/native/tokens.js +90 -0
  62. package/dist/native/use-actions.d.ts +55 -0
  63. package/dist/native/use-actions.js +59 -0
  64. package/dist/native/use-comments.d.ts +40 -0
  65. package/dist/native/use-comments.js +83 -0
  66. package/dist/native/use-controller.d.ts +103 -0
  67. package/dist/native/use-controller.js +147 -0
  68. package/dist/native/use-session.d.ts +268 -0
  69. package/dist/native/use-session.js +86 -0
  70. package/package.json +52 -4
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChangelogScreen = ChangelogScreen;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_native_1 = require("react-native");
7
+ const styles_scale_1 = require("./styles-scale");
8
+ const context_1 = require("./context");
9
+ const primitives_1 = require("./primitives");
10
+ const CommentsThread_1 = require("./CommentsThread");
11
+ const ReleaseView_1 = require("./ReleaseView");
12
+ const styles_1 = require("./styles");
13
+ const tokens_1 = require("./tokens");
14
+ const messages_1 = require("./messages");
15
+ function TopBar({ ui, onClose }) {
16
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: ui.styles.screenHeader, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: ui.styles.screenTitle, accessibilityRole: "header", numberOfLines: 1, children: ui.api.t("title") }), (0, jsx_runtime_1.jsx)(primitives_1.Button, { ui: ui, label: ui.api.t("close"), variant: "ghost", tone: "link", onPress: onClose })] }));
17
+ }
18
+ function Separator() {
19
+ const ui = (0, context_1.useChangesUi)();
20
+ return ui === null ? null : (0, jsx_runtime_1.jsx)(react_native_1.View, { style: ui.styles.separator });
21
+ }
22
+ function ReleaseList({ ui, withTitle, onOpen, }) {
23
+ const { api, styles } = ui;
24
+ return ((0, jsx_runtime_1.jsx)(react_native_1.FlatList, { data: api.releases, keyExtractor: (release) => release.id, contentContainerStyle: styles.listContent, ItemSeparatorComponent: Separator, ListHeaderComponent: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.listHeader, children: [withTitle ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.display, accessibilityRole: "header", children: api.t("title") })) : null, (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.subtitle, ...styles_scale_1.KOREAN_WRAP, children: api.t("subtitle") }), api.stale ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: [styles.banner, styles.bannerInHeader], accessibilityLiveRegion: "polite", children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.bannerText, children: api.t("offline") }) })) : null] }), ListEmptyComponent: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.status, children: api.t("empty") }), renderItem: ({ item }) => ((0, jsx_runtime_1.jsx)(ReleaseView_1.ReleaseView, { ui: ui, release: item, headingLevel: "card", onOpenComments: () => onOpen(item.id) })) }));
25
+ }
26
+ /** Loading and failure states render before the config (and its accent) is known. */
27
+ function Placeholder({ onClose }) {
28
+ const api = (0, context_1.useChanges)();
29
+ const theme = (0, styles_1.useChangesTheme)(tokens_1.DEFAULT_ACCENT);
30
+ if (theme === null)
31
+ return null;
32
+ const { styles, tokens } = theme;
33
+ const copy = (0, messages_1.uiCopy)(api.locale);
34
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.screen, children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.centered, children: [api.status === "loading" ? ((0, jsx_runtime_1.jsx)(react_native_1.ActivityIndicator, { color: tokens.mutedText })) : ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.status, children: api.t(api.status === "disabled" ? "empty" : "loadError") })), api.status === "error" ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.buttonLabel, styles.linkLabel], accessibilityRole: "button", onPress: api.reload, children: copy.retry })) : null, onClose === undefined ? null : ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.buttonLabel, styles.linkLabel], accessibilityRole: "button", onPress: onClose, children: api.t("close") }))] }) }));
35
+ }
36
+ /** The full changelog: release cards with votes and comments; a release opens its thread. */
37
+ function ChangelogScreen({ onClose }) {
38
+ const ui = (0, context_1.useChangesUi)();
39
+ const [detail, setDetail] = (0, react_1.useState)(null);
40
+ const seen = (0, react_1.useRef)(false);
41
+ const markSeen = ui?.api.markChangelogSeen;
42
+ (0, react_1.useEffect)(() => {
43
+ if (seen.current || markSeen === undefined)
44
+ return;
45
+ seen.current = true;
46
+ markSeen();
47
+ }, [markSeen]);
48
+ if (ui === null)
49
+ return (0, jsx_runtime_1.jsx)(Placeholder, { ...(onClose === undefined ? {} : { onClose }) });
50
+ const release = detail === null ? undefined : ui.api.releases.find((item) => item.id === detail);
51
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: ui.styles.screen, testID: "theseeker-changes-changelog", children: [onClose === undefined ? null : (0, jsx_runtime_1.jsx)(TopBar, { ui: ui, onClose: onClose }), release === undefined ? ((0, jsx_runtime_1.jsx)(ReleaseList, { ui: ui, withTitle: onClose === undefined, onOpen: setDetail })) : ((0, jsx_runtime_1.jsx)(react_native_1.ScrollView, { keyboardShouldPersistTaps: "handled", contentContainerStyle: ui.styles.listContent, children: (0, jsx_runtime_1.jsx)(CommentsThread_1.CommentsThread, { ui: ui, release: release, onBack: () => setDetail(null) }) }))] }));
52
+ }
@@ -0,0 +1,11 @@
1
+ import type { ErrorCode } from "../core/types";
2
+ import type { ChangesUi } from "./context";
3
+ import type { ReplyTarget } from "./use-comments";
4
+ export type CommentComposerProps = Readonly<{
5
+ ui: ChangesUi;
6
+ replyTo: ReplyTarget | null;
7
+ onCancelReply: () => void;
8
+ onSubmit: (body: string, guidelinesAccepted: boolean) => Promise<ErrorCode | null>;
9
+ }>;
10
+ /** Visible label, guidelines gate before the first comment, errors under the field that failed. */
11
+ export declare function CommentComposer({ ui, replyTo, onCancelReply, onSubmit }: CommentComposerProps): import("react").JSX.Element;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommentComposer = CommentComposer;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_native_1 = require("react-native");
7
+ const styles_scale_1 = require("./styles-scale");
8
+ const messages_1 = require("./messages");
9
+ const primitives_1 = require("./primitives");
10
+ const MAX_BODY = 2000;
11
+ /** Visible label, guidelines gate before the first comment, errors under the field that failed. */
12
+ function CommentComposer({ ui, replyTo, onCancelReply, onSubmit }) {
13
+ const { api, config, styles, tokens, copy } = ui;
14
+ const [body, setBody] = (0, react_1.useState)("");
15
+ const [focused, setFocused] = (0, react_1.useState)(false);
16
+ const [busy, setBusy] = (0, react_1.useState)(false);
17
+ const [failure, setFailure] = (0, react_1.useState)(null);
18
+ const [accepted, setAccepted] = (0, react_1.useState)(api.guidelinesAccepted);
19
+ const gate = config.community.requireGuidelinesAck && !api.guidelinesAccepted;
20
+ const label = replyTo === null ? api.t("writeComment") : copy.replyTo(replyTo.name);
21
+ async function submit() {
22
+ if (busy || body.trim() === "")
23
+ return;
24
+ setBusy(true);
25
+ const code = await onSubmit(body.trim(), accepted || api.guidelinesAccepted);
26
+ setBusy(false);
27
+ const message = code === null ? null : (0, messages_1.errorMessage)(code, api.locale);
28
+ setFailure(message);
29
+ if (message !== null)
30
+ return (0, primitives_1.announce)(message);
31
+ if (gate)
32
+ api.acceptGuidelines();
33
+ setBody("");
34
+ }
35
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.composer, children: [gate ? ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.guidelines, testID: "theseeker-changes-guidelines-card", children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.guidelinesTitle, accessibilityRole: "header", children: api.t("guidelinesTitle") }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.guidelinesBody, ...styles_scale_1.KOREAN_WRAP, children: api.t("guidelinesBody") }), (0, jsx_runtime_1.jsx)(primitives_1.Checkbox, { ui: ui, label: api.t("guidelinesAccept"), checked: accepted, onChange: setAccepted })] })) : null, (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.replyBar, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.fieldLabel, children: label }), replyTo === null ? null : (0, jsx_runtime_1.jsx)(primitives_1.Button, { ui: ui, label: copy.cancelReply, variant: "ghost", onPress: onCancelReply })] }), (0, jsx_runtime_1.jsx)(react_native_1.TextInput, { testID: "theseeker-changes-comment-input", accessibilityLabel: label, value: body, onChangeText: (value) => {
36
+ setBody(value);
37
+ if (failure !== null)
38
+ setFailure(null);
39
+ }, placeholder: api.t("commentPlaceholder"), placeholderTextColor: tokens.mutedText, selectionColor: tokens.accent, keyboardAppearance: tokens.scheme, multiline: true, maxLength: MAX_BODY, onFocus: () => setFocused(true), onBlur: () => setFocused(false), style: [styles.input, focused && styles.inputFocused] }), (0, jsx_runtime_1.jsx)(primitives_1.Status, { ui: ui, text: failure, tone: "error" }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.composerFoot, children: (0, jsx_runtime_1.jsx)(primitives_1.Button, { ui: ui, label: api.t("commentSubmit"), variant: "primary", testID: "theseeker-changes-comment-submit", disabled: body.trim() === "" || (gate && !accepted), busy: busy, onPress: () => void submit() }) })] }));
40
+ }
@@ -0,0 +1,15 @@
1
+ import type { ReportInput } from "../core/client";
2
+ import type { CommentReply, ErrorCode } from "../core/types";
3
+ import type { ChangesUi, VoteValue } from "./context";
4
+ export type CommentItemProps = Readonly<{
5
+ ui: ChangesUi;
6
+ comment: CommentReply;
7
+ /** Render-stable clock for relative times, captured when the thread opened. */
8
+ now: number;
9
+ reported: boolean;
10
+ onVote: (value: VoteValue) => Promise<ErrorCode | null>;
11
+ onReport: (reason: ReportInput["reason"]) => Promise<ErrorCode | null>;
12
+ /** Top-level comments only: one reply level. */
13
+ onReply?: () => void;
14
+ }>;
15
+ export declare function CommentItem({ ui, comment, now, reported, onVote, onReport, onReply }: CommentItemProps): import("react").JSX.Element;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommentItem = CommentItem;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_native_1 = require("react-native");
7
+ const styles_scale_1 = require("./styles-scale");
8
+ const format_1 = require("./format");
9
+ const messages_1 = require("./messages");
10
+ const primitives_1 = require("./primitives");
11
+ const REASONS = ["spam", "abuse", "off_topic", "other"];
12
+ function Action({ ui, label, accessibilityLabel, selected, onPress, children }) {
13
+ const { styles } = ui;
14
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { accessibilityRole: "button", accessibilityLabel: accessibilityLabel ?? label, ...(selected === undefined ? {} : { accessibilityState: { selected } }), onPress: onPress, style: ({ pressed }) => [
15
+ styles.action,
16
+ selected === true && styles.actionSelected,
17
+ pressed && styles.actionPressed,
18
+ ], children: [children, label === "" ? null : (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.actionLabel, children: label })] }));
19
+ }
20
+ function CommentItem({ ui, comment, now, reported, onVote, onReport, onReply }) {
21
+ const { api, styles, tokens, copy } = ui;
22
+ const [menuOpen, setMenuOpen] = (0, react_1.useState)(false);
23
+ const [failure, setFailure] = (0, react_1.useState)(null);
24
+ async function run(action) {
25
+ const code = await action;
26
+ const message = code === null ? null : (0, messages_1.errorMessage)(code, api.locale);
27
+ setFailure(message);
28
+ if (message !== null)
29
+ (0, primitives_1.announce)(message);
30
+ }
31
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.comment, testID: `theseeker-changes-comment-${comment.id}`, children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.commentHead, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.author, children: comment.authorName }), comment.isDeveloper ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.badge, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.badgeLabel, children: api.t("developerBadge") }) })) : null, (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.meta, children: (0, format_1.formatAgo)(comment.createdAt, now, api.locale) })] }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.commentBody, selectable: true, ...styles_scale_1.KOREAN_WRAP, children: comment.body }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.commentActions, children: [(0, jsx_runtime_1.jsx)(Action, { ui: ui, label: String(comment.upvotes), accessibilityLabel: `${api.t("upvote")}, ${copy.upvoteLabel(comment.upvotes)}`, selected: comment.myVote === 1, onPress: () => void run(onVote(comment.myVote === 1 ? 0 : 1)), children: (0, jsx_runtime_1.jsx)(primitives_1.ArrowGlyph, { direction: "up", size: 14, color: comment.myVote === 1 ? tokens.accentInk : tokens.mutedText }) }), (0, jsx_runtime_1.jsx)(Action, { ui: ui, label: "", accessibilityLabel: api.t("downvote"), selected: comment.myVote === -1, onPress: () => void run(onVote(comment.myVote === -1 ? 0 : -1)), children: (0, jsx_runtime_1.jsx)(primitives_1.ArrowGlyph, { direction: "down", size: 14, color: tokens.mutedText }) }), onReply === undefined ? null : (0, jsx_runtime_1.jsx)(Action, { ui: ui, label: api.t("reply"), onPress: onReply }), reported ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.actionLabel, styles.action], children: api.t("reported") })) : ((0, jsx_runtime_1.jsx)(Action, { ui: ui, label: api.t("report"), onPress: () => setMenuOpen((open) => !open) }))] }), menuOpen && !reported ? ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.reportMenu, accessibilityRole: "menu", accessibilityLabel: copy.reportTitle, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.meta, children: copy.reportTitle }), REASONS.map((reason) => ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { accessibilityRole: "menuitem", onPress: () => {
32
+ setMenuOpen(false);
33
+ void run(onReport(reason));
34
+ }, style: ({ pressed }) => [styles.reportOption, pressed && styles.reportOptionPressed], children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.reportOptionLabel, children: api.t(`reportReasons_${reason}`) }) }, reason))), (0, jsx_runtime_1.jsx)(react_native_1.Pressable, { accessibilityRole: "button", onPress: () => setMenuOpen(false), style: ({ pressed }) => [styles.reportOption, pressed && styles.reportOptionPressed], children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.actionLabel, children: copy.cancel }) })] })) : null, (0, jsx_runtime_1.jsx)(primitives_1.Status, { ui: ui, text: failure, tone: "error" })] }));
35
+ }
@@ -0,0 +1,9 @@
1
+ import type { Release } from "../core/types";
2
+ import type { ChangesUi } from "./context";
3
+ export type CommentsThreadProps = Readonly<{
4
+ ui: ChangesUi;
5
+ release: Release;
6
+ onBack?: () => void;
7
+ }>;
8
+ /** Newest-first thread with one reply level, Developer badges, votes, reports and the composer. */
9
+ export declare function CommentsThread({ ui, release, onBack }: CommentsThreadProps): import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommentsThread = CommentsThread;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_native_1 = require("react-native");
7
+ const CommentComposer_1 = require("./CommentComposer");
8
+ const CommentItem_1 = require("./CommentItem");
9
+ const primitives_1 = require("./primitives");
10
+ const use_comments_1 = require("./use-comments");
11
+ /** Newest-first thread with one reply level, Developer badges, votes, reports and the composer. */
12
+ function CommentsThread({ ui, release, onBack }) {
13
+ const { api, config, styles, tokens, copy } = ui;
14
+ const thread = (0, use_comments_1.useCommentsThread)(api, release.id);
15
+ const [replyTo, setReplyTo] = (0, react_1.useState)(null);
16
+ const [now] = (0, react_1.useState)(() => Date.now());
17
+ const commentsOpen = config.community.commentsEnabled;
18
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { testID: "theseeker-changes-thread", children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.threadHeader, children: [onBack === undefined ? null : ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.backSlot, children: (0, jsx_runtime_1.jsx)(primitives_1.Button, { ui: ui, label: copy.back, variant: "ghost", tone: "link", onPress: onBack }) })), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.threadTitle, accessibilityRole: "header", numberOfLines: 2, children: `${api.t("comments")} ${thread.total}` })] }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.meta, numberOfLines: 1, children: release.title }), commentsOpen ? ((0, jsx_runtime_1.jsx)(CommentComposer_1.CommentComposer, { ui: ui, replyTo: replyTo, onCancelReply: () => setReplyTo(null), onSubmit: async (body, guidelinesAccepted) => {
19
+ const code = await thread.post(body, replyTo?.id ?? null, guidelinesAccepted);
20
+ if (code === null)
21
+ setReplyTo(null);
22
+ return code;
23
+ } })) : ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.status, styles.composer], children: copy.commentsClosed })), thread.status === "loading" ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.centered, children: (0, jsx_runtime_1.jsx)(react_native_1.ActivityIndicator, { color: tokens.mutedText }) })) : null, thread.status === "error" ? ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.centered, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.status, children: api.t("loadError") }), (0, jsx_runtime_1.jsx)(primitives_1.Button, { ui: ui, label: copy.retry, variant: "secondary", onPress: thread.retry })] })) : null, thread.status === "ready" && thread.items.length === 0 ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.centered, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.status, children: copy.noComments }) })) : null, (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.threadList, children: thread.items.map((comment) => ((0, jsx_runtime_1.jsxs)(react_native_1.View, { children: [(0, jsx_runtime_1.jsx)(CommentItem_1.CommentItem, { ui: ui, now: now, comment: comment, reported: thread.reported.has(comment.id), onVote: (value) => thread.vote(comment.id, value), onReport: (reason) => thread.report(comment.id, reason), ...(commentsOpen ? { onReply: () => setReplyTo({ id: comment.id, name: comment.authorName }) } : {}) }), comment.replies.length > 0 ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.replies, children: comment.replies.map((reply) => ((0, jsx_runtime_1.jsx)(CommentItem_1.CommentItem, { ui: ui, now: now, comment: reply, reported: thread.reported.has(reply.id), onVote: (value) => thread.vote(reply.id, value), onReport: (reason) => thread.report(reply.id, reason) }, reply.id))) })) : null] }, comment.id))) }), thread.hasMore ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.footer, children: (0, jsx_runtime_1.jsx)(primitives_1.Button, { ui: ui, label: copy.moreComments, variant: "secondary", onPress: () => void thread.loadMore() }) })) : null] }));
24
+ }
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from "react";
2
+ import type { ControllerProps } from "./use-controller";
3
+ export type ChangesProviderProps = ControllerProps & Readonly<{
4
+ children?: ReactNode;
5
+ }>;
6
+ /**
7
+ * Loads the changelog for `changesKey`, decides the What's New release once per update and renders
8
+ * the built-in sheet and changelog modal. Platform comes from `Platform.OS`: iOS and Android send
9
+ * `X-TheSeeker-App: appId`; react-native-web behaves as a web caller (Origin + allowedDomains).
10
+ */
11
+ export declare function ChangesProvider({ children, ...props }: ChangesProviderProps): import("react").JSX.Element;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChangesProvider = ChangesProvider;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_native_1 = require("react-native");
7
+ const ChangelogScreen_1 = require("./ChangelogScreen");
8
+ const context_1 = require("./context");
9
+ const messages_1 = require("./messages");
10
+ const resolve_1 = require("./resolve");
11
+ const styles_1 = require("./styles");
12
+ const use_controller_1 = require("./use-controller");
13
+ const WhatsNewSheet_1 = require("./WhatsNewSheet");
14
+ const fetchImpl = (url, init) => fetch(url, init);
15
+ function clientInfo() {
16
+ switch (react_native_1.Platform.OS) {
17
+ case "ios":
18
+ return { platform: "ios", osVersion: String(react_native_1.Platform.Version).slice(0, 32) };
19
+ case "android":
20
+ return { platform: "android", osVersion: String(react_native_1.Platform.constants.Release).slice(0, 32) };
21
+ default:
22
+ return undefined;
23
+ }
24
+ }
25
+ // Module-level so the controller's memoized client and session never reload because of identity churn.
26
+ const ENV = {
27
+ platform: (0, resolve_1.resolvePlatform)(react_native_1.Platform.OS),
28
+ deviceLocale: (0, resolve_1.deviceLocale)(),
29
+ clientInfo: clientInfo(),
30
+ fetchImpl,
31
+ randomBytes: (0, resolve_1.createRandomBytes)(Reflect.get(globalThis, "crypto"), Math.random),
32
+ openUrl: (url) => react_native_1.Linking.openURL(url),
33
+ warn: (message) => {
34
+ if (typeof __DEV__ !== "undefined" && __DEV__)
35
+ console.warn(`[TheSeekerChanges] ${message}`);
36
+ },
37
+ };
38
+ function ChangelogModal() {
39
+ const ui = (0, context_1.useChangesUi)();
40
+ if (ui === null)
41
+ return null;
42
+ const { api } = ui;
43
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { visible: api.isChangelogOpen, animationType: "slide", presentationStyle: "pageSheet", onRequestClose: api.closeChangelog, children: (0, jsx_runtime_1.jsx)(ChangelogScreen_1.ChangelogScreen, { onClose: api.closeChangelog }) }));
44
+ }
45
+ /**
46
+ * Loads the changelog for `changesKey`, decides the What's New release once per update and renders
47
+ * the built-in sheet and changelog modal. Platform comes from `Platform.OS`: iOS and Android send
48
+ * `X-TheSeeker-App: appId`; react-native-web behaves as a web caller (Origin + allowedDomains).
49
+ */
50
+ function ChangesProvider({ children, ...props }) {
51
+ const { api, sheetRelease, ratingAvailable } = (0, use_controller_1.useChangesController)(props, ENV);
52
+ const theme = (0, styles_1.useChangesTheme)(api.config?.app.accentColor ?? null);
53
+ const config = api.status === "ready" ? api.config : null;
54
+ const ui = (0, react_1.useMemo)(() => config === null || theme === null
55
+ ? null
56
+ : {
57
+ api,
58
+ config,
59
+ platform: ENV.platform,
60
+ tokens: theme.tokens,
61
+ styles: theme.styles,
62
+ copy: (0, messages_1.uiCopy)(api.locale),
63
+ sheetRelease,
64
+ ratingAvailable,
65
+ }, [api, config, theme, sheetRelease, ratingAvailable]);
66
+ return ((0, jsx_runtime_1.jsx)(context_1.ChangesApiContext.Provider, { value: api, children: (0, jsx_runtime_1.jsxs)(context_1.ChangesUiContext.Provider, { value: ui, children: [children, ui === null ? null : (0, jsx_runtime_1.jsx)(WhatsNewSheet_1.WhatsNewSheet, {}), ui === null ? null : (0, jsx_runtime_1.jsx)(ChangelogModal, {})] }) }));
67
+ }
@@ -0,0 +1,11 @@
1
+ import type { Release } from "../core/types";
2
+ import type { ChangesUi } from "./context";
3
+ export type ReleaseViewProps = Readonly<{
4
+ ui: ChangesUi;
5
+ release: Release;
6
+ /** Sheet: the release title is the dialog heading; list: the card heading. */
7
+ headingLevel: "sheet" | "card";
8
+ onOpenComments: () => void;
9
+ }>;
10
+ /** Title, version · date, tags, notes, `↑ n | ↓` and the comments link; the sheet adds the rating button. */
11
+ export declare function ReleaseView({ ui, release, headingLevel, onOpenComments }: ReleaseViewProps): import("react").JSX.Element;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReleaseView = ReleaseView;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_native_1 = require("react-native");
7
+ const styles_scale_1 = require("./styles-scale");
8
+ const Blocks_1 = require("./Blocks");
9
+ const format_1 = require("./format");
10
+ const messages_1 = require("./messages");
11
+ const primitives_1 = require("./primitives");
12
+ const rating_plan_1 = require("./rating-plan");
13
+ /** Title, version · date, tags, notes, `↑ n | ↓` and the comments link; the sheet adds the rating button. */
14
+ function ReleaseView({ ui, release, headingLevel, onOpenComments }) {
15
+ const { api, config, styles, copy, platform } = ui;
16
+ const [busy, setBusy] = (0, react_1.useState)(false);
17
+ const [failure, setFailure] = (0, react_1.useState)(null);
18
+ const { votesEnabled, commentsEnabled } = config.community;
19
+ const date = (0, format_1.formatReleaseDate)(release.publishedAt, api.locale);
20
+ const meta = release.version === null ? date : `${copy.version(release.version)} · ${date}`;
21
+ async function vote(value) {
22
+ setBusy(true);
23
+ const result = await api.vote(release.id, value);
24
+ setBusy(false);
25
+ const message = result.ok ? null : (0, messages_1.errorMessage)(result.code, api.locale);
26
+ setFailure(message);
27
+ if (message !== null)
28
+ (0, primitives_1.announce)(message);
29
+ }
30
+ const showRating = headingLevel === "sheet" && ui.ratingAvailable && (0, rating_plan_1.shouldShowRating)(config.rating.mode, release.myVote);
31
+ const commentLabel = release.commentCount === 0
32
+ ? api.t("writeComment")
33
+ : `${api.t("comments")} ${release.commentCount} · ${api.t("viewComments")}`;
34
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.releaseHead, children: [headingLevel === "sheet" ? (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.eyebrow, children: api.t("whatsNew") }) : null, (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.releaseTitle, accessibilityRole: "header", ...styles_scale_1.KOREAN_WRAP, children: release.title }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.meta, children: meta }), release.tags.length > 0 ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.tags, children: release.tags.map((tag) => ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.tag, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.tagLabel, children: api.t(`tag_${tag}`) }) }, tag))) })) : null] }), (0, jsx_runtime_1.jsx)(Blocks_1.Blocks, { blocks: release.blocks, styles: styles }), votesEnabled || commentsEnabled ? ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.actionsRow, children: [votesEnabled ? ((0, jsx_runtime_1.jsx)(primitives_1.VoteCapsule, { ui: ui, upvotes: release.upvotes, myVote: release.myVote, busy: busy, onVote: (value) => void vote(value) })) : null, commentsEnabled ? ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { testID: "theseeker-changes-comments-link", accessibilityRole: "button", accessibilityLabel: release.commentCount === 0
35
+ ? commentLabel
36
+ : `${copy.commentCount(release.commentCount)}, ${api.t("viewComments")}`, onPress: onOpenComments, style: styles.commentLink, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.commentLinkLabel, children: commentLabel }) })) : null] })) : null, (0, jsx_runtime_1.jsx)(primitives_1.Status, { ui: ui, text: failure, tone: "error" }), showRating ? ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.footer, children: (0, jsx_runtime_1.jsx)(primitives_1.Button, { ui: ui, label: api.t((0, rating_plan_1.ratingLabelKey)(platform)), variant: "secondary", testID: "theseeker-changes-rate", onPress: () => void api.openRating(release.id) }) })) : null] }));
37
+ }
@@ -0,0 +1,6 @@
1
+ export declare function useReducedMotion(): boolean;
2
+ /**
3
+ * What's New bottom sheet. `onShow` is the only place a release counts as presented (show-once state
4
+ * plus the `view` event), so a sheet that never reached the screen is offered again next launch.
5
+ */
6
+ export declare function WhatsNewSheet(): import("react").JSX.Element | null;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useReducedMotion = useReducedMotion;
4
+ exports.WhatsNewSheet = WhatsNewSheet;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ const react_native_1 = require("react-native");
8
+ const CommentsThread_1 = require("./CommentsThread");
9
+ const context_1 = require("./context");
10
+ const primitives_1 = require("./primitives");
11
+ const ReleaseView_1 = require("./ReleaseView");
12
+ function useReducedMotion() {
13
+ const [reduced, setReduced] = (0, react_1.useState)(false);
14
+ (0, react_1.useEffect)(() => {
15
+ let live = true;
16
+ async function read() {
17
+ const value = await react_native_1.AccessibilityInfo.isReduceMotionEnabled();
18
+ if (live)
19
+ setReduced(value);
20
+ }
21
+ void read();
22
+ const subscription = react_native_1.AccessibilityInfo.addEventListener("reduceMotionChanged", setReduced);
23
+ return () => {
24
+ live = false;
25
+ subscription.remove();
26
+ };
27
+ }, []);
28
+ return reduced;
29
+ }
30
+ function SheetBody({ ui, release }) {
31
+ const { api, styles } = ui;
32
+ const [view, setView] = (0, react_1.useState)("release");
33
+ return ((0, jsx_runtime_1.jsx)(react_native_1.ScrollView, { keyboardShouldPersistTaps: "handled", contentContainerStyle: styles.sheetContent, alwaysBounceVertical: false, children: view === "release" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ReleaseView_1.ReleaseView, { ui: ui, release: release, headingLevel: "sheet", onOpenComments: () => setView("comments") }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.footer, children: (0, jsx_runtime_1.jsx)(primitives_1.Button, { ui: ui, label: api.t("continue"), variant: "primary", testID: "theseeker-changes-continue", onPress: api.dismissWhatsNew }) })] })) : ((0, jsx_runtime_1.jsx)(CommentsThread_1.CommentsThread, { ui: ui, release: release, onBack: () => setView("release") })) }));
34
+ }
35
+ /**
36
+ * What's New bottom sheet. `onShow` is the only place a release counts as presented (show-once state
37
+ * plus the `view` event), so a sheet that never reached the screen is offered again next launch.
38
+ */
39
+ function WhatsNewSheet() {
40
+ const ui = (0, context_1.useChangesUi)();
41
+ const reducedMotion = useReducedMotion();
42
+ const release = ui?.sheetRelease ?? null;
43
+ if (ui === null)
44
+ return null;
45
+ const { api, styles } = ui;
46
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { visible: release !== null, transparent: true, animationType: reducedMotion ? "fade" : "slide", statusBarTranslucent: true, onRequestClose: api.dismissWhatsNew, onShow: () => {
47
+ if (release === null)
48
+ return;
49
+ api.markPresented(release);
50
+ api.trackView(release);
51
+ }, children: (0, jsx_runtime_1.jsxs)(react_native_1.KeyboardAvoidingView, { behavior: "padding", style: styles.sheetRoot, children: [(0, jsx_runtime_1.jsx)(react_native_1.Pressable, { testID: "theseeker-changes-scrim", style: styles.scrim, onPress: api.dismissWhatsNew, accessible: false, importantForAccessibility: "no" }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { testID: "theseeker-changes-sheet", style: styles.sheet, accessibilityViewIsModal: true, onAccessibilityEscape: api.dismissWhatsNew, children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.handle }), release === null ? null : (0, jsx_runtime_1.jsx)(SheetBody, { ui: ui, release: release }, release.id)] })] }) }));
52
+ }
@@ -0,0 +1,18 @@
1
+ import type { ChangesClient } from "../core/client";
2
+ import type { ClientInfo, Failure } from "../core/types";
3
+ import type { ChangesComments } from "./context";
4
+ /** Every call before the session loaded fails the same way: there is no install id to act with yet. */
5
+ export declare const NOT_READY: Failure;
6
+ type ReadDeps = Readonly<{
7
+ client: ChangesClient;
8
+ installId: string | null;
9
+ }>;
10
+ /** List, vote and report: stable while the client and install id are, so open threads never refetch. */
11
+ export declare function createCommentReads({ client, installId }: ReadDeps): Omit<ChangesComments, "post">;
12
+ type PostDeps = ReadDeps & Readonly<{
13
+ guidelinesAccepted: boolean;
14
+ clientInfo: ClientInfo | undefined;
15
+ onPosted: (releaseId: string) => void;
16
+ }>;
17
+ export declare function createCommentPost(deps: PostDeps): ChangesComments["post"];
18
+ export {};
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NOT_READY = void 0;
4
+ exports.createCommentReads = createCommentReads;
5
+ exports.createCommentPost = createCommentPost;
6
+ /** Every call before the session loaded fails the same way: there is no install id to act with yet. */
7
+ exports.NOT_READY = { ok: false, code: "CHANGES_NOT_FOUND" };
8
+ /** List, vote and report: stable while the client and install id are, so open threads never refetch. */
9
+ function createCommentReads({ client, installId }) {
10
+ return {
11
+ list: async (releaseId, cursor) => {
12
+ if (installId === null)
13
+ return exports.NOT_READY;
14
+ return client.listComments({ releaseId, voter: installId, ...(cursor === undefined ? {} : { cursor }) });
15
+ },
16
+ vote: async (commentId, value) => installId === null ? exports.NOT_READY : client.voteComment({ commentId, value, voter: { installId } }),
17
+ report: async (commentId, reason, note) => installId === null
18
+ ? exports.NOT_READY
19
+ : client.reportComment({ commentId, reason, voter: { installId }, ...(note === undefined ? {} : { note }) }),
20
+ };
21
+ }
22
+ function createCommentPost(deps) {
23
+ const { client, installId } = deps;
24
+ return async ({ releaseId, body, parentId, guidelinesAccepted }) => {
25
+ if (installId === null)
26
+ return exports.NOT_READY;
27
+ const result = await client.postComment({
28
+ releaseId,
29
+ body,
30
+ voter: { installId },
31
+ guidelinesAccepted: guidelinesAccepted ?? deps.guidelinesAccepted,
32
+ ...(parentId === undefined ? {} : { parentId }),
33
+ ...(deps.clientInfo === undefined ? {} : { client: deps.clientInfo }),
34
+ });
35
+ if (result.ok)
36
+ deps.onPosted(releaseId);
37
+ return result;
38
+ };
39
+ }
@@ -0,0 +1,125 @@
1
+ import type { CommentInput, ReportInput } from "../core/client";
2
+ import type { Comment, CommentReply, Config, ErrorCode, Platform, Release, Result } from "../core/types";
3
+ import type { Translate, UiCopy } from "./messages";
4
+ import type { ChangesLocale } from "./resolve";
5
+ import type { VoteCounts } from "./session";
6
+ import type { ChangesStyles } from "./styles";
7
+ import type { Tokens } from "./tokens";
8
+ export type ChangesStatus = "loading" | "ready" | "disabled" | "error";
9
+ export type VoteValue = -1 | 0 | 1;
10
+ export type CommentsPage = Readonly<{
11
+ items: readonly Comment[];
12
+ nextCursor: string | null;
13
+ total: number;
14
+ }>;
15
+ export type ReleaseFeedbackInput = Readonly<{
16
+ releaseId: string;
17
+ message: string;
18
+ email?: string;
19
+ }>;
20
+ export type ChangesComments = Readonly<{
21
+ list: (releaseId: string, cursor?: string) => Promise<Result<CommentsPage>>;
22
+ post: (input: Pick<CommentInput, "releaseId" | "body"> & Readonly<{
23
+ parentId?: string;
24
+ guidelinesAccepted?: boolean;
25
+ }>) => Promise<Result<Readonly<{
26
+ comment: CommentReply;
27
+ }>>>;
28
+ vote: (commentId: string, value: VoteValue) => Promise<Result<VoteCounts>>;
29
+ report: (commentId: string, reason: ReportInput["reason"], note?: string) => Promise<Result<unknown>>;
30
+ }>;
31
+ /** Public hook surface; mirrors `@the-seeker/changes-react`'s `useChanges()`, plus `trackView` for custom sheets. */
32
+ export type ChangesApi = Readonly<{
33
+ status: ChangesStatus;
34
+ /** Releases come from the offline cache (network failed, cache younger than 7 days). */
35
+ stale: boolean;
36
+ error: ErrorCode | null;
37
+ config: Config | null;
38
+ locale: ChangesLocale;
39
+ t: Translate;
40
+ releases: readonly Release[];
41
+ latest: Release | null;
42
+ unseenCount: number;
43
+ /** The release the show-once rules picked for this launch, until the sheet reports it shown. */
44
+ pendingWhatsNew: Release | null;
45
+ vote: (releaseId: string, value: VoteValue) => Promise<Result<VoteCounts>>;
46
+ sendFeedback: (input: ReleaseFeedbackInput) => Promise<Result<Readonly<{
47
+ id: string;
48
+ }>>>;
49
+ isChangelogOpen: boolean;
50
+ openChangelog: () => void;
51
+ closeChangelog: () => void;
52
+ /** Opens the built-in sheet (for a settings row); defaults to the latest release. */
53
+ showWhatsNew: (release?: Release) => void;
54
+ dismissWhatsNew: () => void;
55
+ markPresented: (release: Release) => void;
56
+ /** Records the `view` event; call it next to `markPresented` when the app draws its own sheet. */
57
+ trackView: (release: Release) => void;
58
+ markChangelogSeen: () => void;
59
+ openRating: (releaseId?: string) => Promise<boolean>;
60
+ comments: ChangesComments;
61
+ guidelinesAccepted: boolean;
62
+ acceptGuidelines: () => void;
63
+ reload: () => void;
64
+ }>;
65
+ /** What the built-in components need beyond the public API; present once the config loaded. */
66
+ export type ChangesUi = Readonly<{
67
+ api: ChangesApi;
68
+ config: Config;
69
+ platform: Platform;
70
+ tokens: Tokens;
71
+ styles: ChangesStyles;
72
+ copy: UiCopy;
73
+ sheetRelease: Release | null;
74
+ ratingAvailable: boolean;
75
+ }>;
76
+ export declare class ChangesContextError extends Error {
77
+ readonly caller: string;
78
+ constructor(caller: string);
79
+ }
80
+ export declare const ChangesApiContext: import("react").Context<Readonly<{
81
+ status: ChangesStatus;
82
+ /** Releases come from the offline cache (network failed, cache younger than 7 days). */
83
+ stale: boolean;
84
+ error: ErrorCode | null;
85
+ config: Config | null;
86
+ locale: ChangesLocale;
87
+ t: Translate;
88
+ releases: readonly Release[];
89
+ latest: Release | null;
90
+ unseenCount: number;
91
+ /** The release the show-once rules picked for this launch, until the sheet reports it shown. */
92
+ pendingWhatsNew: Release | null;
93
+ vote: (releaseId: string, value: VoteValue) => Promise<Result<VoteCounts>>;
94
+ sendFeedback: (input: ReleaseFeedbackInput) => Promise<Result<Readonly<{
95
+ id: string;
96
+ }>>>;
97
+ isChangelogOpen: boolean;
98
+ openChangelog: () => void;
99
+ closeChangelog: () => void;
100
+ /** Opens the built-in sheet (for a settings row); defaults to the latest release. */
101
+ showWhatsNew: (release?: Release) => void;
102
+ dismissWhatsNew: () => void;
103
+ markPresented: (release: Release) => void;
104
+ /** Records the `view` event; call it next to `markPresented` when the app draws its own sheet. */
105
+ trackView: (release: Release) => void;
106
+ markChangelogSeen: () => void;
107
+ openRating: (releaseId?: string) => Promise<boolean>;
108
+ comments: ChangesComments;
109
+ guidelinesAccepted: boolean;
110
+ acceptGuidelines: () => void;
111
+ reload: () => void;
112
+ }> | null>;
113
+ export declare const ChangesUiContext: import("react").Context<Readonly<{
114
+ api: ChangesApi;
115
+ config: Config;
116
+ platform: Platform;
117
+ tokens: Tokens;
118
+ styles: ChangesStyles;
119
+ copy: UiCopy;
120
+ sheetRelease: Release | null;
121
+ ratingAvailable: boolean;
122
+ }> | null>;
123
+ export declare function useChanges(): ChangesApi;
124
+ /** `null` until the config is loaded (or when the project is disabled); components render nothing then. */
125
+ export declare function useChangesUi(): ChangesUi | null;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChangesUiContext = exports.ChangesApiContext = exports.ChangesContextError = void 0;
4
+ exports.useChanges = useChanges;
5
+ exports.useChangesUi = useChangesUi;
6
+ const react_1 = require("react");
7
+ class ChangesContextError extends Error {
8
+ constructor(caller) {
9
+ super(`${caller} must be rendered inside <ChangesProvider>.`);
10
+ this.caller = caller;
11
+ this.name = "ChangesContextError";
12
+ }
13
+ }
14
+ exports.ChangesContextError = ChangesContextError;
15
+ exports.ChangesApiContext = (0, react_1.createContext)(null);
16
+ exports.ChangesUiContext = (0, react_1.createContext)(null);
17
+ function useChanges() {
18
+ const api = (0, react_1.useContext)(exports.ChangesApiContext);
19
+ if (api === null)
20
+ throw new ChangesContextError("useChanges()");
21
+ return api;
22
+ }
23
+ /** `null` until the config is loaded (or when the project is disabled); components render nothing then. */
24
+ function useChangesUi() {
25
+ return (0, react_1.useContext)(exports.ChangesUiContext);
26
+ }