@crombolo/backoffice-host 0.28.0 → 0.29.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crombolo/backoffice-host",
3
- "version": "0.28.0",
3
+ "version": "0.29.1",
4
4
  "description": "Serves the Umbraco backoffice SPA: shell HTML, import map and package manifests.",
5
5
  "license": "MIT",
6
6
  "author": "Crombolo",
@@ -31,7 +31,7 @@
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
- "@crombolo/core": "0.28.0",
34
+ "@crombolo/core": "0.29.1",
35
35
  "@crombolo/backoffice-dist": "18.2.0"
36
36
  }
37
37
  }
@@ -2,7 +2,7 @@
2
2
  "$schema": "../../../backoffice-dist/dist/umbraco-package-schema.json",
3
3
  "name": "Crombolo App Preview",
4
4
  "id": "Crombolo.AppPreview",
5
- "version": "0.28.0",
5
+ "version": "0.29.1",
6
6
  "allowPublicAccess": false,
7
7
  "extensions": [
8
8
  {
@@ -0,0 +1,40 @@
1
+ /**
2
+ * A header app that says when the server's extensions changed under an open back
3
+ * office (story 181): a host installed or removed a bundle and reloaded. It
4
+ * offers a reload rather than reloading, so nobody loses what they were typing.
5
+ */
6
+ import { UmbElementMixin } from '@umbraco-cms/backoffice/element-api'
7
+ import { css, html, LitElement, nothing } from '@umbraco-cms/backoffice/external/lit'
8
+ import { UMB_MANAGEMENT_API_SERVER_EVENT_CONTEXT } from '@umbraco-cms/backoffice/management-api'
9
+
10
+ export default class CromboloBundlesChangedElement extends UmbElementMixin(LitElement) {
11
+ static properties = { _changed: { state: true } }
12
+
13
+ constructor() {
14
+ super()
15
+ this._changed = false
16
+ this.consumeContext(UMB_MANAGEMENT_API_SERVER_EVENT_CONTEXT, (context) => {
17
+ if (!context) return
18
+ this.observe(context.byEventSourcesAndEventTypes(['Crombolo:Bundles'], ['Changed']), () => {
19
+ this._changed = true
20
+ })
21
+ })
22
+ }
23
+
24
+ render() {
25
+ if (!this._changed) return nothing
26
+ return html`<uui-tag color="warning" look="primary">
27
+ Extensions changed
28
+ <uui-button compact look="secondary" label="Reload to use them" @click=${() => window.location.reload()}>
29
+ Reload to use them
30
+ </uui-button>
31
+ </uui-tag>`
32
+ }
33
+
34
+ static styles = css`
35
+ :host { display: flex; align-items: center; padding: 0 var(--uui-size-space-3); }
36
+ uui-tag { gap: var(--uui-size-space-2); }
37
+ `
38
+ }
39
+
40
+ customElements.define('crombolo-bundles-changed', CromboloBundlesChangedElement)
@@ -28,6 +28,7 @@ export default class CromboloBundlesMarketplaceElement extends UmbLitElement {
28
28
  _appliesContent: { state: true },
29
29
  _declined: { state: true },
30
30
  _installs: { state: true },
31
+ _elsewhere: { state: true },
31
32
  }
32
33
 
33
34
  constructor() {
@@ -43,6 +44,7 @@ export default class CromboloBundlesMarketplaceElement extends UmbLitElement {
43
44
  this._appliesContent = true
44
45
  this._declined = new Set()
45
46
  this._installs = true
47
+ this._elsewhere = null
46
48
  }
47
49
 
48
50
  connectedCallback() {
@@ -60,6 +62,7 @@ export default class CromboloBundlesMarketplaceElement extends UmbLitElement {
60
62
  this._url = result.url ?? ''
61
63
  this._appliesContent = result.appliesContent !== false
62
64
  this._installs = result.installs !== false
65
+ this._elsewhere = result.installsElsewhere ?? null
63
66
  } catch (error) {
64
67
  this._error = error instanceof Error ? error.message : String(error)
65
68
  } finally {
@@ -67,6 +70,12 @@ export default class CromboloBundlesMarketplaceElement extends UmbLitElement {
67
70
  }
68
71
  }
69
72
 
73
+ /** The host's own place for installs, when it gave one. */
74
+ #elsewhereLink() {
75
+ const url = this._elsewhere?.url
76
+ return url ? html`<a href=${url} target="_blank" rel="noopener">Add bundles</a>` : ''
77
+ }
78
+
70
79
  #search(event) {
71
80
  this._query = event.target.value ?? ''
72
81
  this.#load()
@@ -141,7 +150,9 @@ export default class CromboloBundlesMarketplaceElement extends UmbLitElement {
141
150
  ${
142
151
  this._installs
143
152
  ? nothing
144
- : html`<div id="notice">Bundles are added to this site by a deploy, so that every server has them: add one to the site's <code>package.json</code> and deploy it.</div>`
153
+ : this._elsewhere
154
+ ? html`<div id="notice">${this._elsewhere.message} ${this.#elsewhereLink()}</div>`
155
+ : html`<div id="notice">Bundles are added to this site by a deploy, so that every server has them: add one to the site's <code>package.json</code> and deploy it.</div>`
145
156
  }
146
157
  ${
147
158
  this._items.length === 0 && !this._error
@@ -170,7 +181,9 @@ export default class CromboloBundlesMarketplaceElement extends UmbLitElement {
170
181
  item.installedVersion
171
182
  ? html`<uui-tag look="positive">Installed ${item.installedVersion}</uui-tag>`
172
183
  : !this._installs
173
- ? html`<p class="meta">Add it to the site with <code>bun add ${item.name}</code>, then deploy.</p>`
184
+ ? this._elsewhere
185
+ ? html`<p class="meta">${this.#elsewhereLink() || this._elsewhere.message}</p>`
186
+ : html`<p class="meta">Add it to the site with <code>bun add ${item.name}</code>, then deploy.</p>`
174
187
  : html`
175
188
  <uui-button
176
189
  look="primary"
@@ -2,7 +2,7 @@
2
2
  "$schema": "../../../backoffice-dist/dist/umbraco-package-schema.json",
3
3
  "name": "Crombolo Localizations",
4
4
  "id": "Crombolo.Localizations",
5
- "version": "0.28.0",
5
+ "version": "0.29.1",
6
6
  "allowPublicAccess": true,
7
7
  "extensions": [
8
8
  {
@@ -2,7 +2,7 @@
2
2
  "$schema": "../../../backoffice-dist/dist/umbraco-package-schema.json",
3
3
  "name": "Crombolo Search & sharing",
4
4
  "id": "Crombolo.Seo",
5
- "version": "0.28.0",
5
+ "version": "0.29.1",
6
6
  "allowPublicAccess": false,
7
7
  "extensions": [
8
8
  {
@@ -2,7 +2,7 @@
2
2
  "$schema": "../../../backoffice-dist/dist/umbraco-package-schema.json",
3
3
  "name": "Crombolo Sign-in Dialog",
4
4
  "id": "Crombolo.SignInDialog",
5
- "version": "0.28.0",
5
+ "version": "0.29.1",
6
6
  "allowPublicAccess": true,
7
7
  "extensions": [
8
8
  {
@@ -2,7 +2,7 @@
2
2
  "$schema": "../../backoffice-dist/dist/umbraco-package-schema.json",
3
3
  "name": "Crombolo",
4
4
  "id": "Crombolo.Core",
5
- "version": "0.28.0",
5
+ "version": "0.29.1",
6
6
  "allowPublicAccess": false,
7
7
  "extensions": [
8
8
  {
@@ -301,6 +301,13 @@
301
301
  "element": "/crombolo-plugin/read-only-banner.js",
302
302
  "weight": 1000
303
303
  },
304
+ {
305
+ "type": "headerApp",
306
+ "alias": "Crombolo.HeaderApp.BundlesChanged",
307
+ "name": "Crombolo Extensions Changed Notice",
308
+ "element": "/crombolo-plugin/bundles-changed.js",
309
+ "weight": 999
310
+ },
304
311
  {
305
312
  "type": "headerApp",
306
313
  "kind": "button",