@wise/dynamic-flow-client-internal 4.0.0-experimental-dde19b5 → 4.0.0-experimental-9cbdd3f

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
@@ -278,8 +278,7 @@ __export(index_exports, {
278
278
  DynamicFlowRevamp: () => DynamicFlowRevamp,
279
279
  DynamicForm: () => DynamicForm,
280
280
  JsonSchemaForm: () => import_dynamic_flow_client4.JsonSchemaForm,
281
- find: () => import_dynamic_flow_client4.find,
282
- findType: () => import_dynamic_flow_client4.findType,
281
+ findRendererPropsByType: () => import_dynamic_flow_client4.findRendererPropsByType,
283
282
  isValidSchema: () => import_dynamic_flow_client4.isValidSchema,
284
283
  makeCustomFetch: () => import_dynamic_flow_client3.makeHttpClient,
285
284
  translations: () => i18n_default
@@ -1088,36 +1087,24 @@ var import_components5 = require("@transferwise/components");
1088
1087
  var import_jsx_runtime7 = require("react/jsx-runtime");
1089
1088
  var ButtonRenderer = {
1090
1089
  canRenderType: "button",
1091
- render: ButtonRendererComponent
1090
+ render: ({ control, context, disabled, margin, title, size: size2, onClick }) => {
1091
+ const priority = mapControl(control);
1092
+ const type = priority === "tertiary" ? void 0 : mapContext(context);
1093
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1094
+ import_components5.Button,
1095
+ {
1096
+ block: true,
1097
+ className: getMargin(margin),
1098
+ disabled,
1099
+ priority,
1100
+ size: mapSize(size2),
1101
+ type,
1102
+ onClick,
1103
+ children: title
1104
+ }
1105
+ );
1106
+ }
1092
1107
  };
1093
- function ButtonRendererComponent({
1094
- control,
1095
- context,
1096
- disabled,
1097
- margin,
1098
- title,
1099
- size: size2,
1100
- stepLoadingState,
1101
- onClick
1102
- }) {
1103
- const className = getMargin(margin);
1104
- const priority = mapControl(control);
1105
- const type = priority === "tertiary" ? void 0 : mapContext(context);
1106
- const isLoading = stepLoadingState !== "idle";
1107
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1108
- import_components5.Button,
1109
- {
1110
- block: true,
1111
- className,
1112
- disabled: isLoading || disabled,
1113
- priority,
1114
- size: mapSize(size2),
1115
- type,
1116
- onClick,
1117
- children: title
1118
- }
1119
- );
1120
- }
1121
1108
  var mapContext = (context) => {
1122
1109
  switch (context) {
1123
1110
  case "neutral":
@@ -1360,13 +1347,10 @@ function NavigationOptionMedia({ icon, image }) {
1360
1347
  }
1361
1348
  }
1362
1349
  if (image) {
1363
- const { accessibilityDescription, uri, url } = image;
1364
- if (uri && !uri.startsWith("urn:")) {
1350
+ const { accessibilityDescription, uri } = image;
1351
+ if (!uri.startsWith("urn:")) {
1365
1352
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { src: uri, alt: accessibilityDescription });
1366
1353
  }
1367
- if (url) {
1368
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { src: url, alt: accessibilityDescription });
1369
- }
1370
1354
  }
1371
1355
  return null;
1372
1356
  }
@@ -1375,24 +1359,14 @@ function NavigationOptionMedia({ icon, image }) {
1375
1359
  var import_jsx_runtime17 = require("react/jsx-runtime");
1376
1360
  var DecisionRenderer = {
1377
1361
  canRenderType: "decision",
1378
- render: DecisionRendererComponent
1379
- };
1380
- var DecisionRenderer_default = DecisionRenderer;
1381
- function DecisionRendererComponent({
1382
- margin,
1383
- options,
1384
- title,
1385
- stepLoadingState
1386
- }) {
1387
- const isLoading = stepLoadingState !== "idle";
1388
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: getMargin(margin), children: [
1362
+ render: ({ margin, options, title }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: getMargin(margin), children: [
1389
1363
  title && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_components8.Header, { as: "h2", title }),
1390
1364
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_components8.NavigationOptionsList, { children: options.map(({ description, disabled, icon, image, title: itemTitle, onClick }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1391
1365
  import_components8.NavigationOption,
1392
1366
  {
1393
1367
  title: itemTitle,
1394
1368
  content: description,
1395
- disabled: isLoading || disabled,
1369
+ disabled,
1396
1370
  media: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(NavigationOptionMedia, { icon, image }),
1397
1371
  showMediaCircle: false,
1398
1372
  showMediaAtAllSizes: true,
@@ -1400,8 +1374,9 @@ function DecisionRendererComponent({
1400
1374
  },
1401
1375
  JSON.stringify(itemTitle)
1402
1376
  )) })
1403
- ] });
1404
- }
1377
+ ] })
1378
+ };
1379
+ var DecisionRenderer_default = DecisionRenderer;
1405
1380
 
1406
1381
  // ../renderers/src/DividerRenderer.tsx
1407
1382
  var import_jsx_runtime18 = require("react/jsx-runtime");
@@ -1506,19 +1481,14 @@ function ImageRendererComponent({
1506
1481
  margin,
1507
1482
  size: size2,
1508
1483
  uri,
1509
- url,
1510
1484
  httpClient
1511
1485
  }) {
1512
1486
  const [imageSource, setImageSource] = (0, import_react3.useState)("");
1513
1487
  (0, import_react3.useEffect)(() => {
1514
- if (!uri) {
1515
- void getImageSource(httpClient, url).then(setImageSource);
1516
- return;
1517
- }
1518
1488
  if (!uri.startsWith("urn:")) {
1519
1489
  void getImageSource(httpClient, uri).then(setImageSource);
1520
1490
  }
1521
- }, [uri, url, httpClient]);
1491
+ }, [uri, httpClient]);
1522
1492
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: `df-image ${size2 || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1523
1493
  import_components11.Image,
1524
1494
  {
@@ -1595,16 +1565,11 @@ var import_components13 = require("@transferwise/components");
1595
1565
  var import_jsx_runtime24 = require("react/jsx-runtime");
1596
1566
  var size = 24;
1597
1567
  function getIconAvatar({ icon, image }) {
1598
- if (image == null ? void 0 : image.url) {
1599
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1600
- "img",
1601
- {
1602
- src: image.url,
1603
- alt: image.accessibilityDescription,
1604
- width: `${size}px`,
1605
- height: `${size}px`
1606
- }
1607
- );
1568
+ if (image) {
1569
+ const { accessibilityDescription, uri } = image;
1570
+ if (!uri.startsWith("urn:")) {
1571
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { src: uri, alt: accessibilityDescription, width: `${size}px`, height: `${size}px` });
1572
+ }
1608
1573
  }
1609
1574
  if (isFlagIcon2(icon)) {
1610
1575
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components13.Avatar, { type: import_components13.AvatarType.ICON, size, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DynamicIcon_default, { name: icon.name }) });
@@ -1741,8 +1706,8 @@ var import_components19 = require("@transferwise/components");
1741
1706
  var import_components18 = require("@transferwise/components");
1742
1707
  var import_jsx_runtime29 = require("react/jsx-runtime");
1743
1708
  function OptionMedia({ icon, image }) {
1744
- if (image == null ? void 0 : image.url) {
1745
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { src: image.url, alt: image.accessibilityDescription || "", width: "64px" });
1709
+ if (image && !image.uri.startsWith("urn:")) {
1710
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { src: image.uri, alt: image.accessibilityDescription || "", width: "64px" });
1746
1711
  }
1747
1712
  if (icon && "name" in icon) {
1748
1713
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components18.Avatar, { type: import_components18.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DynamicIcon_default, { name: icon.name }) });
package/build/main.mjs CHANGED
@@ -267,7 +267,7 @@ var init_index_8Fxev6OI_esm = __esm({
267
267
 
268
268
  // src/index.ts
269
269
  import { makeHttpClient } from "@wise/dynamic-flow-client";
270
- import { JsonSchemaForm, isValidSchema, findType, find } from "@wise/dynamic-flow-client";
270
+ import { JsonSchemaForm, isValidSchema, findRendererPropsByType } from "@wise/dynamic-flow-client";
271
271
 
272
272
  // src/i18n/index.ts
273
273
  import { translations as coreTranslations } from "@wise/dynamic-flow-client";
@@ -1073,36 +1073,24 @@ import { Button } from "@transferwise/components";
1073
1073
  import { jsx as jsx7 } from "react/jsx-runtime";
1074
1074
  var ButtonRenderer = {
1075
1075
  canRenderType: "button",
1076
- render: ButtonRendererComponent
1076
+ render: ({ control, context, disabled, margin, title, size: size2, onClick }) => {
1077
+ const priority = mapControl(control);
1078
+ const type = priority === "tertiary" ? void 0 : mapContext(context);
1079
+ return /* @__PURE__ */ jsx7(
1080
+ Button,
1081
+ {
1082
+ block: true,
1083
+ className: getMargin(margin),
1084
+ disabled,
1085
+ priority,
1086
+ size: mapSize(size2),
1087
+ type,
1088
+ onClick,
1089
+ children: title
1090
+ }
1091
+ );
1092
+ }
1077
1093
  };
1078
- function ButtonRendererComponent({
1079
- control,
1080
- context,
1081
- disabled,
1082
- margin,
1083
- title,
1084
- size: size2,
1085
- stepLoadingState,
1086
- onClick
1087
- }) {
1088
- const className = getMargin(margin);
1089
- const priority = mapControl(control);
1090
- const type = priority === "tertiary" ? void 0 : mapContext(context);
1091
- const isLoading = stepLoadingState !== "idle";
1092
- return /* @__PURE__ */ jsx7(
1093
- Button,
1094
- {
1095
- block: true,
1096
- className,
1097
- disabled: isLoading || disabled,
1098
- priority,
1099
- size: mapSize(size2),
1100
- type,
1101
- onClick,
1102
- children: title
1103
- }
1104
- );
1105
- }
1106
1094
  var mapContext = (context) => {
1107
1095
  switch (context) {
1108
1096
  case "neutral":
@@ -1345,13 +1333,10 @@ function NavigationOptionMedia({ icon, image }) {
1345
1333
  }
1346
1334
  }
1347
1335
  if (image) {
1348
- const { accessibilityDescription, uri, url } = image;
1349
- if (uri && !uri.startsWith("urn:")) {
1336
+ const { accessibilityDescription, uri } = image;
1337
+ if (!uri.startsWith("urn:")) {
1350
1338
  return /* @__PURE__ */ jsx15("img", { src: uri, alt: accessibilityDescription });
1351
1339
  }
1352
- if (url) {
1353
- return /* @__PURE__ */ jsx15("img", { src: url, alt: accessibilityDescription });
1354
- }
1355
1340
  }
1356
1341
  return null;
1357
1342
  }
@@ -1360,24 +1345,14 @@ function NavigationOptionMedia({ icon, image }) {
1360
1345
  import { jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
1361
1346
  var DecisionRenderer = {
1362
1347
  canRenderType: "decision",
1363
- render: DecisionRendererComponent
1364
- };
1365
- var DecisionRenderer_default = DecisionRenderer;
1366
- function DecisionRendererComponent({
1367
- margin,
1368
- options,
1369
- title,
1370
- stepLoadingState
1371
- }) {
1372
- const isLoading = stepLoadingState !== "idle";
1373
- return /* @__PURE__ */ jsxs4("div", { className: getMargin(margin), children: [
1348
+ render: ({ margin, options, title }) => /* @__PURE__ */ jsxs4("div", { className: getMargin(margin), children: [
1374
1349
  title && /* @__PURE__ */ jsx16(Header, { as: "h2", title }),
1375
1350
  /* @__PURE__ */ jsx16(NavigationOptionsList, { children: options.map(({ description, disabled, icon, image, title: itemTitle, onClick }) => /* @__PURE__ */ jsx16(
1376
1351
  NavigationOption,
1377
1352
  {
1378
1353
  title: itemTitle,
1379
1354
  content: description,
1380
- disabled: isLoading || disabled,
1355
+ disabled,
1381
1356
  media: /* @__PURE__ */ jsx16(NavigationOptionMedia, { icon, image }),
1382
1357
  showMediaCircle: false,
1383
1358
  showMediaAtAllSizes: true,
@@ -1385,8 +1360,9 @@ function DecisionRendererComponent({
1385
1360
  },
1386
1361
  JSON.stringify(itemTitle)
1387
1362
  )) })
1388
- ] });
1389
- }
1363
+ ] })
1364
+ };
1365
+ var DecisionRenderer_default = DecisionRenderer;
1390
1366
 
1391
1367
  // ../renderers/src/DividerRenderer.tsx
1392
1368
  import { jsx as jsx17 } from "react/jsx-runtime";
@@ -1491,19 +1467,14 @@ function ImageRendererComponent({
1491
1467
  margin,
1492
1468
  size: size2,
1493
1469
  uri,
1494
- url,
1495
1470
  httpClient
1496
1471
  }) {
1497
1472
  const [imageSource, setImageSource] = useState2("");
1498
1473
  useEffect2(() => {
1499
- if (!uri) {
1500
- void getImageSource(httpClient, url).then(setImageSource);
1501
- return;
1502
- }
1503
1474
  if (!uri.startsWith("urn:")) {
1504
1475
  void getImageSource(httpClient, uri).then(setImageSource);
1505
1476
  }
1506
- }, [uri, url, httpClient]);
1477
+ }, [uri, httpClient]);
1507
1478
  return /* @__PURE__ */ jsx21("div", { className: `df-image ${size2 || "md"}`, children: /* @__PURE__ */ jsx21(
1508
1479
  Image,
1509
1480
  {
@@ -1580,16 +1551,11 @@ import { Avatar as Avatar2, AvatarType as AvatarType2 } from "@transferwise/comp
1580
1551
  import { jsx as jsx23 } from "react/jsx-runtime";
1581
1552
  var size = 24;
1582
1553
  function getIconAvatar({ icon, image }) {
1583
- if (image == null ? void 0 : image.url) {
1584
- return /* @__PURE__ */ jsx23(
1585
- "img",
1586
- {
1587
- src: image.url,
1588
- alt: image.accessibilityDescription,
1589
- width: `${size}px`,
1590
- height: `${size}px`
1591
- }
1592
- );
1554
+ if (image) {
1555
+ const { accessibilityDescription, uri } = image;
1556
+ if (!uri.startsWith("urn:")) {
1557
+ return /* @__PURE__ */ jsx23("img", { src: uri, alt: accessibilityDescription, width: `${size}px`, height: `${size}px` });
1558
+ }
1593
1559
  }
1594
1560
  if (isFlagIcon2(icon)) {
1595
1561
  return /* @__PURE__ */ jsx23(Avatar2, { type: AvatarType2.ICON, size, children: /* @__PURE__ */ jsx23(DynamicIcon_default, { name: icon.name }) });
@@ -1726,8 +1692,8 @@ import { SelectInput, SelectInputOptionContent } from "@transferwise/components"
1726
1692
  import { Avatar as Avatar3, AvatarType as AvatarType3 } from "@transferwise/components";
1727
1693
  import { jsx as jsx28 } from "react/jsx-runtime";
1728
1694
  function OptionMedia({ icon, image }) {
1729
- if (image == null ? void 0 : image.url) {
1730
- return /* @__PURE__ */ jsx28("img", { src: image.url, alt: image.accessibilityDescription || "", width: "64px" });
1695
+ if (image && !image.uri.startsWith("urn:")) {
1696
+ return /* @__PURE__ */ jsx28("img", { src: image.uri, alt: image.accessibilityDescription || "", width: "64px" });
1731
1697
  }
1732
1698
  if (icon && "name" in icon) {
1733
1699
  return /* @__PURE__ */ jsx28(Avatar3, { type: AvatarType3.ICON, children: /* @__PURE__ */ jsx28(DynamicIcon_default, { name: icon.name }) });
@@ -3321,8 +3287,7 @@ export {
3321
3287
  DynamicFlowRevamp,
3322
3288
  DynamicForm,
3323
3289
  JsonSchemaForm,
3324
- find,
3325
- findType,
3290
+ findRendererPropsByType,
3326
3291
  isValidSchema,
3327
3292
  makeHttpClient as makeCustomFetch,
3328
3293
  i18n_default as translations
@@ -1,7 +1,7 @@
1
1
  export { makeHttpClient as makeCustomFetch } from '@wise/dynamic-flow-client';
2
2
  export type { DynamicFlowProps, DynamicFormController, Step, InitialAction, } from '@wise/dynamic-flow-client';
3
3
  export type { Renderer, Renderers, AlertRendererProps, CheckboxInputRendererProps, BoxRendererProps, ButtonRendererProps, ColumnsRendererProps, DateInputRendererProps, DecisionRendererProps, DividerRendererProps, FormRendererProps, SectionRendererProps, HeadingRendererProps, HiddenRendererProps, ImageRendererProps, InstructionsRendererProps, IntegerInputRendererProps, LoadingIndicatorRendererProps, MarkdownRendererProps, ModalRendererProps, MultiSelectInputRendererProps, MultiUploadInputRendererProps, NumberInputRendererProps, ParagraphRendererProps, RepeatableRendererProps, ReviewRendererProps, SearchRendererProps, SelectInputRendererProps, StatusListRendererProps, StepRendererProps, TextInputRendererProps, UploadInputRendererProps, } from '@wise/dynamic-flow-types/build/renderers';
4
- export { JsonSchemaForm, isValidSchema, findType, find } from '@wise/dynamic-flow-client';
4
+ export { JsonSchemaForm, isValidSchema, findRendererPropsByType } from '@wise/dynamic-flow-client';
5
5
  export { default as translations } from './i18n';
6
6
  export type { DynamicFlowLegacyProps, DynamicFlowRevampProps } from './dynamicFlow/DynamicFlow';
7
7
  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.0.0-experimental-dde19b5",
3
+ "version": "4.0.0-experimental-9cbdd3f",
4
4
  "description": "Dynamic Flow web client for Wise",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -83,8 +83,8 @@
83
83
  "typescript": "5.7.3",
84
84
  "webpack": "5.97.1",
85
85
  "@wise/dynamic-flow-fixtures": "0.0.1",
86
- "@wise/dynamic-flow-types": "3.0.0-experimental-dde19b5",
87
- "@wise/dynamic-flow-renderers": "0.0.0"
86
+ "@wise/dynamic-flow-renderers": "0.0.0",
87
+ "@wise/dynamic-flow-types": "3.0.0-experimental-9cbdd3f"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "@transferwise/components": "^46.92.0",
@@ -98,8 +98,8 @@
98
98
  },
99
99
  "dependencies": {
100
100
  "classnames": "2.5.1",
101
- "@wise/dynamic-flow-types": "3.0.0-experimental-dde19b5",
102
- "@wise/dynamic-flow-client": "4.0.0-experimental-dde19b5"
101
+ "@wise/dynamic-flow-client": "4.0.0-experimental-9cbdd3f",
102
+ "@wise/dynamic-flow-types": "3.0.0-experimental-9cbdd3f"
103
103
  },
104
104
  "scripts": {
105
105
  "dev": "pnpm build:visual-tests && storybook dev -p 3005",