@dxos/plugin-pwa 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +32 -31
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/PwaPlugin.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +7 -7
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -14
- package/src/PwaPlugin.tsx +16 -17
- package/src/meta.ts +1 -1
- package/src/translations.ts +7 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-pwa",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.bcb3aa67d6",
|
|
4
4
|
"description": "DXOS Surface plugin for PWA registration and update handling.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
"author": "DXOS.org",
|
|
13
13
|
"sideEffects": true,
|
|
14
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#meta": "./src/meta.ts"
|
|
17
|
+
},
|
|
15
18
|
"exports": {
|
|
16
19
|
".": {
|
|
17
20
|
"source": "./src/index.ts",
|
|
@@ -28,31 +31,32 @@
|
|
|
28
31
|
"src"
|
|
29
32
|
],
|
|
30
33
|
"dependencies": {
|
|
31
|
-
"effect": "3.
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/app-
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/operation": "0.8.4-main.
|
|
36
|
-
"@dxos/util": "0.8.4-main.
|
|
34
|
+
"effect": "3.20.0",
|
|
35
|
+
"@dxos/app-framework": "0.8.4-main.bcb3aa67d6",
|
|
36
|
+
"@dxos/app-toolkit": "0.8.4-main.bcb3aa67d6",
|
|
37
|
+
"@dxos/log": "0.8.4-main.bcb3aa67d6",
|
|
38
|
+
"@dxos/operation": "0.8.4-main.bcb3aa67d6",
|
|
39
|
+
"@dxos/util": "0.8.4-main.bcb3aa67d6",
|
|
40
|
+
"@dxos/observability": "0.8.4-main.bcb3aa67d6"
|
|
37
41
|
},
|
|
38
42
|
"devDependencies": {
|
|
39
43
|
"@types/react": "~19.2.7",
|
|
40
44
|
"@types/react-dom": "~19.2.3",
|
|
41
45
|
"react": "~19.2.3",
|
|
42
46
|
"react-dom": "~19.2.3",
|
|
43
|
-
"vite": "7.1.
|
|
47
|
+
"vite": "^7.1.11",
|
|
44
48
|
"vite-plugin-pwa": "^1.0.2",
|
|
45
49
|
"workbox-window": "^7.3.0",
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
50
|
+
"@dxos/storybook-utils": "0.8.4-main.bcb3aa67d6",
|
|
51
|
+
"@dxos/react-ui": "0.8.4-main.bcb3aa67d6",
|
|
52
|
+
"@dxos/ui-theme": "0.8.4-main.bcb3aa67d6"
|
|
49
53
|
},
|
|
50
54
|
"peerDependencies": {
|
|
51
|
-
"effect": "3.
|
|
55
|
+
"effect": "3.20.0",
|
|
52
56
|
"react": "~19.2.3",
|
|
53
57
|
"react-dom": "~19.2.3",
|
|
54
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
55
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
58
|
+
"@dxos/react-ui": "0.8.4-main.bcb3aa67d6",
|
|
59
|
+
"@dxos/ui-theme": "0.8.4-main.bcb3aa67d6"
|
|
56
60
|
},
|
|
57
61
|
"publishConfig": {
|
|
58
62
|
"access": "public"
|
package/src/PwaPlugin.tsx
CHANGED
|
@@ -5,42 +5,41 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
import { registerSW } from 'virtual:pwa-register';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { ActivationEvents, Capabilities, Capability, Plugin } from '@dxos/app-framework';
|
|
9
|
+
import { AppPlugin, LayoutOperation } from '@dxos/app-toolkit';
|
|
9
10
|
import { log } from '@dxos/log';
|
|
10
|
-
import { captureException } from '@dxos/observability/sentry';
|
|
11
11
|
|
|
12
|
-
import { meta } from '
|
|
12
|
+
import { meta } from '#meta';
|
|
13
13
|
import { translations } from './translations';
|
|
14
14
|
|
|
15
15
|
export const PwaPlugin = Plugin.define(meta).pipe(
|
|
16
|
-
|
|
16
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
17
17
|
Plugin.addModule({
|
|
18
18
|
id: 'register-pwa',
|
|
19
|
-
activatesOn:
|
|
19
|
+
activatesOn: ActivationEvents.OperationInvokerReady,
|
|
20
20
|
activate: Effect.fnUntraced(function* () {
|
|
21
|
-
const {
|
|
21
|
+
const { invokePromise } = yield* Capability.get(Capabilities.OperationInvoker);
|
|
22
22
|
|
|
23
23
|
const updateSW = registerSW({
|
|
24
24
|
onNeedRefresh: () => {
|
|
25
|
-
|
|
26
|
-
id: `${meta.id}
|
|
27
|
-
title: ['need
|
|
28
|
-
description: ['need
|
|
25
|
+
void invokePromise(LayoutOperation.AddToast, {
|
|
26
|
+
id: `${meta.id}.need-refresh`,
|
|
27
|
+
title: ['need-refresh.label', { ns: meta.id }],
|
|
28
|
+
description: ['need-refresh.description', { ns: meta.id }],
|
|
29
29
|
duration: 4 * 60 * 1000, // 4m
|
|
30
|
-
actionLabel: ['refresh
|
|
31
|
-
actionAlt: ['refresh
|
|
30
|
+
actionLabel: ['refresh.label', { ns: meta.id }],
|
|
31
|
+
actionAlt: ['refresh.alt', { ns: meta.id }],
|
|
32
32
|
onAction: () => updateSW(true),
|
|
33
33
|
});
|
|
34
34
|
},
|
|
35
35
|
onOfflineReady: () => {
|
|
36
|
-
|
|
37
|
-
id: `${meta.id}
|
|
38
|
-
title: ['offline
|
|
39
|
-
closeLabel: ['confirm
|
|
36
|
+
void invokePromise(LayoutOperation.AddToast, {
|
|
37
|
+
id: `${meta.id}.offline-ready`,
|
|
38
|
+
title: ['offline-ready.label', { ns: meta.id }],
|
|
39
|
+
closeLabel: ['confirm.label', { ns: meta.id }],
|
|
40
40
|
});
|
|
41
41
|
},
|
|
42
42
|
onRegisterError: (err) => {
|
|
43
|
-
captureException(err);
|
|
44
43
|
log.error(err);
|
|
45
44
|
},
|
|
46
45
|
});
|
package/src/meta.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
|
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
8
|
export const meta: Plugin.Meta = {
|
|
9
|
-
id: 'dxos.
|
|
9
|
+
id: 'org.dxos.plugin.pwa',
|
|
10
10
|
name: 'PWA',
|
|
11
11
|
description: trim`
|
|
12
12
|
Progressive Web App capabilities enabling offline functionality and app-like experience.
|
package/src/translations.ts
CHANGED
|
@@ -4,20 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
7
|
+
import { meta } from '#meta';
|
|
8
8
|
|
|
9
9
|
export const translations = [
|
|
10
10
|
{
|
|
11
11
|
'en-US': {
|
|
12
12
|
[meta.id]: {
|
|
13
|
-
'need
|
|
14
|
-
'need
|
|
15
|
-
'refresh
|
|
16
|
-
'refresh
|
|
13
|
+
'need-refresh.label': 'Refresh now to get app updates',
|
|
14
|
+
'need-refresh.description': 'You’ll need these updates to continue without interruption.',
|
|
15
|
+
'refresh.label': 'Refresh',
|
|
16
|
+
'refresh.alt': 'Click your browser’s refresh button or use the refresh keyboard shortcut.',
|
|
17
17
|
// TODO(wittjosiah): Non-react translation utils.
|
|
18
18
|
// 'offline ready label': '{{appName}} is ready to use offline.',
|
|
19
|
-
'offline
|
|
20
|
-
'confirm
|
|
19
|
+
'offline-ready.label': 'Ready to use offline.',
|
|
20
|
+
'confirm.label': 'Okay',
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
23
|
},
|