@dxos/plugin-pwa 0.7.5-staging.b81e783 → 0.8.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.
@@ -9,8 +9,33 @@ import { registerSW } from "virtual:pwa-register";
9
9
  import { Capabilities, contributes, createIntent, defineModule, definePlugin, Events, LayoutAction } from "@dxos/app-framework";
10
10
  import { log } from "@dxos/log";
11
11
  import { captureException } from "@dxos/observability/sentry";
12
+
13
+ // packages/plugins/plugin-pwa/src/translations.ts
14
+ var translations_default = [
15
+ {
16
+ "en-US": {
17
+ [PWA_PLUGIN]: {
18
+ "need refresh label": "Refresh now to get app updates",
19
+ "need refresh description": "You\u2019ll need these updates to continue without interruption.",
20
+ "refresh label": "Refresh",
21
+ "refresh alt": "Click your browser\u2019s refresh button or use the refresh keyboard shortcut.",
22
+ // TODO(wittjosiah): Non-react translation utils.
23
+ // 'offline ready label': '{{appName}} is ready to use offline.',
24
+ "offline ready label": "Ready to use offline.",
25
+ "confirm label": "Okay"
26
+ }
27
+ }
28
+ }
29
+ ];
30
+
31
+ // packages/plugins/plugin-pwa/src/PwaPlugin.tsx
12
32
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-pwa/src/PwaPlugin.tsx";
13
33
  var PwaPlugin = () => definePlugin(meta, [
34
+ defineModule({
35
+ id: `${meta.id}/module/translations`,
36
+ activatesOn: Events.SetupTranslations,
37
+ activate: () => contributes(Capabilities.Translations, translations_default)
38
+ }),
14
39
  defineModule({
15
40
  id: `${meta.id}/module/register-pwa`,
16
41
  activatesOn: Events.DispatcherReady,
@@ -71,7 +96,7 @@ var PwaPlugin = () => definePlugin(meta, [
71
96
  captureException(err);
72
97
  log.error(err, void 0, {
73
98
  F: __dxlog_file,
74
- L: 58,
99
+ L: 64,
75
100
  S: void 0,
76
101
  C: (f, a) => f(...a)
77
102
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/meta.ts", "../../../src/PwaPlugin.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const PWA_PLUGIN = 'dxos.org/plugin/pwa';\n\nexport const meta = {\n id: PWA_PLUGIN,\n} satisfies PluginMeta;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { registerSW } from 'virtual:pwa-register';\n\nimport {\n Capabilities,\n contributes,\n createIntent,\n defineModule,\n definePlugin,\n Events,\n LayoutAction,\n} from '@dxos/app-framework';\nimport { log } from '@dxos/log';\nimport { captureException } from '@dxos/observability/sentry';\n\nimport { meta, PWA_PLUGIN } from './meta';\n\nexport const PwaPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/register-pwa`,\n activatesOn: Events.DispatcherReady,\n activate: (context) => {\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n\n const updateSW = registerSW({\n onNeedRefresh: () =>\n dispatch?.(\n createIntent(LayoutAction.AddToast, {\n part: 'toast',\n subject: {\n id: `${PWA_PLUGIN}/need-refresh`,\n title: ['need refresh label', { ns: PWA_PLUGIN }],\n description: ['need refresh description', { ns: PWA_PLUGIN }],\n duration: 4 * 60 * 1000, // 4m\n actionLabel: ['refresh label', { ns: PWA_PLUGIN }],\n actionAlt: ['refresh alt', { ns: PWA_PLUGIN }],\n onAction: () => updateSW(true),\n },\n }),\n ),\n onOfflineReady: () =>\n dispatch?.(\n createIntent(LayoutAction.AddToast, {\n part: 'toast',\n subject: {\n id: `${PWA_PLUGIN}/offline-ready`,\n title: ['offline ready label', { ns: PWA_PLUGIN }],\n closeLabel: ['confirm label', { ns: PWA_PLUGIN }],\n },\n }),\n ),\n onRegisterError: (err) => {\n captureException(err);\n log.error(err);\n },\n });\n\n return contributes(Capabilities.Null, null);\n },\n }),\n ]);\n"],
5
- "mappings": ";AAMO,IAAMA,aAAa;AAEnB,IAAMC,OAAO;EAClBC,IAAIF;AACN;;;ACNA,SAASG,kBAAkB;AAE3B,SACEC,cACAC,aACAC,cACAC,cACAC,cACAC,QACAC,oBACK;AACP,SAASC,WAAW;AACpB,SAASC,wBAAwB;;AAI1B,IAAMC,YAAY,MACvBC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,UAAU,CAACC,YAAAA;AACT,YAAM,EAAEC,iBAAiBC,SAAQ,IAAKF,QAAQG,kBAAkBC,aAAaC,gBAAgB;AAE7F,YAAMC,WAAWC,WAAW;QAC1BC,eAAe,MACbN,WACEO,aAAaC,aAAaC,UAAU;UAClCC,MAAM;UACNC,SAAS;YACPlB,IAAI,GAAGmB,UAAAA;YACPC,OAAO;cAAC;cAAsB;gBAAEC,IAAIF;cAAW;;YAC/CG,aAAa;cAAC;cAA4B;gBAAED,IAAIF;cAAW;;YAC3DI,UAAU,IAAI,KAAK;YACnBC,aAAa;cAAC;cAAiB;gBAAEH,IAAIF;cAAW;;YAChDM,WAAW;cAAC;cAAe;gBAAEJ,IAAIF;cAAW;;YAC5CO,UAAU,MAAMf,SAAS,IAAA;UAC3B;QACF,CAAA,CAAA;QAEJgB,gBAAgB,MACdpB,WACEO,aAAaC,aAAaC,UAAU;UAClCC,MAAM;UACNC,SAAS;YACPlB,IAAI,GAAGmB,UAAAA;YACPC,OAAO;cAAC;cAAuB;gBAAEC,IAAIF;cAAW;;YAChDS,YAAY;cAAC;cAAiB;gBAAEP,IAAIF;cAAW;;UACjD;QACF,CAAA,CAAA;QAEJU,iBAAiB,CAACC,QAAAA;AAChBC,2BAAiBD,GAAAA;AACjBE,cAAIC,MAAMH,KAAAA,QAAAA;;;;;;QACZ;MACF,CAAA;AAEA,aAAOI,YAAYzB,aAAa0B,MAAM,IAAA;IACxC;EACF,CAAA;CACD;",
6
- "names": ["PWA_PLUGIN", "meta", "id", "registerSW", "Capabilities", "contributes", "createIntent", "defineModule", "definePlugin", "Events", "LayoutAction", "log", "captureException", "PwaPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "DispatcherReady", "activate", "context", "dispatchPromise", "dispatch", "requestCapability", "Capabilities", "IntentDispatcher", "updateSW", "registerSW", "onNeedRefresh", "createIntent", "LayoutAction", "AddToast", "part", "subject", "PWA_PLUGIN", "title", "ns", "description", "duration", "actionLabel", "actionAlt", "onAction", "onOfflineReady", "closeLabel", "onRegisterError", "err", "captureException", "log", "error", "contributes", "Null"]
3
+ "sources": ["../../../src/meta.ts", "../../../src/PwaPlugin.tsx", "../../../src/translations.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const PWA_PLUGIN = 'dxos.org/plugin/pwa';\n\nexport const meta = {\n id: PWA_PLUGIN,\n} satisfies PluginMeta;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { registerSW } from 'virtual:pwa-register';\n\nimport {\n Capabilities,\n contributes,\n createIntent,\n defineModule,\n definePlugin,\n Events,\n LayoutAction,\n} from '@dxos/app-framework';\nimport { log } from '@dxos/log';\nimport { captureException } from '@dxos/observability/sentry';\n\nimport { meta, PWA_PLUGIN } from './meta';\nimport translations from './translations';\n\nexport const PwaPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/register-pwa`,\n activatesOn: Events.DispatcherReady,\n activate: (context) => {\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n\n const updateSW = registerSW({\n onNeedRefresh: () =>\n dispatch?.(\n createIntent(LayoutAction.AddToast, {\n part: 'toast',\n subject: {\n id: `${PWA_PLUGIN}/need-refresh`,\n title: ['need refresh label', { ns: PWA_PLUGIN }],\n description: ['need refresh description', { ns: PWA_PLUGIN }],\n duration: 4 * 60 * 1000, // 4m\n actionLabel: ['refresh label', { ns: PWA_PLUGIN }],\n actionAlt: ['refresh alt', { ns: PWA_PLUGIN }],\n onAction: () => updateSW(true),\n },\n }),\n ),\n onOfflineReady: () =>\n dispatch?.(\n createIntent(LayoutAction.AddToast, {\n part: 'toast',\n subject: {\n id: `${PWA_PLUGIN}/offline-ready`,\n title: ['offline ready label', { ns: PWA_PLUGIN }],\n closeLabel: ['confirm label', { ns: PWA_PLUGIN }],\n },\n }),\n ),\n onRegisterError: (err) => {\n captureException(err);\n log.error(err);\n },\n });\n\n return contributes(Capabilities.Null, null);\n },\n }),\n ]);\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { PWA_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [PWA_PLUGIN]: {\n 'need refresh label': 'Refresh now to get app updates',\n 'need refresh description': 'You’ll need these updates to continue without interruption.',\n 'refresh label': 'Refresh',\n 'refresh alt': 'Click your browser’s refresh button or use the refresh keyboard shortcut.',\n // TODO(wittjosiah): Non-react translation utils.\n // 'offline ready label': '{{appName}} is ready to use offline.',\n 'offline ready label': 'Ready to use offline.',\n 'confirm label': 'Okay',\n },\n },\n },\n];\n"],
5
+ "mappings": ";AAMO,IAAMA,aAAa;AAEnB,IAAMC,OAAO;EAClBC,IAAIF;AACN;;;ACNA,SAASG,kBAAkB;AAE3B,SACEC,cACAC,aACAC,cACAC,cACAC,cACAC,QACAC,oBACK;AACP,SAASC,WAAW;AACpB,SAASC,wBAAwB;;;ACVjC,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACC,UAAAA,GAAa;QACZ,sBAAsB;QACtB,4BAA4B;QAC5B,iBAAiB;QACjB,eAAe;;;QAGf,uBAAuB;QACvB,iBAAiB;MACnB;IACF;EACF;;;;;ADCK,IAAMC,YAAY,MACvBC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,UAAU,MAAMC,YAAYC,aAAaC,cAAcC,oBAAAA;EACzD,CAAA;EACAT,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOO;IACpBL,UAAU,CAACM,YAAAA;AACT,YAAM,EAAEC,iBAAiBC,SAAQ,IAAKF,QAAQG,kBAAkBP,aAAaQ,gBAAgB;AAE7F,YAAMC,WAAWC,WAAW;QAC1BC,eAAe,MACbL,WACEM,aAAaC,aAAaC,UAAU;UAClCC,MAAM;UACNC,SAAS;YACPtB,IAAI,GAAGuB,UAAAA;YACPC,OAAO;cAAC;cAAsB;gBAAEC,IAAIF;cAAW;;YAC/CG,aAAa;cAAC;cAA4B;gBAAED,IAAIF;cAAW;;YAC3DI,UAAU,IAAI,KAAK;YACnBC,aAAa;cAAC;cAAiB;gBAAEH,IAAIF;cAAW;;YAChDM,WAAW;cAAC;cAAe;gBAAEJ,IAAIF;cAAW;;YAC5CO,UAAU,MAAMf,SAAS,IAAA;UAC3B;QACF,CAAA,CAAA;QAEJgB,gBAAgB,MACdnB,WACEM,aAAaC,aAAaC,UAAU;UAClCC,MAAM;UACNC,SAAS;YACPtB,IAAI,GAAGuB,UAAAA;YACPC,OAAO;cAAC;cAAuB;gBAAEC,IAAIF;cAAW;;YAChDS,YAAY;cAAC;cAAiB;gBAAEP,IAAIF;cAAW;;UACjD;QACF,CAAA,CAAA;QAEJU,iBAAiB,CAACC,QAAAA;AAChBC,2BAAiBD,GAAAA;AACjBE,cAAIC,MAAMH,KAAAA,QAAAA;;;;;;QACZ;MACF,CAAA;AAEA,aAAO7B,YAAYC,aAAagC,MAAM,IAAA;IACxC;EACF,CAAA;CACD;",
6
+ "names": ["PWA_PLUGIN", "meta", "id", "registerSW", "Capabilities", "contributes", "createIntent", "defineModule", "definePlugin", "Events", "LayoutAction", "log", "captureException", "PWA_PLUGIN", "PwaPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "DispatcherReady", "context", "dispatchPromise", "dispatch", "requestCapability", "IntentDispatcher", "updateSW", "registerSW", "onNeedRefresh", "createIntent", "LayoutAction", "AddToast", "part", "subject", "PWA_PLUGIN", "title", "ns", "description", "duration", "actionLabel", "actionAlt", "onAction", "onOfflineReady", "closeLabel", "onRegisterError", "err", "captureException", "log", "error", "Null"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/plugins/plugin-pwa/src/meta.ts":{"bytes":875,"imports":[],"format":"esm"},"packages/plugins/plugin-pwa/src/PwaPlugin.tsx":{"bytes":8936,"imports":[{"path":"virtual:pwa-register","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/observability/sentry","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-pwa/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-pwa/src/index.ts":{"bytes":580,"imports":[{"path":"packages/plugins/plugin-pwa/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-pwa/src/PwaPlugin.tsx","kind":"import-statement","original":"./PwaPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-pwa/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4147},"packages/plugins/plugin-pwa/dist/lib/browser/index.mjs":{"imports":[{"path":"virtual:pwa-register","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/observability/sentry","kind":"import-statement","external":true}],"exports":["PWA_PLUGIN","PwaPlugin","meta"],"entryPoint":"packages/plugins/plugin-pwa/src/index.ts","inputs":{"packages/plugins/plugin-pwa/src/meta.ts":{"bytesInOutput":73},"packages/plugins/plugin-pwa/src/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-pwa/src/PwaPlugin.tsx":{"bytesInOutput":2281}},"bytes":2528}}}
1
+ {"inputs":{"packages/plugins/plugin-pwa/src/meta.ts":{"bytes":875,"imports":[],"format":"esm"},"packages/plugins/plugin-pwa/src/translations.ts":{"bytes":2353,"imports":[{"path":"packages/plugins/plugin-pwa/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-pwa/src/PwaPlugin.tsx":{"bytes":9806,"imports":[{"path":"virtual:pwa-register","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/observability/sentry","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-pwa/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-pwa/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/plugins/plugin-pwa/src/index.ts":{"bytes":580,"imports":[{"path":"packages/plugins/plugin-pwa/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-pwa/src/PwaPlugin.tsx","kind":"import-statement","original":"./PwaPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-pwa/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5452},"packages/plugins/plugin-pwa/dist/lib/browser/index.mjs":{"imports":[{"path":"virtual:pwa-register","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/observability/sentry","kind":"import-statement","external":true}],"exports":["PWA_PLUGIN","PwaPlugin","meta"],"entryPoint":"packages/plugins/plugin-pwa/src/index.ts","inputs":{"packages/plugins/plugin-pwa/src/meta.ts":{"bytesInOutput":73},"packages/plugins/plugin-pwa/src/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-pwa/src/PwaPlugin.tsx":{"bytesInOutput":2470},"packages/plugins/plugin-pwa/src/translations.ts":{"bytesInOutput":620}},"bytes":3439}}}
@@ -1 +1 @@
1
- {"version":3,"file":"PwaPlugin.d.ts","sourceRoot":"","sources":["../../../src/PwaPlugin.tsx"],"names":[],"mappings":"AAoBA,eAAO,MAAM,SAAS,4CA4ClB,CAAC"}
1
+ {"version":3,"file":"PwaPlugin.d.ts","sourceRoot":"","sources":["../../../src/PwaPlugin.tsx"],"names":[],"mappings":"AAqBA,eAAO,MAAM,SAAS,4CAiDlB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-pwa",
3
- "version": "0.7.5-staging.b81e783",
3
+ "version": "0.8.0",
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",
@@ -23,9 +23,9 @@
23
23
  "src"
24
24
  ],
25
25
  "dependencies": {
26
- "@dxos/observability": "0.7.5-staging.b81e783",
27
- "@dxos/log": "0.7.5-staging.b81e783",
28
- "@dxos/app-framework": "0.7.5-staging.b81e783"
26
+ "@dxos/app-framework": "0.8.0",
27
+ "@dxos/log": "0.8.0",
28
+ "@dxos/observability": "0.8.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@phosphor-icons/react": "^2.1.5",
@@ -36,15 +36,15 @@
36
36
  "vite": "5.4.7",
37
37
  "vite-plugin-pwa": "^0.18.2",
38
38
  "workbox-window": "^7.0.0",
39
- "@dxos/react-ui-theme": "0.7.5-staging.b81e783",
40
- "@dxos/storybook-utils": "0.7.5-staging.b81e783",
41
- "@dxos/react-ui": "0.7.5-staging.b81e783"
39
+ "@dxos/react-ui": "0.8.0",
40
+ "@dxos/react-ui-theme": "0.8.0",
41
+ "@dxos/storybook-utils": "0.8.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@phosphor-icons/react": "^2.1.5",
45
45
  "react": "~18.2.0",
46
- "@dxos/react-ui-theme": "0.7.5-staging.b81e783",
47
- "@dxos/react-ui": "0.7.5-staging.b81e783"
46
+ "@dxos/react-ui": "0.8.0",
47
+ "@dxos/react-ui-theme": "0.8.0"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"
package/src/PwaPlugin.tsx CHANGED
@@ -17,9 +17,15 @@ import { log } from '@dxos/log';
17
17
  import { captureException } from '@dxos/observability/sentry';
18
18
 
19
19
  import { meta, PWA_PLUGIN } from './meta';
20
+ import translations from './translations';
20
21
 
21
22
  export const PwaPlugin = () =>
22
23
  definePlugin(meta, [
24
+ defineModule({
25
+ id: `${meta.id}/module/translations`,
26
+ activatesOn: Events.SetupTranslations,
27
+ activate: () => contributes(Capabilities.Translations, translations),
28
+ }),
23
29
  defineModule({
24
30
  id: `${meta.id}/module/register-pwa`,
25
31
  activatesOn: Events.DispatcherReady,