create-expo-updates-server 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/dist/template/README.md +1 -1
- package/dist/template/app/updates/[encodedKey]/page.tsx +55 -33
- package/dist/template/app/updates/devices/page.tsx +13 -7
- package/dist/template/app/updates/embedded/page.tsx +25 -13
- package/dist/template/app/updates/emergency-redirects/page.tsx +70 -38
- package/dist/template/app/updates/page.tsx +33 -20
- package/dist/template/components/admin/admin-shell.tsx +11 -5
- package/dist/template/components/admin/language-switcher.tsx +5 -2
- package/dist/template/components/ui/dialog.tsx +13 -4
- package/dist/template/components/ui/sheet.tsx +6 -2
- package/dist/template/components/ui/sidebar.tsx +62 -17
- package/dist/template/docs/admin-ui.md +18 -24
- package/dist/template/docs/device-targeting.md +4 -5
- package/dist/template/docs/getting-started.ru.md +11 -544
- package/dist/template/docs/index.md +1 -1
- package/dist/template/docs/installation-telemetry.md +4 -4
- package/dist/template/docs/operations-guide.md +1 -1
- package/dist/template/docs/ota-emergency-recovery.md +34 -57
- package/dist/template/docs/ru/admin-ui.md +29 -0
- package/dist/template/docs/ru/device-targeting.md +59 -0
- package/dist/template/docs/ru/doctor.md +98 -0
- package/dist/template/docs/ru/expo-app-setup.md +497 -0
- package/dist/template/docs/ru/getting-started.md +391 -0
- package/dist/template/docs/ru/index.md +50 -0
- package/dist/template/docs/ru/installation-telemetry.md +125 -0
- package/dist/template/docs/ru/npm-installer.md +71 -0
- package/dist/template/docs/ru/operations-guide.md +317 -0
- package/dist/template/docs/ru/ota-client-lifecycle.md +167 -0
- package/dist/template/docs/ru/ota-emergency-recovery.md +108 -0
- package/dist/template/docs/ru/ota-update-policy.md +67 -0
- package/dist/template/docs/ru/publishing-npm-installer.md +49 -0
- package/dist/template/docs/ru/supabase-setup.md +120 -0
- package/dist/template/docs/uk/admin-ui.md +29 -0
- package/dist/template/docs/uk/device-targeting.md +59 -0
- package/dist/template/docs/uk/doctor.md +98 -0
- package/dist/template/docs/uk/expo-app-setup.md +497 -0
- package/dist/template/docs/uk/getting-started.md +391 -0
- package/dist/template/docs/uk/index.md +50 -0
- package/dist/template/docs/uk/installation-telemetry.md +125 -0
- package/dist/template/docs/uk/npm-installer.md +71 -0
- package/dist/template/docs/uk/operations-guide.md +317 -0
- package/dist/template/docs/uk/ota-client-lifecycle.md +167 -0
- package/dist/template/docs/uk/ota-emergency-recovery.md +108 -0
- package/dist/template/docs/uk/ota-update-policy.md +67 -0
- package/dist/template/docs/uk/publishing-npm-installer.md +49 -0
- package/dist/template/docs/uk/supabase-setup.md +120 -0
- package/dist/template/package.json +1 -0
- package/dist/template/src/client/devices/analytics.tsx +21 -8
- package/dist/template/src/client/devices/device-name.tsx +3 -1
- package/dist/template/src/client/devices/registry.tsx +38 -19
- package/dist/template/src/client/devices/version-adoption-chart.tsx +22 -10
- package/dist/template/src/client/distribution-control.tsx +27 -14
- package/dist/template/src/client/guard-action-combobox.test.ts +1 -1
- package/dist/template/src/client/guard-action-combobox.tsx +16 -10
- package/dist/template/src/client/i18n/en.json +203 -1
- package/dist/template/src/client/i18n/language-switching.test.tsx +224 -0
- package/dist/template/src/client/i18n/messages.test.ts +102 -19
- package/dist/template/src/client/i18n/messages.ts +31 -16
- package/dist/template/src/client/i18n/provider.tsx +6 -3
- package/dist/template/src/client/i18n/ru.json +488 -0
- package/dist/template/src/client/i18n/uk.json +488 -0
- package/dist/template/src/client/i18n/use-formatters.ts +5 -0
- package/dist/template/src/client/update-audience-editor.tsx +18 -11
- package/dist/template/src/client/update-policy-editor.tsx +64 -39
- package/dist/template-manifest.json +224 -69
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import type { TranslationMessage } from "@/src/client/i18n/messages";
|
|
3
|
+
import { useI18n } from "@/src/client/i18n/provider";
|
|
2
4
|
|
|
3
5
|
import { Textarea } from "@/components/ui/textarea";
|
|
4
6
|
|
|
@@ -43,10 +45,11 @@ export default function UpdatePolicyEditor({
|
|
|
43
45
|
encodedKey: string;
|
|
44
46
|
onSaved: () => Promise<void>;
|
|
45
47
|
}) {
|
|
48
|
+
const { t, formatLocale } = useI18n();
|
|
46
49
|
const [policy, setPolicy] = useState<UpdatePolicy | null>(null);
|
|
47
50
|
const [payload, setPayload] = useState("");
|
|
48
51
|
const [error, setError] = useState("");
|
|
49
|
-
const [message, setMessage] = useState("");
|
|
52
|
+
const [message, setMessage] = useState<TranslationMessage>("");
|
|
50
53
|
const [saving, setSaving] = useState(false);
|
|
51
54
|
const [guardActions, setGuardActions] = useState<GuardActionItem[]>([]);
|
|
52
55
|
const [canWriteGuardActions, setCanWriteGuardActions] = useState(false);
|
|
@@ -90,7 +93,7 @@ export default function UpdatePolicyEditor({
|
|
|
90
93
|
if (!policy) {
|
|
91
94
|
return (
|
|
92
95
|
<Card className="rounded-xl border border-border bg-card p-5 text-sm shadow-none">
|
|
93
|
-
{error || "Loading update policy…"}
|
|
96
|
+
{t(error || "Loading update policy…")}
|
|
94
97
|
</Card>
|
|
95
98
|
);
|
|
96
99
|
}
|
|
@@ -169,7 +172,10 @@ export default function UpdatePolicyEditor({
|
|
|
169
172
|
if (
|
|
170
173
|
!option.id ||
|
|
171
174
|
!window.confirm(
|
|
172
|
-
|
|
175
|
+
t(
|
|
176
|
+
'Delete "{0}" from the action catalog? Existing policies are unaffected.',
|
|
177
|
+
[option.actionKey],
|
|
178
|
+
),
|
|
173
179
|
)
|
|
174
180
|
) {
|
|
175
181
|
return;
|
|
@@ -201,7 +207,9 @@ export default function UpdatePolicyEditor({
|
|
|
201
207
|
const trimmedPayload = payload.trim();
|
|
202
208
|
guard = {
|
|
203
209
|
action: policy.guard.action,
|
|
204
|
-
...(trimmedPayload
|
|
210
|
+
...(trimmedPayload
|
|
211
|
+
? { payload: JSON.parse(trimmedPayload) }
|
|
212
|
+
: {}),
|
|
205
213
|
};
|
|
206
214
|
}
|
|
207
215
|
const saved = await putUpdatePolicy(
|
|
@@ -211,7 +219,10 @@ export default function UpdatePolicyEditor({
|
|
|
211
219
|
);
|
|
212
220
|
setPolicy(saved);
|
|
213
221
|
setPayload(payloadText(saved.guard));
|
|
214
|
-
setMessage(
|
|
222
|
+
setMessage({
|
|
223
|
+
key: "Policy saved as version {0}.",
|
|
224
|
+
values: [saved.policyVersion],
|
|
225
|
+
});
|
|
215
226
|
await onSaved();
|
|
216
227
|
} catch (saveError: unknown) {
|
|
217
228
|
setError(
|
|
@@ -228,16 +239,18 @@ export default function UpdatePolicyEditor({
|
|
|
228
239
|
<Card className="gap-4 p-5 shadow-none">
|
|
229
240
|
<div className="flex flex-wrap items-center justify-between gap-3">
|
|
230
241
|
<div>
|
|
231
|
-
<h2 className="font-semibold">Update policy</h2>
|
|
242
|
+
<h2 className="font-semibold">{t("Update policy")}</h2>
|
|
232
243
|
<p className="text-xs text-muted-foreground">
|
|
233
|
-
Version {policy.policyVersion}
|
|
244
|
+
{t("Version {0}", [policy.policyVersion])}
|
|
234
245
|
{policy.publishedAt
|
|
235
|
-
?
|
|
236
|
-
|
|
246
|
+
? t(" · published {0}", [
|
|
247
|
+
new Date(policy.publishedAt).toLocaleString(formatLocale),
|
|
248
|
+
])
|
|
249
|
+
: t(" · draft")}
|
|
237
250
|
</p>
|
|
238
251
|
</div>
|
|
239
252
|
<label className="text-sm">
|
|
240
|
-
Delivery{" "}
|
|
253
|
+
{t("Delivery")}{" "}
|
|
241
254
|
<NativeSelect
|
|
242
255
|
value={policy.delivery}
|
|
243
256
|
disabled={editingDisabled}
|
|
@@ -249,40 +262,46 @@ export default function UpdatePolicyEditor({
|
|
|
249
262
|
}
|
|
250
263
|
className="rounded-md border border-input bg-background px-2 py-2 "
|
|
251
264
|
>
|
|
252
|
-
<option value="manual">Manual</option>
|
|
253
|
-
<option value="background">Background</option>
|
|
265
|
+
<option value="manual">{t("Manual")}</option>
|
|
266
|
+
<option value="background">{t("Background")}</option>
|
|
254
267
|
</NativeSelect>
|
|
255
268
|
</label>
|
|
256
269
|
</div>
|
|
257
270
|
|
|
258
271
|
{readOnly ? (
|
|
259
272
|
<div className="rounded-md border border-border bg-muted/30 p-3 text-sm ">
|
|
260
|
-
|
|
261
|
-
|
|
273
|
+
{t(
|
|
274
|
+
"Published policies are read-only. Publish a new update ID to change policy.",
|
|
275
|
+
)}
|
|
262
276
|
</div>
|
|
263
277
|
) : null}
|
|
264
278
|
{policy.guard && policy.delivery === "manual" ? (
|
|
265
279
|
<div className="rounded-md border border-blue-300 bg-blue-50 p-3 text-sm text-blue-900 dark:border-blue-800 dark:bg-blue-950/30 dark:text-blue-200">
|
|
266
|
-
<strong>Note
|
|
267
|
-
|
|
268
|
-
|
|
280
|
+
<strong>{t("Note:")}</strong>{" "}
|
|
281
|
+
{t(
|
|
282
|
+
"a Guard is usually paired with Background delivery so the candidate can fetch silently. Activation is still allowed.",
|
|
283
|
+
)}
|
|
269
284
|
</div>
|
|
270
285
|
) : null}
|
|
271
|
-
{error ? <p className="text-sm text-red-600">{error}</p> : null}
|
|
272
|
-
{message ?
|
|
286
|
+
{error ? <p className="text-sm text-red-600">{t(error)}</p> : null}
|
|
287
|
+
{message ? (
|
|
288
|
+
<p className="text-sm text-emerald-600">{t(message)}</p>
|
|
289
|
+
) : null}
|
|
273
290
|
{catalogError ? (
|
|
274
291
|
<div
|
|
275
292
|
role="status"
|
|
276
293
|
className="flex items-center gap-2 text-sm text-amber-700 dark:text-amber-300"
|
|
277
294
|
>
|
|
278
|
-
<span>
|
|
295
|
+
<span>
|
|
296
|
+
{t("Action catalog:")} {t(catalogError)}
|
|
297
|
+
</span>
|
|
279
298
|
<Button
|
|
280
299
|
variant="outline"
|
|
281
300
|
size="sm"
|
|
282
301
|
type="button"
|
|
283
302
|
onClick={() => void loadGuardActions()}
|
|
284
303
|
>
|
|
285
|
-
Retry
|
|
304
|
+
{t("Retry")}
|
|
286
305
|
</Button>
|
|
287
306
|
</div>
|
|
288
307
|
) : null}
|
|
@@ -292,7 +311,7 @@ export default function UpdatePolicyEditor({
|
|
|
292
311
|
className="flex flex-wrap items-end gap-2 rounded-md border border-border p-3 "
|
|
293
312
|
>
|
|
294
313
|
<label className="min-w-56 flex-1 text-xs text-muted-foreground">
|
|
295
|
-
Add action to catalog
|
|
314
|
+
{t("Add action to catalog")}
|
|
296
315
|
<TextInput
|
|
297
316
|
value={catalogCreateValue}
|
|
298
317
|
maxLength={100}
|
|
@@ -303,7 +322,7 @@ export default function UpdatePolicyEditor({
|
|
|
303
322
|
}}
|
|
304
323
|
aria-describedby="guard-action-catalog-create-help"
|
|
305
324
|
className="mt-1 w-full rounded border border-input bg-background p-2 text-sm "
|
|
306
|
-
placeholder="Reusable action name"
|
|
325
|
+
placeholder={t("Reusable action name")}
|
|
307
326
|
/>
|
|
308
327
|
</label>
|
|
309
328
|
<Button
|
|
@@ -312,32 +331,34 @@ export default function UpdatePolicyEditor({
|
|
|
312
331
|
type="submit"
|
|
313
332
|
disabled={catalogCreatePending}
|
|
314
333
|
>
|
|
315
|
-
{catalogCreatePending ? "Adding…" : "Add to catalog"}
|
|
334
|
+
{catalogCreatePending ? t("Adding…") : t("Add to catalog")}
|
|
316
335
|
</Button>
|
|
317
336
|
<p
|
|
318
337
|
id="guard-action-catalog-create-help"
|
|
319
338
|
className="w-full text-xs text-muted-foreground"
|
|
320
339
|
>
|
|
321
|
-
|
|
340
|
+
{t(
|
|
341
|
+
"Adds a reusable catalog item without changing this policy.",
|
|
342
|
+
)}
|
|
322
343
|
</p>
|
|
323
344
|
{catalogCreateError ? (
|
|
324
345
|
<div
|
|
325
346
|
role="status"
|
|
326
347
|
className="flex w-full items-center gap-2 text-xs text-amber-700 dark:text-amber-300"
|
|
327
348
|
>
|
|
328
|
-
<span>{catalogCreateError}</span>
|
|
349
|
+
<span>{t(catalogCreateError)}</span>
|
|
329
350
|
<Button variant="outline" size="sm" type="submit">
|
|
330
|
-
Retry
|
|
351
|
+
{t("Retry")}
|
|
331
352
|
</Button>
|
|
332
353
|
</div>
|
|
333
354
|
) : null}
|
|
334
355
|
</form>
|
|
335
356
|
) : null}
|
|
336
357
|
<div className="space-y-2 rounded-md border border-border p-3 ">
|
|
337
|
-
<h3 className="text-sm font-medium">Action catalog</h3>
|
|
358
|
+
<h3 className="text-sm font-medium">{t("Action catalog")}</h3>
|
|
338
359
|
{guardActions.length > 0 ? (
|
|
339
360
|
<ul
|
|
340
|
-
aria-label="Guard action catalog entries"
|
|
361
|
+
aria-label={t("Guard action catalog entries")}
|
|
341
362
|
className="max-h-40 space-y-1 overflow-auto"
|
|
342
363
|
>
|
|
343
364
|
{guardActions.map((item) => (
|
|
@@ -353,7 +374,9 @@ export default function UpdatePolicyEditor({
|
|
|
353
374
|
variant="destructive"
|
|
354
375
|
size="sm"
|
|
355
376
|
type="button"
|
|
356
|
-
aria-label={
|
|
377
|
+
aria-label={t("Delete {0} from action catalog", [
|
|
378
|
+
item.actionKey,
|
|
379
|
+
])}
|
|
357
380
|
onClick={() =>
|
|
358
381
|
void removeGuardAction({
|
|
359
382
|
id: item.id,
|
|
@@ -362,7 +385,7 @@ export default function UpdatePolicyEditor({
|
|
|
362
385
|
})
|
|
363
386
|
}
|
|
364
387
|
>
|
|
365
|
-
Delete
|
|
388
|
+
{t("Delete")}
|
|
366
389
|
</Button>
|
|
367
390
|
) : null}
|
|
368
391
|
</li>
|
|
@@ -370,14 +393,15 @@ export default function UpdatePolicyEditor({
|
|
|
370
393
|
</ul>
|
|
371
394
|
) : (
|
|
372
395
|
<p className="text-xs text-muted-foreground">
|
|
373
|
-
No catalog actions found.
|
|
396
|
+
{t("No catalog actions found.")}
|
|
374
397
|
</p>
|
|
375
398
|
)}
|
|
376
399
|
</div>
|
|
377
400
|
|
|
378
401
|
<div className="space-y-3 rounded-lg border border-input p-3 ">
|
|
379
402
|
<label className="flex items-center gap-2 text-sm font-medium">
|
|
380
|
-
<input
|
|
403
|
+
<input
|
|
404
|
+
className="size-4 rounded border-input accent-primary"
|
|
381
405
|
type="checkbox"
|
|
382
406
|
checked={policy.guard !== null}
|
|
383
407
|
disabled={editingDisabled}
|
|
@@ -393,11 +417,12 @@ export default function UpdatePolicyEditor({
|
|
|
393
417
|
if (!event.target.checked) setPayload("");
|
|
394
418
|
}}
|
|
395
419
|
/>
|
|
396
|
-
Guard enabled
|
|
420
|
+
{t("Guard enabled")}
|
|
397
421
|
</label>
|
|
398
422
|
<p className="text-xs text-muted-foreground">
|
|
399
|
-
|
|
400
|
-
|
|
423
|
+
{t(
|
|
424
|
+
"When enabled, this Guard applies unconditionally whenever this OTA is selected for a client.",
|
|
425
|
+
)}
|
|
401
426
|
</p>
|
|
402
427
|
{policy.guard ? (
|
|
403
428
|
<>
|
|
@@ -417,7 +442,7 @@ export default function UpdatePolicyEditor({
|
|
|
417
442
|
}
|
|
418
443
|
/>
|
|
419
444
|
<label className="block text-xs text-muted-foreground">
|
|
420
|
-
Optional custom JSON payload
|
|
445
|
+
{t("Optional custom JSON payload")}
|
|
421
446
|
<Textarea
|
|
422
447
|
value={payload}
|
|
423
448
|
disabled={editingDisabled}
|
|
@@ -429,7 +454,7 @@ export default function UpdatePolicyEditor({
|
|
|
429
454
|
</>
|
|
430
455
|
) : (
|
|
431
456
|
<p className="text-sm text-muted-foreground">
|
|
432
|
-
No Guard will be emitted in the update manifest.
|
|
457
|
+
{t("No Guard will be emitted in the update manifest.")}
|
|
433
458
|
</p>
|
|
434
459
|
)}
|
|
435
460
|
</div>
|
|
@@ -441,7 +466,7 @@ export default function UpdatePolicyEditor({
|
|
|
441
466
|
disabled={editingDisabled}
|
|
442
467
|
onClick={() => void save()}
|
|
443
468
|
>
|
|
444
|
-
Save policy
|
|
469
|
+
{t("Save policy")}
|
|
445
470
|
</Button>
|
|
446
471
|
</Card>
|
|
447
472
|
);
|