@wise/dynamic-flow-client 3.24.1 → 3.25.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
|
@@ -10133,23 +10133,54 @@ var createReviewComponent = (reviewProps) => __spreadProps(__spreadValues({
|
|
|
10133
10133
|
});
|
|
10134
10134
|
|
|
10135
10135
|
// src/revamp/domain/mappers/layout/reviewLayoutToComponent.ts
|
|
10136
|
-
var reviewLayoutToComponent = (uid, { fields, title, callToAction, control, margin = "md", orientation, action }, { onAction }) => createReviewComponent({
|
|
10136
|
+
var reviewLayoutToComponent = (uid, { fields, title, callToAction, control, margin = "md", orientation, action }, { onAction, onLink }) => createReviewComponent({
|
|
10137
10137
|
uid,
|
|
10138
|
-
callToAction: getReviewAction(onAction, callToAction, action),
|
|
10138
|
+
callToAction: getReviewAction({ onAction, onLink, callToAction, action }),
|
|
10139
10139
|
control: getOrientationControl({ control, orientation }),
|
|
10140
|
-
fields: fields.map((
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10140
|
+
fields: fields.map(({ label, value, rawValue, help }) => ({
|
|
10141
|
+
label,
|
|
10142
|
+
value,
|
|
10143
|
+
rawValue,
|
|
10144
|
+
help: help == null ? void 0 : help.markdown
|
|
10145
|
+
})),
|
|
10144
10146
|
margin,
|
|
10145
10147
|
title
|
|
10146
10148
|
});
|
|
10147
|
-
var getReviewAction = (onAction, callToAction, action) => {
|
|
10149
|
+
var getReviewAction = ({ onAction, onLink, callToAction, action }) => {
|
|
10148
10150
|
if (callToAction) {
|
|
10151
|
+
const { action: ctaAction, behavior, title } = callToAction;
|
|
10152
|
+
if (behavior) {
|
|
10153
|
+
const { accessibilityDescription, action: behaviorAction, link } = behavior;
|
|
10154
|
+
const onClick = () => {
|
|
10155
|
+
if (behaviorAction) {
|
|
10156
|
+
return () => {
|
|
10157
|
+
void onAction(behaviorAction);
|
|
10158
|
+
};
|
|
10159
|
+
}
|
|
10160
|
+
if (link) {
|
|
10161
|
+
return () => {
|
|
10162
|
+
onLink(link.url);
|
|
10163
|
+
};
|
|
10164
|
+
}
|
|
10165
|
+
};
|
|
10166
|
+
return {
|
|
10167
|
+
accessibilityDescription,
|
|
10168
|
+
href: link == null ? void 0 : link.url,
|
|
10169
|
+
title,
|
|
10170
|
+
onClick
|
|
10171
|
+
};
|
|
10172
|
+
}
|
|
10173
|
+
if (ctaAction) {
|
|
10174
|
+
return {
|
|
10175
|
+
title,
|
|
10176
|
+
onClick: () => {
|
|
10177
|
+
void onAction(ctaAction);
|
|
10178
|
+
}
|
|
10179
|
+
};
|
|
10180
|
+
}
|
|
10149
10181
|
return {
|
|
10150
|
-
title
|
|
10182
|
+
title,
|
|
10151
10183
|
onClick: () => {
|
|
10152
|
-
void onAction(callToAction.action);
|
|
10153
10184
|
}
|
|
10154
10185
|
};
|
|
10155
10186
|
}
|
|
@@ -13238,15 +13269,8 @@ var ReviewRenderer = {
|
|
|
13238
13269
|
canRenderType: "review",
|
|
13239
13270
|
render: ({ callToAction, control, fields, margin, title }) => {
|
|
13240
13271
|
const orientation = mapControlToDefinitionListLayout(control);
|
|
13241
|
-
const action = callToAction ? {
|
|
13242
|
-
text: callToAction.title,
|
|
13243
|
-
onClick: (event) => {
|
|
13244
|
-
event.preventDefault();
|
|
13245
|
-
callToAction.onClick();
|
|
13246
|
-
}
|
|
13247
|
-
} : void 0;
|
|
13248
13272
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: getMargin(margin), children: [
|
|
13249
|
-
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_components37.Header, { title: title != null ? title : "", action }),
|
|
13273
|
+
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_components37.Header, { title: title != null ? title : "", action: getReviewAction2(callToAction) }),
|
|
13250
13274
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
13251
13275
|
import_components37.DefinitionList,
|
|
13252
13276
|
{
|
|
@@ -13291,6 +13315,27 @@ var getFieldValue = (value, help, orientation) => {
|
|
|
13291
13315
|
}
|
|
13292
13316
|
return value;
|
|
13293
13317
|
};
|
|
13318
|
+
var getReviewAction2 = (callToAction) => {
|
|
13319
|
+
if (!callToAction) {
|
|
13320
|
+
return void 0;
|
|
13321
|
+
}
|
|
13322
|
+
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
13323
|
+
if (href) {
|
|
13324
|
+
return {
|
|
13325
|
+
"aria-label": accessibilityDescription,
|
|
13326
|
+
href,
|
|
13327
|
+
text: title
|
|
13328
|
+
};
|
|
13329
|
+
}
|
|
13330
|
+
return {
|
|
13331
|
+
"aria-label": accessibilityDescription,
|
|
13332
|
+
text: title,
|
|
13333
|
+
onClick: (event) => {
|
|
13334
|
+
event.preventDefault();
|
|
13335
|
+
onClick();
|
|
13336
|
+
}
|
|
13337
|
+
};
|
|
13338
|
+
};
|
|
13294
13339
|
|
|
13295
13340
|
// ../renderers/src/step/StepRenderer.tsx
|
|
13296
13341
|
var import_react19 = require("react");
|
|
@@ -18340,21 +18385,42 @@ var getDefinitionListLayout = (review) => {
|
|
|
18340
18385
|
}
|
|
18341
18386
|
};
|
|
18342
18387
|
function DynamicReview(props) {
|
|
18388
|
+
var _a;
|
|
18343
18389
|
const review = props.component;
|
|
18344
18390
|
const margin = getMargin2(review.margin || "xs");
|
|
18345
|
-
const
|
|
18346
|
-
|
|
18347
|
-
|
|
18348
|
-
|
|
18391
|
+
const getReviewAction3 = (callToAction2) => {
|
|
18392
|
+
const { title, action, behavior } = callToAction2;
|
|
18393
|
+
if (behavior) {
|
|
18394
|
+
const { action: behaviorAction, link } = behavior;
|
|
18395
|
+
if (link) {
|
|
18396
|
+
return {
|
|
18397
|
+
text: title != null ? title : "",
|
|
18398
|
+
href: link == null ? void 0 : link.url
|
|
18399
|
+
};
|
|
18400
|
+
}
|
|
18401
|
+
if (behaviorAction) {
|
|
18402
|
+
return {
|
|
18403
|
+
text: title != null ? title : "",
|
|
18404
|
+
onClick: behaviorAction ? getOnClick(behaviorAction) : void 0
|
|
18405
|
+
};
|
|
18406
|
+
}
|
|
18407
|
+
}
|
|
18408
|
+
return {
|
|
18409
|
+
text: title != null ? title : "",
|
|
18410
|
+
onClick: action ? getOnClick(action) : void 0
|
|
18411
|
+
};
|
|
18412
|
+
};
|
|
18413
|
+
const getOnClick = (action) => {
|
|
18414
|
+
return (event) => {
|
|
18349
18415
|
event.preventDefault();
|
|
18350
18416
|
if (action) {
|
|
18351
18417
|
props.onAction(action);
|
|
18352
18418
|
}
|
|
18353
|
-
}
|
|
18354
|
-
}
|
|
18419
|
+
};
|
|
18420
|
+
};
|
|
18355
18421
|
const orientation = getDefinitionListLayout(review);
|
|
18356
|
-
const callToAction = review.callToAction ?
|
|
18357
|
-
const legacyCallToAction = !callToAction && review.action ?
|
|
18422
|
+
const callToAction = review.callToAction ? getReviewAction3(review.callToAction) : null;
|
|
18423
|
+
const legacyCallToAction = !callToAction && review.action ? { text: (_a = review.action.title) != null ? _a : "", onClick: getOnClick(review.action) } : null;
|
|
18358
18424
|
return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: margin, children: [
|
|
18359
18425
|
review.title && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_components69.Header, { title: review.title, action: callToAction || legacyCallToAction || void 0 }),
|
|
18360
18426
|
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_components69.DefinitionList, { layout: orientation, definitions: getDefinitions(orientation, review) }) })
|