@eifi1/ui-kit 0.35.0 → 0.37.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 +35 -5
- package/dist/admin/role-select.d.ts +3 -2
- package/dist/admin/role-select.js +2 -0
- package/dist/admin/role-select.js.map +1 -1
- package/dist/components/amount-input.d.ts +2 -2
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/autocomplete.d.ts +2 -2
- package/dist/components/autocomplete.js +2 -1
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/button-look.d.ts +1 -1
- package/dist/components/button-look.js +9 -4
- package/dist/components/button-look.js.map +1 -1
- package/dist/components/checkbox-group.d.ts +5 -2
- package/dist/components/checkbox-group.js +15 -4
- package/dist/components/checkbox-group.js.map +1 -1
- package/dist/components/column-mapper.d.ts +5 -3
- package/dist/components/column-mapper.js +2 -0
- package/dist/components/column-mapper.js.map +1 -1
- package/dist/components/combobox.d.ts +2 -2
- package/dist/components/combobox.js +2 -1
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/country-select.d.ts +3 -3
- package/dist/components/country-select.js +3 -0
- package/dist/components/country-select.js.map +1 -1
- package/dist/components/currency-select.d.ts +3 -2
- package/dist/components/currency-select.js +10 -1
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/date-field.d.ts +2 -1
- package/dist/components/date-field.js.map +1 -1
- package/dist/components/date-picker.js +3 -0
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-range-picker.js +3 -0
- package/dist/components/date-range-picker.js.map +1 -1
- package/dist/components/entity-combobox.d.ts +2 -2
- package/dist/components/entity-combobox.js +2 -1
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/field-parts.d.ts +66 -11
- package/dist/components/field-parts.js +32 -10
- package/dist/components/field-parts.js.map +1 -1
- package/dist/components/field-strip.d.ts +3 -2
- package/dist/components/field-strip.js +2 -1
- package/dist/components/field-strip.js.map +1 -1
- package/dist/components/field.d.ts +3 -2
- package/dist/components/field.js +24 -15
- package/dist/components/field.js.map +1 -1
- package/dist/components/help-popover.d.ts +9 -7
- package/dist/components/help-popover.js.map +1 -1
- package/dist/components/icon-picker.d.ts +3 -2
- package/dist/components/icon-picker.js +3 -0
- package/dist/components/icon-picker.js.map +1 -1
- package/dist/components/inline-entity-combobox.d.ts +2 -2
- package/dist/components/inline-entity-combobox.js +2 -1
- package/dist/components/inline-entity-combobox.js.map +1 -1
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +2 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/month-picker.d.ts +2 -1
- package/dist/components/month-picker.js +8 -1
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/multi-entity-combobox.d.ts +2 -2
- package/dist/components/multi-entity-combobox.js +2 -1
- package/dist/components/multi-entity-combobox.js.map +1 -1
- package/dist/components/multi-select.d.ts +2 -2
- package/dist/components/multi-select.js +3 -0
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/number-input.d.ts +2 -2
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numeric-field.d.ts +5 -2
- package/dist/components/numeric-field.js +4 -1
- package/dist/components/numeric-field.js.map +1 -1
- package/dist/components/one-time-code-input.d.ts +2 -1
- package/dist/components/one-time-code-input.js +2 -1
- package/dist/components/one-time-code-input.js.map +1 -1
- package/dist/components/phone-input.d.ts +1 -1
- package/dist/components/phone-input.js +4 -0
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/select.d.ts +4 -3
- package/dist/components/select.js +2 -1
- package/dist/components/select.js.map +1 -1
- package/dist/components/slider.d.ts +3 -2
- package/dist/components/slider.js +7 -1
- package/dist/components/slider.js.map +1 -1
- package/dist/components/stat-tile.js +2 -11
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/swatch-picker.d.ts +3 -2
- package/dist/components/swatch-picker.js +3 -0
- package/dist/components/swatch-picker.js.map +1 -1
- package/dist/components/text-link.js +3 -1
- package/dist/components/text-link.js.map +1 -1
- package/dist/components/textarea.d.ts +2 -1
- package/dist/components/textarea.js +9 -3
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/toggle-group.d.ts +2 -2
- package/dist/components/toggle-group.js +7 -3
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/eslint/index.js +1 -1
- package/dist/eslint/role-utilities.d.ts +34 -2
- package/dist/eslint/role-utilities.js +30 -9
- package/dist/eslint/role-utilities.js.map +1 -1
- package/dist/i18n/defaults.js +5 -1
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.js +97 -1
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +16 -0
- package/dist/i18n/kit-labels.js +21 -1
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/en.js +103 -2
- package/dist/i18n/locales/en.js.map +3 -3
- package/dist/i18n/locales/es.js +95 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +96 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +95 -1
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +96 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +95 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.js +13 -0
- package/dist/i18n/review.js.map +1 -1
- package/dist/i18n/shared-labels.js +3 -1
- package/dist/i18n/shared-labels.js.map +1 -1
- package/dist/index.d.ts +21 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/device-settings.d.ts +72 -0
- package/dist/lib/device-settings.js +64 -0
- package/dist/lib/device-settings.js.map +1 -0
- package/dist/lib/plain-text.d.ts +11 -0
- package/dist/lib/plain-text.js +16 -0
- package/dist/lib/plain-text.js.map +1 -0
- package/dist/lib/safe-storage.d.ts +6 -0
- package/dist/lib/safe-storage.js +11 -0
- package/dist/lib/safe-storage.js.map +1 -1
- package/dist/notifications/notification-parts.d.ts +39 -0
- package/dist/notifications/notification-parts.js +47 -0
- package/dist/notifications/notification-parts.js.map +1 -0
- package/dist/notifications/notification-types-setting.d.ts +62 -0
- package/dist/notifications/notification-types-setting.js +192 -0
- package/dist/notifications/notification-types-setting.js.map +1 -0
- package/dist/notifications/notification-types.d.ts +75 -0
- package/dist/notifications/notification-types.js +2 -0
- package/dist/notifications/notification-types.js.map +1 -0
- package/dist/notifications/notifications-labels.d.ts +131 -0
- package/dist/notifications/notifications-labels.js +83 -0
- package/dist/notifications/notifications-labels.js.map +1 -0
- package/dist/notifications/push-device-setting.d.ts +37 -0
- package/dist/notifications/push-device-setting.js +164 -0
- package/dist/notifications/push-device-setting.js.map +1 -0
- package/dist/notifications/push-devices-setting.d.ts +44 -0
- package/dist/notifications/push-devices-setting.js +203 -0
- package/dist/notifications/push-devices-setting.js.map +1 -0
- package/dist/notifications/quiet-hours-setting.d.ts +47 -0
- package/dist/notifications/quiet-hours-setting.js +131 -0
- package/dist/notifications/quiet-hours-setting.js.map +1 -0
- package/dist/notifications/time-zone-select.d.ts +50 -0
- package/dist/notifications/time-zone-select.js +76 -0
- package/dist/notifications/time-zone-select.js.map +1 -0
- package/dist/notifications/unsubscribe-panel.d.ts +53 -0
- package/dist/notifications/unsubscribe-panel.js +139 -0
- package/dist/notifications/unsubscribe-panel.js.map +1 -0
- package/dist/notifications/use-push-device.d.ts +122 -0
- package/dist/notifications/use-push-device.js +230 -0
- package/dist/notifications/use-push-device.js.map +1 -0
- package/dist/rhf/fields.d.ts +26 -19
- package/dist/rhf/fields.js +51 -22
- package/dist/rhf/fields.js.map +1 -1
- package/dist/settings/device-reset-setting-labels.d.ts +3 -0
- package/dist/settings/device-reset-setting-labels.js +15 -0
- package/dist/settings/device-reset-setting-labels.js.map +1 -0
- package/dist/settings/device-reset-setting.d.ts +58 -0
- package/dist/settings/device-reset-setting.js +51 -0
- package/dist/settings/device-reset-setting.js.map +1 -0
- package/dist/shell/app-shell.js +5 -0
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/theme/contrast-tokens.d.ts +42 -4
- package/dist/theme/contrast-tokens.js +56 -9
- package/dist/theme/contrast-tokens.js.map +1 -1
- package/dist/theme/contrast.d.ts +4 -2
- package/dist/theme/contrast.js +13 -0
- package/dist/theme/contrast.js.map +1 -1
- package/dist/theme/palette-derive.d.ts +15 -1
- package/dist/theme/palette-derive.js +37 -8
- package/dist/theme/palette-derive.js.map +1 -1
- package/dist/theme/palette-presets.d.ts +2 -1
- package/dist/theme/palette-presets.js +5 -5
- package/dist/theme/palette-presets.js.map +1 -1
- package/dist/theme/palette-store.js +6 -0
- package/dist/theme/palette-store.js.map +1 -1
- package/dist/theme/text-size.js +6 -0
- package/dist/theme/text-size.js.map +1 -1
- package/dist/theme/theme-store.js +6 -0
- package/dist/theme/theme-store.js.map +1 -1
- package/package.json +1 -1
- package/src/admin/role-select.tsx +4 -1
- package/src/components/amount-input.tsx +2 -1
- package/src/components/autocomplete.tsx +5 -2
- package/src/components/button-look.ts +15 -5
- package/src/components/checkbox-group.tsx +22 -4
- package/src/components/column-mapper.tsx +6 -2
- package/src/components/combobox.tsx +5 -2
- package/src/components/country-select.tsx +6 -1
- package/src/components/currency-select.tsx +12 -3
- package/src/components/date-field.tsx +2 -2
- package/src/components/date-picker.tsx +3 -0
- package/src/components/date-range-picker.tsx +3 -0
- package/src/components/entity-combobox.tsx +5 -2
- package/src/components/field-parts.tsx +107 -19
- package/src/components/field-strip.tsx +4 -3
- package/src/components/field.tsx +28 -15
- package/src/components/help-popover.tsx +9 -7
- package/src/components/icon-picker.tsx +8 -3
- package/src/components/inline-entity-combobox.tsx +5 -2
- package/src/components/input.tsx +4 -2
- package/src/components/month-picker.tsx +10 -3
- package/src/components/multi-entity-combobox.tsx +5 -2
- package/src/components/multi-select.tsx +6 -1
- package/src/components/number-input.tsx +2 -2
- package/src/components/numeric-field.ts +10 -2
- package/src/components/one-time-code-input.tsx +5 -3
- package/src/components/phone-input.tsx +4 -0
- package/src/components/popover.tsx +3 -1
- package/src/components/select.tsx +6 -3
- package/src/components/slider.tsx +10 -3
- package/src/components/stat-tile.tsx +3 -18
- package/src/components/swatch-picker.tsx +9 -4
- package/src/components/text-link.tsx +3 -1
- package/src/components/textarea.tsx +11 -4
- package/src/components/toggle-group.tsx +21 -5
- package/src/eslint/role-utilities.ts +67 -11
- package/src/i18n/defaults.ts +4 -0
- package/src/i18n/german.ts +113 -0
- package/src/i18n/kit-labels.tsx +52 -1
- package/src/i18n/locales/en.ts +6 -0
- package/src/i18n/locales/es.ts +106 -0
- package/src/i18n/locales/fr.ts +106 -0
- package/src/i18n/locales/hu.ts +104 -0
- package/src/i18n/locales/it.ts +105 -0
- package/src/i18n/locales/zh.ts +96 -0
- package/src/i18n/review.ts +13 -0
- package/src/i18n/shared-labels.ts +2 -0
- package/src/index.ts +50 -0
- package/src/lib/device-settings.ts +146 -0
- package/src/lib/plain-text.ts +22 -0
- package/src/lib/safe-storage.ts +16 -0
- package/src/notifications/notification-parts.tsx +83 -0
- package/src/notifications/notification-types-setting.tsx +309 -0
- package/src/notifications/notification-types.ts +80 -0
- package/src/notifications/notifications-labels.ts +238 -0
- package/src/notifications/push-device-setting.tsx +224 -0
- package/src/notifications/push-devices-setting.tsx +306 -0
- package/src/notifications/quiet-hours-setting.tsx +185 -0
- package/src/notifications/time-zone-select.tsx +126 -0
- package/src/notifications/unsubscribe-panel.tsx +203 -0
- package/src/notifications/use-push-device.ts +392 -0
- package/src/rhf/fields.tsx +77 -29
- package/src/settings/device-reset-setting-labels.ts +20 -0
- package/src/settings/device-reset-setting.tsx +119 -0
- package/src/shell/app-shell.tsx +8 -0
- package/src/theme/contrast-tokens.ts +106 -12
- package/src/theme/contrast.ts +30 -4
- package/src/theme/palette-derive.ts +68 -7
- package/src/theme/palette-presets.ts +9 -6
- package/src/theme/palette-store.ts +12 -0
- package/src/theme/text-size.ts +8 -0
- package/src/theme/theme-store.ts +10 -0
- package/tokens.css +38 -4
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { useId, useState } from "react";
|
|
2
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
import type { LabelOverride } from "../i18n/kit-labels";
|
|
5
|
+
import { cn } from "../lib/cn";
|
|
6
|
+
import { hasContent } from "../lib/presence";
|
|
7
|
+
import { Card } from "../components/card";
|
|
8
|
+
import { Select } from "../components/select";
|
|
9
|
+
import { Skeleton } from "../components/skeleton";
|
|
10
|
+
import { Switch } from "../components/switch";
|
|
11
|
+
import { SectionLabel } from "../components/text";
|
|
12
|
+
import { COMMIT_EXCEPT_BILLING } from "../components/write-lock";
|
|
13
|
+
import { CARD_DESCRIPTION_CLASS } from "../settings/settings-card-classes";
|
|
14
|
+
import { SettingsCardTitle } from "../settings/settings-heading";
|
|
15
|
+
import { settle, useMounted } from "../account/account-parts";
|
|
16
|
+
import { describeFailure, FailureLine, useNotificationsLabels, useWriteOverlay } from "./notification-parts";
|
|
17
|
+
import type { WriteOverlay } from "./notification-parts";
|
|
18
|
+
import type { NotificationsLabels } from "./notifications-labels";
|
|
19
|
+
import type {
|
|
20
|
+
DigestCadence,
|
|
21
|
+
NotificationSettingsPatch,
|
|
22
|
+
NotificationSwitches,
|
|
23
|
+
NotificationTypeEntry,
|
|
24
|
+
NotificationTypeGroup,
|
|
25
|
+
NotificationTypesValue,
|
|
26
|
+
} from "./notification-types";
|
|
27
|
+
|
|
28
|
+
/** Is this a development build? Dead code in a consumer's production bundle; on under
|
|
29
|
+
* vitest, where a type the card cannot draw is a bug a test should fail on (as
|
|
30
|
+
* `SettingsSection`'s catalogue check). */
|
|
31
|
+
function devChecks(): boolean {
|
|
32
|
+
return Boolean(import.meta.env?.DEV);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface NotificationTypesSettingProps<Id extends string = string>
|
|
36
|
+
extends Omit<ComponentPropsWithRef<"div">, "children" | "onChange"> {
|
|
37
|
+
/** The app's words for its types, in its order. Where an app types its ids. */
|
|
38
|
+
types: readonly NotificationTypeEntry<Id>[];
|
|
39
|
+
/** The `GET`'s `types` (§3.2); `undefined` while the first load runs. */
|
|
40
|
+
value: NotificationTypesValue | undefined;
|
|
41
|
+
/** The settings are loading. */
|
|
42
|
+
loading?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Save one change — `PATCH /notifications/settings` with this body: one switch per
|
|
45
|
+
* call (`{types: {digest: {app: true}}}`), or `{digest_cadence}`. The switch shows its
|
|
46
|
+
* new state while the call runs and goes back if it rejects; hand the card the
|
|
47
|
+
* PATCH's answer (or refetch) when it resolves.
|
|
48
|
+
*/
|
|
49
|
+
onChange: (patch: NotificationSettingsPatch<Id>) => Promise<unknown> | void;
|
|
50
|
+
/** Headings over the types, in the app's words (keksdose's three). Without them, one
|
|
51
|
+
* list in the order of `types`. In development every type the server answered must
|
|
52
|
+
* be in one. */
|
|
53
|
+
groups?: readonly NotificationTypeGroup<Id>[];
|
|
54
|
+
/** The digest type and the account's cadence: a cadence `Select` under that type
|
|
55
|
+
* while it is on. */
|
|
56
|
+
digest?: { type: Id; cadence: DigestCadence };
|
|
57
|
+
/** Under a type while it is on — keksdose's low-balance threshold field. */
|
|
58
|
+
renderExtra?: (id: Id) => ReactNode;
|
|
59
|
+
/** The account's address is unverified: every e-mail switch says
|
|
60
|
+
* `labels.emailUnverified` under it (decision 16). */
|
|
61
|
+
emailUnverified?: boolean;
|
|
62
|
+
/** Nothing can be changed (the switches stay readable). */
|
|
63
|
+
disabled?: boolean;
|
|
64
|
+
/** The app's own words for a failed save, or `undefined` for the kit's `failed`. */
|
|
65
|
+
describeError?: (error: unknown) => ReactNode | undefined;
|
|
66
|
+
labels?: LabelOverride<NotificationsLabels>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** One drawn type: the app's words and the server's switches. */
|
|
70
|
+
interface Row<Id extends string> {
|
|
71
|
+
entry: NotificationTypeEntry<Id>;
|
|
72
|
+
switches: NotificationSwitches;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** A switch's key in the write overlay. */
|
|
76
|
+
const switchKey = (id: string, channel: "app" | "email") => `${id}.${channel}`;
|
|
77
|
+
const CADENCE_KEY = "digest_cadence";
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* What the person hears about, and how (docs/notifications-harmonization.md §2.1–§2.3,
|
|
81
|
+
* §4.2): one row per type the SERVER answered, the app's words on it, a switch for "in
|
|
82
|
+
* the app" and "By e-mail" under it where the type offers mail. Where the app has no
|
|
83
|
+
* "in the app" channel (Kurvenschmiede), the e-mail switch is the row's own, with the
|
|
84
|
+
* type's label.
|
|
85
|
+
*
|
|
86
|
+
* **The server's list is the only list.** The card keeps no defaults and no list of
|
|
87
|
+
* types: it draws what `value` holds, in the order of `groups`, else of `types`. A type
|
|
88
|
+
* the app names that the server did not answer is not drawn (kastlan's tenant receives
|
|
89
|
+
* neither of its types). In development a type the server answered with no entry in
|
|
90
|
+
* `types`, or in no group when `groups` is given, throws — keksdose's compile-time
|
|
91
|
+
* `_EVERY_TYPE_IS_GROUPED`, now at run time, since the list is the server's.
|
|
92
|
+
*
|
|
93
|
+
* **Each flip saves at once**, one switch per call; the switch shows its new state while
|
|
94
|
+
* the call runs and goes back if it rejects, with the failure said under the card. The
|
|
95
|
+
* digest's cadence and the app's extra field (`renderExtra`) show under their type while
|
|
96
|
+
* it is on.
|
|
97
|
+
*
|
|
98
|
+
* Under a write lock the switches are `commit` controls exempt from billing: a lapsed
|
|
99
|
+
* plan never keeps a person from turning notifications off (billing §12.13).
|
|
100
|
+
*/
|
|
101
|
+
export function NotificationTypesSetting<Id extends string = string>({
|
|
102
|
+
types,
|
|
103
|
+
value,
|
|
104
|
+
loading,
|
|
105
|
+
onChange,
|
|
106
|
+
groups,
|
|
107
|
+
digest,
|
|
108
|
+
renderExtra,
|
|
109
|
+
emailUnverified = false,
|
|
110
|
+
disabled = false,
|
|
111
|
+
describeError,
|
|
112
|
+
labels: labelsProp,
|
|
113
|
+
className,
|
|
114
|
+
...rest
|
|
115
|
+
}: NotificationTypesSettingProps<Id>) {
|
|
116
|
+
const labels = useNotificationsLabels(labelsProp);
|
|
117
|
+
const overlay = useWriteOverlay<boolean>(value);
|
|
118
|
+
const cadenceOverlay = useWriteOverlay<DigestCadence>(digest?.cadence);
|
|
119
|
+
const [failure, setFailure] = useState<ReactNode>(null);
|
|
120
|
+
const mounted = useMounted();
|
|
121
|
+
const groupId = useId();
|
|
122
|
+
|
|
123
|
+
const answered = value ? Object.keys(value) : [];
|
|
124
|
+
const entries = new Map(types.map((entry) => [entry.id as string, entry]));
|
|
125
|
+
if (value && devChecks()) {
|
|
126
|
+
const unnamed = answered.filter((id) => !entries.has(id));
|
|
127
|
+
if (unnamed.length) {
|
|
128
|
+
throw new Error(
|
|
129
|
+
`NotificationTypesSetting: the server answered ${unnamed.map((id) => `"${id}"`).join(", ")} with no entry in \`types\` — give every type the server can send its words.`,
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
if (groups) {
|
|
133
|
+
const grouped = new Set<string>(groups.flatMap((group) => group.types));
|
|
134
|
+
const loose = answered.filter((id) => !grouped.has(id));
|
|
135
|
+
if (loose.length) {
|
|
136
|
+
throw new Error(
|
|
137
|
+
`NotificationTypesSetting: ${loose.map((id) => `"${id}"`).join(", ")} is in no group — a type in no group is drawn nowhere, and could not be turned off.`,
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const rowOf = (id: Id): Row<Id> | null => {
|
|
144
|
+
const switches = value?.[id];
|
|
145
|
+
const entry = entries.get(id);
|
|
146
|
+
if (!switches || !entry || (switches.app === null && switches.email === null)) return null;
|
|
147
|
+
return { entry, switches };
|
|
148
|
+
};
|
|
149
|
+
const rowsOf = (ids: readonly Id[]) => ids.map(rowOf).filter((row): row is Row<Id> => row !== null);
|
|
150
|
+
|
|
151
|
+
const shown = (id: string, channel: "app" | "email", server: boolean): boolean => {
|
|
152
|
+
const key = switchKey(id, channel);
|
|
153
|
+
return overlay.get(key) ?? server;
|
|
154
|
+
};
|
|
155
|
+
/** The row's own switch: `app`, or `email` where the app has no `app` channel. */
|
|
156
|
+
const rowOn = ({ entry, switches }: Row<Id>) =>
|
|
157
|
+
switches.app !== null
|
|
158
|
+
? shown(entry.id, "app", switches.app)
|
|
159
|
+
: shown(entry.id, "email", switches.email === true);
|
|
160
|
+
|
|
161
|
+
const save = <V,>(key: string, patch: NotificationSettingsPatch<Id>, which: WriteOverlay<V>, next: V) => {
|
|
162
|
+
if (which.pending(key)) return;
|
|
163
|
+
setFailure(null);
|
|
164
|
+
which.set(key, next);
|
|
165
|
+
settle(() => onChange(patch)).then(
|
|
166
|
+
() => {
|
|
167
|
+
if (mounted.current) which.settle(key, true);
|
|
168
|
+
},
|
|
169
|
+
(error: unknown) => {
|
|
170
|
+
if (!mounted.current) return;
|
|
171
|
+
which.settle(key, false);
|
|
172
|
+
setFailure(describeFailure(describeError?.(error), labels.failed));
|
|
173
|
+
},
|
|
174
|
+
);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const flip = (id: Id, channel: "app" | "email", on: boolean) =>
|
|
178
|
+
save(
|
|
179
|
+
switchKey(id, channel),
|
|
180
|
+
{ types: { [id]: { [channel]: on } } as NotificationSettingsPatch<Id>["types"] },
|
|
181
|
+
overlay,
|
|
182
|
+
on,
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
const cadence = cadenceOverlay.get(CADENCE_KEY) ?? digest?.cadence;
|
|
186
|
+
|
|
187
|
+
const unverifiedLine = emailUnverified ? (
|
|
188
|
+
<span className="block" data-email-unverified="">
|
|
189
|
+
{labels.emailUnverified}
|
|
190
|
+
</span>
|
|
191
|
+
) : null;
|
|
192
|
+
|
|
193
|
+
const renderRow = (row: Row<Id>) => {
|
|
194
|
+
const { entry, switches } = row;
|
|
195
|
+
const on = rowOn(row);
|
|
196
|
+
const emailOnly = switches.app === null;
|
|
197
|
+
const both = !emailOnly && switches.email !== null;
|
|
198
|
+
const cadenceSelect =
|
|
199
|
+
on && digest?.type === entry.id && cadence ? (
|
|
200
|
+
<Select
|
|
201
|
+
label={labels.digestCadence}
|
|
202
|
+
value={cadence}
|
|
203
|
+
disabled={disabled}
|
|
204
|
+
commit={COMMIT_EXCEPT_BILLING}
|
|
205
|
+
onChange={(event) => {
|
|
206
|
+
const next = event.target.value as DigestCadence;
|
|
207
|
+
if (next !== cadence) save(CADENCE_KEY, { digest_cadence: next }, cadenceOverlay, next);
|
|
208
|
+
}}
|
|
209
|
+
className="max-w-44"
|
|
210
|
+
>
|
|
211
|
+
<option value="weekly">{labels.digestWeekly}</option>
|
|
212
|
+
<option value="monthly">{labels.digestMonthly}</option>
|
|
213
|
+
</Select>
|
|
214
|
+
) : null;
|
|
215
|
+
const extra = on ? renderExtra?.(entry.id) : null;
|
|
216
|
+
const description =
|
|
217
|
+
emailOnly && unverifiedLine ? (
|
|
218
|
+
<>
|
|
219
|
+
{entry.description !== undefined && <span className="block">{entry.description}</span>}
|
|
220
|
+
{unverifiedLine}
|
|
221
|
+
</>
|
|
222
|
+
) : (
|
|
223
|
+
entry.description
|
|
224
|
+
);
|
|
225
|
+
return (
|
|
226
|
+
<div
|
|
227
|
+
key={entry.id}
|
|
228
|
+
data-notification-type={entry.id}
|
|
229
|
+
// A row with two switches is a group named by its type, so "By e-mail" is heard
|
|
230
|
+
// with the type it belongs to.
|
|
231
|
+
role={both ? "group" : undefined}
|
|
232
|
+
aria-label={both ? entry.label : undefined}
|
|
233
|
+
className="space-y-2"
|
|
234
|
+
>
|
|
235
|
+
<Switch
|
|
236
|
+
label={entry.label}
|
|
237
|
+
description={description}
|
|
238
|
+
checked={on}
|
|
239
|
+
disabled={disabled}
|
|
240
|
+
commit={COMMIT_EXCEPT_BILLING}
|
|
241
|
+
onCheckedChange={(next) => flip(entry.id, emailOnly ? "email" : "app", next)}
|
|
242
|
+
/>
|
|
243
|
+
{both && (
|
|
244
|
+
<div className="ps-4">
|
|
245
|
+
<Switch
|
|
246
|
+
size="sm"
|
|
247
|
+
label={labels.byEmail}
|
|
248
|
+
description={unverifiedLine ?? undefined}
|
|
249
|
+
checked={shown(entry.id, "email", switches.email === true)}
|
|
250
|
+
disabled={disabled}
|
|
251
|
+
commit={COMMIT_EXCEPT_BILLING}
|
|
252
|
+
onCheckedChange={(next) => flip(entry.id, "email", next)}
|
|
253
|
+
/>
|
|
254
|
+
</div>
|
|
255
|
+
)}
|
|
256
|
+
{(cadenceSelect || hasContent(extra)) && (
|
|
257
|
+
<div className="ps-4 space-y-2">
|
|
258
|
+
{cadenceSelect}
|
|
259
|
+
{extra}
|
|
260
|
+
</div>
|
|
261
|
+
)}
|
|
262
|
+
</div>
|
|
263
|
+
);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
let body: ReactNode;
|
|
267
|
+
if (loading || value === undefined) {
|
|
268
|
+
body = <Skeleton lines={3} label={labels.typesLoading} />;
|
|
269
|
+
} else if (groups) {
|
|
270
|
+
const drawn = groups
|
|
271
|
+
.map((group) => ({ group, rows: rowsOf(group.types) }))
|
|
272
|
+
.filter(({ rows }) => rows.length > 0);
|
|
273
|
+
body =
|
|
274
|
+
drawn.length === 0 ? (
|
|
275
|
+
<p className={CARD_DESCRIPTION_CLASS}>{labels.typesEmpty}</p>
|
|
276
|
+
) : (
|
|
277
|
+
drawn.map(({ group, rows }) => {
|
|
278
|
+
const headingId = `${groupId}-${group.id}`;
|
|
279
|
+
return (
|
|
280
|
+
<div key={group.id} role="group" aria-labelledby={headingId} className="space-y-3">
|
|
281
|
+
<SectionLabel as="div" size="xs" id={headingId}>
|
|
282
|
+
{group.label}
|
|
283
|
+
</SectionLabel>
|
|
284
|
+
{rows.map(renderRow)}
|
|
285
|
+
</div>
|
|
286
|
+
);
|
|
287
|
+
})
|
|
288
|
+
);
|
|
289
|
+
} else {
|
|
290
|
+
const rows = rowsOf(types.map((entry) => entry.id));
|
|
291
|
+
body =
|
|
292
|
+
rows.length === 0 ? (
|
|
293
|
+
<p className={CARD_DESCRIPTION_CLASS}>{labels.typesEmpty}</p>
|
|
294
|
+
) : (
|
|
295
|
+
<div className="space-y-3">{rows.map(renderRow)}</div>
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return (
|
|
300
|
+
<Card {...rest} className={cn("p-4 space-y-3", className)}>
|
|
301
|
+
<div>
|
|
302
|
+
<SettingsCardTitle>{labels.typesTitle}</SettingsCardTitle>
|
|
303
|
+
<div className={CARD_DESCRIPTION_CLASS}>{labels.typesDescription}</div>
|
|
304
|
+
</div>
|
|
305
|
+
{body}
|
|
306
|
+
<FailureLine>{failure}</FailureLine>
|
|
307
|
+
</Card>
|
|
308
|
+
);
|
|
309
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The shapes the notification cards share (docs/notifications-harmonization.md §3.2,
|
|
5
|
+
* §3.5, §4.2): the server's `GET /notifications/settings` answer, the parts of its
|
|
6
|
+
* `PATCH` the cards send, one push device, and the app's words for its types.
|
|
7
|
+
*
|
|
8
|
+
* Types only — the kit keeps no list of notification types and no defaults (§2.1): the
|
|
9
|
+
* server's registry is the one list, and the cards draw what it answers.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** The digest's cadence, one for the account (§2.5): Monday, or the 1st, in its zone. */
|
|
13
|
+
export type DigestCadence = "weekly" | "monthly";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* One type's two switches in the `GET` (§3.2). `null` where the type does not offer
|
|
17
|
+
* that channel: `email` for a type with no mail, `app` in an app with no "in the app"
|
|
18
|
+
* channel (Kurvenschmiede: `{app: null, email: true}`). An unset switch already reads as
|
|
19
|
+
* its default — the server fills it in.
|
|
20
|
+
*/
|
|
21
|
+
export interface NotificationSwitches {
|
|
22
|
+
app: boolean | null;
|
|
23
|
+
email: boolean | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** The `GET`'s `types`: every type the account can receive, in the registry's order. */
|
|
27
|
+
export type NotificationTypesValue = Readonly<Record<string, NotificationSwitches>>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The app's words for one of its types — where an app TYPES its ids, so its own maps
|
|
31
|
+
* (keksdose's inbox icons) are keyed on the same list (§5.1). The kit draws the type
|
|
32
|
+
* only when the server answered it.
|
|
33
|
+
*/
|
|
34
|
+
export interface NotificationTypeEntry<Id extends string = string> {
|
|
35
|
+
id: Id;
|
|
36
|
+
/** The switch's label: what the person hears about. */
|
|
37
|
+
label: string;
|
|
38
|
+
/** The line under it, attached to the switch. */
|
|
39
|
+
description?: ReactNode;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** A heading over some of the types, in the app's words (keksdose's "Budget", "Scans &
|
|
43
|
+
* sharing", "Summaries & news"). */
|
|
44
|
+
export interface NotificationTypeGroup<Id extends string = string> {
|
|
45
|
+
/** A stable key for the group. */
|
|
46
|
+
id: string;
|
|
47
|
+
label: ReactNode;
|
|
48
|
+
/** The group's types, in the order they are drawn. */
|
|
49
|
+
types: readonly Id[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The parts of `PATCH /notifications/settings` (§3.2) the cards send. Omitted keeps; a
|
|
54
|
+
* type's `null` puts both its switches back to their defaults; `quiet_hours_*: null`
|
|
55
|
+
* clears a time. One switch per call from the types card (`{types: {digest: {app:
|
|
56
|
+
* true}}}`), or `{digest_cadence}`; quiet hours send a time, with the device's zone the
|
|
57
|
+
* first time; the zone picker sends `{timezone}`.
|
|
58
|
+
*/
|
|
59
|
+
export interface NotificationSettingsPatch<Id extends string = string> {
|
|
60
|
+
types?: Partial<Record<Id, { app?: boolean; email?: boolean } | null>>;
|
|
61
|
+
digest_cadence?: DigestCadence;
|
|
62
|
+
quiet_hours_start?: string | null;
|
|
63
|
+
quiet_hours_end?: string | null;
|
|
64
|
+
timezone?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** One registered push device, as `GET /notifications/devices` lists it (§3.5), oldest
|
|
68
|
+
* first. The owner gets the whole endpoint, which marks "this device". */
|
|
69
|
+
export interface PushDeviceItem<Id extends string | number = string> {
|
|
70
|
+
id: Id;
|
|
71
|
+
endpoint: string;
|
|
72
|
+
/** The browser's user agent at registration; `null` when it sent none. */
|
|
73
|
+
user_agent: string | null;
|
|
74
|
+
/** ISO date-time. */
|
|
75
|
+
created_at: string;
|
|
76
|
+
/** ISO date-time of the last delivery the push service accepted, or `null`. */
|
|
77
|
+
last_success_at: string | null;
|
|
78
|
+
/** Failed deliveries in a row; the server removes the device at 10. */
|
|
79
|
+
failure_count: number;
|
|
80
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// The words of the notification cards (docs/notifications-harmonization.md §4.2), in a
|
|
2
|
+
// module with no component code: the English catalogue (src/i18n/defaults.ts) imports
|
|
3
|
+
// them without the components, so `en` loads as one chunk like the other languages
|
|
4
|
+
// (0.34, KS U8). The cards read it through `useKitLabels("notifications", …)`.
|
|
5
|
+
|
|
6
|
+
/** The ten IANA regions `Intl` lists zones under — keksdose's `tz_region_*` — in the
|
|
7
|
+
* kit's words. A region a runtime adds later keeps its IANA name. */
|
|
8
|
+
export interface NotificationRegionLabels {
|
|
9
|
+
Africa: string;
|
|
10
|
+
America: string;
|
|
11
|
+
Antarctica: string;
|
|
12
|
+
Arctic: string;
|
|
13
|
+
Asia: string;
|
|
14
|
+
Atlantic: string;
|
|
15
|
+
Australia: string;
|
|
16
|
+
Europe: string;
|
|
17
|
+
Indian: string;
|
|
18
|
+
Pacific: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Every string the notification parts render — the `notifications` namespace of
|
|
23
|
+
* `<UiKitProvider labels>`, overridable per instance through `labels`: the types card,
|
|
24
|
+
* quiet hours and the zone picker, this device's push, the device list, and the
|
|
25
|
+
* unsubscribe page. Cancel is `common.cancel`.
|
|
26
|
+
*/
|
|
27
|
+
export interface NotificationsLabels {
|
|
28
|
+
/* ── The types card ─────────────────────────────────────────────────── */
|
|
29
|
+
/** The types card's title. */
|
|
30
|
+
typesTitle: string;
|
|
31
|
+
/** The line under it. */
|
|
32
|
+
typesDescription: string;
|
|
33
|
+
/** The e-mail switch under a type that offers mail. */
|
|
34
|
+
byEmail: string;
|
|
35
|
+
/** Under every e-mail switch while the account's address is unverified (decision 16):
|
|
36
|
+
* no notification mail goes to an unverified address. */
|
|
37
|
+
emailUnverified: string;
|
|
38
|
+
/** The digest's cadence select. */
|
|
39
|
+
digestCadence: string;
|
|
40
|
+
digestWeekly: string;
|
|
41
|
+
digestMonthly: string;
|
|
42
|
+
/** While the settings load. */
|
|
43
|
+
typesLoading: string;
|
|
44
|
+
/** The server answered no types for this account. */
|
|
45
|
+
typesEmpty: string;
|
|
46
|
+
|
|
47
|
+
/* ── Quiet hours ────────────────────────────────────────────────────── */
|
|
48
|
+
quietTitle: string;
|
|
49
|
+
/** The line under the title; `inbox`: the app keeps an inbox, which a held push still
|
|
50
|
+
* reaches. */
|
|
51
|
+
quietDescription: (inbox: boolean) => string;
|
|
52
|
+
/** The start time's label. */
|
|
53
|
+
quietFrom: string;
|
|
54
|
+
/** The end time's label. */
|
|
55
|
+
quietUntil: string;
|
|
56
|
+
/** One time set, the other not: quiet hours fail open until both are. */
|
|
57
|
+
quietIncomplete: string;
|
|
58
|
+
/** The zone picker's label. */
|
|
59
|
+
timeZone: string;
|
|
60
|
+
/** Given the device's zone, as the picker names it, when it differs from the one the
|
|
61
|
+
* server applies. */
|
|
62
|
+
deviceZone: (zone: string) => string;
|
|
63
|
+
/** The button that takes the device's zone. */
|
|
64
|
+
useDeviceZone: string;
|
|
65
|
+
/** The zone picker's region headings. */
|
|
66
|
+
regions: NotificationRegionLabels;
|
|
67
|
+
|
|
68
|
+
/* ── This device ────────────────────────────────────────────────────── */
|
|
69
|
+
pushTitle: string;
|
|
70
|
+
pushDescription: string;
|
|
71
|
+
/** The browser has no push. */
|
|
72
|
+
unsupported: string;
|
|
73
|
+
/** iOS outside the installed app, given the app's name. */
|
|
74
|
+
iosInstall: (app: string) => string;
|
|
75
|
+
/** The server has no VAPID keys. */
|
|
76
|
+
notConfigured: string;
|
|
77
|
+
/** The browser's permission is denied. */
|
|
78
|
+
blocked: string;
|
|
79
|
+
/** This device gets notifications for the signed-in account. */
|
|
80
|
+
on: string;
|
|
81
|
+
off: string;
|
|
82
|
+
/** This browser's subscription belongs to another account. */
|
|
83
|
+
otherAccount: string;
|
|
84
|
+
enable: string;
|
|
85
|
+
disable: string;
|
|
86
|
+
sendTest: string;
|
|
87
|
+
/** Turning on did not finish (the permission prompt dismissed, a refusal). */
|
|
88
|
+
enableFailed: string;
|
|
89
|
+
/** No service worker, or one that is not ready in 10 s. */
|
|
90
|
+
noServiceWorker: string;
|
|
91
|
+
/** The browser's push service did not answer in 15 s. */
|
|
92
|
+
pushTimeout: string;
|
|
93
|
+
/** Given how many devices the push service accepted the test for (≥ 1). */
|
|
94
|
+
testSent: (count: number) => string;
|
|
95
|
+
/** The test reached no device. */
|
|
96
|
+
testNone: string;
|
|
97
|
+
testFailed: string;
|
|
98
|
+
/** The explainer before the browser's one permission prompt. */
|
|
99
|
+
explainerTitle: string;
|
|
100
|
+
explainerBody: (app: string) => string;
|
|
101
|
+
explainerHint: string;
|
|
102
|
+
explainerContinue: string;
|
|
103
|
+
|
|
104
|
+
/* ── The device list ────────────────────────────────────────────────── */
|
|
105
|
+
devicesTitle: string;
|
|
106
|
+
devicesDescription: string;
|
|
107
|
+
devicesLoading: string;
|
|
108
|
+
devicesEmpty: string;
|
|
109
|
+
/** A device whose user agent says nothing the kit recognises. */
|
|
110
|
+
unknownDevice: string;
|
|
111
|
+
/** The chip on this browser's row. */
|
|
112
|
+
thisDevice: string;
|
|
113
|
+
/** Given the registration date, formatted. */
|
|
114
|
+
added: (date: string) => string;
|
|
115
|
+
/** Given the last accepted delivery, formatted. */
|
|
116
|
+
lastDelivery: (date: string) => string;
|
|
117
|
+
noDelivery: string;
|
|
118
|
+
/** Given the failed deliveries in a row (≥ 1). */
|
|
119
|
+
failures: (count: number) => string;
|
|
120
|
+
/** A row's button, visible text — and the confirm's answer. */
|
|
121
|
+
remove: string;
|
|
122
|
+
/** The same button's accessible name, given the device: it starts with `remove`. */
|
|
123
|
+
removeItem: (device: string) => string;
|
|
124
|
+
/** The question the row asks before it removes. */
|
|
125
|
+
removePrompt: string;
|
|
126
|
+
|
|
127
|
+
/* ── The unsubscribe page ───────────────────────────────────────────── */
|
|
128
|
+
unsubscribeTitle: string;
|
|
129
|
+
/** Given the type's name in the app's words. */
|
|
130
|
+
unsubscribeAbout: (type: string) => string;
|
|
131
|
+
/** No type name to give. */
|
|
132
|
+
unsubscribeGeneric: string;
|
|
133
|
+
stopThese: string;
|
|
134
|
+
stopAll: (app: string) => string;
|
|
135
|
+
stoppedThese: string;
|
|
136
|
+
stoppedAll: (app: string) => string;
|
|
137
|
+
/** Account mail is not a notification, and keeps coming. */
|
|
138
|
+
accountMail: string;
|
|
139
|
+
turnBackOn: string;
|
|
140
|
+
openSettings: string;
|
|
141
|
+
/** A token the server refused, or one that does not parse. */
|
|
142
|
+
invalidLink: string;
|
|
143
|
+
|
|
144
|
+
/* ── Every card ─────────────────────────────────────────────────────── */
|
|
145
|
+
/** A request failed, and the app had no words of its own. */
|
|
146
|
+
failed: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export const DEFAULT_NOTIFICATIONS_LABELS: NotificationsLabels = {
|
|
150
|
+
typesTitle: "Notify me about",
|
|
151
|
+
typesDescription: "Choose what you hear about, and how.",
|
|
152
|
+
byEmail: "By e-mail",
|
|
153
|
+
emailUnverified: "Confirm your address to receive these.",
|
|
154
|
+
digestCadence: "Frequency",
|
|
155
|
+
digestWeekly: "Weekly",
|
|
156
|
+
digestMonthly: "Monthly",
|
|
157
|
+
typesLoading: "Loading notification settings…",
|
|
158
|
+
typesEmpty: "There are no notifications for this account.",
|
|
159
|
+
|
|
160
|
+
quietTitle: "Quiet hours",
|
|
161
|
+
quietDescription: (inbox) =>
|
|
162
|
+
inbox
|
|
163
|
+
? "No push notifications during this window. They still reach your inbox."
|
|
164
|
+
: "No push notifications during this window.",
|
|
165
|
+
quietFrom: "From",
|
|
166
|
+
quietUntil: "Until",
|
|
167
|
+
quietIncomplete: "Set both a start and an end time. Quiet hours take effect once both are set.",
|
|
168
|
+
timeZone: "Time zone",
|
|
169
|
+
deviceZone: (zone) => `This device is in ${zone}.`,
|
|
170
|
+
useDeviceZone: "Use it",
|
|
171
|
+
regions: {
|
|
172
|
+
Africa: "Africa",
|
|
173
|
+
America: "Americas",
|
|
174
|
+
Antarctica: "Antarctica",
|
|
175
|
+
Arctic: "Arctic",
|
|
176
|
+
Asia: "Asia",
|
|
177
|
+
Atlantic: "Atlantic",
|
|
178
|
+
Australia: "Australia",
|
|
179
|
+
Europe: "Europe",
|
|
180
|
+
Indian: "Indian Ocean",
|
|
181
|
+
Pacific: "Pacific",
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
pushTitle: "Push notifications",
|
|
185
|
+
pushDescription: "Notifications on this device, also while the app is closed.",
|
|
186
|
+
unsupported: "This browser doesn’t support push notifications.",
|
|
187
|
+
iosInstall: (app) =>
|
|
188
|
+
`On iPhone or iPad, add ${app} to your Home Screen first: iOS delivers notifications only to the installed app.`,
|
|
189
|
+
notConfigured: "Push notifications aren’t set up on this server.",
|
|
190
|
+
blocked: "Notifications are blocked in this browser’s settings.",
|
|
191
|
+
on: "Notifications are on for this device.",
|
|
192
|
+
off: "Notifications are off for this device.",
|
|
193
|
+
otherAccount:
|
|
194
|
+
"This browser gets notifications for another account. Turn them on here to get them for the account you’re signed in with.",
|
|
195
|
+
enable: "Turn on notifications",
|
|
196
|
+
disable: "Turn off",
|
|
197
|
+
sendTest: "Send a test",
|
|
198
|
+
enableFailed: "Couldn’t turn on notifications.",
|
|
199
|
+
noServiceWorker: "Couldn’t reach the app’s service worker. Reload the page and try again.",
|
|
200
|
+
pushTimeout: "The browser’s push service didn’t answer. Check your connection and try again.",
|
|
201
|
+
testSent: (count) => (count === 1 ? "Test sent to 1 device" : `Test sent to ${count} devices`),
|
|
202
|
+
testNone: "No device accepted the test. Turn notifications on for this device first.",
|
|
203
|
+
testFailed: "Couldn’t send a test notification.",
|
|
204
|
+
explainerTitle: "Turn on notifications?",
|
|
205
|
+
explainerBody: (app) =>
|
|
206
|
+
`${app} sends a notification only for the kinds you choose, and you can turn them off at any time.`,
|
|
207
|
+
explainerHint: "Your browser asks for permission next.",
|
|
208
|
+
explainerContinue: "Continue",
|
|
209
|
+
|
|
210
|
+
devicesTitle: "Notification devices",
|
|
211
|
+
devicesDescription: "Every device that gets push notifications for your account. Remove any you no longer use.",
|
|
212
|
+
devicesLoading: "Loading devices…",
|
|
213
|
+
devicesEmpty: "No device gets notifications yet.",
|
|
214
|
+
unknownDevice: "Unknown device",
|
|
215
|
+
thisDevice: "This device",
|
|
216
|
+
added: (date) => `Added ${date}`,
|
|
217
|
+
lastDelivery: (date) => `Last delivery ${date}`,
|
|
218
|
+
noDelivery: "No delivery yet",
|
|
219
|
+
failures: (count) =>
|
|
220
|
+
count === 1 ? "1 failed delivery in a row" : `${count} failed deliveries in a row`,
|
|
221
|
+
remove: "Remove",
|
|
222
|
+
removeItem: (device) => `Remove ${device}`,
|
|
223
|
+
removePrompt: "Stop sending notifications to this device?",
|
|
224
|
+
|
|
225
|
+
unsubscribeTitle: "E-mail notifications",
|
|
226
|
+
unsubscribeAbout: (type) => `You get e-mails about: ${type}.`,
|
|
227
|
+
unsubscribeGeneric: "You get notification e-mails.",
|
|
228
|
+
stopThese: "Stop these e-mails",
|
|
229
|
+
stopAll: (app) => `Stop all notification e-mails from ${app}`,
|
|
230
|
+
stoppedThese: "Done. You won’t get these e-mails any more.",
|
|
231
|
+
stoppedAll: (app) => `Done. You won’t get notification e-mails from ${app} any more.`,
|
|
232
|
+
accountMail: "E-mails about your account still come.",
|
|
233
|
+
turnBackOn: "You can turn them back on at any time in Settings.",
|
|
234
|
+
openSettings: "Open Settings",
|
|
235
|
+
invalidLink: "This link doesn’t work any more. You can turn e-mails off in Settings instead.",
|
|
236
|
+
|
|
237
|
+
failed: "That didn’t work. Please try again.",
|
|
238
|
+
};
|