@wise/dynamic-flow-client-internal 4.28.0 → 4.29.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.css CHANGED
@@ -358,6 +358,21 @@ button.df-back-btn {
358
358
  display: flex;
359
359
  flex-direction: column;
360
360
  }
361
+ .df-step-fixed__footer {
362
+ position: sticky;
363
+ bottom: 0;
364
+ left: 0;
365
+ right: 0;
366
+ padding: var(--size-8) 0;
367
+ background-color: var(--color-background-screen);
368
+ }
369
+ /* If we're in a drawer, we need to account for the bottom padding on the drawer content */
370
+ .np-drawer-content .df-step-fixed__footer {
371
+ bottom: -16px;
372
+ }
373
+ .tw-modal-body--scrollable .df-step-fixed__footer {
374
+ bottom: -24px;
375
+ }
361
376
  .chips-container {
362
377
  overflow-x: auto;
363
378
  }
package/build/main.js CHANGED
@@ -396,25 +396,25 @@ var isNamedIcon = (name) => {
396
396
  const iconName = toCapitalisedCamelCase(name);
397
397
  return Object.keys(icons).includes(iconName);
398
398
  };
399
- function NamedIcon({ name }) {
399
+ function NamedIcon({ name, size = 24 }) {
400
400
  if (!isNamedIcon(name)) {
401
401
  return null;
402
402
  }
403
403
  const iconName = toCapitalisedCamelCase(name);
404
404
  const Icon = icons[iconName];
405
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { size: 24 });
405
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { size });
406
406
  }
407
407
  var toCapitalisedCamelCase = (value) => value.split("-").map(capitaliseFirstChar).join("");
408
408
  var capitaliseFirstChar = (value) => `${value[0].toUpperCase()}${value.slice(1)}`;
409
409
 
410
410
  // ../renderers/src/components/icon/DynamicIcon.tsx
411
411
  var import_jsx_runtime11 = require("react/jsx-runtime");
412
- function DynamicIcon({ name }) {
412
+ function DynamicIcon({ name, size }) {
413
413
  if (isFlagIcon(name)) {
414
414
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FlagIcon, { name });
415
415
  }
416
416
  if (isNamedIcon(name)) {
417
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NamedIcon, { name });
417
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NamedIcon, { name, size });
418
418
  }
419
419
  return null;
420
420
  }
@@ -436,25 +436,25 @@ var stringToURN = (uri) => {
436
436
  const [nameWithRQComponents, _] = uri.split("#");
437
437
  const [nameWithRComponent, qComponent] = nameWithRQComponents.split("?=");
438
438
  const [name, rComponent] = (_a = nameWithRComponent == null ? void 0 : nameWithRComponent.split("?+")) != null ? _a : ["", ""];
439
- const rComponents = rComponent ? (_b = decodeURIComponent(rComponent)) == null ? void 0 : _b.split("&").map((c) => c.split("=")).map(([a, b]) => [a, b]) : void 0;
440
- const qComponents = qComponent ? (_c = decodeURIComponent(qComponent)) == null ? void 0 : _c.split("&").map((c) => c.split("=")).map(([a, b]) => [a, b]) : void 0;
439
+ const rComponents = rComponent ? (_b = decodeURIComponent(rComponent)) == null ? void 0 : _b.split("&").map((c) => c.split("=")).reduce((acc, [key, value]) => __spreadProps(__spreadValues({}, acc), { [key]: value }), {}) : void 0;
440
+ const qComponents = qComponent ? (_c = decodeURIComponent(qComponent)) == null ? void 0 : _c.split("&").map((c) => c.split("=")).reduce((acc, [key, value]) => __spreadProps(__spreadValues({}, acc), { [key]: value }), {}) : void 0;
441
441
  return {
442
442
  name,
443
- rComponents,
444
- qComponents
443
+ rComponents: rComponents != null ? rComponents : {},
444
+ qComponents: qComponents != null ? qComponents : {}
445
445
  };
446
446
  };
447
447
 
448
448
  // ../renderers/src/components/Media/resolveMediaFromUri.tsx
449
449
  var import_jsx_runtime12 = require("react/jsx-runtime");
450
450
  var resolveMediaFromUri = (uri, size) => {
451
- var _a, _b;
452
- const { name, qComponents = [] } = stringToURN(uri);
451
+ const { name, qComponents } = stringToURN(uri);
453
452
  if (isValidIconUrn(name)) {
454
- const icon = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DynamicIcon_default, { name: name.replace("urn:wise:icons:", "") });
453
+ const icon = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DynamicIcon_default, { name: name.replace("urn:wise:icons:", ""), size: size === 48 ? 32 : size });
455
454
  return {
456
455
  icon,
457
- backgroundColor: formatColor((_a = qComponents.find(([key]) => key === "background-color")) == null ? void 0 : _a[1])
456
+ color: formatColor(qComponents["foreground-color"]),
457
+ backgroundColor: formatColor(qComponents["background-color"])
458
458
  };
459
459
  }
460
460
  if (isUrnFlag(name)) {
@@ -466,7 +466,8 @@ var resolveMediaFromUri = (uri, size) => {
466
466
  const text = decodeURI(name.replace("data:text/plain,", ""));
467
467
  return {
468
468
  asset: text,
469
- backgroundColor: formatColor((_b = qComponents.find(([key]) => key === "background-color")) == null ? void 0 : _b[1])
469
+ color: formatColor(qComponents["foreground-color"]),
470
+ backgroundColor: formatColor(qComponents["background-color"])
470
471
  };
471
472
  }
472
473
  if (!uri.startsWith("urn:")) {
@@ -502,7 +503,7 @@ var AvatarMedia = ({
502
503
  };
503
504
  const avatars = content.map(getRenderableAvatar);
504
505
  if (avatars.length === 1) {
505
- const { badge, backgroundColor, asset, icon } = avatars[0];
506
+ const { badge, backgroundColor, color, asset, icon } = avatars[0];
506
507
  if (!asset && !icon) {
507
508
  return null;
508
509
  }
@@ -514,15 +515,15 @@ var AvatarMedia = ({
514
515
  badge: badge ? __spreadProps(__spreadValues({}, badge), {
515
516
  type: "reference"
516
517
  }) : void 0,
517
- style: { backgroundColor },
518
+ style: { backgroundColor, color },
518
519
  children: icon != null ? icon : asset
519
520
  }
520
521
  );
521
522
  }
522
- const avatarsWithoutBadges = avatars.filter(({ asset }) => asset).slice(0, 2).map((_a) => {
523
- var _b = _a, { badge } = _b, rest = __objRest(_b, ["badge"]);
524
- return __spreadValues({}, rest);
525
- });
523
+ const avatarsWithoutBadges = avatars.filter(({ asset, icon }) => asset || icon).slice(0, 2).map(({ asset, icon, backgroundColor, color }) => ({
524
+ asset: icon != null ? icon : asset,
525
+ style: { backgroundColor, color }
526
+ }));
526
527
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
527
528
  import_components6.AvatarLayout,
528
529
  {
@@ -966,7 +967,8 @@ var FilteredDecisionList = (props) => {
966
967
  onChange: (e) => {
967
968
  var _a;
968
969
  return setQuery((_a = e.target.value) != null ? _a : "");
969
- }
970
+ },
971
+ className: "m-b-2"
970
972
  }
971
973
  ),
972
974
  isGrouped && query.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GroupedList, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
@@ -1286,9 +1288,8 @@ var import_react7 = require("react");
1286
1288
 
1287
1289
  // ../renderers/src/ImageRenderer/isAnimated.ts
1288
1290
  var isAnimated = (uri) => {
1289
- var _a;
1290
1291
  const { rComponents } = stringToURN(uri);
1291
- return (_a = rComponents == null ? void 0 : rComponents.some(([key, value]) => key === "type" && value === "animated")) != null ? _a : false;
1292
+ return rComponents["type"] === "animated";
1292
1293
  };
1293
1294
 
1294
1295
  // ../renderers/src/ImageRenderer/SafeIllustration3D.tsx
@@ -2095,6 +2096,7 @@ function ItemSummaryOption({
2095
2096
  title: item.title,
2096
2097
  content: item.description,
2097
2098
  showMediaAtAllSizes: true,
2099
+ showMediaCircle: false,
2098
2100
  onClick
2099
2101
  }
2100
2102
  );
@@ -2885,15 +2887,17 @@ var StepRenderer = {
2885
2887
  render: StepRendererComponent
2886
2888
  };
2887
2889
  function StepRendererComponent(props) {
2888
- const { back, description, error, title, children, toolbar } = props;
2889
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
2890
+ const { back, description, error, title, children, toolbar, footer } = props;
2891
+ const hasFooter = footer && Array.isArray(footer) && footer.length > 0;
2892
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { children: [
2890
2893
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(TopBar, { back, toolbar }),
2891
2894
  title || description ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "m-b-4", children: [
2892
2895
  title ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_components46.Title, { as: "h1", type: "title-section", className: "text-xs-center m-b-2", children: title }) : void 0,
2893
2896
  description ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "text-xs-center np-text-body-large", children: description }) : void 0
2894
2897
  ] }) : void 0,
2895
2898
  error ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_components46.Alert, { type: "negative", className: "m-b-2", message: error }) : void 0,
2896
- children
2899
+ children,
2900
+ hasFooter ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "df-step-fixed__footer", children: footer }) : void 0
2897
2901
  ] });
2898
2902
  }
2899
2903
 
@@ -4386,7 +4390,7 @@ var import_dynamic_flow_client2 = require("@wise/dynamic-flow-client");
4386
4390
  // src/dynamicFlow/telemetry/app-version.ts
4387
4391
  var appVersion = (
4388
4392
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
4389
- typeof process !== "undefined" ? "4.28.0" : "0.0.0"
4393
+ typeof process !== "undefined" ? "4.29.0" : "0.0.0"
4390
4394
  );
4391
4395
 
4392
4396
  // src/dynamicFlow/telemetry/getLogEvent.ts
package/build/main.mjs CHANGED
@@ -353,25 +353,25 @@ var isNamedIcon = (name) => {
353
353
  const iconName = toCapitalisedCamelCase(name);
354
354
  return Object.keys(icons).includes(iconName);
355
355
  };
356
- function NamedIcon({ name }) {
356
+ function NamedIcon({ name, size = 24 }) {
357
357
  if (!isNamedIcon(name)) {
358
358
  return null;
359
359
  }
360
360
  const iconName = toCapitalisedCamelCase(name);
361
361
  const Icon = icons[iconName];
362
- return /* @__PURE__ */ jsx10(Icon, { size: 24 });
362
+ return /* @__PURE__ */ jsx10(Icon, { size });
363
363
  }
364
364
  var toCapitalisedCamelCase = (value) => value.split("-").map(capitaliseFirstChar).join("");
365
365
  var capitaliseFirstChar = (value) => `${value[0].toUpperCase()}${value.slice(1)}`;
366
366
 
367
367
  // ../renderers/src/components/icon/DynamicIcon.tsx
368
368
  import { jsx as jsx11 } from "react/jsx-runtime";
369
- function DynamicIcon({ name }) {
369
+ function DynamicIcon({ name, size }) {
370
370
  if (isFlagIcon(name)) {
371
371
  return /* @__PURE__ */ jsx11(FlagIcon, { name });
372
372
  }
373
373
  if (isNamedIcon(name)) {
374
- return /* @__PURE__ */ jsx11(NamedIcon, { name });
374
+ return /* @__PURE__ */ jsx11(NamedIcon, { name, size });
375
375
  }
376
376
  return null;
377
377
  }
@@ -393,25 +393,25 @@ var stringToURN = (uri) => {
393
393
  const [nameWithRQComponents, _] = uri.split("#");
394
394
  const [nameWithRComponent, qComponent] = nameWithRQComponents.split("?=");
395
395
  const [name, rComponent] = (_a = nameWithRComponent == null ? void 0 : nameWithRComponent.split("?+")) != null ? _a : ["", ""];
396
- const rComponents = rComponent ? (_b = decodeURIComponent(rComponent)) == null ? void 0 : _b.split("&").map((c) => c.split("=")).map(([a, b]) => [a, b]) : void 0;
397
- const qComponents = qComponent ? (_c = decodeURIComponent(qComponent)) == null ? void 0 : _c.split("&").map((c) => c.split("=")).map(([a, b]) => [a, b]) : void 0;
396
+ const rComponents = rComponent ? (_b = decodeURIComponent(rComponent)) == null ? void 0 : _b.split("&").map((c) => c.split("=")).reduce((acc, [key, value]) => __spreadProps(__spreadValues({}, acc), { [key]: value }), {}) : void 0;
397
+ const qComponents = qComponent ? (_c = decodeURIComponent(qComponent)) == null ? void 0 : _c.split("&").map((c) => c.split("=")).reduce((acc, [key, value]) => __spreadProps(__spreadValues({}, acc), { [key]: value }), {}) : void 0;
398
398
  return {
399
399
  name,
400
- rComponents,
401
- qComponents
400
+ rComponents: rComponents != null ? rComponents : {},
401
+ qComponents: qComponents != null ? qComponents : {}
402
402
  };
403
403
  };
404
404
 
405
405
  // ../renderers/src/components/Media/resolveMediaFromUri.tsx
406
406
  import { jsx as jsx12 } from "react/jsx-runtime";
407
407
  var resolveMediaFromUri = (uri, size) => {
408
- var _a, _b;
409
- const { name, qComponents = [] } = stringToURN(uri);
408
+ const { name, qComponents } = stringToURN(uri);
410
409
  if (isValidIconUrn(name)) {
411
- const icon = /* @__PURE__ */ jsx12(DynamicIcon_default, { name: name.replace("urn:wise:icons:", "") });
410
+ const icon = /* @__PURE__ */ jsx12(DynamicIcon_default, { name: name.replace("urn:wise:icons:", ""), size: size === 48 ? 32 : size });
412
411
  return {
413
412
  icon,
414
- backgroundColor: formatColor((_a = qComponents.find(([key]) => key === "background-color")) == null ? void 0 : _a[1])
413
+ color: formatColor(qComponents["foreground-color"]),
414
+ backgroundColor: formatColor(qComponents["background-color"])
415
415
  };
416
416
  }
417
417
  if (isUrnFlag(name)) {
@@ -423,7 +423,8 @@ var resolveMediaFromUri = (uri, size) => {
423
423
  const text = decodeURI(name.replace("data:text/plain,", ""));
424
424
  return {
425
425
  asset: text,
426
- backgroundColor: formatColor((_b = qComponents.find(([key]) => key === "background-color")) == null ? void 0 : _b[1])
426
+ color: formatColor(qComponents["foreground-color"]),
427
+ backgroundColor: formatColor(qComponents["background-color"])
427
428
  };
428
429
  }
429
430
  if (!uri.startsWith("urn:")) {
@@ -459,7 +460,7 @@ var AvatarMedia = ({
459
460
  };
460
461
  const avatars = content.map(getRenderableAvatar);
461
462
  if (avatars.length === 1) {
462
- const { badge, backgroundColor, asset, icon } = avatars[0];
463
+ const { badge, backgroundColor, color, asset, icon } = avatars[0];
463
464
  if (!asset && !icon) {
464
465
  return null;
465
466
  }
@@ -471,15 +472,15 @@ var AvatarMedia = ({
471
472
  badge: badge ? __spreadProps(__spreadValues({}, badge), {
472
473
  type: "reference"
473
474
  }) : void 0,
474
- style: { backgroundColor },
475
+ style: { backgroundColor, color },
475
476
  children: icon != null ? icon : asset
476
477
  }
477
478
  );
478
479
  }
479
- const avatarsWithoutBadges = avatars.filter(({ asset }) => asset).slice(0, 2).map((_a) => {
480
- var _b = _a, { badge } = _b, rest = __objRest(_b, ["badge"]);
481
- return __spreadValues({}, rest);
482
- });
480
+ const avatarsWithoutBadges = avatars.filter(({ asset, icon }) => asset || icon).slice(0, 2).map(({ asset, icon, backgroundColor, color }) => ({
481
+ asset: icon != null ? icon : asset,
482
+ style: { backgroundColor, color }
483
+ }));
483
484
  return /* @__PURE__ */ jsx13(
484
485
  AvatarLayout,
485
486
  {
@@ -923,7 +924,8 @@ var FilteredDecisionList = (props) => {
923
924
  onChange: (e) => {
924
925
  var _a;
925
926
  return setQuery((_a = e.target.value) != null ? _a : "");
926
- }
927
+ },
928
+ className: "m-b-2"
927
929
  }
928
930
  ),
929
931
  isGrouped && query.length === 0 ? /* @__PURE__ */ jsx25(GroupedList, __spreadValues({}, props)) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
@@ -1246,9 +1248,8 @@ import { useState as useState5 } from "react";
1246
1248
 
1247
1249
  // ../renderers/src/ImageRenderer/isAnimated.ts
1248
1250
  var isAnimated = (uri) => {
1249
- var _a;
1250
1251
  const { rComponents } = stringToURN(uri);
1251
- return (_a = rComponents == null ? void 0 : rComponents.some(([key, value]) => key === "type" && value === "animated")) != null ? _a : false;
1252
+ return rComponents["type"] === "animated";
1252
1253
  };
1253
1254
 
1254
1255
  // ../renderers/src/ImageRenderer/SafeIllustration3D.tsx
@@ -2055,6 +2056,7 @@ function ItemSummaryOption({
2055
2056
  title: item.title,
2056
2057
  content: item.description,
2057
2058
  showMediaAtAllSizes: true,
2059
+ showMediaCircle: false,
2058
2060
  onClick
2059
2061
  }
2060
2062
  );
@@ -2839,21 +2841,23 @@ function SplashStepRendererComponent(props) {
2839
2841
 
2840
2842
  // ../renderers/src/step/StepRenderer.tsx
2841
2843
  import { Alert as Alert2, Title as Title2 } from "@transferwise/components";
2842
- import { Fragment as Fragment10, jsx as jsx69, jsxs as jsxs28 } from "react/jsx-runtime";
2844
+ import { jsx as jsx69, jsxs as jsxs28 } from "react/jsx-runtime";
2843
2845
  var StepRenderer = {
2844
2846
  canRenderType: "step",
2845
2847
  render: StepRendererComponent
2846
2848
  };
2847
2849
  function StepRendererComponent(props) {
2848
- const { back, description, error, title, children, toolbar } = props;
2849
- return /* @__PURE__ */ jsxs28(Fragment10, { children: [
2850
+ const { back, description, error, title, children, toolbar, footer } = props;
2851
+ const hasFooter = footer && Array.isArray(footer) && footer.length > 0;
2852
+ return /* @__PURE__ */ jsxs28("div", { children: [
2850
2853
  /* @__PURE__ */ jsx69(TopBar, { back, toolbar }),
2851
2854
  title || description ? /* @__PURE__ */ jsxs28("div", { className: "m-b-4", children: [
2852
2855
  title ? /* @__PURE__ */ jsx69(Title2, { as: "h1", type: "title-section", className: "text-xs-center m-b-2", children: title }) : void 0,
2853
2856
  description ? /* @__PURE__ */ jsx69("p", { className: "text-xs-center np-text-body-large", children: description }) : void 0
2854
2857
  ] }) : void 0,
2855
2858
  error ? /* @__PURE__ */ jsx69(Alert2, { type: "negative", className: "m-b-2", message: error }) : void 0,
2856
- children
2859
+ children,
2860
+ hasFooter ? /* @__PURE__ */ jsx69("div", { className: "df-step-fixed__footer", children: footer }) : void 0
2857
2861
  ] });
2858
2862
  }
2859
2863
 
@@ -3188,13 +3192,13 @@ var getAdditionalInfo = (additionalInfo) => {
3188
3192
  };
3189
3193
 
3190
3194
  // ../renderers/src/NewListItem/NewDecisionRenderer.tsx
3191
- import { Fragment as Fragment11, jsx as jsx76 } from "react/jsx-runtime";
3195
+ import { Fragment as Fragment10, jsx as jsx76 } from "react/jsx-runtime";
3192
3196
  var DecisionRenderer2 = {
3193
3197
  canRenderType: "decision",
3194
3198
  render: (props) => /* @__PURE__ */ jsx76(DecisionWrapper, __spreadProps(__spreadValues({}, props), { renderDecisionList: renderDecisionList2 }))
3195
3199
  };
3196
3200
  var renderDecisionList2 = ({ options, control }) => {
3197
- return /* @__PURE__ */ jsx76(Fragment11, { children: options.map((option) => {
3201
+ return /* @__PURE__ */ jsx76(Fragment10, { children: options.map((option) => {
3198
3202
  const {
3199
3203
  description,
3200
3204
  disabled,
@@ -4356,7 +4360,7 @@ import {
4356
4360
  // src/dynamicFlow/telemetry/app-version.ts
4357
4361
  var appVersion = (
4358
4362
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
4359
- typeof process !== "undefined" ? "4.28.0" : "0.0.0"
4363
+ typeof process !== "undefined" ? "4.29.0" : "0.0.0"
4360
4364
  );
4361
4365
 
4362
4366
  // src/dynamicFlow/telemetry/getLogEvent.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client-internal",
3
- "version": "4.28.0",
3
+ "version": "4.29.0",
4
4
  "description": "Dynamic Flow web client for Wise",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -74,9 +74,9 @@
74
74
  "stylelint-value-no-unknown-custom-properties": "6.0.1",
75
75
  "tsx": "4.20.5",
76
76
  "typescript": "5.9.2",
77
- "@wise/dynamic-flow-fixtures": "0.0.1",
78
77
  "@wise/dynamic-flow-renderers": "0.0.0",
79
- "@wise/dynamic-flow-types": "3.13.0"
78
+ "@wise/dynamic-flow-types": "3.14.0",
79
+ "@wise/dynamic-flow-fixtures": "0.0.1"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "@transferwise/components": "^46.104.0",
@@ -91,8 +91,8 @@
91
91
  },
92
92
  "dependencies": {
93
93
  "classnames": "2.5.1",
94
- "@wise/dynamic-flow-client": "4.16.1",
95
- "@wise/dynamic-flow-types": "3.13.0"
94
+ "@wise/dynamic-flow-client": "4.17.0",
95
+ "@wise/dynamic-flow-types": "3.14.0"
96
96
  },
97
97
  "scripts": {
98
98
  "dev": "pnpm build:visual-tests && storybook dev -p 3005",