@wise/dynamic-flow-client 3.25.0 → 3.25.2

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
@@ -6965,12 +6965,18 @@ var alertLayoutToComponent = (uid, { control, markdown, margin = "md", context =
6965
6965
  control,
6966
6966
  markdown,
6967
6967
  margin,
6968
- callToAction: callToAction ? getComponentCallToAction(callToAction, onAction) : void 0,
6968
+ callToAction: getComponentCallToAction(callToAction, onAction),
6969
6969
  context: mapLegacyContext(context)
6970
6970
  });
6971
6971
  };
6972
6972
  var getComponentCallToAction = (callToAction, onAction) => {
6973
+ if (!callToAction) {
6974
+ return void 0;
6975
+ }
6973
6976
  const { accessibilityDescription, behavior, title } = callToAction;
6977
+ if ("type" in behavior) {
6978
+ return void 0;
6979
+ }
6974
6980
  if (behavior.link) {
6975
6981
  const { url } = behavior.link;
6976
6982
  return {
@@ -7071,9 +7077,13 @@ var buttonLayoutToComponent = (uid, button, mapperProps) => {
7071
7077
  var buttonLayoutToComponentWithBehavior = (uid, button, mapperProps) => {
7072
7078
  const { onAction, onLink, step } = mapperProps;
7073
7079
  const { context, control, disabled, margin = "md", pinOrder, size, title, behavior } = button;
7074
- const { action, link } = behavior;
7075
- const inlinedAction = action ? inlineAction(action, step == null ? void 0 : step.actions) : null;
7076
- const onClick = (() => {
7080
+ const getOnClick = () => {
7081
+ if ("type" in behavior) {
7082
+ return () => {
7083
+ };
7084
+ }
7085
+ const { action, link } = behavior;
7086
+ const inlinedAction = action ? inlineAction(action, step == null ? void 0 : step.actions) : null;
7077
7087
  if (inlinedAction) {
7078
7088
  return () => {
7079
7089
  void onAction(inlinedAction);
@@ -7086,7 +7096,7 @@ var buttonLayoutToComponentWithBehavior = (uid, button, mapperProps) => {
7086
7096
  }
7087
7097
  return () => {
7088
7098
  };
7089
- })();
7099
+ };
7090
7100
  return createButtonComponent({
7091
7101
  uid,
7092
7102
  context: mapLegacyContext(context != null ? context : "neutral"),
@@ -7096,7 +7106,7 @@ var buttonLayoutToComponentWithBehavior = (uid, button, mapperProps) => {
7096
7106
  pinOrder,
7097
7107
  size,
7098
7108
  title: title != null ? title : "",
7099
- onClick
7109
+ onClick: getOnClick()
7100
7110
  });
7101
7111
  };
7102
7112
  var buttonLayoutToComponentWithAction = (uid, button, mapperProps) => {
@@ -10126,24 +10136,34 @@ var getReviewAction = ({ onAction, onLink, callToAction, action }) => {
10126
10136
  if (callToAction) {
10127
10137
  const { action: ctaAction, behavior, title } = callToAction;
10128
10138
  if (behavior) {
10139
+ if ("type" in behavior) {
10140
+ return void 0;
10141
+ }
10129
10142
  const { accessibilityDescription, action: behaviorAction, link } = behavior;
10130
- const onClick = () => {
10131
- if (behaviorAction) {
10132
- return () => {
10143
+ if (behaviorAction) {
10144
+ return {
10145
+ accessibilityDescription,
10146
+ title,
10147
+ onClick: () => {
10133
10148
  void onAction(behaviorAction);
10134
- };
10135
- }
10136
- if (link) {
10137
- return () => {
10149
+ }
10150
+ };
10151
+ }
10152
+ if (link) {
10153
+ return {
10154
+ accessibilityDescription,
10155
+ href: link.url,
10156
+ title,
10157
+ onClick: () => {
10138
10158
  onLink(link.url);
10139
- };
10140
- }
10141
- };
10159
+ }
10160
+ };
10161
+ }
10142
10162
  return {
10143
10163
  accessibilityDescription,
10144
- href: link == null ? void 0 : link.url,
10145
10164
  title,
10146
- onClick
10165
+ onClick: () => {
10166
+ }
10147
10167
  };
10148
10168
  }
10149
10169
  if (ctaAction) {
@@ -10330,40 +10350,59 @@ var createStatusListComponent = (statusListProps) => __spreadProps(__spreadValue
10330
10350
  var statusListLayoutToComponent = (uid, { control, items, margin = "md", title }, { onAction, onLink }) => createStatusListComponent({
10331
10351
  uid,
10332
10352
  control,
10333
- items: items.map((item) => {
10334
- var _a, _b, _c;
10335
- return __spreadProps(__spreadValues({}, item), {
10336
- href: (_c = (_b = (_a = item == null ? void 0 : item.callToAction) == null ? void 0 : _a.behavior) == null ? void 0 : _b.link) == null ? void 0 : _c.url,
10337
- callToAction: item.callToAction ? getItemCallToAction(item.callToAction, onAction, onLink) : void 0
10338
- });
10339
- }),
10353
+ items: items.map((item) => __spreadProps(__spreadValues({}, item), {
10354
+ href: getItemHref(item.callToAction),
10355
+ callToAction: getItemCallToAction(item.callToAction, onAction, onLink)
10356
+ })),
10340
10357
  margin,
10341
10358
  title
10342
10359
  });
10360
+ var getItemHref = (callToAction) => {
10361
+ var _a;
10362
+ if (!callToAction) {
10363
+ return void 0;
10364
+ }
10365
+ const { behavior } = callToAction;
10366
+ if ("type" in behavior) {
10367
+ return void 0;
10368
+ }
10369
+ return (_a = behavior == null ? void 0 : behavior.link) == null ? void 0 : _a.url;
10370
+ };
10343
10371
  var getItemCallToAction = (callToAction, onAction, onLink) => {
10372
+ if (!callToAction) {
10373
+ return void 0;
10374
+ }
10344
10375
  const { accessibilityDescription, behavior, title } = callToAction;
10345
- if (behavior.link) {
10346
- const { url } = behavior.link;
10376
+ if ("type" in behavior) {
10377
+ return void 0;
10378
+ }
10379
+ if (behavior.action) {
10380
+ const { action } = behavior;
10347
10381
  return {
10348
10382
  accessibilityDescription,
10349
- href: url,
10350
10383
  title,
10351
10384
  onClick: () => {
10352
- void onLink(url);
10385
+ void onAction(action);
10353
10386
  }
10354
10387
  };
10355
10388
  }
10356
- if (behavior.action) {
10357
- const { action } = behavior;
10389
+ if (behavior.link) {
10390
+ const { url } = behavior.link;
10358
10391
  return {
10359
10392
  accessibilityDescription,
10393
+ href: url,
10360
10394
  title,
10361
10395
  onClick: () => {
10362
- void onAction(action);
10396
+ void onLink(url);
10363
10397
  }
10364
10398
  };
10365
10399
  }
10366
- return void 0;
10400
+ return {
10401
+ accessibilityDescription,
10402
+ title,
10403
+ onClick: () => {
10404
+ }
10405
+ };
10367
10406
  };
10368
10407
 
10369
10408
  // src/revamp/domain/mappers/layout/listLayoutToComponent.ts
@@ -12997,19 +13036,32 @@ var StatusListRenderer = {
12997
13036
  description,
12998
13037
  icon: icon && "name" in icon ? /* @__PURE__ */ jsx50(DynamicIcon_default, { name: icon.name }) : null,
12999
13038
  status: mapStatus(status),
13000
- action: callToAction ? {
13001
- "aria-label": callToAction.accessibilityDescription,
13002
- href: callToAction.href,
13003
- text: callToAction.title,
13004
- target: callToAction.href ? "_blank" : void 0,
13005
- onClick: callToAction.href ? void 0 : callToAction.onClick
13006
- } : void 0
13039
+ action: getSummaryAction(callToAction)
13007
13040
  },
13008
13041
  `${itemTitle}/${description || ""}`
13009
13042
  ))
13010
13043
  ] })
13011
13044
  };
13012
13045
  var StatusListRenderer_default = StatusListRenderer;
13046
+ var getSummaryAction = (callToAction) => {
13047
+ if (!callToAction) {
13048
+ return void 0;
13049
+ }
13050
+ const { accessibilityDescription, href, title, onClick } = callToAction;
13051
+ if (!href) {
13052
+ return {
13053
+ "aria-label": accessibilityDescription,
13054
+ text: title,
13055
+ onClick
13056
+ };
13057
+ }
13058
+ return {
13059
+ "aria-label": accessibilityDescription,
13060
+ href,
13061
+ target: "_blank",
13062
+ text: title
13063
+ };
13064
+ };
13013
13065
  var mapStatus = (status) => {
13014
13066
  if (status === "not-done") {
13015
13067
  return "notDone";
@@ -13302,20 +13354,21 @@ var getReviewAction2 = (callToAction) => {
13302
13354
  return void 0;
13303
13355
  }
13304
13356
  const { accessibilityDescription, href, title, onClick } = callToAction;
13305
- if (href) {
13357
+ if (!href) {
13306
13358
  return {
13307
13359
  "aria-label": accessibilityDescription,
13308
- href,
13309
- text: title
13360
+ text: title,
13361
+ onClick: (event) => {
13362
+ event.preventDefault();
13363
+ onClick();
13364
+ }
13310
13365
  };
13311
13366
  }
13312
13367
  return {
13313
13368
  "aria-label": accessibilityDescription,
13314
- text: title,
13315
- onClick: (event) => {
13316
- event.preventDefault();
13317
- onClick();
13318
- }
13369
+ href,
13370
+ target: "_blank",
13371
+ text: title
13319
13372
  };
13320
13373
  };
13321
13374
 
@@ -18212,12 +18265,11 @@ var DynamicStatusList = ({ component, onAction }) => {
18212
18265
  var mapListItemToSummary = (props, onAction) => {
18213
18266
  const { title, description, icon, status } = props;
18214
18267
  const summaryProps = __spreadValues(__spreadValues({
18215
- key: `${title}/${description || ""}`,
18216
18268
  title,
18217
18269
  description,
18218
18270
  action: "callToAction" in props ? callToActionToSummaryAction(props == null ? void 0 : props.callToAction, onAction) : void 0
18219
18271
  }, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ jsx108(DynamicIcon_default2, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
18220
- return /* @__PURE__ */ jsx108(Summary2, __spreadValues({}, summaryProps));
18272
+ return /* @__PURE__ */ jsx108(Summary2, __spreadValues({}, summaryProps), `${title}/${description || ""}`);
18221
18273
  };
18222
18274
  var callToActionToSummaryAction = (callToAction, onAction) => {
18223
18275
  if (!callToAction) {
@@ -18243,7 +18295,12 @@ var callToActionToSummaryAction = (callToAction, onAction) => {
18243
18295
  }
18244
18296
  };
18245
18297
  }
18246
- return void 0;
18298
+ return {
18299
+ text: "title",
18300
+ "aria-label": accessibilityDescription,
18301
+ onClick: () => {
18302
+ }
18303
+ };
18247
18304
  };
18248
18305
  var statusListMap = {
18249
18306
  done: "done",
@@ -18389,16 +18446,16 @@ function DynamicReview(props) {
18389
18446
  const { title, action, behavior } = callToAction2;
18390
18447
  if (behavior) {
18391
18448
  const { action: behaviorAction, link } = behavior;
18392
- if (link) {
18449
+ if (behaviorAction) {
18393
18450
  return {
18394
18451
  text: title != null ? title : "",
18395
- href: link == null ? void 0 : link.url
18452
+ onClick: behaviorAction ? getOnClick(behaviorAction) : void 0
18396
18453
  };
18397
18454
  }
18398
- if (behaviorAction) {
18455
+ if (link) {
18399
18456
  return {
18400
18457
  text: title != null ? title : "",
18401
- onClick: behaviorAction ? getOnClick(behaviorAction) : void 0
18458
+ href: link == null ? void 0 : link.url
18402
18459
  };
18403
18460
  }
18404
18461
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "3.25.0",
3
+ "version": "3.25.2",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",