@wise/dynamic-flow-client 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/main.js
CHANGED
|
@@ -4469,7 +4469,7 @@ var DynamicImage = ({ component: image }) => {
|
|
|
4469
4469
|
if (!imageSource) {
|
|
4470
4470
|
return null;
|
|
4471
4471
|
}
|
|
4472
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: `df-image ${size || "
|
|
4472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components15.Image, __spreadValues({ className: `img-responsive ${getMarginBottom(margin || "md")}` }, imageProps)) });
|
|
4473
4473
|
};
|
|
4474
4474
|
var readImageBlobAsDataURL = (imageBlob) => {
|
|
4475
4475
|
return new Promise((resolve, reject) => {
|
|
@@ -4501,31 +4501,49 @@ var getImageSource = async (httpClient, imageUrl) => {
|
|
|
4501
4501
|
};
|
|
4502
4502
|
var DynamicImage_default = DynamicImage;
|
|
4503
4503
|
|
|
4504
|
-
// src/layout/
|
|
4504
|
+
// src/layout/instructions/DynamicInstructions.tsx
|
|
4505
|
+
var import_components16 = require("@transferwise/components");
|
|
4505
4506
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
4507
|
+
var doContext = ["positive", "neutral"];
|
|
4508
|
+
var dontContext = ["warning", "negative"];
|
|
4509
|
+
var DynamicInstructions = ({ component }) => {
|
|
4510
|
+
const { items } = component;
|
|
4511
|
+
const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
|
|
4512
|
+
const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
|
|
4513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getMarginBottom(component.margin || "md"), children: [
|
|
4514
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_components16.Header, { title: component.title }) : null,
|
|
4515
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_components16.InstructionsList, { dos, donts })
|
|
4516
|
+
] });
|
|
4517
|
+
};
|
|
4518
|
+
var DynamicInstructions_default = DynamicInstructions;
|
|
4519
|
+
|
|
4520
|
+
// src/layout/DynamicLayout.tsx
|
|
4521
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4506
4522
|
var getKey = (component) => JSON.stringify(component);
|
|
4507
4523
|
var DynamicLayout = (props) => {
|
|
4508
4524
|
const { components, model, submitted, errors, onModelChange, onAction, onPersistAsync, baseUrl } = props;
|
|
4509
4525
|
const renderComponent = (component) => {
|
|
4510
4526
|
switch (component.type) {
|
|
4511
4527
|
case "heading":
|
|
4512
|
-
return /* @__PURE__ */ (0,
|
|
4528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicHeading_default, { component }, getKey(component));
|
|
4513
4529
|
case "paragraph":
|
|
4514
|
-
return /* @__PURE__ */ (0,
|
|
4530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicParagraph_default, { component }, getKey(component));
|
|
4515
4531
|
case "image":
|
|
4516
|
-
return /* @__PURE__ */ (0,
|
|
4532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicImage_default, { component }, getKey(component));
|
|
4517
4533
|
case "alert":
|
|
4518
|
-
return /* @__PURE__ */ (0,
|
|
4534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicAlert_default, { component }, getKey(component));
|
|
4519
4535
|
case "review":
|
|
4520
|
-
return /* @__PURE__ */ (0,
|
|
4536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicReview_default, { component, onAction }, getKey(component));
|
|
4521
4537
|
case "divider":
|
|
4522
|
-
return /* @__PURE__ */ (0,
|
|
4538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicDivider_default, { component }, getKey(component));
|
|
4523
4539
|
case "info":
|
|
4524
|
-
return /* @__PURE__ */ (0,
|
|
4540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicInfo, { component }, getKey(component));
|
|
4541
|
+
case "instructions":
|
|
4542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicInstructions_default, { component }, getKey(component));
|
|
4525
4543
|
case "markdown":
|
|
4526
|
-
return /* @__PURE__ */ (0,
|
|
4544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicMarkdown, { component }, getKey(component));
|
|
4527
4545
|
case "columns":
|
|
4528
|
-
return /* @__PURE__ */ (0,
|
|
4546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4529
4547
|
DynamicColumns_default,
|
|
4530
4548
|
{
|
|
4531
4549
|
component,
|
|
@@ -4539,7 +4557,7 @@ var DynamicLayout = (props) => {
|
|
|
4539
4557
|
getKey(component)
|
|
4540
4558
|
);
|
|
4541
4559
|
case "form":
|
|
4542
|
-
return /* @__PURE__ */ (0,
|
|
4560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4543
4561
|
DynamicForm_default,
|
|
4544
4562
|
{
|
|
4545
4563
|
component,
|
|
@@ -4552,9 +4570,9 @@ var DynamicLayout = (props) => {
|
|
|
4552
4570
|
getKey(__spreadProps(__spreadValues({}, component), { errors: errors != null ? errors : null }))
|
|
4553
4571
|
);
|
|
4554
4572
|
case "button":
|
|
4555
|
-
return /* @__PURE__ */ (0,
|
|
4573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicButton_default, { component, onAction }, getKey(component));
|
|
4556
4574
|
case "box":
|
|
4557
|
-
return /* @__PURE__ */ (0,
|
|
4575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4558
4576
|
DynamicBox_default,
|
|
4559
4577
|
{
|
|
4560
4578
|
component,
|
|
@@ -4568,32 +4586,32 @@ var DynamicLayout = (props) => {
|
|
|
4568
4586
|
getKey(component)
|
|
4569
4587
|
);
|
|
4570
4588
|
case "decision":
|
|
4571
|
-
return /* @__PURE__ */ (0,
|
|
4589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicDecision_default, { component, onAction }, getKey(component));
|
|
4572
4590
|
case "external":
|
|
4573
|
-
return /* @__PURE__ */ (0,
|
|
4591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicExternal_default, { component, onAction }, getKey(component));
|
|
4574
4592
|
case "list":
|
|
4575
4593
|
case "status-list":
|
|
4576
|
-
return /* @__PURE__ */ (0,
|
|
4594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicStatusList_default, { component, onAction }, getKey(component));
|
|
4577
4595
|
case "loading-indicator":
|
|
4578
|
-
return /* @__PURE__ */ (0,
|
|
4596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicLoadingIndicator_default, { component }, getKey(component));
|
|
4579
4597
|
default:
|
|
4580
|
-
return /* @__PURE__ */ (0,
|
|
4598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", {}, getKey(component));
|
|
4581
4599
|
}
|
|
4582
4600
|
};
|
|
4583
4601
|
if (useHasHttpClientProvider() || baseUrl == null) {
|
|
4584
|
-
return /* @__PURE__ */ (0,
|
|
4602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_jsx_runtime42.Fragment, { children: components.map(renderComponent) });
|
|
4585
4603
|
} else {
|
|
4586
|
-
return /* @__PURE__ */ (0,
|
|
4604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
|
|
4587
4605
|
}
|
|
4588
4606
|
};
|
|
4589
4607
|
var DynamicLayout_default = DynamicLayout;
|
|
4590
4608
|
|
|
4591
4609
|
// src/layout/list/DynamicStatusList.tsx
|
|
4592
|
-
var
|
|
4593
|
-
var
|
|
4610
|
+
var import_components17 = require("@transferwise/components");
|
|
4611
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
4594
4612
|
var DynamicStatusList = ({ component }) => {
|
|
4595
|
-
return /* @__PURE__ */ (0,
|
|
4596
|
-
component.title ? /* @__PURE__ */ (0,
|
|
4613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: getMarginBottom(component.margin || "md"), children: [
|
|
4614
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("h4", { className: "m-b-2", children: [
|
|
4597
4615
|
" ",
|
|
4598
4616
|
component.title,
|
|
4599
4617
|
" "
|
|
@@ -4606,8 +4624,8 @@ var mapListItemToSummary = ({ title, description, icon, status }) => {
|
|
|
4606
4624
|
key: `${title}/${description || ""}`,
|
|
4607
4625
|
title,
|
|
4608
4626
|
description
|
|
4609
|
-
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0,
|
|
4610
|
-
return /* @__PURE__ */ (0,
|
|
4627
|
+
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicIcon_default, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
|
|
4628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components17.Summary, __spreadValues({}, props));
|
|
4611
4629
|
};
|
|
4612
4630
|
var statusListMap = {
|
|
4613
4631
|
done: "done",
|
|
@@ -4623,12 +4641,12 @@ var statusMap = __spreadValues(__spreadValues({}, statusListMap), legacyStatusMa
|
|
|
4623
4641
|
var DynamicStatusList_default = DynamicStatusList;
|
|
4624
4642
|
|
|
4625
4643
|
// src/layout/loadingIndicator/DynamicLoadingIndicator.tsx
|
|
4626
|
-
var
|
|
4627
|
-
var
|
|
4644
|
+
var import_components18 = require("@transferwise/components");
|
|
4645
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
4628
4646
|
var DynamicLoadingIndicator = ({ component }) => {
|
|
4629
4647
|
const { margin, size = "md" } = component;
|
|
4630
|
-
return /* @__PURE__ */ (0,
|
|
4631
|
-
|
|
4648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4649
|
+
import_components18.Loader,
|
|
4632
4650
|
{
|
|
4633
4651
|
size,
|
|
4634
4652
|
classNames: {
|
|
@@ -4641,7 +4659,7 @@ var DynamicLoadingIndicator = ({ component }) => {
|
|
|
4641
4659
|
var DynamicLoadingIndicator_default = DynamicLoadingIndicator;
|
|
4642
4660
|
|
|
4643
4661
|
// src/layout/paragraph/DynamicParagraph.tsx
|
|
4644
|
-
var
|
|
4662
|
+
var import_components20 = require("@transferwise/components");
|
|
4645
4663
|
var import_react_intl14 = require("react-intl");
|
|
4646
4664
|
|
|
4647
4665
|
// src/layout/paragraph/DynamicParagraph.messages.ts
|
|
@@ -4660,19 +4678,19 @@ var DynamicParagraph_messages_default = (0, import_react_intl13.defineMessages)(
|
|
|
4660
4678
|
});
|
|
4661
4679
|
|
|
4662
4680
|
// src/layout/paragraph/useSnackBarIfAvailable.ts
|
|
4663
|
-
var
|
|
4681
|
+
var import_components19 = require("@transferwise/components");
|
|
4664
4682
|
var import_react23 = require("react");
|
|
4665
4683
|
function useSnackBarIfAvailable() {
|
|
4666
|
-
const context = (0, import_react23.useContext)(
|
|
4684
|
+
const context = (0, import_react23.useContext)(import_components19.SnackbarContext);
|
|
4667
4685
|
return context ? context.createSnackbar : noop3;
|
|
4668
4686
|
}
|
|
4669
4687
|
function noop3() {
|
|
4670
4688
|
}
|
|
4671
4689
|
|
|
4672
4690
|
// src/layout/paragraph/DynamicParagraph.tsx
|
|
4673
|
-
var
|
|
4674
|
-
var DynamicParagraph = ({ component }) => component.control === "copyable" ? /* @__PURE__ */ (0,
|
|
4675
|
-
var BasicDynamicParagraph = ({ component }) => /* @__PURE__ */ (0,
|
|
4691
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
4692
|
+
var DynamicParagraph = ({ component }) => component.control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(BasicDynamicParagraph, { component });
|
|
4693
|
+
var BasicDynamicParagraph = ({ component }) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("p", { className: getTextAlignmentAndMargin(component), children: [
|
|
4676
4694
|
" ",
|
|
4677
4695
|
component.text,
|
|
4678
4696
|
" "
|
|
@@ -4686,8 +4704,8 @@ var CopyableDynamicParagraph = ({ component }) => {
|
|
|
4686
4704
|
(_a = navigator.clipboard) == null ? void 0 : _a.writeText(text).then(() => createSnackbar({ text: formatMessage(DynamicParagraph_messages_default.copied) })).catch(noop4);
|
|
4687
4705
|
};
|
|
4688
4706
|
const classNames7 = getTextAlignmentAndMargin({ align: component.align, margin: "sm" }) + " form-control";
|
|
4689
|
-
return /* @__PURE__ */ (0,
|
|
4690
|
-
/* @__PURE__ */ (0,
|
|
4707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: getTextAlignmentAndMargin(component), children: [
|
|
4708
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4691
4709
|
"input",
|
|
4692
4710
|
{
|
|
4693
4711
|
type: "text",
|
|
@@ -4697,7 +4715,7 @@ var CopyableDynamicParagraph = ({ component }) => {
|
|
|
4697
4715
|
style: { textOverflow: "ellipsis" }
|
|
4698
4716
|
}
|
|
4699
4717
|
),
|
|
4700
|
-
/* @__PURE__ */ (0,
|
|
4718
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_components20.Button, { block: true, onClick: copy, children: formatMessage(DynamicParagraph_messages_default.copy) })
|
|
4701
4719
|
] });
|
|
4702
4720
|
};
|
|
4703
4721
|
function noop4() {
|
|
@@ -4705,8 +4723,8 @@ function noop4() {
|
|
|
4705
4723
|
var DynamicParagraph_default = DynamicParagraph;
|
|
4706
4724
|
|
|
4707
4725
|
// src/layout/review/DynamicReview.tsx
|
|
4708
|
-
var
|
|
4709
|
-
var
|
|
4726
|
+
var import_components21 = require("@transferwise/components");
|
|
4727
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
4710
4728
|
var mapFieldsToDefinitions = ({ label, value }, index) => {
|
|
4711
4729
|
return { key: String(index), title: label, value };
|
|
4712
4730
|
};
|
|
@@ -4718,7 +4736,7 @@ var DynamicReview = (props) => {
|
|
|
4718
4736
|
const review = props.component;
|
|
4719
4737
|
const margin = getMarginBottom(review.margin || "xs");
|
|
4720
4738
|
const getReviewAction = (action) => {
|
|
4721
|
-
return /* @__PURE__ */ (0,
|
|
4739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4722
4740
|
"a",
|
|
4723
4741
|
{
|
|
4724
4742
|
href: action.url,
|
|
@@ -4732,13 +4750,13 @@ var DynamicReview = (props) => {
|
|
|
4732
4750
|
}
|
|
4733
4751
|
);
|
|
4734
4752
|
};
|
|
4735
|
-
return /* @__PURE__ */ (0,
|
|
4736
|
-
review.title && /* @__PURE__ */ (0,
|
|
4753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
4754
|
+
review.title && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("h6", { className: "m-b-2", children: [
|
|
4737
4755
|
review.title,
|
|
4738
4756
|
review.action && getReviewAction(review.action)
|
|
4739
4757
|
] }),
|
|
4740
|
-
/* @__PURE__ */ (0,
|
|
4741
|
-
|
|
4758
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4759
|
+
import_components21.DefinitionList,
|
|
4742
4760
|
{
|
|
4743
4761
|
layout: getReviewLayout(review),
|
|
4744
4762
|
definitions: review.fields.map(mapFieldsToDefinitions)
|
|
@@ -4749,7 +4767,7 @@ var DynamicReview = (props) => {
|
|
|
4749
4767
|
var DynamicReview_default = DynamicReview;
|
|
4750
4768
|
|
|
4751
4769
|
// src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
4752
|
-
var
|
|
4770
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
4753
4771
|
var isNullish = (value) => isNull(value) || isUndefined(value);
|
|
4754
4772
|
var getDefaultValue = (schema) => {
|
|
4755
4773
|
return schema.type === "boolean" && isNullish(schema.default) ? false : schema.default;
|
|
@@ -4823,15 +4841,15 @@ var BasicTypeSchema = (props) => {
|
|
|
4823
4841
|
};
|
|
4824
4842
|
const showLabel = props.schema.format !== "file" && props.schema.type !== "boolean";
|
|
4825
4843
|
const schemaHelp = props.schema.help;
|
|
4826
|
-
return !isHidden ? /* @__PURE__ */ (0,
|
|
4827
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
4828
|
-
/* @__PURE__ */ (0,
|
|
4829
|
-
showLabel && /* @__PURE__ */ (0,
|
|
4830
|
-
/* @__PURE__ */ (0,
|
|
4831
|
-
!!schemaHelp && /* @__PURE__ */ (0,
|
|
4844
|
+
return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
4845
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
4846
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: (0, import_classnames6.default)(formGroupClasses), children: [
|
|
4847
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "d-inline-block", children: [
|
|
4848
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
|
|
4849
|
+
!!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Help_default, { help: schemaHelp })
|
|
4832
4850
|
] }),
|
|
4833
|
-
!showLabel && !!schemaHelp && /* @__PURE__ */ (0,
|
|
4834
|
-
/* @__PURE__ */ (0,
|
|
4851
|
+
!showLabel && !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Help_default, { help: schemaHelp }),
|
|
4852
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
4835
4853
|
SchemaFormControl_default,
|
|
4836
4854
|
{
|
|
4837
4855
|
id,
|
|
@@ -4843,7 +4861,7 @@ var BasicTypeSchema = (props) => {
|
|
|
4843
4861
|
onBlur
|
|
4844
4862
|
}
|
|
4845
4863
|
),
|
|
4846
|
-
/* @__PURE__ */ (0,
|
|
4864
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
4847
4865
|
ControlFeedback_default,
|
|
4848
4866
|
{
|
|
4849
4867
|
changed,
|
|
@@ -4867,7 +4885,7 @@ BasicTypeSchema.defaultProps = {
|
|
|
4867
4885
|
var BasicTypeSchema_default = BasicTypeSchema;
|
|
4868
4886
|
|
|
4869
4887
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
4870
|
-
var
|
|
4888
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
4871
4889
|
var getIdFromResponse = (idProperty, response) => {
|
|
4872
4890
|
return response[idProperty];
|
|
4873
4891
|
};
|
|
@@ -4959,7 +4977,7 @@ var PersistAsyncBasicSchema = (props) => {
|
|
|
4959
4977
|
setPersistAsyncModel(newPersistAsyncModel);
|
|
4960
4978
|
}
|
|
4961
4979
|
};
|
|
4962
|
-
return /* @__PURE__ */ (0,
|
|
4980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
4963
4981
|
BasicTypeSchema_default,
|
|
4964
4982
|
{
|
|
4965
4983
|
required,
|
|
@@ -5170,7 +5188,7 @@ function useStepPolling(polling, onAction) {
|
|
|
5170
5188
|
}
|
|
5171
5189
|
|
|
5172
5190
|
// src/step/layoutStep/LayoutStep.tsx
|
|
5173
|
-
var
|
|
5191
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
5174
5192
|
var getComponents = (step, options) => {
|
|
5175
5193
|
var _a;
|
|
5176
5194
|
if (isEmpty(step)) {
|
|
@@ -5193,7 +5211,7 @@ var LayoutStep = (props) => {
|
|
|
5193
5211
|
onEvent("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
|
|
5194
5212
|
};
|
|
5195
5213
|
useStepPolling(stepSpecification.polling, onAction);
|
|
5196
|
-
return /* @__PURE__ */ (0,
|
|
5214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5197
5215
|
DynamicLayout_default,
|
|
5198
5216
|
{
|
|
5199
5217
|
components,
|
|
@@ -5237,49 +5255,49 @@ var CameraCapture_messages_default = (0, import_react_intl17.defineMessages)({
|
|
|
5237
5255
|
});
|
|
5238
5256
|
|
|
5239
5257
|
// src/step/cameraStep/cameraCapture/components/index.tsx
|
|
5240
|
-
var
|
|
5258
|
+
var import_components22 = require("@transferwise/components");
|
|
5241
5259
|
var import_react_intl18 = require("react-intl");
|
|
5242
|
-
var
|
|
5243
|
-
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0,
|
|
5260
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
5261
|
+
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(CaptureButton, { onClick: onCapture }) });
|
|
5244
5262
|
var ReviewBottomBar = ({
|
|
5245
5263
|
onSubmit,
|
|
5246
5264
|
onRetry
|
|
5247
5265
|
}) => {
|
|
5248
5266
|
const intl = (0, import_react_intl18.useIntl)();
|
|
5249
|
-
return /* @__PURE__ */ (0,
|
|
5250
|
-
/* @__PURE__ */ (0,
|
|
5251
|
-
|
|
5267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
|
|
5268
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5269
|
+
import_components22.Button,
|
|
5252
5270
|
{
|
|
5253
5271
|
className: "m-b-1",
|
|
5254
5272
|
block: true,
|
|
5255
|
-
size:
|
|
5256
|
-
type:
|
|
5273
|
+
size: import_components22.Size.MEDIUM,
|
|
5274
|
+
type: import_components22.ControlType.ACCENT,
|
|
5257
5275
|
onClick: onSubmit,
|
|
5258
5276
|
children: intl.formatMessage(CameraCapture_messages_default.reviewSubmit)
|
|
5259
5277
|
}
|
|
5260
5278
|
),
|
|
5261
|
-
/* @__PURE__ */ (0,
|
|
5262
|
-
|
|
5279
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5280
|
+
import_components22.Button,
|
|
5263
5281
|
{
|
|
5264
5282
|
className: "m-b-2",
|
|
5265
5283
|
block: true,
|
|
5266
|
-
size:
|
|
5267
|
-
type:
|
|
5268
|
-
priority:
|
|
5284
|
+
size: import_components22.Size.MEDIUM,
|
|
5285
|
+
type: import_components22.ControlType.ACCENT,
|
|
5286
|
+
priority: import_components22.Priority.SECONDARY,
|
|
5269
5287
|
onClick: onRetry,
|
|
5270
5288
|
children: intl.formatMessage(CameraCapture_messages_default.reviewRetry)
|
|
5271
5289
|
}
|
|
5272
5290
|
)
|
|
5273
5291
|
] }) }) });
|
|
5274
5292
|
};
|
|
5275
|
-
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
5293
|
+
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5276
5294
|
"button",
|
|
5277
5295
|
{
|
|
5278
5296
|
type: "button",
|
|
5279
5297
|
className: "camera-capture-btn m-b-2",
|
|
5280
5298
|
"data-testid": "camera-capture-button",
|
|
5281
5299
|
onClick,
|
|
5282
|
-
children: /* @__PURE__ */ (0,
|
|
5300
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "camera-capture-btn-inner" })
|
|
5283
5301
|
}
|
|
5284
5302
|
);
|
|
5285
5303
|
|
|
@@ -5359,7 +5377,7 @@ var useVideoConstraints = (direction) => {
|
|
|
5359
5377
|
|
|
5360
5378
|
// src/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
5361
5379
|
var import_react31 = require("react");
|
|
5362
|
-
var
|
|
5380
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
5363
5381
|
var captureButtonHeight = 92;
|
|
5364
5382
|
var reviewButtonsHeight = 120;
|
|
5365
5383
|
var imageHeight = 40;
|
|
@@ -5388,18 +5406,18 @@ var Overlay = ({
|
|
|
5388
5406
|
return () => window.removeEventListener("resize", listener);
|
|
5389
5407
|
});
|
|
5390
5408
|
let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
|
|
5391
|
-
let helperBox = /* @__PURE__ */ (0,
|
|
5392
|
-
imageUrl && /* @__PURE__ */ (0,
|
|
5393
|
-
title && /* @__PURE__ */ (0,
|
|
5394
|
-
instructions && /* @__PURE__ */ (0,
|
|
5409
|
+
let helperBox = /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
5410
|
+
imageUrl && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
|
|
5411
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("h4", { className: "camera-capture-title", children: title }),
|
|
5412
|
+
instructions && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("small", { className: "camera-capture-instructions", children: instructions })
|
|
5395
5413
|
] });
|
|
5396
5414
|
const frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
5397
5415
|
if (reviewInstructions) {
|
|
5398
5416
|
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
5399
|
-
helperBox = /* @__PURE__ */ (0,
|
|
5417
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
|
|
5400
5418
|
const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
5401
5419
|
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
5402
|
-
helperBox = /* @__PURE__ */ (0,
|
|
5420
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, {});
|
|
5403
5421
|
}
|
|
5404
5422
|
}
|
|
5405
5423
|
const framePosition = {
|
|
@@ -5417,20 +5435,20 @@ var Overlay = ({
|
|
|
5417
5435
|
width: "90%"
|
|
5418
5436
|
}
|
|
5419
5437
|
};
|
|
5420
|
-
return /* @__PURE__ */ (0,
|
|
5421
|
-
/* @__PURE__ */ (0,
|
|
5422
|
-
/* @__PURE__ */ (0,
|
|
5423
|
-
/* @__PURE__ */ (0,
|
|
5438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
5439
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("mask", { id: "mask", children: [
|
|
5440
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
|
|
5441
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("image", __spreadValues({ href: overlay }, framePosition))
|
|
5424
5442
|
] }) }),
|
|
5425
|
-
overlay && /* @__PURE__ */ (0,
|
|
5426
|
-
outline && /* @__PURE__ */ (0,
|
|
5427
|
-
/* @__PURE__ */ (0,
|
|
5443
|
+
overlay && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
|
|
5444
|
+
outline && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("image", __spreadValues({ href: outline }, framePosition)),
|
|
5445
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
|
|
5428
5446
|
] });
|
|
5429
5447
|
};
|
|
5430
5448
|
var Overlay_default = Overlay;
|
|
5431
5449
|
|
|
5432
5450
|
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
|
|
5433
|
-
var
|
|
5451
|
+
var import_components23 = require("@transferwise/components");
|
|
5434
5452
|
var import_react_intl20 = require("react-intl");
|
|
5435
5453
|
|
|
5436
5454
|
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.ts
|
|
@@ -5454,13 +5472,13 @@ var NoCameraAccess_messages_default = (0, import_react_intl19.defineMessages)({
|
|
|
5454
5472
|
});
|
|
5455
5473
|
|
|
5456
5474
|
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
|
|
5457
|
-
var
|
|
5475
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
5458
5476
|
var NoCameraAccess = ({ onAction }) => {
|
|
5459
5477
|
const intl = (0, import_react_intl20.useIntl)();
|
|
5460
|
-
return /* @__PURE__ */ (0,
|
|
5461
|
-
/* @__PURE__ */ (0,
|
|
5462
|
-
/* @__PURE__ */ (0,
|
|
5463
|
-
/* @__PURE__ */ (0,
|
|
5478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { id: "no-camera-access", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
5479
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(NoCameraAccess_messages_default.title) }),
|
|
5480
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(NoCameraAccess_messages_default.paragraph) }),
|
|
5481
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components23.Button, { block: true, onClick: onAction, children: intl.formatMessage(NoCameraAccess_messages_default.action) })
|
|
5464
5482
|
] }) }) }) });
|
|
5465
5483
|
};
|
|
5466
5484
|
var NoCameraAccess_default = NoCameraAccess;
|
|
@@ -5484,12 +5502,12 @@ var CameraNotSupported_messages_default = (0, import_react_intl21.defineMessages
|
|
|
5484
5502
|
});
|
|
5485
5503
|
|
|
5486
5504
|
// src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
|
|
5487
|
-
var
|
|
5505
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
5488
5506
|
var CameraNotSupported = () => {
|
|
5489
5507
|
const intl = (0, import_react_intl22.useIntl)();
|
|
5490
|
-
return /* @__PURE__ */ (0,
|
|
5491
|
-
/* @__PURE__ */ (0,
|
|
5492
|
-
/* @__PURE__ */ (0,
|
|
5508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { id: "camera-not-supported", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
5509
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(CameraNotSupported_messages_default.title) }),
|
|
5510
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(CameraNotSupported_messages_default.paragraph) })
|
|
5493
5511
|
] }) }) }) });
|
|
5494
5512
|
};
|
|
5495
5513
|
var CameraNotSupported_default = CameraNotSupported;
|
|
@@ -5514,7 +5532,7 @@ var getCameraStartedProperties = async (props, videoStream) => {
|
|
|
5514
5532
|
};
|
|
5515
5533
|
|
|
5516
5534
|
// src/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
5517
|
-
var
|
|
5535
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
5518
5536
|
var CameraCapture = ({
|
|
5519
5537
|
direction = "back",
|
|
5520
5538
|
overlay = "",
|
|
@@ -5583,8 +5601,8 @@ var CameraCapture = ({
|
|
|
5583
5601
|
setReviewImage(void 0);
|
|
5584
5602
|
};
|
|
5585
5603
|
const handleRetryCameraAccess = () => setMode("CAPTURE");
|
|
5586
|
-
const captureScreen = /* @__PURE__ */ (0,
|
|
5587
|
-
videoConstraints && /* @__PURE__ */ (0,
|
|
5604
|
+
const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
5605
|
+
videoConstraints && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5588
5606
|
import_react_webcam.default,
|
|
5589
5607
|
{
|
|
5590
5608
|
ref: webcamReference,
|
|
@@ -5595,7 +5613,7 @@ var CameraCapture = ({
|
|
|
5595
5613
|
onUserMedia: handleUserMedia
|
|
5596
5614
|
}
|
|
5597
5615
|
),
|
|
5598
|
-
/* @__PURE__ */ (0,
|
|
5616
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5599
5617
|
Overlay_default,
|
|
5600
5618
|
{
|
|
5601
5619
|
overlay,
|
|
@@ -5605,11 +5623,11 @@ var CameraCapture = ({
|
|
|
5605
5623
|
instructions
|
|
5606
5624
|
}
|
|
5607
5625
|
),
|
|
5608
|
-
ready && /* @__PURE__ */ (0,
|
|
5626
|
+
ready && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(CaptureBottomBar, { onCapture: () => void handleCapture() })
|
|
5609
5627
|
] });
|
|
5610
|
-
const reviewScreen = /* @__PURE__ */ (0,
|
|
5611
|
-
/* @__PURE__ */ (0,
|
|
5612
|
-
/* @__PURE__ */ (0,
|
|
5628
|
+
const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
5629
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
|
|
5630
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5613
5631
|
Overlay_default,
|
|
5614
5632
|
{
|
|
5615
5633
|
overlay,
|
|
@@ -5619,19 +5637,19 @@ var CameraCapture = ({
|
|
|
5619
5637
|
reviewInstructions: intl.formatMessage(CameraCapture_messages_default.reviewInstructions)
|
|
5620
5638
|
}
|
|
5621
5639
|
),
|
|
5622
|
-
/* @__PURE__ */ (0,
|
|
5640
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
|
|
5623
5641
|
] });
|
|
5624
|
-
return /* @__PURE__ */ (0,
|
|
5642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("section", { className: "camera-capture", children: [
|
|
5625
5643
|
mode === "CAPTURE" && captureScreen,
|
|
5626
5644
|
mode === "REVIEW" && reviewScreen,
|
|
5627
|
-
mode === "NO_CAMERA_ACCESS" && /* @__PURE__ */ (0,
|
|
5628
|
-
mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0,
|
|
5645
|
+
mode === "NO_CAMERA_ACCESS" && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(NoCameraAccess_default, { onAction: handleRetryCameraAccess }),
|
|
5646
|
+
mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(CameraNotSupported_default, {})
|
|
5629
5647
|
] });
|
|
5630
5648
|
};
|
|
5631
5649
|
var CameraCapture_default = CameraCapture;
|
|
5632
5650
|
|
|
5633
5651
|
// src/step/cameraStep/CameraStep.tsx
|
|
5634
|
-
var
|
|
5652
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
5635
5653
|
function blobToBase64(blob) {
|
|
5636
5654
|
return new Promise((resolve, _) => {
|
|
5637
5655
|
const reader = new FileReader();
|
|
@@ -5669,7 +5687,7 @@ var CameraStep = (props) => {
|
|
|
5669
5687
|
});
|
|
5670
5688
|
}
|
|
5671
5689
|
};
|
|
5672
|
-
return /* @__PURE__ */ (0,
|
|
5690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5673
5691
|
CameraCapture_default,
|
|
5674
5692
|
{
|
|
5675
5693
|
overlay,
|
|
@@ -5746,12 +5764,12 @@ var ExternalConfirmationStep_messages_default = (0, import_react_intl24.defineMe
|
|
|
5746
5764
|
});
|
|
5747
5765
|
|
|
5748
5766
|
// src/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
5749
|
-
var
|
|
5767
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
5750
5768
|
var noop5 = () => {
|
|
5751
5769
|
};
|
|
5752
5770
|
var ExternalConfirmationStep = ({ url, onClose }) => {
|
|
5753
5771
|
const { formatMessage } = (0, import_react_intl25.useIntl)();
|
|
5754
|
-
return /* @__PURE__ */ (0,
|
|
5772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5755
5773
|
DynamicLayout_default,
|
|
5756
5774
|
{
|
|
5757
5775
|
components: [
|
|
@@ -5816,7 +5834,7 @@ function getOrigin(url) {
|
|
|
5816
5834
|
}
|
|
5817
5835
|
|
|
5818
5836
|
// src/dynamicFlow/DynamicFlowStep.tsx
|
|
5819
|
-
var
|
|
5837
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
5820
5838
|
var DynamicFlowStep = (props) => {
|
|
5821
5839
|
var _a;
|
|
5822
5840
|
const { step, globalError } = props;
|
|
@@ -5826,14 +5844,14 @@ var DynamicFlowStep = (props) => {
|
|
|
5826
5844
|
return null;
|
|
5827
5845
|
}
|
|
5828
5846
|
if (externalUrl && requiresManualTrigger) {
|
|
5829
|
-
return /* @__PURE__ */ (0,
|
|
5847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
|
|
5830
5848
|
}
|
|
5831
5849
|
if (isCameraStep(step)) {
|
|
5832
|
-
return /* @__PURE__ */ (0,
|
|
5850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(CameraStep_default, __spreadProps(__spreadValues({}, props), { step }));
|
|
5833
5851
|
}
|
|
5834
|
-
return /* @__PURE__ */ (0,
|
|
5835
|
-
globalError ? /* @__PURE__ */ (0,
|
|
5836
|
-
/* @__PURE__ */ (0,
|
|
5852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
5853
|
+
globalError ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
|
|
5854
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step }))
|
|
5837
5855
|
] });
|
|
5838
5856
|
};
|
|
5839
5857
|
|
|
@@ -5952,19 +5970,19 @@ var isInlineSchema = (schema) => {
|
|
|
5952
5970
|
};
|
|
5953
5971
|
|
|
5954
5972
|
// src/dynamicFlow/utils/useLoader.tsx
|
|
5955
|
-
var
|
|
5973
|
+
var import_components25 = require("@transferwise/components");
|
|
5956
5974
|
var import_react36 = require("react");
|
|
5957
|
-
var
|
|
5975
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
5958
5976
|
function useLoader(loaderConfig, initialState) {
|
|
5959
5977
|
const config = __spreadValues({
|
|
5960
|
-
size:
|
|
5978
|
+
size: import_components25.Size.EXTRA_LARGE,
|
|
5961
5979
|
initial: true,
|
|
5962
5980
|
submission: false
|
|
5963
5981
|
}, loaderConfig);
|
|
5964
5982
|
const [loadingState, setLoadingState] = (0, import_react36.useState)(initialState);
|
|
5965
5983
|
const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
|
|
5966
|
-
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0,
|
|
5967
|
-
|
|
5984
|
+
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5985
|
+
import_components25.Loader,
|
|
5968
5986
|
{
|
|
5969
5987
|
size: config.size,
|
|
5970
5988
|
classNames: { "tw-loader": "tw-loader m-x-auto" },
|
|
@@ -5978,7 +5996,7 @@ function useLoader(loaderConfig, initialState) {
|
|
|
5978
5996
|
var import_react37 = require("react");
|
|
5979
5997
|
|
|
5980
5998
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.tsx
|
|
5981
|
-
var
|
|
5999
|
+
var import_components26 = require("@transferwise/components");
|
|
5982
6000
|
var import_react_intl27 = require("react-intl");
|
|
5983
6001
|
|
|
5984
6002
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.ts
|
|
@@ -5997,18 +6015,18 @@ var ErrorBoundary_messages_default = (0, import_react_intl26.defineMessages)({
|
|
|
5997
6015
|
});
|
|
5998
6016
|
|
|
5999
6017
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.tsx
|
|
6000
|
-
var
|
|
6018
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
6001
6019
|
var ErrorBoundaryAlert = ({ onDismiss }) => {
|
|
6002
6020
|
const { formatMessage } = (0, import_react_intl27.useIntl)();
|
|
6003
|
-
return /* @__PURE__ */ (0,
|
|
6004
|
-
|
|
6021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
6022
|
+
import_components26.Alert,
|
|
6005
6023
|
{
|
|
6006
6024
|
action: {
|
|
6007
6025
|
text: formatMessage(ErrorBoundary_messages_default.retry),
|
|
6008
6026
|
href: window.location.href
|
|
6009
6027
|
},
|
|
6010
6028
|
message: formatMessage(ErrorBoundary_messages_default.errorAlert),
|
|
6011
|
-
type:
|
|
6029
|
+
type: import_components26.Sentiment.NEGATIVE,
|
|
6012
6030
|
className: "m-b-3",
|
|
6013
6031
|
onDismiss
|
|
6014
6032
|
}
|
|
@@ -6016,7 +6034,7 @@ var ErrorBoundaryAlert = ({ onDismiss }) => {
|
|
|
6016
6034
|
};
|
|
6017
6035
|
|
|
6018
6036
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundary.tsx
|
|
6019
|
-
var
|
|
6037
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
6020
6038
|
var noop6 = () => {
|
|
6021
6039
|
};
|
|
6022
6040
|
var ErrorBoundary = class extends import_react37.Component {
|
|
@@ -6037,8 +6055,8 @@ var ErrorBoundary = class extends import_react37.Component {
|
|
|
6037
6055
|
render() {
|
|
6038
6056
|
const { children } = this.props;
|
|
6039
6057
|
const { hasError, isFatalError } = this.state;
|
|
6040
|
-
return /* @__PURE__ */ (0,
|
|
6041
|
-
hasError && /* @__PURE__ */ (0,
|
|
6058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
6059
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ErrorBoundaryAlert, { onDismiss: this.handleErrorReset }),
|
|
6042
6060
|
!isFatalError && children
|
|
6043
6061
|
] });
|
|
6044
6062
|
}
|
|
@@ -6139,7 +6157,7 @@ var assertResponseIsValid = (response) => {
|
|
|
6139
6157
|
var isResponse = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
|
|
6140
6158
|
|
|
6141
6159
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
6142
|
-
var
|
|
6160
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
6143
6161
|
var noop7 = () => {
|
|
6144
6162
|
};
|
|
6145
6163
|
var DynamicFlowComponent = ({
|
|
@@ -6357,7 +6375,7 @@ var DynamicFlowComponent = ({
|
|
|
6357
6375
|
await actionHandler(action);
|
|
6358
6376
|
}
|
|
6359
6377
|
};
|
|
6360
|
-
return /* @__PURE__ */ (0,
|
|
6378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(LogProvider, { flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), onLog, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(DynamicFlowProvider, { loading: isLoading, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(HttpClientProvider, { httpClient, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6361
6379
|
DynamicFlowStep,
|
|
6362
6380
|
{
|
|
6363
6381
|
step,
|
|
@@ -6373,7 +6391,7 @@ var DynamicFlowComponent = ({
|
|
|
6373
6391
|
}
|
|
6374
6392
|
) }) }) }) });
|
|
6375
6393
|
};
|
|
6376
|
-
var DynamicFlow = (props) => /* @__PURE__ */ (0,
|
|
6394
|
+
var DynamicFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(DynamicFlowComponent, __spreadValues({}, props)) });
|
|
6377
6395
|
var DynamicFlow_default = DynamicFlow;
|
|
6378
6396
|
var combineModels2 = (formModels) => {
|
|
6379
6397
|
return Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
|