@the-seeker/changes-react 0.3.0 → 0.4.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/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # @the-seeker/changes-react
2
2
 
3
- 제품 문서: https://docs.theseeker.io/changes/react
3
+ 제품 문서: https://docs.devstage.app/changes/react
4
+
5
+ 0.4.0은 서버 modes와 capabilities를 해석하는 공통 코어를 포함합니다. 웹 테마는 기존 `colorScheme`을 사용하며 RN 전용 `theme` prop과 다릅니다. 설정 재조회는 `reload()`를 사용하세요. 앱 연동 가이드: https://docs.devstage.app/llm/app-ui-guide
4
6
 
5
7
  devstage 체인지로그(Changes)를 웹 React 앱에 붙이는 SDK입니다. 새 버전 소식을 한 번만 띄우는
6
8
  What's New 시트, 읽지 않은 수 배지가 달린 체인지로그 버튼, 릴리스 목록, 추천·비추천, 스토어 평가
@@ -104,6 +104,32 @@ export declare function createChangesClient(options: ChangesClientOptions): {
104
104
  reviewUrl: string | null;
105
105
  }>;
106
106
  texts: Readonly<Record<string, Readonly<Record<string, string>>>>;
107
+ modes?: Readonly<{
108
+ v: number;
109
+ site: Readonly<{
110
+ published: boolean;
111
+ theme: "light" | "dark" | "system";
112
+ locales: readonly ("ko" | "en")[];
113
+ }>;
114
+ feedback: Readonly<{
115
+ siteEnabled: boolean;
116
+ mode: "one_way" | "two_way";
117
+ visibility: "private" | "public_board";
118
+ eligibility: "anyone" | "email" | "app_user";
119
+ anonymity: "off" | "others" | "full";
120
+ reviewBeforePublish: boolean;
121
+ }> | null;
122
+ updates: Readonly<{
123
+ enabled: boolean;
124
+ siteUpdatesEnabled: boolean;
125
+ pageUrl: string | null;
126
+ }> | null;
127
+ roadmap: Readonly<{
128
+ enabled: boolean;
129
+ votes: boolean;
130
+ }> | null;
131
+ capabilities: readonly string[];
132
+ }> | null | undefined;
107
133
  }>>>;
108
134
  listReleases(input?: ListOptions): Promise<ReleasesResult>;
109
135
  vote: (input: ReleaseWrite & Readonly<{
@@ -188,7 +214,7 @@ export declare function createChangesClient(options: ChangesClientOptions): {
188
214
  voted: boolean;
189
215
  }>>>;
190
216
  listReleaseRequests: (releaseId: string) => Promise<Result<readonly Readonly<{
191
- kind: "roadmap" | "feedback";
217
+ kind: "feedback" | "roadmap";
192
218
  title: string;
193
219
  }>[]>>;
194
220
  };
@@ -0,0 +1,16 @@
1
+ import type { AppModes, Config } from "./types";
2
+ export declare const UPDATES_CAPABILITIES: readonly ["updates.sheet", "updates.page", "updates.votes", "updates.comments", "updates.rating", "roadmap.view", "roadmap.votes"];
3
+ export type UpdatesCapability = (typeof UPDATES_CAPABILITIES)[number];
4
+ export type UpdatesModes = Readonly<{
5
+ enabled: boolean;
6
+ pageUrl: string | null;
7
+ votes: boolean;
8
+ comments: boolean;
9
+ rating: boolean;
10
+ roadmap: boolean;
11
+ roadmapVotes: boolean;
12
+ theme: AppModes["site"]["theme"];
13
+ locales: readonly ("ko" | "en")[];
14
+ capabilities: readonly UpdatesCapability[];
15
+ }>;
16
+ export declare function resolveUpdatesModes(config: Config): UpdatesModes;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UPDATES_CAPABILITIES = void 0;
4
+ exports.resolveUpdatesModes = resolveUpdatesModes;
5
+ exports.UPDATES_CAPABILITIES = [
6
+ "updates.sheet",
7
+ "updates.page",
8
+ "updates.votes",
9
+ "updates.comments",
10
+ "updates.rating",
11
+ "roadmap.view",
12
+ "roadmap.votes",
13
+ ];
14
+ function resolveUpdatesModes(config) {
15
+ const modes = config.modes;
16
+ const legacy = {
17
+ "updates.sheet": config.enabled,
18
+ "updates.page": config.page.enabled && config.page.url !== null,
19
+ "updates.votes": config.enabled && config.community.votesEnabled,
20
+ "updates.comments": config.enabled && config.community.commentsEnabled,
21
+ "updates.rating": config.enabled && config.rating.mode !== "off",
22
+ "roadmap.view": false,
23
+ "roadmap.votes": false,
24
+ };
25
+ const capabilities = exports.UPDATES_CAPABILITIES.filter((capability) => modes == null ? legacy[capability] : modes.capabilities.includes(capability));
26
+ const has = (capability) => capabilities.includes(capability);
27
+ return {
28
+ enabled: has("updates.sheet"),
29
+ pageUrl: has("updates.page") ? (modes == null ? config.page.url : (modes.updates?.pageUrl ?? null)) : null,
30
+ votes: has("updates.votes"),
31
+ comments: has("updates.comments"),
32
+ rating: has("updates.rating"),
33
+ roadmap: has("roadmap.view"),
34
+ roadmapVotes: has("roadmap.votes"),
35
+ theme: modes?.site.theme ?? "system",
36
+ locales: modes?.site.locales ?? ["ko", "en"],
37
+ capabilities,
38
+ };
39
+ }
@@ -181,12 +181,107 @@ export declare const releasesSchema: z.ZodReadonly<z.ZodObject<{
181
181
  }, z.core.$strip>>;
182
182
  export type Release = z.infer<typeof releaseSchema>;
183
183
  export type Releases = z.infer<typeof releasesSchema>;
184
+ export declare const appModesSchema: z.ZodReadonly<z.ZodObject<{
185
+ v: z.ZodNumber;
186
+ site: z.ZodReadonly<z.ZodObject<{
187
+ published: z.ZodBoolean;
188
+ theme: z.ZodCatch<z.ZodEnum<{
189
+ light: "light";
190
+ dark: "dark";
191
+ system: "system";
192
+ }>>;
193
+ locales: z.ZodReadonly<z.ZodCatch<z.ZodArray<z.ZodEnum<{
194
+ ko: "ko";
195
+ en: "en";
196
+ }>>>>;
197
+ }, z.core.$strip>>;
198
+ feedback: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
199
+ siteEnabled: z.ZodBoolean;
200
+ mode: z.ZodCatch<z.ZodEnum<{
201
+ one_way: "one_way";
202
+ two_way: "two_way";
203
+ }>>;
204
+ visibility: z.ZodCatch<z.ZodEnum<{
205
+ private: "private";
206
+ public_board: "public_board";
207
+ }>>;
208
+ eligibility: z.ZodCatch<z.ZodEnum<{
209
+ anyone: "anyone";
210
+ email: "email";
211
+ app_user: "app_user";
212
+ }>>;
213
+ anonymity: z.ZodCatch<z.ZodEnum<{
214
+ off: "off";
215
+ others: "others";
216
+ full: "full";
217
+ }>>;
218
+ reviewBeforePublish: z.ZodBoolean;
219
+ }, z.core.$strip>>>;
220
+ updates: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
221
+ enabled: z.ZodBoolean;
222
+ siteUpdatesEnabled: z.ZodBoolean;
223
+ pageUrl: z.ZodCatch<z.ZodNullable<z.ZodString>>;
224
+ }, z.core.$strip>>>;
225
+ roadmap: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
226
+ enabled: z.ZodBoolean;
227
+ votes: z.ZodBoolean;
228
+ }, z.core.$strip>>>;
229
+ capabilities: z.ZodReadonly<z.ZodCatch<z.ZodArray<z.ZodString>>>;
230
+ }, z.core.$strip>>;
231
+ export type AppModes = z.infer<typeof appModesSchema>;
184
232
  export declare const configSchema: z.ZodReadonly<z.ZodObject<{
185
233
  enabled: z.ZodBoolean;
186
234
  defaultLocale: z.ZodEnum<{
187
235
  ko: "ko";
188
236
  en: "en";
189
237
  }>;
238
+ modes: z.ZodOptional<z.ZodCatch<z.ZodNullable<z.ZodReadonly<z.ZodObject<{
239
+ v: z.ZodNumber;
240
+ site: z.ZodReadonly<z.ZodObject<{
241
+ published: z.ZodBoolean;
242
+ theme: z.ZodCatch<z.ZodEnum<{
243
+ light: "light";
244
+ dark: "dark";
245
+ system: "system";
246
+ }>>;
247
+ locales: z.ZodReadonly<z.ZodCatch<z.ZodArray<z.ZodEnum<{
248
+ ko: "ko";
249
+ en: "en";
250
+ }>>>>;
251
+ }, z.core.$strip>>;
252
+ feedback: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
253
+ siteEnabled: z.ZodBoolean;
254
+ mode: z.ZodCatch<z.ZodEnum<{
255
+ one_way: "one_way";
256
+ two_way: "two_way";
257
+ }>>;
258
+ visibility: z.ZodCatch<z.ZodEnum<{
259
+ private: "private";
260
+ public_board: "public_board";
261
+ }>>;
262
+ eligibility: z.ZodCatch<z.ZodEnum<{
263
+ anyone: "anyone";
264
+ email: "email";
265
+ app_user: "app_user";
266
+ }>>;
267
+ anonymity: z.ZodCatch<z.ZodEnum<{
268
+ off: "off";
269
+ others: "others";
270
+ full: "full";
271
+ }>>;
272
+ reviewBeforePublish: z.ZodBoolean;
273
+ }, z.core.$strip>>>;
274
+ updates: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
275
+ enabled: z.ZodBoolean;
276
+ siteUpdatesEnabled: z.ZodBoolean;
277
+ pageUrl: z.ZodCatch<z.ZodNullable<z.ZodString>>;
278
+ }, z.core.$strip>>>;
279
+ roadmap: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
280
+ enabled: z.ZodBoolean;
281
+ votes: z.ZodBoolean;
282
+ }, z.core.$strip>>>;
283
+ capabilities: z.ZodReadonly<z.ZodCatch<z.ZodArray<z.ZodString>>>;
284
+ }, z.core.$strip>>>>>;
190
285
  app: z.ZodReadonly<z.ZodObject<{
191
286
  name: z.ZodString;
192
287
  subtitle: z.ZodNullable<z.ZodString>;
@@ -363,22 +458,22 @@ export declare const roadmapVoteSchema: z.ZodReadonly<z.ZodObject<{
363
458
  export type RoadmapVote = z.infer<typeof roadmapVoteSchema>;
364
459
  export declare const releaseRequestSchema: z.ZodReadonly<z.ZodObject<{
365
460
  kind: z.ZodEnum<{
366
- roadmap: "roadmap";
367
461
  feedback: "feedback";
462
+ roadmap: "roadmap";
368
463
  }>;
369
464
  title: z.ZodString;
370
465
  }, z.core.$strip>>;
371
466
  export declare const releaseRequestsSchema: z.ZodPipe<z.ZodObject<{
372
467
  requests: z.ZodPipe<z.ZodArray<z.ZodUnknown>, z.ZodTransform<readonly Readonly<{
373
- kind: "roadmap" | "feedback";
468
+ kind: "feedback" | "roadmap";
374
469
  title: string;
375
470
  }>[], unknown[]>>;
376
471
  }, z.core.$strip>, z.ZodTransform<readonly Readonly<{
377
- kind: "roadmap" | "feedback";
472
+ kind: "feedback" | "roadmap";
378
473
  title: string;
379
474
  }>[], {
380
475
  requests: readonly Readonly<{
381
- kind: "roadmap" | "feedback";
476
+ kind: "feedback" | "roadmap";
382
477
  title: string;
383
478
  }>[];
384
479
  }>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stateSchema = exports.errorCodeSchema = exports.releaseRequestsSchema = exports.releaseRequestSchema = exports.roadmapVoteSchema = exports.ROADMAP_DISABLED = exports.roadmapSchema = exports.roadmapItemSchema = exports.roadmapStageSchema = exports.ROADMAP_STAGES = exports.commentsSchema = exports.threadSchema = exports.commentSchema = exports.configSchema = exports.releasesSchema = exports.releaseSchema = exports.voteSchema = exports.blockSchema = exports.inlineSchema = exports.platformSchema = void 0;
3
+ exports.stateSchema = exports.errorCodeSchema = exports.releaseRequestsSchema = exports.releaseRequestSchema = exports.roadmapVoteSchema = exports.ROADMAP_DISABLED = exports.roadmapSchema = exports.roadmapItemSchema = exports.roadmapStageSchema = exports.ROADMAP_STAGES = exports.commentsSchema = exports.threadSchema = exports.commentSchema = exports.configSchema = exports.appModesSchema = exports.releasesSchema = exports.releaseSchema = exports.voteSchema = exports.blockSchema = exports.inlineSchema = exports.platformSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.platformSchema = zod_1.z.enum(["web", "ios", "android"]);
6
6
  exports.inlineSchema = zod_1.z.union([
@@ -37,10 +37,48 @@ exports.releaseSchema = zod_1.z
37
37
  exports.releasesSchema = zod_1.z
38
38
  .object({ items: zod_1.z.array(exports.releaseSchema).readonly(), nextCursor: zod_1.z.string().nullable() })
39
39
  .readonly();
40
+ exports.appModesSchema = zod_1.z
41
+ .object({
42
+ v: zod_1.z.number().int().positive(),
43
+ site: zod_1.z
44
+ .object({
45
+ published: zod_1.z.boolean(),
46
+ theme: zod_1.z.enum(["light", "dark", "system"]).catch("system"),
47
+ locales: zod_1.z
48
+ .array(zod_1.z.enum(["ko", "en"]))
49
+ .min(1)
50
+ .catch(["ko"])
51
+ .readonly(),
52
+ })
53
+ .readonly(),
54
+ feedback: zod_1.z
55
+ .object({
56
+ siteEnabled: zod_1.z.boolean(),
57
+ mode: zod_1.z.enum(["one_way", "two_way"]).catch("one_way"),
58
+ visibility: zod_1.z.enum(["private", "public_board"]).catch("private"),
59
+ eligibility: zod_1.z.enum(["anyone", "email", "app_user"]).catch("email"),
60
+ anonymity: zod_1.z.enum(["off", "others", "full"]).catch("off"),
61
+ reviewBeforePublish: zod_1.z.boolean(),
62
+ })
63
+ .readonly()
64
+ .nullable(),
65
+ updates: zod_1.z
66
+ .object({
67
+ enabled: zod_1.z.boolean(),
68
+ siteUpdatesEnabled: zod_1.z.boolean(),
69
+ pageUrl: zod_1.z.string().url().nullable().catch(null),
70
+ })
71
+ .readonly()
72
+ .nullable(),
73
+ roadmap: zod_1.z.object({ enabled: zod_1.z.boolean(), votes: zod_1.z.boolean() }).readonly().nullable(),
74
+ capabilities: zod_1.z.array(zod_1.z.string()).catch([]).readonly(),
75
+ })
76
+ .readonly();
40
77
  exports.configSchema = zod_1.z
41
78
  .object({
42
79
  enabled: zod_1.z.boolean(),
43
80
  defaultLocale: zod_1.z.enum(["ko", "en"]),
81
+ modes: exports.appModesSchema.nullable().catch(null).optional(),
44
82
  app: zod_1.z
45
83
  .object({
46
84
  name: zod_1.z.string(),
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./core/types";
2
+ export * from "./core/modes";
2
3
  export * from "./core/client";
3
4
  export * from "./core/storage";
4
5
  export * from "./core/decide";
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.DEFAULT_TEXTS = exports.localStorageAdapter = exports.Blocks = exports.CommentsThread = exports.ReleaseCard = exports.ChangelogDialog = exports.ChangelogList = exports.ChangelogButton = exports.WhatsNewModal = exports.ChangesProviderMissingError = exports.useChanges = exports.ChangesProvider = exports.createMemoryVisitorStore = void 0;
18
18
  __exportStar(require("./core/types"), exports);
19
+ __exportStar(require("./core/modes"), exports);
19
20
  __exportStar(require("./core/client"), exports);
20
21
  __exportStar(require("./core/storage"), exports);
21
22
  __exportStar(require("./core/decide"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-seeker/changes-react",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -12,6 +12,12 @@
12
12
  },
13
13
  "sideEffects": false,
14
14
  "license": "MIT",
15
+ "scripts": {
16
+ "build": "tsc -p tsconfig.build.json",
17
+ "typecheck": "tsc --noEmit",
18
+ "test": "vitest run",
19
+ "prepublishOnly": "pnpm run typecheck && pnpm test && pnpm run build"
20
+ },
15
21
  "peerDependencies": {
16
22
  "react": ">=18",
17
23
  "react-dom": ">=18"
@@ -29,9 +35,5 @@
29
35
  "typescript": "^5",
30
36
  "vitest": "^5.1.1"
31
37
  },
32
- "scripts": {
33
- "build": "tsc -p tsconfig.build.json",
34
- "typecheck": "tsc --noEmit",
35
- "test": "vitest run"
36
- }
37
- }
38
+ "packageManager": "pnpm@12.1.0"
39
+ }