@wise/dynamic-flow-client 3.4.0 → 3.5.0-experimental-6654c72
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/common/errorBoundary/ErrorBoundary.js +44 -0
- package/build/common/errorBoundary/ErrorBoundaryAlert.js +12 -0
- package/build/common/httpClientContext/HttpClientContext.js +35 -0
- package/build/common/httpClientContext/index.js +1 -0
- package/build/common/makeHttpClient/index.js +1 -0
- package/build/common/makeHttpClient/makeHttpClient.js +34 -0
- package/build/common/messages/external-confirmation.messages.js +23 -0
- package/build/common/messages/generic-error.messages.js +18 -0
- package/build/common/messages/help.messages.js +8 -0
- package/build/common/messages/multi-file-upload.messages.js +18 -0
- package/build/common/messages/multi-select.messages.js +8 -0
- package/build/common/messages/paragraph.messages.js +13 -0
- package/build/common/messages/repeatable.messages.js +23 -0
- package/build/common/messages/validation.array.messages.js +13 -0
- package/build/common/messages/validation.messages.js +53 -0
- package/build/common/utils/api-utils.js +4 -0
- package/build/i18n/de.json +2 -1
- package/build/i18n/es.json +1 -0
- package/build/i18n/fr.json +1 -0
- package/build/i18n/hu.json +1 -0
- package/build/i18n/id.json +1 -0
- package/build/i18n/index.js +36 -0
- package/build/i18n/it.json +1 -0
- package/build/i18n/ja.json +1 -0
- package/build/i18n/pl.json +1 -0
- package/build/i18n/pt.json +1 -0
- package/build/i18n/ro.json +1 -0
- package/build/i18n/ru.json +1 -0
- package/build/i18n/th.json +1 -0
- package/build/i18n/tr.json +1 -0
- package/build/i18n/zh_CN.json +1 -0
- package/build/i18n/zh_HK.json +1 -0
- package/build/legacy/common/constants/DateMode.js +4 -0
- package/build/legacy/common/constants/FeatureName.js +4 -0
- package/build/legacy/common/constants/FormControlType.js +21 -0
- package/build/legacy/common/constants/MonthFormat.js +4 -0
- package/build/legacy/common/constants/Size.js +7 -0
- package/build/legacy/common/constants/index.js +4 -0
- package/build/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +36 -0
- package/build/legacy/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +13 -0
- package/build/legacy/common/contexts/eventsContext/EventsContext.js +38 -0
- package/build/legacy/common/contexts/featureContext/FeatureContext.js +22 -0
- package/build/legacy/common/contexts/index.js +3 -0
- package/build/legacy/common/contexts/logContext/LogContext.js +44 -0
- package/build/legacy/common/hooks/index.js +7 -0
- package/build/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.js +9 -0
- package/build/legacy/common/hooks/useExternal/useExternal.js +15 -0
- package/build/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.js +70 -0
- package/build/legacy/common/hooks/usePersistAsync/usePersistAsync.js +172 -0
- package/build/legacy/common/hooks/usePolling/usePolling.js +51 -0
- package/build/legacy/common/hooks/usePrevious/usePrevious.js +8 -0
- package/build/legacy/common/hooks/useStepPolling/useStepPolling.js +43 -0
- package/build/legacy/common/messages.js +8 -0
- package/build/legacy/common/utils/api-utils.js +6 -0
- package/build/legacy/common/utils/date-utils.js +22 -0
- package/build/legacy/common/utils/debounce.js +38 -0
- package/build/legacy/common/utils/file-utils.js +45 -0
- package/build/legacy/common/utils/id-utils.js +5 -0
- package/build/legacy/common/utils/index.js +11 -0
- package/build/legacy/common/utils/is-equal.js +21 -0
- package/build/legacy/common/utils/misc-utils.js +4 -0
- package/build/legacy/common/utils/mobile-utils.js +23 -0
- package/build/legacy/common/utils/model-utils.js +33 -0
- package/build/legacy/common/utils/schema-utils.js +113 -0
- package/build/legacy/common/utils/step-utils.js +32 -0
- package/build/legacy/common/validators/index.js +5 -0
- package/build/legacy/common/validators/models/model-utils.js +119 -0
- package/build/legacy/common/validators/models/model-validators.js +62 -0
- package/build/legacy/common/validators/schemas/schema-validators.js +101 -0
- package/build/legacy/common/validators/types/type-validators.js +14 -0
- package/build/legacy/common/validators/validationFailures/validation-failures.js +139 -0
- package/build/legacy/common/validators/validationFailures/validation-failures.utils.js +40 -0
- package/build/legacy/common/validators/values/value-validators.js +6 -0
- package/build/legacy/dynamic-flow-types.js +1 -0
- package/build/legacy/dynamicFlow/BackButton.js +22 -0
- package/build/legacy/dynamicFlow/DynamicFlow.js +346 -0
- package/build/legacy/dynamicFlow/DynamicFlowStep.js +37 -0
- package/build/legacy/dynamicFlow/DynamicFlowTypes.js +1 -0
- package/build/legacy/dynamicFlow/index.js +1 -0
- package/build/legacy/dynamicFlow/utils/index.js +5 -0
- package/build/legacy/dynamicFlow/utils/responseParsers/response-parsers.js +185 -0
- package/build/legacy/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +26 -0
- package/build/legacy/dynamicFlow/utils/useDynamicFlowState.js +137 -0
- package/build/legacy/dynamicFlow/utils/useLoader.js +22 -0
- package/build/legacy/formControl/FormControl.js +266 -0
- package/build/legacy/formControl/index.js +1 -0
- package/build/legacy/formControl/utils/getAutocompleteString.js +80 -0
- package/build/legacy/formControl/utils/index.js +2 -0
- package/build/legacy/formControl/utils/value-utils.js +108 -0
- package/build/legacy/jsonSchemaForm/JsonSchemaForm.js +24 -0
- package/build/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.js +50 -0
- package/build/legacy/jsonSchemaForm/allOfSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +25 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +34 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.js +84 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +141 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +2 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +79 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +14 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.js +7 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.js +134 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.js +85 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/utils/summary-utils.js +135 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +111 -0
- package/build/legacy/jsonSchemaForm/basicTypeSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.js +86 -0
- package/build/legacy/jsonSchemaForm/controlFeedback/index.js +1 -0
- package/build/legacy/jsonSchemaForm/genericSchema/GenericSchema.js +85 -0
- package/build/legacy/jsonSchemaForm/genericSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/help/Help.js +20 -0
- package/build/legacy/jsonSchemaForm/help/index.js +1 -0
- package/build/legacy/jsonSchemaForm/index.js +1 -0
- package/build/legacy/jsonSchemaForm/objectSchema/ObjectSchema.js +77 -0
- package/build/legacy/jsonSchemaForm/objectSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.js +155 -0
- package/build/legacy/jsonSchemaForm/oneOfSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/oneOfSchema/utils.js +68 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +26 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +165 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +131 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +31 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +72 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +8 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +27 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +31 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +32 -0
- package/build/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +54 -0
- package/build/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +13 -0
- package/build/legacy/jsonSchemaForm/readOnlySchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +133 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/index.js +1 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/utils/index.js +1 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +107 -0
- package/build/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +150 -0
- package/build/legacy/jsonSchemaForm/validationAsyncSchema/index.js +1 -0
- package/build/legacy/layout/DynamicLayout.js +68 -0
- package/build/legacy/layout/alert/DynamicAlert.js +29 -0
- package/build/legacy/layout/box/DynamicBox.js +41 -0
- package/build/legacy/layout/button/DynamicButton.js +27 -0
- package/build/legacy/layout/button/utils.js +45 -0
- package/build/legacy/layout/columns/DynamicColumns.js +38 -0
- package/build/legacy/layout/decision/DynamicDecision.js +21 -0
- package/build/legacy/layout/divider/DynamicDivider.js +9 -0
- package/build/legacy/layout/external/DynamicExternal.js +32 -0
- package/build/legacy/layout/external/DynamicExternal.messages.js +8 -0
- package/build/legacy/layout/form/DynamicForm.js +22 -0
- package/build/legacy/layout/heading/DynamicHeading.js +51 -0
- package/build/legacy/layout/icon/DynamicIcon.js +17 -0
- package/build/legacy/layout/icon/FlagIcon.js +198 -0
- package/build/legacy/layout/icon/NamedIcon.js +19 -0
- package/build/legacy/layout/image/DynamicImage.js +111 -0
- package/build/legacy/layout/index.js +20 -0
- package/build/legacy/layout/instructions/DynamicInstructions.js +30 -0
- package/build/legacy/layout/list/DynamicStatusList.js +37 -0
- package/build/legacy/layout/loadingIndicator/DynamicLoadingIndicator.js +11 -0
- package/build/legacy/layout/markdown/DynamicMarkdown.js +23 -0
- package/build/legacy/layout/modal/DynamicModal.js +26 -0
- package/build/legacy/layout/paragraph/DynamicParagraph.js +46 -0
- package/build/legacy/layout/paragraph/useSnackBarIfAvailable.js +9 -0
- package/build/legacy/layout/review/DynamicReview.js +58 -0
- package/build/legacy/layout/search/DynamicSearch.js +58 -0
- package/build/legacy/layout/search/SearchInput.js +17 -0
- package/build/legacy/layout/search/SearchResults.js +31 -0
- package/build/legacy/layout/search/useSearch.js +137 -0
- package/build/legacy/layout/utils/getNavigationOptionMedia.js +28 -0
- package/build/legacy/layout/utils/index.js +32 -0
- package/build/legacy/step/cameraStep/CameraStep.js +124 -0
- package/build/legacy/step/cameraStep/cameraCapture/CameraCapture.js +161 -0
- package/build/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.js +58 -0
- package/build/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.js +28 -0
- package/build/legacy/step/cameraStep/cameraCapture/components/index.js +3 -0
- package/build/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.js +19 -0
- package/build/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.js +8 -0
- package/build/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.js +60 -0
- package/build/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.js +80 -0
- package/build/legacy/step/cameraStep/cameraCapture/index.js +1 -0
- package/build/legacy/step/cameraStep/cameraCapture/overlay/Overlay.js +77 -0
- package/build/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.js +18 -0
- package/build/legacy/step/cameraStep/cameraCapture/screens/index.js +1 -0
- package/build/legacy/step/cameraStep/cameraCapture/tracking/index.js +109 -0
- package/build/legacy/step/cameraStep/cameraCapture/types/index.js +7 -0
- package/build/legacy/step/cameraStep/cameraCapture/utils/index.js +107 -0
- package/build/legacy/step/cameraStep/index.js +1 -0
- package/build/legacy/step/externalConfirmationStep/ExternalConfirmationStep.js +64 -0
- package/build/legacy/step/externalConfirmationStep/index.js +1 -0
- package/build/legacy/step/index.js +3 -0
- package/build/legacy/step/layoutStep/LayoutStep.js +33 -0
- package/build/legacy/step/layoutStep/index.js +1 -0
- package/build/legacy/step/layoutStep/utils/index.js +2 -0
- package/build/legacy/step/layoutStep/utils/inline-reference-utils.js +105 -0
- package/build/legacy/step/layoutStep/utils/layout-utils.js +212 -0
- package/build/main.js +4791 -226
- package/build/main.min.js +1 -1
- package/build/main.mjs +4792 -227
- package/build/revamp/domain/components/AlertComponent.js +50 -0
- package/build/revamp/domain/components/AllOfComponent.js +72 -0
- package/build/revamp/domain/components/BooleanInputComponent.js +108 -0
- package/build/revamp/domain/components/BoxComponent.js +65 -0
- package/build/revamp/domain/components/ButtonComponent.js +50 -0
- package/build/revamp/domain/components/ColumnsComponent.js +74 -0
- package/build/revamp/domain/components/ConstComponent.js +50 -0
- package/build/revamp/domain/components/ContainerComponent.js +65 -0
- package/build/revamp/domain/components/DateInputComponent.js +127 -0
- package/build/revamp/domain/components/DecisionComponent.js +50 -0
- package/build/revamp/domain/components/DividerComponent.js +50 -0
- package/build/revamp/domain/components/FormComponent.js +65 -0
- package/build/revamp/domain/components/HeadingComponent.js +50 -0
- package/build/revamp/domain/components/ImageComponent.js +50 -0
- package/build/revamp/domain/components/InstructionsComponent.js +50 -0
- package/build/revamp/domain/components/IntegerInputComponent.js +125 -0
- package/build/revamp/domain/components/LoadingIndicatorComponent.js +50 -0
- package/build/revamp/domain/components/MarkdownComponent.js +50 -0
- package/build/revamp/domain/components/ModalComponent.js +65 -0
- package/build/revamp/domain/components/MultiUploadInputComponent.js +190 -0
- package/build/revamp/domain/components/NumberInputComponent.js +125 -0
- package/build/revamp/domain/components/ObjectComponent.js +104 -0
- package/build/revamp/domain/components/ParagraphComponent.js +50 -0
- package/build/revamp/domain/components/ReviewComponent.js +50 -0
- package/build/revamp/domain/components/SelectInputComponent.js +138 -0
- package/build/revamp/domain/components/StatusListComponent.js +50 -0
- package/build/revamp/domain/components/StepDomainComponent.js +93 -0
- package/build/revamp/domain/components/TextInputComponent.js +125 -0
- package/build/revamp/domain/components/UploadInputComponent.js +151 -0
- package/build/revamp/domain/components/repeatableComponent/RepeatableComponent.js +148 -0
- package/build/revamp/domain/components/searchComponent/SearchComponent.js +108 -0
- package/build/revamp/domain/components/utils/component-utils.js +18 -0
- package/build/revamp/domain/components/utils/debounce.js +38 -0
- package/build/revamp/domain/components/utils/file-utils.js +46 -0
- package/build/revamp/domain/components/utils/getComponentForLocalValueKey.js +31 -0
- package/build/revamp/domain/components/utils/isPartialLocalValueMatch.js +40 -0
- package/build/revamp/domain/features/events.js +1 -0
- package/build/revamp/domain/features/persistAsync/getComponentPersistAsync.js +133 -0
- package/build/revamp/domain/features/persistAsync/getPerformPersistAsync.js +103 -0
- package/build/revamp/domain/features/refresh/getPerformRefresh.js +53 -0
- package/build/revamp/domain/features/summary/summary-utils.js +39 -0
- package/build/revamp/domain/features/utils/http-utils.js +34 -0
- package/build/revamp/domain/features/utils/response-utils.js +9 -0
- package/build/revamp/domain/features/validation/validation-functions.js +12 -0
- package/build/revamp/domain/features/validation/value-checks.js +111 -0
- package/build/revamp/domain/features/validationAsync/getComponentValidationAsync.js +94 -0
- package/build/revamp/domain/features/validationAsync/getPerformValidationAsync.js +107 -0
- package/build/revamp/domain/mappers/types.js +1 -0
- package/build/revamp/domain/types.js +1 -0
- package/build/revamp/flow/response-utils.js +88 -0
- package/build/revamp/renderers/CoreContainerRenderer.js +8 -0
- package/build/revamp/renderers/LoadingContext.js +7 -0
- package/build/revamp/renderers/types.js +1 -0
- package/build/revamp/types.js +1 -0
- package/build/revamp/utils/component-utils.js +86 -0
- package/build/revamp/utils/type-utils.js +56 -0
- package/build/revamp/utils/type-validators.js +16 -0
- package/build/revamp/wise/renderers/AlertRenderer.js +11 -0
- package/build/revamp/wise/renderers/BooleanInputRenderer.js +34 -0
- package/build/revamp/wise/renderers/BoxRenderer.js +30 -0
- package/build/revamp/wise/renderers/ButtonRenderer.js +64 -0
- package/build/revamp/wise/renderers/ColumnsRenderer.js +25 -0
- package/build/revamp/wise/renderers/components/FieldInput.js +20 -0
- package/build/revamp/wise/renderers/components/Help.js +21 -0
- package/build/revamp/wise/renderers/components/LabelContentWithHelp.js +6 -0
- package/build/revamp/wise/renderers/utils/layout-utils.js +31 -0
- package/build/types/legacy/step/externalConfirmationStep/ExternalConfirmationStep.d.ts +1 -1
- package/build/types/revamp/domain/components/StepDomainComponent.d.ts +4 -2
- package/build/types/revamp/renderers/step/ExternalConfirmationDialog.d.ts +6 -0
- package/build/types/revamp/renderers/{StepRenderer.d.ts → step/StepRenderer.d.ts} +1 -1
- package/build/types/revamp/renderers/step/useExternal.d.ts +4 -0
- package/build/types/revamp/renderers/stepComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/types.d.ts +3 -0
- package/package.json +13 -13
- /package/build/types/{legacy/step/externalConfirmationStep/ExternalConfirmationStep.messages.d.ts → common/messages/external-confirmation.messages.d.ts} +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { isObject } from '../utils/type-validators';
|
|
38
|
+
export var assertResponseIsValid = function (response) {
|
|
39
|
+
if (!isResponse(response)) {
|
|
40
|
+
throw new Error('Incorrect type of response from fetch. Expected object of type Response.');
|
|
41
|
+
}
|
|
42
|
+
if (response.bodyUsed) {
|
|
43
|
+
throw new Error('The body of the provided Response object has already been used. Every request must respond with a new Response object.');
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var isResponse = function (response) {
|
|
47
|
+
return typeof response === 'object' &&
|
|
48
|
+
response !== null &&
|
|
49
|
+
'clone' in response &&
|
|
50
|
+
'bodyUsed' in response;
|
|
51
|
+
};
|
|
52
|
+
export var parseResponseBodyAsJsonElement = function (response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
53
|
+
var _a;
|
|
54
|
+
return __generator(this, function (_b) {
|
|
55
|
+
switch (_b.label) {
|
|
56
|
+
case 0:
|
|
57
|
+
_b.trys.push([0, 2, , 3]);
|
|
58
|
+
return [4 /*yield*/, response.json()];
|
|
59
|
+
case 1: return [2 /*return*/, (_b.sent())];
|
|
60
|
+
case 2:
|
|
61
|
+
_a = _b.sent();
|
|
62
|
+
return [2 /*return*/, null];
|
|
63
|
+
case 3: return [2 /*return*/];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}); };
|
|
67
|
+
export function assertActionResponseBody(body) {
|
|
68
|
+
// TODO: use zod to validate the action object instead of this
|
|
69
|
+
if (!isObject(body) || !isObject(body.action)) {
|
|
70
|
+
throw new Error('Incorrect response body in action response. Expected an object satisfying the type { action: Action }.');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export function isErrorResponseBody(body) {
|
|
74
|
+
return Boolean(isObject(body) &&
|
|
75
|
+
(body.refreshFormUrl || body.refreshUrl || body.validation || body.error || body.analytics));
|
|
76
|
+
}
|
|
77
|
+
export function assertErrorResponseBody(body) {
|
|
78
|
+
// TODO: use zod to validate the error object instead of this
|
|
79
|
+
if (!isErrorResponseBody(body)) {
|
|
80
|
+
throw new Error('Incorrect error response body in error response. Expected an object with either `refreshUrl`, `validation` or `error` properties.');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export function assertStepResponseBody(body) {
|
|
84
|
+
// TODO: use zod to validate the error object instead of this. Currently we just want to log, in future we can throw.
|
|
85
|
+
if (!isObject(body)) {
|
|
86
|
+
throw new Error('Incorrect response body in step response. Expected an object.');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
var LoadingContext = createContext({ loadingState: 'idle' });
|
|
3
|
+
export var LoadingContextProvider = LoadingContext.Provider;
|
|
4
|
+
export var useLoadingContext = function () {
|
|
5
|
+
var loadingState = useContext(LoadingContext).loadingState;
|
|
6
|
+
return { loadingState: loadingState, isLoading: loadingState !== 'idle' };
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import { isObjectLocalValue, isObjectModel } from './type-utils';
|
|
49
|
+
export var getSubmittableData = function (components) { return __awaiter(void 0, void 0, void 0, function () {
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
return [2 /*return*/, Promise.all(components.map(function (component) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
52
|
+
return [2 /*return*/, component.getSubmittableValue()];
|
|
53
|
+
}); }); })).then(function (values) {
|
|
54
|
+
return values.reduce(function (acc, value) { return mergeModels(acc, value); }, null);
|
|
55
|
+
})];
|
|
56
|
+
});
|
|
57
|
+
}); };
|
|
58
|
+
export var getLocalValues = function (components) {
|
|
59
|
+
return components
|
|
60
|
+
.map(function (component) { return component.getLocalValue(); })
|
|
61
|
+
.reduce(function (acc, value) { return mergeLocalValues(acc, value); }, null);
|
|
62
|
+
};
|
|
63
|
+
export var mergeLocalValues = function (valueA, valueB) {
|
|
64
|
+
if (valueA === null) {
|
|
65
|
+
return valueB;
|
|
66
|
+
}
|
|
67
|
+
if (valueB === null) {
|
|
68
|
+
return valueA;
|
|
69
|
+
}
|
|
70
|
+
if (isObjectLocalValue(valueA) && isObjectLocalValue(valueB)) {
|
|
71
|
+
return __assign(__assign({}, valueA), valueB);
|
|
72
|
+
}
|
|
73
|
+
return valueB;
|
|
74
|
+
};
|
|
75
|
+
export var mergeModels = function (valueA, valueB) {
|
|
76
|
+
if (valueA === null) {
|
|
77
|
+
return valueB;
|
|
78
|
+
}
|
|
79
|
+
if (valueB === null) {
|
|
80
|
+
return valueA;
|
|
81
|
+
}
|
|
82
|
+
if (isObjectModel(valueA) && isObjectModel(valueB)) {
|
|
83
|
+
return __assign(__assign({}, valueA), valueB);
|
|
84
|
+
}
|
|
85
|
+
return valueB;
|
|
86
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { isArray, isNullish, isObject } from './type-validators';
|
|
2
|
+
export var hasChildren = function (component) {
|
|
3
|
+
return 'getChildren' in component && typeof component.getChildren === 'function';
|
|
4
|
+
};
|
|
5
|
+
export var isColumnsComponent = function (component) {
|
|
6
|
+
return Object.hasOwnProperty.call(component, 'startComponents') &&
|
|
7
|
+
Object.hasOwnProperty.call(component, 'endComponents');
|
|
8
|
+
};
|
|
9
|
+
export var isHiddenComponent = function (component) { return 'hidden' in component && component.hidden; };
|
|
10
|
+
export var isRepeatableComponent = function (component) { return Object.hasOwnProperty.call(component, 'editableComponent'); };
|
|
11
|
+
export var isObjectLocalValue = function (value) {
|
|
12
|
+
return value != null && typeof value === 'object' && !Array.isArray(value) && !(value instanceof File);
|
|
13
|
+
};
|
|
14
|
+
export var isObjectModel = function (model) {
|
|
15
|
+
return model != null && typeof model === 'object' && !Array.isArray(model);
|
|
16
|
+
};
|
|
17
|
+
export var isArrayModel = function (model) { return Array.isArray(model); };
|
|
18
|
+
export var isAllOfSchema = function (schema) {
|
|
19
|
+
return 'allOf' in schema && !isNullish(schema.allOf);
|
|
20
|
+
};
|
|
21
|
+
export var isBooleanSchema = function (schema) {
|
|
22
|
+
return 'type' in schema && schema.type === 'boolean';
|
|
23
|
+
};
|
|
24
|
+
export var isBlobSchema = function (schema) {
|
|
25
|
+
return 'type' in schema && schema.type === 'blob';
|
|
26
|
+
};
|
|
27
|
+
export var isConstSchema = function (schema) {
|
|
28
|
+
return 'const' in schema && schema["const"] !== undefined;
|
|
29
|
+
};
|
|
30
|
+
export var isIntegerSchema = function (schema) {
|
|
31
|
+
return 'type' in schema && schema.type === 'integer';
|
|
32
|
+
};
|
|
33
|
+
export var isNumberSchema = function (schema) {
|
|
34
|
+
return 'type' in schema && schema.type === 'number';
|
|
35
|
+
};
|
|
36
|
+
export var isObjectSchema = function (schema) {
|
|
37
|
+
return 'type' in schema && schema.type === 'object';
|
|
38
|
+
};
|
|
39
|
+
export var isOneOfSchema = function (schema) {
|
|
40
|
+
return 'oneOf' in schema && !isNullish(schema.oneOf);
|
|
41
|
+
};
|
|
42
|
+
export var isArraySchema = function (schema) {
|
|
43
|
+
return 'items' in schema && !isNullish(schema.items);
|
|
44
|
+
};
|
|
45
|
+
export var isArrayListSchema = function (schema) {
|
|
46
|
+
return 'items' in schema && isObject(schema.items) && !isArray(schema.items);
|
|
47
|
+
};
|
|
48
|
+
export var isStringSchema = function (schema) {
|
|
49
|
+
return 'type' in schema && schema.type === 'string';
|
|
50
|
+
};
|
|
51
|
+
export var isStringSchemaWithUpload = function (schema) {
|
|
52
|
+
return isStringSchema(schema) && schema.format === 'base64url';
|
|
53
|
+
};
|
|
54
|
+
export var isSchemaWithPersistAsync = function (schema) {
|
|
55
|
+
return 'persistAsync' in schema && !isNullish(schema.persistAsync);
|
|
56
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export var isString = function (value) { return typeof value === 'string'; };
|
|
2
|
+
export var isNumber = function (value) {
|
|
3
|
+
return typeof value === 'number' && !Number.isNaN(value);
|
|
4
|
+
};
|
|
5
|
+
export var isInteger = function (value) {
|
|
6
|
+
return isNumber(value) && Math.floor(value) === value;
|
|
7
|
+
};
|
|
8
|
+
export var isBoolean = function (value) { return typeof value === 'boolean'; };
|
|
9
|
+
export var isObject = function (value) {
|
|
10
|
+
return !isNullish(value) && (value === null || value === void 0 ? void 0 : value.constructor) === Object;
|
|
11
|
+
};
|
|
12
|
+
export var isArray = function (value) { return Array.isArray(value); };
|
|
13
|
+
export var isNull = function (value) { return value === null; };
|
|
14
|
+
export var isUndefined = function (value) { return typeof value === 'undefined'; };
|
|
15
|
+
export var isNullish = function (v) { return isNull(v) || isUndefined(v); };
|
|
16
|
+
export var isFile = function (value) { return value instanceof File; };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Alert } from '@transferwise/components';
|
|
3
|
+
import { getMargin } from './utils/layout-utils';
|
|
4
|
+
var AlertRenderer = {
|
|
5
|
+
canRenderType: 'alert',
|
|
6
|
+
render: function (_a) {
|
|
7
|
+
var context = _a.context, markdown = _a.markdown, margin = _a.margin;
|
|
8
|
+
return (_jsx(Alert, { type: context, className: getMargin(margin), message: markdown }));
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export default AlertRenderer;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import FieldInput from './components/FieldInput';
|
|
25
|
+
import { Checkbox } from '@transferwise/components';
|
|
26
|
+
var BooleanInputRenderer = {
|
|
27
|
+
canRenderType: 'input-boolean',
|
|
28
|
+
render: function (props) {
|
|
29
|
+
var id = props.id, control = props.control, _a = props.label, label = _a === void 0 ? '' : _a, description = props.description, help = props.help, error = props.error, type = props.type, value = props.value, rest = __rest(props, ["id", "control", "label", "description", "help", "error", "type", "value"]);
|
|
30
|
+
var checkboxProps = __assign(__assign({}, rest), { label: label, checked: value });
|
|
31
|
+
return (_jsx(FieldInput, __assign({ id: id, label: "", description: description, error: error, help: help }, { children: _jsx(Checkbox, __assign({ id: id }, checkboxProps)) })));
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export default BooleanInputRenderer;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import classNames from 'classnames';
|
|
14
|
+
import { getMargin } from './utils/layout-utils';
|
|
15
|
+
var BoxRenderer = {
|
|
16
|
+
canRenderType: 'box',
|
|
17
|
+
render: function (_a) {
|
|
18
|
+
var _b;
|
|
19
|
+
var border = _a.border, children = _a.children, margin = _a.margin, width = _a.width;
|
|
20
|
+
var hasFixedWidth = width !== 'xl';
|
|
21
|
+
var contents = (_jsx("div", __assign({ className: classNames((_b = {
|
|
22
|
+
'df-box-renderer-border': border
|
|
23
|
+
},
|
|
24
|
+
_b["df-box-renderer-width-".concat(width)] = hasFixedWidth,
|
|
25
|
+
_b[getMargin(margin)] = !hasFixedWidth,
|
|
26
|
+
_b)) }, { children: children })));
|
|
27
|
+
return hasFixedWidth ? (_jsx("div", __assign({ className: classNames('df-box-renderer-fixed-width', getMargin(margin)) }, { children: contents }))) : (contents);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export default BoxRenderer;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { Button } from '@transferwise/components';
|
|
14
|
+
import { getMargin } from './utils/layout-utils';
|
|
15
|
+
import { useLoadingContext } from '../../renderers/LoadingContext';
|
|
16
|
+
var ButtonRenderer = {
|
|
17
|
+
canRenderType: 'button',
|
|
18
|
+
render: ButtonRendererComponent
|
|
19
|
+
};
|
|
20
|
+
function ButtonRendererComponent(_a) {
|
|
21
|
+
var control = _a.control, context = _a.context, disabled = _a.disabled, margin = _a.margin, title = _a.title, size = _a.size, onClick = _a.onClick;
|
|
22
|
+
var className = getMargin(margin);
|
|
23
|
+
var priority = mapControl(control);
|
|
24
|
+
// Button doesn't support tertiary buttons with a context, and will render as
|
|
25
|
+
// secondary. This is inconsistent with mobile, so for now we remove context
|
|
26
|
+
var type = priority === 'tertiary' ? undefined : mapContext(context);
|
|
27
|
+
var isLoading = useLoadingContext().isLoading;
|
|
28
|
+
return (_jsx(Button, __assign({ block: true, className: className, disabled: isLoading || disabled, priority: mapControl(control), size: mapSize(size), type: type, onClick: onClick }, { children: title })));
|
|
29
|
+
}
|
|
30
|
+
var mapContext = function (context) {
|
|
31
|
+
switch (context) {
|
|
32
|
+
case 'neutral':
|
|
33
|
+
case 'warning':
|
|
34
|
+
return 'accent';
|
|
35
|
+
default:
|
|
36
|
+
return context;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var mapControl = function (control) {
|
|
40
|
+
switch (control) {
|
|
41
|
+
case 'primary':
|
|
42
|
+
case 'tertiary':
|
|
43
|
+
return control;
|
|
44
|
+
default:
|
|
45
|
+
return 'secondary';
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var mapSize = function (size) {
|
|
49
|
+
if (!size) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
switch (size) {
|
|
53
|
+
case 'xs':
|
|
54
|
+
case 'sm':
|
|
55
|
+
return 'sm';
|
|
56
|
+
case 'lg':
|
|
57
|
+
case 'xl':
|
|
58
|
+
return 'lg';
|
|
59
|
+
case 'md':
|
|
60
|
+
default:
|
|
61
|
+
return 'md';
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
export default ButtonRenderer;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import classNames from 'classnames';
|
|
14
|
+
import { getMargin } from './utils/layout-utils';
|
|
15
|
+
var ColumnsRenderer = {
|
|
16
|
+
canRenderType: 'columns',
|
|
17
|
+
render: function (_a) {
|
|
18
|
+
var bias = _a.bias, margin = _a.margin, startChildren = _a.startChildren, endChildren = _a.endChildren;
|
|
19
|
+
return (_jsxs("div", __assign({ className: classNames('df-columns-renderer-container', getMargin(margin), {
|
|
20
|
+
'df-columns-renderer-bias-start': bias === 'start',
|
|
21
|
+
'df-columns-renderer-bias-end': bias === 'end'
|
|
22
|
+
}) }, { children: [_jsx("div", __assign({ className: "df-columns-renderer-column" }, { children: startChildren })), _jsx("div", __assign({ className: "df-columns-renderer-column" }, { children: endChildren }))] })));
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export default ColumnsRenderer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { Field } from '@wise/forms';
|
|
14
|
+
import { LabelContentWithHelp } from './LabelContentWithHelp';
|
|
15
|
+
function FieldInput(_a) {
|
|
16
|
+
var id = _a.id, children = _a.children, label = _a.label, error = _a.error, description = _a.description, help = _a.help;
|
|
17
|
+
var labelContent = label && help ? _jsx(LabelContentWithHelp, { text: label, help: help }) : label;
|
|
18
|
+
return (_jsx(Field, __assign({ id: id, label: labelContent, hint: description, error: error }, { children: children })));
|
|
19
|
+
}
|
|
20
|
+
export default FieldInput;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { Info, Markdown } from '@transferwise/components';
|
|
14
|
+
import { useIntl } from 'react-intl';
|
|
15
|
+
import helpMessages from '../../../../common/messages/help.messages';
|
|
16
|
+
function Help(_a) {
|
|
17
|
+
var help = _a.help;
|
|
18
|
+
var intl = useIntl();
|
|
19
|
+
return (_jsx(Info, { className: "m-l-1", content: _jsx(Markdown, __assign({ config: { link: { target: '_blank' } } }, { children: help })), presentation: "POPOVER", size: "sm", "aria-label": intl.formatMessage(helpMessages.helpAria) }));
|
|
20
|
+
}
|
|
21
|
+
export default Help;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var getMargin = function (size) {
|
|
2
|
+
switch (size) {
|
|
3
|
+
case 'xs':
|
|
4
|
+
return 'm-b-0';
|
|
5
|
+
case 'sm':
|
|
6
|
+
return 'm-b-1';
|
|
7
|
+
case 'md':
|
|
8
|
+
return 'm-b-2';
|
|
9
|
+
case 'lg':
|
|
10
|
+
return 'm-b-3';
|
|
11
|
+
case 'xl':
|
|
12
|
+
return 'm-b-5';
|
|
13
|
+
default:
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var getTextAlignment = function (align) {
|
|
18
|
+
switch (align) {
|
|
19
|
+
case 'end':
|
|
20
|
+
return 'text-xs-right';
|
|
21
|
+
case 'center':
|
|
22
|
+
return 'text-xs-center';
|
|
23
|
+
case 'start':
|
|
24
|
+
default:
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var getTextAlignmentAndMargin = function (component) {
|
|
29
|
+
return "".concat(getTextAlignment(component.align), " ").concat(getMargin(component.margin));
|
|
30
|
+
};
|
|
31
|
+
export { getMargin, getTextAlignmentAndMargin };
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { BaseComponent, DomainComponent, LoadingState, LocalValue, UpdateComponent } from '../types';
|
|
2
|
+
import type { External } from '@wise/dynamic-flow-types/build/next/feature/External';
|
|
2
3
|
export type StepDomainComponent = BaseComponent & {
|
|
3
4
|
type: 'step';
|
|
4
|
-
loadingState: LoadingState;
|
|
5
5
|
components: DomainComponent[];
|
|
6
|
+
external?: External;
|
|
7
|
+
loadingState: LoadingState;
|
|
6
8
|
setLoadingState: (loadingState: LoadingState) => void;
|
|
7
9
|
getChildren: () => DomainComponent[];
|
|
8
10
|
getLocalValue: () => LocalValue;
|
|
9
11
|
};
|
|
10
|
-
export declare const createStepComponent: (stepProps: Pick<StepDomainComponent, "components" | "loadingState" | "uid"> & {
|
|
12
|
+
export declare const createStepComponent: (stepProps: Pick<StepDomainComponent, "external" | "components" | "loadingState" | "uid"> & {
|
|
11
13
|
updateComponent: UpdateComponent;
|
|
12
14
|
}) => StepDomainComponent;
|
|
13
15
|
export declare const createEmptyStepComponent: (updateComponent: UpdateComponent) => StepDomainComponent;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Renderer, StepRendererProps } from '
|
|
1
|
+
import type { Renderer, StepRendererProps } from '../types';
|
|
2
2
|
export declare const StepRenderer: Renderer<StepRendererProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { StepDomainComponent } from '../domain/components/StepDomainComponent';
|
|
3
3
|
import type { StepRendererProps } from './types';
|
|
4
|
-
export declare const stepComponentToProps: ({ loadingState }: StepDomainComponent, children: ReactNode) => StepRendererProps;
|
|
4
|
+
export declare const stepComponentToProps: ({ external, loadingState }: StepDomainComponent, children: ReactNode) => StepRendererProps;
|