@wise/dynamic-flow-client-internal 4.25.0-experimental-cd1bec2 → 4.25.0-experimental-91c6dca

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
@@ -65,6 +65,7 @@ __export(index_exports, {
65
65
  Header: () => Header11,
66
66
  JsonSchemaForm: () => import_dynamic_flow_client4.JsonSchemaForm,
67
67
  findRendererPropsByType: () => import_dynamic_flow_client4.findRendererPropsByType,
68
+ getListItemRenderers: () => getListItemRenderers2,
68
69
  getMargin: () => getMargin2,
69
70
  isValidSchema: () => import_dynamic_flow_client4.isValidSchema,
70
71
  makeCustomFetch: () => import_dynamic_flow_client3.makeHttpClient,
@@ -841,7 +842,7 @@ var OPTION_GROUPS = {
841
842
  recent: "recent"
842
843
  };
843
844
  var GroupedList = (_a) => {
844
- var _b = _a, { renderDecisionList: renderDecisionList2 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
845
+ var _b = _a, { renderDecisionList: renderDecisionList3 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
845
846
  const { formatMessage } = (0, import_react_intl6.useIntl)();
846
847
  const { options } = rest;
847
848
  const popularOptions = options.filter((option) => option.tag === OPTION_GROUPS.popular);
@@ -849,15 +850,15 @@ var GroupedList = (_a) => {
849
850
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
850
851
  popularOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components12.Section, { children: [
851
852
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components12.Header, { as: "h2", title: formatMessage(decision_messages_default.popular) }),
852
- renderDecisionList2(__spreadProps(__spreadValues({}, rest), { options: popularOptions }))
853
+ renderDecisionList3(__spreadProps(__spreadValues({}, rest), { options: popularOptions }))
853
854
  ] }) : null,
854
855
  recentOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components12.Section, { children: [
855
856
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components12.Header, { as: "h2", title: formatMessage(decision_messages_default.recent) }),
856
- renderDecisionList2(__spreadProps(__spreadValues({}, rest), { options: recentOptions }))
857
+ renderDecisionList3(__spreadProps(__spreadValues({}, rest), { options: recentOptions }))
857
858
  ] }) : null,
858
859
  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components12.Section, { children: [
859
860
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components12.Header, { as: "h2", title: formatMessage(decision_messages_default.all) }),
860
- renderDecisionList2(rest)
861
+ renderDecisionList3(rest)
861
862
  ] })
862
863
  ] });
863
864
  };
@@ -917,13 +918,13 @@ var DecisionWrapper = (props) => {
917
918
  ] });
918
919
  };
919
920
  var UnfilteredDecisionList = (_a) => {
920
- var _b = _a, { renderDecisionList: renderDecisionList2 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
921
- return isGroupedDecision(rest.options) ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GroupedList, __spreadProps(__spreadValues({}, rest), { renderDecisionList: renderDecisionList2 })) : renderDecisionList2(rest);
921
+ var _b = _a, { renderDecisionList: renderDecisionList3 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
922
+ return isGroupedDecision(rest.options) ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GroupedList, __spreadProps(__spreadValues({}, rest), { renderDecisionList: renderDecisionList3 })) : renderDecisionList3(rest);
922
923
  };
923
924
  var FilteredDecisionList = (props) => {
924
925
  const { formatMessage } = (0, import_react_intl7.useIntl)();
925
926
  const [query, setQuery] = (0, import_react3.useState)("");
926
- const { control, options, renderDecisionList: renderDecisionList2 } = props;
927
+ const { control, options, renderDecisionList: renderDecisionList3 } = props;
927
928
  const filteredOptions = filterAndSortDecisionOptions(options, query);
928
929
  const isGrouped = isGroupedDecision(options);
929
930
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
@@ -940,7 +941,7 @@ var FilteredDecisionList = (props) => {
940
941
  ),
941
942
  isGrouped && query.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GroupedList, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
942
943
  query.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components13.Header, { as: "h2", title: formatMessage(decision_messages_default.results), className: "m-t-4" }),
943
- filteredOptions.length > 0 ? renderDecisionList2({
944
+ filteredOptions.length > 0 ? renderDecisionList3({
944
945
  control,
945
946
  className: query.length === 0 ? "m-t-3" : "",
946
947
  options: filteredOptions
@@ -3152,31 +3153,231 @@ var import_components53 = require("@transferwise/components");
3152
3153
  // ../renderers/src/NewListItem/getInlineAlert.tsx
3153
3154
  var import_components51 = require("@transferwise/components");
3154
3155
  var import_jsx_runtime73 = require("react/jsx-runtime");
3156
+ var getInlineAlert = (inlineAlert) => inlineAlert ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_components51.ListItem.Prompt, { sentiment: inlineAlert == null ? void 0 : inlineAlert.context, children: inlineAlert.content }) : void 0;
3155
3157
 
3156
3158
  // ../renderers/src/NewListItem/getMedia.tsx
3157
3159
  var import_jsx_runtime74 = require("react/jsx-runtime");
3160
+ var getMedia = (media, preferAvatar) => media ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(OptionMedia, { media, preferAvatar }) : void 0;
3158
3161
 
3159
3162
  // ../renderers/src/NewListItem/getAdditionalInfo.tsx
3160
3163
  var import_components52 = require("@transferwise/components");
3161
3164
  var import_jsx_runtime75 = require("react/jsx-runtime");
3165
+ var getAdditionalInfo = (additionalInfo) => {
3166
+ if (!additionalInfo) {
3167
+ return void 0;
3168
+ }
3169
+ const { href, text, onClick } = additionalInfo;
3170
+ if (href || onClick) {
3171
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
3172
+ import_components52.ListItem.AdditionalInfo,
3173
+ {
3174
+ action: {
3175
+ label: text,
3176
+ href,
3177
+ onClick,
3178
+ target: "_blank"
3179
+ }
3180
+ }
3181
+ );
3182
+ }
3183
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_components52.ListItem.AdditionalInfo, { children: additionalInfo == null ? void 0 : additionalInfo.text });
3184
+ };
3162
3185
 
3163
3186
  // ../renderers/src/NewListItem/NewDecisionRenderer.tsx
3164
3187
  var import_jsx_runtime76 = require("react/jsx-runtime");
3188
+ var DecisionRenderer2 = {
3189
+ canRenderType: "decision",
3190
+ render: (props) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(DecisionWrapper, __spreadProps(__spreadValues({}, props), { renderDecisionList: renderDecisionList2 }))
3191
+ };
3192
+ var renderDecisionList2 = ({ options, control }) => {
3193
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_jsx_runtime76.Fragment, { children: options.map((option) => {
3194
+ const {
3195
+ description,
3196
+ disabled,
3197
+ media,
3198
+ title: itemTitle,
3199
+ tag,
3200
+ href,
3201
+ additionalText,
3202
+ inlineAlert,
3203
+ supportingValues,
3204
+ onClick
3205
+ } = option;
3206
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
3207
+ import_components53.ListItem,
3208
+ {
3209
+ title: itemTitle,
3210
+ subtitle: description,
3211
+ spotlight: control === "spotlight" ? tag === "spotlight-active" ? "active" : "inactive" : void 0,
3212
+ disabled,
3213
+ valueTitle: supportingValues == null ? void 0 : supportingValues.value,
3214
+ valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
3215
+ media: getMedia(media, control === "with-avatar" || tag === "with-avatar"),
3216
+ prompt: getInlineAlert(inlineAlert),
3217
+ additionalInfo: additionalText ? getAdditionalInfo({ text: additionalText }) : void 0,
3218
+ control: href ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_components53.ListItem.Navigation, { href, target: "_blank" }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_components53.ListItem.Navigation, { onClick })
3219
+ },
3220
+ JSON.stringify(option)
3221
+ );
3222
+ }) });
3223
+ };
3224
+ var NewDecisionRenderer_default = DecisionRenderer2;
3165
3225
 
3166
3226
  // ../renderers/src/NewListItem/NewListRenderer.tsx
3167
3227
  var import_components54 = require("@transferwise/components");
3168
3228
  var import_jsx_runtime77 = require("react/jsx-runtime");
3229
+ var ListRenderer2 = {
3230
+ canRenderType: "list",
3231
+ render: ({ callToAction, control, margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: getMargin(margin), children: [
3232
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Header7, { title, callToAction }),
3233
+ items.map((item) => {
3234
+ const {
3235
+ title: itemTitle,
3236
+ description,
3237
+ supportingValues,
3238
+ media,
3239
+ tag,
3240
+ additionalInfo,
3241
+ inlineAlert
3242
+ } = item;
3243
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
3244
+ import_components54.ListItem,
3245
+ {
3246
+ title: itemTitle,
3247
+ subtitle: description,
3248
+ valueTitle: supportingValues == null ? void 0 : supportingValues.value,
3249
+ valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
3250
+ media: getMedia(media, control === "with-avatar" || tag === "with-avatar"),
3251
+ prompt: getInlineAlert(inlineAlert),
3252
+ additionalInfo: getAdditionalInfo(additionalInfo)
3253
+ },
3254
+ itemTitle
3255
+ );
3256
+ })
3257
+ ] })
3258
+ };
3259
+ var NewListRenderer_default = ListRenderer2;
3169
3260
 
3170
3261
  // ../renderers/src/NewListItem/NewReviewRenderer.tsx
3171
3262
  var import_components55 = require("@transferwise/components");
3172
3263
  var import_icons4 = require("@transferwise/icons");
3173
3264
  var import_jsx_runtime78 = require("react/jsx-runtime");
3265
+ var IGNORED_CONTROLS = [
3266
+ "horizontal",
3267
+ "horizontal-end-aligned",
3268
+ "horizontal-start-aligned",
3269
+ "vertical-two-column"
3270
+ ];
3271
+ var ReviewRenderer2 = {
3272
+ canRenderType: "review",
3273
+ canRender: ({ control }) => control ? !IGNORED_CONTROLS.includes(control) : true,
3274
+ render: ({ callToAction, control, margin, fields, title }) => /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: getMargin(margin), children: [
3275
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Header7, { title, callToAction }),
3276
+ fields.map((field) => {
3277
+ var _a;
3278
+ const {
3279
+ label,
3280
+ value,
3281
+ media,
3282
+ tag,
3283
+ additionalInfo,
3284
+ inlineAlert,
3285
+ help,
3286
+ callToAction: itemCallToAction
3287
+ } = field;
3288
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
3289
+ import_components55.ListItem,
3290
+ {
3291
+ title: value,
3292
+ subtitle: label,
3293
+ inverted: true,
3294
+ media: getMedia(media, control === "with-avatar" || tag === "with-avatar"),
3295
+ control: (_a = getCTAControl(itemCallToAction)) != null ? _a : getHelpControl(help),
3296
+ prompt: getInlineAlert(inlineAlert),
3297
+ additionalInfo: getAdditionalInfo(additionalInfo)
3298
+ },
3299
+ JSON.stringify(field)
3300
+ );
3301
+ })
3302
+ ] })
3303
+ };
3304
+ var getCTAControl = (callToAction) => {
3305
+ if (!callToAction) {
3306
+ return void 0;
3307
+ }
3308
+ const { accessibilityDescription, href, title, onClick } = callToAction;
3309
+ if (href) {
3310
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_components55.ListItem.Button, { href, partiallyInteractive: true, "aria-description": accessibilityDescription, children: title });
3311
+ }
3312
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
3313
+ import_components55.ListItem.Button,
3314
+ {
3315
+ "aria-description": accessibilityDescription,
3316
+ partiallyInteractive: true,
3317
+ onClick,
3318
+ children: title
3319
+ }
3320
+ );
3321
+ };
3322
+ var getHelpControl = (help) => {
3323
+ if (!help) {
3324
+ return void 0;
3325
+ }
3326
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_components55.Popover, { content: help, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_components55.ListItem.IconButton, { partiallyInteractive: true, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_icons4.QuestionMarkCircle, {}) }) });
3327
+ };
3328
+ var NewReviewRenderer_default = ReviewRenderer2;
3174
3329
 
3175
3330
  // ../renderers/src/NewListItem/NewStatusListRenderer.tsx
3176
3331
  var import_components56 = require("@transferwise/components");
3177
3332
  var import_jsx_runtime79 = require("react/jsx-runtime");
3333
+ var NewStatusListRenderer = {
3334
+ canRenderType: "status-list",
3335
+ render: ({ margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: getMargin(margin), children: [
3336
+ title ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components56.Header, { title, className: "m-b-2" }) : null,
3337
+ items.map((item) => {
3338
+ const { callToAction, description, icon, status, title: itemTitle } = item;
3339
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
3340
+ import_components56.ListItem,
3341
+ {
3342
+ title: itemTitle,
3343
+ subtitle: description,
3344
+ media: icon && "name" in icon ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components56.AvatarView, { badge: { status: mapStatus2(status) }, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(DynamicIcon_default, { name: icon.name }) }) : void 0,
3345
+ additionalInfo: callToAction ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
3346
+ import_components56.ListItem.AdditionalInfo,
3347
+ {
3348
+ action: {
3349
+ href: callToAction.href,
3350
+ onClick: callToAction.href ? void 0 : callToAction.onClick,
3351
+ label: callToAction.title,
3352
+ target: "_blank"
3353
+ }
3354
+ }
3355
+ ) : void 0
3356
+ },
3357
+ JSON.stringify(item)
3358
+ );
3359
+ })
3360
+ ] })
3361
+ };
3362
+ var mapStatus2 = (status) => {
3363
+ switch (status) {
3364
+ case "done":
3365
+ return "positive";
3366
+ case "pending":
3367
+ return "pending";
3368
+ default:
3369
+ return void 0;
3370
+ }
3371
+ };
3372
+ var NewStatusListRenderer_default = NewStatusListRenderer;
3178
3373
 
3179
3374
  // ../renderers/src/getWiseRenderers.ts
3375
+ var getListItemRenderers = () => [
3376
+ NewDecisionRenderer_default,
3377
+ NewListRenderer_default,
3378
+ NewReviewRenderer_default,
3379
+ NewStatusListRenderer_default
3380
+ ];
3180
3381
  var getWiseRenderers = () => [
3181
3382
  AddressValidationButtonRenderer_default,
3182
3383
  AlertRenderer_default,
@@ -3226,6 +3427,7 @@ var import_jsx_runtime80 = require("react/jsx-runtime");
3226
3427
  // src/dynamicFlow/renderers.ts
3227
3428
  var Header11 = Header7;
3228
3429
  var getMargin2 = getMargin;
3430
+ var getListItemRenderers2 = getListItemRenderers;
3229
3431
 
3230
3432
  // src/i18n/index.ts
3231
3433
  var import_dynamic_flow_client = require("@wise/dynamic-flow-client");
package/build/main.mjs CHANGED
@@ -801,7 +801,7 @@ var OPTION_GROUPS = {
801
801
  recent: "recent"
802
802
  };
803
803
  var GroupedList = (_a) => {
804
- var _b = _a, { renderDecisionList: renderDecisionList2 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
804
+ var _b = _a, { renderDecisionList: renderDecisionList3 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
805
805
  const { formatMessage } = useIntl3();
806
806
  const { options } = rest;
807
807
  const popularOptions = options.filter((option) => option.tag === OPTION_GROUPS.popular);
@@ -809,15 +809,15 @@ var GroupedList = (_a) => {
809
809
  return /* @__PURE__ */ jsxs4(Fragment, { children: [
810
810
  popularOptions.length > 0 ? /* @__PURE__ */ jsxs4(Section, { children: [
811
811
  /* @__PURE__ */ jsx23(Header, { as: "h2", title: formatMessage(decision_messages_default.popular) }),
812
- renderDecisionList2(__spreadProps(__spreadValues({}, rest), { options: popularOptions }))
812
+ renderDecisionList3(__spreadProps(__spreadValues({}, rest), { options: popularOptions }))
813
813
  ] }) : null,
814
814
  recentOptions.length > 0 ? /* @__PURE__ */ jsxs4(Section, { children: [
815
815
  /* @__PURE__ */ jsx23(Header, { as: "h2", title: formatMessage(decision_messages_default.recent) }),
816
- renderDecisionList2(__spreadProps(__spreadValues({}, rest), { options: recentOptions }))
816
+ renderDecisionList3(__spreadProps(__spreadValues({}, rest), { options: recentOptions }))
817
817
  ] }) : null,
818
818
  /* @__PURE__ */ jsxs4(Section, { children: [
819
819
  /* @__PURE__ */ jsx23(Header, { as: "h2", title: formatMessage(decision_messages_default.all) }),
820
- renderDecisionList2(rest)
820
+ renderDecisionList3(rest)
821
821
  ] })
822
822
  ] });
823
823
  };
@@ -877,13 +877,13 @@ var DecisionWrapper = (props) => {
877
877
  ] });
878
878
  };
879
879
  var UnfilteredDecisionList = (_a) => {
880
- var _b = _a, { renderDecisionList: renderDecisionList2 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
881
- return isGroupedDecision(rest.options) ? /* @__PURE__ */ jsx24(GroupedList, __spreadProps(__spreadValues({}, rest), { renderDecisionList: renderDecisionList2 })) : renderDecisionList2(rest);
880
+ var _b = _a, { renderDecisionList: renderDecisionList3 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
881
+ return isGroupedDecision(rest.options) ? /* @__PURE__ */ jsx24(GroupedList, __spreadProps(__spreadValues({}, rest), { renderDecisionList: renderDecisionList3 })) : renderDecisionList3(rest);
882
882
  };
883
883
  var FilteredDecisionList = (props) => {
884
884
  const { formatMessage } = useIntl4();
885
885
  const [query, setQuery] = useState3("");
886
- const { control, options, renderDecisionList: renderDecisionList2 } = props;
886
+ const { control, options, renderDecisionList: renderDecisionList3 } = props;
887
887
  const filteredOptions = filterAndSortDecisionOptions(options, query);
888
888
  const isGrouped = isGroupedDecision(options);
889
889
  return /* @__PURE__ */ jsxs5(Fragment2, { children: [
@@ -900,7 +900,7 @@ var FilteredDecisionList = (props) => {
900
900
  ),
901
901
  isGrouped && query.length === 0 ? /* @__PURE__ */ jsx24(GroupedList, __spreadValues({}, props)) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
902
902
  query.length > 0 && /* @__PURE__ */ jsx24(Header2, { as: "h2", title: formatMessage(decision_messages_default.results), className: "m-t-4" }),
903
- filteredOptions.length > 0 ? renderDecisionList2({
903
+ filteredOptions.length > 0 ? renderDecisionList3({
904
904
  control,
905
905
  className: query.length === 0 ? "m-t-3" : "",
906
906
  options: filteredOptions
@@ -3121,31 +3121,231 @@ import { ListItem as ListItem3 } from "@transferwise/components";
3121
3121
  // ../renderers/src/NewListItem/getInlineAlert.tsx
3122
3122
  import { ListItem } from "@transferwise/components";
3123
3123
  import { jsx as jsx73 } from "react/jsx-runtime";
3124
+ var getInlineAlert = (inlineAlert) => inlineAlert ? /* @__PURE__ */ jsx73(ListItem.Prompt, { sentiment: inlineAlert == null ? void 0 : inlineAlert.context, children: inlineAlert.content }) : void 0;
3124
3125
 
3125
3126
  // ../renderers/src/NewListItem/getMedia.tsx
3126
3127
  import { jsx as jsx74 } from "react/jsx-runtime";
3128
+ var getMedia = (media, preferAvatar) => media ? /* @__PURE__ */ jsx74(OptionMedia, { media, preferAvatar }) : void 0;
3127
3129
 
3128
3130
  // ../renderers/src/NewListItem/getAdditionalInfo.tsx
3129
3131
  import { ListItem as ListItem2 } from "@transferwise/components";
3130
3132
  import { jsx as jsx75 } from "react/jsx-runtime";
3133
+ var getAdditionalInfo = (additionalInfo) => {
3134
+ if (!additionalInfo) {
3135
+ return void 0;
3136
+ }
3137
+ const { href, text, onClick } = additionalInfo;
3138
+ if (href || onClick) {
3139
+ return /* @__PURE__ */ jsx75(
3140
+ ListItem2.AdditionalInfo,
3141
+ {
3142
+ action: {
3143
+ label: text,
3144
+ href,
3145
+ onClick,
3146
+ target: "_blank"
3147
+ }
3148
+ }
3149
+ );
3150
+ }
3151
+ return /* @__PURE__ */ jsx75(ListItem2.AdditionalInfo, { children: additionalInfo == null ? void 0 : additionalInfo.text });
3152
+ };
3131
3153
 
3132
3154
  // ../renderers/src/NewListItem/NewDecisionRenderer.tsx
3133
3155
  import { Fragment as Fragment12, jsx as jsx76 } from "react/jsx-runtime";
3156
+ var DecisionRenderer2 = {
3157
+ canRenderType: "decision",
3158
+ render: (props) => /* @__PURE__ */ jsx76(DecisionWrapper, __spreadProps(__spreadValues({}, props), { renderDecisionList: renderDecisionList2 }))
3159
+ };
3160
+ var renderDecisionList2 = ({ options, control }) => {
3161
+ return /* @__PURE__ */ jsx76(Fragment12, { children: options.map((option) => {
3162
+ const {
3163
+ description,
3164
+ disabled,
3165
+ media,
3166
+ title: itemTitle,
3167
+ tag,
3168
+ href,
3169
+ additionalText,
3170
+ inlineAlert,
3171
+ supportingValues,
3172
+ onClick
3173
+ } = option;
3174
+ return /* @__PURE__ */ jsx76(
3175
+ ListItem3,
3176
+ {
3177
+ title: itemTitle,
3178
+ subtitle: description,
3179
+ spotlight: control === "spotlight" ? tag === "spotlight-active" ? "active" : "inactive" : void 0,
3180
+ disabled,
3181
+ valueTitle: supportingValues == null ? void 0 : supportingValues.value,
3182
+ valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
3183
+ media: getMedia(media, control === "with-avatar" || tag === "with-avatar"),
3184
+ prompt: getInlineAlert(inlineAlert),
3185
+ additionalInfo: additionalText ? getAdditionalInfo({ text: additionalText }) : void 0,
3186
+ control: href ? /* @__PURE__ */ jsx76(ListItem3.Navigation, { href, target: "_blank" }) : /* @__PURE__ */ jsx76(ListItem3.Navigation, { onClick })
3187
+ },
3188
+ JSON.stringify(option)
3189
+ );
3190
+ }) });
3191
+ };
3192
+ var NewDecisionRenderer_default = DecisionRenderer2;
3134
3193
 
3135
3194
  // ../renderers/src/NewListItem/NewListRenderer.tsx
3136
3195
  import { ListItem as ListItem4 } from "@transferwise/components";
3137
3196
  import { jsx as jsx77, jsxs as jsxs30 } from "react/jsx-runtime";
3197
+ var ListRenderer2 = {
3198
+ canRenderType: "list",
3199
+ render: ({ callToAction, control, margin, items, title }) => /* @__PURE__ */ jsxs30("div", { className: getMargin(margin), children: [
3200
+ /* @__PURE__ */ jsx77(Header7, { title, callToAction }),
3201
+ items.map((item) => {
3202
+ const {
3203
+ title: itemTitle,
3204
+ description,
3205
+ supportingValues,
3206
+ media,
3207
+ tag,
3208
+ additionalInfo,
3209
+ inlineAlert
3210
+ } = item;
3211
+ return /* @__PURE__ */ jsx77(
3212
+ ListItem4,
3213
+ {
3214
+ title: itemTitle,
3215
+ subtitle: description,
3216
+ valueTitle: supportingValues == null ? void 0 : supportingValues.value,
3217
+ valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
3218
+ media: getMedia(media, control === "with-avatar" || tag === "with-avatar"),
3219
+ prompt: getInlineAlert(inlineAlert),
3220
+ additionalInfo: getAdditionalInfo(additionalInfo)
3221
+ },
3222
+ itemTitle
3223
+ );
3224
+ })
3225
+ ] })
3226
+ };
3227
+ var NewListRenderer_default = ListRenderer2;
3138
3228
 
3139
3229
  // ../renderers/src/NewListItem/NewReviewRenderer.tsx
3140
3230
  import { ListItem as ListItem5, Popover } from "@transferwise/components";
3141
3231
  import { QuestionMarkCircle } from "@transferwise/icons";
3142
3232
  import { jsx as jsx78, jsxs as jsxs31 } from "react/jsx-runtime";
3233
+ var IGNORED_CONTROLS = [
3234
+ "horizontal",
3235
+ "horizontal-end-aligned",
3236
+ "horizontal-start-aligned",
3237
+ "vertical-two-column"
3238
+ ];
3239
+ var ReviewRenderer2 = {
3240
+ canRenderType: "review",
3241
+ canRender: ({ control }) => control ? !IGNORED_CONTROLS.includes(control) : true,
3242
+ render: ({ callToAction, control, margin, fields, title }) => /* @__PURE__ */ jsxs31("div", { className: getMargin(margin), children: [
3243
+ /* @__PURE__ */ jsx78(Header7, { title, callToAction }),
3244
+ fields.map((field) => {
3245
+ var _a;
3246
+ const {
3247
+ label,
3248
+ value,
3249
+ media,
3250
+ tag,
3251
+ additionalInfo,
3252
+ inlineAlert,
3253
+ help,
3254
+ callToAction: itemCallToAction
3255
+ } = field;
3256
+ return /* @__PURE__ */ jsx78(
3257
+ ListItem5,
3258
+ {
3259
+ title: value,
3260
+ subtitle: label,
3261
+ inverted: true,
3262
+ media: getMedia(media, control === "with-avatar" || tag === "with-avatar"),
3263
+ control: (_a = getCTAControl(itemCallToAction)) != null ? _a : getHelpControl(help),
3264
+ prompt: getInlineAlert(inlineAlert),
3265
+ additionalInfo: getAdditionalInfo(additionalInfo)
3266
+ },
3267
+ JSON.stringify(field)
3268
+ );
3269
+ })
3270
+ ] })
3271
+ };
3272
+ var getCTAControl = (callToAction) => {
3273
+ if (!callToAction) {
3274
+ return void 0;
3275
+ }
3276
+ const { accessibilityDescription, href, title, onClick } = callToAction;
3277
+ if (href) {
3278
+ return /* @__PURE__ */ jsx78(ListItem5.Button, { href, partiallyInteractive: true, "aria-description": accessibilityDescription, children: title });
3279
+ }
3280
+ return /* @__PURE__ */ jsx78(
3281
+ ListItem5.Button,
3282
+ {
3283
+ "aria-description": accessibilityDescription,
3284
+ partiallyInteractive: true,
3285
+ onClick,
3286
+ children: title
3287
+ }
3288
+ );
3289
+ };
3290
+ var getHelpControl = (help) => {
3291
+ if (!help) {
3292
+ return void 0;
3293
+ }
3294
+ return /* @__PURE__ */ jsx78(Popover, { content: help, children: /* @__PURE__ */ jsx78(ListItem5.IconButton, { partiallyInteractive: true, children: /* @__PURE__ */ jsx78(QuestionMarkCircle, {}) }) });
3295
+ };
3296
+ var NewReviewRenderer_default = ReviewRenderer2;
3143
3297
 
3144
3298
  // ../renderers/src/NewListItem/NewStatusListRenderer.tsx
3145
3299
  import { AvatarView as AvatarView5, Header as Header10, ListItem as ListItem6 } from "@transferwise/components";
3146
3300
  import { jsx as jsx79, jsxs as jsxs32 } from "react/jsx-runtime";
3301
+ var NewStatusListRenderer = {
3302
+ canRenderType: "status-list",
3303
+ render: ({ margin, items, title }) => /* @__PURE__ */ jsxs32("div", { className: getMargin(margin), children: [
3304
+ title ? /* @__PURE__ */ jsx79(Header10, { title, className: "m-b-2" }) : null,
3305
+ items.map((item) => {
3306
+ const { callToAction, description, icon, status, title: itemTitle } = item;
3307
+ return /* @__PURE__ */ jsx79(
3308
+ ListItem6,
3309
+ {
3310
+ title: itemTitle,
3311
+ subtitle: description,
3312
+ media: icon && "name" in icon ? /* @__PURE__ */ jsx79(AvatarView5, { badge: { status: mapStatus2(status) }, children: /* @__PURE__ */ jsx79(DynamicIcon_default, { name: icon.name }) }) : void 0,
3313
+ additionalInfo: callToAction ? /* @__PURE__ */ jsx79(
3314
+ ListItem6.AdditionalInfo,
3315
+ {
3316
+ action: {
3317
+ href: callToAction.href,
3318
+ onClick: callToAction.href ? void 0 : callToAction.onClick,
3319
+ label: callToAction.title,
3320
+ target: "_blank"
3321
+ }
3322
+ }
3323
+ ) : void 0
3324
+ },
3325
+ JSON.stringify(item)
3326
+ );
3327
+ })
3328
+ ] })
3329
+ };
3330
+ var mapStatus2 = (status) => {
3331
+ switch (status) {
3332
+ case "done":
3333
+ return "positive";
3334
+ case "pending":
3335
+ return "pending";
3336
+ default:
3337
+ return void 0;
3338
+ }
3339
+ };
3340
+ var NewStatusListRenderer_default = NewStatusListRenderer;
3147
3341
 
3148
3342
  // ../renderers/src/getWiseRenderers.ts
3343
+ var getListItemRenderers = () => [
3344
+ NewDecisionRenderer_default,
3345
+ NewListRenderer_default,
3346
+ NewReviewRenderer_default,
3347
+ NewStatusListRenderer_default
3348
+ ];
3149
3349
  var getWiseRenderers = () => [
3150
3350
  AddressValidationButtonRenderer_default,
3151
3351
  AlertRenderer_default,
@@ -3195,6 +3395,7 @@ import { jsx as jsx80 } from "react/jsx-runtime";
3195
3395
  // src/dynamicFlow/renderers.ts
3196
3396
  var Header11 = Header7;
3197
3397
  var getMargin2 = getMargin;
3398
+ var getListItemRenderers2 = getListItemRenderers;
3198
3399
 
3199
3400
  // src/i18n/index.ts
3200
3401
  import { translations as coreTranslations } from "@wise/dynamic-flow-client";
@@ -4202,6 +4403,7 @@ export {
4202
4403
  Header11 as Header,
4203
4404
  JsonSchemaForm,
4204
4405
  findRendererPropsByType,
4406
+ getListItemRenderers2 as getListItemRenderers,
4205
4407
  getMargin2 as getMargin,
4206
4408
  isValidSchema,
4207
4409
  makeHttpClient as makeCustomFetch,
@@ -3,3 +3,5 @@ export declare const Header: ({ title, callToAction }: {
3
3
  callToAction?: import("@wise/dynamic-flow-types/build/renderers").CallToAction;
4
4
  }) => "" | import("react/jsx-runtime").JSX.Element | undefined;
5
5
  export declare const getMargin: (size: import("@wise/dynamic-flow-types/build/next").Margin) => "m-b-0" | "m-b-1" | "m-b-2" | "m-b-3" | "m-b-5" | "";
6
+ export declare const getListItemRenderers: () => import("@wise/dynamic-flow-client").Renderers;
7
+ export declare const ButtonRendererV2: import("@wise/dynamic-flow-client").Renderer<import("@wise/dynamic-flow-client").ButtonRendererProps>;
@@ -2,7 +2,7 @@ export { makeHttpClient as makeCustomFetch } from '@wise/dynamic-flow-client';
2
2
  export type { DynamicFlowProps, DynamicFormController, InitialAction, Step, } from '@wise/dynamic-flow-client';
3
3
  export type { AlertRendererProps, BoxRendererProps, ButtonRendererProps, CheckboxInputRendererProps, ColumnsRendererProps, DateInputRendererProps, DecisionRendererProps, DividerRendererProps, FormRendererProps, FormSectionRendererProps, HeadingRendererProps, HiddenRendererProps, ImageRendererProps, InstructionsRendererProps, IntegerInputRendererProps, LoadingIndicatorRendererProps, MarkdownRendererProps, ModalLayoutRendererProps, ModalRendererProps, MultiSelectInputRendererProps, MultiUploadInputRendererProps, NumberInputRendererProps, ParagraphRendererProps, Renderer, Renderers, RepeatableRendererProps, ReviewRendererProps, SearchRendererProps, SelectInputRendererProps, StatusListRendererProps, StepRendererProps, TextInputRendererProps, UploadInputRendererProps, } from '@wise/dynamic-flow-types/build/renderers';
4
4
  export { findRendererPropsByType, isValidSchema, JsonSchemaForm } from '@wise/dynamic-flow-client';
5
- export { Header, getMargin } from './dynamicFlow/renderers';
5
+ export { Header, getMargin, getListItemRenderers } from './dynamicFlow/renderers';
6
6
  export { default as translations } from './i18n';
7
7
  export type { DynamicFlowLegacyProps, DynamicFlowRevampProps } from './dynamicFlow/DynamicFlow';
8
8
  export { DynamicFlowLegacy, DynamicFlowRevamp, DynamicForm } from './dynamicFlow/DynamicFlow';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client-internal",
3
- "version": "4.25.0-experimental-cd1bec2",
3
+ "version": "4.25.0-experimental-91c6dca",
4
4
  "description": "Dynamic Flow web client for Wise",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -74,12 +74,12 @@
74
74
  "stylelint-value-no-unknown-custom-properties": "6.0.1",
75
75
  "tsx": "4.20.4",
76
76
  "typescript": "5.9.2",
77
- "@wise/dynamic-flow-renderers": "0.0.0",
78
- "@wise/dynamic-flow-types": "3.12.0-experimental-cd1bec2",
79
- "@wise/dynamic-flow-fixtures": "0.0.1"
77
+ "@wise/dynamic-flow-fixtures": "0.0.1",
78
+ "@wise/dynamic-flow-types": "3.12.0-experimental-91c6dca",
79
+ "@wise/dynamic-flow-renderers": "0.0.0"
80
80
  },
81
81
  "peerDependencies": {
82
- "@transferwise/components": "^46.92.0",
82
+ "@transferwise/components": "^46.104.0",
83
83
  "@transferwise/formatting": "^2",
84
84
  "@transferwise/icons": "^3.18.0",
85
85
  "@transferwise/neptune-css": "^14.22.0",
@@ -91,8 +91,8 @@
91
91
  },
92
92
  "dependencies": {
93
93
  "classnames": "2.5.1",
94
- "@wise/dynamic-flow-types": "3.12.0-experimental-cd1bec2",
95
- "@wise/dynamic-flow-client": "4.15.0-experimental-cd1bec2"
94
+ "@wise/dynamic-flow-types": "3.12.0-experimental-91c6dca",
95
+ "@wise/dynamic-flow-client": "4.15.0-experimental-91c6dca"
96
96
  },
97
97
  "scripts": {
98
98
  "dev": "pnpm build:visual-tests && storybook dev -p 3005",