@wise/dynamic-flow-client 2.8.4 → 2.8.6
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 +53 -45
- package/build/main.min.js +1 -1
- package/build/types/common/messages/help.messages.d.ts +8 -0
- package/build/types/legacy/jsonSchemaForm/help/Help.d.ts +1 -1
- package/build/types/legacy/layout/paragraph/DynamicParagraph.d.ts +2 -2
- package/build/types/revamp/domain/components/AlertComponent.d.ts +1 -7
- package/build/types/revamp/domain/components/BoxComponent.d.ts +4 -11
- package/build/types/revamp/domain/components/ButtonComponent.d.ts +4 -13
- package/build/types/revamp/domain/components/ColumnsComponent.d.ts +3 -13
- package/build/types/revamp/domain/components/ContainerComponent.d.ts +11 -0
- package/build/types/revamp/domain/components/DateInputComponent.d.ts +10 -0
- package/build/types/revamp/domain/components/HeadingComponent.d.ts +2 -8
- package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/NumberInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/ObjectComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/ParagraphComponent.d.ts +2 -10
- package/build/types/revamp/domain/components/TextInputComponent.d.ts +2 -1
- package/build/types/revamp/domain/components/UploadInputComponent.d.ts +9 -0
- package/build/types/revamp/domain/mappers/layout/alertLayoutToComponent.d.ts +1 -2
- package/build/types/revamp/domain/mappers/layout/boxLayoutToComponents.d.ts +1 -1
- package/build/types/revamp/domain/mappers/layout/buttonLayoutToComponent.d.ts +1 -1
- package/build/types/revamp/domain/mappers/layout/columnsLayoutToComponent.d.ts +1 -1
- package/build/types/revamp/domain/mappers/layout/headingLayoutToComponent.d.ts +1 -2
- package/build/types/revamp/domain/mappers/layout/paragraphLayoutToComponent.d.ts +1 -2
- package/build/types/revamp/domain/mappers/schema/{objectSchemaToComponent.d.ts → objectSchemaToComponent/objectSchemaToComponent.d.ts} +2 -2
- package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToComponent.d.ts +5 -0
- package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToDateInputComponent.d.ts +5 -0
- package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToTextInputComponent.d.ts +5 -0
- package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToUploadInputComponent.d.ts +5 -0
- package/build/types/revamp/domain/types.d.ts +8 -3
- package/build/types/revamp/renderers/CoreContainerRenderer.d.ts +7 -0
- package/build/types/revamp/renderers/mappers/alertComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/boxComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/containerComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/dateInputComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/headingComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/objectComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/paragraphComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/uploadInputComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/types.d.ts +26 -8
- package/build/types/revamp/utils/type-utils.d.ts +2 -2
- package/build/types/revamp/wise/renderers/DateInputRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/UploadInputRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/components/FieldInput.d.ts +10 -0
- package/build/types/revamp/wise/renderers/components/VariableDateInput.d.ts +9 -0
- package/build/types/revamp/wise/renderers/components/VariableTextInput.d.ts +10 -0
- package/build/types/revamp/wise/renderers/hooks/useSnackBarIfAvailable.d.ts +10 -0
- package/build/types/revamp/wise/renderers/utils/input-utils.d.ts +1 -0
- package/build/types/revamp/wise/renderers/utils/value-utils.d.ts +3 -0
- package/build/types/revamp/wise/renderers/validators/type-validators.d.ts +9 -0
- package/package.json +2 -2
- package/build/types/legacy/jsonSchemaForm/help/Help.messages.d.ts +0 -8
- package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent.d.ts +0 -5
- /package/build/types/{legacy/layout/paragraph/DynamicParagraph.messages.d.ts → common/messages/paragraph.messages.d.ts} +0 -0
- /package/build/types/common/{validationMessages → messages}/validation.messages.d.ts +0 -0
package/build/main.js
CHANGED
|
@@ -2541,19 +2541,23 @@ var DynamicColumns_default = DynamicColumns;
|
|
|
2541
2541
|
var import_components4 = require("@transferwise/components");
|
|
2542
2542
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2543
2543
|
function DynamicDecision({ component, onAction }) {
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2544
|
+
const { loading } = useDynamicFlow();
|
|
2545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getMargin(component.margin), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_components4.NavigationOptionsList, { children: component.options.map((option) => {
|
|
2546
|
+
var _a;
|
|
2547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2548
|
+
import_components4.NavigationOption,
|
|
2549
|
+
{
|
|
2550
|
+
title: option.title,
|
|
2551
|
+
content: option.description,
|
|
2552
|
+
disabled: (_a = option.disabled) != null ? _a : loading,
|
|
2553
|
+
media: getNavigationOptionMedia(option),
|
|
2554
|
+
showMediaCircle: false,
|
|
2555
|
+
showMediaAtAllSizes: true,
|
|
2556
|
+
onClick: () => onAction(option.action)
|
|
2557
|
+
},
|
|
2558
|
+
JSON.stringify(option)
|
|
2559
|
+
);
|
|
2560
|
+
}) }) });
|
|
2557
2561
|
}
|
|
2558
2562
|
var DynamicDecision_default = DynamicDecision;
|
|
2559
2563
|
|
|
@@ -2666,7 +2670,7 @@ var import_components7 = require("@transferwise/components");
|
|
|
2666
2670
|
var import_formatting = require("@transferwise/formatting");
|
|
2667
2671
|
var import_react_intl5 = require("react-intl");
|
|
2668
2672
|
|
|
2669
|
-
// src/common/
|
|
2673
|
+
// src/common/messages/validation.messages.ts
|
|
2670
2674
|
var import_react_intl4 = require("react-intl");
|
|
2671
2675
|
var validation_messages_default = (0, import_react_intl4.defineMessages)({
|
|
2672
2676
|
type: {
|
|
@@ -3520,9 +3524,9 @@ var import_react17 = require("react");
|
|
|
3520
3524
|
var import_components11 = require("@transferwise/components");
|
|
3521
3525
|
var import_react_intl13 = require("react-intl");
|
|
3522
3526
|
|
|
3523
|
-
// src/
|
|
3527
|
+
// src/common/messages/help.messages.ts
|
|
3524
3528
|
var import_react_intl12 = require("react-intl");
|
|
3525
|
-
var
|
|
3529
|
+
var help_messages_default = (0, import_react_intl12.defineMessages)({
|
|
3526
3530
|
helpAria: {
|
|
3527
3531
|
id: "dynamicFlows.Help.ariaLabel",
|
|
3528
3532
|
defaultMessage: "Click here for more info.",
|
|
@@ -3532,7 +3536,7 @@ var Help_messages_default = (0, import_react_intl12.defineMessages)({
|
|
|
3532
3536
|
|
|
3533
3537
|
// src/legacy/jsonSchemaForm/help/Help.tsx
|
|
3534
3538
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3535
|
-
|
|
3539
|
+
function Help(props) {
|
|
3536
3540
|
const intl = (0, import_react_intl13.useIntl)();
|
|
3537
3541
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3538
3542
|
import_components11.Info,
|
|
@@ -3541,10 +3545,10 @@ var Help = (props) => {
|
|
|
3541
3545
|
content: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components11.Markdown, { children: props.help.markdown }),
|
|
3542
3546
|
presentation: "POPOVER",
|
|
3543
3547
|
size: "sm",
|
|
3544
|
-
"aria-label": intl.formatMessage(
|
|
3548
|
+
"aria-label": intl.formatMessage(help_messages_default.helpAria)
|
|
3545
3549
|
}
|
|
3546
3550
|
);
|
|
3547
|
-
}
|
|
3551
|
+
}
|
|
3548
3552
|
var Help_default = Help;
|
|
3549
3553
|
|
|
3550
3554
|
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
@@ -5350,9 +5354,9 @@ var DynamicLoadingIndicator_default = DynamicLoadingIndicator;
|
|
|
5350
5354
|
var import_components26 = require("@transferwise/components");
|
|
5351
5355
|
var import_react_intl17 = require("react-intl");
|
|
5352
5356
|
|
|
5353
|
-
// src/
|
|
5357
|
+
// src/common/messages/paragraph.messages.ts
|
|
5354
5358
|
var import_react_intl16 = require("react-intl");
|
|
5355
|
-
var
|
|
5359
|
+
var paragraph_messages_default = (0, import_react_intl16.defineMessages)({
|
|
5356
5360
|
copy: {
|
|
5357
5361
|
id: "dynamicFlows.DynamicParagraph.copy",
|
|
5358
5362
|
defaultMessage: "Copy",
|
|
@@ -5377,21 +5381,28 @@ function noop2() {
|
|
|
5377
5381
|
|
|
5378
5382
|
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
5379
5383
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
"
|
|
5385
|
-
|
|
5386
|
-
|
|
5384
|
+
function DynamicParagraph({ component }) {
|
|
5385
|
+
return component.control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BasicDynamicParagraph, { component });
|
|
5386
|
+
}
|
|
5387
|
+
function BasicDynamicParagraph({ component }) {
|
|
5388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("p", { className: getTextAlignmentAndMargin(component), children: [
|
|
5389
|
+
" ",
|
|
5390
|
+
component.text,
|
|
5391
|
+
" "
|
|
5392
|
+
] });
|
|
5393
|
+
}
|
|
5394
|
+
function CopyableDynamicParagraph({ component }) {
|
|
5387
5395
|
const { formatMessage } = (0, import_react_intl17.useIntl)();
|
|
5388
5396
|
const createSnackbar = useSnackBarIfAvailable();
|
|
5389
5397
|
const { text } = component;
|
|
5390
5398
|
const copy = () => {
|
|
5391
5399
|
var _a;
|
|
5392
|
-
(_a = navigator.clipboard) == null ? void 0 : _a.writeText(text).then(() => createSnackbar({ text: formatMessage(
|
|
5400
|
+
(_a = navigator.clipboard) == null ? void 0 : _a.writeText(text).then(() => createSnackbar({ text: formatMessage(paragraph_messages_default.copied) })).catch(noop3);
|
|
5393
5401
|
};
|
|
5394
|
-
const classNames8 = getTextAlignmentAndMargin({
|
|
5402
|
+
const classNames8 = `${getTextAlignmentAndMargin({
|
|
5403
|
+
align: component.align,
|
|
5404
|
+
margin: "sm"
|
|
5405
|
+
})} form-control`;
|
|
5395
5406
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: getTextAlignmentAndMargin(component), children: [
|
|
5396
5407
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5397
5408
|
"input",
|
|
@@ -5403,9 +5414,9 @@ var CopyableDynamicParagraph = ({ component }) => {
|
|
|
5403
5414
|
style: { textOverflow: "ellipsis" }
|
|
5404
5415
|
}
|
|
5405
5416
|
),
|
|
5406
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components26.Button, { block: true, onClick: copy, children: formatMessage(
|
|
5417
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components26.Button, { block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
5407
5418
|
] });
|
|
5408
|
-
}
|
|
5419
|
+
}
|
|
5409
5420
|
function noop3() {
|
|
5410
5421
|
}
|
|
5411
5422
|
var DynamicParagraph_default = DynamicParagraph;
|
|
@@ -7304,9 +7315,16 @@ var DynamicFlowComponent = ({
|
|
|
7304
7315
|
dispatchEvent("Dynamic Flow - Step Submitted", { actionId: action.id || action.$id });
|
|
7305
7316
|
try {
|
|
7306
7317
|
const response = await dfHttpClient({ action, data });
|
|
7318
|
+
if (action.exit && response.ok) {
|
|
7319
|
+
await handleExitResponse(response, action.result);
|
|
7320
|
+
return;
|
|
7321
|
+
}
|
|
7307
7322
|
await handleResponse(response, "submission");
|
|
7308
7323
|
} catch (error) {
|
|
7309
|
-
completeWithError(
|
|
7324
|
+
completeWithError(
|
|
7325
|
+
error,
|
|
7326
|
+
action.exit ? "Error fetching exit result" : "Error fetching next step"
|
|
7327
|
+
);
|
|
7310
7328
|
}
|
|
7311
7329
|
};
|
|
7312
7330
|
const performRefresh = async (url, data, etag2) => {
|
|
@@ -7319,15 +7337,6 @@ var DynamicFlowComponent = ({
|
|
|
7319
7337
|
completeWithError(error, "Error fetching refresh step");
|
|
7320
7338
|
}
|
|
7321
7339
|
};
|
|
7322
|
-
const performExitAction = async (action, data) => {
|
|
7323
|
-
setLoadingState("submission");
|
|
7324
|
-
try {
|
|
7325
|
-
const response = await dfHttpClient({ action, data });
|
|
7326
|
-
await handleExitResponse(response, action.result);
|
|
7327
|
-
} catch (error) {
|
|
7328
|
-
completeWithError(error, "Error fetching exit result");
|
|
7329
|
-
}
|
|
7330
|
-
};
|
|
7331
7340
|
const handleExitResponse = async (response, actionResult) => {
|
|
7332
7341
|
const exitResult = await getJsonObjectOrNull(response);
|
|
7333
7342
|
dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), actionResult));
|
|
@@ -7443,7 +7452,6 @@ var DynamicFlowComponent = ({
|
|
|
7443
7452
|
dispatchEventAndComplete(action.result);
|
|
7444
7453
|
return;
|
|
7445
7454
|
}
|
|
7446
|
-
const actionHandler = action.exit ? performExitAction : performAction;
|
|
7447
7455
|
const { data, method, skipValidation } = action;
|
|
7448
7456
|
const submissionData = __spreadValues(__spreadValues({}, combineModels2(models)), data);
|
|
7449
7457
|
if (isSubmissionMethod(method)) {
|
|
@@ -7452,10 +7460,10 @@ var DynamicFlowComponent = ({
|
|
|
7452
7460
|
setSubmitted(true);
|
|
7453
7461
|
}
|
|
7454
7462
|
if (modelIsValid || skipValidation) {
|
|
7455
|
-
await
|
|
7463
|
+
await performAction(action, submissionData);
|
|
7456
7464
|
}
|
|
7457
7465
|
} else {
|
|
7458
|
-
await
|
|
7466
|
+
await performAction(action);
|
|
7459
7467
|
}
|
|
7460
7468
|
};
|
|
7461
7469
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(LogProvider, { flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), onLog, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(DynamicFlowProvider, { loading: isLoading, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(HttpClientProvider, { httpClient, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(FeatureContextProvider, { features, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|