@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.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: callToAction ? getComponentCallToAction(callToAction, onAction) : void 0,
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 { action, link } = behavior;
7099
- const inlinedAction = action ? inlineAction(action, step == null ? void 0 : step.actions) : null;
7100
- const onClick = (() => {
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) => {
@@ -10150,24 +10160,34 @@ var getReviewAction = ({ onAction, onLink, callToAction, action }) => {
10150
10160
  if (callToAction) {
10151
10161
  const { action: ctaAction, behavior, title } = callToAction;
10152
10162
  if (behavior) {
10163
+ if ("type" in behavior) {
10164
+ return void 0;
10165
+ }
10153
10166
  const { accessibilityDescription, action: behaviorAction, link } = behavior;
10154
- const onClick = () => {
10155
- if (behaviorAction) {
10156
- return () => {
10167
+ if (behaviorAction) {
10168
+ return {
10169
+ accessibilityDescription,
10170
+ title,
10171
+ onClick: () => {
10157
10172
  void onAction(behaviorAction);
10158
- };
10159
- }
10160
- if (link) {
10161
- return () => {
10173
+ }
10174
+ };
10175
+ }
10176
+ if (link) {
10177
+ return {
10178
+ accessibilityDescription,
10179
+ href: link.url,
10180
+ title,
10181
+ onClick: () => {
10162
10182
  onLink(link.url);
10163
- };
10164
- }
10165
- };
10183
+ }
10184
+ };
10185
+ }
10166
10186
  return {
10167
10187
  accessibilityDescription,
10168
- href: link == null ? void 0 : link.url,
10169
10188
  title,
10170
- onClick
10189
+ onClick: () => {
10190
+ }
10171
10191
  };
10172
10192
  }
10173
10193
  if (ctaAction) {
@@ -10354,40 +10374,59 @@ var createStatusListComponent = (statusListProps) => __spreadProps(__spreadValue
10354
10374
  var statusListLayoutToComponent = (uid, { control, items, margin = "md", title }, { onAction, onLink }) => createStatusListComponent({
10355
10375
  uid,
10356
10376
  control,
10357
- items: items.map((item) => {
10358
- var _a, _b, _c;
10359
- return __spreadProps(__spreadValues({}, item), {
10360
- 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,
10361
- callToAction: item.callToAction ? getItemCallToAction(item.callToAction, onAction, onLink) : void 0
10362
- });
10363
- }),
10377
+ items: items.map((item) => __spreadProps(__spreadValues({}, item), {
10378
+ href: getItemHref(item.callToAction),
10379
+ callToAction: getItemCallToAction(item.callToAction, onAction, onLink)
10380
+ })),
10364
10381
  margin,
10365
10382
  title
10366
10383
  });
10384
+ var getItemHref = (callToAction) => {
10385
+ var _a;
10386
+ if (!callToAction) {
10387
+ return void 0;
10388
+ }
10389
+ const { behavior } = callToAction;
10390
+ if ("type" in behavior) {
10391
+ return void 0;
10392
+ }
10393
+ return (_a = behavior == null ? void 0 : behavior.link) == null ? void 0 : _a.url;
10394
+ };
10367
10395
  var getItemCallToAction = (callToAction, onAction, onLink) => {
10396
+ if (!callToAction) {
10397
+ return void 0;
10398
+ }
10368
10399
  const { accessibilityDescription, behavior, title } = callToAction;
10369
- if (behavior.link) {
10370
- const { url } = behavior.link;
10400
+ if ("type" in behavior) {
10401
+ return void 0;
10402
+ }
10403
+ if (behavior.action) {
10404
+ const { action } = behavior;
10371
10405
  return {
10372
10406
  accessibilityDescription,
10373
- href: url,
10374
10407
  title,
10375
10408
  onClick: () => {
10376
- void onLink(url);
10409
+ void onAction(action);
10377
10410
  }
10378
10411
  };
10379
10412
  }
10380
- if (behavior.action) {
10381
- const { action } = behavior;
10413
+ if (behavior.link) {
10414
+ const { url } = behavior.link;
10382
10415
  return {
10383
10416
  accessibilityDescription,
10417
+ href: url,
10384
10418
  title,
10385
10419
  onClick: () => {
10386
- void onAction(action);
10420
+ void onLink(url);
10387
10421
  }
10388
10422
  };
10389
10423
  }
10390
- return void 0;
10424
+ return {
10425
+ accessibilityDescription,
10426
+ title,
10427
+ onClick: () => {
10428
+ }
10429
+ };
10391
10430
  };
10392
10431
 
10393
10432
  // src/revamp/domain/mappers/layout/listLayoutToComponent.ts
@@ -13021,19 +13060,32 @@ var StatusListRenderer = {
13021
13060
  description,
13022
13061
  icon: icon && "name" in icon ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(DynamicIcon_default, { name: icon.name }) : null,
13023
13062
  status: mapStatus(status),
13024
- action: callToAction ? {
13025
- "aria-label": callToAction.accessibilityDescription,
13026
- href: callToAction.href,
13027
- text: callToAction.title,
13028
- target: callToAction.href ? "_blank" : void 0,
13029
- onClick: callToAction.href ? void 0 : callToAction.onClick
13030
- } : void 0
13063
+ action: getSummaryAction(callToAction)
13031
13064
  },
13032
13065
  `${itemTitle}/${description || ""}`
13033
13066
  ))
13034
13067
  ] })
13035
13068
  };
13036
13069
  var StatusListRenderer_default = StatusListRenderer;
13070
+ var getSummaryAction = (callToAction) => {
13071
+ if (!callToAction) {
13072
+ return void 0;
13073
+ }
13074
+ const { accessibilityDescription, href, title, onClick } = callToAction;
13075
+ if (!href) {
13076
+ return {
13077
+ "aria-label": accessibilityDescription,
13078
+ text: title,
13079
+ onClick
13080
+ };
13081
+ }
13082
+ return {
13083
+ "aria-label": accessibilityDescription,
13084
+ href,
13085
+ target: "_blank",
13086
+ text: title
13087
+ };
13088
+ };
13037
13089
  var mapStatus = (status) => {
13038
13090
  if (status === "not-done") {
13039
13091
  return "notDone";
@@ -13320,20 +13372,21 @@ var getReviewAction2 = (callToAction) => {
13320
13372
  return void 0;
13321
13373
  }
13322
13374
  const { accessibilityDescription, href, title, onClick } = callToAction;
13323
- if (href) {
13375
+ if (!href) {
13324
13376
  return {
13325
13377
  "aria-label": accessibilityDescription,
13326
- href,
13327
- text: title
13378
+ text: title,
13379
+ onClick: (event) => {
13380
+ event.preventDefault();
13381
+ onClick();
13382
+ }
13328
13383
  };
13329
13384
  }
13330
13385
  return {
13331
13386
  "aria-label": accessibilityDescription,
13332
- text: title,
13333
- onClick: (event) => {
13334
- event.preventDefault();
13335
- onClick();
13336
- }
13387
+ href,
13388
+ target: "_blank",
13389
+ text: title
13337
13390
  };
13338
13391
  };
13339
13392
 
@@ -18215,12 +18268,11 @@ var DynamicStatusList = ({ component, onAction }) => {
18215
18268
  var mapListItemToSummary = (props, onAction) => {
18216
18269
  const { title, description, icon, status } = props;
18217
18270
  const summaryProps = __spreadValues(__spreadValues({
18218
- key: `${title}/${description || ""}`,
18219
18271
  title,
18220
18272
  description,
18221
18273
  action: "callToAction" in props ? callToActionToSummaryAction(props == null ? void 0 : props.callToAction, onAction) : void 0
18222
18274
  }, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DynamicIcon_default2, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
18223
- return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_components65.Summary, __spreadValues({}, summaryProps));
18275
+ return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_components65.Summary, __spreadValues({}, summaryProps), `${title}/${description || ""}`);
18224
18276
  };
18225
18277
  var callToActionToSummaryAction = (callToAction, onAction) => {
18226
18278
  if (!callToAction) {
@@ -18246,7 +18298,12 @@ var callToActionToSummaryAction = (callToAction, onAction) => {
18246
18298
  }
18247
18299
  };
18248
18300
  }
18249
- return void 0;
18301
+ return {
18302
+ text: "title",
18303
+ "aria-label": accessibilityDescription,
18304
+ onClick: () => {
18305
+ }
18306
+ };
18250
18307
  };
18251
18308
  var statusListMap = {
18252
18309
  done: "done",
@@ -18392,16 +18449,16 @@ function DynamicReview(props) {
18392
18449
  const { title, action, behavior } = callToAction2;
18393
18450
  if (behavior) {
18394
18451
  const { action: behaviorAction, link } = behavior;
18395
- if (link) {
18452
+ if (behaviorAction) {
18396
18453
  return {
18397
18454
  text: title != null ? title : "",
18398
- href: link == null ? void 0 : link.url
18455
+ onClick: behaviorAction ? getOnClick(behaviorAction) : void 0
18399
18456
  };
18400
18457
  }
18401
- if (behaviorAction) {
18458
+ if (link) {
18402
18459
  return {
18403
18460
  text: title != null ? title : "",
18404
- onClick: behaviorAction ? getOnClick(behaviorAction) : void 0
18461
+ href: link == null ? void 0 : link.url
18405
18462
  };
18406
18463
  }
18407
18464
  }