@wise/dynamic-flow-types 4.3.0 → 4.5.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.
- package/build/renderers/FormattedValueRendererProps.d.ts +14 -0
- package/build/renderers/RendererProps.d.ts +4 -2
- package/build/renderers/RootRendererProps.d.ts +8 -0
- package/build/renderers/SubflowRendererProps.d.ts +25 -0
- package/build/renderers/index.d.ts +2 -0
- package/build/spec/feature/Behavior.d.ts +2 -1
- package/build/spec/feature/DynamicLaunchConfig.d.ts +16 -0
- package/build/spec/feature/LaunchConfig.d.ts +5 -0
- package/build/spec/feature/ModalPresentation.d.ts +6 -0
- package/build/spec/feature/Presentation.d.ts +6 -0
- package/build/spec/feature/PushPresentation.d.ts +6 -0
- package/build/spec/feature/SubflowBehavior.d.ts +32 -0
- package/build/spec/index.d.ts +6 -1
- package/build/spec/main.js +61 -19
- package/build/spec/main.mjs +61 -19
- package/build/spec/misc/Request.d.ts +23 -0
- package/build/spec/responses/subflow/SubflowResponseBody.d.ts +25 -0
- package/build/spec/schema/ObjectSchema.d.ts +5 -0
- package/build/zod/schemas.d.ts +226 -65
- package/build/zod/schemas.ts +50 -0
- package/build/zod/validators.d.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ValidationResult } from './BaseInputRendererProps';
|
|
2
|
+
import type { JsonElement } from '../spec';
|
|
3
|
+
import type { Media } from './Media';
|
|
4
|
+
import type { BaseRendererProps } from './RendererProps';
|
|
5
|
+
export type FormattedValueRendererProps = BaseRendererProps & {
|
|
6
|
+
type: 'formatted-value';
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
format: string;
|
|
10
|
+
help?: string;
|
|
11
|
+
media?: Media;
|
|
12
|
+
validationState: ValidationResult | undefined;
|
|
13
|
+
onChange: (newValue: JsonElement) => void;
|
|
14
|
+
};
|
|
@@ -8,6 +8,7 @@ import type { DateInputRendererProps } from './DateInputRendererProps';
|
|
|
8
8
|
import type { DecisionRendererProps } from './DecisionRendererProps';
|
|
9
9
|
import type { DividerRendererProps } from './DividerRendererProps';
|
|
10
10
|
import type { ExternalConfirmationRendererProps } from './ExternalConfirmationRendererProps';
|
|
11
|
+
import type { FormattedValueRendererProps } from './FormattedValueRendererProps';
|
|
11
12
|
import type { FormRendererProps } from './FormRendererProps';
|
|
12
13
|
import type { FormSectionRendererProps } from './FormSectionRendererProps';
|
|
13
14
|
import type { HeadingRendererProps } from './HeadingRendererProps';
|
|
@@ -34,10 +35,11 @@ import type { SectionRendererProps } from './SectionRendererProps';
|
|
|
34
35
|
import type { SelectInputRendererProps } from './SelectInputRendererProps';
|
|
35
36
|
import type { StatusListRendererProps } from './StatusListRendererProps';
|
|
36
37
|
import type { AnalyticsEventDispatcher, LoadingState, StepRendererProps } from './StepRendererProps';
|
|
38
|
+
import { SubflowRendererProps } from './SubflowRendererProps';
|
|
37
39
|
import { TabsRendererProps } from './TabsRendererProps';
|
|
38
40
|
import type { TextInputRendererProps } from './TextInputRendererProps';
|
|
39
41
|
import type { UploadInputRendererProps } from './UploadInputRendererProps';
|
|
40
|
-
export type RendererProps = AlertRendererProps | CheckboxInputRendererProps | BoxRendererProps | ButtonRendererProps | ColumnsRendererProps | CoreContainerRendererProps | DateInputRendererProps | DecisionRendererProps | DividerRendererProps | ExternalConfirmationRendererProps | FormRendererProps | HeadingRendererProps | HiddenRendererProps | ImageRendererProps | InstructionsRendererProps | IntegerInputRendererProps | ListRendererProps | LoadingIndicatorRendererProps | MarkdownRendererProps | ModalLayoutRendererProps | ModalRendererProps | MoneyInputRendererProps | MultiSelectInputRendererProps | MultiUploadInputRendererProps | NumberInputRendererProps | ParagraphRendererProps | ProgressRendererProps | RepeatableRendererProps | ReviewRendererProps | RootRendererProps | SearchRendererProps | FormSectionRendererProps | SelectInputRendererProps | SectionRendererProps | StatusListRendererProps | StepRendererProps | TabsRendererProps | TextInputRendererProps | UploadInputRendererProps;
|
|
42
|
+
export type RendererProps = AlertRendererProps | CheckboxInputRendererProps | BoxRendererProps | ButtonRendererProps | ColumnsRendererProps | CoreContainerRendererProps | DateInputRendererProps | DecisionRendererProps | DividerRendererProps | ExternalConfirmationRendererProps | FormattedValueRendererProps | FormRendererProps | HeadingRendererProps | HiddenRendererProps | ImageRendererProps | InstructionsRendererProps | IntegerInputRendererProps | ListRendererProps | LoadingIndicatorRendererProps | MarkdownRendererProps | ModalLayoutRendererProps | ModalRendererProps | MoneyInputRendererProps | MultiSelectInputRendererProps | MultiUploadInputRendererProps | NumberInputRendererProps | ParagraphRendererProps | ProgressRendererProps | RepeatableRendererProps | ReviewRendererProps | RootRendererProps | SearchRendererProps | FormSectionRendererProps | SelectInputRendererProps | SectionRendererProps | StatusListRendererProps | StepRendererProps | SubflowRendererProps | TabsRendererProps | TextInputRendererProps | UploadInputRendererProps;
|
|
41
43
|
export type Renderer<P extends RendererProps> = {
|
|
42
44
|
canRenderType: P['type'];
|
|
43
45
|
canRender?: (props: P) => boolean;
|
|
@@ -47,7 +49,7 @@ export type RendererContext = {
|
|
|
47
49
|
render: RenderFunction;
|
|
48
50
|
};
|
|
49
51
|
export type RenderFunction = (props: RendererProps | null) => JSX.Element | null;
|
|
50
|
-
export type Renderers = readonly (Renderer<StepRendererProps> | Renderer<CoreContainerRendererProps> | Renderer<AlertRendererProps> | Renderer<BoxRendererProps> | Renderer<ColumnsRendererProps> | Renderer<DecisionRendererProps> | Renderer<DividerRendererProps> | Renderer<ExternalConfirmationRendererProps> | Renderer<FormRendererProps> | Renderer<HeadingRendererProps> | Renderer<InstructionsRendererProps> | Renderer<ListRendererProps> | Renderer<LoadingIndicatorRendererProps> | Renderer<MarkdownRendererProps> | Renderer<ImageRendererProps> | Renderer<ModalLayoutRendererProps> | Renderer<ModalRendererProps> | Renderer<ParagraphRendererProps> | Renderer<ProgressRendererProps> | Renderer<ReviewRendererProps> | Renderer<SearchRendererProps> | Renderer<StatusListRendererProps> | Renderer<CheckboxInputRendererProps> | Renderer<ButtonRendererProps> | Renderer<DateInputRendererProps> | Renderer<HiddenRendererProps> | Renderer<IntegerInputRendererProps> | Renderer<MoneyInputRendererProps> | Renderer<NumberInputRendererProps> | Renderer<RepeatableRendererProps> | Renderer<RootRendererProps> | Renderer<FormSectionRendererProps> | Renderer<SelectInputRendererProps> | Renderer<SectionRendererProps> | Renderer<MultiSelectInputRendererProps> | Renderer<TabsRendererProps> | Renderer<TextInputRendererProps> | Renderer<UploadInputRendererProps> | Renderer<MultiUploadInputRendererProps>)[];
|
|
52
|
+
export type Renderers = readonly (Renderer<StepRendererProps> | Renderer<CoreContainerRendererProps> | Renderer<AlertRendererProps> | Renderer<BoxRendererProps> | Renderer<ColumnsRendererProps> | Renderer<DecisionRendererProps> | Renderer<DividerRendererProps> | Renderer<ExternalConfirmationRendererProps> | Renderer<FormattedValueRendererProps> | Renderer<FormRendererProps> | Renderer<HeadingRendererProps> | Renderer<InstructionsRendererProps> | Renderer<ListRendererProps> | Renderer<LoadingIndicatorRendererProps> | Renderer<MarkdownRendererProps> | Renderer<ImageRendererProps> | Renderer<ModalLayoutRendererProps> | Renderer<ModalRendererProps> | Renderer<ParagraphRendererProps> | Renderer<ProgressRendererProps> | Renderer<ReviewRendererProps> | Renderer<SearchRendererProps> | Renderer<StatusListRendererProps> | Renderer<CheckboxInputRendererProps> | Renderer<ButtonRendererProps> | Renderer<DateInputRendererProps> | Renderer<HiddenRendererProps> | Renderer<IntegerInputRendererProps> | Renderer<MoneyInputRendererProps> | Renderer<NumberInputRendererProps> | Renderer<RepeatableRendererProps> | Renderer<RootRendererProps> | Renderer<FormSectionRendererProps> | Renderer<SelectInputRendererProps> | Renderer<SectionRendererProps> | Renderer<SubflowRendererProps> | Renderer<MultiSelectInputRendererProps> | Renderer<TabsRendererProps> | Renderer<TextInputRendererProps> | Renderer<UploadInputRendererProps> | Renderer<MultiUploadInputRendererProps>)[];
|
|
51
53
|
export type BaseRendererProps = {
|
|
52
54
|
uid: string;
|
|
53
55
|
analyticsId?: string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { JsonElement, Request } from '../spec';
|
|
2
|
+
import { BaseRendererProps } from './RendererProps';
|
|
3
|
+
import { AnalyticsEventDispatcher } from './StepRendererProps';
|
|
4
|
+
/**
|
|
5
|
+
* @experimental These renderer props may change in the future without notice.
|
|
6
|
+
*/
|
|
7
|
+
export type SubflowRendererProps = BaseRendererProps & {
|
|
8
|
+
type: 'subflow';
|
|
9
|
+
uid: string;
|
|
10
|
+
presentation: {
|
|
11
|
+
type: 'push';
|
|
12
|
+
} | {
|
|
13
|
+
type: 'modal';
|
|
14
|
+
};
|
|
15
|
+
initialRequest: Request;
|
|
16
|
+
requestCache?: RequestCache;
|
|
17
|
+
onCompletion: (result: JsonElement) => void;
|
|
18
|
+
onError: (error: unknown, status?: number) => void;
|
|
19
|
+
onCancellation: () => void;
|
|
20
|
+
onEvent: AnalyticsEventDispatcher;
|
|
21
|
+
};
|
|
22
|
+
export type RequestCache = {
|
|
23
|
+
get: (requestParams: Parameters<typeof fetch>) => Promise<Response | null> | undefined;
|
|
24
|
+
set: (requestParams: Parameters<typeof fetch>, responsePromise: Promise<Response | null>) => void;
|
|
25
|
+
};
|
|
@@ -8,6 +8,7 @@ export type { DateInputRendererProps } from './DateInputRendererProps';
|
|
|
8
8
|
export type { DecisionOption, DecisionRendererProps } from './DecisionRendererProps';
|
|
9
9
|
export type { DividerRendererProps } from './DividerRendererProps';
|
|
10
10
|
export type { ExternalConfirmationRendererProps } from './ExternalConfirmationRendererProps';
|
|
11
|
+
export type { FormattedValueRendererProps } from './FormattedValueRendererProps';
|
|
11
12
|
export type { FormRendererProps } from './FormRendererProps';
|
|
12
13
|
export type { FormSectionRendererProps } from './FormSectionRendererProps';
|
|
13
14
|
export type { HeadingRendererProps } from './HeadingRendererProps';
|
|
@@ -38,6 +39,7 @@ export type { Tab, TabsRendererProps } from './TabsRendererProps';
|
|
|
38
39
|
export type { TextInputRendererProps } from './TextInputRendererProps';
|
|
39
40
|
export type { UploadInputRendererProps } from './UploadInputRendererProps';
|
|
40
41
|
export type { ValidationResult } from './BaseInputRendererProps';
|
|
42
|
+
export type { SubflowRendererProps } from './SubflowRendererProps';
|
|
41
43
|
export type { Align, Context, Margin, Size } from './constants';
|
|
42
44
|
export type { Icon } from './Icon';
|
|
43
45
|
export type { Image } from './Image';
|
|
@@ -5,7 +5,8 @@ import type { DismissBehavior } from './DismissBehavior';
|
|
|
5
5
|
import type { LinkBehavior } from './LinkBehavior';
|
|
6
6
|
import type { ModalBehavior } from './ModalBehavior';
|
|
7
7
|
import type { RefreshBehavior } from './RefreshBehavior';
|
|
8
|
+
import type { SubflowBehavior } from './SubflowBehavior';
|
|
8
9
|
/**
|
|
9
10
|
* Describes the result of performing some interaction.
|
|
10
11
|
*/
|
|
11
|
-
export type Behavior = ActionBehavior | ContainerBehavior | CopyBehavior | DismissBehavior | LinkBehavior | ModalBehavior | RefreshBehavior;
|
|
12
|
+
export type Behavior = ActionBehavior | ContainerBehavior | CopyBehavior | DismissBehavior | LinkBehavior | ModalBehavior | RefreshBehavior | SubflowBehavior;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Request } from '../misc/Request';
|
|
2
|
+
import type { Presentation } from './Presentation';
|
|
3
|
+
export type DynamicLaunchConfig = {
|
|
4
|
+
/**
|
|
5
|
+
* It must be `dynamic`.
|
|
6
|
+
*/
|
|
7
|
+
type: 'dynamic';
|
|
8
|
+
/**
|
|
9
|
+
* The request to start the subflow
|
|
10
|
+
*/
|
|
11
|
+
request: Request;
|
|
12
|
+
/**
|
|
13
|
+
* How the subflow should be presented
|
|
14
|
+
*/
|
|
15
|
+
presentation: Presentation;
|
|
16
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { LaunchConfig } from './LaunchConfig';
|
|
2
|
+
import type { Behavior } from './Behavior';
|
|
3
|
+
/**
|
|
4
|
+
* Launches a Subflow when triggered.
|
|
5
|
+
*/
|
|
6
|
+
export type SubflowBehavior = {
|
|
7
|
+
/**
|
|
8
|
+
* It must be `subflow`.
|
|
9
|
+
*/
|
|
10
|
+
type: 'subflow';
|
|
11
|
+
/**
|
|
12
|
+
* The identifier for the triggering flow, used for tracking
|
|
13
|
+
*/
|
|
14
|
+
referrerId: string;
|
|
15
|
+
/**
|
|
16
|
+
* The configuration to launch the subflow with
|
|
17
|
+
*/
|
|
18
|
+
launchConfig: LaunchConfig;
|
|
19
|
+
/**
|
|
20
|
+
* The key the result will be merged under, or root if not provided
|
|
21
|
+
*/
|
|
22
|
+
resultKey?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The behavior performed on successful completion of the subflow. If this is an ActionBehavior,
|
|
25
|
+
* the result of the subflow will be merged into the payload according to the [resultKey].
|
|
26
|
+
*/
|
|
27
|
+
onCompletion?: Behavior;
|
|
28
|
+
/**
|
|
29
|
+
* The behavior performed when the subflow fails
|
|
30
|
+
*/
|
|
31
|
+
onError?: Behavior;
|
|
32
|
+
};
|
package/build/spec/index.d.ts
CHANGED
|
@@ -7,12 +7,15 @@ export type { PersistAsync } from './feature/PersistAsync';
|
|
|
7
7
|
export type { Polling } from './feature/Polling';
|
|
8
8
|
export type { PollingOnError } from './feature/PollingOnError';
|
|
9
9
|
export type { ValidateAsync } from './feature/ValidateAsync';
|
|
10
|
+
export type { Presentation } from './feature/Presentation';
|
|
11
|
+
export type { LaunchConfig } from './feature/LaunchConfig';
|
|
10
12
|
export type { ActionBehavior } from './feature/ActionBehavior';
|
|
11
13
|
export type { Behavior } from './feature/Behavior';
|
|
12
14
|
export type { CopyBehavior } from './feature/CopyBehavior';
|
|
13
15
|
export type { DismissBehavior } from './feature/DismissBehavior';
|
|
14
16
|
export type { LinkBehavior } from './feature/LinkBehavior';
|
|
15
17
|
export type { ModalBehavior } from './feature/ModalBehavior';
|
|
18
|
+
export type { SubflowBehavior } from './feature/SubflowBehavior';
|
|
16
19
|
export type { LinkHandler } from './feature/LinkHandler';
|
|
17
20
|
export type { AutocompleteToken } from './misc/AutocompleteToken';
|
|
18
21
|
export type { HttpMethod } from './misc/HttpMethod';
|
|
@@ -24,6 +27,7 @@ export type { Icon } from './misc/Icon';
|
|
|
24
27
|
export type { Image } from './misc/Image';
|
|
25
28
|
export type { InlineAlert } from './misc/InlineAlert';
|
|
26
29
|
export type { Media } from './misc/media/Media';
|
|
30
|
+
export type { Request } from './misc/Request';
|
|
27
31
|
export type { Size as Margin, Size } from './misc/Size';
|
|
28
32
|
export type { SupportingValues } from './misc/SupportingValues';
|
|
29
33
|
export type { AlertLayout } from './layout/AlertLayout';
|
|
@@ -85,6 +89,7 @@ export type { StringSchemaFormat } from './schema/StringSchemaFormat';
|
|
|
85
89
|
export type { ActionResponseBody } from './responses/action/ActionResponseBody';
|
|
86
90
|
export type { ErrorResponseBody } from './responses/error/ErrorResponseBody';
|
|
87
91
|
export type { ModalResponseBody } from './responses/modal/ModalResponseBody';
|
|
92
|
+
export type { SubflowResponseBody } from './responses/subflow/SubflowResponseBody';
|
|
88
93
|
export type { Toolbar } from './feature/toolbar/Toolbar';
|
|
89
94
|
export type { ToolbarButton } from './feature/toolbar/ToolbarButton';
|
|
90
95
|
export type { ToolbarItem } from './feature/toolbar/ToolbarItem';
|
|
@@ -95,4 +100,4 @@ export type ValidationError = JsonElement;
|
|
|
95
100
|
export type Reference = {
|
|
96
101
|
$ref: string;
|
|
97
102
|
};
|
|
98
|
-
export { validateStep, validateActionResponse, validateErrorResponse } from '../zod/validators';
|
|
103
|
+
export { validateStep, validateActionResponse, validateErrorResponse, validateSubflowResponse, } from '../zod/validators';
|
package/build/spec/main.js
CHANGED
|
@@ -22,7 +22,8 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
validateActionResponse: () => validateActionResponse,
|
|
24
24
|
validateErrorResponse: () => validateErrorResponse,
|
|
25
|
-
validateStep: () => validateStep
|
|
25
|
+
validateStep: () => validateStep,
|
|
26
|
+
validateSubflowResponse: () => validateSubflowResponse
|
|
26
27
|
});
|
|
27
28
|
module.exports = __toCommonJS(index_exports);
|
|
28
29
|
|
|
@@ -78,6 +79,15 @@ var autocapitalizationTypeSchema = import_zod.z.union([
|
|
|
78
79
|
import_zod.z.literal("sentences"),
|
|
79
80
|
import_zod.z.literal("words")
|
|
80
81
|
]);
|
|
82
|
+
var jsonElementSchema = import_zod.z.lazy(
|
|
83
|
+
() => import_zod.z.union([
|
|
84
|
+
import_zod.z.string(),
|
|
85
|
+
import_zod.z.number(),
|
|
86
|
+
import_zod.z.boolean(),
|
|
87
|
+
import_zod.z.record(jsonElementSchema),
|
|
88
|
+
import_zod.z.array(jsonElementSchema)
|
|
89
|
+
]).nullable()
|
|
90
|
+
);
|
|
81
91
|
var alignSchema = import_zod.z.union([import_zod.z.literal("left"), import_zod.z.literal("center"), import_zod.z.literal("right")]);
|
|
82
92
|
var iconSchema = import_zod.z.union([iconNamedSchema, iconTextSchema]);
|
|
83
93
|
var mediaImageSchema = import_zod.z.object({
|
|
@@ -323,15 +333,13 @@ var searchResultSearchSchema = import_zod.z.object({
|
|
|
323
333
|
value: searchSearchRequestSchema,
|
|
324
334
|
media: mediaSchema.optional()
|
|
325
335
|
});
|
|
326
|
-
var
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
]).nullable()
|
|
334
|
-
);
|
|
336
|
+
var errorResponseBodySchema = import_zod.z.object({
|
|
337
|
+
refreshFormUrl: import_zod.z.string().optional(),
|
|
338
|
+
analytics: import_zod.z.record(import_zod.z.string()).optional(),
|
|
339
|
+
error: import_zod.z.string().optional(),
|
|
340
|
+
validation: jsonElementSchema.optional(),
|
|
341
|
+
refreshUrl: import_zod.z.string().optional()
|
|
342
|
+
});
|
|
335
343
|
var externalSchema = import_zod.z.object({
|
|
336
344
|
url: import_zod.z.string()
|
|
337
345
|
});
|
|
@@ -402,6 +410,12 @@ var actionTypeSchema = import_zod.z.union([
|
|
|
402
410
|
import_zod.z.literal("positive"),
|
|
403
411
|
import_zod.z.literal("negative")
|
|
404
412
|
]);
|
|
413
|
+
var requestSchema = import_zod.z.object({
|
|
414
|
+
url: import_zod.z.string(),
|
|
415
|
+
method: httpMethodSchema,
|
|
416
|
+
body: jsonElementSchema.optional(),
|
|
417
|
+
prefetch: import_zod.z.boolean().optional()
|
|
418
|
+
});
|
|
405
419
|
var actionSchema = import_zod.z.object({
|
|
406
420
|
title: import_zod.z.string().optional(),
|
|
407
421
|
type: actionTypeSchema.optional(),
|
|
@@ -418,7 +432,13 @@ var actionSchema = import_zod.z.object({
|
|
|
418
432
|
skipValidation: import_zod.z.boolean().optional(),
|
|
419
433
|
prefetch: import_zod.z.boolean().optional()
|
|
420
434
|
});
|
|
435
|
+
var modalPresentationSchema = import_zod.z.object({
|
|
436
|
+
type: import_zod.z.literal("modal")
|
|
437
|
+
});
|
|
421
438
|
var summarySchema = import_zod.z.union([summaryProviderSchema, summarySummariserSchema]);
|
|
439
|
+
var pushPresentationSchema = import_zod.z.object({
|
|
440
|
+
type: import_zod.z.literal("push")
|
|
441
|
+
});
|
|
422
442
|
var linkBehaviorSchema = import_zod.z.object({
|
|
423
443
|
type: import_zod.z.literal("link"),
|
|
424
444
|
url: import_zod.z.string()
|
|
@@ -456,19 +476,19 @@ var searchResultActionSchema = import_zod.z.object({
|
|
|
456
476
|
var actionResponseBodySchema = import_zod.z.object({
|
|
457
477
|
action: actionSchema
|
|
458
478
|
});
|
|
459
|
-
var errorResponseBodySchema = import_zod.z.object({
|
|
460
|
-
refreshFormUrl: import_zod.z.string().optional(),
|
|
461
|
-
analytics: import_zod.z.record(import_zod.z.string()).optional(),
|
|
462
|
-
error: import_zod.z.string().optional(),
|
|
463
|
-
validation: jsonElementSchema.optional(),
|
|
464
|
-
refreshUrl: import_zod.z.string().optional()
|
|
465
|
-
});
|
|
466
479
|
var navigationSchema = import_zod.z.object({
|
|
467
480
|
backButton: navigationBackBehaviorSchema.optional(),
|
|
468
481
|
back: navigationBackBehaviorSchema.optional(),
|
|
469
482
|
stackBehavior: navigationStackBehaviorSchema.optional()
|
|
470
483
|
});
|
|
484
|
+
var presentationSchema = import_zod.z.union([modalPresentationSchema, pushPresentationSchema]);
|
|
485
|
+
var dynamicLaunchConfigSchema = import_zod.z.object({
|
|
486
|
+
type: import_zod.z.literal("dynamic"),
|
|
487
|
+
request: requestSchema,
|
|
488
|
+
presentation: presentationSchema
|
|
489
|
+
});
|
|
471
490
|
var searchResultSchema = import_zod.z.union([searchResultActionSchema, searchResultSearchSchema]);
|
|
491
|
+
var launchConfigSchema = dynamicLaunchConfigSchema;
|
|
472
492
|
var searchResponseBodySchema = import_zod.z.object({
|
|
473
493
|
results: import_zod.z.array(searchResultSchema)
|
|
474
494
|
});
|
|
@@ -487,7 +507,8 @@ var behaviorSchema = import_zod.z.lazy(
|
|
|
487
507
|
dismissBehaviorSchema,
|
|
488
508
|
linkBehaviorSchema,
|
|
489
509
|
modalBehaviorSchema,
|
|
490
|
-
refreshBehaviorSchema
|
|
510
|
+
refreshBehaviorSchema,
|
|
511
|
+
subflowBehaviorSchema
|
|
491
512
|
])
|
|
492
513
|
);
|
|
493
514
|
var reviewLayoutCallToActionSchema = import_zod.z.lazy(
|
|
@@ -768,6 +789,15 @@ var modalLayoutContentSchema = import_zod.z.lazy(
|
|
|
768
789
|
components: import_zod.z.array(layoutSchema)
|
|
769
790
|
})
|
|
770
791
|
);
|
|
792
|
+
var subflowResponseBodySchema = import_zod.z.lazy(
|
|
793
|
+
() => import_zod.z.object({
|
|
794
|
+
referrerId: import_zod.z.string(),
|
|
795
|
+
launchConfig: launchConfigSchema,
|
|
796
|
+
resultKey: import_zod.z.string().optional(),
|
|
797
|
+
onCompletion: behaviorSchema.optional(),
|
|
798
|
+
onError: behaviorSchema.optional()
|
|
799
|
+
})
|
|
800
|
+
);
|
|
771
801
|
var modalResponseBodySchema = import_zod.z.lazy(
|
|
772
802
|
() => import_zod.z.object({
|
|
773
803
|
title: import_zod.z.string().optional(),
|
|
@@ -1052,7 +1082,8 @@ var objectSchemaSchema = import_zod.z.lazy(
|
|
|
1052
1082
|
format: import_zod.z.string().optional(),
|
|
1053
1083
|
additionalText: import_zod.z.string().optional(),
|
|
1054
1084
|
supportingValues: supportingValuesSchema.optional(),
|
|
1055
|
-
inlineAlert: inlineAlertSchema.optional()
|
|
1085
|
+
inlineAlert: inlineAlertSchema.optional(),
|
|
1086
|
+
onChange: behaviorSchema.optional()
|
|
1056
1087
|
})
|
|
1057
1088
|
);
|
|
1058
1089
|
var oneOfSchemaSchema = import_zod.z.lazy(
|
|
@@ -1229,6 +1260,16 @@ var toolbarButtonSchema = import_zod.z.lazy(
|
|
|
1229
1260
|
tags: import_zod.z.array(import_zod.z.string()).optional()
|
|
1230
1261
|
})
|
|
1231
1262
|
);
|
|
1263
|
+
var subflowBehaviorSchema = import_zod.z.lazy(
|
|
1264
|
+
() => import_zod.z.object({
|
|
1265
|
+
type: import_zod.z.literal("subflow"),
|
|
1266
|
+
referrerId: import_zod.z.string(),
|
|
1267
|
+
launchConfig: launchConfigSchema,
|
|
1268
|
+
resultKey: import_zod.z.string().optional(),
|
|
1269
|
+
onCompletion: behaviorSchema.optional(),
|
|
1270
|
+
onError: behaviorSchema.optional()
|
|
1271
|
+
})
|
|
1272
|
+
);
|
|
1232
1273
|
var modalBehaviorSchema = import_zod.z.lazy(
|
|
1233
1274
|
() => import_zod.z.object({
|
|
1234
1275
|
type: import_zod.z.literal("modal"),
|
|
@@ -1241,6 +1282,7 @@ var modalBehaviorSchema = import_zod.z.lazy(
|
|
|
1241
1282
|
var validateStep = (step) => validate(step, stepSchema);
|
|
1242
1283
|
var validateActionResponse = (response) => validate(response, actionResponseBodySchema);
|
|
1243
1284
|
var validateErrorResponse = (response) => validate(response, errorResponseBodySchema);
|
|
1285
|
+
var validateSubflowResponse = (response) => validate(response, subflowResponseBodySchema);
|
|
1244
1286
|
var validate = (value, schema) => {
|
|
1245
1287
|
const parseResult = schema.safeParse(value);
|
|
1246
1288
|
if (parseResult.success) {
|
package/build/spec/main.mjs
CHANGED
|
@@ -50,6 +50,15 @@ var autocapitalizationTypeSchema = z.union([
|
|
|
50
50
|
z.literal("sentences"),
|
|
51
51
|
z.literal("words")
|
|
52
52
|
]);
|
|
53
|
+
var jsonElementSchema = z.lazy(
|
|
54
|
+
() => z.union([
|
|
55
|
+
z.string(),
|
|
56
|
+
z.number(),
|
|
57
|
+
z.boolean(),
|
|
58
|
+
z.record(jsonElementSchema),
|
|
59
|
+
z.array(jsonElementSchema)
|
|
60
|
+
]).nullable()
|
|
61
|
+
);
|
|
53
62
|
var alignSchema = z.union([z.literal("left"), z.literal("center"), z.literal("right")]);
|
|
54
63
|
var iconSchema = z.union([iconNamedSchema, iconTextSchema]);
|
|
55
64
|
var mediaImageSchema = z.object({
|
|
@@ -295,15 +304,13 @@ var searchResultSearchSchema = z.object({
|
|
|
295
304
|
value: searchSearchRequestSchema,
|
|
296
305
|
media: mediaSchema.optional()
|
|
297
306
|
});
|
|
298
|
-
var
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
]).nullable()
|
|
306
|
-
);
|
|
307
|
+
var errorResponseBodySchema = z.object({
|
|
308
|
+
refreshFormUrl: z.string().optional(),
|
|
309
|
+
analytics: z.record(z.string()).optional(),
|
|
310
|
+
error: z.string().optional(),
|
|
311
|
+
validation: jsonElementSchema.optional(),
|
|
312
|
+
refreshUrl: z.string().optional()
|
|
313
|
+
});
|
|
307
314
|
var externalSchema = z.object({
|
|
308
315
|
url: z.string()
|
|
309
316
|
});
|
|
@@ -374,6 +381,12 @@ var actionTypeSchema = z.union([
|
|
|
374
381
|
z.literal("positive"),
|
|
375
382
|
z.literal("negative")
|
|
376
383
|
]);
|
|
384
|
+
var requestSchema = z.object({
|
|
385
|
+
url: z.string(),
|
|
386
|
+
method: httpMethodSchema,
|
|
387
|
+
body: jsonElementSchema.optional(),
|
|
388
|
+
prefetch: z.boolean().optional()
|
|
389
|
+
});
|
|
377
390
|
var actionSchema = z.object({
|
|
378
391
|
title: z.string().optional(),
|
|
379
392
|
type: actionTypeSchema.optional(),
|
|
@@ -390,7 +403,13 @@ var actionSchema = z.object({
|
|
|
390
403
|
skipValidation: z.boolean().optional(),
|
|
391
404
|
prefetch: z.boolean().optional()
|
|
392
405
|
});
|
|
406
|
+
var modalPresentationSchema = z.object({
|
|
407
|
+
type: z.literal("modal")
|
|
408
|
+
});
|
|
393
409
|
var summarySchema = z.union([summaryProviderSchema, summarySummariserSchema]);
|
|
410
|
+
var pushPresentationSchema = z.object({
|
|
411
|
+
type: z.literal("push")
|
|
412
|
+
});
|
|
394
413
|
var linkBehaviorSchema = z.object({
|
|
395
414
|
type: z.literal("link"),
|
|
396
415
|
url: z.string()
|
|
@@ -428,19 +447,19 @@ var searchResultActionSchema = z.object({
|
|
|
428
447
|
var actionResponseBodySchema = z.object({
|
|
429
448
|
action: actionSchema
|
|
430
449
|
});
|
|
431
|
-
var errorResponseBodySchema = z.object({
|
|
432
|
-
refreshFormUrl: z.string().optional(),
|
|
433
|
-
analytics: z.record(z.string()).optional(),
|
|
434
|
-
error: z.string().optional(),
|
|
435
|
-
validation: jsonElementSchema.optional(),
|
|
436
|
-
refreshUrl: z.string().optional()
|
|
437
|
-
});
|
|
438
450
|
var navigationSchema = z.object({
|
|
439
451
|
backButton: navigationBackBehaviorSchema.optional(),
|
|
440
452
|
back: navigationBackBehaviorSchema.optional(),
|
|
441
453
|
stackBehavior: navigationStackBehaviorSchema.optional()
|
|
442
454
|
});
|
|
455
|
+
var presentationSchema = z.union([modalPresentationSchema, pushPresentationSchema]);
|
|
456
|
+
var dynamicLaunchConfigSchema = z.object({
|
|
457
|
+
type: z.literal("dynamic"),
|
|
458
|
+
request: requestSchema,
|
|
459
|
+
presentation: presentationSchema
|
|
460
|
+
});
|
|
443
461
|
var searchResultSchema = z.union([searchResultActionSchema, searchResultSearchSchema]);
|
|
462
|
+
var launchConfigSchema = dynamicLaunchConfigSchema;
|
|
444
463
|
var searchResponseBodySchema = z.object({
|
|
445
464
|
results: z.array(searchResultSchema)
|
|
446
465
|
});
|
|
@@ -459,7 +478,8 @@ var behaviorSchema = z.lazy(
|
|
|
459
478
|
dismissBehaviorSchema,
|
|
460
479
|
linkBehaviorSchema,
|
|
461
480
|
modalBehaviorSchema,
|
|
462
|
-
refreshBehaviorSchema
|
|
481
|
+
refreshBehaviorSchema,
|
|
482
|
+
subflowBehaviorSchema
|
|
463
483
|
])
|
|
464
484
|
);
|
|
465
485
|
var reviewLayoutCallToActionSchema = z.lazy(
|
|
@@ -740,6 +760,15 @@ var modalLayoutContentSchema = z.lazy(
|
|
|
740
760
|
components: z.array(layoutSchema)
|
|
741
761
|
})
|
|
742
762
|
);
|
|
763
|
+
var subflowResponseBodySchema = z.lazy(
|
|
764
|
+
() => z.object({
|
|
765
|
+
referrerId: z.string(),
|
|
766
|
+
launchConfig: launchConfigSchema,
|
|
767
|
+
resultKey: z.string().optional(),
|
|
768
|
+
onCompletion: behaviorSchema.optional(),
|
|
769
|
+
onError: behaviorSchema.optional()
|
|
770
|
+
})
|
|
771
|
+
);
|
|
743
772
|
var modalResponseBodySchema = z.lazy(
|
|
744
773
|
() => z.object({
|
|
745
774
|
title: z.string().optional(),
|
|
@@ -1024,7 +1053,8 @@ var objectSchemaSchema = z.lazy(
|
|
|
1024
1053
|
format: z.string().optional(),
|
|
1025
1054
|
additionalText: z.string().optional(),
|
|
1026
1055
|
supportingValues: supportingValuesSchema.optional(),
|
|
1027
|
-
inlineAlert: inlineAlertSchema.optional()
|
|
1056
|
+
inlineAlert: inlineAlertSchema.optional(),
|
|
1057
|
+
onChange: behaviorSchema.optional()
|
|
1028
1058
|
})
|
|
1029
1059
|
);
|
|
1030
1060
|
var oneOfSchemaSchema = z.lazy(
|
|
@@ -1201,6 +1231,16 @@ var toolbarButtonSchema = z.lazy(
|
|
|
1201
1231
|
tags: z.array(z.string()).optional()
|
|
1202
1232
|
})
|
|
1203
1233
|
);
|
|
1234
|
+
var subflowBehaviorSchema = z.lazy(
|
|
1235
|
+
() => z.object({
|
|
1236
|
+
type: z.literal("subflow"),
|
|
1237
|
+
referrerId: z.string(),
|
|
1238
|
+
launchConfig: launchConfigSchema,
|
|
1239
|
+
resultKey: z.string().optional(),
|
|
1240
|
+
onCompletion: behaviorSchema.optional(),
|
|
1241
|
+
onError: behaviorSchema.optional()
|
|
1242
|
+
})
|
|
1243
|
+
);
|
|
1204
1244
|
var modalBehaviorSchema = z.lazy(
|
|
1205
1245
|
() => z.object({
|
|
1206
1246
|
type: z.literal("modal"),
|
|
@@ -1213,6 +1253,7 @@ var modalBehaviorSchema = z.lazy(
|
|
|
1213
1253
|
var validateStep = (step) => validate(step, stepSchema);
|
|
1214
1254
|
var validateActionResponse = (response) => validate(response, actionResponseBodySchema);
|
|
1215
1255
|
var validateErrorResponse = (response) => validate(response, errorResponseBodySchema);
|
|
1256
|
+
var validateSubflowResponse = (response) => validate(response, subflowResponseBodySchema);
|
|
1216
1257
|
var validate = (value, schema) => {
|
|
1217
1258
|
const parseResult = schema.safeParse(value);
|
|
1218
1259
|
if (parseResult.success) {
|
|
@@ -1237,5 +1278,6 @@ var flattenZodErrors = (zodError) => zodError.flatMap((e) => {
|
|
|
1237
1278
|
export {
|
|
1238
1279
|
validateActionResponse,
|
|
1239
1280
|
validateErrorResponse,
|
|
1240
|
-
validateStep
|
|
1281
|
+
validateStep,
|
|
1282
|
+
validateSubflowResponse
|
|
1241
1283
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { HttpMethod } from './HttpMethod';
|
|
2
|
+
import type { JsonElement } from '../JsonElement';
|
|
3
|
+
/**
|
|
4
|
+
* Represents an HTTP request
|
|
5
|
+
*/
|
|
6
|
+
export type Request = {
|
|
7
|
+
/**
|
|
8
|
+
* The URL to make the request to
|
|
9
|
+
*/
|
|
10
|
+
url: string;
|
|
11
|
+
/**
|
|
12
|
+
* The method to use
|
|
13
|
+
*/
|
|
14
|
+
method: HttpMethod;
|
|
15
|
+
/**
|
|
16
|
+
* The body of the request, ignored if [method] is GET
|
|
17
|
+
*/
|
|
18
|
+
body?: JsonElement;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the request should be prefetched
|
|
21
|
+
*/
|
|
22
|
+
prefetch?: boolean;
|
|
23
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { LaunchConfig } from '../../feature/LaunchConfig';
|
|
2
|
+
import type { Behavior } from '../../feature/Behavior';
|
|
3
|
+
export type SubflowResponseBody = {
|
|
4
|
+
/**
|
|
5
|
+
* The identifier for the triggering flow, used for tracking
|
|
6
|
+
*/
|
|
7
|
+
referrerId: string;
|
|
8
|
+
/**
|
|
9
|
+
* The configuration to launch the subflow with
|
|
10
|
+
*/
|
|
11
|
+
launchConfig: LaunchConfig;
|
|
12
|
+
/**
|
|
13
|
+
* The key the result will be merged under, or root if not provided
|
|
14
|
+
*/
|
|
15
|
+
resultKey?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The behavior performed on successful completion of the subflow. If this is an ActionBehavior,
|
|
18
|
+
* the result of the subflow will be merged into the payload according to the [resultKey].
|
|
19
|
+
*/
|
|
20
|
+
onCompletion?: Behavior;
|
|
21
|
+
/**
|
|
22
|
+
* The behavior performed when the subflow fails
|
|
23
|
+
*/
|
|
24
|
+
onError?: Behavior;
|
|
25
|
+
};
|
|
@@ -7,6 +7,7 @@ import type { AlertLayout } from '../layout/AlertLayout';
|
|
|
7
7
|
import type { Media } from '../misc/media/Media';
|
|
8
8
|
import type { SupportingValues } from '../misc/SupportingValues';
|
|
9
9
|
import type { InlineAlert } from '../misc/InlineAlert';
|
|
10
|
+
import type { Behavior } from '../feature/Behavior';
|
|
10
11
|
/**
|
|
11
12
|
* Represents an object value in the submission.
|
|
12
13
|
* The value for submission includes only non-null property values. If all property values are null, the value is an empty object.
|
|
@@ -121,4 +122,8 @@ export type ObjectSchema = {
|
|
|
121
122
|
* An alert that will be displayed inline with the item.
|
|
122
123
|
*/
|
|
123
124
|
inlineAlert?: InlineAlert;
|
|
125
|
+
/**
|
|
126
|
+
* The [com.wise.dynamicflow.feature.Behavior] that should be performed when the schema value changes.
|
|
127
|
+
*/
|
|
128
|
+
onChange?: Behavior;
|
|
124
129
|
};
|