@antelopejs/dms 0.21.4-next.999.g264d3a3 → 0.22.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/CHANGELOG.md +114 -0
- package/README.md +2 -2
- package/dist/e2e/mongo.d.mts +5 -5
- package/dist/e2e/processes.d.mts +18 -4
- package/dist/implementations/dms/page/preview-models.d.ts +0 -2
- package/dist/implementations/dms-base/phone-number.d.ts +1 -0
- package/dist/implementations/dms-base/phone-number.js +17 -0
- package/dist/implementations/dms-base/phone-number.js.map +1 -0
- package/dist/implementations/dms-notifications/index.d.ts +5 -1
- package/dist/implementations/dms-notifications/index.js +39 -11
- package/dist/implementations/dms-notifications/index.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/page-verify/accounts.d.ts +2 -2
- package/dist/mcp/page-verify/accounts.js +21 -13
- package/dist/mcp/page-verify/accounts.js.map +1 -1
- package/dist/pages/settings/users/invite-resend.d.ts +4 -0
- package/dist/pages/settings/users/invite-resend.js +27 -19
- package/dist/pages/settings/users/invite-resend.js.map +1 -1
- package/dist/pages/settings/users/invites.d.ts +2 -4
- package/dist/pages/settings/users/invites.js +4 -17
- package/dist/pages/settings/users/invites.js.map +1 -1
- package/dist/pages/settings/users/notifications.d.ts +4 -1
- package/dist/pages/settings/users/notifications.js +12 -4
- package/dist/pages/settings/users/notifications.js.map +1 -1
- package/dist/store/internal/frontend/dev-reload.d.ts +7 -4
- package/dist/store/internal/frontend/dev-reload.js +16 -17
- package/dist/store/internal/frontend/dev-reload.js.map +1 -1
- package/dist/utils/notification-email.d.ts +13 -0
- package/dist/utils/notification-email.js +37 -0
- package/dist/utils/notification-email.js.map +1 -0
- package/dist/utils/notification-registry/index.d.ts +1 -0
- package/dist/utils/notification-registry/index.js +1 -0
- package/dist/utils/notification-registry/index.js.map +1 -1
- package/e2e/database.mjs +9 -3
- package/e2e/mongo.mjs +5 -5
- package/e2e/processes.mjs +32 -9
- package/e2e/run-state.mjs +40 -2
- package/frontend-vue/eslint-globals.generated.mjs +17 -17
- package/frontend-vue/layers/dms-core/app/composables/page/useSiteLayout.ts +20 -14
- package/frontend-vue/layers/dms-core/app/types/row-action.ts +2 -0
- package/frontend-vue/layers/dms-core/i18n/locales/core-en-GB.json +1 -0
- package/frontend-vue/layers/dms-core/i18n/locales/core-fr-FR.json +1 -0
- package/frontend-vue/layers/dms-layout/app/build/components/layout/PageHeaderActionBar.vue +4 -8
- package/frontend-vue/layers/dms-layout/app/build/components/notification/NotificationPopover.vue +10 -2
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationInboxItem.vue +8 -2
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationMatrixSubject.vue +32 -1
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/NotificationPreferencesForm.vue +11 -1
- package/frontend-vue/layers/dms-layout/app/build/components/pages/settings/notification/notificationDisplay.ts +13 -0
- package/frontend-vue/layers/dms-layout/app/build/composables/notification/useNotificationCatalog.ts +16 -0
- package/frontend-vue/layers/dms-layout/app/build/composables/notification/useNotificationPreferences.ts +38 -3
- package/frontend-vue/layers/dms-layout/app/components/layout/DashboardSearch.vue +10 -0
- package/frontend-vue/layers/dms-layout/i18n/locales/layout-en-GB.json +4 -1
- package/frontend-vue/layers/dms-layout/i18n/locales/layout-fr-FR.json +4 -1
- package/frontend-vue/layers/dms-ui/app/build/components/button/DisabledReason.vue +27 -0
- package/frontend-vue/layers/dms-ui/app/build/components/containers/TargetComponentTree.vue +2 -0
- package/frontend-vue/layers/dms-ui/app/build/components/period/PeriodRangeCalendar.vue +1 -0
- package/frontend-vue/layers/dms-ui/app/build/components/stat/StatCell.vue +2 -11
- package/frontend-vue/layers/dms-ui/app/build/components/table/TableActions.vue +17 -17
- package/frontend-vue/layers/dms-ui/app/build/components/table/TablePagination.vue +1 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetHandlers.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/actions/actionTargetRows.ts +5 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupViewerShortcuts.ts +19 -9
- package/frontend-vue/layers/dms-ui/app/build/composables/confirm/fetchedConfirmDialog.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/defaultPrimitiveTypes.ts +12 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/global/shortcuts.ts +14 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/page/pageUrlValues.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionDescriptors.ts +47 -31
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionRendering.ts +19 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnActionSizing.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table/tableColumnTypes.ts +2 -0
- package/frontend-vue/layers/dms-ui/app/build/utils/phoneNumber.ts +143 -0
- package/frontend-vue/layers/dms-ui/app/components/form/components/DatePicker.vue +1 -0
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputCalendar.vue +1 -0
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputPhone.vue +165 -13
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputRelation.vue +3 -2
- package/frontend-vue/layers/dms-ui/app/components/form/components/InputRepeater.vue +32 -1
- package/frontend-vue/layers/dms-ui/app/components/kpi/KpiCard.vue +1 -6
- package/frontend-vue/layers/dms-ui/app/entries/components/button/DisabledReason.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/components/stat/StatCell.ts +2 -0
- package/frontend-vue/layers/dms-ui/app/entries/composables/global/shortcuts.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/entries/utils/phoneNumber.ts +1 -0
- package/frontend-vue/layers/dms-ui/app/types/row-action.ts +2 -0
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-en-GB.json +10 -1
- package/frontend-vue/layers/dms-ui/i18n/locales/ui-fr-FR.json +10 -1
- package/frontend-vue/package.json +1 -0
- package/package.json +6 -5
package/e2e/processes.mjs
CHANGED
|
@@ -93,31 +93,54 @@ function ephemeralRange() {
|
|
|
93
93
|
return { low, high };
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
/**
|
|
97
|
+
* @typedef {number & { readonly restartable: true }} RestartablePort A loopback port outside the kernel's ephemeral range, or any port where /proc does not tell the range. A function that takes one refuses a port from {@link freePort}, which a restart can fail to listen on again.
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @param {number} port A loopback port
|
|
102
|
+
* @returns {port is RestartablePort} Whether it lies outside the kernel's ephemeral range, or the range is unknown
|
|
103
|
+
*/
|
|
104
|
+
export function isRestartablePort(port) {
|
|
105
|
+
const range = ephemeralRange();
|
|
106
|
+
return range === null || port < range.low || port > range.high;
|
|
107
|
+
}
|
|
108
|
+
|
|
96
109
|
/**
|
|
97
110
|
* A free loopback port outside the kernel's ephemeral range, for a server
|
|
98
111
|
* that must listen on the same port again after it restarts. No outgoing
|
|
99
112
|
* connection takes such a port as its source port, so none can hold it in
|
|
100
113
|
* TIME_WAIT and make that listen fail with `EADDRINUSE`, as a port from
|
|
101
|
-
* {@link freePort} can be held.
|
|
102
|
-
* unprivileged port outside it is free, it is a port from {@link freePort}.
|
|
114
|
+
* {@link freePort} can be held.
|
|
103
115
|
*
|
|
104
|
-
* @returns {Promise<
|
|
116
|
+
* @returns {Promise<RestartablePort>} The port
|
|
117
|
+
* @throws When no unprivileged port outside the range is free
|
|
105
118
|
*/
|
|
106
119
|
export async function restartablePort() {
|
|
107
120
|
const range = ephemeralRange();
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const above = Math.max(LAST_PORT - range.high, 0);
|
|
111
|
-
if (below + above === 0) return
|
|
121
|
+
const below =
|
|
122
|
+
range === null ? 0 : Math.max(range.low - FIRST_UNPRIVILEGED_PORT, 0);
|
|
123
|
+
const above = range === null ? 0 : Math.max(LAST_PORT - range.high, 0);
|
|
124
|
+
if (range === null || below + above === 0) return restartableFree();
|
|
112
125
|
for (let attempt = 0; attempt < RESTARTABLE_PORT_ATTEMPTS; attempt += 1) {
|
|
113
126
|
const index = randomInt(below + above);
|
|
114
127
|
const port =
|
|
115
128
|
index < below
|
|
116
129
|
? FIRST_UNPRIVILEGED_PORT + index
|
|
117
130
|
: range.high + 1 + index - below;
|
|
118
|
-
if (await canListen(port)) return port;
|
|
131
|
+
if (isRestartablePort(port) && (await canListen(port))) return port;
|
|
119
132
|
}
|
|
120
|
-
|
|
133
|
+
throw new Error("no loopback port outside the ephemeral range is free");
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @returns {Promise<RestartablePort>} A port from {@link freePort}, where /proc does not tell the range
|
|
138
|
+
* @throws When the range is known and the port lies in it
|
|
139
|
+
*/
|
|
140
|
+
async function restartableFree() {
|
|
141
|
+
const port = await freePort();
|
|
142
|
+
if (isRestartablePort(port)) return port;
|
|
143
|
+
throw new Error("no loopback port outside the ephemeral range is free");
|
|
121
144
|
}
|
|
122
145
|
|
|
123
146
|
/**
|
package/e2e/run-state.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
rmSync,
|
|
9
9
|
writeFileSync,
|
|
10
10
|
} from "node:fs";
|
|
11
|
-
import { tmpdir } from "node:os";
|
|
11
|
+
import { platform, tmpdir } from "node:os";
|
|
12
12
|
import { join, resolve } from "node:path";
|
|
13
13
|
import { describeFailure } from "./failure.mjs";
|
|
14
14
|
import { assertSameNamespaces } from "./identity.mjs";
|
|
@@ -26,6 +26,9 @@ import {
|
|
|
26
26
|
} from "./json.mjs";
|
|
27
27
|
|
|
28
28
|
const RUN_FILE = "run.json";
|
|
29
|
+
const REPLACE_RETRY_MS = 2_000;
|
|
30
|
+
const REPLACE_POLL_MS = 5;
|
|
31
|
+
const REPLACE_PAUSE = new Int32Array(new SharedArrayBuffer(4));
|
|
29
32
|
const ID_BYTES = 3;
|
|
30
33
|
const TIMESTAMP_LENGTH = 15;
|
|
31
34
|
|
|
@@ -275,7 +278,42 @@ export function saveRun(state) {
|
|
|
275
278
|
writeFileSync(`${file}.next`, `${JSON.stringify(state, null, 2)}\n`, {
|
|
276
279
|
mode: 0o600,
|
|
277
280
|
});
|
|
278
|
-
|
|
281
|
+
replaceFile(`${file}.next`, file);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Renames `from` over `to`. Windows refuses with EPERM to replace a file
|
|
286
|
+
* another process holds open, as a service loading the run does for a
|
|
287
|
+
* moment, so there the rename is tried again until that read is done.
|
|
288
|
+
*
|
|
289
|
+
* @param {string} from The new file
|
|
290
|
+
* @param {string} to The file it replaces
|
|
291
|
+
* @throws When the rename fails for another reason, or Windows still refuses it after {@link REPLACE_RETRY_MS}
|
|
292
|
+
*/
|
|
293
|
+
function replaceFile(from, to) {
|
|
294
|
+
const deadline = Date.now() + REPLACE_RETRY_MS;
|
|
295
|
+
for (;;) {
|
|
296
|
+
try {
|
|
297
|
+
renameSync(from, to);
|
|
298
|
+
return;
|
|
299
|
+
} catch (error) {
|
|
300
|
+
if (!isHeldOpen(error) || Date.now() >= deadline) throw error;
|
|
301
|
+
Atomics.wait(REPLACE_PAUSE, 0, 0, REPLACE_POLL_MS);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* @param {unknown} error
|
|
308
|
+
* @returns {boolean}
|
|
309
|
+
*/
|
|
310
|
+
function isHeldOpen(error) {
|
|
311
|
+
return (
|
|
312
|
+
platform() === "win32" &&
|
|
313
|
+
error instanceof Error &&
|
|
314
|
+
"code" in error &&
|
|
315
|
+
error.code === "EPERM"
|
|
316
|
+
);
|
|
279
317
|
}
|
|
280
318
|
|
|
281
319
|
/**
|
|
@@ -172,20 +172,20 @@ describeFieldErrors detectDatetimeBuckets detectKeyboardPlatform
|
|
|
172
172
|
dispatchQuickActionTarget distributionMap downloadFile ensureApexLocale
|
|
173
173
|
evaluateRowActionRule extractRouteParams fieldErrorId
|
|
174
174
|
fieldValuesOfSubmitDefaults fillRouteParams findCascaderNode
|
|
175
|
-
findNavigableCategory firstAccessiblePagePath
|
|
176
|
-
focusFirstFormError foldBreadcrumb formIssueMessage
|
|
177
|
-
formatCascaderPath formatDate formatDateTime
|
|
178
|
-
formatKeyboardShortcut formatNumber
|
|
179
|
-
formatPrice formatRelativeDistance
|
|
180
|
-
formatValueParts getAppComposedText
|
|
181
|
-
heatmapRangeColors hideSearchTextMatches
|
|
182
|
-
injectPageHeaderActionsHost interpolateRowText
|
|
183
|
-
isAcceptanceField isAccountMenuRoute isActionEnabled
|
|
184
|
-
isBlankValue isBoolean isCalendarPreset
|
|
185
|
-
isClearedFieldValue isComposedText isConfirmFrom
|
|
186
|
-
isDefinitiveMetadataFailure isEligibleKanbanColumn
|
|
187
|
-
isFieldGroup isFieldMarkedRequired isFocusInsideOverlay
|
|
188
|
-
isFromAccountsList isFunction isJSON isKeyword isKnownTimeZone
|
|
175
|
+
findNavigableCategory findPageRoute firstAccessiblePagePath
|
|
176
|
+
flattenCascaderTree focusFirstFormError foldBreadcrumb formIssueMessage
|
|
177
|
+
formShowsActions formatCascaderPath formatDate formatDateTime
|
|
178
|
+
formatDeltaPercent formatDuration formatKeyboardShortcut formatNumber
|
|
179
|
+
formatPercentage formatPlainAxisValue formatPrice formatRelativeDistance
|
|
180
|
+
formatRelativeTime formatTime formatValue formatValueParts getAppComposedText
|
|
181
|
+
getAppTranslation getPluginI18n heatmapRangeColors hideSearchTextMatches
|
|
182
|
+
holdPageHeaderActions injectPageHeaderActionsHost interpolateRowText
|
|
183
|
+
interpolateUrl isAcceptanceField isAccountMenuRoute isActionEnabled
|
|
184
|
+
isActionVisible isBigint isBlankValue isBoolean isCalendarPreset
|
|
185
|
+
isCascaderNodeSelectable isClearedFieldValue isComposedText isConfirmFrom
|
|
186
|
+
isDarkSurface isDate isDefinitiveMetadataFailure isEligibleKanbanColumn
|
|
187
|
+
isFavoritePathValid isFieldGroup isFieldMarkedRequired isFocusInsideOverlay
|
|
188
|
+
isFoldedCrumbs isFromAccountsList isFunction isJSON isKeyword isKnownTimeZone
|
|
189
189
|
isLayoutBannerInScope isMenuItemActive isModuleAreaPath isNull isNumber
|
|
190
190
|
isObject isReducedMotionActive isRelativePreset isRichTextBlank
|
|
191
191
|
isSamePageQuery isSameRouteParams isSegmentChart isSidebarWidgetVisible
|
|
@@ -219,9 +219,9 @@ resolveRowClickAction resolveSidePanelWidthBounds resolveSidebarWidgetPosition
|
|
|
219
219
|
resolveSparklineAccent resolveSubmitDefaults resolveSubmitTarget
|
|
220
220
|
resolvesPeriodsAsBrowser ringFitsSliceLabels rowCustomActions
|
|
221
221
|
runCustomValidation runDeduped scrollToBlock searchCascaderTree
|
|
222
|
-
setOnboardingComplete setReaderTimeZoneSource
|
|
223
|
-
settledRenderedBellCounts shouldExpandMenuItem
|
|
224
|
-
snapshotFormState stripQueryAndHash tableSearchShortcuts
|
|
222
|
+
servedQuickActions setOnboardingComplete setReaderTimeZoneSource
|
|
223
|
+
setRegionalPreferencesSource settledRenderedBellCounts shouldExpandMenuItem
|
|
224
|
+
siblingComponentId snapshotFormState stripQueryAndHash tableSearchShortcuts
|
|
225
225
|
thinnedCategoryFormatter toBucketSeries toDonutRecords translateMenuItem
|
|
226
226
|
translateMenuItems unregisterCommandPaletteAssistant
|
|
227
227
|
unregisterCommandPaletteSource unregisterFooterLink unregisterSidePanel
|
|
@@ -393,6 +393,25 @@ function patternPageRoute(
|
|
|
393
393
|
return null;
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
+
/**
|
|
397
|
+
* The page of the site layout a path matches, with its route parameters, or
|
|
398
|
+
* `null` before the layout loads. It reads the layout state only, so a click
|
|
399
|
+
* handler may call it outside a component's setup.
|
|
400
|
+
*/
|
|
401
|
+
export function findPageRoute(path: string): MatchRouteResult<PageInfo> | null {
|
|
402
|
+
const layout = useSiteLayoutState().siteLayout.value;
|
|
403
|
+
return layout ? matchPageRoute(path, layout) : null;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* The quick actions the site layout serves the user, or `undefined` before it
|
|
408
|
+
* loads. It reads the layout state only, so a click handler may call it
|
|
409
|
+
* outside a component's setup.
|
|
410
|
+
*/
|
|
411
|
+
export function servedQuickActions(): QuickActionsPayload | undefined {
|
|
412
|
+
return useSiteLayoutState().quickActions.value;
|
|
413
|
+
}
|
|
414
|
+
|
|
396
415
|
export const useSiteLayout = () => {
|
|
397
416
|
const {
|
|
398
417
|
state,
|
|
@@ -454,19 +473,6 @@ export const useSiteLayout = () => {
|
|
|
454
473
|
}
|
|
455
474
|
};
|
|
456
475
|
|
|
457
|
-
const findMatchingRoute = (
|
|
458
|
-
path: string,
|
|
459
|
-
): {
|
|
460
|
-
pattern: string;
|
|
461
|
-
metadata: PageInfo;
|
|
462
|
-
params: Record<string, string>;
|
|
463
|
-
} | null => {
|
|
464
|
-
const layout = siteLayout.value;
|
|
465
|
-
if (!layout) return null;
|
|
466
|
-
|
|
467
|
-
return matchPageRoute(path, layout);
|
|
468
|
-
};
|
|
469
|
-
|
|
470
476
|
const findMatchingRouteOrCategory = (
|
|
471
477
|
path: string,
|
|
472
478
|
): {
|
|
@@ -512,7 +518,7 @@ export const useSiteLayout = () => {
|
|
|
512
518
|
refresh,
|
|
513
519
|
resync,
|
|
514
520
|
refreshIfStale,
|
|
515
|
-
findMatchingRoute,
|
|
521
|
+
findMatchingRoute: findPageRoute,
|
|
516
522
|
findMatchingRouteOrCategory,
|
|
517
523
|
probeAndCommitRoute,
|
|
518
524
|
};
|
|
@@ -70,6 +70,8 @@ export interface RowActionConfig<
|
|
|
70
70
|
isEnabled?: boolean;
|
|
71
71
|
isVisible?: boolean;
|
|
72
72
|
rule?: RowActionRule<T>;
|
|
73
|
+
/** Shown on a row `rule` keeps the action off, which then stays disabled (`$`: i18n key). */
|
|
74
|
+
disabledReason?: string;
|
|
73
75
|
/** Label in place of the built-in one (`$`: i18n key). */
|
|
74
76
|
label?: string;
|
|
75
77
|
/** Icon in place of the built-in one. */
|
|
@@ -411,6 +411,7 @@
|
|
|
411
411
|
"required": "This field is required.",
|
|
412
412
|
"invalid": "This value isn’t valid.",
|
|
413
413
|
"invalid_email": "Enter a valid email address.",
|
|
414
|
+
"invalid_phone": "Enter a valid phone number, with its country.",
|
|
414
415
|
"too_long": "This value is too long.",
|
|
415
416
|
"too_short": "This value is too short.",
|
|
416
417
|
"too_small": "This value is too small.",
|
|
@@ -411,6 +411,7 @@
|
|
|
411
411
|
"required": "Ce champ est obligatoire.",
|
|
412
412
|
"invalid": "Cette valeur n’est pas valide.",
|
|
413
413
|
"invalid_email": "Saisissez une adresse e-mail valide.",
|
|
414
|
+
"invalid_phone": "Saisissez un numéro de téléphone valide, avec son pays.",
|
|
414
415
|
"too_long": "Cette valeur est trop longue.",
|
|
415
416
|
"too_short": "Cette valeur est trop courte.",
|
|
416
417
|
"too_small": "Cette valeur est trop petite.",
|
|
@@ -15,6 +15,7 @@ import { PREVIEW_LOCK_ICON } from "#dms-ui/app/entries/utils/permissionPreview";
|
|
|
15
15
|
import { runMountedQuickAction } from "#dms-ui/app/entries/utils/quickActionTargets";
|
|
16
16
|
import { useActionTargets } from "#dms-ui/app/entries/composables/actions/useActionTargets";
|
|
17
17
|
import { refreshPageBlocks } from "#dms-ui/app/utils/blockRefresh";
|
|
18
|
+
import DmsDisabledReason from "#dms-ui/app/entries/components/button/DisabledReason";
|
|
18
19
|
import {
|
|
19
20
|
hasUrlVariables,
|
|
20
21
|
resolveLinkVariables,
|
|
@@ -291,16 +292,11 @@ const entries = computed<HeaderBarEntry[]>(() => {
|
|
|
291
292
|
<template>
|
|
292
293
|
<template v-for="{ key, action } in entries" :key="key">
|
|
293
294
|
<slot v-if="!action" />
|
|
294
|
-
<!-- A disabled button fires no pointer event: the tooltip hangs on a
|
|
295
|
-
focusable wrapper, so the reason also reaches keyboard users. -->
|
|
296
295
|
<UTooltip v-else-if="action.previewLocked" :text="action.previewLocked">
|
|
297
296
|
<UButton v-bind="action.button" />
|
|
298
297
|
</UTooltip>
|
|
299
|
-
<
|
|
300
|
-
<
|
|
301
|
-
|
|
302
|
-
</span>
|
|
303
|
-
</UTooltip>
|
|
304
|
-
<UButton v-else v-bind="action.button" />
|
|
298
|
+
<DmsDisabledReason v-else :reason="action.disabledReason">
|
|
299
|
+
<UButton v-bind="action.button" />
|
|
300
|
+
</DmsDisabledReason>
|
|
305
301
|
</template>
|
|
306
302
|
</template>
|
package/frontend-vue/layers/dms-layout/app/build/components/notification/NotificationPopover.vue
CHANGED
|
@@ -8,7 +8,10 @@ import {
|
|
|
8
8
|
settledRenderedBellCounts,
|
|
9
9
|
type UserNotification,
|
|
10
10
|
} from "../../../composables/notification/useNotifications";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
formatNotificationFullTime,
|
|
13
|
+
resolveNotificationTone,
|
|
14
|
+
} from "../pages/settings/notification/notificationDisplay";
|
|
12
15
|
import { DMS_TONE_SOLID, iconWellToneOf } from "#dms-ui/app/entries/utils/tone";
|
|
13
16
|
import DmsRowSkeleton from "#dms-ui/app/entries/components/skeleton/RowSkeleton";
|
|
14
17
|
|
|
@@ -227,7 +230,12 @@ const goToNotifications = () => {
|
|
|
227
230
|
}}
|
|
228
231
|
</div>
|
|
229
232
|
<div class="text-muted mt-1 text-[10px]">
|
|
230
|
-
|
|
233
|
+
<time
|
|
234
|
+
:datetime="notification.createdAt"
|
|
235
|
+
:title="formatNotificationFullTime(notification.createdAt, locale)"
|
|
236
|
+
>
|
|
237
|
+
{{ formatRelativeTime(notification.createdAt, t, locale) }}
|
|
238
|
+
</time>
|
|
231
239
|
</div>
|
|
232
240
|
</template>
|
|
233
241
|
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
MODULE_TAG_CLASS,
|
|
5
5
|
type NotificationSourceTag,
|
|
6
6
|
SOURCE_TAG_CLASS,
|
|
7
|
+
formatNotificationFullTime,
|
|
7
8
|
resolveNotificationTone,
|
|
8
9
|
} from "./notificationDisplay";
|
|
9
10
|
|
|
@@ -19,7 +20,7 @@ const emit = defineEmits<{
|
|
|
19
20
|
toggleRead: [];
|
|
20
21
|
delete: [];
|
|
21
22
|
}>();
|
|
22
|
-
const { t } = useI18n();
|
|
23
|
+
const { t, locale } = useI18n();
|
|
23
24
|
const { processI18n } = useTranslation();
|
|
24
25
|
|
|
25
26
|
const isUnread = computed(() => !props.notification.isRead);
|
|
@@ -27,6 +28,9 @@ const iconWellTone = computed(() => {
|
|
|
27
28
|
const tone = resolveNotificationTone(props.notification);
|
|
28
29
|
return tone === "neutral" ? "muted" : tone;
|
|
29
30
|
});
|
|
31
|
+
const fullTime = computed(() =>
|
|
32
|
+
formatNotificationFullTime(props.notification.createdAt, locale.value),
|
|
33
|
+
);
|
|
30
34
|
const readToggleLabel = computed(() =>
|
|
31
35
|
isUnread.value
|
|
32
36
|
? t("page.settings.notifications.mark_read")
|
|
@@ -71,7 +75,9 @@ const actionLabelUi = {
|
|
|
71
75
|
}}
|
|
72
76
|
</template>
|
|
73
77
|
<template #meta>
|
|
74
|
-
<time :datetime="props.notification.createdAt">{{
|
|
78
|
+
<time :datetime="props.notification.createdAt" :title="fullTime">{{
|
|
79
|
+
props.time
|
|
80
|
+
}}</time>
|
|
75
81
|
<span
|
|
76
82
|
v-if="props.source"
|
|
77
83
|
:class="[SOURCE_TAG_CLASS, props.source.isModule && MODULE_TAG_CLASS]"
|
|
@@ -10,18 +10,35 @@ interface NotificationMatrixSubjectProps {
|
|
|
10
10
|
subject: NotificationSubject;
|
|
11
11
|
enabled: boolean;
|
|
12
12
|
state: SaveStatusState;
|
|
13
|
+
emailEnabled?: boolean;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
const props = defineProps<NotificationMatrixSubjectProps>();
|
|
16
|
-
const emit = defineEmits<{
|
|
17
|
+
const emit = defineEmits<{
|
|
18
|
+
toggle: [enabled: boolean];
|
|
19
|
+
"toggle-email": [enabled: boolean];
|
|
20
|
+
retry: [];
|
|
21
|
+
}>();
|
|
17
22
|
const { t } = useI18n();
|
|
18
23
|
|
|
19
24
|
const label = computed(() => t(props.subject.labelKey));
|
|
20
25
|
const isLocked = computed(() => props.subject.locked === true);
|
|
26
|
+
/** E-mail follows the in-app notification: none is sent without it. */
|
|
27
|
+
const isEmailDisabled = computed(() => isLocked.value || !props.enabled);
|
|
28
|
+
const emailTitle = computed(() => {
|
|
29
|
+
if (isLocked.value) return t("page.settings.notifications.locked_hint");
|
|
30
|
+
return props.enabled
|
|
31
|
+
? undefined
|
|
32
|
+
: t("page.settings.notifications.email_needs_in_app");
|
|
33
|
+
});
|
|
21
34
|
|
|
22
35
|
const onToggle = (value: boolean) => {
|
|
23
36
|
if (props.state !== "saving") emit("toggle", value);
|
|
24
37
|
};
|
|
38
|
+
|
|
39
|
+
const onToggleEmail = (value: boolean) => {
|
|
40
|
+
if (props.state !== "saving") emit("toggle-email", value);
|
|
41
|
+
};
|
|
25
42
|
</script>
|
|
26
43
|
|
|
27
44
|
<template>
|
|
@@ -68,7 +85,21 @@ const onToggle = (value: boolean) => {
|
|
|
68
85
|
@update:model-value="onToggle"
|
|
69
86
|
/>
|
|
70
87
|
</div>
|
|
88
|
+
<div v-if="props.subject.email" class="flex justify-center" role="cell">
|
|
89
|
+
<USwitch
|
|
90
|
+
:model-value="props.emailEnabled"
|
|
91
|
+
:disabled="isEmailDisabled"
|
|
92
|
+
:title="emailTitle"
|
|
93
|
+
:aria-label="
|
|
94
|
+
t('page.settings.notifications.email_switch', { name: label })
|
|
95
|
+
"
|
|
96
|
+
:aria-busy="props.state === 'saving'"
|
|
97
|
+
data-channel="email"
|
|
98
|
+
@update:model-value="onToggleEmail"
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
71
101
|
<div
|
|
102
|
+
v-else
|
|
72
103
|
class="text-dimmed flex justify-center font-mono text-xs font-medium"
|
|
73
104
|
role="cell"
|
|
74
105
|
>
|
|
@@ -28,6 +28,9 @@ const {
|
|
|
28
28
|
toggleableSubjectsOf,
|
|
29
29
|
toggleSubject,
|
|
30
30
|
toggleCategory,
|
|
31
|
+
hasEmailChannel,
|
|
32
|
+
isEmailEnabled,
|
|
33
|
+
toggleEmail,
|
|
31
34
|
retry,
|
|
32
35
|
load,
|
|
33
36
|
} = useNotificationPreferences();
|
|
@@ -91,6 +94,7 @@ const failureMessage = computed(() => {
|
|
|
91
94
|
>
|
|
92
95
|
{{ t("page.settings.notifications.column_email") }}
|
|
93
96
|
<UBadge
|
|
97
|
+
v-if="!hasEmailChannel"
|
|
94
98
|
color="neutral"
|
|
95
99
|
size="sm"
|
|
96
100
|
class="tracking-[0.04em]"
|
|
@@ -160,7 +164,9 @@ const failureMessage = computed(() => {
|
|
|
160
164
|
:subject="subject"
|
|
161
165
|
:enabled="isEnabled(subject)"
|
|
162
166
|
:state="rowState(subject)"
|
|
167
|
+
:email-enabled="isEmailEnabled(subject)"
|
|
163
168
|
@toggle="(enabled) => toggleSubject(subject, enabled)"
|
|
169
|
+
@toggle-email="(enabled) => toggleEmail(subject, enabled)"
|
|
164
170
|
@retry="retry"
|
|
165
171
|
/>
|
|
166
172
|
</div>
|
|
@@ -187,7 +193,11 @@ const failureMessage = computed(() => {
|
|
|
187
193
|
</template>
|
|
188
194
|
<span v-else class="flex items-center gap-1.5 text-xs">
|
|
189
195
|
<UIcon name="i-ph-info" class="text-dimmed size-3.5" />
|
|
190
|
-
{{
|
|
196
|
+
{{
|
|
197
|
+
hasEmailChannel
|
|
198
|
+
? t("page.settings.notifications.email_hint_active")
|
|
199
|
+
: t("page.settings.notifications.email_hint")
|
|
200
|
+
}}
|
|
191
201
|
</span>
|
|
192
202
|
</template>
|
|
193
203
|
</DmsSectionPanel>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { formatDate } from "#dms-core/app/utils/formatter";
|
|
1
2
|
import { MONO_TAG_CLASS } from "#dms-ui/app/entries/utils/monoChip";
|
|
2
3
|
import {
|
|
3
4
|
formatShortDate,
|
|
@@ -82,6 +83,18 @@ export const formatNotificationTime = (
|
|
|
82
83
|
return formatShortDate(date, now, locale);
|
|
83
84
|
};
|
|
84
85
|
|
|
86
|
+
const FULL_TIME_FORMAT: Intl.DateTimeFormatOptions = {
|
|
87
|
+
dateStyle: "medium",
|
|
88
|
+
timeStyle: "short",
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/** The exact date and time, in the user's language, for a time's hover title. */
|
|
92
|
+
export const formatNotificationFullTime = (
|
|
93
|
+
createdAt: string,
|
|
94
|
+
locale: string,
|
|
95
|
+
): string | undefined =>
|
|
96
|
+
formatDate(createdAt, locale, FULL_TIME_FORMAT) ?? undefined;
|
|
97
|
+
|
|
85
98
|
/**
|
|
86
99
|
* The matrix lays out from its own width (`@container/matrix` on the table),
|
|
87
100
|
* not the viewport's: the settings column at 1024px is narrower than a phone
|
package/frontend-vue/layers/dms-layout/app/build/composables/notification/useNotificationCatalog.ts
CHANGED
|
@@ -20,11 +20,18 @@ export interface NotificationSubject {
|
|
|
20
20
|
badgeKey?: string;
|
|
21
21
|
/** Set by the server: the user may not turn the subject off. */
|
|
22
22
|
locked?: boolean;
|
|
23
|
+
/** Set by the server when the subject has an e-mail switch: it offers e-mail and a module delivers it. */
|
|
24
|
+
email?: {
|
|
25
|
+
/** E-mail is on for a user who never chose. */
|
|
26
|
+
defaultOn: boolean;
|
|
27
|
+
};
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
interface NotificationCatalogResponse {
|
|
26
31
|
categories: NotificationCategory[];
|
|
27
32
|
subjects: NotificationSubject[];
|
|
33
|
+
/** A module registered the e-mail channel. */
|
|
34
|
+
emailChannel?: boolean;
|
|
28
35
|
}
|
|
29
36
|
|
|
30
37
|
export const buildPreferenceKey = (categoryId: string, subjectId: string) =>
|
|
@@ -33,6 +40,10 @@ export const buildPreferenceKey = (categoryId: string, subjectId: string) =>
|
|
|
33
40
|
export const subjectPreferenceKey = (subject: NotificationSubject) =>
|
|
34
41
|
buildPreferenceKey(subject.category.id, subject.id);
|
|
35
42
|
|
|
43
|
+
/** The key the subject's e-mail switch is stored under. */
|
|
44
|
+
export const emailPreferenceKey = (subject: NotificationSubject) =>
|
|
45
|
+
`${subjectPreferenceKey(subject)}@email`;
|
|
46
|
+
|
|
36
47
|
const CATALOG_URL = pageRoutePath(
|
|
37
48
|
"/settings/user/notifications",
|
|
38
49
|
"/categories",
|
|
@@ -55,6 +66,10 @@ export const useNotificationCatalog = (enabled: () => boolean = () => true) => {
|
|
|
55
66
|
);
|
|
56
67
|
const categories = computed(() => catalog.data.value?.categories ?? []);
|
|
57
68
|
const subjects = computed(() => catalog.data.value?.subjects ?? []);
|
|
69
|
+
/** A module registered the e-mail channel: its column holds switches. */
|
|
70
|
+
const hasEmailChannel = computed(
|
|
71
|
+
() => catalog.data.value?.emailChannel === true,
|
|
72
|
+
);
|
|
58
73
|
const isLoaded = computed(() => !!catalog.data.value);
|
|
59
74
|
const loadFailed = computed(() => !isLoaded.value && hasFailed(catalog));
|
|
60
75
|
|
|
@@ -76,6 +91,7 @@ export const useNotificationCatalog = (enabled: () => boolean = () => true) => {
|
|
|
76
91
|
return {
|
|
77
92
|
categories,
|
|
78
93
|
subjects,
|
|
94
|
+
hasEmailChannel,
|
|
79
95
|
isLoaded,
|
|
80
96
|
loadFailed,
|
|
81
97
|
loadCatalog,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { pageRoutePath } from "#dms-core/app/utils/pageRoutes";
|
|
2
2
|
import type { SaveStatusState } from "#dms-ui/app/components/save-bar/SaveStatus.vue";
|
|
3
3
|
import { useInstantSave } from "#dms-ui/app/entries/composables/instant-save/useInstantSave";
|
|
4
|
+
import { combineSaveStates } from "#dms-ui/app/composables/layout/useInstantSaveHeader";
|
|
4
5
|
import {
|
|
6
|
+
emailPreferenceKey,
|
|
5
7
|
hasFailed,
|
|
6
8
|
type NotificationCategory,
|
|
7
9
|
type NotificationSubject,
|
|
@@ -51,8 +53,23 @@ export const useNotificationPreferences = (
|
|
|
51
53
|
() => !(isStoredRead.value && catalog.isLoaded.value) && !loadFailed.value,
|
|
52
54
|
);
|
|
53
55
|
|
|
56
|
+
/** What an e-mail switch the user never touched reads, by its key. */
|
|
57
|
+
const emailDefaults = computed<PreferenceMap>(() =>
|
|
58
|
+
Object.fromEntries(
|
|
59
|
+
catalog.subjects.value.flatMap((subject) =>
|
|
60
|
+
subject.email
|
|
61
|
+
? [[emailPreferenceKey(subject), subject.email.defaultOn]]
|
|
62
|
+
: [],
|
|
63
|
+
),
|
|
64
|
+
),
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
/** What a switch reads: the stored choice, else its default. */
|
|
68
|
+
const read = (key: string) =>
|
|
69
|
+
preferences.value[key] ?? emailDefaults.value[key] ?? true;
|
|
70
|
+
|
|
54
71
|
const instant = useInstantSave<PreferenceMap>({
|
|
55
|
-
read
|
|
72
|
+
read,
|
|
56
73
|
write: (key, enabled) => {
|
|
57
74
|
preferences.value = { ...preferences.value, [key]: enabled };
|
|
58
75
|
},
|
|
@@ -61,10 +78,22 @@ export const useNotificationPreferences = (
|
|
|
61
78
|
});
|
|
62
79
|
|
|
63
80
|
const isEnabled = (subject: NotificationSubject) =>
|
|
64
|
-
|
|
81
|
+
read(subjectPreferenceKey(subject));
|
|
65
82
|
|
|
83
|
+
/**
|
|
84
|
+
* As the server sends it: a locked subject is mailed whatever is stored,
|
|
85
|
+
* and a subject off in the app is not mailed at all.
|
|
86
|
+
*/
|
|
87
|
+
const isEmailEnabled = (subject: NotificationSubject) =>
|
|
88
|
+
subject.locked === true ||
|
|
89
|
+
(isEnabled(subject) && read(emailPreferenceKey(subject)));
|
|
90
|
+
|
|
91
|
+
/** The row's state cell sums up its in-app and e-mail switches. */
|
|
66
92
|
const rowState = (subject: NotificationSubject): SaveStatusState =>
|
|
67
|
-
|
|
93
|
+
combineSaveStates([
|
|
94
|
+
instant.states[subjectPreferenceKey(subject)],
|
|
95
|
+
instant.states[emailPreferenceKey(subject)],
|
|
96
|
+
]);
|
|
68
97
|
|
|
69
98
|
const toggleableSubjectsOf = (category: NotificationCategory) =>
|
|
70
99
|
catalog.subjectsOf(category.id).filter((subject) => !subject.locked);
|
|
@@ -72,6 +101,9 @@ export const useNotificationPreferences = (
|
|
|
72
101
|
const toggleSubject = (subject: NotificationSubject, enabled: boolean) =>
|
|
73
102
|
instant.change(subjectPreferenceKey(subject), enabled);
|
|
74
103
|
|
|
104
|
+
const toggleEmail = (subject: NotificationSubject, enabled: boolean) =>
|
|
105
|
+
instant.change(emailPreferenceKey(subject), enabled);
|
|
106
|
+
|
|
75
107
|
const toggleCategory = (category: NotificationCategory, enabled: boolean) =>
|
|
76
108
|
instant.changeMany(
|
|
77
109
|
Object.fromEntries(
|
|
@@ -95,6 +127,9 @@ export const useNotificationPreferences = (
|
|
|
95
127
|
return {
|
|
96
128
|
categories: catalog.categories,
|
|
97
129
|
subjectsOf: catalog.subjectsOf,
|
|
130
|
+
hasEmailChannel: catalog.hasEmailChannel,
|
|
131
|
+
isEmailEnabled,
|
|
132
|
+
toggleEmail,
|
|
98
133
|
preferences,
|
|
99
134
|
failedChanges: instant.failed,
|
|
100
135
|
saveState: instant.state,
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import CommandPaletteAssistantAnswer from "../../build/components/layout/CommandPaletteAssistantAnswer.vue";
|
|
10
10
|
import { ASSISTANT_MODE_KEY } from "../../build/composables/command-palette/assistantGroups";
|
|
11
11
|
import { useCommandPaletteAssistantMode } from "../../build/composables/command-palette/useCommandPaletteAssistantMode";
|
|
12
|
+
import { SHORTCUTS_PAGE_SHORTCUT } from "#dms-ui/app/entries/composables/global/shortcuts";
|
|
12
13
|
|
|
13
14
|
const { t } = useI18n();
|
|
14
15
|
const appConfig = useDmsAppConfig();
|
|
@@ -61,6 +62,15 @@ function close(): void {
|
|
|
61
62
|
isOpen.value = false;
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
/** The page "?" opens: the keyboard shortcuts, in the user's settings. */
|
|
66
|
+
const SHORTCUTS_PAGE_PATH = "/settings/user/shortcuts";
|
|
67
|
+
|
|
68
|
+
defineShortcuts({
|
|
69
|
+
[SHORTCUTS_PAGE_SHORTCUT]: () => {
|
|
70
|
+
void navigateDms(SHORTCUTS_PAGE_PATH);
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
64
74
|
/**
|
|
65
75
|
* Set on `<html>` while the palette is mounted, which is while its ⌘ K /
|
|
66
76
|
* Ctrl K shortcut listens. The palette renders nothing until opened and
|
|
@@ -174,6 +174,9 @@
|
|
|
174
174
|
"category_collapse": "Hide {name} notifications",
|
|
175
175
|
"locked_hint": "Required for account safety",
|
|
176
176
|
"email_hint": "Only in-app notifications are available today. Email delivery is on the way.",
|
|
177
|
+
"email_hint_active": "Subjects with a switch in the Email column can also reach you by email, on top of the app.",
|
|
178
|
+
"email_switch": "Email: {name}",
|
|
179
|
+
"email_needs_in_app": "Turn the in-app notification on to also receive it by email.",
|
|
177
180
|
"save_failed_on": "Couldn’t save — the switch was turned back on.",
|
|
178
181
|
"save_failed_off": "Couldn’t save — the switch was turned back off.",
|
|
179
182
|
"save_failed_many": "Couldn’t save — the switches were turned back.",
|
|
@@ -429,7 +432,7 @@
|
|
|
429
432
|
"cancel_confirm_title": "Cancel invitation",
|
|
430
433
|
"cancel_confirm_description": "Are you sure you want to cancel this invitation? The invite link will no longer work.",
|
|
431
434
|
"copy_link": "Copy link",
|
|
432
|
-
"copy_link_success": "
|
|
435
|
+
"copy_link_success": "New invitation link copied. Earlier links no longer work",
|
|
433
436
|
"edit": "Edit invitation",
|
|
434
437
|
"revoke": "Revoke",
|
|
435
438
|
"revoke_confirm_title": "Revoke the invitation to {email}?",
|