dsh-agency-agents 0.3.1 → 0.3.3

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.
Files changed (2) hide show
  1. package/client.js +21 -4
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -10,7 +10,7 @@
10
10
  * lazy factory, and every side effect lives inside `apply`.
11
11
  */
12
12
  window.__ModuleLoader__.load({
13
- id: '@local/agency-agents',
13
+ id: 'dsh-agency-agents',
14
14
  factory(require) {
15
15
  const React = require('react')
16
16
  const h = React.createElement
@@ -533,8 +533,22 @@ animation:aag-spin .8s linear infinite}
533
533
  */
534
534
  function AgencyConfigPage(props) {
535
535
  const t = typeof props.t === 'function' ? props.t : key => key
536
- const form = props.form
537
- const values = form?.state?.value
536
+ const provided = props.form
537
+ // The row page passes a Host-owned form; the bundle page does not, so fall
538
+ // back to the shared client ConfigForms service for the same namespace.
539
+ const fetchForm = React.useCallback(() => {
540
+ const service = ctx0.get('configForms')
541
+ return service?.get?.('agency-agents')
542
+ }, [])
543
+ const [form] = React.useState(() => provided ?? fetchForm())
544
+ const [fallback, setFallback] = React.useState(undefined)
545
+ React.useEffect(() => {
546
+ if (provided !== undefined || form === undefined) return undefined
547
+ setFallback(form.getSnapshot())
548
+ return form.subscribe(() => setFallback(form.getSnapshot()))
549
+ }, [provided, form])
550
+ const snapshot = provided?.state ?? fallback
551
+ const values = snapshot?.value
538
552
  const [draft, setDraft] = React.useState(undefined)
539
553
  const [busy, setBusy] = React.useState(false)
540
554
  const [notice, setNotice] = React.useState(undefined)
@@ -563,7 +577,7 @@ animation:aag-spin .8s linear infinite}
563
577
  )
564
578
  }
565
579
  if (form === undefined) return h('p', { className: 'aag-configHint' }, t('config.unavailable'))
566
- if (form.state.status !== 'ready' || draft === undefined) return h(Skeleton)
580
+ if (snapshot?.status !== 'ready' || draft === undefined) return h(Skeleton)
567
581
 
568
582
  const persist = async ops => {
569
583
  setBusy(true)
@@ -1638,6 +1652,9 @@ animation:aag-spin .8s linear infinite}
1638
1652
  ctx.slots.inject('plugins.row.config', () =>
1639
1653
  ctx.slots.register({ name: 'plugins.row.config', key: 'dsh-agency-agents#agency-agents', locale: NS }, AgencyConfigPage),
1640
1654
  )
1655
+ ctx.slots.inject('plugins.bundle.config', () =>
1656
+ ctx.slots.register({ name: 'plugins.bundle.config', key: 'dsh-agency-agents', locale: NS }, AgencyConfigPage),
1657
+ )
1641
1658
  },
1642
1659
  }
1643
1660
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agency-agents",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
 
5
5
  "type": "module",
6
6
  "main": "index.js",