@youasked/react 0.4.1 → 0.6.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.
@@ -1,7 +1,8 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { type YouAskedUser } from "./client";
3
+ import { type NudgeSettings } from "./nudge";
3
4
  import { type Appearance } from "./theme";
4
- export declare const DEFAULT_API_URL = "https://youasked-api.adenteo.workers.dev";
5
+ export declare const DEFAULT_API_URL = "https://api.youasked.dev";
5
6
  export type YouAskedProps = {
6
7
  /** Publishable key (ya_pub_…). Safe to ship in client code. Not needed with `demo`. */
7
8
  appKey?: string;
@@ -34,7 +35,13 @@ export type YouAskedProps = {
34
35
  offset?: number;
35
36
  /** Show the corner card for replies, shipped requests and what's new. Turn off for previews embedded in a page. */
36
37
  cards?: boolean;
38
+ /**
39
+ * The occasional "Got an idea for <App>?" prompt. Set it up in the dashboard; this overrides it:
40
+ * false turns it off, true turns it on with the dashboard's (or default) settings, an object
41
+ * changes individual settings, e.g. `{ everyDays: 14, activeSeconds: 60 }`.
42
+ */
43
+ nudge?: boolean | Partial<NudgeSettings>;
37
44
  apiUrl?: string;
38
45
  children?: ReactNode;
39
46
  };
40
- export declare function YouAsked({ appKey, demo, cards, user, signature, ready, appearance, trigger, position, label, appName, appIcon, greeting, title, offset, apiUrl, children, }: YouAskedProps): import("react").JSX.Element;
47
+ export declare function YouAsked({ appKey, demo, cards, nudge: nudgeProp, user, signature, ready, appearance, trigger, position, label, appName, appIcon, greeting, title, offset, apiUrl, children, }: YouAskedProps): import("react").JSX.Element;
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type Status = "open" | "planned" | "in_progress" | "shipped" | "declined";
1
+ export type Status = "open" | "planned" | "in_progress" | "shipped" | "declined" | "pending";
2
2
  export type FeatureRequest = {
3
3
  id: string;
4
4
  /** Shown as YA-12; commits and PRs that say "closes YA-12" ship it. */
@@ -15,6 +15,9 @@ export type FeatureRequest = {
15
15
  path?: string;
16
16
  topic?: string;
17
17
  } | null;
18
+ /** Set when the team found this ask elsewhere ("reddit" or "appstore") and added it. */
19
+ source?: string;
20
+ sourceUrl?: string | null;
18
21
  /** First name of the person who asked, when they opted in to being thanked and it has shipped. */
19
22
  creditName: string | null;
20
23
  createdAt: number;
@@ -65,6 +68,9 @@ export type Config = {
65
68
  canCredit: boolean;
66
69
  unseen: Notice[];
67
70
  whatsNew: WhatsNew | null;
71
+ mode?: "test" | "live";
72
+ /** The occasional in-app prompt, as set in the dashboard. null when it's off. */
73
+ nudge?: import("./nudge").NudgeSettings | null;
68
74
  };
69
75
  export type NewRequest = {
70
76
  title: string;
@@ -83,6 +89,8 @@ export type RequestDetail = {
83
89
  attachments?: Attachment[];
84
90
  /** Whether this person asked to try it before it ships. */
85
91
  earlyAccess?: boolean;
92
+ /** The person wrote it and nobody else has joined in yet, so they can take it back. */
93
+ canDelete?: boolean;
86
94
  redirect?: string;
87
95
  };
88
96
  export type YouAskedUser = {
@@ -92,7 +100,11 @@ export type YouAskedUser = {
92
100
  };
93
101
  export declare class YouAskedError extends Error {
94
102
  code: string;
95
- constructor(code: string);
103
+ /** A ready-to-show sentence from the server, when it sent one (spam and rate-limit answers do). */
104
+ detail?: string | undefined;
105
+ constructor(code: string,
106
+ /** A ready-to-show sentence from the server, when it sent one (spam and rate-limit answers do). */
107
+ detail?: string | undefined);
96
108
  }
97
109
  export type ClientOptions = {
98
110
  appKey: string;
@@ -122,6 +134,9 @@ export declare function createClient({ appKey, apiUrl, user, signature }: Client
122
134
  path?: string;
123
135
  topic?: string;
124
136
  } | null;
137
+ /** Set when the team found this ask elsewhere ("reddit" or "appstore") and added it. */
138
+ source?: string;
139
+ sourceUrl?: string | null;
125
140
  /** First name of the person who asked, when they opted in to being thanked and it has shipped. */
126
141
  creditName: string | null;
127
142
  createdAt: number;
@@ -129,6 +144,9 @@ export declare function createClient({ appKey, apiUrl, user, signature }: Client
129
144
  mine: boolean;
130
145
  }>;
131
146
  upload: (image: Blob) => Promise<Attachment>;
147
+ remove: (id: string) => Promise<{
148
+ ok: true;
149
+ }>;
132
150
  earlyAccess: (id: string) => Promise<{
133
151
  earlyAccess: boolean;
134
152
  }>;
package/dist/context.d.ts CHANGED
@@ -23,9 +23,12 @@ export type Route = {
23
23
  } | {
24
24
  view: "board";
25
25
  tab?: "top" | "new" | "shipped";
26
- } | {
26
+ }
27
+ /** `from` is where Back goes: the list they opened it from. */
28
+ | {
27
29
  view: "detail";
28
30
  id: string;
31
+ from?: "home" | "board" | "mine";
29
32
  } | {
30
33
  view: "mine";
31
34
  };
package/dist/icons.d.ts CHANGED
@@ -11,4 +11,7 @@ export declare const IconBulb: () => import("react").JSX.Element;
11
11
  export declare const IconFrame: () => import("react").JSX.Element;
12
12
  export declare const IconSpark: () => import("react").JSX.Element;
13
13
  /** YouAsked's own mark for asking: a speech bubble with an up arrow (ask, and vote it up). */
14
- export declare const IconIdea: () => import("react").JSX.Element;
14
+ /** The ask mark: a speech bubble holding the vote arrow. `ink` colours the arrow; by default the background. */
15
+ export declare const IconIdea: ({ ink }: {
16
+ ink?: string;
17
+ }) => import("react").JSX.Element;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { YouAsked, DEFAULT_API_URL } from "./YouAsked";
2
+ export type { NudgeSettings } from "./nudge";
2
3
  export type { YouAskedProps } from "./YouAsked";
3
4
  export { useYouAsked, openYouAsked } from "./context";
4
5
  export type { OpenOptions } from "./context";