@wise/dynamic-flow-client 3.3.2 → 3.4.0-experimental-ed080a1

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 (168) hide show
  1. package/build/common/httpClientContext/HttpClientContext.js +35 -0
  2. package/build/common/httpClientContext/index.js +1 -0
  3. package/build/common/makeHttpClient/index.js +1 -0
  4. package/build/common/makeHttpClient/makeHttpClient.js +34 -0
  5. package/build/common/messages/generic-error.messages.js +18 -0
  6. package/build/common/messages/help.messages.js +8 -0
  7. package/build/common/messages/multi-file-upload.messages.js +18 -0
  8. package/build/common/messages/paragraph.messages.js +13 -0
  9. package/build/common/messages/repeatable.messages.js +23 -0
  10. package/build/common/messages/validation.array.messages.js +13 -0
  11. package/build/common/messages/validation.messages.js +53 -0
  12. package/build/common/utils/api-utils.js +4 -0
  13. package/build/legacy/common/constants/DateMode.js +4 -0
  14. package/build/legacy/common/constants/FeatureName.js +4 -0
  15. package/build/legacy/common/constants/FormControlType.js +21 -0
  16. package/build/legacy/common/constants/MonthFormat.js +4 -0
  17. package/build/legacy/common/constants/Size.js +7 -0
  18. package/build/legacy/common/constants/index.js +4 -0
  19. package/build/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +36 -0
  20. package/build/legacy/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +13 -0
  21. package/build/legacy/common/contexts/eventsContext/EventsContext.js +38 -0
  22. package/build/legacy/common/contexts/featureContext/FeatureContext.js +22 -0
  23. package/build/legacy/common/contexts/index.js +3 -0
  24. package/build/legacy/common/contexts/logContext/LogContext.js +44 -0
  25. package/build/legacy/common/hooks/index.js +7 -0
  26. package/build/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.js +9 -0
  27. package/build/legacy/common/hooks/useExternal/useExternal.js +15 -0
  28. package/build/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.js +70 -0
  29. package/build/legacy/common/hooks/usePersistAsync/usePersistAsync.js +172 -0
  30. package/build/legacy/common/hooks/usePolling/usePolling.js +51 -0
  31. package/build/legacy/common/hooks/usePrevious/usePrevious.js +8 -0
  32. package/build/legacy/common/hooks/useStepPolling/useStepPolling.js +43 -0
  33. package/build/legacy/common/messages.js +8 -0
  34. package/build/legacy/common/utils/api-utils.js +6 -0
  35. package/build/legacy/common/utils/date-utils.js +22 -0
  36. package/build/legacy/common/utils/debounce.js +38 -0
  37. package/build/legacy/common/utils/file-utils.js +45 -0
  38. package/build/legacy/common/utils/id-utils.js +5 -0
  39. package/build/legacy/common/utils/index.js +11 -0
  40. package/build/legacy/common/utils/is-equal.js +21 -0
  41. package/build/legacy/common/utils/misc-utils.js +4 -0
  42. package/build/legacy/common/utils/mobile-utils.js +23 -0
  43. package/build/legacy/common/utils/model-utils.js +33 -0
  44. package/build/legacy/common/utils/schema-utils.js +97 -0
  45. package/build/legacy/common/utils/step-utils.js +32 -0
  46. package/build/legacy/common/validators/index.js +5 -0
  47. package/build/legacy/common/validators/models/model-utils.js +119 -0
  48. package/build/legacy/common/validators/models/model-validators.js +62 -0
  49. package/build/legacy/common/validators/schemas/schema-validators.js +101 -0
  50. package/build/legacy/common/validators/types/type-validators.js +14 -0
  51. package/build/legacy/common/validators/validationFailures/validation-failures.js +139 -0
  52. package/build/legacy/common/validators/validationFailures/validation-failures.utils.js +40 -0
  53. package/build/legacy/common/validators/values/value-validators.js +6 -0
  54. package/build/legacy/dynamic-flow-types.js +1 -0
  55. package/build/legacy/dynamicFlow/BackButton.js +22 -0
  56. package/build/legacy/dynamicFlow/DynamicFlowStep.js +37 -0
  57. package/build/legacy/formControl/FormControl.js +266 -0
  58. package/build/legacy/formControl/index.js +1 -0
  59. package/build/legacy/formControl/utils/getAutocompleteString.js +80 -0
  60. package/build/legacy/formControl/utils/index.js +2 -0
  61. package/build/legacy/formControl/utils/value-utils.js +108 -0
  62. package/build/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.js +50 -0
  63. package/build/legacy/jsonSchemaForm/allOfSchema/index.js +1 -0
  64. package/build/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +25 -0
  65. package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +30 -0
  66. package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +141 -0
  67. package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +1 -0
  68. package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +2 -0
  69. package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +79 -0
  70. package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +14 -0
  71. package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.js +7 -0
  72. package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.js +134 -0
  73. package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.js +85 -0
  74. package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/utils/summary-utils.js +135 -0
  75. package/build/legacy/jsonSchemaForm/arrayTypeSchema/index.js +1 -0
  76. package/build/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +111 -0
  77. package/build/legacy/jsonSchemaForm/basicTypeSchema/index.js +1 -0
  78. package/build/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.js +86 -0
  79. package/build/legacy/jsonSchemaForm/controlFeedback/index.js +1 -0
  80. package/build/legacy/jsonSchemaForm/help/Help.js +20 -0
  81. package/build/legacy/jsonSchemaForm/help/index.js +1 -0
  82. package/build/legacy/jsonSchemaForm/objectSchema/ObjectSchema.js +77 -0
  83. package/build/legacy/jsonSchemaForm/objectSchema/index.js +1 -0
  84. package/build/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.js +155 -0
  85. package/build/legacy/jsonSchemaForm/oneOfSchema/index.js +1 -0
  86. package/build/legacy/jsonSchemaForm/oneOfSchema/utils.js +68 -0
  87. package/build/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +26 -0
  88. package/build/legacy/jsonSchemaForm/persistAsyncSchema/index.js +1 -0
  89. package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +165 -0
  90. package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +1 -0
  91. package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +131 -0
  92. package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +31 -0
  93. package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +1 -0
  94. package/build/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +72 -0
  95. package/build/legacy/jsonSchemaForm/promotedOneOfSchema/index.js +1 -0
  96. package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +8 -0
  97. package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +27 -0
  98. package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +31 -0
  99. package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +32 -0
  100. package/build/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +54 -0
  101. package/build/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +13 -0
  102. package/build/legacy/jsonSchemaForm/readOnlySchema/index.js +1 -0
  103. package/build/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +133 -0
  104. package/build/legacy/jsonSchemaForm/schemaFormControl/index.js +1 -0
  105. package/build/legacy/jsonSchemaForm/schemaFormControl/utils/index.js +1 -0
  106. package/build/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +107 -0
  107. package/build/legacy/layout/DynamicLayout.js +68 -0
  108. package/build/legacy/layout/alert/DynamicAlert.js +29 -0
  109. package/build/legacy/layout/box/DynamicBox.js +41 -0
  110. package/build/legacy/layout/button/DynamicButton.js +27 -0
  111. package/build/legacy/layout/button/utils.js +45 -0
  112. package/build/legacy/layout/columns/DynamicColumns.js +38 -0
  113. package/build/legacy/layout/decision/DynamicDecision.js +21 -0
  114. package/build/legacy/layout/divider/DynamicDivider.js +9 -0
  115. package/build/legacy/layout/external/DynamicExternal.js +32 -0
  116. package/build/legacy/layout/external/DynamicExternal.messages.js +8 -0
  117. package/build/legacy/layout/form/DynamicForm.js +22 -0
  118. package/build/legacy/layout/heading/DynamicHeading.js +51 -0
  119. package/build/legacy/layout/icon/DynamicIcon.js +17 -0
  120. package/build/legacy/layout/icon/FlagIcon.js +198 -0
  121. package/build/legacy/layout/icon/NamedIcon.js +19 -0
  122. package/build/legacy/layout/image/DynamicImage.js +111 -0
  123. package/build/legacy/layout/index.js +20 -0
  124. package/build/legacy/layout/instructions/DynamicInstructions.js +30 -0
  125. package/build/legacy/layout/list/DynamicStatusList.js +37 -0
  126. package/build/legacy/layout/loadingIndicator/DynamicLoadingIndicator.js +11 -0
  127. package/build/legacy/layout/markdown/DynamicMarkdown.js +23 -0
  128. package/build/legacy/layout/modal/DynamicModal.js +26 -0
  129. package/build/legacy/layout/paragraph/DynamicParagraph.js +46 -0
  130. package/build/legacy/layout/paragraph/useSnackBarIfAvailable.js +9 -0
  131. package/build/legacy/layout/review/DynamicReview.js +58 -0
  132. package/build/legacy/layout/search/DynamicSearch.js +58 -0
  133. package/build/legacy/layout/search/SearchInput.js +17 -0
  134. package/build/legacy/layout/search/SearchResults.js +31 -0
  135. package/build/legacy/layout/search/useSearch.js +137 -0
  136. package/build/legacy/layout/utils/getNavigationOptionMedia.js +28 -0
  137. package/build/legacy/layout/utils/index.js +32 -0
  138. package/build/legacy/step/cameraStep/CameraStep.js +124 -0
  139. package/build/legacy/step/cameraStep/cameraCapture/CameraCapture.js +161 -0
  140. package/build/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.js +58 -0
  141. package/build/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.js +28 -0
  142. package/build/legacy/step/cameraStep/cameraCapture/components/index.js +3 -0
  143. package/build/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.js +19 -0
  144. package/build/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.js +8 -0
  145. package/build/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.js +60 -0
  146. package/build/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.js +80 -0
  147. package/build/legacy/step/cameraStep/cameraCapture/index.js +1 -0
  148. package/build/legacy/step/cameraStep/cameraCapture/overlay/Overlay.js +77 -0
  149. package/build/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.js +18 -0
  150. package/build/legacy/step/cameraStep/cameraCapture/screens/index.js +1 -0
  151. package/build/legacy/step/cameraStep/cameraCapture/tracking/index.js +109 -0
  152. package/build/legacy/step/cameraStep/cameraCapture/types/index.js +7 -0
  153. package/build/legacy/step/cameraStep/cameraCapture/utils/index.js +107 -0
  154. package/build/legacy/step/cameraStep/index.js +1 -0
  155. package/build/legacy/step/externalConfirmationStep/ExternalConfirmationStep.js +64 -0
  156. package/build/legacy/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +23 -0
  157. package/build/legacy/step/externalConfirmationStep/index.js +1 -0
  158. package/build/legacy/step/index.js +3 -0
  159. package/build/legacy/step/layoutStep/LayoutStep.js +33 -0
  160. package/build/legacy/step/layoutStep/index.js +1 -0
  161. package/build/legacy/step/layoutStep/utils/index.js +2 -0
  162. package/build/legacy/step/layoutStep/utils/inline-reference-utils.js +105 -0
  163. package/build/legacy/step/layoutStep/utils/layout-utils.js +212 -0
  164. package/build/main.js +13 -28
  165. package/build/main.min.js +1 -1
  166. package/build/main.mjs +13 -28
  167. package/build/types/revamp/domain/features/events.d.ts +1 -1
  168. package/package.json +2 -2
package/build/main.mjs CHANGED
@@ -13973,13 +13973,13 @@ function DynamicFlowCore(props) {
13973
13973
  return abortControllerRef.current.signal;
13974
13974
  };
13975
13975
  useEffect23(() => {
13976
- trackEvent("Flow Started");
13976
+ trackEvent("Initiated");
13977
13977
  if (!initialStep && initialAction) {
13978
13978
  void onAction(initialAction);
13979
13979
  }
13980
13980
  if (initialStep && !initialAction) {
13981
13981
  initialiseWithStep(initialStep, null);
13982
- trackEvent("Step Shown");
13982
+ trackEvent("Step Shown", { isFirstStep: true });
13983
13983
  }
13984
13984
  }, []);
13985
13985
  const initialiseWithStep = useCallback11(
@@ -14051,14 +14051,14 @@ function DynamicFlowCore(props) {
14051
14051
  );
14052
14052
  const closeWithError = useCallback11(
14053
14053
  (error, analytics) => {
14054
- trackEvent("Flow Failed", __spreadValues({}, analytics));
14054
+ trackEvent("Failed", __spreadValues({}, analytics));
14055
14055
  onError(error);
14056
14056
  },
14057
14057
  // eslint-disable-next-line react-hooks/exhaustive-deps
14058
14058
  []
14059
14059
  );
14060
14060
  const onAction = useCallback11(async (action) => {
14061
- var _a2, _b, _c, _d, _e;
14061
+ var _a2, _b, _c, _d;
14062
14062
  try {
14063
14063
  (_a2 = stepComponentRef.current) == null ? void 0 : _a2.setLoadingState("loading");
14064
14064
  const model = (_c = await ((_b = stepComponentRef.current) == null ? void 0 : _b.getSubmittableValue())) != null ? _c : null;
@@ -14073,12 +14073,13 @@ function DynamicFlowCore(props) {
14073
14073
  switch (command.type) {
14074
14074
  case "complete": {
14075
14075
  onCompletion(command.result);
14076
- trackEvent("Flow Succeeded");
14076
+ trackEvent("Succeeded");
14077
14077
  break;
14078
14078
  }
14079
14079
  case "replace-step": {
14080
+ const isFirstStep = stepRef.current === null;
14080
14081
  initialiseWithStep(command.step, command.etag);
14081
- trackEvent("Step Shown");
14082
+ trackEvent("Step Shown", { isFirstStep });
14082
14083
  break;
14083
14084
  }
14084
14085
  case "error": {
@@ -14093,26 +14094,7 @@ function DynamicFlowCore(props) {
14093
14094
  }
14094
14095
  case "refresh": {
14095
14096
  const { refreshUrl, errors = {} } = command.body;
14096
- try {
14097
- (_e = stepComponentRef.current) == null ? void 0 : _e.setLoadingState("loading");
14098
- const refreshCommand = await executeRefresh({
14099
- abortSignal: abortCurrentAndGetNewAbortSignal(),
14100
- url: refreshUrl,
14101
- model,
14102
- etag: etagRef.current,
14103
- httpClient,
14104
- trackEvent
14105
- });
14106
- switch (refreshCommand.type) {
14107
- case "refresh-step":
14108
- initialiseWithStep(__spreadProps(__spreadValues({}, refreshCommand.step), { errors }), refreshCommand.etag);
14109
- break;
14110
- default:
14111
- throw new Error("Failed to refresh");
14112
- }
14113
- } catch (e) {
14114
- closeWithError(e, {});
14115
- }
14097
+ void onRefresh(void 0, refreshUrl, errors);
14116
14098
  break;
14117
14099
  }
14118
14100
  }
@@ -14121,7 +14103,7 @@ function DynamicFlowCore(props) {
14121
14103
  }
14122
14104
  }, []);
14123
14105
  const onRefresh = useCallback11(
14124
- async (schemaId, refreshUrl = "") => {
14106
+ async (schemaId, refreshUrl = "", errorsOverride) => {
14125
14107
  var _a2, _b, _c, _d;
14126
14108
  try {
14127
14109
  (_a2 = stepComponentRef.current) == null ? void 0 : _a2.setLoadingState("loading");
@@ -14137,7 +14119,10 @@ function DynamicFlowCore(props) {
14137
14119
  });
14138
14120
  switch (command.type) {
14139
14121
  case "refresh-step":
14140
- initialiseWithStep(command.step, command.etag);
14122
+ {
14123
+ const errors = errorsOverride != null ? errorsOverride : command.step.errors;
14124
+ initialiseWithStep(__spreadProps(__spreadValues({}, command.step), { errors }), command.etag);
14125
+ }
14141
14126
  break;
14142
14127
  case "error": {
14143
14128
  closeWithError(new Error("Failed to refresh"), command.body.analytics);
@@ -1,6 +1,6 @@
1
1
  export type AnalyticsEventHandler = (eventName: string, properties?: Record<string, unknown>) => void;
2
2
  export type AnalyticsEventDispatcher = (eventName: EventName, properties?: Record<string, unknown>) => void;
3
- export type EventName = 'Flow Started' | 'Flow Succeeded' | 'Flow Failed' | 'Step Shown' | 'Action Triggered' | 'Action Succeeded' | 'Action Aborted' | 'Action Failed' | 'Refresh Triggered' | 'Refresh Succeeded' | 'Refresh Aborted' | 'Refresh Failed' | 'OneOf Selected' | 'PersistAsync Triggered' | 'PersistAsync Succeeded' | 'PersistAsync Failed' | 'ValidationAsync Triggered' | 'ValidationAsync Succeeded' | 'ValidationAsync Failed' | 'Search Started' | 'Search Result Selected';
3
+ export type EventName = 'Initiated' | 'Succeeded' | 'Failed' | 'Step Shown' | 'Action Triggered' | 'Action Succeeded' | 'Action Aborted' | 'Action Failed' | 'Refresh Triggered' | 'Refresh Succeeded' | 'Refresh Aborted' | 'Refresh Failed' | 'OneOf Selected' | 'PersistAsync Triggered' | 'PersistAsync Succeeded' | 'PersistAsync Failed' | 'ValidationAsync Triggered' | 'ValidationAsync Succeeded' | 'ValidationAsync Failed' | 'Search Started' | 'Search Result Selected';
4
4
  export type LogLevel = 'info' | 'warning' | 'error';
5
5
  export type LoggingEventHandler = (level: LogLevel, message: string, extra: Record<string, unknown>) => void;
6
6
  export type LoggingEventDispatcher = (level: LogLevel, message: string, extra?: Record<string, unknown>) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "3.3.2",
3
+ "version": "3.4.0-experimental-ed080a1",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",
@@ -92,7 +92,7 @@
92
92
  "classnames": "2.5.1",
93
93
  "react-webcam": "^7.2.0",
94
94
  "screenfull": "^5.2.0",
95
- "@wise/dynamic-flow-types": "2.10.0"
95
+ "@wise/dynamic-flow-types": "2.11.0-experimental-ed080a1"
96
96
  },
97
97
  "scripts": {
98
98
  "dev": "storybook dev -p 3003",