@juo/blocks 1.0.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 (153) hide show
  1. package/dist/ExtensionRoot-CZyBNJZY.js +159 -0
  2. package/dist/block-VhmfGB3N.js +51 -0
  3. package/dist/block.d.ts +96 -0
  4. package/dist/block.d.ts.map +1 -0
  5. package/dist/bridge-DQsM97cH.js +490 -0
  6. package/dist/context.d.ts +76 -0
  7. package/dist/context.d.ts.map +1 -0
  8. package/dist/context.test.d.ts +2 -0
  9. package/dist/context.test.d.ts.map +1 -0
  10. package/dist/core.js +1163 -0
  11. package/dist/editor/bridge.d.ts +75 -0
  12. package/dist/editor/bridge.d.ts.map +1 -0
  13. package/dist/editor/bridge.test.d.ts +2 -0
  14. package/dist/editor/bridge.test.d.ts.map +1 -0
  15. package/dist/editor/components.d.ts +31 -0
  16. package/dist/editor/components.d.ts.map +1 -0
  17. package/dist/editor/handler.d.ts +10 -0
  18. package/dist/editor/handler.d.ts.map +1 -0
  19. package/dist/editor/main.d.ts +17 -0
  20. package/dist/editor/main.d.ts.map +1 -0
  21. package/dist/editor/messages.d.ts +233 -0
  22. package/dist/editor/messages.d.ts.map +1 -0
  23. package/dist/editor.js +711 -0
  24. package/dist/flows/MockWorkflowApiAdapter.d.ts +13 -0
  25. package/dist/flows/MockWorkflowApiAdapter.d.ts.map +1 -0
  26. package/dist/flows/WorkflowService.d.ts +175 -0
  27. package/dist/flows/WorkflowService.d.ts.map +1 -0
  28. package/dist/flows/__tests__/WorkflowService.test.d.ts +2 -0
  29. package/dist/flows/__tests__/WorkflowService.test.d.ts.map +1 -0
  30. package/dist/flows/__tests__/defaults.test.d.ts +2 -0
  31. package/dist/flows/__tests__/defaults.test.d.ts.map +1 -0
  32. package/dist/flows/__tests__/juo-workflow.test.d.ts +2 -0
  33. package/dist/flows/__tests__/juo-workflow.test.d.ts.map +1 -0
  34. package/dist/flows/__tests__/overlay-behavior.test.d.ts +2 -0
  35. package/dist/flows/__tests__/overlay-behavior.test.d.ts.map +1 -0
  36. package/dist/flows/__tests__/theme-state-surfaces.test.d.ts +2 -0
  37. package/dist/flows/__tests__/theme-state-surfaces.test.d.ts.map +1 -0
  38. package/dist/flows/defaults.d.ts +15 -0
  39. package/dist/flows/defaults.d.ts.map +1 -0
  40. package/dist/flows/index.d.ts +4 -0
  41. package/dist/flows/index.d.ts.map +1 -0
  42. package/dist/flows/juo-workflow.d.ts +48 -0
  43. package/dist/flows/juo-workflow.d.ts.map +1 -0
  44. package/dist/juo-workflow-RSrOuKUH.js +591 -0
  45. package/dist/main.d.ts +11 -0
  46. package/dist/main.d.ts.map +1 -0
  47. package/dist/preact/block.d.ts +21 -0
  48. package/dist/preact/block.d.ts.map +1 -0
  49. package/dist/preact/block.test.d.ts +2 -0
  50. package/dist/preact/block.test.d.ts.map +1 -0
  51. package/dist/preact/bridge.d.ts +11 -0
  52. package/dist/preact/bridge.d.ts.map +1 -0
  53. package/dist/preact/context.d.ts +31 -0
  54. package/dist/preact/context.d.ts.map +1 -0
  55. package/dist/preact/main.d.ts +11 -0
  56. package/dist/preact/main.d.ts.map +1 -0
  57. package/dist/preact/signals.d.ts +23 -0
  58. package/dist/preact/signals.d.ts.map +1 -0
  59. package/dist/preact.js +230 -0
  60. package/dist/react/block.d.ts +21 -0
  61. package/dist/react/block.d.ts.map +1 -0
  62. package/dist/react/block.test.d.ts +2 -0
  63. package/dist/react/block.test.d.ts.map +1 -0
  64. package/dist/react/bridge.d.ts +11 -0
  65. package/dist/react/bridge.d.ts.map +1 -0
  66. package/dist/react/context.d.ts +28 -0
  67. package/dist/react/context.d.ts.map +1 -0
  68. package/dist/react/main.d.ts +11 -0
  69. package/dist/react/main.d.ts.map +1 -0
  70. package/dist/react/signals.d.ts +23 -0
  71. package/dist/react/signals.d.ts.map +1 -0
  72. package/dist/react.js +205 -0
  73. package/dist/services/index.d.ts +4 -0
  74. package/dist/services/index.d.ts.map +1 -0
  75. package/dist/services/login/index.d.ts +23 -0
  76. package/dist/services/login/index.d.ts.map +1 -0
  77. package/dist/services/login/loginService.d.ts +82 -0
  78. package/dist/services/login/loginService.d.ts.map +1 -0
  79. package/dist/services/product/adapter.d.ts +20 -0
  80. package/dist/services/product/adapter.d.ts.map +1 -0
  81. package/dist/services/product/index.d.ts +5 -0
  82. package/dist/services/product/index.d.ts.map +1 -0
  83. package/dist/services/product/productService.d.ts +12 -0
  84. package/dist/services/product/productService.d.ts.map +1 -0
  85. package/dist/services/product/types.d.ts +32 -0
  86. package/dist/services/product/types.d.ts.map +1 -0
  87. package/dist/services/subscription/adapter.d.ts +49 -0
  88. package/dist/services/subscription/adapter.d.ts.map +1 -0
  89. package/dist/services/subscription/index.d.ts +5 -0
  90. package/dist/services/subscription/index.d.ts.map +1 -0
  91. package/dist/services/subscription/list.d.ts +22 -0
  92. package/dist/services/subscription/list.d.ts.map +1 -0
  93. package/dist/services/subscription/store.d.ts +30 -0
  94. package/dist/services/subscription/store.d.ts.map +1 -0
  95. package/dist/services/subscription/subscriptionService.d.ts +12 -0
  96. package/dist/services/subscription/subscriptionService.d.ts.map +1 -0
  97. package/dist/services/subscription/types.d.ts +76 -0
  98. package/dist/services/subscription/types.d.ts.map +1 -0
  99. package/dist/shared/block.d.ts +17 -0
  100. package/dist/shared/block.d.ts.map +1 -0
  101. package/dist/shared/context.d.ts +16 -0
  102. package/dist/shared/context.d.ts.map +1 -0
  103. package/dist/shared/signals.d.ts +17 -0
  104. package/dist/shared/signals.d.ts.map +1 -0
  105. package/dist/state.d.ts +81 -0
  106. package/dist/state.d.ts.map +1 -0
  107. package/dist/theme-state-BZplRS92.js +886 -0
  108. package/dist/theme-state.d.ts +85 -0
  109. package/dist/theme-state.d.ts.map +1 -0
  110. package/dist/theme-state.locales.test.d.ts +2 -0
  111. package/dist/theme-state.locales.test.d.ts.map +1 -0
  112. package/dist/translation.d.ts +14 -0
  113. package/dist/translation.d.ts.map +1 -0
  114. package/dist/translation.test.d.ts +2 -0
  115. package/dist/translation.test.d.ts.map +1 -0
  116. package/dist/utils/index.d.ts +32 -0
  117. package/dist/utils/index.d.ts.map +1 -0
  118. package/dist/utils/login.d.ts +11 -0
  119. package/dist/utils/login.d.ts.map +1 -0
  120. package/dist/utils/uuid.d.ts +2 -0
  121. package/dist/utils/uuid.d.ts.map +1 -0
  122. package/dist/vue/block.d.ts +7 -0
  123. package/dist/vue/block.d.ts.map +1 -0
  124. package/dist/vue/bridge.d.ts +11 -0
  125. package/dist/vue/bridge.d.ts.map +1 -0
  126. package/dist/vue/context.d.ts +24 -0
  127. package/dist/vue/context.d.ts.map +1 -0
  128. package/dist/vue/main.d.ts +6 -0
  129. package/dist/vue/main.d.ts.map +1 -0
  130. package/dist/vue/signals.d.ts +5 -0
  131. package/dist/vue/signals.d.ts.map +1 -0
  132. package/dist/vue/target.d.ts +2 -0
  133. package/dist/vue/target.d.ts.map +1 -0
  134. package/dist/vue/transform.d.ts +2 -0
  135. package/dist/vue/transform.d.ts.map +1 -0
  136. package/dist/vue.js +254 -0
  137. package/dist/web-components/Block.d.ts +17 -0
  138. package/dist/web-components/Block.d.ts.map +1 -0
  139. package/dist/web-components/Block.test.d.ts +2 -0
  140. package/dist/web-components/Block.test.d.ts.map +1 -0
  141. package/dist/web-components/ExtensionRoot.d.ts +29 -0
  142. package/dist/web-components/ExtensionRoot.d.ts.map +1 -0
  143. package/dist/web-components/editor/InlineText.d.ts +29 -0
  144. package/dist/web-components/editor/InlineText.d.ts.map +1 -0
  145. package/dist/web-components/editor/main.d.ts +2 -0
  146. package/dist/web-components/editor/main.d.ts.map +1 -0
  147. package/dist/web-components/runtime/InlineText.d.ts +6 -0
  148. package/dist/web-components/runtime/InlineText.d.ts.map +1 -0
  149. package/dist/web-components/runtime/main.d.ts +2 -0
  150. package/dist/web-components/runtime/main.d.ts.map +1 -0
  151. package/dist/web-components-editor.js +183 -0
  152. package/dist/web-components-runtime.js +55 -0
  153. package/package.json +62 -0
@@ -0,0 +1,13 @@
1
+ import { WorkflowApiAdapter } from './WorkflowService';
2
+ /**
3
+ * Creates a mock WorkflowApiAdapter that simulates the full workflow lifecycle.
4
+ *
5
+ * - `start()` begins a flow using predefined step sequences
6
+ * - `respond()` advances to the next step or completes the flow
7
+ * - `cancel()` cancels the flow
8
+ * - `getState()` returns the current state
9
+ *
10
+ * Useful for development/testing when Stream 4 (backend) is not yet implemented.
11
+ */
12
+ export declare function createMockWorkflowApiAdapter(): WorkflowApiAdapter;
13
+ //# sourceMappingURL=MockWorkflowApiAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MockWorkflowApiAdapter.d.ts","sourceRoot":"","sources":["../../src/flows/MockWorkflowApiAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAKnB,MAAM,mBAAmB,CAAC;AA4L3B;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,IAAI,kBAAkB,CA0GjE"}
@@ -0,0 +1,175 @@
1
+ import { ReadonlySignal } from '@preact/signals-core';
2
+ import { ThemeState } from '../theme-state';
3
+ export declare const WorkflowServiceContext: {
4
+ __context__: {
5
+ state: ReadonlySignal<WorkflowState>;
6
+ /** True when the portal is running inside the Blocks Editor (editorMode dep
7
+ * or ?trigger=... URL param). Consumers use this to suppress auto-start. */
8
+ isPreviewMode: boolean;
9
+ isActive: ReadonlySignal<boolean>;
10
+ isLoading: ReadonlySignal<boolean>;
11
+ isCompleted: ReadonlySignal<boolean>;
12
+ hasError: ReadonlySignal<boolean>;
13
+ canRespond: ReadonlySignal<boolean>;
14
+ currentInteraction: ReadonlySignal<PendingInteraction | null>;
15
+ currentStepInfo: ReadonlySignal<WorkflowStepInfo | null>;
16
+ startFlow(flowType: string, context: Record<string, unknown>, workflowId?: string): Promise<void>;
17
+ respond(responseType: string, responseData?: Record<string, unknown>): Promise<void>;
18
+ cancel(): Promise<void>;
19
+ reset(): void;
20
+ refresh(): Promise<void>;
21
+ };
22
+ };
23
+ /**
24
+ * Mirrors `PendingInteraction` from `@juo/workflows-core`.
25
+ * Inlined here to avoid a cross-package dependency from blocks -> workflow-core.
26
+ */
27
+ export interface PendingInteraction {
28
+ /** Unique per interaction instance (idempotency/stale-response protection) */
29
+ interactionId: string;
30
+ stepId: string;
31
+ actionType: string;
32
+ actionBehavior: "input";
33
+ actionConfig: Record<string, unknown>;
34
+ availableResponses: Array<{
35
+ type: string;
36
+ label: string;
37
+ }>;
38
+ presentedAt: Date;
39
+ /** Optional relative timeout duration (milliseconds) */
40
+ timeoutMs?: number;
41
+ }
42
+ export interface WorkflowOutcome {
43
+ type: string;
44
+ message: string;
45
+ }
46
+ export interface WorkflowEndStep {
47
+ id: string;
48
+ category?: string;
49
+ label?: string;
50
+ }
51
+ export interface WorkflowCompletionData {
52
+ outcome?: WorkflowOutcome;
53
+ endStep?: WorkflowEndStep;
54
+ }
55
+ export type WorkflowStatus = "idle" | "loading" | "active" | "completed" | "error";
56
+ export interface WorkflowState {
57
+ status: WorkflowStatus;
58
+ flowType: string | null;
59
+ workflowId: string | null;
60
+ workflowVersion: number | null;
61
+ runId: string | null;
62
+ runVersion: number | null;
63
+ currentStepId: string | null;
64
+ currentInteraction: PendingInteraction | null;
65
+ error: string | null;
66
+ result: Record<string, unknown> | null;
67
+ /** Parameters passed to startFlow (e.g. { layout: 'modal' | 'sidebar' }) */
68
+ flowParams: Record<string, unknown> | null;
69
+ /** Accumulated resources invalidated by actions across all responses in this flow. */
70
+ invalidatedResources: string[];
71
+ /** Describes the primary action taken when the workflow completes.
72
+ * Used to show a confirmation toast (e.g. "Your subscription has been cancelled"). */
73
+ outcome: WorkflowOutcome | null;
74
+ /** Persisted completion metadata: outcome and the End node reached. */
75
+ completionData: WorkflowCompletionData | null;
76
+ dryRun: boolean | null;
77
+ }
78
+ /** Available steps metadata (for rendering and editor) */
79
+ export interface WorkflowStepInfo {
80
+ interactionId: string;
81
+ stepId: string;
82
+ actionType: string;
83
+ actionConfig: Record<string, unknown>;
84
+ availableResponses: Array<{
85
+ type: string;
86
+ label: string;
87
+ }>;
88
+ }
89
+ /**
90
+ * Lightweight step definition (no per-instance interactionId).
91
+ * Used by `interactiveSteps` to describe the full set of input steps
92
+ * in a workflow so the root block can pre-populate all slots and presets.
93
+ */
94
+ export interface WorkflowStepDefinition {
95
+ stepId: string;
96
+ actionType: string;
97
+ actionConfig: Record<string, unknown>;
98
+ availableResponses: Array<{
99
+ type: string;
100
+ label: string;
101
+ }>;
102
+ }
103
+ export type WorkflowStartResponse = {
104
+ status: "no_workflow";
105
+ } | {
106
+ status: "completed_silently";
107
+ invalidatedResources?: string[];
108
+ outcome?: WorkflowOutcome;
109
+ completionData?: WorkflowCompletionData;
110
+ } | WorkflowRunState;
111
+ export interface WorkflowRunState {
112
+ workflowId: string;
113
+ workflowVersion: number;
114
+ runId: string;
115
+ runVersion: number;
116
+ status: "running" | "waiting_interaction" | "completed" | "failed" | "cancelled";
117
+ pendingInteraction?: PendingInteraction;
118
+ /** All interactive (input) steps in this workflow, in order.
119
+ * Provided on start() so the client can pre-populate all root block slots and editor presets. */
120
+ interactiveSteps?: WorkflowStepDefinition[];
121
+ result?: Record<string, unknown>;
122
+ error?: {
123
+ message: string;
124
+ code?: string;
125
+ };
126
+ /** Resources invalidated by actions executed during this response (e.g. ["subscription"]). */
127
+ invalidatedResources?: string[];
128
+ outcome?: WorkflowOutcome;
129
+ completionData?: WorkflowCompletionData;
130
+ }
131
+ /**
132
+ * API adapter interface for WorkflowService.
133
+ * Allows different implementations (real API, mocked, etc.)
134
+ */
135
+ export interface WorkflowApiAdapter {
136
+ start(flowType: string, context: Record<string, unknown>, workflowId?: string, dryRun?: boolean): Promise<WorkflowStartResponse>;
137
+ respond(runId: string, interactionId: string, responseType: string, responseData?: Record<string, unknown>, expectedRunVersion?: number, eventId?: string): Promise<WorkflowRunState>;
138
+ getState(runId: string): Promise<WorkflowRunState>;
139
+ cancel(runId: string): Promise<WorkflowRunState>;
140
+ }
141
+ /**
142
+ * Create a real API adapter for the Customer API.
143
+ */
144
+ export declare function createWorkflowApiAdapter(sdk: {
145
+ get: any;
146
+ post: any;
147
+ }): WorkflowApiAdapter;
148
+ export interface WorkflowServiceDependencies {
149
+ /** API adapter for communicating with backend */
150
+ api: WorkflowApiAdapter;
151
+ /** ThemeState context for resolving the started workflow */
152
+ themeState: ThemeState;
153
+ /** Shop currency code (e.g. "USD", "EUR"). Injected into actionConfig for blocks that display monetary values. */
154
+ shopCurrencyCode?: string;
155
+ }
156
+ export declare function createWorkflowService(deps: WorkflowServiceDependencies): {
157
+ state: ReadonlySignal<WorkflowState>;
158
+ /** True when the portal is running inside the Blocks Editor (editorMode dep
159
+ * or ?trigger=... URL param). Consumers use this to suppress auto-start. */
160
+ isPreviewMode: boolean;
161
+ isActive: ReadonlySignal<boolean>;
162
+ isLoading: ReadonlySignal<boolean>;
163
+ isCompleted: ReadonlySignal<boolean>;
164
+ hasError: ReadonlySignal<boolean>;
165
+ canRespond: ReadonlySignal<boolean>;
166
+ currentInteraction: ReadonlySignal<PendingInteraction | null>;
167
+ currentStepInfo: ReadonlySignal<WorkflowStepInfo | null>;
168
+ startFlow(flowType: string, context: Record<string, unknown>, workflowId?: string): Promise<void>;
169
+ respond(responseType: string, responseData?: Record<string, unknown>): Promise<void>;
170
+ cancel(): Promise<void>;
171
+ reset(): void;
172
+ refresh(): Promise<void>;
173
+ };
174
+ export type WorkflowService = ReturnType<typeof createWorkflowService>;
175
+ //# sourceMappingURL=WorkflowService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkflowService.d.ts","sourceRoot":"","sources":["../../src/flows/WorkflowService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG7E,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAS5C,eAAO,MAAM,sBAAsB;;eAijBd,cAAc,CAAC,aAAa,CAAC;QAE9C;qFAC6E;;;;;;;;;4BAcjE,MAAM,WACP,MA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AE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtC,kBAAkB,CAAC,EAAE,MAAM,EAC3B,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACnD,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAClD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE;IAC5C,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,GAAG,CAAC;CACX,GAAG,kBAAkB,CAgDrB;AAMD,MAAM,WAAW,2BAA2B;IAC1C,iDAAiD;IACjD,GAAG,EAAE,kBAAkB,CAAC;IACxB,4DAA4D;IAC5D,UAAU,EAAE,UAAU,CAAC;IACvB,kHAAkH;IAClH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAMD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,2BAA2B;WAiVlD,cAAc,CAAC,aAAa,CAAC;IAE9C;iFAC6E;;;;;;;;;wBAcjE,MAAM,WACP,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,eACnB,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC;0BAwDA,MAAM,iBACL,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,OAAO,CAAC,IAAI,CAAC;cAuBA,OAAO,CAAC,IAAI,CAAC;aA4CpB,IAAI;eAoBI,OAAO,CAAC,IAAI,CAAC;EAsBjC;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=WorkflowService.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkflowService.test.d.ts","sourceRoot":"","sources":["../../../src/flows/__tests__/WorkflowService.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=defaults.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.test.d.ts","sourceRoot":"","sources":["../../../src/flows/__tests__/defaults.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=juo-workflow.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"juo-workflow.test.d.ts","sourceRoot":"","sources":["../../../src/flows/__tests__/juo-workflow.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=overlay-behavior.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay-behavior.test.d.ts","sourceRoot":"","sources":["../../../src/flows/__tests__/overlay-behavior.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=theme-state-surfaces.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-state-surfaces.test.d.ts","sourceRoot":"","sources":["../../../src/flows/__tests__/theme-state-surfaces.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import { Block } from '../block';
2
+ /**
3
+ * Get default block for a flow step based on action type.
4
+ * Looks for a registered block with name `action:<actionType>`.
5
+ *
6
+ * Used by:
7
+ * - <juo-workflow> for rendering current step
8
+ * - BlocksWorkflowInitializer when no custom block is defined for a step
9
+ */
10
+ export declare function getDefaultBlockForAction(actionType: string, actionConfig: Record<string, unknown>, blockId?: string): Block;
11
+ /**
12
+ * Check if a default block exists for an action type.
13
+ */
14
+ export declare function hasDefaultBlockForAction(actionType: string): boolean;
15
+ //# sourceMappingURL=defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/flows/defaults.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,OAAO,CAAC,EAAE,MAAM,GACf,KAAK,CAcP;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAGpE"}
@@ -0,0 +1,4 @@
1
+ export { createWorkflowService, createWorkflowApiAdapter, WorkflowServiceContext, type PendingInteraction, type WorkflowService, type WorkflowApiAdapter, type WorkflowServiceDependencies, type WorkflowState, type WorkflowStatus, type WorkflowStepInfo, type WorkflowStepDefinition, type WorkflowStartResponse, type WorkflowRunState, type WorkflowOutcome, type WorkflowEndStep, type WorkflowCompletionData, } from './WorkflowService';
2
+ export { getDefaultBlockForAction, hasDefaultBlockForAction, } from './defaults';
3
+ export { createMockWorkflowApiAdapter } from './MockWorkflowApiAdapter';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/flows/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,sBAAsB,GAC5B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAGxE,OAAO,gBAAgB,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * <juo-workflow> web component
3
+ *
4
+ * Renders the current workflow step by:
5
+ * 1. Subscribing to WorkflowServiceContext
6
+ * 2. Watching state (status + currentStepInfo) changes
7
+ * 3. For active/loading state with a step: renders <juo-extension-root surface="overlay" name="<stepId>">
8
+ * - The step is kept mounted during `loading` so button processing state is preserved
9
+ * while the respond API call is in flight.
10
+ * - The DOM is only replaced when the step ID actually changes.
11
+ * 4. For all other states: clears content
12
+ * - `completed`: unloads content; the portal handles teardown
13
+ * - `error`: dispatches a `juo-workflow-error` CustomEvent for the portal to handle
14
+ *
15
+ * The `name` attribute on juo-extension-root corresponds to the current step ID.
16
+ * The `surface="overlay"` attribute selects ThemeStateContext.overlay blocks.
17
+ * Block resolution (default vs custom) is handled by BlocksWorkflowInitializer
18
+ * which updates ThemeStateContext.overlay with the appropriate blocks.
19
+ *
20
+ * Usage:
21
+ * <juo-workflow></juo-workflow>
22
+ *
23
+ * Must be placed inside an element where WorkflowServiceContext is provided.
24
+ *
25
+ * The `blockWrapper` property accepts an optional function:
26
+ * (rendered: HTMLElement) => HTMLElement
27
+ * When provided, it is called to wrap each rendered block element.
28
+ * This allows the parent (e.g. WorkflowOverlay) to inject a sidebar/modal container
29
+ * inside the block wrapper, producing:
30
+ * juo-editor-block-wrapper -> [blockWrapper result] -> actual block
31
+ */
32
+ export declare class JuoWorkflowElement extends HTMLElement {
33
+ private workflowService;
34
+ private unsubscribeContext;
35
+ private unsubscribeEffect;
36
+ /** Tracks which step is currently mounted to avoid unnecessary DOM teardown. */
37
+ private renderedStepId;
38
+ /**
39
+ * Optional function to wrap rendered content (step blocks).
40
+ * Must be set before workflow becomes active for correct behavior.
41
+ */
42
+ blockWrapper: ((rendered: HTMLElement) => HTMLElement) | null;
43
+ connectedCallback(): void;
44
+ disconnectedCallback(): void;
45
+ private setupSubscription;
46
+ private render;
47
+ }
48
+ //# sourceMappingURL=juo-workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"juo-workflow.d.ts","sourceRoot":"","sources":["../../src/flows/juo-workflow.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,kBAAmB,SAAQ,WAAW;IACjD,OAAO,CAAC,eAAe,CAAgC;IACvD,OAAO,CAAC,kBAAkB,CAA6B;IACvD,OAAO,CAAC,iBAAiB,CAA6B;IACtD,gFAAgF;IAChF,OAAO,CAAC,cAAc,CAAuB;IAE7C;;;OAGG;IACI,YAAY,EAAE,CAAC,CAAC,QAAQ,EAAE,WAAW,KAAK,WAAW,CAAC,GAAG,IAAI,CAAQ;IAE5E,iBAAiB;IAYjB,oBAAoB;IAQpB,OAAO,CAAC,iBAAiB;IAsBzB,OAAO,CAAC,MAAM;CAkCf"}