@huaqiu/dsh-hardware-ui 0.7.21 → 0.7.23

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": "@huaqiu/dsh-hardware-ui",
3
- "version": "0.7.21",
3
+ "version": "0.7.23",
4
4
  "type": "module",
5
5
  "description": "Hardware Engineering product UI for DSH: five-destination engineering navigation, right-panel artifact viewer, CAD installation settings and contextual native-application actions.",
6
6
  "license": "MIT",
@@ -51,12 +51,16 @@ export const HARDWARE_CONFIG_ENTRY = 'hardware-artifacts'
51
51
  declare global {
52
52
  interface Window {
53
53
  /**
54
- * The one-method handle the desktop shell's Place Order menu calls (PO-02).
54
+ * Desktop's preload surface, reached through `contextBridge` (PO-02).
55
55
  *
56
- * A handle rather than a shell-side URL or IPC: the shell stays unable to
57
- * name a project, but can still ask the workflow to start.
56
+ * Only the member this plugin needs is declared: Desktop windows run with
57
+ * `contextIsolation: true`, so the plugin cannot publish a callback by
58
+ * assigning a window global — it must hand the callback to preload, which
59
+ * the caption menu then runs.
58
60
  */
59
- huaqiu?: { placeOrder?: () => boolean }
61
+ dshDesktop?: {
62
+ registerPlaceOrder?: (handler: () => boolean) => () => void
63
+ }
60
64
  }
61
65
  }
62
66
 
@@ -293,14 +297,14 @@ export function apply(ctx: ClientContext): void {
293
297
  }) ?? (() => {}), 'hardware-ui: place order tab type')
294
298
 
295
299
  // The desktop shell's Place Order menu (PO-02) needs one thing from this
296
- // plugin: a way to ask for the workflow. It is a single handle with a single
297
- // method, installed while the plugin is active and removed with it, so the
298
- // menu never reaches into business logic and a reload keeps working.
300
+ // plugin: a way to ask for the workflow. Desktop preload owns the registry
301
+ // (`dshDesktop.registerPlaceOrder`) and the caption entry runs whatever is
302
+ // registered, so the menu never reaches into business logic. Leaving the
303
+ // registration behind when the plugin unloads keeps "not loaded" honest.
299
304
  if (typeof window !== 'undefined') {
300
305
  effect(() => {
301
- const handle = { placeOrder: (): boolean => controller.placeOrder() }
302
- window.huaqiu = handle
303
- return () => { if (window.huaqiu === handle) delete window.huaqiu }
306
+ const unregister = window.dshDesktop?.registerPlaceOrder?.(() => controller.placeOrder())
307
+ return () => { unregister?.() }
304
308
  }, 'hardware-ui: place order handle')
305
309
  }
306
310