@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,89 @@
1
+ export declare const DEFAULT_TEXTS: {
2
+ readonly ko: {
3
+ readonly title: "업데이트";
4
+ readonly subtitle: "더 나은 경험을 위한 새로운 소식";
5
+ readonly whatsNew: "새로운 소식";
6
+ readonly viewAll: "전체 보기";
7
+ readonly close: "닫기";
8
+ readonly continue: "계속";
9
+ readonly readUpdate: "업데이트 읽기";
10
+ readonly upvote: "좋아요";
11
+ readonly downvote: "아쉬워요";
12
+ readonly comments: "댓글";
13
+ readonly viewComments: "댓글 보기";
14
+ readonly writeComment: "댓글 쓰기";
15
+ readonly commentPlaceholder: "의견을 남겨 주세요";
16
+ readonly commentSubmit: "댓글 등록";
17
+ readonly reply: "답글";
18
+ readonly developerBadge: "개발자";
19
+ readonly report: "신고";
20
+ readonly reportReasons_spam: "스팸";
21
+ readonly reportReasons_abuse: "욕설 및 괴롭힘";
22
+ readonly reportReasons_off_topic: "주제와 무관";
23
+ readonly reportReasons_other: "기타";
24
+ readonly reported: "신고되었습니다";
25
+ readonly guidelinesTitle: "커뮤니티 이용 안내";
26
+ readonly guidelinesBody: "서로를 존중하며 업데이트에 관한 의견을 나눠 주세요. 개인정보, 스팸, 욕설 및 괴롭힘은 허용되지 않습니다.";
27
+ readonly guidelinesAccept: "이용 안내를 읽고 동의합니다";
28
+ readonly feedbackLabel: "개발자에게 의견 보내기";
29
+ readonly feedbackPlaceholder: "어떤 점을 개선하면 좋을까요?";
30
+ readonly feedbackSubmit: "의견 보내기";
31
+ readonly feedbackThanks: "의견을 보내 주셔서 감사합니다";
32
+ readonly rateAppStore: "App Store에서 평가";
33
+ readonly ratePlay: "Google Play에서 평가";
34
+ readonly rateWeb: "리뷰 남기기";
35
+ readonly empty: "아직 업데이트가 없습니다";
36
+ readonly loadError: "소식을 불러오지 못했습니다";
37
+ readonly offline: "오프라인입니다. 저장된 소식을 표시합니다";
38
+ readonly contactDeveloper: "개발자에게 문의";
39
+ readonly tag_new: "새 기능";
40
+ readonly tag_improved: "개선";
41
+ readonly tag_fixed: "수정";
42
+ readonly tag_security: "보안";
43
+ readonly tag_deprecated: "지원 중단 예정";
44
+ };
45
+ readonly en: {
46
+ readonly title: "Updates";
47
+ readonly subtitle: "The latest improvements to your experience";
48
+ readonly whatsNew: "What's new";
49
+ readonly viewAll: "View all";
50
+ readonly close: "Close";
51
+ readonly continue: "Continue";
52
+ readonly readUpdate: "Read update";
53
+ readonly upvote: "Upvote";
54
+ readonly downvote: "Downvote";
55
+ readonly comments: "Comments";
56
+ readonly viewComments: "View comments";
57
+ readonly writeComment: "Write a comment";
58
+ readonly commentPlaceholder: "Share your thoughts";
59
+ readonly commentSubmit: "Post comment";
60
+ readonly reply: "Reply";
61
+ readonly developerBadge: "Developer";
62
+ readonly report: "Report";
63
+ readonly reportReasons_spam: "Spam";
64
+ readonly reportReasons_abuse: "Abuse or harassment";
65
+ readonly reportReasons_off_topic: "Off topic";
66
+ readonly reportReasons_other: "Other";
67
+ readonly reported: "Reported";
68
+ readonly guidelinesTitle: "Community guidelines";
69
+ readonly guidelinesBody: "Respect others and keep comments relevant to the update. Personal information, spam, abuse and harassment are not allowed.";
70
+ readonly guidelinesAccept: "I have read and accept the guidelines";
71
+ readonly feedbackLabel: "Send feedback to the developer";
72
+ readonly feedbackPlaceholder: "What could we improve?";
73
+ readonly feedbackSubmit: "Send feedback";
74
+ readonly feedbackThanks: "Thank you for your feedback";
75
+ readonly rateAppStore: "Rate on the App Store";
76
+ readonly ratePlay: "Rate on Google Play";
77
+ readonly rateWeb: "Write a review";
78
+ readonly empty: "No updates yet";
79
+ readonly loadError: "Could not load updates";
80
+ readonly offline: "You are offline. Showing saved updates";
81
+ readonly contactDeveloper: "Contact developer";
82
+ readonly tag_new: "New";
83
+ readonly tag_improved: "Improved";
84
+ readonly tag_fixed: "Fixed";
85
+ readonly tag_security: "Security";
86
+ readonly tag_deprecated: "Deprecated";
87
+ };
88
+ };
89
+ export type TextKey = keyof (typeof DEFAULT_TEXTS)["ko"];
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_TEXTS = void 0;
4
+ // Built-in copy for keys an older server may not send yet; the hosted config always wins.
5
+ exports.DEFAULT_TEXTS = {
6
+ ko: {
7
+ title: "업데이트",
8
+ subtitle: "더 나은 경험을 위한 새로운 소식",
9
+ whatsNew: "새로운 소식",
10
+ viewAll: "전체 보기",
11
+ close: "닫기",
12
+ continue: "계속",
13
+ readUpdate: "업데이트 읽기",
14
+ upvote: "좋아요",
15
+ downvote: "아쉬워요",
16
+ comments: "댓글",
17
+ viewComments: "댓글 보기",
18
+ writeComment: "댓글 쓰기",
19
+ commentPlaceholder: "의견을 남겨 주세요",
20
+ commentSubmit: "댓글 등록",
21
+ reply: "답글",
22
+ developerBadge: "개발자",
23
+ report: "신고",
24
+ reportReasons_spam: "스팸",
25
+ reportReasons_abuse: "욕설 및 괴롭힘",
26
+ reportReasons_off_topic: "주제와 무관",
27
+ reportReasons_other: "기타",
28
+ reported: "신고되었습니다",
29
+ guidelinesTitle: "커뮤니티 이용 안내",
30
+ guidelinesBody: "서로를 존중하며 업데이트에 관한 의견을 나눠 주세요. 개인정보, 스팸, 욕설 및 괴롭힘은 허용되지 않습니다.",
31
+ guidelinesAccept: "이용 안내를 읽고 동의합니다",
32
+ feedbackLabel: "개발자에게 의견 보내기",
33
+ feedbackPlaceholder: "어떤 점을 개선하면 좋을까요?",
34
+ feedbackSubmit: "의견 보내기",
35
+ feedbackThanks: "의견을 보내 주셔서 감사합니다",
36
+ rateAppStore: "App Store에서 평가",
37
+ ratePlay: "Google Play에서 평가",
38
+ rateWeb: "리뷰 남기기",
39
+ empty: "아직 업데이트가 없습니다",
40
+ loadError: "소식을 불러오지 못했습니다",
41
+ offline: "오프라인입니다. 저장된 소식을 표시합니다",
42
+ contactDeveloper: "개발자에게 문의",
43
+ tag_new: "새 기능",
44
+ tag_improved: "개선",
45
+ tag_fixed: "수정",
46
+ tag_security: "보안",
47
+ tag_deprecated: "지원 중단 예정",
48
+ },
49
+ en: {
50
+ title: "Updates",
51
+ subtitle: "The latest improvements to your experience",
52
+ whatsNew: "What's new",
53
+ viewAll: "View all",
54
+ close: "Close",
55
+ continue: "Continue",
56
+ readUpdate: "Read update",
57
+ upvote: "Upvote",
58
+ downvote: "Downvote",
59
+ comments: "Comments",
60
+ viewComments: "View comments",
61
+ writeComment: "Write a comment",
62
+ commentPlaceholder: "Share your thoughts",
63
+ commentSubmit: "Post comment",
64
+ reply: "Reply",
65
+ developerBadge: "Developer",
66
+ report: "Report",
67
+ reportReasons_spam: "Spam",
68
+ reportReasons_abuse: "Abuse or harassment",
69
+ reportReasons_off_topic: "Off topic",
70
+ reportReasons_other: "Other",
71
+ reported: "Reported",
72
+ guidelinesTitle: "Community guidelines",
73
+ guidelinesBody: "Respect others and keep comments relevant to the update. Personal information, spam, abuse and harassment are not allowed.",
74
+ guidelinesAccept: "I have read and accept the guidelines",
75
+ feedbackLabel: "Send feedback to the developer",
76
+ feedbackPlaceholder: "What could we improve?",
77
+ feedbackSubmit: "Send feedback",
78
+ feedbackThanks: "Thank you for your feedback",
79
+ rateAppStore: "Rate on the App Store",
80
+ ratePlay: "Rate on Google Play",
81
+ rateWeb: "Write a review",
82
+ empty: "No updates yet",
83
+ loadError: "Could not load updates",
84
+ offline: "You are offline. Showing saved updates",
85
+ contactDeveloper: "Contact developer",
86
+ tag_new: "New",
87
+ tag_improved: "Improved",
88
+ tag_fixed: "Fixed",
89
+ tag_security: "Security",
90
+ tag_deprecated: "Deprecated",
91
+ },
92
+ };
@@ -0,0 +1,5 @@
1
+ import type { ChangesLocale } from "./resolve";
2
+ /** Long release date in UTC ("2026년 11월 6일" / "Nov 6, 2026"); ISO date when Intl is unavailable. */
3
+ export declare function formatReleaseDate(iso: string, locale: ChangesLocale): string;
4
+ /** Compact relative time for comments ("3분 전" / "3m ago"), falling back to the release date format. */
5
+ export declare function formatAgo(iso: string, now: number, locale: ChangesLocale): string;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatReleaseDate = formatReleaseDate;
4
+ exports.formatAgo = formatAgo;
5
+ const INTL_LOCALES = { ko: "ko-KR", en: "en-US" };
6
+ /** Long release date in UTC ("2026년 11월 6일" / "Nov 6, 2026"); ISO date when Intl is unavailable. */
7
+ function formatReleaseDate(iso, locale) {
8
+ try {
9
+ return new Intl.DateTimeFormat(INTL_LOCALES[locale], {
10
+ year: "numeric",
11
+ month: locale === "ko" ? "long" : "short",
12
+ day: "numeric",
13
+ timeZone: "UTC",
14
+ }).format(new Date(iso));
15
+ }
16
+ catch {
17
+ return iso.slice(0, 10);
18
+ }
19
+ }
20
+ /** Compact relative time for comments ("3분 전" / "3m ago"), falling back to the release date format. */
21
+ function formatAgo(iso, now, locale) {
22
+ const minutes = Math.max(0, Math.floor((now - Date.parse(iso)) / 60000));
23
+ if (minutes < 1)
24
+ return locale === "ko" ? "방금" : "now";
25
+ if (minutes < 60)
26
+ return locale === "ko" ? `${minutes}분 전` : `${minutes}m ago`;
27
+ const hours = Math.floor(minutes / 60);
28
+ if (hours < 24)
29
+ return locale === "ko" ? `${hours}시간 전` : `${hours}h ago`;
30
+ const days = Math.floor(hours / 24);
31
+ if (days < 7)
32
+ return locale === "ko" ? `${days}일 전` : `${days}d ago`;
33
+ return formatReleaseDate(iso, locale);
34
+ }
@@ -0,0 +1,44 @@
1
+ import type { Config, ErrorCode } from "../core/types";
2
+ import type { TextKey } from "./default-texts";
3
+ import type { ChangesLocale } from "./resolve";
4
+ export type Translate = (key: TextKey) => string;
5
+ /** Hosted locale → hosted default locale → built-in copy, so a raw key never reaches the screen. */
6
+ export declare function createTranslator(config: Pick<Config, "texts" | "defaultLocale">, locale: ChangesLocale): Translate;
7
+ declare const UI: {
8
+ readonly ko: {
9
+ readonly version: (version: string) => string;
10
+ readonly upvoteLabel: (count: number) => string;
11
+ readonly downvoteLabel: "아쉬워요";
12
+ readonly commentCount: (count: number) => string;
13
+ readonly unread: (count: number) => string;
14
+ readonly replyTo: (name: string) => string;
15
+ readonly back: "뒤로";
16
+ readonly cancel: "취소";
17
+ readonly cancelReply: "답글 취소";
18
+ readonly reportTitle: "신고 사유를 선택하세요";
19
+ readonly noComments: "아직 댓글이 없습니다. 첫 의견을 남겨 주세요.";
20
+ readonly moreComments: "댓글 더 보기";
21
+ readonly retry: "다시 시도";
22
+ readonly commentsClosed: "이 업데이트에는 댓글을 쓸 수 없습니다.";
23
+ };
24
+ readonly en: {
25
+ readonly version: (version: string) => string;
26
+ readonly upvoteLabel: (count: number) => string;
27
+ readonly downvoteLabel: "Downvote";
28
+ readonly commentCount: (count: number) => string;
29
+ readonly unread: (count: number) => string;
30
+ readonly replyTo: (name: string) => string;
31
+ readonly back: "Back";
32
+ readonly cancel: "Cancel";
33
+ readonly cancelReply: "Cancel reply";
34
+ readonly reportTitle: "Choose a reason for the report";
35
+ readonly noComments: "No comments yet. Share the first thought.";
36
+ readonly moreComments: "Show more comments";
37
+ readonly retry: "Try again";
38
+ readonly commentsClosed: "Comments are closed for this update.";
39
+ };
40
+ };
41
+ export type UiCopy = (typeof UI)[ChangesLocale];
42
+ export declare function uiCopy(locale: ChangesLocale): UiCopy;
43
+ export declare function errorMessage(code: ErrorCode, locale: ChangesLocale): string;
44
+ export {};
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createTranslator = createTranslator;
4
+ exports.uiCopy = uiCopy;
5
+ exports.errorMessage = errorMessage;
6
+ const default_texts_1 = require("./default-texts");
7
+ /** Hosted locale → hosted default locale → built-in copy, so a raw key never reaches the screen. */
8
+ function createTranslator(config, locale) {
9
+ const primary = config.texts[locale];
10
+ const fallback = config.texts[config.defaultLocale];
11
+ return (key) => primary?.[key] ?? fallback?.[key] ?? default_texts_1.DEFAULT_TEXTS[locale][key];
12
+ }
13
+ const UI = {
14
+ ko: {
15
+ version: (version) => `버전 ${version}`,
16
+ upvoteLabel: (count) => `좋아요 ${count}개`,
17
+ downvoteLabel: "아쉬워요",
18
+ commentCount: (count) => `댓글 ${count}개`,
19
+ unread: (count) => `읽지 않은 소식 ${count}개`,
20
+ replyTo: (name) => `${name}님에게 답글`,
21
+ back: "뒤로",
22
+ cancel: "취소",
23
+ cancelReply: "답글 취소",
24
+ reportTitle: "신고 사유를 선택하세요",
25
+ noComments: "아직 댓글이 없습니다. 첫 의견을 남겨 주세요.",
26
+ moreComments: "댓글 더 보기",
27
+ retry: "다시 시도",
28
+ commentsClosed: "이 업데이트에는 댓글을 쓸 수 없습니다.",
29
+ },
30
+ en: {
31
+ version: (version) => `Version ${version}`,
32
+ upvoteLabel: (count) => (count === 1 ? "1 upvote" : `${count} upvotes`),
33
+ downvoteLabel: "Downvote",
34
+ commentCount: (count) => (count === 1 ? "1 comment" : `${count} comments`),
35
+ unread: (count) => (count === 1 ? "1 unread update" : `${count} unread updates`),
36
+ replyTo: (name) => `Replying to ${name}`,
37
+ back: "Back",
38
+ cancel: "Cancel",
39
+ cancelReply: "Cancel reply",
40
+ reportTitle: "Choose a reason for the report",
41
+ noComments: "No comments yet. Share the first thought.",
42
+ moreComments: "Show more comments",
43
+ retry: "Try again",
44
+ commentsClosed: "Comments are closed for this update.",
45
+ },
46
+ };
47
+ function uiCopy(locale) {
48
+ return UI[locale];
49
+ }
50
+ const ERRORS = {
51
+ ko: {
52
+ BANNED: "이 기기에서는 더 이상 댓글을 쓰거나 투표할 수 없습니다.",
53
+ COMMENTS_DISABLED: "지금은 댓글을 쓸 수 없습니다.",
54
+ VOTES_DISABLED: "지금은 투표할 수 없습니다.",
55
+ RATE_LIMITED: "요청이 많습니다. 몇 분 뒤 다시 시도해 주세요.",
56
+ GUIDELINES_REQUIRED: "이용 안내에 동의하면 댓글을 등록할 수 있습니다.",
57
+ NETWORK_ERROR: "연결을 확인한 뒤 다시 시도해 주세요.",
58
+ fallback: "요청을 처리하지 못했습니다. 잠시 뒤 다시 시도해 주세요.",
59
+ },
60
+ en: {
61
+ BANNED: "This device can no longer comment or vote.",
62
+ COMMENTS_DISABLED: "Comments are turned off right now.",
63
+ VOTES_DISABLED: "Voting is turned off right now.",
64
+ RATE_LIMITED: "Too many requests. Try again in a few minutes.",
65
+ GUIDELINES_REQUIRED: "Accept the community guidelines to post a comment.",
66
+ NETWORK_ERROR: "Check your connection and try again.",
67
+ fallback: "Unable to complete the request. Try again shortly.",
68
+ },
69
+ };
70
+ function errorMessage(code, locale) {
71
+ const copy = ERRORS[locale];
72
+ switch (code) {
73
+ case "BANNED":
74
+ case "COMMENTS_DISABLED":
75
+ case "VOTES_DISABLED":
76
+ case "RATE_LIMITED":
77
+ case "GUIDELINES_REQUIRED":
78
+ case "NETWORK_ERROR":
79
+ return copy[code];
80
+ default:
81
+ return copy.fallback;
82
+ }
83
+ }
@@ -0,0 +1,39 @@
1
+ import type { ChangesUi } from "./context";
2
+ /** VoiceOver has no live regions; Android already reads `accessibilityLiveRegion` text. */
3
+ export declare function announce(text: string): void;
4
+ export declare function ArrowGlyph({ direction, color, size, }: Readonly<{
5
+ direction: "up" | "down";
6
+ color: string;
7
+ size?: number;
8
+ }>): import("react").JSX.Element;
9
+ export type ButtonProps = Readonly<{
10
+ ui: ChangesUi;
11
+ label: string;
12
+ variant: "primary" | "secondary" | "ghost";
13
+ onPress: () => void;
14
+ disabled?: boolean;
15
+ busy?: boolean;
16
+ tone?: "default" | "link";
17
+ testID?: string;
18
+ }>;
19
+ export declare function Button({ ui, label, variant, onPress, disabled, busy, tone, testID, }: ButtonProps): import("react").JSX.Element;
20
+ export type VoteCapsuleProps = Readonly<{
21
+ ui: ChangesUi;
22
+ upvotes: number;
23
+ myVote: -1 | 0 | 1;
24
+ onVote: (value: -1 | 0 | 1) => void;
25
+ busy: boolean;
26
+ }>;
27
+ /** `↑ n | ↓`: the down count stays private like ReleaseKit; tapping the active side clears the vote. */
28
+ export declare function VoteCapsule({ ui, upvotes, myVote, onVote, busy }: VoteCapsuleProps): import("react").JSX.Element;
29
+ export declare function Checkbox({ ui, label, checked, onChange, }: Readonly<{
30
+ ui: ChangesUi;
31
+ label: string;
32
+ checked: boolean;
33
+ onChange: (next: boolean) => void;
34
+ }>): import("react").JSX.Element;
35
+ export declare function Status({ ui, text, tone }: Readonly<{
36
+ ui: ChangesUi;
37
+ text: string | null;
38
+ tone: "info" | "error";
39
+ }>): import("react").JSX.Element | null;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.announce = announce;
4
+ exports.ArrowGlyph = ArrowGlyph;
5
+ exports.Button = Button;
6
+ exports.VoteCapsule = VoteCapsule;
7
+ exports.Checkbox = Checkbox;
8
+ exports.Status = Status;
9
+ const jsx_runtime_1 = require("react/jsx-runtime");
10
+ const react_native_1 = require("react-native");
11
+ // lucide:arrow-up `m5 12l7-7l7 7m-7 7V5` and lucide:check `M20 6L9 17l-5-5` (icon catalog), on the 24 grid.
12
+ const ARROW_UP = [
13
+ [12, 19, 12, 5],
14
+ [5, 12, 12, 5],
15
+ [19, 12, 12, 5],
16
+ ];
17
+ const CHECK = [
18
+ [4, 12, 9, 17],
19
+ [9, 17, 20, 6],
20
+ ];
21
+ /** VoiceOver has no live regions; Android already reads `accessibilityLiveRegion` text. */
22
+ function announce(text) {
23
+ if (react_native_1.Platform.OS === "ios")
24
+ react_native_1.AccessibilityInfo.announceForAccessibility(text);
25
+ }
26
+ /** Stroked catalog glyph drawn with rotated Views: the SDK ships no SVG renderer. */
27
+ function LineGlyph({ segments, size, color, flip = false, }) {
28
+ const scale = size / 24;
29
+ const thickness = Math.max(1.5, size / 12);
30
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: { width: size, height: size, transform: flip ? [{ rotate: "180deg" }] : [] }, accessible: false, importantForAccessibility: "no-hide-descendants", children: segments.map(([x1, y1, x2, y2]) => {
31
+ const length = Math.hypot(x2 - x1, y2 - y1) * scale + thickness;
32
+ const bar = {
33
+ position: "absolute",
34
+ left: ((x1 + x2) / 2) * scale - length / 2,
35
+ top: ((y1 + y2) / 2) * scale - thickness / 2,
36
+ width: length,
37
+ height: thickness,
38
+ borderRadius: thickness / 2,
39
+ backgroundColor: color,
40
+ transform: [{ rotate: `${(Math.atan2(y2 - y1, x2 - x1) * 180) / Math.PI}deg` }],
41
+ };
42
+ return (0, jsx_runtime_1.jsx)(react_native_1.View, { style: bar }, `${x1}-${y1}-${x2}-${y2}`);
43
+ }) }));
44
+ }
45
+ function ArrowGlyph({ direction, color, size = 16, }) {
46
+ return (0, jsx_runtime_1.jsx)(LineGlyph, { segments: ARROW_UP, size: size, color: color, flip: direction === "down" });
47
+ }
48
+ function Button({ ui, label, variant, onPress, disabled = false, busy = false, tone = "default", testID, }) {
49
+ const { styles } = ui;
50
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { accessibilityRole: "button", accessibilityState: { disabled: disabled || busy, busy }, disabled: disabled || busy, onPress: onPress, ...(testID === undefined ? {} : { testID }), style: ({ pressed }) => [
51
+ styles.button,
52
+ styles[variant],
53
+ pressed && styles[`${variant}Pressed`],
54
+ (disabled || busy) && styles.disabled,
55
+ ], children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.buttonLabel, variant === "primary" && styles.primaryLabel, tone === "link" && styles.linkLabel], numberOfLines: 2, children: label }) }));
56
+ }
57
+ /** `↑ n | ↓`: the down count stays private like ReleaseKit; tapping the active side clears the vote. */
58
+ function VoteCapsule({ ui, upvotes, myVote, onVote, busy }) {
59
+ const { styles, tokens, api, copy } = ui;
60
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.capsule, children: [(0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { testID: "theseeker-changes-upvote", accessibilityRole: "button", accessibilityLabel: `${api.t("upvote")}, ${copy.upvoteLabel(upvotes)}`, accessibilityState: { selected: myVote === 1, disabled: busy }, disabled: busy, onPress: () => onVote(myVote === 1 ? 0 : 1), style: ({ pressed }) => [
61
+ styles.capsuleSegment,
62
+ myVote === 1 && styles.segmentUp,
63
+ pressed && styles.segmentPressed,
64
+ ], children: [(0, jsx_runtime_1.jsx)(ArrowGlyph, { direction: "up", color: myVote === 1 ? tokens.accentInk : tokens.text }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.count, children: upvotes })] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.capsuleDivider }), (0, jsx_runtime_1.jsx)(react_native_1.Pressable, { testID: "theseeker-changes-downvote", accessibilityRole: "button", accessibilityLabel: api.t("downvote"), accessibilityState: { selected: myVote === -1, disabled: busy }, disabled: busy, onPress: () => onVote(myVote === -1 ? 0 : -1), style: ({ pressed }) => [
65
+ styles.capsuleSegment,
66
+ myVote === -1 && styles.segmentDown,
67
+ pressed && styles.segmentPressed,
68
+ ], children: (0, jsx_runtime_1.jsx)(ArrowGlyph, { direction: "down", color: tokens.text }) })] }));
69
+ }
70
+ function Checkbox({ ui, label, checked, onChange, }) {
71
+ const { styles, tokens } = ui;
72
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { testID: "theseeker-changes-guidelines", accessibilityRole: "checkbox", accessibilityState: { checked }, accessibilityLabel: label, onPress: () => onChange(!checked), style: styles.checkboxRow, children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: [styles.checkbox, checked && styles.checkboxChecked], children: checked ? (0, jsx_runtime_1.jsx)(LineGlyph, { segments: CHECK, size: 16, color: tokens.accentText }) : null }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.checkboxLabel, children: label })] }));
73
+ }
74
+ function Status({ ui, text, tone }) {
75
+ if (text === null)
76
+ return null;
77
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [ui.styles.status, tone === "error" && ui.styles.statusError], accessibilityLiveRegion: "polite", children: text }));
78
+ }
@@ -0,0 +1,31 @@
1
+ import type { Config, Platform } from "../core/types";
2
+ export type RatingStep = Readonly<{
3
+ kind: "native-review";
4
+ }> | Readonly<{
5
+ kind: "open";
6
+ url: string;
7
+ fallbackUrl?: string;
8
+ }>;
9
+ export type RatingPlanInput = Readonly<{
10
+ platform: Platform;
11
+ config: Pick<Config, "app" | "rating">;
12
+ /** `storeReview.isAvailableAsync()` resolved to true for an injected adapter. */
13
+ nativeAvailable: boolean;
14
+ /** Host opt-in: show the in-app review prompt before falling back to the store page. */
15
+ useNativeReview: boolean;
16
+ }>;
17
+ /** The adapter shape of `import * as StoreReview from "expo-store-review"`; injected, never imported. */
18
+ export type StoreReviewAdapter = Readonly<{
19
+ isAvailableAsync(): Promise<boolean>;
20
+ requestReview(): Promise<void>;
21
+ }>;
22
+ /** Ordered steps for the rating button; an empty plan means the button has nowhere to go. */
23
+ export declare function planRatingOpen(input: RatingPlanInput): readonly RatingStep[];
24
+ export declare function shouldShowRating(mode: Config["rating"]["mode"], myVote: -1 | 0 | 1): boolean;
25
+ export declare function ratingLabelKey(platform: Platform): "rateAppStore" | "ratePlay" | "rateWeb";
26
+ export type RatingRunner = Readonly<{
27
+ openUrl: (url: string) => Promise<unknown>;
28
+ requestReview?: () => Promise<void>;
29
+ }>;
30
+ /** Runs steps in order until one succeeds; `open` steps retry their fallback URL. Never throws. */
31
+ export declare function runRatingPlan(steps: readonly RatingStep[], runner: RatingRunner): Promise<boolean>;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.planRatingOpen = planRatingOpen;
4
+ exports.shouldShowRating = shouldShowRating;
5
+ exports.ratingLabelKey = ratingLabelKey;
6
+ exports.runRatingPlan = runRatingPlan;
7
+ const rating_1 = require("../core/rating");
8
+ function storeStep({ platform, config }) {
9
+ const { rating, app } = config;
10
+ switch (platform) {
11
+ case "ios": {
12
+ const url = rating.iosAppStoreId ? (0, rating_1.iosReviewUrl)(rating.iosAppStoreId) : (rating.reviewUrl ?? app.appStoreUrl);
13
+ return url ? { kind: "open", url } : null;
14
+ }
15
+ case "android": {
16
+ if (rating.androidPackage) {
17
+ const { market, web } = (0, rating_1.androidReviewUrls)(rating.androidPackage);
18
+ return { kind: "open", url: market, fallbackUrl: web };
19
+ }
20
+ const url = rating.reviewUrl ?? app.playStoreUrl;
21
+ return url ? { kind: "open", url } : null;
22
+ }
23
+ case "web": {
24
+ const url = rating.reviewUrl ?? app.appStoreUrl ?? app.playStoreUrl;
25
+ return url ? { kind: "open", url } : null;
26
+ }
27
+ default: {
28
+ const exhaustive = platform;
29
+ return exhaustive;
30
+ }
31
+ }
32
+ }
33
+ /** Ordered steps for the rating button; an empty plan means the button has nowhere to go. */
34
+ function planRatingOpen(input) {
35
+ const store = storeStep(input);
36
+ const native = input.platform !== "web" && input.useNativeReview && input.nativeAvailable;
37
+ return [...(native ? [{ kind: "native-review" }] : []), ...(store === null ? [] : [store])];
38
+ }
39
+ function shouldShowRating(mode, myVote) {
40
+ switch (mode) {
41
+ case "always":
42
+ return true;
43
+ case "after_upvote":
44
+ return myVote === 1;
45
+ case "off":
46
+ return false;
47
+ default: {
48
+ const exhaustive = mode;
49
+ return exhaustive;
50
+ }
51
+ }
52
+ }
53
+ function ratingLabelKey(platform) {
54
+ switch (platform) {
55
+ case "ios":
56
+ return "rateAppStore";
57
+ case "android":
58
+ return "ratePlay";
59
+ case "web":
60
+ return "rateWeb";
61
+ default: {
62
+ const exhaustive = platform;
63
+ return exhaustive;
64
+ }
65
+ }
66
+ }
67
+ async function attempt(action) {
68
+ try {
69
+ await action();
70
+ return true;
71
+ }
72
+ catch {
73
+ return false;
74
+ }
75
+ }
76
+ /** Runs steps in order until one succeeds; `open` steps retry their fallback URL. Never throws. */
77
+ async function runRatingPlan(steps, runner) {
78
+ for (const step of steps) {
79
+ switch (step.kind) {
80
+ case "native-review": {
81
+ const { requestReview } = runner;
82
+ if (requestReview && (await attempt(requestReview)))
83
+ return true;
84
+ break;
85
+ }
86
+ case "open": {
87
+ if (await attempt(() => runner.openUrl(step.url)))
88
+ return true;
89
+ const { fallbackUrl } = step;
90
+ if (fallbackUrl !== undefined && (await attempt(() => runner.openUrl(fallbackUrl))))
91
+ return true;
92
+ break;
93
+ }
94
+ default: {
95
+ const exhaustive = step;
96
+ return exhaustive;
97
+ }
98
+ }
99
+ }
100
+ return false;
101
+ }
@@ -0,0 +1,21 @@
1
+ import type { ChangesStorage } from "../core/storage";
2
+ import type { Config, Platform } from "../core/types";
3
+ export type ChangesLocale = "ko" | "en";
4
+ export type LocaleMode = "auto" | ChangesLocale;
5
+ /** AsyncStorage-compatible adapter; `removeItem` is accepted so `AsyncStorage` can be passed as-is. */
6
+ export type ChangesStorageAdapter = ChangesStorage & Readonly<{
7
+ removeItem?(key: string): unknown;
8
+ }>;
9
+ export type ResolvedStorage = Readonly<{
10
+ storage: ChangesStorage;
11
+ persistent: boolean;
12
+ }>;
13
+ /** Only iOS and Android are app callers; every other RN target (web, desktop) uses web semantics. */
14
+ export declare function resolvePlatform(os: string): Platform;
15
+ export declare function resolveAppVersion(prop: string | null | undefined): string | null;
16
+ /** Injected adapters can reject (AsyncStorage on a full disk); a failed read is a miss, a failed write is dropped. */
17
+ export declare function resolveStorage(prop: ChangesStorageAdapter | undefined, createFallback: () => ChangesStorage): ResolvedStorage;
18
+ export declare function resolveLocale(mode: LocaleMode, deviceLocale: string, config: Pick<Config, "defaultLocale" | "texts">): ChangesLocale;
19
+ /** `crypto.getRandomValues` when the runtime has it (Hermes with a polyfill, web); otherwise `random()`. */
20
+ export declare function createRandomBytes(crypto: unknown, random: () => number): (length: number) => Uint8Array;
21
+ export declare function deviceLocale(): string;