@syntrologie/runtime-sdk 2.8.0-canary.144 → 2.8.0-canary.145
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/dist/index.js +108 -148
- package/dist/index.js.map +4 -4
- package/dist/smart-canvas.esm.js +38 -38
- package/dist/smart-canvas.esm.js.map +4 -4
- package/dist/smart-canvas.js +109 -149
- package/dist/smart-canvas.js.map +4 -4
- package/dist/smart-canvas.min.js +38 -38
- package/dist/smart-canvas.min.js.map +4 -4
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2436,12 +2436,12 @@ if (typeof window !== "undefined" && !customElements.get(TAG_NAME)) {
|
|
|
2436
2436
|
var WorkflowWidgetLitMountable = {
|
|
2437
2437
|
mount(container, config) {
|
|
2438
2438
|
var _a3;
|
|
2439
|
-
const
|
|
2439
|
+
const runtime5 = (_a3 = config == null ? void 0 : config.runtime) != null ? _a3 : null;
|
|
2440
2440
|
if (typeof window !== "undefined" && !customElements.get(TAG_NAME)) {
|
|
2441
2441
|
customElements.define(TAG_NAME, WorkflowTrackerLit);
|
|
2442
2442
|
}
|
|
2443
2443
|
const el = document.createElement(TAG_NAME);
|
|
2444
|
-
el.runtimeRef =
|
|
2444
|
+
el.runtimeRef = runtime5;
|
|
2445
2445
|
container.appendChild(el);
|
|
2446
2446
|
return () => {
|
|
2447
2447
|
el.remove();
|
|
@@ -2452,8 +2452,8 @@ var WorkflowWidgetLitMountable = {
|
|
|
2452
2452
|
const el = container.querySelector(TAG_NAME);
|
|
2453
2453
|
if (!el)
|
|
2454
2454
|
return;
|
|
2455
|
-
const
|
|
2456
|
-
el.runtimeRef =
|
|
2455
|
+
const runtime5 = (_a3 = config == null ? void 0 : config.runtime) != null ? _a3 : null;
|
|
2456
|
+
el.runtimeRef = runtime5;
|
|
2457
2457
|
}
|
|
2458
2458
|
};
|
|
2459
2459
|
|
|
@@ -2794,11 +2794,11 @@ var runtime2 = {
|
|
|
2794
2794
|
|
|
2795
2795
|
// src/apps/AppContext.ts
|
|
2796
2796
|
function createAppContext(options) {
|
|
2797
|
-
const { appId, runtime:
|
|
2797
|
+
const { appId, runtime: runtime5, isBuiltIn = false } = options;
|
|
2798
2798
|
const _statePrefix = `app:${appId}:`;
|
|
2799
2799
|
const registeredActions = [];
|
|
2800
2800
|
const registeredWidgets = [];
|
|
2801
|
-
const appStorage =
|
|
2801
|
+
const appStorage = runtime5.state.ns(`app:${appId}`);
|
|
2802
2802
|
const context = {
|
|
2803
2803
|
appId,
|
|
2804
2804
|
// Namespaced state access (using session storage scoped to this app)
|
|
@@ -2808,22 +2808,22 @@ function createAppContext(options) {
|
|
|
2808
2808
|
remove: (key) => appStorage.remove(key)
|
|
2809
2809
|
},
|
|
2810
2810
|
// Telemetry access (if available) - using EventBus for custom events
|
|
2811
|
-
telemetry:
|
|
2811
|
+
telemetry: runtime5.telemetry ? {
|
|
2812
2812
|
emit: (eventName, props) => {
|
|
2813
|
-
|
|
2813
|
+
runtime5.events.publish(eventName, {
|
|
2814
2814
|
...props,
|
|
2815
2815
|
_appId: appId
|
|
2816
2816
|
});
|
|
2817
2817
|
},
|
|
2818
2818
|
getSessionId: () => {
|
|
2819
2819
|
var _a3, _b;
|
|
2820
|
-
return (_b = (_a3 =
|
|
2820
|
+
return (_b = (_a3 = runtime5.telemetry) == null ? void 0 : _a3.getSessionId) == null ? void 0 : _b.call(_a3);
|
|
2821
2821
|
}
|
|
2822
2822
|
} : void 0,
|
|
2823
2823
|
// Surfaces access
|
|
2824
2824
|
surfaces: {
|
|
2825
2825
|
mount: (slot, content, opts) => {
|
|
2826
|
-
const handle =
|
|
2826
|
+
const handle = runtime5.surfaces.mount(slot, content, {
|
|
2827
2827
|
...opts,
|
|
2828
2828
|
adaptiveId: appId
|
|
2829
2829
|
});
|
|
@@ -2832,15 +2832,15 @@ function createAppContext(options) {
|
|
|
2832
2832
|
update: (newContent) => handle.update(newContent)
|
|
2833
2833
|
};
|
|
2834
2834
|
},
|
|
2835
|
-
canMount: (slot, priority) =>
|
|
2835
|
+
canMount: (slot, priority) => runtime5.surfaces.canMount(slot, priority)
|
|
2836
2836
|
},
|
|
2837
2837
|
// Events access
|
|
2838
2838
|
events: {
|
|
2839
|
-
subscribe: (callback) =>
|
|
2839
|
+
subscribe: (callback) => runtime5.events.subscribe((event) => {
|
|
2840
2840
|
callback(event);
|
|
2841
2841
|
}),
|
|
2842
2842
|
publish: (name, props) => {
|
|
2843
|
-
|
|
2843
|
+
runtime5.events.publish(name, {
|
|
2844
2844
|
...props,
|
|
2845
2845
|
_appId: appId
|
|
2846
2846
|
});
|
|
@@ -2848,7 +2848,7 @@ function createAppContext(options) {
|
|
|
2848
2848
|
},
|
|
2849
2849
|
// Action registration
|
|
2850
2850
|
registerAction: (definition) => {
|
|
2851
|
-
|
|
2851
|
+
runtime5.executors.register(
|
|
2852
2852
|
definition.kind,
|
|
2853
2853
|
definition.executor,
|
|
2854
2854
|
definition.schema,
|
|
@@ -2859,15 +2859,15 @@ function createAppContext(options) {
|
|
|
2859
2859
|
},
|
|
2860
2860
|
// Widget registration
|
|
2861
2861
|
registerWidget: (definition) => {
|
|
2862
|
-
|
|
2862
|
+
runtime5.widgets.register(definition.id, definition.component, appId, definition.metadata);
|
|
2863
2863
|
registeredWidgets.push(definition.id);
|
|
2864
2864
|
}
|
|
2865
2865
|
};
|
|
2866
2866
|
return context;
|
|
2867
2867
|
}
|
|
2868
|
-
function cleanupAppContext(appId,
|
|
2869
|
-
|
|
2870
|
-
|
|
2868
|
+
function cleanupAppContext(appId, runtime5) {
|
|
2869
|
+
runtime5.executors.unregisterBySource(appId);
|
|
2870
|
+
runtime5.widgets.unregisterBySource(appId);
|
|
2871
2871
|
}
|
|
2872
2872
|
|
|
2873
2873
|
// src/apps/AppLoader.ts
|
|
@@ -2895,7 +2895,6 @@ var CORE_ACTION_KINDS = /* @__PURE__ */ new Set([
|
|
|
2895
2895
|
var BUNDLED_APP_IDS = /* @__PURE__ */ new Set([
|
|
2896
2896
|
"adaptive-content",
|
|
2897
2897
|
"adaptive-faq",
|
|
2898
|
-
"adaptive-gamification",
|
|
2899
2898
|
"adaptive-nav",
|
|
2900
2899
|
"adaptive-overlays"
|
|
2901
2900
|
]);
|
|
@@ -2904,7 +2903,12 @@ var NAMESPACE_TO_APP_ID = {
|
|
|
2904
2903
|
nav: "adaptive-nav",
|
|
2905
2904
|
gamification: "adaptive-gamification",
|
|
2906
2905
|
overlays: "adaptive-overlays",
|
|
2907
|
-
content: "adaptive-content"
|
|
2906
|
+
content: "adaptive-content",
|
|
2907
|
+
// Widgets like `adaptive-viz:chart` use the full `adaptive-<name>` form as
|
|
2908
|
+
// namespace; the resolveAppId fallback covers it, but list it explicitly so
|
|
2909
|
+
// it shows up in the bundled minified output and matches the established
|
|
2910
|
+
// pattern for lazy-loaded adaptives.
|
|
2911
|
+
"adaptive-viz": "adaptive-viz"
|
|
2908
2912
|
};
|
|
2909
2913
|
function resolveAppId(namespace) {
|
|
2910
2914
|
var _a3;
|
|
@@ -3088,8 +3092,8 @@ var AppRegistry = class {
|
|
|
3088
3092
|
* Bind the registry to a runtime instance.
|
|
3089
3093
|
* Must be called before apps can be activated.
|
|
3090
3094
|
*/
|
|
3091
|
-
bind(
|
|
3092
|
-
this.runtime =
|
|
3095
|
+
bind(runtime5) {
|
|
3096
|
+
this.runtime = runtime5;
|
|
3093
3097
|
}
|
|
3094
3098
|
/**
|
|
3095
3099
|
* Unbind from the current runtime.
|
|
@@ -5349,7 +5353,7 @@ if (!customElements.get("syntro-faq-accordion")) {
|
|
|
5349
5353
|
// ../adaptives/adaptive-faq/dist/runtime.js
|
|
5350
5354
|
var FAQWidgetLitMountable = {
|
|
5351
5355
|
mount(container, config) {
|
|
5352
|
-
const { runtime:
|
|
5356
|
+
const { runtime: runtime5, instanceId = "faq-widget", ...faqConfig } = config != null ? config : {
|
|
5353
5357
|
expandBehavior: "single",
|
|
5354
5358
|
searchable: false,
|
|
5355
5359
|
theme: "auto",
|
|
@@ -5358,7 +5362,7 @@ var FAQWidgetLitMountable = {
|
|
|
5358
5362
|
const el = document.createElement("syntro-faq-accordion");
|
|
5359
5363
|
Object.assign(el, {
|
|
5360
5364
|
faqConfig,
|
|
5361
|
-
runtime:
|
|
5365
|
+
runtime: runtime5 != null ? runtime5 : null,
|
|
5362
5366
|
instanceId
|
|
5363
5367
|
});
|
|
5364
5368
|
container.appendChild(el);
|
|
@@ -5412,50 +5416,6 @@ var runtime3 = {
|
|
|
5412
5416
|
}
|
|
5413
5417
|
};
|
|
5414
5418
|
|
|
5415
|
-
// ../adaptives/adaptive-gamification/dist/runtime.js
|
|
5416
|
-
var executeAwardBadge = async (action, context) => {
|
|
5417
|
-
const { badgeId } = action;
|
|
5418
|
-
context.publishEvent("gamification.badge_awarded", {
|
|
5419
|
-
badgeId,
|
|
5420
|
-
awardedAt: Date.now()
|
|
5421
|
-
});
|
|
5422
|
-
return {
|
|
5423
|
-
cleanup: () => {
|
|
5424
|
-
}
|
|
5425
|
-
};
|
|
5426
|
-
};
|
|
5427
|
-
var executeAddPoints = async (action, context) => {
|
|
5428
|
-
const { points, reason } = action;
|
|
5429
|
-
context.publishEvent("gamification.points_added", {
|
|
5430
|
-
points,
|
|
5431
|
-
reason,
|
|
5432
|
-
timestamp: Date.now()
|
|
5433
|
-
});
|
|
5434
|
-
return {
|
|
5435
|
-
cleanup: () => {
|
|
5436
|
-
}
|
|
5437
|
-
};
|
|
5438
|
-
};
|
|
5439
|
-
var badgeTriggerHandler = {
|
|
5440
|
-
names: ["page_view", "button_click"],
|
|
5441
|
-
handler: (_event, _ctx) => {
|
|
5442
|
-
console.log("[Gamification] Event received for badge trigger check");
|
|
5443
|
-
}
|
|
5444
|
-
};
|
|
5445
|
-
var executors3 = [
|
|
5446
|
-
{ kind: "gamification:awardBadge", executor: executeAwardBadge },
|
|
5447
|
-
{ kind: "gamification:addPoints", executor: executeAddPoints }
|
|
5448
|
-
];
|
|
5449
|
-
var eventHandlers = [badgeTriggerHandler];
|
|
5450
|
-
var runtime4 = {
|
|
5451
|
-
id: "adaptive-gamification",
|
|
5452
|
-
version: "1.0.0",
|
|
5453
|
-
name: "Gamification",
|
|
5454
|
-
description: "Badges, rewards, points, and engagement mechanics",
|
|
5455
|
-
executors: executors3,
|
|
5456
|
-
eventHandlers
|
|
5457
|
-
};
|
|
5458
|
-
|
|
5459
5419
|
// ../adaptives/adaptive-nav/dist/NavWidgetLit.js
|
|
5460
5420
|
import { html as html3, LitElement as LitElement3, nothing as nothing3 } from "lit";
|
|
5461
5421
|
import { styleMap as styleMap3 } from "lit/directives/style-map.js";
|
|
@@ -6010,25 +5970,25 @@ var NavWidgetLitMountable = {
|
|
|
6010
5970
|
mount(container, config) {
|
|
6011
5971
|
registerNavWidgetLit();
|
|
6012
5972
|
const el = document.createElement("syntro-nav-tips");
|
|
6013
|
-
const { runtime:
|
|
5973
|
+
const { runtime: runtime5, instanceId = "nav-widget", ...navConfig } = config != null ? config : {
|
|
6014
5974
|
expandBehavior: "single",
|
|
6015
5975
|
theme: "auto",
|
|
6016
5976
|
actions: []
|
|
6017
5977
|
};
|
|
6018
5978
|
Object.assign(el, {
|
|
6019
5979
|
config: navConfig,
|
|
6020
|
-
runtime:
|
|
5980
|
+
runtime: runtime5,
|
|
6021
5981
|
instanceId
|
|
6022
5982
|
});
|
|
6023
5983
|
container.appendChild(el);
|
|
6024
5984
|
return () => el.remove();
|
|
6025
5985
|
}
|
|
6026
5986
|
};
|
|
6027
|
-
var
|
|
5987
|
+
var executors3 = [
|
|
6028
5988
|
{ kind: "navigation:scrollTo", executor: executeScrollTo },
|
|
6029
5989
|
{ kind: "navigation:navigate", executor: executeNavigate }
|
|
6030
5990
|
];
|
|
6031
|
-
var
|
|
5991
|
+
var runtime4 = {
|
|
6032
5992
|
id: "adaptive-nav",
|
|
6033
5993
|
version: "2.0.0",
|
|
6034
5994
|
name: "Navigation Tips",
|
|
@@ -6036,7 +5996,7 @@ var runtime5 = {
|
|
|
6036
5996
|
/**
|
|
6037
5997
|
* Navigation action executors (scrollTo, navigate).
|
|
6038
5998
|
*/
|
|
6039
|
-
executors:
|
|
5999
|
+
executors: executors3,
|
|
6040
6000
|
/**
|
|
6041
6001
|
* Widget definitions for the runtime's WidgetRegistry.
|
|
6042
6002
|
*/
|
|
@@ -6074,7 +6034,7 @@ var runtime5 = {
|
|
|
6074
6034
|
};
|
|
6075
6035
|
|
|
6076
6036
|
// src/apps/builtinRuntimeModules.ts
|
|
6077
|
-
var allRuntimes = [runtime, runtime3, runtime4,
|
|
6037
|
+
var allRuntimes = [runtime, runtime3, runtime4, runtime2];
|
|
6078
6038
|
var builtinAdaptiveManifests = allRuntimes.map((r) => ({
|
|
6079
6039
|
id: r.id,
|
|
6080
6040
|
version: r.version,
|
|
@@ -7035,37 +6995,37 @@ var SyntroCanvasOverlay = class extends LitElement4 {
|
|
|
7035
6995
|
// ---- NotifyWatcher (Lit equivalent of useNotifyWatcher) ----------------
|
|
7036
6996
|
_startNotifyWatcher() {
|
|
7037
6997
|
var _a3, _b;
|
|
7038
|
-
const
|
|
7039
|
-
if (!(
|
|
7040
|
-
const entries = collectNotifyEntries(this.tiles,
|
|
6998
|
+
const runtime5 = this.runtimeRef;
|
|
6999
|
+
if (!(runtime5 == null ? void 0 : runtime5.events) || !runtime5.apps) return;
|
|
7000
|
+
const entries = collectNotifyEntries(this.tiles, runtime5.apps);
|
|
7041
7001
|
if (entries.length === 0) return;
|
|
7042
|
-
const notifiedStore =
|
|
7002
|
+
const notifiedStore = runtime5.state.ns("notified");
|
|
7043
7003
|
for (const entry of entries) {
|
|
7044
7004
|
if (!this._notifyPrevState.has(entry.id)) {
|
|
7045
|
-
const result =
|
|
7005
|
+
const result = runtime5.evaluateSync(entry.strategy);
|
|
7046
7006
|
this._notifyPrevState.set(entry.id, result.value);
|
|
7047
7007
|
if (result.value && !notifiedStore.has(entry.id)) {
|
|
7048
7008
|
notifiedStore.set(entry.id, true);
|
|
7049
|
-
|
|
7009
|
+
runtime5.events.publish(entry.eventName, entry.eventProps);
|
|
7050
7010
|
}
|
|
7051
7011
|
}
|
|
7052
7012
|
}
|
|
7053
7013
|
const reeval = () => {
|
|
7054
7014
|
var _a4;
|
|
7055
7015
|
for (const entry of entries) {
|
|
7056
|
-
const result =
|
|
7016
|
+
const result = runtime5.evaluateSync(entry.strategy);
|
|
7057
7017
|
const wasVisible = (_a4 = this._notifyPrevState.get(entry.id)) != null ? _a4 : false;
|
|
7058
7018
|
this._notifyPrevState.set(entry.id, result.value);
|
|
7059
7019
|
if (!wasVisible && result.value) {
|
|
7060
7020
|
notifiedStore.set(entry.id, true);
|
|
7061
|
-
|
|
7021
|
+
runtime5.events.publish(entry.eventName, entry.eventProps);
|
|
7062
7022
|
} else if (wasVisible && !result.value) {
|
|
7063
7023
|
notifiedStore.remove(entry.id);
|
|
7064
7024
|
}
|
|
7065
7025
|
}
|
|
7066
7026
|
};
|
|
7067
|
-
this._notifyUnsub =
|
|
7068
|
-
this._notifyUnsubMetrics = (_b = (_a3 =
|
|
7027
|
+
this._notifyUnsub = runtime5.events.subscribe(reeval);
|
|
7028
|
+
this._notifyUnsubMetrics = (_b = (_a3 = runtime5.sessionMetrics) == null ? void 0 : _a3.subscribe(reeval)) != null ? _b : null;
|
|
7069
7029
|
}
|
|
7070
7030
|
_stopNotifyWatcher() {
|
|
7071
7031
|
if (this._notifyUnsub) {
|
|
@@ -7748,7 +7708,7 @@ function error(prefix, message, data) {
|
|
|
7748
7708
|
}
|
|
7749
7709
|
|
|
7750
7710
|
// src/version.ts
|
|
7751
|
-
var SDK_VERSION = "2.8.0-canary.
|
|
7711
|
+
var SDK_VERSION = "2.8.0-canary.145";
|
|
7752
7712
|
|
|
7753
7713
|
// src/types.ts
|
|
7754
7714
|
var SDK_SCHEMA_VERSION = "2.0";
|
|
@@ -10481,7 +10441,7 @@ function createActionEngine(options) {
|
|
|
10481
10441
|
adaptiveId,
|
|
10482
10442
|
executorRegistry: executorRegistry2 = executorRegistry,
|
|
10483
10443
|
subscribeNavigation,
|
|
10484
|
-
runtime:
|
|
10444
|
+
runtime: runtime5
|
|
10485
10445
|
} = options;
|
|
10486
10446
|
const activeActions = /* @__PURE__ */ new Map();
|
|
10487
10447
|
const conditionalUnsubs = /* @__PURE__ */ new Map();
|
|
@@ -10564,7 +10524,7 @@ function createActionEngine(options) {
|
|
|
10564
10524
|
return executor(action, context);
|
|
10565
10525
|
}
|
|
10566
10526
|
function subscribeForReeval(id, action, triggerWhen, _handle) {
|
|
10567
|
-
if (!
|
|
10527
|
+
if (!runtime5) return;
|
|
10568
10528
|
const unsubs = [];
|
|
10569
10529
|
let reevalInFlight = false;
|
|
10570
10530
|
const onReeval = async () => {
|
|
@@ -10573,7 +10533,7 @@ function createActionEngine(options) {
|
|
|
10573
10533
|
if (!entry) return;
|
|
10574
10534
|
reevalInFlight = true;
|
|
10575
10535
|
try {
|
|
10576
|
-
const result =
|
|
10536
|
+
const result = runtime5.evaluateSync(triggerWhen);
|
|
10577
10537
|
const shouldApply = result.value;
|
|
10578
10538
|
if (entry.state === "applied" && !shouldApply) {
|
|
10579
10539
|
try {
|
|
@@ -10603,17 +10563,17 @@ function createActionEngine(options) {
|
|
|
10603
10563
|
reevalInFlight = false;
|
|
10604
10564
|
}
|
|
10605
10565
|
};
|
|
10606
|
-
if (
|
|
10607
|
-
unsubs.push(
|
|
10566
|
+
if (runtime5.context) {
|
|
10567
|
+
unsubs.push(runtime5.context.subscribe(onReeval));
|
|
10608
10568
|
}
|
|
10609
|
-
if (
|
|
10610
|
-
unsubs.push(
|
|
10569
|
+
if (runtime5.accumulator) {
|
|
10570
|
+
unsubs.push(runtime5.accumulator.subscribe(onReeval));
|
|
10611
10571
|
}
|
|
10612
|
-
if (
|
|
10613
|
-
unsubs.push(
|
|
10572
|
+
if (runtime5.sessionMetrics) {
|
|
10573
|
+
unsubs.push(runtime5.sessionMetrics.subscribe(onReeval));
|
|
10614
10574
|
}
|
|
10615
|
-
if (
|
|
10616
|
-
unsubs.push(
|
|
10575
|
+
if (runtime5.events) {
|
|
10576
|
+
unsubs.push(runtime5.events.subscribe(onReeval));
|
|
10617
10577
|
}
|
|
10618
10578
|
conditionalUnsubs.set(id, unsubs);
|
|
10619
10579
|
}
|
|
@@ -10630,8 +10590,8 @@ function createActionEngine(options) {
|
|
|
10630
10590
|
}
|
|
10631
10591
|
const id = generateId();
|
|
10632
10592
|
const triggerWhen = action.triggerWhen;
|
|
10633
|
-
if (triggerWhen &&
|
|
10634
|
-
const evalResult =
|
|
10593
|
+
if (triggerWhen && runtime5) {
|
|
10594
|
+
const evalResult = runtime5.evaluateSync(triggerWhen);
|
|
10635
10595
|
if (!evalResult.value) {
|
|
10636
10596
|
const entry2 = {
|
|
10637
10597
|
id,
|
|
@@ -10738,7 +10698,7 @@ function createActionEngine(options) {
|
|
|
10738
10698
|
return (_a3 = entry2 == null ? void 0 : entry2.state) != null ? _a3 : "reverted";
|
|
10739
10699
|
}
|
|
10740
10700
|
};
|
|
10741
|
-
if (triggerWhen &&
|
|
10701
|
+
if (triggerWhen && runtime5) {
|
|
10742
10702
|
subscribeForReeval(id, action, triggerWhen, handle);
|
|
10743
10703
|
}
|
|
10744
10704
|
return handle;
|
|
@@ -11612,15 +11572,15 @@ var createSmartCanvas = async (config = {}) => {
|
|
|
11612
11572
|
let currentConfig = null;
|
|
11613
11573
|
let currentFetcher = null;
|
|
11614
11574
|
let currentBatchHandle = null;
|
|
11615
|
-
const { runtime:
|
|
11575
|
+
const { runtime: runtime5 } = config;
|
|
11616
11576
|
async function applyActions(actions) {
|
|
11617
|
-
if (!(
|
|
11577
|
+
if (!(runtime5 == null ? void 0 : runtime5.actions) || actions.length === 0) {
|
|
11618
11578
|
return;
|
|
11619
11579
|
}
|
|
11620
11580
|
if (currentBatchHandle == null ? void 0 : currentBatchHandle.isApplied()) {
|
|
11621
11581
|
await currentBatchHandle.revertAll();
|
|
11622
11582
|
}
|
|
11623
|
-
currentBatchHandle = await
|
|
11583
|
+
currentBatchHandle = await runtime5.actions.applyBatch(actions);
|
|
11624
11584
|
}
|
|
11625
11585
|
async function revertActions() {
|
|
11626
11586
|
if (currentBatchHandle == null ? void 0 : currentBatchHandle.isApplied()) {
|
|
@@ -11648,12 +11608,12 @@ var createSmartCanvas = async (config = {}) => {
|
|
|
11648
11608
|
).join(", ")
|
|
11649
11609
|
);
|
|
11650
11610
|
}
|
|
11651
|
-
if (canvasConfig.actions && canvasConfig.actions.length > 0 && (
|
|
11611
|
+
if (canvasConfig.actions && canvasConfig.actions.length > 0 && (runtime5 == null ? void 0 : runtime5.actions)) {
|
|
11652
11612
|
await applyActions(canvasConfig.actions);
|
|
11653
11613
|
console.log("[SmartCanvas] Initial actions applied successfully");
|
|
11654
11614
|
}
|
|
11655
|
-
if (canvasConfig.tiles && (
|
|
11656
|
-
registerConfigPredicates(canvasConfig.tiles,
|
|
11615
|
+
if (canvasConfig.tiles && (runtime5 == null ? void 0 : runtime5.accumulator)) {
|
|
11616
|
+
registerConfigPredicates(canvasConfig.tiles, runtime5.accumulator, canvasConfig.actions);
|
|
11657
11617
|
}
|
|
11658
11618
|
} catch (error2) {
|
|
11659
11619
|
console.error("[SmartCanvas] Error fetching/applying initial config:", error2);
|
|
@@ -11688,7 +11648,7 @@ var createSmartCanvas = async (config = {}) => {
|
|
|
11688
11648
|
fetchCredentials: config.fetchCredentials,
|
|
11689
11649
|
experiments,
|
|
11690
11650
|
telemetry,
|
|
11691
|
-
runtime:
|
|
11651
|
+
runtime: runtime5,
|
|
11692
11652
|
initialBatchHandle: currentBatchHandle,
|
|
11693
11653
|
initialBatchActions: currentBatchHandle ? (_k = currentConfig == null ? void 0 : currentConfig.actions) != null ? _k : [] : void 0,
|
|
11694
11654
|
workspaceTheme: config.workspaceTheme
|
|
@@ -11754,10 +11714,10 @@ var createSmartCanvas = async (config = {}) => {
|
|
|
11754
11714
|
setOverrideFetcher: (newFetcher) => {
|
|
11755
11715
|
currentFetcher = newFetcher;
|
|
11756
11716
|
host.setOverrideFetcher(newFetcher);
|
|
11757
|
-
if (
|
|
11717
|
+
if (runtime5 == null ? void 0 : runtime5.accumulator) {
|
|
11758
11718
|
newFetcher().then((config2) => {
|
|
11759
11719
|
if (config2 == null ? void 0 : config2.tiles) {
|
|
11760
|
-
registerConfigPredicates(config2.tiles,
|
|
11720
|
+
registerConfigPredicates(config2.tiles, runtime5.accumulator, config2.actions);
|
|
11761
11721
|
}
|
|
11762
11722
|
}).catch(() => {
|
|
11763
11723
|
});
|
|
@@ -11780,7 +11740,7 @@ var createSmartCanvas = async (config = {}) => {
|
|
|
11780
11740
|
telemetry.track(eventName, properties);
|
|
11781
11741
|
return true;
|
|
11782
11742
|
},
|
|
11783
|
-
runtime:
|
|
11743
|
+
runtime: runtime5
|
|
11784
11744
|
};
|
|
11785
11745
|
if (typeof window !== "undefined") {
|
|
11786
11746
|
const syn = window.SynOS;
|
|
@@ -14466,8 +14426,8 @@ var WidgetRegistry = class {
|
|
|
14466
14426
|
* Bind a runtime reference so it can be injected into widget mount() calls.
|
|
14467
14427
|
* Uses `unknown` to avoid circular imports (WidgetRegistry ← runtime.ts).
|
|
14468
14428
|
*/
|
|
14469
|
-
bindRuntime(
|
|
14470
|
-
this.runtimeRef =
|
|
14429
|
+
bindRuntime(runtime5) {
|
|
14430
|
+
this.runtimeRef = runtime5;
|
|
14471
14431
|
}
|
|
14472
14432
|
/**
|
|
14473
14433
|
* Register a widget.
|
|
@@ -14706,7 +14666,7 @@ function createSmartCanvasRuntime(options = {}) {
|
|
|
14706
14666
|
var _a3, _b, _c, _d;
|
|
14707
14667
|
const { telemetry, sessionMetrics, routes, mode = "production", namespace } = options;
|
|
14708
14668
|
const widgets = (_a3 = options.widgets) != null ? _a3 : widgetRegistry;
|
|
14709
|
-
const
|
|
14669
|
+
const executors4 = (_b = options.executors) != null ? _b : executorRegistry;
|
|
14710
14670
|
const apps = (_c = options.apps) != null ? _c : appRegistry;
|
|
14711
14671
|
const navigation = new NavigationMonitor();
|
|
14712
14672
|
const context = createContextManager({
|
|
@@ -14754,7 +14714,7 @@ function createSmartCanvasRuntime(options = {}) {
|
|
|
14754
14714
|
surfaces,
|
|
14755
14715
|
anchorResolver,
|
|
14756
14716
|
waitForAnchor,
|
|
14757
|
-
executorRegistry:
|
|
14717
|
+
executorRegistry: executors4,
|
|
14758
14718
|
subscribeNavigation: (callback) => navigation.subscribe(callback),
|
|
14759
14719
|
runtime: {
|
|
14760
14720
|
evaluateSync: (strategy) => decisionEngine.evaluateSync(strategy, context.get()),
|
|
@@ -14807,7 +14767,7 @@ function createSmartCanvasRuntime(options = {}) {
|
|
|
14807
14767
|
}
|
|
14808
14768
|
});
|
|
14809
14769
|
}
|
|
14810
|
-
const
|
|
14770
|
+
const runtime5 = {
|
|
14811
14771
|
telemetry,
|
|
14812
14772
|
context,
|
|
14813
14773
|
events,
|
|
@@ -14816,7 +14776,7 @@ function createSmartCanvasRuntime(options = {}) {
|
|
|
14816
14776
|
actions,
|
|
14817
14777
|
surfaces,
|
|
14818
14778
|
widgets,
|
|
14819
|
-
executors:
|
|
14779
|
+
executors: executors4,
|
|
14820
14780
|
apps,
|
|
14821
14781
|
accumulator,
|
|
14822
14782
|
anchorResolver: anchorResolverService,
|
|
@@ -14878,9 +14838,9 @@ function createSmartCanvasRuntime(options = {}) {
|
|
|
14878
14838
|
surfaces.destroy();
|
|
14879
14839
|
}
|
|
14880
14840
|
};
|
|
14881
|
-
apps.bind(
|
|
14882
|
-
widgets.bindRuntime(
|
|
14883
|
-
return
|
|
14841
|
+
apps.bind(runtime5);
|
|
14842
|
+
widgets.bindRuntime(runtime5);
|
|
14843
|
+
return runtime5;
|
|
14884
14844
|
}
|
|
14885
14845
|
|
|
14886
14846
|
// src/telemetry/InterventionTracker.ts
|
|
@@ -15503,7 +15463,7 @@ async function _initCore(options) {
|
|
|
15503
15463
|
if (sdkMode === "editor") runtimeMode = "editor";
|
|
15504
15464
|
else if (sdkMode === "audit") runtimeMode = "audit";
|
|
15505
15465
|
else if (getEnvVar("NODE_ENV") === "development") runtimeMode = "development";
|
|
15506
|
-
const
|
|
15466
|
+
const runtime5 = createSmartCanvasRuntime({
|
|
15507
15467
|
telemetry,
|
|
15508
15468
|
sessionMetrics,
|
|
15509
15469
|
mode: runtimeMode,
|
|
@@ -15511,17 +15471,17 @@ async function _initCore(options) {
|
|
|
15511
15471
|
// Use the EventBus we created earlier (already wired to PostHog)
|
|
15512
15472
|
});
|
|
15513
15473
|
debug("Syntro Bootstrap", "Runtime created:", {
|
|
15514
|
-
version:
|
|
15515
|
-
mode:
|
|
15516
|
-
hasContext: !!
|
|
15517
|
-
hasEvents: !!
|
|
15518
|
-
hasState: !!
|
|
15474
|
+
version: runtime5.version,
|
|
15475
|
+
mode: runtime5.mode,
|
|
15476
|
+
hasContext: !!runtime5.context,
|
|
15477
|
+
hasEvents: !!runtime5.events,
|
|
15478
|
+
hasState: !!runtime5.state
|
|
15519
15479
|
});
|
|
15520
15480
|
debug("Syntro Bootstrap", "Core app executors already registered");
|
|
15521
15481
|
const cdnBase = options.cdnBase || getEnvVar("NEXT_PUBLIC_SYNTRO_CDN_BASE") || getEnvVar("VITE_SYNTRO_CDN_BASE") || getDerivedCdnBase() || "https://cdn.syntrologie.com";
|
|
15522
15482
|
const appLoader = createAppLoader({
|
|
15523
15483
|
cdnBase,
|
|
15524
|
-
registry:
|
|
15484
|
+
registry: runtime5.apps,
|
|
15525
15485
|
onLoadStart: (appId) => {
|
|
15526
15486
|
debug("Syntro Bootstrap", `Loading app from CDN: ${appId}`);
|
|
15527
15487
|
},
|
|
@@ -15536,10 +15496,10 @@ async function _initCore(options) {
|
|
|
15536
15496
|
if (typeof window !== "undefined") {
|
|
15537
15497
|
window.SynOS = {
|
|
15538
15498
|
...window.SynOS,
|
|
15539
|
-
appRegistry:
|
|
15499
|
+
appRegistry: runtime5.apps,
|
|
15540
15500
|
appLoader,
|
|
15541
|
-
runtime:
|
|
15542
|
-
version:
|
|
15501
|
+
runtime: runtime5,
|
|
15502
|
+
version: runtime5.version
|
|
15543
15503
|
};
|
|
15544
15504
|
debug("Syntro Bootstrap", "Global SynOS object exposed");
|
|
15545
15505
|
}
|
|
@@ -15548,7 +15508,7 @@ async function _initCore(options) {
|
|
|
15548
15508
|
debug("Syntro Bootstrap", "auto-load of adaptive-mcp failed (non-fatal):", err);
|
|
15549
15509
|
});
|
|
15550
15510
|
}
|
|
15551
|
-
const registeredApps = (_i = (_h = (_g =
|
|
15511
|
+
const registeredApps = (_i = (_h = (_g = runtime5.apps).list) == null ? void 0 : _h.call(_g)) != null ? _i : [];
|
|
15552
15512
|
console.log(
|
|
15553
15513
|
`[DIAG] Activation loop: ${registeredApps.length} apps in registry:`,
|
|
15554
15514
|
registeredApps.map((a) => `${a.manifest.id}(${a.state})`).join(", ")
|
|
@@ -15556,9 +15516,9 @@ async function _initCore(options) {
|
|
|
15556
15516
|
for (const app of registeredApps) {
|
|
15557
15517
|
if (app.state === "registered") {
|
|
15558
15518
|
try {
|
|
15559
|
-
await
|
|
15519
|
+
await runtime5.apps.activate(app.manifest.id);
|
|
15560
15520
|
console.log(
|
|
15561
|
-
`[DIAG] Activated: ${app.manifest.id} \u2192 widgets: [${
|
|
15521
|
+
`[DIAG] Activated: ${app.manifest.id} \u2192 widgets: [${runtime5.widgets.list().join(", ")}]`
|
|
15562
15522
|
);
|
|
15563
15523
|
} catch (err) {
|
|
15564
15524
|
console.error(`[DIAG] FAILED to activate: ${app.manifest.id}`, err);
|
|
@@ -15566,7 +15526,7 @@ async function _initCore(options) {
|
|
|
15566
15526
|
}
|
|
15567
15527
|
}
|
|
15568
15528
|
}
|
|
15569
|
-
console.log(`[DIAG] Activation complete. Total widgets: [${
|
|
15529
|
+
console.log(`[DIAG] Activation complete. Total widgets: [${runtime5.widgets.list().join(", ")}]`);
|
|
15570
15530
|
if (experiments == null ? void 0 : experiments.refreshFeatures) {
|
|
15571
15531
|
try {
|
|
15572
15532
|
await experiments.refreshFeatures();
|
|
@@ -15624,7 +15584,7 @@ async function _initCore(options) {
|
|
|
15624
15584
|
if (typeof window !== "undefined") {
|
|
15625
15585
|
window.SynOS.interventionTracker = tracker;
|
|
15626
15586
|
}
|
|
15627
|
-
|
|
15587
|
+
runtime5.navigation.subscribe(() => {
|
|
15628
15588
|
tracker.resetPage();
|
|
15629
15589
|
});
|
|
15630
15590
|
}
|
|
@@ -15668,9 +15628,9 @@ async function _initCore(options) {
|
|
|
15668
15628
|
newFailures.forEach((r) => warnedAppFailures.add(r.appId));
|
|
15669
15629
|
}
|
|
15670
15630
|
for (const appId of requiredApps) {
|
|
15671
|
-
if (
|
|
15631
|
+
if (runtime5.apps.has(appId)) {
|
|
15672
15632
|
try {
|
|
15673
|
-
await
|
|
15633
|
+
await runtime5.apps.activate(appId);
|
|
15674
15634
|
console.log(`[Syntro Bootstrap] App activated: ${appId}`);
|
|
15675
15635
|
} catch (err) {
|
|
15676
15636
|
console.error(`[Syntro Bootstrap] Failed to activate app: ${appId}`, err);
|
|
@@ -15678,7 +15638,7 @@ async function _initCore(options) {
|
|
|
15678
15638
|
} else {
|
|
15679
15639
|
console.error(
|
|
15680
15640
|
`[Syntro Bootstrap] App "${appId}" required by config but NOT registered.`,
|
|
15681
|
-
`Available apps: [${Array.from((_c3 = (_b3 = (_a5 =
|
|
15641
|
+
`Available apps: [${Array.from((_c3 = (_b3 = (_a5 = runtime5.apps).list) == null ? void 0 : _b3.call(_a5)) != null ? _c3 : []).join(", ")}]`
|
|
15682
15642
|
);
|
|
15683
15643
|
}
|
|
15684
15644
|
}
|
|
@@ -15701,10 +15661,10 @@ async function _initCore(options) {
|
|
|
15701
15661
|
fetcher: appLoadingFetcher,
|
|
15702
15662
|
integrations: { experiments, telemetry },
|
|
15703
15663
|
editorUrl,
|
|
15704
|
-
runtime:
|
|
15664
|
+
runtime: runtime5
|
|
15705
15665
|
// Pass runtime so actions can be applied
|
|
15706
15666
|
});
|
|
15707
|
-
return { canvas, runtime:
|
|
15667
|
+
return { canvas, runtime: runtime5, experiments, telemetry, sessionMetrics, appLoader };
|
|
15708
15668
|
}
|
|
15709
15669
|
|
|
15710
15670
|
// src/bootstrap.ts
|
|
@@ -15724,9 +15684,9 @@ async function init(options) {
|
|
|
15724
15684
|
function emit(eventName, props = {}) {
|
|
15725
15685
|
var _a3, _b;
|
|
15726
15686
|
if (typeof window === "undefined") return;
|
|
15727
|
-
const
|
|
15728
|
-
if (!((_b =
|
|
15729
|
-
|
|
15687
|
+
const runtime5 = (_a3 = window.SynOS) == null ? void 0 : _a3.runtime;
|
|
15688
|
+
if (!((_b = runtime5 == null ? void 0 : runtime5.events) == null ? void 0 : _b.publish)) return;
|
|
15689
|
+
runtime5.events.publish({ name: eventName, source: "custom", props });
|
|
15730
15690
|
}
|
|
15731
15691
|
async function loadAdaptive(appId) {
|
|
15732
15692
|
var _a3;
|
|
@@ -15898,7 +15858,7 @@ function validateRuntimeContext(data) {
|
|
|
15898
15858
|
|
|
15899
15859
|
// src/controllers/DecisionController.ts
|
|
15900
15860
|
var DecisionController = class {
|
|
15901
|
-
constructor(host,
|
|
15861
|
+
constructor(host, runtime5, strategy, defaultValue) {
|
|
15902
15862
|
__publicField(this, "_host");
|
|
15903
15863
|
__publicField(this, "_runtime");
|
|
15904
15864
|
__publicField(this, "_strategy");
|
|
@@ -15908,7 +15868,7 @@ var DecisionController = class {
|
|
|
15908
15868
|
__publicField(this, "_isLoading", true);
|
|
15909
15869
|
__publicField(this, "_cancelled", false);
|
|
15910
15870
|
this._host = host;
|
|
15911
|
-
this._runtime =
|
|
15871
|
+
this._runtime = runtime5;
|
|
15912
15872
|
this._strategy = strategy;
|
|
15913
15873
|
this._defaultValue = defaultValue;
|
|
15914
15874
|
this._value = defaultValue;
|
|
@@ -15960,14 +15920,14 @@ var DecisionController = class {
|
|
|
15960
15920
|
|
|
15961
15921
|
// src/controllers/RuntimeController.ts
|
|
15962
15922
|
var RuntimeController = class {
|
|
15963
|
-
constructor(host,
|
|
15923
|
+
constructor(host, runtime5) {
|
|
15964
15924
|
__publicField(this, "host");
|
|
15965
15925
|
__publicField(this, "_runtime");
|
|
15966
15926
|
__publicField(this, "_context");
|
|
15967
15927
|
__publicField(this, "_unsubscribe", null);
|
|
15968
15928
|
this.host = host;
|
|
15969
|
-
this._runtime =
|
|
15970
|
-
this._context =
|
|
15929
|
+
this._runtime = runtime5;
|
|
15930
|
+
this._context = runtime5.context.get();
|
|
15971
15931
|
host.addController(this);
|
|
15972
15932
|
}
|
|
15973
15933
|
// ── ReactiveController lifecycle ───────────────────────────────────────────
|
|
@@ -16011,14 +15971,14 @@ var RuntimeController = class {
|
|
|
16011
15971
|
|
|
16012
15972
|
// src/controllers/RuntimeEventsController.ts
|
|
16013
15973
|
var RuntimeEventsController = class {
|
|
16014
|
-
constructor(host,
|
|
15974
|
+
constructor(host, runtime5, filter, callback) {
|
|
16015
15975
|
__publicField(this, "_host");
|
|
16016
15976
|
__publicField(this, "_runtime");
|
|
16017
15977
|
__publicField(this, "_filter");
|
|
16018
15978
|
__publicField(this, "_callback");
|
|
16019
15979
|
__publicField(this, "_unsubscribe");
|
|
16020
15980
|
this._host = host;
|
|
16021
|
-
this._runtime =
|
|
15981
|
+
this._runtime = runtime5;
|
|
16022
15982
|
this._filter = filter;
|
|
16023
15983
|
this._callback = callback;
|
|
16024
15984
|
host.addController(this);
|