@wise/dynamic-flow-client 3.24.0 → 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.mjs
CHANGED
|
@@ -10109,23 +10109,54 @@ var createReviewComponent = (reviewProps) => __spreadProps(__spreadValues({
|
|
|
10109
10109
|
});
|
|
10110
10110
|
|
|
10111
10111
|
// src/revamp/domain/mappers/layout/reviewLayoutToComponent.ts
|
|
10112
|
-
var reviewLayoutToComponent = (uid, { fields, title, callToAction, control, margin = "md", orientation, action }, { onAction }) => createReviewComponent({
|
|
10112
|
+
var reviewLayoutToComponent = (uid, { fields, title, callToAction, control, margin = "md", orientation, action }, { onAction, onLink }) => createReviewComponent({
|
|
10113
10113
|
uid,
|
|
10114
|
-
callToAction: getReviewAction(onAction, callToAction, action),
|
|
10114
|
+
callToAction: getReviewAction({ onAction, onLink, callToAction, action }),
|
|
10115
10115
|
control: getOrientationControl({ control, orientation }),
|
|
10116
|
-
fields: fields.map((
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10116
|
+
fields: fields.map(({ label, value, rawValue, help }) => ({
|
|
10117
|
+
label,
|
|
10118
|
+
value,
|
|
10119
|
+
rawValue,
|
|
10120
|
+
help: help == null ? void 0 : help.markdown
|
|
10121
|
+
})),
|
|
10120
10122
|
margin,
|
|
10121
10123
|
title
|
|
10122
10124
|
});
|
|
10123
|
-
var getReviewAction = (onAction, callToAction, action) => {
|
|
10125
|
+
var getReviewAction = ({ onAction, onLink, callToAction, action }) => {
|
|
10124
10126
|
if (callToAction) {
|
|
10127
|
+
const { action: ctaAction, behavior, title } = callToAction;
|
|
10128
|
+
if (behavior) {
|
|
10129
|
+
const { accessibilityDescription, action: behaviorAction, link } = behavior;
|
|
10130
|
+
const onClick = () => {
|
|
10131
|
+
if (behaviorAction) {
|
|
10132
|
+
return () => {
|
|
10133
|
+
void onAction(behaviorAction);
|
|
10134
|
+
};
|
|
10135
|
+
}
|
|
10136
|
+
if (link) {
|
|
10137
|
+
return () => {
|
|
10138
|
+
onLink(link.url);
|
|
10139
|
+
};
|
|
10140
|
+
}
|
|
10141
|
+
};
|
|
10142
|
+
return {
|
|
10143
|
+
accessibilityDescription,
|
|
10144
|
+
href: link == null ? void 0 : link.url,
|
|
10145
|
+
title,
|
|
10146
|
+
onClick
|
|
10147
|
+
};
|
|
10148
|
+
}
|
|
10149
|
+
if (ctaAction) {
|
|
10150
|
+
return {
|
|
10151
|
+
title,
|
|
10152
|
+
onClick: () => {
|
|
10153
|
+
void onAction(ctaAction);
|
|
10154
|
+
}
|
|
10155
|
+
};
|
|
10156
|
+
}
|
|
10125
10157
|
return {
|
|
10126
|
-
title
|
|
10158
|
+
title,
|
|
10127
10159
|
onClick: () => {
|
|
10128
|
-
void onAction(callToAction.action);
|
|
10129
10160
|
}
|
|
10130
10161
|
};
|
|
10131
10162
|
}
|
|
@@ -13220,15 +13251,8 @@ var ReviewRenderer = {
|
|
|
13220
13251
|
canRenderType: "review",
|
|
13221
13252
|
render: ({ callToAction, control, fields, margin, title }) => {
|
|
13222
13253
|
const orientation = mapControlToDefinitionListLayout(control);
|
|
13223
|
-
const action = callToAction ? {
|
|
13224
|
-
text: callToAction.title,
|
|
13225
|
-
onClick: (event) => {
|
|
13226
|
-
event.preventDefault();
|
|
13227
|
-
callToAction.onClick();
|
|
13228
|
-
}
|
|
13229
|
-
} : void 0;
|
|
13230
13254
|
return /* @__PURE__ */ jsxs19("div", { className: getMargin(margin), children: [
|
|
13231
|
-
(title || callToAction) && /* @__PURE__ */ jsx54(Header6, { title: title != null ? title : "", action }),
|
|
13255
|
+
(title || callToAction) && /* @__PURE__ */ jsx54(Header6, { title: title != null ? title : "", action: getReviewAction2(callToAction) }),
|
|
13232
13256
|
/* @__PURE__ */ jsx54("div", { className: margin, children: /* @__PURE__ */ jsx54(
|
|
13233
13257
|
DefinitionList,
|
|
13234
13258
|
{
|
|
@@ -13273,6 +13297,27 @@ var getFieldValue = (value, help, orientation) => {
|
|
|
13273
13297
|
}
|
|
13274
13298
|
return value;
|
|
13275
13299
|
};
|
|
13300
|
+
var getReviewAction2 = (callToAction) => {
|
|
13301
|
+
if (!callToAction) {
|
|
13302
|
+
return void 0;
|
|
13303
|
+
}
|
|
13304
|
+
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
13305
|
+
if (href) {
|
|
13306
|
+
return {
|
|
13307
|
+
"aria-label": accessibilityDescription,
|
|
13308
|
+
href,
|
|
13309
|
+
text: title
|
|
13310
|
+
};
|
|
13311
|
+
}
|
|
13312
|
+
return {
|
|
13313
|
+
"aria-label": accessibilityDescription,
|
|
13314
|
+
text: title,
|
|
13315
|
+
onClick: (event) => {
|
|
13316
|
+
event.preventDefault();
|
|
13317
|
+
onClick();
|
|
13318
|
+
}
|
|
13319
|
+
};
|
|
13320
|
+
};
|
|
13276
13321
|
|
|
13277
13322
|
// ../renderers/src/step/StepRenderer.tsx
|
|
13278
13323
|
import { useMemo as useMemo3 } from "react";
|
|
@@ -18337,21 +18382,42 @@ var getDefinitionListLayout = (review) => {
|
|
|
18337
18382
|
}
|
|
18338
18383
|
};
|
|
18339
18384
|
function DynamicReview(props) {
|
|
18385
|
+
var _a;
|
|
18340
18386
|
const review = props.component;
|
|
18341
18387
|
const margin = getMargin2(review.margin || "xs");
|
|
18342
|
-
const
|
|
18343
|
-
|
|
18344
|
-
|
|
18345
|
-
|
|
18388
|
+
const getReviewAction3 = (callToAction2) => {
|
|
18389
|
+
const { title, action, behavior } = callToAction2;
|
|
18390
|
+
if (behavior) {
|
|
18391
|
+
const { action: behaviorAction, link } = behavior;
|
|
18392
|
+
if (link) {
|
|
18393
|
+
return {
|
|
18394
|
+
text: title != null ? title : "",
|
|
18395
|
+
href: link == null ? void 0 : link.url
|
|
18396
|
+
};
|
|
18397
|
+
}
|
|
18398
|
+
if (behaviorAction) {
|
|
18399
|
+
return {
|
|
18400
|
+
text: title != null ? title : "",
|
|
18401
|
+
onClick: behaviorAction ? getOnClick(behaviorAction) : void 0
|
|
18402
|
+
};
|
|
18403
|
+
}
|
|
18404
|
+
}
|
|
18405
|
+
return {
|
|
18406
|
+
text: title != null ? title : "",
|
|
18407
|
+
onClick: action ? getOnClick(action) : void 0
|
|
18408
|
+
};
|
|
18409
|
+
};
|
|
18410
|
+
const getOnClick = (action) => {
|
|
18411
|
+
return (event) => {
|
|
18346
18412
|
event.preventDefault();
|
|
18347
18413
|
if (action) {
|
|
18348
18414
|
props.onAction(action);
|
|
18349
18415
|
}
|
|
18350
|
-
}
|
|
18351
|
-
}
|
|
18416
|
+
};
|
|
18417
|
+
};
|
|
18352
18418
|
const orientation = getDefinitionListLayout(review);
|
|
18353
|
-
const callToAction = review.callToAction ?
|
|
18354
|
-
const legacyCallToAction = !callToAction && review.action ?
|
|
18419
|
+
const callToAction = review.callToAction ? getReviewAction3(review.callToAction) : null;
|
|
18420
|
+
const legacyCallToAction = !callToAction && review.action ? { text: (_a = review.action.title) != null ? _a : "", onClick: getOnClick(review.action) } : null;
|
|
18355
18421
|
return /* @__PURE__ */ jsxs40("div", { className: margin, children: [
|
|
18356
18422
|
review.title && /* @__PURE__ */ jsx111(Header14, { title: review.title, action: callToAction || legacyCallToAction || void 0 }),
|
|
18357
18423
|
/* @__PURE__ */ jsx111("div", { className: margin, children: /* @__PURE__ */ jsx111(DefinitionList3, { layout: orientation, definitions: getDefinitions(orientation, review) }) })
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ReviewLayout } from '@wise/dynamic-flow-types/build/next';
|
|
2
2
|
import type { MapperProps } from '../schema/types';
|
|
3
|
-
export declare const reviewLayoutToComponent: (uid: string, { fields, title, callToAction, control, margin, orientation, action }: ReviewLayout, { onAction }: MapperProps) => import("../../components/ReviewComponent").ReviewComponent;
|
|
3
|
+
export declare const reviewLayoutToComponent: (uid: string, { fields, title, callToAction, control, margin, orientation, action }: ReviewLayout, { onAction, onLink }: MapperProps) => import("../../components/ReviewComponent").ReviewComponent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.25.0",
|
|
4
4
|
"description": "Dynamic Flow web client",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./build/main.min.js",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"nanoid": "5.0.7",
|
|
102
102
|
"react-webcam": "^7.2.0",
|
|
103
103
|
"screenfull": "^5.2.0",
|
|
104
|
-
"@wise/dynamic-flow-types": "2.
|
|
104
|
+
"@wise/dynamic-flow-types": "2.27.0"
|
|
105
105
|
},
|
|
106
106
|
"scripts": {
|
|
107
107
|
"dev": "pnpm build:visual-tests && storybook dev -p 3003",
|