@marktiderman/genesis-cli 1.14.0 → 1.15.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.
@@ -125,7 +125,7 @@ LogBox.
125
125
  | unset or `production` | Genesis Starter | `com.example.genesisstarter` | `genesis-starter://` |
126
126
 
127
127
  All three install side by side, and each registers its own scheme, so a link opens the build it
128
- names (`genesis-starter-dev://check-in?gym=hilltop` in a development build). `src/lib/links.ts`
128
+ names (`genesis-starter-dev://check-in?location=hilltop` in a development build). `src/lib/links.ts`
129
129
  accepts every variant's scheme (the OS only delivers the one the build registered). Redirect URLs
130
130
  that use the scheme (Supabase Auth, OAuth clients) need each variant's. Any other value fails the
131
131
  build. Set it per EAS environment so
@@ -4,8 +4,8 @@ import { normalizeLink } from "@marktiderman/genesis-native";
4
4
  import { appSchemes, links } from "@/lib/links";
5
5
 
6
6
  describe("deep links", () => {
7
- it("opens the check-in from its documented link, gym and all", () => {
8
- expect(normalizeLink("genesis-starter://check-in?gym=hilltop", links)).toBe("/check-in?gym=hilltop");
7
+ it("opens the check-in from its documented link, location and all", () => {
8
+ expect(normalizeLink("genesis-starter://check-in?location=hilltop", links)).toBe("/check-in?location=hilltop");
9
9
  });
10
10
 
11
11
  it("answers to every variant's scheme, whatever config Metro served", () => {
@@ -15,7 +15,7 @@ describe("deep links", () => {
15
15
  expect(appSchemes("genesis-starter", ["genesis-starter-preview"])).toEqual(all);
16
16
  expect(appSchemes("genesis-starter", "custom")).toEqual([...all, "custom"]);
17
17
  // The app's own map, as built in this test (no APP_VARIANT): a development build's link still opens.
18
- expect(normalizeLink("genesis-starter-dev://check-in?gym=hilltop", links)).toBe("/check-in?gym=hilltop");
18
+ expect(normalizeLink("genesis-starter-dev://check-in?location=hilltop", links)).toBe("/check-in?location=hilltop");
19
19
  expect(normalizeLink("genesis-starter-preview://settings", links)).toBe("/settings");
20
20
  });
21
21
 
@@ -5,7 +5,7 @@ import { copy } from "@/copy";
5
5
  import { attachmentKinds, kindAllowsTopics } from "@/lib/chat";
6
6
  import { expectPathname, renderApp } from "./render-app";
7
7
 
8
- const checkIn = { id: "a1", kind: "check_in", ref: { title: "Hilltop Gym" } } as unknown as ChatAttachment;
8
+ const checkIn = { id: "a1", kind: "check_in", ref: { title: "Hilltop office" } } as unknown as ChatAttachment;
9
9
 
10
10
  describe("Messages", () => {
11
11
  it("opens a check-in from a conversation inside the Messages stack, so Back returns to it", async () => {
@@ -19,8 +19,8 @@ describe("Messages", () => {
19
19
  const call = <R,>(fn: unknown, mine: boolean) => (fn as (a: ChatAttachment, ctx: { mine: boolean }) => R)(checkIn, { mine });
20
20
  expect(call<{ label: string } | null>(kind.action, false)?.label).toBe(copy.messages.checkInAnswer);
21
21
  expect(call(kind.action, true)).toBeNull();
22
- expect(call(kind.subtitle, true)).toBe(`${copy.messages.checkInSent} · Hilltop Gym`);
23
- expect(call(kind.subtitle, false)).toBe("Hilltop Gym");
22
+ expect(call(kind.subtitle, true)).toBe(`${copy.messages.checkInSent} · Hilltop office`);
23
+ expect(call(kind.subtitle, false)).toBe("Hilltop office");
24
24
  expect(kind.title(checkIn)).toBe(copy.messages.checkInCard);
25
25
  });
26
26
 
@@ -463,3 +463,16 @@ describe("metro", () => {
463
463
  for (const name of genesis) expect(names, name).toContain(name);
464
464
  });
465
465
  });
466
+
467
+ describe("the sample check-in", () => {
468
+ // Answers are stored by field id and carried between versions by key: a renamed
469
+ // question gets a new id and key, so old answers never read as the new question.
470
+ it("names each question's id and key after what it asks", () => {
471
+ const form = JSON.parse(read("src/forms/check-in.json")) as { definition: { blocks: { kind: string; id: string; key?: string; label?: string }[] } };
472
+ const fields = form.definition.blocks.filter((b) => b.kind === "field");
473
+ for (const f of fields) expect(f.key, f.id).toBe(f.id);
474
+ const ids = fields.map((f) => f.id);
475
+ expect(ids).toEqual(expect.arrayContaining(["location", "member", "mood", "daysOnPlan", "tookBreaks"]));
476
+ for (const old of ["gym", "coach", "sessions", "slept", "energy", "class"]) expect(ids).not.toContain(old);
477
+ });
478
+ });
@@ -1,7 +1,7 @@
1
1
  import { copy } from "@/copy";
2
2
  import { CheckInScreen } from "@/lib/check-in-screen";
3
3
 
4
- /** The check-in from Home (and its link, `genesis-starter://check-in?gym=hilltop`). */
4
+ /** The check-in from Home (and its link, `genesis-starter://check-in?location=hilltop`). */
5
5
  export default function HomeCheckIn() {
6
6
  return <CheckInScreen backTitle={copy.home.title} />;
7
7
  }
@@ -10,9 +10,9 @@ export default function HomeScreen() {
10
10
  {copy.home.checkIn}
11
11
  </NativeButton>
12
12
  ) : null;
13
- // The same form opened from a link that fills in the gym, so that question is skipped.
13
+ // The same form opened from a link that fills in the location, so that question is skipped.
14
14
  const fromLink = starter.features.checkIn ? (
15
- <NativeButton testID="home-check-in-link" variant="outline" onPress={() => router.push("/check-in?gym=hilltop")}>
15
+ <NativeButton testID="home-check-in-link" variant="outline" onPress={() => router.push("/check-in?location=hilltop")}>
16
16
  {copy.home.checkInFromLink}
17
17
  </NativeButton>
18
18
  ) : null;
@@ -42,7 +42,7 @@ const en = {
42
42
  emptyTitle: "Your app starts here",
43
43
  emptyBody: "This is the first tab. Replace this screen with your own.",
44
44
  checkIn: "Try the check-in",
45
- checkInFromLink: "Check in at Hilltop Gym",
45
+ checkInFromLink: "Check in from the Hilltop office",
46
46
  },
47
47
  checkIn: {
48
48
  done: "Done",
@@ -3,59 +3,125 @@
3
3
  "schemaVersion": 1,
4
4
  "id": "weekly-check-in",
5
5
  "title": "Weekly check-in",
6
- "description": "About two minutes. Your coach reads every answer.",
7
- "layout": { "mode": "focus" },
8
- "settings": { "saveProgress": true },
6
+ "description": "About two minutes. Your team lead reads every answer.",
7
+ "layout": {
8
+ "mode": "focus"
9
+ },
10
+ "settings": {
11
+ "saveProgress": true
12
+ },
9
13
  "blocks": [
10
- { "kind": "content", "id": "welcome", "type": "heading", "text": "How was your week?" },
11
- { "kind": "content", "id": "intro", "type": "text", "text": "One question at a time. You can go back, and your answers are kept on this phone until you send them." },
14
+ {
15
+ "kind": "content",
16
+ "id": "welcome",
17
+ "type": "heading",
18
+ "text": "How was your week?"
19
+ },
20
+ {
21
+ "kind": "content",
22
+ "id": "intro",
23
+ "type": "text",
24
+ "text": "One question at a time. You can go back, and your answers are kept on this phone until you send them."
25
+ },
12
26
  {
13
27
  "kind": "field",
14
- "id": "gym",
15
- "key": "gym",
28
+ "id": "location",
29
+ "key": "location",
16
30
  "type": "single-choice",
17
- "label": "Which gym do you train at?",
31
+ "label": "Which office do you work from?",
18
32
  "required": true,
19
33
  "props": {
20
34
  "options": [
21
- { "value": "riverside", "label": "Riverside Gym", "description": "12 Mill Lane" },
22
- { "value": "hilltop", "label": "Hilltop Gym", "description": "3 Summit Road" },
23
- { "value": "harbour", "label": "Harbour Gym", "description": "Pier 4" }
35
+ {
36
+ "value": "riverside",
37
+ "label": "Riverside",
38
+ "description": "12 Mill Lane"
39
+ },
40
+ {
41
+ "value": "hilltop",
42
+ "label": "Hilltop",
43
+ "description": "3 Summit Road"
44
+ },
45
+ {
46
+ "value": "harbour",
47
+ "label": "Harbour",
48
+ "description": "Pier 4"
49
+ }
24
50
  ],
25
- "prefill": { "param": "gym", "hideWhenPrefilled": true }
51
+ "prefill": {
52
+ "param": "location",
53
+ "hideWhenPrefilled": true
54
+ }
26
55
  }
27
56
  },
28
57
  {
29
58
  "kind": "field",
30
- "id": "coach",
31
- "key": "coach",
59
+ "id": "member",
60
+ "key": "member",
32
61
  "type": "single-choice",
33
- "label": "Who coached you this week?",
34
- "description": "Only the coaches at your gym are listed.",
62
+ "label": "Who did you work with most this week?",
63
+ "description": "Only the people at your location are listed.",
35
64
  "required": true,
36
- "props": { "optionsFrom": { "source": "host", "key": "coaches", "filter": { "attribute": "gym", "field": "gym" } } }
65
+ "props": {
66
+ "optionsFrom": {
67
+ "source": "host",
68
+ "key": "members",
69
+ "filter": {
70
+ "attribute": "location",
71
+ "field": "location"
72
+ }
73
+ }
74
+ }
37
75
  },
38
- { "kind": "field", "id": "name", "key": "name", "type": "short-text", "label": "What should we call you?", "required": true },
39
76
  {
40
77
  "kind": "field",
41
- "id": "sessions",
42
- "key": "sessions",
43
- "type": "number",
44
- "label": "How many sessions did you train, {{field:name}}?",
78
+ "id": "mood",
79
+ "key": "mood",
80
+ "type": "rating",
81
+ "label": "How do you feel about this week?",
45
82
  "required": true,
46
- "props": { "min": 0, "max": 21, "step": 1 }
83
+ "props": {
84
+ "max": 5,
85
+ "display": "stars",
86
+ "lowLabel": "Rough",
87
+ "highLabel": "Great"
88
+ }
47
89
  },
48
- { "kind": "field", "id": "started", "key": "started", "type": "date", "label": "When did your current programme start?" },
49
90
  {
50
91
  "kind": "field",
51
- "id": "energy",
52
- "key": "energy",
53
- "type": "rating",
54
- "label": "How was your energy?",
92
+ "id": "name",
93
+ "key": "name",
94
+ "type": "short-text",
95
+ "label": "What should we call you?",
96
+ "required": true
97
+ },
98
+ {
99
+ "kind": "field",
100
+ "id": "daysOnPlan",
101
+ "key": "daysOnPlan",
102
+ "type": "number",
103
+ "label": "How many days did you get through your plan, {{field:name}}?",
55
104
  "required": true,
56
- "props": { "max": 5, "display": "stars", "lowLabel": "Drained", "highLabel": "Buzzing" }
105
+ "props": {
106
+ "min": 0,
107
+ "max": 7,
108
+ "step": 1
109
+ }
110
+ },
111
+ {
112
+ "kind": "field",
113
+ "id": "started",
114
+ "key": "started",
115
+ "type": "date",
116
+ "label": "When did your current project start?"
117
+ },
118
+ {
119
+ "kind": "field",
120
+ "id": "tookBreaks",
121
+ "key": "tookBreaks",
122
+ "type": "yes-no",
123
+ "label": "Did you take a proper break most days?"
57
124
  },
58
- { "kind": "field", "id": "slept", "key": "slept", "type": "yes-no", "label": "Did you sleep seven hours most nights?" },
59
125
  {
60
126
  "kind": "field",
61
127
  "id": "focus",
@@ -64,34 +130,84 @@
64
130
  "label": "What did you work on?",
65
131
  "props": {
66
132
  "options": [
67
- { "value": "strength", "label": "Strength" },
68
- { "value": "mobility", "label": "Mobility" },
69
- { "value": "endurance", "label": "Endurance" },
70
- { "value": "skills", "label": "Skills" }
133
+ {
134
+ "value": "planning",
135
+ "label": "Planning"
136
+ },
137
+ {
138
+ "value": "building",
139
+ "label": "Building"
140
+ },
141
+ {
142
+ "value": "meetings",
143
+ "label": "Meetings"
144
+ },
145
+ {
146
+ "value": "learning",
147
+ "label": "Learning"
148
+ }
71
149
  ],
72
- "other": { "label": "Something else" }
150
+ "other": {
151
+ "label": "Something else"
152
+ }
73
153
  }
74
154
  },
75
155
  {
76
156
  "kind": "field",
77
- "id": "class",
78
- "key": "class",
157
+ "id": "highlight",
158
+ "key": "highlight",
79
159
  "type": "single-choice",
80
- "label": "Which class did you enjoy most?",
160
+ "label": "Which part of the week went best?",
81
161
  "props": {
82
162
  "options": [
83
- { "value": "c01", "label": "Barbell basics" },
84
- { "value": "c02", "label": "Kettlebell flow" },
85
- { "value": "c03", "label": "Rowing intervals" },
86
- { "value": "c04", "label": "Open gym" },
87
- { "value": "c05", "label": "Olympic lifting" },
88
- { "value": "c06", "label": "Gymnastics skills" },
89
- { "value": "c07", "label": "Yoga for athletes" },
90
- { "value": "c08", "label": "Sprint club" },
91
- { "value": "c09", "label": "Strongman Saturday" },
92
- { "value": "c10", "label": "Core and conditioning" },
93
- { "value": "c11", "label": "Masters class" },
94
- { "value": "c12", "label": "Mobility lab" }
163
+ {
164
+ "value": "h01",
165
+ "label": "Monday stand-up"
166
+ },
167
+ {
168
+ "value": "h02",
169
+ "label": "Planning session"
170
+ },
171
+ {
172
+ "value": "h03",
173
+ "label": "Design review"
174
+ },
175
+ {
176
+ "value": "h04",
177
+ "label": "Pairing"
178
+ },
179
+ {
180
+ "value": "h05",
181
+ "label": "Customer call"
182
+ },
183
+ {
184
+ "value": "h06",
185
+ "label": "Demo day"
186
+ },
187
+ {
188
+ "value": "h07",
189
+ "label": "Retrospective"
190
+ },
191
+ {
192
+ "value": "h08",
193
+ "label": "Focus time"
194
+ },
195
+ {
196
+ "value": "h09",
197
+ "label": "Team lunch"
198
+ },
199
+ {
200
+ "value": "h10",
201
+ "label": "Training"
202
+ },
203
+ {
204
+ "value": "h11",
205
+ "label": "Workshop"
206
+ },
207
+ {
208
+ "value": "h12",
209
+ "label": "Friday wrap-up"
210
+ }
95
211
  ],
96
212
  "other": true
97
213
  }
@@ -100,22 +216,94 @@
100
216
  "kind": "content",
101
217
  "id": "tip",
102
218
  "type": "callout",
103
- "text": "Nearly done. The next questions help your coach plan next week.",
104
- "props": { "title": "Almost there", "tone": "success" }
105
- },
106
- { "kind": "field", "id": "recommend", "key": "recommend", "type": "nps", "label": "How likely are you to recommend us to a friend?" },
107
- { "kind": "field", "id": "email", "key": "email", "type": "email", "label": "Email for your weekly summary" },
108
- { "kind": "field", "id": "phone", "key": "phone", "type": "phone", "label": "A phone number your coach can text" },
109
- { "kind": "field", "id": "photo", "key": "photo", "type": "photo", "label": "A progress photo, if you like" },
110
- { "kind": "field", "id": "notes", "key": "notes", "type": "long-text", "label": "Anything else your coach should know?" }
219
+ "text": "Nearly done. The next questions help plan next week.",
220
+ "props": {
221
+ "title": "Almost there",
222
+ "tone": "success"
223
+ }
224
+ },
225
+ {
226
+ "kind": "field",
227
+ "id": "recommend",
228
+ "key": "recommend",
229
+ "type": "nps",
230
+ "label": "How likely are you to recommend us to a friend?"
231
+ },
232
+ {
233
+ "kind": "field",
234
+ "id": "email",
235
+ "key": "email",
236
+ "type": "email",
237
+ "label": "Email for your weekly summary"
238
+ },
239
+ {
240
+ "kind": "field",
241
+ "id": "phone",
242
+ "key": "phone",
243
+ "type": "phone",
244
+ "label": "A phone number we can text"
245
+ },
246
+ {
247
+ "kind": "field",
248
+ "id": "photo",
249
+ "key": "photo",
250
+ "type": "photo",
251
+ "label": "A photo from your week, if you like"
252
+ },
253
+ {
254
+ "kind": "field",
255
+ "id": "notes",
256
+ "key": "notes",
257
+ "type": "long-text",
258
+ "label": "Anything else we should know?"
259
+ }
111
260
  ],
112
- "endings": [{ "id": "done", "title": "Thanks, {{field:name}}", "description": "Your coach will reply before your next session." }]
261
+ "endings": [
262
+ {
263
+ "id": "done",
264
+ "title": "Thanks, {{field:name}}",
265
+ "description": "Your team lead will reply before next week."
266
+ }
267
+ ]
113
268
  },
114
- "contentTypes": [{ "type": "callout", "label": "Callout" }],
115
- "coaches": [
116
- { "value": "ada", "label": "Ada Park", "description": "Strength", "attributes": { "gym": "riverside" } },
117
- { "value": "grace", "label": "Grace Okafor", "description": "Mobility", "attributes": { "gym": ["riverside", "hilltop"] } },
118
- { "value": "alan", "label": "Alan Reyes", "description": "Endurance", "attributes": { "gym": "hilltop" } },
119
- { "value": "mina", "label": "Mina Sato", "description": "Olympic lifting", "attributes": { "gym": "harbour" } }
269
+ "contentTypes": [
270
+ {
271
+ "type": "callout",
272
+ "label": "Callout"
273
+ }
274
+ ],
275
+ "members": [
276
+ {
277
+ "value": "ada",
278
+ "label": "Ada Park",
279
+ "description": "Design",
280
+ "attributes": {
281
+ "location": "riverside"
282
+ }
283
+ },
284
+ {
285
+ "value": "grace",
286
+ "label": "Grace Okafor",
287
+ "description": "Engineering",
288
+ "attributes": {
289
+ "location": ["riverside", "hilltop"]
290
+ }
291
+ },
292
+ {
293
+ "value": "alan",
294
+ "label": "Alan Reyes",
295
+ "description": "Operations",
296
+ "attributes": {
297
+ "location": "hilltop"
298
+ }
299
+ },
300
+ {
301
+ "value": "mina",
302
+ "label": "Mina Sato",
303
+ "description": "Support",
304
+ "attributes": {
305
+ "location": "harbour"
306
+ }
307
+ }
120
308
  ]
121
309
  }
@@ -11,18 +11,18 @@ import { checkInDrafts, checkInForm, checkInHaptics, checkInHostOptions, checkIn
11
11
  /**
12
12
  * The check-in example (`features.checkIn`): one question per screen, the title in the native
13
13
  * header, a draft per signed-in user and the offline outbox. Open it with a link to fill in the
14
- * gym: `genesis-starter://check-in?gym=hilltop`. The Home tab shows it at `/check-in`; a check-in
14
+ * location: `genesis-starter://check-in?location=hilltop`. The Home tab shows it at `/check-in`; a check-in
15
15
  * card in a conversation opens it in the Messages stack (`/messages/check-in`), so Back returns
16
16
  * to the conversation. `backTitle` names the screen under it (left out, iOS uses that screen's title).
17
17
  */
18
18
  export function CheckInScreen({ backTitle }: { backTitle?: string }) {
19
- const params = useLocalSearchParams<{ gym?: string }>();
19
+ const params = useLocalSearchParams<{ location?: string }>();
20
20
  const { session } = useSession<Session>();
21
21
  const draft = useFormDraft(checkInForm, {
22
22
  store: checkInDrafts,
23
23
  respondent: session?.user.id ?? "signed-out",
24
24
  hostOptions: checkInHostOptions,
25
- linkParams: params.gym ? { gym: params.gym } : undefined,
25
+ linkParams: params.location ? { location: params.location } : undefined,
26
26
  });
27
27
  if (!starter.features.checkIn) return <Redirect href="/" />;
28
28
  return (
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The check-in example (`features.checkIn`): a sample form in focus layout, with every check-in
3
3
  * field type, an "Other" answer, a list filtered by an earlier answer, a searchable list, a
4
- * question a link can fill in (`?gym=hilltop`) and content steps. Drafts and the submit outbox
4
+ * question a link can fill in (`?location=hilltop`) and content steps. Drafts and the submit outbox
5
5
  * keep their data in AsyncStorage, so a check-in survives the app closing and waits offline.
6
6
  *
7
7
  * Submissions go to a stub `send` that answers like `submitResponse` would. Point it at your own
@@ -46,8 +46,8 @@ function load(raw: unknown): FormDefinition {
46
46
  /** The sample check-in, checked once when the app loads. */
47
47
  export const checkInForm: FormDefinition = load(sample.definition);
48
48
 
49
- /** The coaches the app supplies for the filtered question (`optionsFrom: { source: "host", key: "coaches" }`). */
50
- export const checkInHostOptions: Readonly<Record<string, readonly ChoiceOption[]>> = { coaches: sample.coaches };
49
+ /** The people the app supplies for the filtered question (`optionsFrom: { source: "host", key: "members" }`). */
50
+ export const checkInHostOptions: Readonly<Record<string, readonly ChoiceOption[]>> = { members: sample.members };
51
51
 
52
52
  /** Where check-in drafts are kept, by form and respondent. */
53
53
  export const checkInDrafts = createDraftStore(AsyncStorage);
@@ -29,7 +29,7 @@ export const links: LinkOptions = {
29
29
  hosts: genesisConfig.links.hosts,
30
30
  map: {
31
31
  ...(starter.features.notifications ? { "/notifications": "/notifications" } : {}),
32
- // The check-in example's link (`genesis-starter://check-in?gym=hilltop` fills in the gym; `genesis-starter-dev://` in a development build).
32
+ // The check-in example's link (`genesis-starter://check-in?location=hilltop` fills in the location; `genesis-starter-dev://` in a development build).
33
33
  ...(starter.features.checkIn ? { "/check-in": "/check-in" } : {}),
34
34
  // A message's push opens its thread (`data.url` = `/messages/<conversation>`).
35
35
  ...(starter.features.chat ? { "/messages": "/messages", "/messages/:id": "/messages/:id" } : {}),