@jay-framework/runtime-automation 0.15.5 → 0.16.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.
Files changed (2) hide show
  1. package/dist/index.js +16 -14
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -196,11 +196,6 @@ class AutomationAgent {
196
196
  if (options) {
197
197
  this.initialSlowViewState = options.initialViewState;
198
198
  this.trackByMap = options.trackByMap;
199
- this.mergedViewState = deepMergeViewStates(
200
- options.initialViewState,
201
- this.component.viewState || {},
202
- options.trackByMap
203
- );
204
199
  }
205
200
  this.subscribeToUpdates();
206
201
  }
@@ -208,13 +203,7 @@ class AutomationAgent {
208
203
  this.viewStateHandler = () => {
209
204
  this.cachedRaw = null;
210
205
  this.cachedGrouped = null;
211
- if (this.initialSlowViewState && this.trackByMap) {
212
- this.mergedViewState = deepMergeViewStates(
213
- this.initialSlowViewState,
214
- this.component.viewState || {},
215
- this.trackByMap
216
- );
217
- }
206
+ this.mergedViewState = null;
218
207
  this.notifyListeners();
219
208
  };
220
209
  this.component.addEventListener(VIEW_STATE_CHANGE, this.viewStateHandler);
@@ -235,9 +224,22 @@ class AutomationAgent {
235
224
  return this.cachedGrouped;
236
225
  }
237
226
  getPageState() {
227
+ let viewState;
228
+ if (this.initialSlowViewState && this.trackByMap) {
229
+ viewState = deepMergeViewStates(
230
+ this.initialSlowViewState,
231
+ this.component.viewState || {},
232
+ this.trackByMap
233
+ );
234
+ const componentInstances = this.component.viewState?.__headlessInstances;
235
+ if (componentInstances) {
236
+ viewState.__headlessInstances = componentInstances;
237
+ }
238
+ } else {
239
+ viewState = this.component.viewState;
240
+ }
238
241
  return {
239
- // Use merged state if available (slow+fast), otherwise component's viewState
240
- viewState: this.mergedViewState || this.component.viewState,
242
+ viewState,
241
243
  interactions: this.getGrouped(),
242
244
  customEvents: this.getCustomEvents()
243
245
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/runtime-automation",
3
- "version": "0.15.5",
3
+ "version": "0.16.0",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Automation API for Jay components - enables programmatic state inspection and interaction triggering",
@@ -21,12 +21,12 @@
21
21
  "test:watch": "vitest"
22
22
  },
23
23
  "dependencies": {
24
- "@jay-framework/runtime": "^0.15.5",
25
- "@jay-framework/view-state-merge": "^0.15.5"
24
+ "@jay-framework/runtime": "^0.16.0",
25
+ "@jay-framework/view-state-merge": "^0.16.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@jay-framework/component": "^0.15.5",
29
- "@jay-framework/dev-environment": "^0.15.5",
28
+ "@jay-framework/component": "^0.16.0",
29
+ "@jay-framework/dev-environment": "^0.16.0",
30
30
  "@types/node": "^20.11.5",
31
31
  "rimraf": "^5.0.5",
32
32
  "tsup": "^8.0.1",