@wise/dynamic-flow-client 0.2.0 → 0.2.1

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 (117) hide show
  1. package/build/flow/DynamicFlow.d.ts +1 -0
  2. package/build/flow/DynamicFlow.js +15 -5
  3. package/build/flow/DynamicFlowStep.d.ts +1 -0
  4. package/build/flow/errorBoundary/ErrorBoundaryAlert.d.ts +1 -0
  5. package/build/flow/fixtures/components/alert.d.ts +2 -2
  6. package/build/flow/fixtures/components/box.d.ts +2 -2
  7. package/build/flow/fixtures/components/button.d.ts +2 -2
  8. package/build/flow/fixtures/components/columns.d.ts +2 -2
  9. package/build/flow/fixtures/components/copyable.d.ts +2 -2
  10. package/build/flow/fixtures/components/decision.d.ts +2 -2
  11. package/build/flow/fixtures/components/heading.d.ts +2 -2
  12. package/build/flow/fixtures/components/image.d.ts +3 -2
  13. package/build/flow/fixtures/components/image.js +22 -3
  14. package/build/flow/fixtures/components/info.d.ts +2 -2
  15. package/build/flow/fixtures/components/list.d.ts +2 -2
  16. package/build/flow/fixtures/components/loading-indicator.d.ts +2 -2
  17. package/build/flow/fixtures/components/paragraph.d.ts +2 -2
  18. package/build/flow/fixtures/components/review.d.ts +2 -2
  19. package/build/flow/fixtures/examples/camera-capture.d.ts +2 -2
  20. package/build/flow/fixtures/examples/recipient-update.d.ts +2 -2
  21. package/build/flow/fixtures/examples/recipient-update.js +2 -2
  22. package/build/flow/fixtures/examples/recipient.d.ts +2 -2
  23. package/build/flow/fixtures/examples/single-file-upload.d.ts +2 -2
  24. package/build/flow/fixtures/examples/single-file-upload.js +32 -30
  25. package/build/flow/fixtures/examples/step-validation-errors.d.ts +2 -2
  26. package/build/flow/fixtures/features/action-response.d.ts +2 -2
  27. package/build/flow/fixtures/features/external.d.ts +2 -2
  28. package/build/flow/fixtures/features/persist-async.d.ts +2 -2
  29. package/build/flow/fixtures/features/polling.d.ts +2 -2
  30. package/build/flow/fixtures/features/validation-async.d.ts +3 -0
  31. package/build/flow/fixtures/features/validation-async.js +38 -0
  32. package/build/flow/fixtures/index.d.ts +34 -28
  33. package/build/flow/fixtures/index.js +8 -1
  34. package/build/flow/fixtures/responses/action-response-final.d.ts +2 -2
  35. package/build/flow/fixtures/responses/recipient-update-final.d.ts +2 -2
  36. package/build/flow/fixtures/schemas/basic-form.d.ts +2 -2
  37. package/build/flow/fixtures/schemas/number-and-integer.d.ts +2 -2
  38. package/build/flow/fixtures/schemas/one-of.d.ts +2 -2
  39. package/build/flow/fixtures/schemas/string-formats.d.ts +2 -2
  40. package/build/flow/fixtures/schemas/string-formats.js +6 -2
  41. package/build/flow/stories/DynamicFlow.story.d.ts +1 -0
  42. package/build/flow/stories/DynamicFlow.story.js +30 -0
  43. package/build/flow/stories/EditableDynamicFlow.d.ts +1 -0
  44. package/build/flow/stories/EditableDynamicFlow.js +2 -1
  45. package/build/flow/stories/fixtureFetcher.d.ts +2 -0
  46. package/build/flow/stories/fixtureFetcher.js +114 -0
  47. package/build/jsonSchemaForm/JsonSchemaForm.d.ts +1 -0
  48. package/build/jsonSchemaForm/allOfSchema/AllOfSchema.d.ts +1 -0
  49. package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.d.ts +1 -0
  50. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +1 -0
  51. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +1 -0
  52. package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.d.ts +1 -0
  53. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.d.ts +1 -0
  54. package/build/jsonSchemaForm/genericSchema/GenericSchema.d.ts +1 -0
  55. package/build/jsonSchemaForm/help/Help.d.ts +1 -0
  56. package/build/jsonSchemaForm/objectSchema/ObjectSchema.d.ts +1 -0
  57. package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.d.ts +1 -0
  58. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.d.ts +1 -0
  59. package/build/jsonSchemaForm/persistAsyncSchema/basic/PersistAsyncBasicSchema.d.ts +1 -0
  60. package/build/jsonSchemaForm/persistAsyncSchema/blob/PersistAsyncBlobSchema.d.ts +1 -0
  61. package/build/jsonSchemaForm/persistAsyncSchema/blob/UploadInputAdapter.d.ts +1 -0
  62. package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.d.ts +1 -0
  63. package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfCheckboxControl.d.ts +1 -0
  64. package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfRadioControl.d.ts +1 -0
  65. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.d.ts +1 -0
  66. package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.d.ts +2 -1
  67. package/build/jsonSchemaForm/schemaFormControl/optionMapper.d.ts +7 -11
  68. package/build/jsonSchemaForm/schemaFormControl/optionMapper.js +12 -6
  69. package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.d.ts +1 -0
  70. package/build/layout/DynamicLayout.d.ts +1 -0
  71. package/build/layout/alert/index.d.ts +1 -0
  72. package/build/layout/box/index.d.ts +1 -0
  73. package/build/layout/button/index.d.ts +1 -0
  74. package/build/layout/columns/index.d.ts +1 -0
  75. package/build/layout/decision/index.d.ts +1 -0
  76. package/build/layout/divider/index.d.ts +1 -0
  77. package/build/layout/external/DynamicExternal.d.ts +1 -0
  78. package/build/layout/form/index.d.ts +1 -0
  79. package/build/layout/heading/index.d.ts +1 -0
  80. package/build/layout/icon/index.d.ts +1 -0
  81. package/build/layout/image/index.d.ts +4 -2
  82. package/build/layout/image/index.js +17 -38
  83. package/build/layout/info/index.d.ts +1 -0
  84. package/build/layout/list/index.d.ts +1 -0
  85. package/build/layout/loading-indicator/index.d.ts +1 -0
  86. package/build/layout/paragraph/DynamicParagraph.d.ts +1 -0
  87. package/build/layout/review/index.d.ts +1 -0
  88. package/build/main.css +45 -0
  89. package/build/step/cameraStep/CameraStep.d.ts +1 -0
  90. package/build/step/cameraStep/cameraCapture/CameraCapture.d.ts +1 -0
  91. package/build/step/cameraStep/cameraCapture/components/index.d.ts +1 -0
  92. package/build/step/cameraStep/cameraCapture/overlay/Overlay.d.ts +1 -0
  93. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +1 -0
  94. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.d.ts +1 -0
  95. package/build/step/externalConfirmationStep/ExternalConfirmationStep.d.ts +1 -0
  96. package/build/step/layoutStep/LayoutStep.d.ts +1 -0
  97. package/package.json +7 -5
  98. package/build/common/hooks/useDebouncedFunction.test.d.ts +0 -1
  99. package/build/common/hooks/useDebouncedFunction.test.js +0 -59
  100. package/build/common/logging/spec.d.ts +0 -1
  101. package/build/common/logging/spec.js +0 -45
  102. package/build/common/tracking/spec.d.ts +0 -1
  103. package/build/common/tracking/spec.js +0 -49
  104. package/build/common/utils/generate-random-id.test.d.ts +0 -1
  105. package/build/common/utils/generate-random-id.test.js +0 -12
  106. package/build/common/validation/rule-validators/spec.d.ts +0 -1
  107. package/build/common/validation/rule-validators/spec.js +0 -145
  108. package/build/common/validation/schema-validators/spec.d.ts +0 -1
  109. package/build/common/validation/schema-validators/spec.js +0 -137
  110. package/build/common/validation/valid-model/spec.d.ts +0 -1
  111. package/build/common/validation/valid-model/spec.js +0 -605
  112. package/build/common/validation/validation-failures/spec.d.ts +0 -1
  113. package/build/common/validation/validation-failures/spec.js +0 -185
  114. package/build/flow/response-parsers/spec.d.ts +0 -1
  115. package/build/flow/response-parsers/spec.js +0 -263
  116. package/build/layout/loading-indicator/spec.d.ts +0 -1
  117. package/build/layout/loading-indicator/spec.js +0 -11
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { DynamicFlowProps } from './types';
2
3
  declare const DynamicFlow: (props: DynamicFlowProps) => JSX.Element;
3
4
  export default DynamicFlow;
@@ -320,16 +320,26 @@ var DynamicFlowComponent = function (_a) {
320
320
  : "onAction was supressed because action is disabled", extraLoggingProps);
321
321
  return [2 /*return*/];
322
322
  }
323
- if (!exit) return [3 /*break*/, 3];
324
- if (!url) return [3 /*break*/, 2];
323
+ if (!exit) return [3 /*break*/, 7];
324
+ if (!url) return [3 /*break*/, 6];
325
+ if (!isSubmissionMethod(method)) return [3 /*break*/, 3];
326
+ setFormErrors(null);
327
+ setSubmitted(true);
328
+ if (!modelIsValid) return [3 /*break*/, 2];
325
329
  return [4 /*yield*/, fetchExitResult(action, submissionData)];
326
330
  case 1:
327
331
  _a.sent();
328
- return [2 /*return*/];
329
- case 2:
332
+ _a.label = 2;
333
+ case 2: return [3 /*break*/, 5];
334
+ case 3: return [4 /*yield*/, fetchExitResult(action)];
335
+ case 4:
336
+ _a.sent();
337
+ _a.label = 5;
338
+ case 5: return [2 /*return*/];
339
+ case 6:
330
340
  onCloseWithTracking(result);
331
341
  return [2 /*return*/];
332
- case 3:
342
+ case 7:
333
343
  if (isSubmissionMethod(method)) {
334
344
  setFormErrors(null);
335
345
  setSubmitted(true);
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { GlobalError, Step } from '../dynamic-flow-types';
2
3
  import { LayoutStepProps } from '../step/layoutStep/LayoutStep';
3
4
  type DynamicFlowStepProps = Omit<LayoutStepProps, 'stepSpecification'> & {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  type Props = {
2
3
  onDismiss: () => void;
3
4
  };
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,4 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { Size, FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
4
+ export declare const getImageStep: (size: Size) => FormStep;
@@ -1,3 +1,4 @@
1
+ var sizes = ['xs', 'sm', 'md', 'lg', 'xl'];
1
2
  var step = {
2
3
  type: 'form',
3
4
  key: 'Components/Image',
@@ -5,7 +6,7 @@ var step = {
5
6
  description: 'Images can have different sizes: "xs", "sm", "md", "lg", "xl".',
6
7
  actions: [],
7
8
  schemas: [],
8
- layout: ['xs', 'sm', 'md', 'lg', 'xl'].flatMap(function (size) { return [
9
+ layout: sizes.flatMap(function (size) { return [
9
10
  {
10
11
  type: 'paragraph',
11
12
  text: "This is an image with size: \"".concat(size, "\""),
@@ -13,10 +14,28 @@ var step = {
13
14
  },
14
15
  {
15
16
  type: 'image',
16
- url: 'https://bootstrap.transferwise.com/assets/img/css2-bg.jpg',
17
- text: "This is heading with size: \"".concat(size, "\""),
17
+ url: 'http://placekitten.com/g/400/400',
18
+ text: "This is an image with size: \"".concat(size, "\""),
18
19
  size: size
19
20
  },
20
21
  ]; })
21
22
  };
22
23
  export default step;
24
+ export var getImageStep = function (size) {
25
+ return {
26
+ type: 'form',
27
+ key: "Components/Image-".concat(size),
28
+ title: "Image Component - ".concat(size),
29
+ description: "This is an image with size: \"".concat(size, "\""),
30
+ actions: [],
31
+ schemas: [],
32
+ layout: [
33
+ {
34
+ type: 'image',
35
+ url: 'http://placekitten.com/g/400/400',
36
+ text: "This is an image with size: \"".concat(size, "\""),
37
+ size: size
38
+ },
39
+ ]
40
+ };
41
+ };
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -13,6 +13,7 @@ var step = {
13
13
  ],
14
14
  schemas: [
15
15
  {
16
+ $id: 'form',
16
17
  allOf: [
17
18
  {
18
19
  type: 'object',
@@ -190,8 +191,7 @@ var step = {
190
191
  },
191
192
  required: ['address']
192
193
  },
193
- ],
194
- $id: 'form'
194
+ ]
195
195
  },
196
196
  ],
197
197
  errors: {
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -5,7 +5,7 @@ var step = {
5
5
  actions: [],
6
6
  schemas: [
7
7
  {
8
- $id: 'the-schema',
8
+ $id: '#schema-1',
9
9
  type: 'object',
10
10
  displayOrder: ['frontSide'],
11
11
  properties: {
@@ -33,6 +33,35 @@ var step = {
33
33
  },
34
34
  required: ['frontSide']
35
35
  },
36
+ {
37
+ $id: '#schema-2',
38
+ type: 'object',
39
+ displayOrder: ['frontSide'],
40
+ properties: {
41
+ frontSide: {
42
+ refreshFormOnChange: false,
43
+ $id: 'backSide',
44
+ persistAsync: {
45
+ url: '/single-file-upload-url-fail',
46
+ param: 'file',
47
+ idProperty: 'backSide',
48
+ schema: {
49
+ accepts: ['image/jpeg', 'image/png'],
50
+ maxSize: 41943040,
51
+ source: 'file',
52
+ description: 'JPEG or PNG less than 10MB',
53
+ $id: 'cb22a588-c404-43fd-b3fa-754afb3729f4',
54
+ title: 'Upload file',
55
+ type: 'blob'
56
+ },
57
+ method: 'POST'
58
+ },
59
+ title: 'Single File Upload',
60
+ type: 'integer'
61
+ }
62
+ },
63
+ required: ['backSide']
64
+ },
36
65
  ],
37
66
  layout: [
38
67
  {
@@ -41,7 +70,7 @@ var step = {
41
70
  },
42
71
  {
43
72
  type: 'form',
44
- schema: { $ref: 'the-schema' }
73
+ schema: { $ref: '#schema-1' }
45
74
  },
46
75
  {
47
76
  type: 'paragraph',
@@ -49,34 +78,7 @@ var step = {
49
78
  },
50
79
  {
51
80
  type: 'form',
52
- schema: {
53
- type: 'object',
54
- displayOrder: ['frontSide'],
55
- properties: {
56
- frontSide: {
57
- refreshFormOnChange: false,
58
- $id: 'backSide',
59
- persistAsync: {
60
- url: '/single-file-upload-url-fail',
61
- param: 'file',
62
- idProperty: 'backSide',
63
- schema: {
64
- accepts: ['image/jpeg', 'image/png'],
65
- maxSize: 41943040,
66
- source: 'file',
67
- description: 'JPEG or PNG less than 10MB',
68
- $id: 'cb22a588-c404-43fd-b3fa-754afb3729f4',
69
- title: 'Upload file',
70
- type: 'blob'
71
- },
72
- method: 'POST'
73
- },
74
- title: 'Single File Upload',
75
- type: 'integer'
76
- }
77
- },
78
- required: ['backSide']
79
- }
81
+ schema: { $ref: '#schema-2' }
80
82
  },
81
83
  {
82
84
  type: 'button',
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -0,0 +1,3 @@
1
+ import { Step } from '../../../dynamic-flow-types';
2
+ declare const step: Step;
3
+ export default step;
@@ -0,0 +1,38 @@
1
+ var step = {
2
+ type: 'form',
3
+ key: 'Features/Validation Async',
4
+ title: 'Validation Async Feature',
5
+ schemas: [
6
+ {
7
+ $id: '#the-schema',
8
+ type: 'object',
9
+ displayOrder: ['account-number'],
10
+ properties: {
11
+ 'account-number': {
12
+ $id: '#the-string-schema',
13
+ type: 'string',
14
+ maxLength: 6,
15
+ title: 'Account number (max 6 digits)',
16
+ validationAsync: {
17
+ method: 'POST',
18
+ url: '/validate',
19
+ param: 'myParameter'
20
+ }
21
+ }
22
+ }
23
+ },
24
+ ],
25
+ layout: [
26
+ {
27
+ type: 'form',
28
+ schema: {
29
+ $ref: '#the-schema'
30
+ }
31
+ },
32
+ ],
33
+ actions: [],
34
+ model: {
35
+ // name: 'Colin Robinson',
36
+ }
37
+ };
38
+ export default step;
@@ -1,38 +1,44 @@
1
1
  export declare const fixtures: {
2
2
  readonly steps: {
3
- readonly simpleForm: import("../..").Step;
4
- readonly stringFormats: import("../..").Step;
5
- readonly numberAndInteger: import("../..").Step;
6
- readonly oneOf: import("../..").Step;
7
- readonly alert: import("../..").Step;
8
- readonly box: import("../..").Step;
9
- readonly button: import("../..").Step;
10
- readonly columns: import("../..").Step;
11
- readonly decision: import("../..").Step;
12
- readonly heading: import("../..").Step;
13
- readonly image: import("../..").Step;
14
- readonly info: import("../..").Step;
15
- readonly list: import("../..").Step;
16
- readonly loadingIndicator: import("../..").Step;
17
- readonly paragraph: import("../..").Step;
18
- readonly review: import("../..").Step;
19
- readonly copyable: import("../..").Step;
20
- readonly actionResponse: import("../..").Step;
21
- readonly polling: import("../..").Step;
22
- readonly external: import("../..").Step;
23
- readonly recipient: import("../..").Step;
24
- readonly recipientUpdate: import("../..").Step;
25
- readonly persistAsync: import("../..").Step;
26
- readonly singleFileUpload: import("../..").Step;
27
- readonly stepValidationErrors: import("../..").Step;
28
- readonly cameraCapture: import("../..").Step;
3
+ readonly simpleForm: import("../../dynamic-flow-types").FormStep;
4
+ readonly stringFormats: import("../../dynamic-flow-types").FormStep;
5
+ readonly numberAndInteger: import("../../dynamic-flow-types").FormStep;
6
+ readonly oneOf: import("../../dynamic-flow-types").FormStep;
7
+ readonly alert: import("../../dynamic-flow-types").FormStep;
8
+ readonly box: import("../../dynamic-flow-types").FormStep;
9
+ readonly button: import("../../dynamic-flow-types").FormStep;
10
+ readonly columns: import("../../dynamic-flow-types").FormStep;
11
+ readonly decision: import("../../dynamic-flow-types").FormStep;
12
+ readonly heading: import("../../dynamic-flow-types").FormStep;
13
+ readonly image: import("../../dynamic-flow-types").FormStep;
14
+ readonly 'image-xs': import("../../dynamic-flow-types").FormStep;
15
+ readonly 'image-sm': import("../../dynamic-flow-types").FormStep;
16
+ readonly 'image-md': import("../../dynamic-flow-types").FormStep;
17
+ readonly 'image-lg': import("../../dynamic-flow-types").FormStep;
18
+ readonly 'image-xl': import("../../dynamic-flow-types").FormStep;
19
+ readonly info: import("../../dynamic-flow-types").FormStep;
20
+ readonly list: import("../../dynamic-flow-types").FormStep;
21
+ readonly loadingIndicator: import("../../dynamic-flow-types").FormStep;
22
+ readonly paragraph: import("../../dynamic-flow-types").FormStep;
23
+ readonly review: import("../../dynamic-flow-types").FormStep;
24
+ readonly copyable: import("../../dynamic-flow-types").FormStep;
25
+ readonly actionResponse: import("../../dynamic-flow-types").FormStep;
26
+ readonly polling: import("../../dynamic-flow-types").FormStep;
27
+ readonly external: import("../../dynamic-flow-types").FormStep;
28
+ readonly recipient: import("../../dynamic-flow-types").FormStep;
29
+ readonly recipientUpdate: import("../../dynamic-flow-types").FormStep;
30
+ readonly persistAsync: import("../../dynamic-flow-types").FormStep;
31
+ readonly validationAsync: import("../..").Step;
32
+ readonly singleFileUpload: import("../../dynamic-flow-types").FormStep;
33
+ readonly stepValidationErrors: import("../../dynamic-flow-types").FormStep;
34
+ readonly cameraCapture: import("../../dynamic-flow-types").FormStep;
29
35
  };
30
36
  readonly responses: {
31
37
  readonly action: {
32
38
  action: import("../../dynamic-flow-types").Action;
33
39
  };
34
- readonly success: import("../..").Step;
35
- readonly recipientUpdate: import("../..").Step;
40
+ readonly success: import("../../dynamic-flow-types").FormStep;
41
+ readonly recipientUpdate: import("../../dynamic-flow-types").FormStep;
36
42
  readonly exit: {
37
43
  id: string;
38
44
  name: string;
@@ -5,7 +5,7 @@ import columns from './components/columns';
5
5
  import copyable from './components/copyable';
6
6
  import decision from './components/decision';
7
7
  import heading from './components/heading';
8
- import image from './components/image';
8
+ import image, { getImageStep } from './components/image';
9
9
  import info from './components/info';
10
10
  import list from './components/list';
11
11
  import loadingIndicator from './components/loading-indicator';
@@ -20,6 +20,7 @@ import actionResponse from './features/action-response';
20
20
  import external from './features/external';
21
21
  import persistAsync from './features/persist-async';
22
22
  import polling from './features/polling';
23
+ import validationAsync from './features/validation-async';
23
24
  import action from './responses/action';
24
25
  import actionResponseFinal from './responses/action-response-final';
25
26
  import exit from './responses/exit';
@@ -41,6 +42,11 @@ export var fixtures = {
41
42
  decision: decision,
42
43
  heading: heading,
43
44
  image: image,
45
+ 'image-xs': getImageStep('xs'),
46
+ 'image-sm': getImageStep('sm'),
47
+ 'image-md': getImageStep('md'),
48
+ 'image-lg': getImageStep('lg'),
49
+ 'image-xl': getImageStep('xl'),
44
50
  info: info,
45
51
  list: list,
46
52
  loadingIndicator: loadingIndicator,
@@ -53,6 +59,7 @@ export var fixtures = {
53
59
  recipient: recipient,
54
60
  recipientUpdate: recipientUpdate,
55
61
  persistAsync: persistAsync,
62
+ validationAsync: validationAsync,
56
63
  singleFileUpload: singleFileUpload,
57
64
  stepValidationErrors: stepValidationErrors,
58
65
  cameraCapture: cameraCapture
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -1,3 +1,3 @@
1
- import { Step } from '../../../dynamic-flow-types';
2
- declare const step: Step;
1
+ import { FormStep } from '../../../dynamic-flow-types';
2
+ declare const step: FormStep;
3
3
  export default step;
@@ -30,7 +30,8 @@ var step = {
30
30
  format: 'date',
31
31
  control: 'date-lookup',
32
32
  minimum: '2023-01-01',
33
- maximum: '2023-12-31'
33
+ maximum: '2023-12-31',
34
+ placeholder: 'Select a date'
34
35
  },
35
36
  telephone: {
36
37
  title: 'Phone number (string schema with format: "phone-number")',
@@ -53,6 +54,9 @@ var step = {
53
54
  type: 'primary'
54
55
  }
55
56
  },
56
- ]
57
+ ],
58
+ model: {
59
+ 'date-lookup': '2023-01-01'
60
+ }
57
61
  };
58
62
  export default step;
@@ -0,0 +1 @@
1
+ export declare const getObjectKeys: <T>(object: T) => (keyof T)[];
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { action } from '@storybook/addon-actions';
3
+ import { storiesOf } from '@storybook/react';
4
+ import DynamicFlow from '../DynamicFlow';
5
+ import { fixtures } from '../fixtures';
6
+ import EditableDynamicFlow from './EditableDynamicFlow';
7
+ import { fixtureFetcher } from './fixtureFetcher';
8
+ export var getObjectKeys = Object.keys;
9
+ var storyMap = {};
10
+ var allStepNames = getObjectKeys(fixtures.steps);
11
+ allStepNames.forEach(function (stepName) {
12
+ var _a;
13
+ var label = (_a = fixtures.steps[stepName].key) !== null && _a !== void 0 ? _a : stepName;
14
+ var _b = label.split('/'), group = _b[0], name = _b[1];
15
+ if (!storyMap[group]) {
16
+ storyMap[group] = storiesOf("Dynamic Flow/".concat(group), module);
17
+ }
18
+ storyMap[group].add(name, function () { return (_jsx(DynamicFlow, { id: "storybook", initialAction: { method: 'GET', url: "/steps/".concat(stepName) }, fetcher: fixtureFetcher, loaderConfig: { size: 'xl', initial: true, submission: false }, onClose: action('onClose'), onStepChange: action('onStepChange'), onError: action('onError'), onTrackableEvent: action('onTrackableEvent'), onLog: action('onLog') }, stepName)); });
19
+ });
20
+ var editable = storiesOf("Dynamic Flow/Editable", module);
21
+ editable.add('Dynamic Flow', EditableDynamicFlow, {
22
+ argTypes: {
23
+ initialStepName: {
24
+ label: 'Initial Step',
25
+ control: 'select',
26
+ options: Object.keys(fixtures.steps)
27
+ }
28
+ },
29
+ args: { initialStepName: Object.keys(fixtures)[0] }
30
+ });
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const EditableDynamicFlow: ({ initialStepName }: {
2
3
  initialStepName?: string | undefined;
3
4
  }) => JSX.Element;