@wise/dynamic-flow-client 3.12.0-experimental-kyc-camera-fae600d → 3.12.0-experimental-kyc-camera-ebd94d5

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 (160) hide show
  1. package/build/common/cameraCapture/CameraCapture.spec.js +16 -3
  2. package/build/common/cameraCapture/CameraEventHandler.js +1 -0
  3. package/build/legacy/dynamicFlow/DynamicFlow.js +21 -5
  4. package/build/legacy/dynamicFlow/tests/DynamicFlow.InitialAction.spec.js +16 -3
  5. package/build/legacy/dynamicFlow/tests/DynamicFlow.InitialStep.spec.js +20 -5
  6. package/build/legacy/dynamicFlow/tests/DynamicFlow.LoaderConfig.spec.js +16 -3
  7. package/build/legacy/dynamicFlow/tests/DynamicFlow.legacy.spec.js +1 -1
  8. package/build/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.spec.js +4 -4
  9. package/build/legacy/layout/search/useSearch.js +19 -6
  10. package/build/main.js +321 -95
  11. package/build/main.min.js +1 -1
  12. package/build/main.mjs +321 -95
  13. package/build/revamp/domain/components/DateInputComponent.js +1 -1
  14. package/build/revamp/domain/components/IntegerInputComponent.js +1 -1
  15. package/build/revamp/domain/components/MultiUploadInputComponent.js +6 -6
  16. package/build/revamp/domain/components/NumberInputComponent.js +1 -1
  17. package/build/revamp/domain/components/SelectInputComponent.js +2 -2
  18. package/build/revamp/domain/components/TextInputComponent.js +1 -1
  19. package/build/revamp/domain/components/searchComponent/SearchComponent.js +1 -1
  20. package/build/revamp/domain/components/utils/isPartialLocalValueMatch.js +12 -7
  21. package/build/revamp/domain/components/utils/isPartialLocalValueMatch.spec.js +21 -15
  22. package/build/revamp/domain/components/utils/local-value.js +4 -1
  23. package/build/revamp/domain/features/persistAsync/getComponentPersistAsync.spec.js +10 -10
  24. package/build/revamp/domain/features/persistAsync/getPerformPersistAsync.js +8 -8
  25. package/build/revamp/domain/features/search/getPerformSearchFunction.js +30 -32
  26. package/build/revamp/domain/features/validationAsync/getComponentValidationAsync.spec.js +10 -10
  27. package/build/revamp/domain/features/validationAsync/getPerformValidationAsync.js +9 -9
  28. package/build/revamp/domain/mappers/schema/objectSchemaToComponent/objectSchemaToComponent.js +23 -4
  29. package/build/revamp/stories/dev-tools/EditableStep.story.js +3 -1
  30. package/build/revamp/stories/examples/KYCCameraStep.story.js +1 -0
  31. package/build/revamp/tests/InitialStep.spec.js +122 -0
  32. package/build/revamp/tests/OneOfInitialisation.spec.js +13 -0
  33. package/build/revamp/tests/legacy/RefreshStepOnChange.spec.js +20 -5
  34. package/build/revamp/useDynamicFlowCore.js +16 -3
  35. package/build/revamp/wise/renderers/components/VariableDateInput.js +8 -2
  36. package/build/types/common/cameraCapture/CameraCapture.d.ts +3 -4
  37. package/build/types/common/cameraCapture/CameraEventHandler.d.ts +2 -0
  38. package/build/types/common/cameraCapture/components/bottomBar/BottomBar.d.ts +2 -2
  39. package/build/types/common/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.d.ts +1 -1
  40. package/build/types/common/cameraCapture/hooks/useFullScreenOrientationLock.d.ts +1 -1
  41. package/build/types/common/cameraCapture/index.d.ts +1 -0
  42. package/build/types/common/cameraCapture/overlay/Overlay.d.ts +1 -1
  43. package/build/types/common/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.d.ts +1 -1
  44. package/build/types/common/cameraCapture/tracking/index.d.ts +1 -1
  45. package/build/types/common/errorBoundary/ErrorBoundary.d.ts +1 -1
  46. package/build/types/common/errorBoundary/ErrorBoundaryAlert.d.ts +1 -1
  47. package/build/types/common/httpClientContext/HttpClientContext.d.ts +2 -2
  48. package/build/types/index.d.ts +1 -0
  49. package/build/types/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.d.ts +1 -1
  50. package/build/types/legacy/common/contexts/eventsContext/EventsContext.d.ts +1 -1
  51. package/build/types/legacy/common/contexts/featureContext/FeatureContext.d.ts +1 -1
  52. package/build/types/legacy/common/contexts/logContext/LogContext.d.ts +1 -1
  53. package/build/types/legacy/dynamic-flow-types.d.ts +1 -1
  54. package/build/types/legacy/dynamicFlow/BackButton.d.ts +1 -1
  55. package/build/types/legacy/dynamicFlow/DynamicFlow.d.ts +1 -1
  56. package/build/types/legacy/dynamicFlow/DynamicFlowStep.d.ts +1 -1
  57. package/build/types/legacy/dynamicFlow/utils/useLoader.d.ts +1 -1
  58. package/build/types/legacy/formControl/FormControl.d.ts +1 -1
  59. package/build/types/legacy/jsonSchemaForm/JsonSchemaForm.d.ts +1 -1
  60. package/build/types/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.d.ts +1 -1
  61. package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.d.ts +1 -1
  62. package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +1 -1
  63. package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.d.ts +1 -1
  64. package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +1 -1
  65. package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.d.ts +1 -1
  66. package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.d.ts +1 -1
  67. package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.d.ts +1 -1
  68. package/build/types/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.d.ts +1 -1
  69. package/build/types/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.d.ts +1 -1
  70. package/build/types/legacy/jsonSchemaForm/genericSchema/GenericSchema.d.ts +1 -1
  71. package/build/types/legacy/jsonSchemaForm/help/Help.d.ts +1 -1
  72. package/build/types/legacy/jsonSchemaForm/objectSchema/ObjectSchema.d.ts +1 -1
  73. package/build/types/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.d.ts +1 -1
  74. package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.d.ts +1 -1
  75. package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.d.ts +1 -1
  76. package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.d.ts +1 -1
  77. package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.d.ts +1 -1
  78. package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.d.ts +1 -1
  79. package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.d.ts +1 -1
  80. package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.d.ts +1 -1
  81. package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.d.ts +1 -1
  82. package/build/types/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.d.ts +1 -1
  83. package/build/types/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.d.ts +1 -1
  84. package/build/types/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.d.ts +5 -5
  85. package/build/types/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.d.ts +1 -1
  86. package/build/types/legacy/layout/DynamicLayout.d.ts +1 -1
  87. package/build/types/legacy/layout/alert/DynamicAlert.d.ts +1 -1
  88. package/build/types/legacy/layout/box/DynamicBox.d.ts +1 -1
  89. package/build/types/legacy/layout/button/DynamicButton.d.ts +1 -1
  90. package/build/types/legacy/layout/columns/DynamicColumns.d.ts +1 -1
  91. package/build/types/legacy/layout/decision/DynamicDecision.d.ts +1 -1
  92. package/build/types/legacy/layout/divider/DynamicDivider.d.ts +1 -1
  93. package/build/types/legacy/layout/external/DynamicExternal.d.ts +1 -1
  94. package/build/types/legacy/layout/form/DynamicForm.d.ts +1 -1
  95. package/build/types/legacy/layout/heading/DynamicHeading.d.ts +1 -1
  96. package/build/types/legacy/layout/icon/DynamicIcon.d.ts +1 -1
  97. package/build/types/legacy/layout/icon/FlagIcon.d.ts +1 -1
  98. package/build/types/legacy/layout/icon/NamedIcon.d.ts +1 -1
  99. package/build/types/legacy/layout/image/DynamicImage.d.ts +1 -1
  100. package/build/types/legacy/layout/instructions/DynamicInstructions.d.ts +1 -1
  101. package/build/types/legacy/layout/list/DynamicStatusList.d.ts +1 -1
  102. package/build/types/legacy/layout/loadingIndicator/DynamicLoadingIndicator.d.ts +1 -1
  103. package/build/types/legacy/layout/markdown/DynamicMarkdown.d.ts +2 -2
  104. package/build/types/legacy/layout/modal/DynamicModal.d.ts +1 -1
  105. package/build/types/legacy/layout/paragraph/DynamicParagraph.d.ts +1 -1
  106. package/build/types/legacy/layout/review/DynamicReview.d.ts +1 -1
  107. package/build/types/legacy/layout/search/DynamicSearch.d.ts +1 -1
  108. package/build/types/legacy/layout/search/SearchInput.d.ts +1 -1
  109. package/build/types/legacy/layout/search/SearchResults.d.ts +2 -2
  110. package/build/types/legacy/layout/utils/getNavigationOptionMedia.d.ts +3 -3
  111. package/build/types/legacy/step/cameraStep/CameraStep.d.ts +1 -1
  112. package/build/types/legacy/step/externalConfirmationStep/ExternalConfirmationStep.d.ts +1 -1
  113. package/build/types/legacy/step/layoutStep/LayoutStep.d.ts +1 -1
  114. package/build/types/legacy/test-utils/DynamicFlowProviders.d.ts +1 -1
  115. package/build/types/legacy/test-utils/legacy-utils.d.ts +1 -1
  116. package/build/types/revamp/DynamicFlowCore.d.ts +1 -1
  117. package/build/types/revamp/DynamicFlowWise.d.ts +1 -1
  118. package/build/types/revamp/domain/components/AllOfComponent.d.ts +2 -2
  119. package/build/types/revamp/domain/components/BooleanInputComponent.d.ts +1 -1
  120. package/build/types/revamp/domain/components/ConstComponent.d.ts +1 -1
  121. package/build/types/revamp/domain/components/DateInputComponent.d.ts +1 -1
  122. package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +1 -1
  123. package/build/types/revamp/domain/components/MultiSelectInputComponent.d.ts +1 -1
  124. package/build/types/revamp/domain/components/MultiUploadInputComponent.d.ts +1 -1
  125. package/build/types/revamp/domain/components/NumberInputComponent.d.ts +1 -1
  126. package/build/types/revamp/domain/components/ObjectComponent.d.ts +2 -2
  127. package/build/types/revamp/domain/components/SelectInputComponent.d.ts +1 -1
  128. package/build/types/revamp/domain/components/StepDomainComponent.d.ts +2 -2
  129. package/build/types/revamp/domain/components/TextInputComponent.d.ts +1 -1
  130. package/build/types/revamp/domain/components/UploadInputComponent.d.ts +1 -1
  131. package/build/types/revamp/domain/components/repeatableComponent/RepeatableComponent.d.ts +3 -3
  132. package/build/types/revamp/domain/components/utils/isPartialLocalValueMatch.d.ts +1 -1
  133. package/build/types/revamp/domain/features/persistAsync/getPerformPersistAsync.d.ts +1 -1
  134. package/build/types/revamp/domain/features/validationAsync/getPerformValidationAsync.d.ts +1 -1
  135. package/build/types/revamp/flow/executeRefresh.d.ts +1 -1
  136. package/build/types/revamp/renderers/mappers/componentToRendererProps.d.ts +3 -3
  137. package/build/types/revamp/wise/renderers/MultiSelectInputRenderer.d.ts +1 -1
  138. package/build/types/revamp/wise/renderers/SearchRenderer/BlockSearchRendererComponent.d.ts +2 -2
  139. package/build/types/revamp/wise/renderers/SearchRenderer/ErrorResult.d.ts +1 -1
  140. package/build/types/revamp/wise/renderers/SearchRenderer/InlineSearchRendererComponent.d.ts +1 -1
  141. package/build/types/revamp/wise/renderers/SelectInputRenderer/OptionMedia.d.ts +1 -1
  142. package/build/types/revamp/wise/renderers/SelectInputRenderer/RadioInputRendererComponent.d.ts +1 -1
  143. package/build/types/revamp/wise/renderers/SelectInputRenderer/SegmentedInputRendererComponent.d.ts +1 -1
  144. package/build/types/revamp/wise/renderers/SelectInputRenderer/SelectInputRendererComponent.d.ts +1 -1
  145. package/build/types/revamp/wise/renderers/SelectInputRenderer/SelectTriggerMedia.d.ts +1 -1
  146. package/build/types/revamp/wise/renderers/SelectInputRenderer/TabInputRendererComponent.d.ts +1 -1
  147. package/build/types/revamp/wise/renderers/components/FieldInput.d.ts +1 -1
  148. package/build/types/revamp/wise/renderers/components/Help.d.ts +1 -1
  149. package/build/types/revamp/wise/renderers/components/LabelContentWithHelp.d.ts +1 -1
  150. package/build/types/revamp/wise/renderers/components/UploadFieldInput.d.ts +1 -1
  151. package/build/types/revamp/wise/renderers/components/VariableDateInput.d.ts +1 -1
  152. package/build/types/revamp/wise/renderers/components/VariableTextInput.d.ts +1 -1
  153. package/build/types/revamp/wise/renderers/components/icon/DynamicIcon.d.ts +1 -1
  154. package/build/types/revamp/wise/renderers/components/icon/FlagIcon.d.ts +1 -1
  155. package/build/types/revamp/wise/renderers/components/icon/NamedIcon.d.ts +1 -1
  156. package/build/types/revamp/wise/renderers/components/icon/NavigationOptionMedia.d.ts +1 -1
  157. package/build/types/revamp/wise/renderers/step/BackButton.d.ts +1 -1
  158. package/build/types/revamp/wise/renderers/step/ExternalConfirmationDialog.d.ts +1 -1
  159. package/build/types/test-utils/NeptuneProviders.d.ts +1 -1
  160. package/package.json +30 -31
@@ -45,6 +45,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
+ if (ar || !(i in from)) {
51
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
+ ar[i] = from[i];
53
+ }
54
+ }
55
+ return to.concat(ar || Array.prototype.slice.call(from));
56
+ };
48
57
  import { jsx as _jsx } from "react/jsx-runtime";
49
58
  /* eslint-disable testing-library/no-node-access */
50
59
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
@@ -124,11 +133,15 @@ var schemas = [
124
133
  describe.each(schemas)('Given a component for rendering a camera capture experience', function (schema) {
125
134
  var onCapture;
126
135
  var unmount;
127
- var renderComponent = function (customProps) {
128
- if (customProps === void 0) { customProps = {}; }
129
- return __awaiter(void 0, void 0, void 0, function () {
136
+ var renderComponent = function () {
137
+ var args_1 = [];
138
+ for (var _i = 0; _i < arguments.length; _i++) {
139
+ args_1[_i] = arguments[_i];
140
+ }
141
+ return __awaiter(void 0, __spreadArray([], args_1, true), void 0, function (customProps) {
130
142
  var view;
131
143
  var _a, _b, _c, _d, _e, _f, _g;
144
+ if (customProps === void 0) { customProps = {}; }
132
145
  return __generator(this, function (_h) {
133
146
  switch (_h.label) {
134
147
  case 0:
@@ -0,0 +1 @@
1
+ export {};
@@ -45,8 +45,18 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
+ if (ar || !(i in from)) {
51
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
+ ar[i] = from[i];
53
+ }
54
+ }
55
+ return to.concat(ar || Array.prototype.slice.call(from));
56
+ };
48
57
  import { jsx as _jsx } from "react/jsx-runtime";
49
58
  import { useCallback, useEffect, useMemo, useState } from 'react';
59
+ import { useIntl } from 'react-intl';
50
60
  import { DynamicFlowProvider, getEventDispatcher, EventsContextProvider, LogProvider, getLogger, } from '../common/contexts';
51
61
  import { FeatureContextProvider } from '../common/contexts/featureContext/FeatureContext';
52
62
  import { isObjectModel } from '../common/utils';
@@ -71,6 +81,7 @@ var DynamicFlowComponent = function (_a) {
71
81
  var flowId = _a.flowId, httpClient = _a.httpClient, initialAction = _a.initialAction, initialStep = _a.initialStep, loaderConfig = _a.loaderConfig, _b = _a.displayStepTitle, displayStepTitle = _b === void 0 ? true : _b, features = _a.features, onCompletion = _a.onCompletion, onError = _a.onError, _c = _a.onEvent, onEvent = _c === void 0 ? noop : _c, _d = _a.onLog, onLog = _d === void 0 ? noop : _d;
72
82
  var _e = useDynamicFlowState(initialStep), formErrors = _e.formErrors, globalError = _e.globalError, step = _e.step, models = _e.models, etag = _e.etag, modelIsValid = _e.modelIsValid, setFormErrors = _e.setFormErrors, setGlobalError = _e.setGlobalError, setStepAndEtag = _e.setStepAndEtag, setSchemaModel = _e.setSchemaModel;
73
83
  var _f = useState(false), submitted = _f[0], setSubmitted = _f[1];
84
+ var locale = useIntl().locale;
74
85
  var _g = useLoader(loaderConfig, initialStep ? 'idle' : 'initial'), isLoading = _g.isLoading, loader = _g.loader, setLoadingState = _g.setLoadingState;
75
86
  var logCritical = getLogger('critical', onLog, flowId, (step === null || step === void 0 ? void 0 : step.id) || (step === null || step === void 0 ? void 0 : step.key));
76
87
  var logWarning = getLogger('warning', onLog, flowId, (step === null || step === void 0 ? void 0 : step.id) || (step === null || step === void 0 ? void 0 : step.key));
@@ -88,14 +99,19 @@ var DynamicFlowComponent = function (_a) {
88
99
  var url = action.url, _b = action.method, method = _b === void 0 ? 'POST' : _b;
89
100
  return httpClient(url !== null && url !== void 0 ? url : '', {
90
101
  method: method,
91
- headers: __assign({ 'Content-Type': 'application/json' }, (etag ? { 'If-None-Match': etag } : {})),
102
+ credentials: 'include',
103
+ headers: __assign({ 'Content-Type': 'application/json', 'accept-language': locale }, (etag ? { 'If-None-Match': etag } : {})),
92
104
  body: method === 'GET' ? undefined : JSON.stringify(data),
93
105
  });
94
- }, [httpClient]);
95
- var performAction = function (action, data) {
96
- if (data === void 0) { data = {}; }
97
- return __awaiter(void 0, void 0, void 0, function () {
106
+ }, [httpClient, locale]);
107
+ var performAction = function (action_1) {
108
+ var args_1 = [];
109
+ for (var _i = 1; _i < arguments.length; _i++) {
110
+ args_1[_i - 1] = arguments[_i];
111
+ }
112
+ return __awaiter(void 0, __spreadArray([action_1], args_1, true), void 0, function (action, data) {
98
113
  var response, error_1;
114
+ if (data === void 0) { data = {}; }
99
115
  return __generator(this, function (_a) {
100
116
  switch (_a.label) {
101
117
  case 0:
@@ -45,6 +45,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
+ if (ar || !(i in from)) {
51
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
+ ar[i] = from[i];
53
+ }
54
+ }
55
+ return to.concat(ar || Array.prototype.slice.call(from));
56
+ };
48
57
  import { jsx as _jsx } from "react/jsx-runtime";
49
58
  import '@testing-library/jest-dom';
50
59
  import { render, screen, waitFor, fireEvent } from '@testing-library/react';
@@ -116,9 +125,13 @@ var getFormStep = function (_a) {
116
125
  model: model || { accountNumber: '1234567890' },
117
126
  });
118
127
  };
119
- var getMockJsonResponse = function (response, init) {
120
- if (init === void 0) { init = {}; }
121
- return __awaiter(void 0, void 0, void 0, function () {
128
+ var getMockJsonResponse = function (response_1) {
129
+ var args_1 = [];
130
+ for (var _i = 1; _i < arguments.length; _i++) {
131
+ args_1[_i - 1] = arguments[_i];
132
+ }
133
+ return __awaiter(void 0, __spreadArray([response_1], args_1, true), void 0, function (response, init) {
134
+ if (init === void 0) { init = {}; }
122
135
  return __generator(this, function (_a) {
123
136
  return [2 /*return*/, new Response(JSON.stringify(response), init)];
124
137
  });
@@ -56,6 +56,15 @@ var __rest = (this && this.__rest) || function (s, e) {
56
56
  }
57
57
  return t;
58
58
  };
59
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
60
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
61
+ if (ar || !(i in from)) {
62
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
63
+ ar[i] = from[i];
64
+ }
65
+ }
66
+ return to.concat(ar || Array.prototype.slice.call(from));
67
+ };
59
68
  import { jsx as _jsx } from "react/jsx-runtime";
60
69
  import '@testing-library/jest-dom';
61
70
  import { render, screen, waitFor, act, fireEvent } from '@testing-library/react';
@@ -126,11 +135,17 @@ var getFormStep = function (_a) {
126
135
  },
127
136
  ], model: model || { accountNumber: '1234567890' } }), rest);
128
137
  };
129
- var getMockJsonResponse = function (response, init) {
130
- if (init === void 0) { init = {}; }
131
- return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
132
- return [2 /*return*/, new Response(JSON.stringify(response), init)];
133
- }); });
138
+ var getMockJsonResponse = function (response_1) {
139
+ var args_1 = [];
140
+ for (var _i = 1; _i < arguments.length; _i++) {
141
+ args_1[_i - 1] = arguments[_i];
142
+ }
143
+ return __awaiter(void 0, __spreadArray([response_1], args_1, true), void 0, function (response, init) {
144
+ if (init === void 0) { init = {}; }
145
+ return __generator(this, function (_a) {
146
+ return [2 /*return*/, new Response(JSON.stringify(response), init)];
147
+ });
148
+ });
134
149
  };
135
150
  var mockHttpClient = jest.fn(function () { return getMockJsonResponse(getFormStep()); });
136
151
  var i18n = { locale: 'en-GB', messages: __assign({}, componentTranslations.en) };
@@ -45,6 +45,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
+ if (ar || !(i in from)) {
51
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
+ ar[i] = from[i];
53
+ }
54
+ }
55
+ return to.concat(ar || Array.prototype.slice.call(from));
56
+ };
48
57
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
49
58
  import '@testing-library/jest-dom';
50
59
  import { render, screen, waitFor } from '@testing-library/react';
@@ -78,9 +87,13 @@ var getFormStep = function (_a) {
78
87
  },
79
88
  ], model: model || { accountNumber: '1234567890' } }));
80
89
  };
81
- var getMockJsonResponse = function (response, init) {
82
- if (init === void 0) { init = {}; }
83
- return __awaiter(void 0, void 0, void 0, function () {
90
+ var getMockJsonResponse = function (response_1) {
91
+ var args_1 = [];
92
+ for (var _i = 1; _i < arguments.length; _i++) {
93
+ args_1[_i - 1] = arguments[_i];
94
+ }
95
+ return __awaiter(void 0, __spreadArray([response_1], args_1, true), void 0, function (response, init) {
96
+ if (init === void 0) { init = {}; }
84
97
  return __generator(this, function (_a) {
85
98
  return [2 /*return*/, new Response(JSON.stringify(response), init)];
86
99
  });
@@ -140,7 +140,7 @@ describe('Given a component for rendering a dynamic flow', function () {
140
140
  var newStep = { type: 'form', layout: newLayout, model: { newModel: 123 } };
141
141
  var formStep = {
142
142
  type: 'form',
143
- id: 'create-thing',
143
+ id: 'create-thing', // For tracking
144
144
  layout: [
145
145
  {
146
146
  type: 'form',
@@ -88,8 +88,8 @@ describe('mapConstSchemaToOption', function () {
88
88
  describe('when the title and description are longer than 50 characters', function () {
89
89
  it('maps "description" to the "secondary" property', function () {
90
90
  var mapped = mapConstSchemaToOption({
91
- title: 'Some Very Long Title',
92
- description: 'The description here is even longer.',
91
+ title: 'Some Very Long Title', // 20 chars
92
+ description: 'The description here is even longer.', // 36 chars
93
93
  const: 'option-2',
94
94
  }, 'select');
95
95
  expect(mapped).toMatchObject({
@@ -102,8 +102,8 @@ describe('mapConstSchemaToOption', function () {
102
102
  describe('when the title and description are 50 characters or less', function () {
103
103
  it('maps "description" to the "note" property', function () {
104
104
  var mapped = mapConstSchemaToOption({
105
- title: "Title's 16 chars",
106
- description: 'This description is not too short.',
105
+ title: "Title's 16 chars", // 16 chars
106
+ description: 'This description is not too short.', // 34 chars
107
107
  const: 'option-1',
108
108
  }, 'select');
109
109
  expect(mapped).toMatchObject({
@@ -34,6 +34,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
34
34
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
35
  }
36
36
  };
37
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
38
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
39
+ if (ar || !(i in from)) {
40
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
41
+ ar[i] = from[i];
42
+ }
43
+ }
44
+ return to.concat(ar || Array.prototype.slice.call(from));
45
+ };
37
46
  import { useCallback, useRef, useState } from 'react';
38
47
  import { isArray, isObject } from '../../common/validators';
39
48
  import { useHttpClient } from '../../../common/httpClientContext';
@@ -44,16 +53,20 @@ export var useSearch = function (defaultSearchConfig) {
44
53
  }), state = _a[0], setState = _a[1];
45
54
  var abortControllerRef = useRef(null);
46
55
  var httpClient = useHttpClient();
47
- var search = useCallback(function (query, _a) {
48
- var _b = _a === void 0 ? defaultSearchConfig : _a, url = _b.url, method = _b.method, param = _b.param;
49
- return __awaiter(void 0, void 0, void 0, function () {
56
+ var search = useCallback(function (query_1) {
57
+ var args_1 = [];
58
+ for (var _i = 1; _i < arguments.length; _i++) {
59
+ args_1[_i - 1] = arguments[_i];
60
+ }
61
+ return __awaiter(void 0, __spreadArray([query_1], args_1, true), void 0, function (query, _a) {
50
62
  var signal, request, response, error_1;
63
+ var _b;
51
64
  var _c;
52
- var _d;
65
+ var _d = _a === void 0 ? defaultSearchConfig : _a, url = _d.url, method = _d.method, param = _d.param;
53
66
  return __generator(this, function (_e) {
54
67
  switch (_e.label) {
55
68
  case 0:
56
- (_d = abortControllerRef.current) === null || _d === void 0 ? void 0 : _d.abort();
69
+ (_c = abortControllerRef.current) === null || _c === void 0 ? void 0 : _c.abort();
57
70
  if (!query) {
58
71
  setState({ status: 'idle' });
59
72
  return [2 /*return*/];
@@ -74,7 +87,7 @@ export var useSearch = function (defaultSearchConfig) {
74
87
  method: method,
75
88
  signal: signal,
76
89
  headers: headers,
77
- body: JSON.stringify((_c = {}, _c[param] = query, _c)),
90
+ body: JSON.stringify((_b = {}, _b[param] = query, _b)),
78
91
  });
79
92
  return [4 /*yield*/, request];
80
93
  case 2: