@juo/orion-core 0.20.0 → 0.20.2
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/{ExtensionRoot-z_aRSifd.js → ExtensionRoot-BmGYqy4C.js} +1 -1
- package/dist/core.js +1 -1
- package/dist/flows/WorkflowService.d.ts +2 -0
- package/dist/{juo-workflow-BBbsNhY2.js → juo-workflow-Dbh6KMoG.js} +14 -0
- package/dist/web-components-editor.js +12 -7
- package/dist/web-components-runtime.js +6 -4
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
import { signal, effect, createBlockInstance } from "@juo/orion-core";
|
|
8
8
|
import { d, j as withWrapper, t as subscribeContext, T as ThemeStateContext, E, v as n } from "./theme-state-D4n_2n_h.js";
|
|
9
|
-
import "./juo-workflow-
|
|
9
|
+
import "./juo-workflow-Dbh6KMoG.js";
|
|
10
10
|
class Block extends HTMLElement {
|
|
11
11
|
constructor() {
|
|
12
12
|
super();
|
package/dist/core.js
CHANGED
|
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
import { c as createContext, d, w, E, u } from "./theme-state-D4n_2n_h.js";
|
|
8
8
|
import { B, n, C, D, S, T, a, b, e, f, k, l, g, h, i, m, p, o, q, r, s, t, v, j } from "./theme-state-D4n_2n_h.js";
|
|
9
|
-
import { T as T2, W, c, b as b2, a as a2, g as g2, h as h2 } from "./juo-workflow-
|
|
9
|
+
import { T as T2, W, c, b as b2, a as a2, g as g2, h as h2 } from "./juo-workflow-Dbh6KMoG.js";
|
|
10
10
|
function createState() {
|
|
11
11
|
const discountCode = d(null);
|
|
12
12
|
const products = d([]);
|
|
@@ -10,6 +10,7 @@ export declare const WorkflowServiceContext: {
|
|
|
10
10
|
isLoading: ReadonlySignal<boolean>;
|
|
11
11
|
isCompleted: ReadonlySignal<boolean>;
|
|
12
12
|
hasError: ReadonlySignal<boolean>;
|
|
13
|
+
canRespond: ReadonlySignal<boolean>;
|
|
13
14
|
currentInteraction: ReadonlySignal<PendingInteraction | null>;
|
|
14
15
|
currentStepInfo: ReadonlySignal<WorkflowStepInfo | null>;
|
|
15
16
|
startFlow(flowType: string, context: Record<string, unknown>, workflowId?: string): Promise<void>;
|
|
@@ -148,6 +149,7 @@ export declare function createWorkflowService(deps: WorkflowServiceDependencies)
|
|
|
148
149
|
isLoading: ReadonlySignal<boolean>;
|
|
149
150
|
isCompleted: ReadonlySignal<boolean>;
|
|
150
151
|
hasError: ReadonlySignal<boolean>;
|
|
152
|
+
canRespond: ReadonlySignal<boolean>;
|
|
151
153
|
currentInteraction: ReadonlySignal<PendingInteraction | null>;
|
|
152
154
|
currentStepInfo: ReadonlySignal<WorkflowStepInfo | null>;
|
|
153
155
|
startFlow(flowType: string, context: Record<string, unknown>, workflowId?: string): Promise<void>;
|
|
@@ -137,12 +137,20 @@ function createWorkflowService(deps) {
|
|
|
137
137
|
outcome: null,
|
|
138
138
|
dryRun: null
|
|
139
139
|
});
|
|
140
|
+
const _backendInteractionId = d(null);
|
|
140
141
|
const _registeredRootBlocks = /* @__PURE__ */ new Set();
|
|
141
142
|
const isActive = w(() => _state.value.status === "active");
|
|
142
143
|
const isLoading = w(() => _state.value.status === "loading");
|
|
143
144
|
const isCompleted = w(() => _state.value.status === "completed");
|
|
144
145
|
const hasError = w(() => _state.value.status === "error");
|
|
145
146
|
const currentInteraction = w(() => _state.value.currentInteraction);
|
|
147
|
+
const canRespond = w(() => {
|
|
148
|
+
const interaction = _state.value.currentInteraction;
|
|
149
|
+
const backendId = _backendInteractionId.value;
|
|
150
|
+
if (!interaction || !backendId)
|
|
151
|
+
return false;
|
|
152
|
+
return interaction.interactionId === backendId;
|
|
153
|
+
});
|
|
146
154
|
const currentStepInfo = w(() => {
|
|
147
155
|
const interaction = _state.value.currentInteraction;
|
|
148
156
|
if (!interaction)
|
|
@@ -182,6 +190,7 @@ function createWorkflowService(deps) {
|
|
|
182
190
|
...data.invalidatedResources ?? []
|
|
183
191
|
];
|
|
184
192
|
if (data.status === "waiting_interaction" && data.pendingInteraction) {
|
|
193
|
+
_backendInteractionId.value = data.pendingInteraction.interactionId;
|
|
185
194
|
updateState({
|
|
186
195
|
status: "active",
|
|
187
196
|
workflowId: data.workflowId,
|
|
@@ -206,6 +215,7 @@ function createWorkflowService(deps) {
|
|
|
206
215
|
}
|
|
207
216
|
}
|
|
208
217
|
} else if (data.status === "completed") {
|
|
218
|
+
_backendInteractionId.value = null;
|
|
209
219
|
updateState({
|
|
210
220
|
status: "completed",
|
|
211
221
|
currentStepId: null,
|
|
@@ -216,8 +226,10 @@ function createWorkflowService(deps) {
|
|
|
216
226
|
outcome: data.outcome || null
|
|
217
227
|
});
|
|
218
228
|
} else if (data.status === "failed") {
|
|
229
|
+
_backendInteractionId.value = null;
|
|
219
230
|
handleError(new Error(((_b = data.error) == null ? void 0 : _b.message) || "Flow failed"));
|
|
220
231
|
} else if (data.status === "cancelled") {
|
|
232
|
+
_backendInteractionId.value = null;
|
|
221
233
|
updateState({
|
|
222
234
|
status: "idle",
|
|
223
235
|
flowType: null,
|
|
@@ -362,6 +374,7 @@ function createWorkflowService(deps) {
|
|
|
362
374
|
isLoading,
|
|
363
375
|
isCompleted,
|
|
364
376
|
hasError,
|
|
377
|
+
canRespond,
|
|
365
378
|
currentInteraction,
|
|
366
379
|
currentStepInfo,
|
|
367
380
|
// Methods
|
|
@@ -454,6 +467,7 @@ function createWorkflowService(deps) {
|
|
|
454
467
|
service.reset();
|
|
455
468
|
},
|
|
456
469
|
reset() {
|
|
470
|
+
_backendInteractionId.value = null;
|
|
457
471
|
updateState({
|
|
458
472
|
status: "idle",
|
|
459
473
|
flowType: null,
|
|
@@ -5,9 +5,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
import { p as injectContext, E, x as ContextRoot } from "./theme-state-D4n_2n_h.js";
|
|
8
|
-
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-
|
|
8
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-BmGYqy4C.js";
|
|
9
9
|
import { a as createEditorBridge, b as createFocusInlineTextMessage, d as createUpdateBlockTranslationMessage } from "./bridge-BHI_2-Xw.js";
|
|
10
|
-
import { T as TranslationContext } from "./juo-workflow-
|
|
10
|
+
import { T as TranslationContext } from "./juo-workflow-Dbh6KMoG.js";
|
|
11
11
|
const _InlineText = class _InlineText extends HTMLElement {
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
@@ -25,8 +25,10 @@ const _InlineText = class _InlineText extends HTMLElement {
|
|
|
25
25
|
return ["prop", "readonly"];
|
|
26
26
|
}
|
|
27
27
|
connectedCallback() {
|
|
28
|
-
this.style.display
|
|
29
|
-
|
|
28
|
+
if (!this.style.display)
|
|
29
|
+
this.style.display = "inline-block";
|
|
30
|
+
if (!this.style.overflowWrap)
|
|
31
|
+
this.style.overflowWrap = "anywhere";
|
|
30
32
|
this.propName = this.getAttribute("prop");
|
|
31
33
|
if (!this.propName) {
|
|
32
34
|
console.warn("juo-text: 'prop' attribute is required");
|
|
@@ -70,9 +72,12 @@ const _InlineText = class _InlineText extends HTMLElement {
|
|
|
70
72
|
this.style.outline = "0.5px solid transparent";
|
|
71
73
|
this.style.outlineOffset = "2px";
|
|
72
74
|
}
|
|
73
|
-
this.style.width
|
|
74
|
-
|
|
75
|
-
this.style.
|
|
75
|
+
if (!this.style.width)
|
|
76
|
+
this.style.width = "100%";
|
|
77
|
+
if (!this.style.overflowWrap)
|
|
78
|
+
this.style.overflowWrap = "anywhere";
|
|
79
|
+
if (!this.style.whiteSpace)
|
|
80
|
+
this.style.whiteSpace = "pre-wrap";
|
|
76
81
|
if (!this.isReadonly) {
|
|
77
82
|
this.injectStyles();
|
|
78
83
|
}
|
|
@@ -5,16 +5,18 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
import { p as injectContext, E, x as ContextRoot } from "./theme-state-D4n_2n_h.js";
|
|
8
|
-
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-
|
|
9
|
-
import { T as TranslationContext } from "./juo-workflow-
|
|
8
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-BmGYqy4C.js";
|
|
9
|
+
import { T as TranslationContext } from "./juo-workflow-Dbh6KMoG.js";
|
|
10
10
|
class InlineText extends HTMLElement {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
13
|
__publicField(this, "dispose");
|
|
14
14
|
}
|
|
15
15
|
connectedCallback() {
|
|
16
|
-
this.style.display
|
|
17
|
-
|
|
16
|
+
if (!this.style.display)
|
|
17
|
+
this.style.display = "inline-block";
|
|
18
|
+
if (!this.style.overflowWrap)
|
|
19
|
+
this.style.overflowWrap = "anywhere";
|
|
18
20
|
const key = this.getAttribute("prop");
|
|
19
21
|
if (!key)
|
|
20
22
|
return;
|