@linagora/twake-react-new-version 1.0.0 → 1.1.2

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 CHANGED
@@ -1,3 +1,24 @@
1
+ ## @linagora/twake-react-new-version [1.1.2](https://github.com/linagora/twake-libs/compare/@linagora/twake-react-new-version@1.1.1...@linagora/twake-react-new-version@1.1.2) (2026-11-18)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Publish with npm provenance ([913c37d](https://github.com/linagora/twake-libs/commit/913c37db3fd78ab56f981607213c29fe15b930a0))
7
+
8
+ ## @linagora/twake-react-new-version [1.1.1](https://github.com/linagora/twake-libs/compare/@linagora/twake-react-new-version@1.1.0...@linagora/twake-react-new-version@1.1.1) (2026-11-16)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **twake-react-new-version:** Describe the optional illustration ([#66](https://github.com/linagora/twake-libs/issues/66)) ([08cb0ac](https://github.com/linagora/twake-libs/commit/08cb0ac0a9b43d699e9825d8452469d11f123448))
14
+
15
+ # @linagora/twake-react-new-version [1.1.0](https://github.com/linagora/twake-libs/compare/@linagora/twake-react-new-version@1.0.0...@linagora/twake-react-new-version@1.1.0) (2026-11-16)
16
+
17
+
18
+ ### Features
19
+
20
+ * **twake-react-new-version:** Illustration banner and centred text ([#65](https://github.com/linagora/twake-libs/issues/65)) ([ee83d0d](https://github.com/linagora/twake-libs/commit/ee83d0dd604a26f87cd0625927451b705acf2605))
21
+
1
22
  # @linagora/twake-react-new-version 1.0.0 (2026-11-13)
2
23
 
3
24
 
package/README.md CHANGED
@@ -54,7 +54,7 @@ Every 10 minutes, when the tab gets the focus, becomes visible again or comes ba
54
54
 
55
55
  ### What the user sees
56
56
 
57
- « New version available », with « Not now » and « Reload ». « Not now », Escape or a click outside decline that build for the life of the tab: the dialog comes back only for a build not declined yet, so a rollback to a declined build is not offered again.
57
+ A dialog titled « What's new in <appName> », with the text « An update just arrived. Reload to get it. », centred, and « Not now » and « Reload » side by side, centred. With `image`, a banner above the title shows the illustration. « Not now », Escape or a click outside decline that build for the life of the tab: the dialog comes back only for a build not declined yet, so a rollback to a declined build is not offered again.
58
58
 
59
59
  ### Props
60
60
 
@@ -63,6 +63,8 @@ Every 10 minutes, when the tab gets the focus, becomes visible again or comes ba
63
63
  - `fetchServed()`: reads the served build id, `fetchServedBuild` by default
64
64
  - `reload()`: `window.location.reload` by default
65
65
  - `intervalMs`: time between two checks, 10 minutes by default
66
+ - `image`: URL of a decorative illustration (`alt=""`), drawn centred in a full-width banner about 130 px high at the top of the dialog, `object-fit: contain`, cut at the bottom of the banner if taller; no banner without it
67
+ - `imageBackground`: CSS colour of the banner, the theme's light primary colour by default (light and dark)
66
68
 
67
69
  ### Texts
68
70
 
@@ -7,6 +7,10 @@ export interface NewVersionDialogProps {
7
7
  fetchServed?: () => Promise<string | null>;
8
8
  reload?: () => void;
9
9
  intervalMs?: number;
10
+ /** URL of a decorative illustration, drawn in a banner at the top */
11
+ image?: string;
12
+ /** CSS colour of the banner, the theme's light primary by default */
13
+ imageBackground?: string;
10
14
  }
11
15
  /**
12
16
  * « New version available »: offers a reload to a tab that runs an older
@@ -14,4 +18,4 @@ export interface NewVersionDialogProps {
14
18
  * that build for the life of the tab: the dialog comes back only for a build
15
19
  * not declined yet. Mount it once, under the app's `I18n` and twake-mui theme
16
20
  */
17
- export declare const NewVersionDialog: ({ running, appName, fetchServed, reload, intervalMs }: NewVersionDialogProps) => React.ReactElement;
21
+ export declare const NewVersionDialog: ({ running, appName, fetchServed, reload, intervalMs, image, imageBackground }: NewVersionDialogProps) => React.ReactElement;
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useId, useRef, useState } from 'react';
2
- import { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@linagora/twake-mui';
2
+ import { Box, Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@linagora/twake-mui';
3
3
  import { useExtendI18n, useI18n } from 'twake-i18n';
4
4
  import de from './locales/de.json';
5
5
  import en from './locales/en.json';
@@ -59,13 +59,42 @@ const useVersionChecks = (check, intervalMs) => {
59
59
  };
60
60
  }, [intervalMs]);
61
61
  };
62
+ /**
63
+ * Decorative banner at the top of the dialog. The small dialog of twake-mui
64
+ * pads its paper by 8 px on each side below `lg`: the banner cancels that
65
+ * margin there, to reach the edges of the paper (which clips it to its rounded
66
+ * corners). The image is taller than the banner (120%) and anchored at its top,
67
+ * so its bottom is cut. Without `background`, the tint is the light primary,
68
+ * a dimmed primary in the dark scheme where the light one glares
69
+ */
70
+ const Banner = ({ image, background }) => (React.createElement(Box, { sx: theme => ({
71
+ height: 130,
72
+ overflow: 'hidden',
73
+ display: 'flex',
74
+ justifyContent: 'center',
75
+ alignItems: 'flex-start',
76
+ [theme.breakpoints.down('lg')]: { marginInline: -1 },
77
+ backgroundColor: background ??
78
+ theme.vars?.palette.primary.light ??
79
+ theme.palette.primary.light,
80
+ ...(background === undefined &&
81
+ theme.applyStyles('dark', {
82
+ backgroundColor: theme.alpha(theme.vars?.palette.primary.main ?? theme.palette.primary.main, 0.16)
83
+ }))
84
+ }) },
85
+ React.createElement("img", { src: image, alt: "", "aria-hidden": true, style: {
86
+ height: '120%',
87
+ marginTop: 6,
88
+ flexShrink: 0,
89
+ objectFit: 'contain'
90
+ } })));
62
91
  /**
63
92
  * « New version available »: offers a reload to a tab that runs an older
64
93
  * build than the served one. « Not now », Escape or a click outside decline
65
94
  * that build for the life of the tab: the dialog comes back only for a build
66
95
  * not declined yet. Mount it once, under the app's `I18n` and twake-mui theme
67
96
  */
68
- export const NewVersionDialog = ({ running, appName, fetchServed = fetchServedBuild, reload = () => window.location.reload(), intervalMs = 10 * MINUTE }) => {
97
+ export const NewVersionDialog = ({ running, appName, fetchServed = fetchServedBuild, reload = () => window.location.reload(), intervalMs = 10 * MINUTE, image, imageBackground }) => {
69
98
  const { t, lang } = useI18n();
70
99
  useExtendI18n({ [lang]: locales[lang] ?? locales.en });
71
100
  const titleId = useId();
@@ -86,10 +115,11 @@ export const NewVersionDialog = ({ running, appName, fetchServed = fetchServedBu
86
115
  setOffered(null);
87
116
  };
88
117
  return (React.createElement(Dialog, { open: offered !== null, onClose: notNow, size: "small", "aria-labelledby": titleId, "data-testid": "new-version-dialog" },
89
- React.createElement(DialogTitle, { id: titleId }, t('twakeNewVersion.title')),
118
+ image !== undefined && (React.createElement(Banner, { image: image, background: imageBackground })),
119
+ React.createElement(DialogTitle, { id: titleId, sx: { textAlign: 'center' } }, t('twakeNewVersion.title').replace('%{appName}', appName)),
90
120
  React.createElement(DialogContent, null,
91
- React.createElement(DialogContentText, null, t('twakeNewVersion.body').replace('%{appName}', appName))),
92
- React.createElement(DialogActions, null,
121
+ React.createElement(DialogContentText, { sx: { textAlign: 'center' } }, t('twakeNewVersion.body').replace('%{appName}', appName))),
122
+ React.createElement(DialogActions, { sx: { justifyContent: 'center' } },
93
123
  React.createElement(Button, { variant: "outlined", "data-testid": "new-version-not-now", onClick: notNow }, t('twakeNewVersion.notNow')),
94
124
  React.createElement(Button, { variant: "contained", color: "primary", "data-testid": "new-version-reload", onClick: reload }, t('twakeNewVersion.reload')))));
95
125
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "twakeNewVersion": {
3
- "title": "Neue Version verfügbar",
4
- "body": "Laden Sie die Seite neu, um die neueste Version von %{appName} zu verwenden.",
3
+ "title": "Neues in %{appName}",
4
+ "body": "Ein Update ist gerade eingetroffen. Laden Sie neu, um es zu erhalten.",
5
5
  "reload": "Neu laden",
6
6
  "notNow": "Nicht jetzt"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "twakeNewVersion": {
3
- "title": "New version available",
4
- "body": "Reload the page to use the latest version of %{appName}.",
3
+ "title": "What's new in %{appName}",
4
+ "body": "An update just arrived. Reload to get it.",
5
5
  "reload": "Reload",
6
6
  "notNow": "Not now"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "twakeNewVersion": {
3
- "title": "Nueva versión disponible",
4
- "body": "Recarga la página para usar la última versión de %{appName}.",
3
+ "title": "Novedades de %{appName}",
4
+ "body": "Acaba de llegar una actualización. Recarga para obtenerla.",
5
5
  "reload": "Recargar",
6
6
  "notNow": "Ahora no"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "twakeNewVersion": {
3
- "title": "Nouvelle version disponible",
4
- "body": "Rechargez la page pour utiliser la dernière version de %{appName}.",
3
+ "title": "Du nouveau dans %{appName}",
4
+ "body": "Une mise à jour vient d'arriver. Rechargez pour en profiter.",
5
5
  "reload": "Recharger",
6
6
  "notNow": "Pas maintenant"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "twakeNewVersion": {
3
- "title": "Nuova versione disponibile",
4
- "body": "Ricarica la pagina per usare l'ultima versione di %{appName}.",
3
+ "title": "Novità di %{appName}",
4
+ "body": "È appena arrivato un aggiornamento. Ricarica per ottenerlo.",
5
5
  "reload": "Ricarica",
6
6
  "notNow": "Non ora"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "twakeNewVersion": {
3
- "title": "Доступна новая версия",
4
- "body": "Перезагрузите страницу, чтобы использовать последнюю версию %{appName}.",
3
+ "title": "Что нового в %{appName}",
4
+ "body": "Только что вышло обновление. Перезагрузите, чтобы получить его.",
5
5
  "reload": "Перезагрузить",
6
6
  "notNow": "Не сейчас"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "twakeNewVersion": {
3
- "title": "Đã có phiên bản mới",
4
- "body": "Tải lại trang để dùng phiên bản mới nhất của %{appName}.",
3
+ "title": "Có gì mới trong %{appName}",
4
+ "body": "Vừa có bản cập nhật. Tải lại để nhận.",
5
5
  "reload": "Tải lại",
6
6
  "notNow": "Để sau"
7
7
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@linagora/twake-react-new-version",
3
3
  "type": "module",
4
- "version": "1.0.0",
5
- "description": "Tells the user of a Twake application that a new version is served, and offers a reload",
4
+ "version": "1.1.2",
5
+ "description": "Tells the user of a Twake application that a new version is served, and offers a reload in a dialog with an optional illustration",
6
6
  "author": "Twake",
7
7
  "license": "MIT",
8
8
  "engines": {
@@ -28,7 +28,8 @@
28
28
  "README.md"
29
29
  ],
30
30
  "publishConfig": {
31
- "access": "public"
31
+ "access": "public",
32
+ "provenance": true
32
33
  },
33
34
  "scripts": {
34
35
  "build": "tsc -b tsconfig.build.json",