@wise/dynamic-flow-client 3.24.1 → 3.25.1
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
|
@@ -6989,12 +6989,18 @@ var alertLayoutToComponent = (uid, { control, markdown, margin = "md", context =
|
|
|
6989
6989
|
control,
|
|
6990
6990
|
markdown,
|
|
6991
6991
|
margin,
|
|
6992
|
-
callToAction:
|
|
6992
|
+
callToAction: getComponentCallToAction(callToAction, onAction),
|
|
6993
6993
|
context: mapLegacyContext(context)
|
|
6994
6994
|
});
|
|
6995
6995
|
};
|
|
6996
6996
|
var getComponentCallToAction = (callToAction, onAction) => {
|
|
6997
|
+
if (!callToAction) {
|
|
6998
|
+
return void 0;
|
|
6999
|
+
}
|
|
6997
7000
|
const { accessibilityDescription, behavior, title } = callToAction;
|
|
7001
|
+
if ("type" in behavior) {
|
|
7002
|
+
return void 0;
|
|
7003
|
+
}
|
|
6998
7004
|
if (behavior.link) {
|
|
6999
7005
|
const { url } = behavior.link;
|
|
7000
7006
|
return {
|
|
@@ -7095,9 +7101,13 @@ var buttonLayoutToComponent = (uid, button, mapperProps) => {
|
|
|
7095
7101
|
var buttonLayoutToComponentWithBehavior = (uid, button, mapperProps) => {
|
|
7096
7102
|
const { onAction, onLink, step } = mapperProps;
|
|
7097
7103
|
const { context, control, disabled, margin = "md", pinOrder, size, title, behavior } = button;
|
|
7098
|
-
const
|
|
7099
|
-
|
|
7100
|
-
|
|
7104
|
+
const getOnClick = () => {
|
|
7105
|
+
if ("type" in behavior) {
|
|
7106
|
+
return () => {
|
|
7107
|
+
};
|
|
7108
|
+
}
|
|
7109
|
+
const { action, link } = behavior;
|
|
7110
|
+
const inlinedAction = action ? inlineAction(action, step == null ? void 0 : step.actions) : null;
|
|
7101
7111
|
if (inlinedAction) {
|
|
7102
7112
|
return () => {
|
|
7103
7113
|
void onAction(inlinedAction);
|
|
@@ -7110,7 +7120,7 @@ var buttonLayoutToComponentWithBehavior = (uid, button, mapperProps) => {
|
|
|
7110
7120
|
}
|
|
7111
7121
|
return () => {
|
|
7112
7122
|
};
|
|
7113
|
-
}
|
|
7123
|
+
};
|
|
7114
7124
|
return createButtonComponent({
|
|
7115
7125
|
uid,
|
|
7116
7126
|
context: mapLegacyContext(context != null ? context : "neutral"),
|
|
@@ -7120,7 +7130,7 @@ var buttonLayoutToComponentWithBehavior = (uid, button, mapperProps) => {
|
|
|
7120
7130
|
pinOrder,
|
|
7121
7131
|
size,
|
|
7122
7132
|
title: title != null ? title : "",
|
|
7123
|
-
onClick
|
|
7133
|
+
onClick: getOnClick()
|
|
7124
7134
|
});
|
|
7125
7135
|
};
|
|
7126
7136
|
var buttonLayoutToComponentWithAction = (uid, button, mapperProps) => {
|
|
@@ -10133,23 +10143,57 @@ var createReviewComponent = (reviewProps) => __spreadProps(__spreadValues({
|
|
|
10133
10143
|
});
|
|
10134
10144
|
|
|
10135
10145
|
// src/revamp/domain/mappers/layout/reviewLayoutToComponent.ts
|
|
10136
|
-
var reviewLayoutToComponent = (uid, { fields, title, callToAction, control, margin = "md", orientation, action }, { onAction }) => createReviewComponent({
|
|
10146
|
+
var reviewLayoutToComponent = (uid, { fields, title, callToAction, control, margin = "md", orientation, action }, { onAction, onLink }) => createReviewComponent({
|
|
10137
10147
|
uid,
|
|
10138
|
-
callToAction: getReviewAction(onAction, callToAction, action),
|
|
10148
|
+
callToAction: getReviewAction({ onAction, onLink, callToAction, action }),
|
|
10139
10149
|
control: getOrientationControl({ control, orientation }),
|
|
10140
|
-
fields: fields.map((
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10150
|
+
fields: fields.map(({ label, value, rawValue, help }) => ({
|
|
10151
|
+
label,
|
|
10152
|
+
value,
|
|
10153
|
+
rawValue,
|
|
10154
|
+
help: help == null ? void 0 : help.markdown
|
|
10155
|
+
})),
|
|
10144
10156
|
margin,
|
|
10145
10157
|
title
|
|
10146
10158
|
});
|
|
10147
|
-
var getReviewAction = (onAction, callToAction, action) => {
|
|
10159
|
+
var getReviewAction = ({ onAction, onLink, callToAction, action }) => {
|
|
10148
10160
|
if (callToAction) {
|
|
10161
|
+
const { action: ctaAction, behavior, title } = callToAction;
|
|
10162
|
+
if (behavior) {
|
|
10163
|
+
if ("type" in behavior) {
|
|
10164
|
+
return void 0;
|
|
10165
|
+
}
|
|
10166
|
+
const { accessibilityDescription, action: behaviorAction, link } = behavior;
|
|
10167
|
+
const onClick = () => {
|
|
10168
|
+
if (behaviorAction) {
|
|
10169
|
+
return () => {
|
|
10170
|
+
void onAction(behaviorAction);
|
|
10171
|
+
};
|
|
10172
|
+
}
|
|
10173
|
+
if (link) {
|
|
10174
|
+
return () => {
|
|
10175
|
+
onLink(link.url);
|
|
10176
|
+
};
|
|
10177
|
+
}
|
|
10178
|
+
};
|
|
10179
|
+
return {
|
|
10180
|
+
accessibilityDescription,
|
|
10181
|
+
href: link == null ? void 0 : link.url,
|
|
10182
|
+
title,
|
|
10183
|
+
onClick
|
|
10184
|
+
};
|
|
10185
|
+
}
|
|
10186
|
+
if (ctaAction) {
|
|
10187
|
+
return {
|
|
10188
|
+
title,
|
|
10189
|
+
onClick: () => {
|
|
10190
|
+
void onAction(ctaAction);
|
|
10191
|
+
}
|
|
10192
|
+
};
|
|
10193
|
+
}
|
|
10149
10194
|
return {
|
|
10150
|
-
title
|
|
10195
|
+
title,
|
|
10151
10196
|
onClick: () => {
|
|
10152
|
-
void onAction(callToAction.action);
|
|
10153
10197
|
}
|
|
10154
10198
|
};
|
|
10155
10199
|
}
|
|
@@ -10323,18 +10367,32 @@ var createStatusListComponent = (statusListProps) => __spreadProps(__spreadValue
|
|
|
10323
10367
|
var statusListLayoutToComponent = (uid, { control, items, margin = "md", title }, { onAction, onLink }) => createStatusListComponent({
|
|
10324
10368
|
uid,
|
|
10325
10369
|
control,
|
|
10326
|
-
items: items.map((item) => {
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
callToAction: item.callToAction ? getItemCallToAction(item.callToAction, onAction, onLink) : void 0
|
|
10331
|
-
});
|
|
10332
|
-
}),
|
|
10370
|
+
items: items.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
10371
|
+
href: getItemHref(item.callToAction),
|
|
10372
|
+
callToAction: getItemCallToAction(item.callToAction, onAction, onLink)
|
|
10373
|
+
})),
|
|
10333
10374
|
margin,
|
|
10334
10375
|
title
|
|
10335
10376
|
});
|
|
10377
|
+
var getItemHref = (callToAction) => {
|
|
10378
|
+
var _a;
|
|
10379
|
+
if (!callToAction) {
|
|
10380
|
+
return void 0;
|
|
10381
|
+
}
|
|
10382
|
+
const { behavior } = callToAction;
|
|
10383
|
+
if ("type" in behavior) {
|
|
10384
|
+
return void 0;
|
|
10385
|
+
}
|
|
10386
|
+
return (_a = behavior == null ? void 0 : behavior.link) == null ? void 0 : _a.url;
|
|
10387
|
+
};
|
|
10336
10388
|
var getItemCallToAction = (callToAction, onAction, onLink) => {
|
|
10389
|
+
if (!callToAction) {
|
|
10390
|
+
return void 0;
|
|
10391
|
+
}
|
|
10337
10392
|
const { accessibilityDescription, behavior, title } = callToAction;
|
|
10393
|
+
if ("type" in behavior) {
|
|
10394
|
+
return void 0;
|
|
10395
|
+
}
|
|
10338
10396
|
if (behavior.link) {
|
|
10339
10397
|
const { url } = behavior.link;
|
|
10340
10398
|
return {
|
|
@@ -13238,15 +13296,8 @@ var ReviewRenderer = {
|
|
|
13238
13296
|
canRenderType: "review",
|
|
13239
13297
|
render: ({ callToAction, control, fields, margin, title }) => {
|
|
13240
13298
|
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
13299
|
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 }),
|
|
13300
|
+
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_components37.Header, { title: title != null ? title : "", action: getReviewAction2(callToAction) }),
|
|
13250
13301
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
13251
13302
|
import_components37.DefinitionList,
|
|
13252
13303
|
{
|
|
@@ -13291,6 +13342,27 @@ var getFieldValue = (value, help, orientation) => {
|
|
|
13291
13342
|
}
|
|
13292
13343
|
return value;
|
|
13293
13344
|
};
|
|
13345
|
+
var getReviewAction2 = (callToAction) => {
|
|
13346
|
+
if (!callToAction) {
|
|
13347
|
+
return void 0;
|
|
13348
|
+
}
|
|
13349
|
+
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
13350
|
+
if (href) {
|
|
13351
|
+
return {
|
|
13352
|
+
"aria-label": accessibilityDescription,
|
|
13353
|
+
href,
|
|
13354
|
+
text: title
|
|
13355
|
+
};
|
|
13356
|
+
}
|
|
13357
|
+
return {
|
|
13358
|
+
"aria-label": accessibilityDescription,
|
|
13359
|
+
text: title,
|
|
13360
|
+
onClick: (event) => {
|
|
13361
|
+
event.preventDefault();
|
|
13362
|
+
onClick();
|
|
13363
|
+
}
|
|
13364
|
+
};
|
|
13365
|
+
};
|
|
13294
13366
|
|
|
13295
13367
|
// ../renderers/src/step/StepRenderer.tsx
|
|
13296
13368
|
var import_react19 = require("react");
|
|
@@ -18340,21 +18412,42 @@ var getDefinitionListLayout = (review) => {
|
|
|
18340
18412
|
}
|
|
18341
18413
|
};
|
|
18342
18414
|
function DynamicReview(props) {
|
|
18415
|
+
var _a;
|
|
18343
18416
|
const review = props.component;
|
|
18344
18417
|
const margin = getMargin2(review.margin || "xs");
|
|
18345
|
-
const
|
|
18346
|
-
|
|
18347
|
-
|
|
18348
|
-
|
|
18418
|
+
const getReviewAction3 = (callToAction2) => {
|
|
18419
|
+
const { title, action, behavior } = callToAction2;
|
|
18420
|
+
if (behavior) {
|
|
18421
|
+
const { action: behaviorAction, link } = behavior;
|
|
18422
|
+
if (link) {
|
|
18423
|
+
return {
|
|
18424
|
+
text: title != null ? title : "",
|
|
18425
|
+
href: link == null ? void 0 : link.url
|
|
18426
|
+
};
|
|
18427
|
+
}
|
|
18428
|
+
if (behaviorAction) {
|
|
18429
|
+
return {
|
|
18430
|
+
text: title != null ? title : "",
|
|
18431
|
+
onClick: behaviorAction ? getOnClick(behaviorAction) : void 0
|
|
18432
|
+
};
|
|
18433
|
+
}
|
|
18434
|
+
}
|
|
18435
|
+
return {
|
|
18436
|
+
text: title != null ? title : "",
|
|
18437
|
+
onClick: action ? getOnClick(action) : void 0
|
|
18438
|
+
};
|
|
18439
|
+
};
|
|
18440
|
+
const getOnClick = (action) => {
|
|
18441
|
+
return (event) => {
|
|
18349
18442
|
event.preventDefault();
|
|
18350
18443
|
if (action) {
|
|
18351
18444
|
props.onAction(action);
|
|
18352
18445
|
}
|
|
18353
|
-
}
|
|
18354
|
-
}
|
|
18446
|
+
};
|
|
18447
|
+
};
|
|
18355
18448
|
const orientation = getDefinitionListLayout(review);
|
|
18356
|
-
const callToAction = review.callToAction ?
|
|
18357
|
-
const legacyCallToAction = !callToAction && review.action ?
|
|
18449
|
+
const callToAction = review.callToAction ? getReviewAction3(review.callToAction) : null;
|
|
18450
|
+
const legacyCallToAction = !callToAction && review.action ? { text: (_a = review.action.title) != null ? _a : "", onClick: getOnClick(review.action) } : null;
|
|
18358
18451
|
return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: margin, children: [
|
|
18359
18452
|
review.title && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_components69.Header, { title: review.title, action: callToAction || legacyCallToAction || void 0 }),
|
|
18360
18453
|
/* @__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) }) })
|