@wise/dynamic-flow-client-internal 5.2.0 → 5.4.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/README.md CHANGED
@@ -235,51 +235,6 @@ onLog={(level, message, extra) => {
235
235
  }}
236
236
  ```
237
237
 
238
- ## DynamicForm Component
239
-
240
- If you need to get the submittable data outside of a submission, you can use the `DynamicForm` component. This will give you access to two methods: `getValue` and `validate` via a [ref](https://react.dev/reference/react/useRef). For example:
241
-
242
- ```tsx
243
- import type { DynamicFormController } from '@wise/dynamic-flow-client-internal';
244
- import { DynamicForm } from '@wise/dynamic-flow-client-internal';
245
- import { useRef } from 'react';
246
-
247
- function DynamicFlowWithRef() {
248
- const ref = useRef<DynamicFormController>(null);
249
-
250
- return (
251
- <div>
252
- <DynamicForm
253
- ref={ref}
254
- flowId={"id"}
255
- customFetch={fetch}
256
- initialStep={myStep}
257
- onValueChange={ async () => {
258
- const value = (await ref.current?.getValue()) ?? null;
259
- console.log('Value changed to', JSON.stringify(value));
260
- }}
261
- onCompletion={(error) => console.error(error)}
262
- onCompletion={() => console.log('Completed')}
263
- />
264
- <Button
265
- onClick={ async () => {
266
- // This will get the value, whether or not the form is valid
267
- const value = (await ref.current?.getValue()) ?? null;
268
-
269
- // This will trigger validation of the form and show any validation messages to the user.
270
- // The response is a boolean indicating whether or not the form is valid.
271
- const isValid = ref.current?.validate();
272
-
273
- // Whatever you want to do with value
274
- }}
275
- >
276
- Log value
277
- </Button>
278
- </div>
279
- );
280
- }
281
- ```
282
-
283
238
  ## Contributing
284
239
 
285
240
  We love contributions! Check out `CONTRIBUTING.md` for more information.
package/build/main.css CHANGED
@@ -14,7 +14,11 @@
14
14
  .df-box-renderer-width-lg {
15
15
  width: 100%;
16
16
  }
17
- @media screen and (width >= 768px) {
17
+ @media screen and (width >=768px) {
18
+ .df-box-renderer-border {
19
+ padding: var(--size-24);
20
+ }
21
+
18
22
  .df-box-renderer-width-xs {
19
23
  width: 33.33%;
20
24
  }
@@ -31,7 +35,7 @@
31
35
  width: 83.33%;
32
36
  }
33
37
  }
34
- @media screen and (width >= 990px) {
38
+ @media screen and (width >=990px) {
35
39
  .df-box-renderer-width-xs {
36
40
  width: 25%;
37
41
  }
@@ -176,6 +180,16 @@
176
180
  .tw-modal-body--scrollable .df-step-fixed__footer {
177
181
  bottom: -24px;
178
182
  }
183
+ .df-modal .df-back-button {
184
+ position: fixed;
185
+ top: 24px;
186
+ }
187
+ .dynamic-flow-modal .df-back-button {
188
+ position: fixed;
189
+ top: 24px;
190
+ width: 40px;
191
+ height: 40px;
192
+ }
179
193
  .chips-container {
180
194
  overflow-x: auto;
181
195
  }
package/build/main.js CHANGED
@@ -124,21 +124,77 @@ var require_classnames = __commonJS({
124
124
  var index_exports = {};
125
125
  __export(index_exports, {
126
126
  DynamicFlow: () => DynamicFlow,
127
- DynamicForm: () => DynamicForm,
127
+ DynamicFlowWithRef: () => DynamicFlowWithRef,
128
128
  Header: () => Header11,
129
129
  Media: () => Media2,
130
- findRendererPropsByType: () => import_dynamic_flow_client4.findRendererPropsByType,
130
+ findRendererPropsByType: () => import_dynamic_flow_client7.findRendererPropsByType,
131
131
  getMargin: () => getMargin2,
132
- makeCustomFetch: () => import_dynamic_flow_client3.makeHttpClient,
132
+ makeCustomFetch: () => import_dynamic_flow_client6.makeHttpClient,
133
133
  translations: () => i18n_default
134
134
  });
135
135
  module.exports = __toCommonJS(index_exports);
136
- var import_dynamic_flow_client3 = require("@wise/dynamic-flow-client");
136
+ var import_dynamic_flow_client6 = require("@wise/dynamic-flow-client");
137
137
 
138
138
  // src/dynamicFlow/DynamicFlow.tsx
139
- var import_react19 = require("react");
140
- var import_react_intl27 = require("react-intl");
139
+ var import_dynamic_flow_client3 = require("@wise/dynamic-flow-client");
140
+
141
+ // src/dynamicFlow/useWiseToCoreProps.tsx
142
+ var import_react21 = require("react");
143
+
144
+ // src/dynamicFlow/telemetry/app-version.ts
145
+ var appVersion = (
146
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
147
+ typeof process !== "undefined" ? "5.4.0" : "0.0.0"
148
+ );
149
+
150
+ // src/dynamicFlow/telemetry/getLogEvent.ts
151
+ var getLogEvent = (onLog) => (level, message, extra) => {
152
+ const extraWithVersion = __spreadProps(__spreadValues({}, extra), {
153
+ dfWiseVersion: appVersion
154
+ });
155
+ if (level !== "info" && onLog) {
156
+ if (onLog) {
157
+ onLog(level, message, extraWithVersion);
158
+ } else {
159
+ logToRollbar(level, message, extraWithVersion);
160
+ }
161
+ }
162
+ };
163
+ var logToRollbar = (level, message, extra) => {
164
+ try {
165
+ const rollbar = typeof window.Rollbar !== "undefined" ? window.Rollbar : void 0;
166
+ rollbar == null ? void 0 : rollbar[level](message, extra);
167
+ } catch (error) {
168
+ console.error("Failed to log to Rollbar", error);
169
+ }
170
+ };
171
+
172
+ // src/dynamicFlow/telemetry/getTrackEvent.ts
141
173
  var import_dynamic_flow_client = require("@wise/dynamic-flow-client");
174
+ var prefix = "Dynamic Flow - ";
175
+ var getTrackEvent = (onEvent, onAnalytics) => (name, properties) => {
176
+ onEvent == null ? void 0 : onEvent(name, properties);
177
+ if (includeInAnalytics(name)) {
178
+ onAnalytics == null ? void 0 : onAnalytics(name, properties);
179
+ }
180
+ };
181
+ var includeInAnalytics = (name) => {
182
+ const eventName = name.startsWith(prefix) ? name.slice(prefix.length) : name;
183
+ if (isCoreEventName(eventName)) {
184
+ return true;
185
+ }
186
+ if (eventName in customEventsToAnalytics) {
187
+ return customEventsToAnalytics[eventName];
188
+ }
189
+ return true;
190
+ };
191
+ var isCoreEventName = (eventName) => {
192
+ return import_dynamic_flow_client.eventNames.includes(eventName);
193
+ };
194
+ var customEventsToAnalytics = {
195
+ "Theme Required": false
196
+ // Excluded from analytics
197
+ };
142
198
 
143
199
  // ../renderers/src/AlertRenderer.tsx
144
200
  var import_components = require("@transferwise/components");
@@ -1149,7 +1205,7 @@ var import_react4 = require("react");
1149
1205
  // ../renderers/src/utils/api-utils.ts
1150
1206
  function isRelativePath(url = "") {
1151
1207
  return !["https://", "http://", "data:"].some(
1152
- (prefix) => url.startsWith(prefix) && url.length > prefix.length
1208
+ (prefix2) => url.startsWith(prefix2) && url.length > prefix2.length
1153
1209
  );
1154
1210
  }
1155
1211
 
@@ -3512,9 +3568,10 @@ var DecisionRenderer = {
3512
3568
  };
3513
3569
  var renderDecisionList = ({ options, control }) => {
3514
3570
  return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_jsx_runtime78.Fragment, { children: options.map((_a) => {
3515
- var _b = _a, { disabled, onClick } = _b, rest = __objRest(_b, ["disabled", "onClick"]);
3571
+ var _b = _a, { onClick } = _b, rest = __objRest(_b, ["onClick"]);
3516
3572
  const {
3517
3573
  description,
3574
+ disabled,
3518
3575
  media,
3519
3576
  title: itemTitle,
3520
3577
  href,
@@ -3731,6 +3788,36 @@ var getWiseRenderers = () => [
3731
3788
  ReviewLegacyRenderer_default
3732
3789
  ];
3733
3790
 
3791
+ // ../renderers/src/subflow/getSubflowRenderer.tsx
3792
+ var import_jsx_runtime82 = require("react/jsx-runtime");
3793
+ var getSubflowRenderer = ({
3794
+ Component: Component2,
3795
+ canRender
3796
+ }) => {
3797
+ return {
3798
+ canRenderType: "subflow",
3799
+ canRender,
3800
+ render: (props) => {
3801
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
3802
+ Component2,
3803
+ {
3804
+ presentation: props.presentation,
3805
+ requestCache: props.requestCache,
3806
+ initialRequest: props.initialRequest,
3807
+ onCompletion: props.onCompletion,
3808
+ onError: props.onError,
3809
+ onCancellation: props.onCancellation,
3810
+ onEvent: props.onEvent
3811
+ }
3812
+ );
3813
+ }
3814
+ };
3815
+ };
3816
+
3817
+ // src/dynamicFlow/useOnCopy.tsx
3818
+ var import_react19 = require("react");
3819
+ var import_react_intl27 = require("react-intl");
3820
+
3734
3821
  // src/dynamicFlow/messages.ts
3735
3822
  var import_react_intl26 = require("react-intl");
3736
3823
  var messages_default = (0, import_react_intl26.defineMessages)({
@@ -3746,120 +3833,28 @@ var messages_default = (0, import_react_intl26.defineMessages)({
3746
3833
  }
3747
3834
  });
3748
3835
 
3749
- // src/dynamicFlow/telemetry/app-version.ts
3750
- var appVersion = (
3751
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
3752
- typeof process !== "undefined" ? "5.2.0" : "0.0.0"
3753
- );
3754
-
3755
- // src/dynamicFlow/telemetry/getLogEvent.ts
3756
- var getLogEvent = (onLog) => (level, message, extra) => {
3757
- const extraWithVersion = __spreadProps(__spreadValues({}, extra), {
3758
- dfWiseVersion: appVersion
3759
- });
3760
- if (level !== "info" && onLog) {
3761
- if (onLog) {
3762
- onLog(level, message, extraWithVersion);
3763
- } else {
3764
- logToRollbar(level, message, extraWithVersion);
3765
- }
3766
- }
3767
- };
3768
- var logToRollbar = (level, message, extra) => {
3769
- try {
3770
- const rollbar = typeof window.Rollbar !== "undefined" ? window.Rollbar : void 0;
3771
- rollbar == null ? void 0 : rollbar[level](message, extra);
3772
- } catch (error) {
3773
- console.error("Failed to log to Rollbar", error);
3774
- }
3775
- };
3776
-
3777
- // src/dynamicFlow/telemetry/getTrackEvent.ts
3778
- var getTrackEvent = (onEvent, onAnalytics) => (name, properties) => {
3779
- onEvent == null ? void 0 : onEvent(name, properties);
3780
- if (!name.includes(ThemeRequiredEventName)) {
3781
- onAnalytics == null ? void 0 : onAnalytics(name, properties);
3782
- }
3783
- };
3784
-
3785
- // src/dynamicFlow/DynamicFlow.tsx
3786
- var import_jsx_runtime82 = require("react/jsx-runtime");
3787
- var wiseRenderers = getWiseRenderers();
3788
- function DynamicFlow(props) {
3789
- const {
3790
- className = "",
3791
- customFetch = globalThis.fetch,
3792
- renderers,
3793
- displayStepTitle = true,
3794
- features = {},
3795
- onAnalytics,
3796
- onEvent,
3797
- onLog,
3798
- onLink = openLinkInNewTab
3799
- } = props;
3800
- const { formatMessage } = (0, import_react_intl27.useIntl)();
3801
- const createSnackBar = useSnackBarIfAvailable();
3802
- const httpClient = useWiseHttpClient(customFetch);
3803
- const mergedRenderers = (0, import_react19.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
3804
- const logEvent = (0, import_react19.useMemo)(() => getLogEvent(onLog), [onLog]);
3805
- const trackEvent = (0, import_react19.useMemo)(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
3806
- const onCopy = (copiedContent) => {
3807
- if (copiedContent) {
3808
- createSnackBar({ text: formatMessage(messages_default.copied) });
3809
- } else {
3810
- createSnackBar({ text: formatMessage(messages_default.copyFailed) });
3811
- }
3812
- };
3813
- const coreProps = __spreadProps(__spreadValues({}, props), {
3814
- features: __spreadValues({ hideStepTitle: !displayStepTitle }, features),
3815
- httpClient,
3816
- renderers: mergedRenderers,
3817
- onEvent: trackEvent,
3818
- onLog: logEvent,
3819
- onLink,
3820
- onCopy
3821
- });
3822
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_dynamic_flow_client.DynamicFlow, __spreadValues({}, coreProps)) });
3823
- }
3824
- var DynamicForm = (0, import_react19.forwardRef)(function DynamicForm2(props, ref) {
3825
- const {
3826
- className = "",
3827
- customFetch = globalThis.fetch,
3828
- renderers,
3829
- displayStepTitle = true,
3830
- features = {},
3831
- onAnalytics,
3832
- onEvent,
3833
- onLog,
3834
- onLink = openLinkInNewTab
3835
- } = props;
3836
+ // src/dynamicFlow/useOnCopy.tsx
3837
+ var useOnCopy = () => {
3836
3838
  const { formatMessage } = (0, import_react_intl27.useIntl)();
3837
3839
  const createSnackBar = useSnackBarIfAvailable();
3838
- const httpClient = useWiseHttpClient(customFetch);
3839
- const mergedRenderers = (0, import_react19.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
3840
- const logEvent = (0, import_react19.useMemo)(() => getLogEvent(onLog), [onLog]);
3841
- const trackEvent = (0, import_react19.useMemo)(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
3842
- const onCopy = (copiedContent) => {
3843
- if (copiedContent) {
3844
- createSnackBar({ text: formatMessage(messages_default.copied) });
3845
- } else {
3846
- createSnackBar({ text: formatMessage(messages_default.copyFailed) });
3847
- }
3848
- };
3849
- const coreProps = __spreadProps(__spreadValues({}, props), {
3850
- httpClient,
3851
- renderers: mergedRenderers,
3852
- features: __spreadValues({ hideStepTitle: !displayStepTitle }, features),
3853
- onEvent: trackEvent,
3854
- onLog: logEvent,
3855
- onLink,
3856
- onCopy
3857
- });
3858
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_dynamic_flow_client.DynamicForm, __spreadProps(__spreadValues({}, coreProps), { ref })) });
3859
- });
3860
- var useWiseHttpClient = (httpClient) => {
3861
- const { locale } = (0, import_react_intl27.useIntl)();
3862
3840
  return (0, import_react19.useCallback)(
3841
+ (copiedContent) => {
3842
+ if (copiedContent) {
3843
+ createSnackBar({ text: formatMessage(messages_default.copied) });
3844
+ } else {
3845
+ createSnackBar({ text: formatMessage(messages_default.copyFailed) });
3846
+ }
3847
+ },
3848
+ [createSnackBar, formatMessage]
3849
+ );
3850
+ };
3851
+
3852
+ // src/dynamicFlow/useWiseHttpClient.tsx
3853
+ var import_react20 = require("react");
3854
+ var import_react_intl28 = require("react-intl");
3855
+ var useWiseHttpClient = (httpClient) => {
3856
+ const { locale } = (0, import_react_intl28.useIntl)();
3857
+ return (0, import_react20.useCallback)(
3863
3858
  async (input, init = {}) => {
3864
3859
  const headers = new Headers(init.headers);
3865
3860
  headers.set("accept-language", locale);
@@ -3879,6 +3874,80 @@ var handleRejection = (error) => {
3879
3874
  }
3880
3875
  throw error;
3881
3876
  };
3877
+
3878
+ // src/dynamicFlow/DynamicFlowModal.tsx
3879
+ var import_dynamic_flow_client2 = require("@wise/dynamic-flow-client");
3880
+ var import_components59 = require("@transferwise/components");
3881
+ var import_jsx_runtime83 = require("react/jsx-runtime");
3882
+ function DynamicFlowModal(props) {
3883
+ const _a = props, { className = "" } = _a, rest = __objRest(_a, ["className"]);
3884
+ const dfProps = useWiseToCoreProps(rest);
3885
+ const df = (0, import_dynamic_flow_client2.useDynamicFlowModal)(dfProps);
3886
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
3887
+ import_components59.Modal,
3888
+ __spreadProps(__spreadValues({
3889
+ className: `dynamic-flow-modal ${className}`,
3890
+ disableDimmerClickToClose: true
3891
+ }, df.modal), {
3892
+ body: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "dynamic-flow-modal", children: df.modal.body })
3893
+ })
3894
+ );
3895
+ }
3896
+
3897
+ // src/dynamicFlow/getMergedRenderers.tsx
3898
+ var import_jsx_runtime84 = require("react/jsx-runtime");
3899
+ var wiseRenderers = getWiseRenderers();
3900
+ var getMergedRenderers = (props) => {
3901
+ var _d;
3902
+ const _a = props, { initialAction, initialStep } = _a, restProps = __objRest(_a, ["initialAction", "initialStep"]);
3903
+ const subflowFeatures = __spreadProps(__spreadValues({}, props.features), { nativeBack: true });
3904
+ const subflowRenderer = getSubflowRenderer({
3905
+ Component: (_b) => {
3906
+ var _c = _b, { presentation, initialRequest } = _c, rest = __objRest(_c, ["presentation", "initialRequest"]);
3907
+ const action = {
3908
+ url: initialRequest.url,
3909
+ method: initialRequest.method,
3910
+ data: initialRequest.body
3911
+ };
3912
+ return presentation.type === "push" ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(DynamicFlow, __spreadProps(__spreadValues(__spreadValues({}, restProps), rest), { features: subflowFeatures, initialAction: action })) : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
3913
+ DynamicFlowModal,
3914
+ __spreadProps(__spreadValues(__spreadValues({}, restProps), rest), {
3915
+ features: subflowFeatures,
3916
+ initialAction: action
3917
+ })
3918
+ );
3919
+ }
3920
+ });
3921
+ return [...(_d = props.renderers) != null ? _d : [], subflowRenderer, ...wiseRenderers];
3922
+ };
3923
+
3924
+ // src/dynamicFlow/useWiseToCoreProps.tsx
3925
+ var useWiseToCoreProps = (props) => {
3926
+ const {
3927
+ displayStepTitle = true,
3928
+ features = {},
3929
+ customFetch = globalThis.fetch,
3930
+ renderers,
3931
+ onAnalytics,
3932
+ onEvent,
3933
+ onLink = openLinkInNewTab,
3934
+ onLog
3935
+ } = props;
3936
+ const httpClient = useWiseHttpClient(customFetch);
3937
+ const mergedRenderers = (0, import_react21.useMemo)(() => getMergedRenderers(props), [renderers]);
3938
+ const logEvent = (0, import_react21.useMemo)(() => getLogEvent(onLog), [onLog]);
3939
+ const trackEvent = (0, import_react21.useMemo)(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
3940
+ const onCopy = useOnCopy();
3941
+ return __spreadProps(__spreadValues({}, props), {
3942
+ httpClient,
3943
+ features: __spreadValues({ hideStepTitle: !displayStepTitle }, features),
3944
+ renderers: mergedRenderers,
3945
+ onEvent: trackEvent,
3946
+ onLog: logEvent,
3947
+ onCopy,
3948
+ onLink
3949
+ });
3950
+ };
3882
3951
  var openLinkInNewTab = (url) => {
3883
3952
  var _a;
3884
3953
  try {
@@ -3889,16 +3958,47 @@ var openLinkInNewTab = (url) => {
3889
3958
  }
3890
3959
  };
3891
3960
 
3892
- // src/index.ts
3961
+ // src/dynamicFlow/DynamicFlow.tsx
3962
+ var import_jsx_runtime85 = require("react/jsx-runtime");
3963
+ function DynamicFlow(props) {
3964
+ const { className = "" } = props;
3965
+ const dfProps = useWiseToCoreProps(props);
3966
+ const df = (0, import_dynamic_flow_client3.useDynamicFlow)(dfProps);
3967
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className, children: df.view });
3968
+ }
3969
+
3970
+ // src/dynamicFlow/DynamicFlowWithRef.tsx
3971
+ var import_react22 = require("react");
3893
3972
  var import_dynamic_flow_client4 = require("@wise/dynamic-flow-client");
3973
+ var import_jsx_runtime86 = require("react/jsx-runtime");
3974
+ var DynamicFlowWithRef = (0, import_react22.forwardRef)(function DynamicFlowWithRef2(props, ref) {
3975
+ const { className = "" } = props;
3976
+ const dfProps = useWiseToCoreProps(props);
3977
+ const df = (0, import_dynamic_flow_client4.useDynamicFlow)(dfProps);
3978
+ (0, import_react22.useImperativeHandle)(
3979
+ ref,
3980
+ () => ({
3981
+ getValue: async () => {
3982
+ var _a;
3983
+ return (_a = await df.controller.getSubmittableValue()) != null ? _a : null;
3984
+ },
3985
+ validate: () => df.controller.validate()
3986
+ }),
3987
+ [df]
3988
+ );
3989
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className, children: df.view });
3990
+ });
3894
3991
 
3895
- // src/dynamicFlow/renderers.ts
3992
+ // src/index.ts
3993
+ var import_dynamic_flow_client7 = require("@wise/dynamic-flow-client");
3994
+
3995
+ // src/dynamicFlow/renderers.tsx
3896
3996
  var Header11 = Header7;
3897
3997
  var Media2 = Media;
3898
3998
  var getMargin2 = getMargin;
3899
3999
 
3900
4000
  // src/i18n/index.ts
3901
- var import_dynamic_flow_client2 = require("@wise/dynamic-flow-client");
4001
+ var import_dynamic_flow_client5 = require("@wise/dynamic-flow-client");
3902
4002
 
3903
4003
  // src/i18n/cs.json
3904
4004
  var cs_default = {
@@ -4751,10 +4851,10 @@ var wiseTranslations = {
4751
4851
  "zh-HK": zh_HK_default
4752
4852
  };
4753
4853
  var languages = Array.from(
4754
- /* @__PURE__ */ new Set([...Object.keys(import_dynamic_flow_client2.translations), ...Object.keys(wiseTranslations)])
4854
+ /* @__PURE__ */ new Set([...Object.keys(import_dynamic_flow_client5.translations), ...Object.keys(wiseTranslations)])
4755
4855
  );
4756
4856
  var translations = languages.reduce(
4757
- (acc, lang) => __spreadProps(__spreadValues({}, acc), { [lang]: __spreadValues(__spreadValues({}, import_dynamic_flow_client2.translations[lang]), wiseTranslations[lang]) }),
4857
+ (acc, lang) => __spreadProps(__spreadValues({}, acc), { [lang]: __spreadValues(__spreadValues({}, import_dynamic_flow_client5.translations[lang]), wiseTranslations[lang]) }),
4758
4858
  {}
4759
4859
  );
4760
4860
  var i18n_default = translations;
package/build/main.mjs CHANGED
@@ -118,12 +118,65 @@ var require_classnames = __commonJS({
118
118
  import { makeHttpClient } from "@wise/dynamic-flow-client";
119
119
 
120
120
  // src/dynamicFlow/DynamicFlow.tsx
121
- import { forwardRef, useCallback, useMemo as useMemo2 } from "react";
122
- import { useIntl as useIntl15 } from "react-intl";
123
- import {
124
- DynamicFlow as DynamicFlowCore,
125
- DynamicForm as DynamicFormCore
126
- } from "@wise/dynamic-flow-client";
121
+ import { useDynamicFlow } from "@wise/dynamic-flow-client";
122
+
123
+ // src/dynamicFlow/useWiseToCoreProps.tsx
124
+ import { useMemo as useMemo2 } from "react";
125
+
126
+ // src/dynamicFlow/telemetry/app-version.ts
127
+ var appVersion = (
128
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
129
+ typeof process !== "undefined" ? "5.4.0" : "0.0.0"
130
+ );
131
+
132
+ // src/dynamicFlow/telemetry/getLogEvent.ts
133
+ var getLogEvent = (onLog) => (level, message, extra) => {
134
+ const extraWithVersion = __spreadProps(__spreadValues({}, extra), {
135
+ dfWiseVersion: appVersion
136
+ });
137
+ if (level !== "info" && onLog) {
138
+ if (onLog) {
139
+ onLog(level, message, extraWithVersion);
140
+ } else {
141
+ logToRollbar(level, message, extraWithVersion);
142
+ }
143
+ }
144
+ };
145
+ var logToRollbar = (level, message, extra) => {
146
+ try {
147
+ const rollbar = typeof window.Rollbar !== "undefined" ? window.Rollbar : void 0;
148
+ rollbar == null ? void 0 : rollbar[level](message, extra);
149
+ } catch (error) {
150
+ console.error("Failed to log to Rollbar", error);
151
+ }
152
+ };
153
+
154
+ // src/dynamicFlow/telemetry/getTrackEvent.ts
155
+ import { eventNames } from "@wise/dynamic-flow-client";
156
+ var prefix = "Dynamic Flow - ";
157
+ var getTrackEvent = (onEvent, onAnalytics) => (name, properties) => {
158
+ onEvent == null ? void 0 : onEvent(name, properties);
159
+ if (includeInAnalytics(name)) {
160
+ onAnalytics == null ? void 0 : onAnalytics(name, properties);
161
+ }
162
+ };
163
+ var includeInAnalytics = (name) => {
164
+ const eventName = name.startsWith(prefix) ? name.slice(prefix.length) : name;
165
+ if (isCoreEventName(eventName)) {
166
+ return true;
167
+ }
168
+ if (eventName in customEventsToAnalytics) {
169
+ return customEventsToAnalytics[eventName];
170
+ }
171
+ return true;
172
+ };
173
+ var isCoreEventName = (eventName) => {
174
+ return eventNames.includes(eventName);
175
+ };
176
+ var customEventsToAnalytics = {
177
+ "Theme Required": false
178
+ // Excluded from analytics
179
+ };
127
180
 
128
181
  // ../renderers/src/AlertRenderer.tsx
129
182
  import { Alert } from "@transferwise/components";
@@ -1134,7 +1187,7 @@ import { useEffect as useEffect4, useState as useState3 } from "react";
1134
1187
  // ../renderers/src/utils/api-utils.ts
1135
1188
  function isRelativePath(url = "") {
1136
1189
  return !["https://", "http://", "data:"].some(
1137
- (prefix) => url.startsWith(prefix) && url.length > prefix.length
1190
+ (prefix2) => url.startsWith(prefix2) && url.length > prefix2.length
1138
1191
  );
1139
1192
  }
1140
1193
 
@@ -3506,9 +3559,10 @@ var DecisionRenderer = {
3506
3559
  };
3507
3560
  var renderDecisionList = ({ options, control }) => {
3508
3561
  return /* @__PURE__ */ jsx78(Fragment11, { children: options.map((_a) => {
3509
- var _b = _a, { disabled, onClick } = _b, rest = __objRest(_b, ["disabled", "onClick"]);
3562
+ var _b = _a, { onClick } = _b, rest = __objRest(_b, ["onClick"]);
3510
3563
  const {
3511
3564
  description,
3565
+ disabled,
3512
3566
  media,
3513
3567
  title: itemTitle,
3514
3568
  href,
@@ -3725,6 +3779,36 @@ var getWiseRenderers = () => [
3725
3779
  ReviewLegacyRenderer_default
3726
3780
  ];
3727
3781
 
3782
+ // ../renderers/src/subflow/getSubflowRenderer.tsx
3783
+ import { jsx as jsx82 } from "react/jsx-runtime";
3784
+ var getSubflowRenderer = ({
3785
+ Component: Component2,
3786
+ canRender
3787
+ }) => {
3788
+ return {
3789
+ canRenderType: "subflow",
3790
+ canRender,
3791
+ render: (props) => {
3792
+ return /* @__PURE__ */ jsx82(
3793
+ Component2,
3794
+ {
3795
+ presentation: props.presentation,
3796
+ requestCache: props.requestCache,
3797
+ initialRequest: props.initialRequest,
3798
+ onCompletion: props.onCompletion,
3799
+ onError: props.onError,
3800
+ onCancellation: props.onCancellation,
3801
+ onEvent: props.onEvent
3802
+ }
3803
+ );
3804
+ }
3805
+ };
3806
+ };
3807
+
3808
+ // src/dynamicFlow/useOnCopy.tsx
3809
+ import { useCallback } from "react";
3810
+ import { useIntl as useIntl15 } from "react-intl";
3811
+
3728
3812
  // src/dynamicFlow/messages.ts
3729
3813
  import { defineMessages as defineMessages12 } from "react-intl";
3730
3814
  var messages_default = defineMessages12({
@@ -3740,138 +3824,120 @@ var messages_default = defineMessages12({
3740
3824
  }
3741
3825
  });
3742
3826
 
3743
- // src/dynamicFlow/telemetry/app-version.ts
3744
- var appVersion = (
3745
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
3746
- typeof process !== "undefined" ? "5.2.0" : "0.0.0"
3747
- );
3827
+ // src/dynamicFlow/useOnCopy.tsx
3828
+ var useOnCopy = () => {
3829
+ const { formatMessage } = useIntl15();
3830
+ const createSnackBar = useSnackBarIfAvailable();
3831
+ return useCallback(
3832
+ (copiedContent) => {
3833
+ if (copiedContent) {
3834
+ createSnackBar({ text: formatMessage(messages_default.copied) });
3835
+ } else {
3836
+ createSnackBar({ text: formatMessage(messages_default.copyFailed) });
3837
+ }
3838
+ },
3839
+ [createSnackBar, formatMessage]
3840
+ );
3841
+ };
3748
3842
 
3749
- // src/dynamicFlow/telemetry/getLogEvent.ts
3750
- var getLogEvent = (onLog) => (level, message, extra) => {
3751
- const extraWithVersion = __spreadProps(__spreadValues({}, extra), {
3752
- dfWiseVersion: appVersion
3753
- });
3754
- if (level !== "info" && onLog) {
3755
- if (onLog) {
3756
- onLog(level, message, extraWithVersion);
3757
- } else {
3758
- logToRollbar(level, message, extraWithVersion);
3759
- }
3760
- }
3843
+ // src/dynamicFlow/useWiseHttpClient.tsx
3844
+ import { useCallback as useCallback2 } from "react";
3845
+ import { useIntl as useIntl16 } from "react-intl";
3846
+ var useWiseHttpClient = (httpClient) => {
3847
+ const { locale } = useIntl16();
3848
+ return useCallback2(
3849
+ async (input, init = {}) => {
3850
+ const headers = new Headers(init.headers);
3851
+ headers.set("accept-language", locale);
3852
+ const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || void 0;
3853
+ if (timeZone) {
3854
+ headers.set("time-zone", timeZone);
3855
+ }
3856
+ const requestInit = __spreadProps(__spreadValues({}, init), { credentials: "include", headers });
3857
+ return httpClient(input, requestInit).catch(handleRejection);
3858
+ },
3859
+ [httpClient, locale]
3860
+ );
3761
3861
  };
3762
- var logToRollbar = (level, message, extra) => {
3763
- try {
3764
- const rollbar = typeof window.Rollbar !== "undefined" ? window.Rollbar : void 0;
3765
- rollbar == null ? void 0 : rollbar[level](message, extra);
3766
- } catch (error) {
3767
- console.error("Failed to log to Rollbar", error);
3862
+ var handleRejection = (error) => {
3863
+ if (error instanceof Error && error.message === "SCA_MODAL_CLOSED") {
3864
+ return new Response(JSON.stringify({ validation: {} }), { status: 400 });
3768
3865
  }
3866
+ throw error;
3769
3867
  };
3770
3868
 
3771
- // src/dynamicFlow/telemetry/getTrackEvent.ts
3772
- var getTrackEvent = (onEvent, onAnalytics) => (name, properties) => {
3773
- onEvent == null ? void 0 : onEvent(name, properties);
3774
- if (!name.includes(ThemeRequiredEventName)) {
3775
- onAnalytics == null ? void 0 : onAnalytics(name, properties);
3776
- }
3777
- };
3869
+ // src/dynamicFlow/DynamicFlowModal.tsx
3870
+ import { useDynamicFlowModal } from "@wise/dynamic-flow-client";
3871
+ import { Modal as Modal5 } from "@transferwise/components";
3872
+ import { jsx as jsx83 } from "react/jsx-runtime";
3873
+ function DynamicFlowModal(props) {
3874
+ const _a = props, { className = "" } = _a, rest = __objRest(_a, ["className"]);
3875
+ const dfProps = useWiseToCoreProps(rest);
3876
+ const df = useDynamicFlowModal(dfProps);
3877
+ return /* @__PURE__ */ jsx83(
3878
+ Modal5,
3879
+ __spreadProps(__spreadValues({
3880
+ className: `dynamic-flow-modal ${className}`,
3881
+ disableDimmerClickToClose: true
3882
+ }, df.modal), {
3883
+ body: /* @__PURE__ */ jsx83("div", { className: "dynamic-flow-modal", children: df.modal.body })
3884
+ })
3885
+ );
3886
+ }
3778
3887
 
3779
- // src/dynamicFlow/DynamicFlow.tsx
3780
- import { jsx as jsx82 } from "react/jsx-runtime";
3888
+ // src/dynamicFlow/getMergedRenderers.tsx
3889
+ import { jsx as jsx84 } from "react/jsx-runtime";
3781
3890
  var wiseRenderers = getWiseRenderers();
3782
- function DynamicFlow(props) {
3783
- const {
3784
- className = "",
3785
- customFetch = globalThis.fetch,
3786
- renderers,
3787
- displayStepTitle = true,
3788
- features = {},
3789
- onAnalytics,
3790
- onEvent,
3791
- onLog,
3792
- onLink = openLinkInNewTab
3793
- } = props;
3794
- const { formatMessage } = useIntl15();
3795
- const createSnackBar = useSnackBarIfAvailable();
3796
- const httpClient = useWiseHttpClient(customFetch);
3797
- const mergedRenderers = useMemo2(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
3798
- const logEvent = useMemo2(() => getLogEvent(onLog), [onLog]);
3799
- const trackEvent = useMemo2(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
3800
- const onCopy = (copiedContent) => {
3801
- if (copiedContent) {
3802
- createSnackBar({ text: formatMessage(messages_default.copied) });
3803
- } else {
3804
- createSnackBar({ text: formatMessage(messages_default.copyFailed) });
3891
+ var getMergedRenderers = (props) => {
3892
+ var _d;
3893
+ const _a = props, { initialAction, initialStep } = _a, restProps = __objRest(_a, ["initialAction", "initialStep"]);
3894
+ const subflowFeatures = __spreadProps(__spreadValues({}, props.features), { nativeBack: true });
3895
+ const subflowRenderer = getSubflowRenderer({
3896
+ Component: (_b) => {
3897
+ var _c = _b, { presentation, initialRequest } = _c, rest = __objRest(_c, ["presentation", "initialRequest"]);
3898
+ const action = {
3899
+ url: initialRequest.url,
3900
+ method: initialRequest.method,
3901
+ data: initialRequest.body
3902
+ };
3903
+ return presentation.type === "push" ? /* @__PURE__ */ jsx84(DynamicFlow, __spreadProps(__spreadValues(__spreadValues({}, restProps), rest), { features: subflowFeatures, initialAction: action })) : /* @__PURE__ */ jsx84(
3904
+ DynamicFlowModal,
3905
+ __spreadProps(__spreadValues(__spreadValues({}, restProps), rest), {
3906
+ features: subflowFeatures,
3907
+ initialAction: action
3908
+ })
3909
+ );
3805
3910
  }
3806
- };
3807
- const coreProps = __spreadProps(__spreadValues({}, props), {
3808
- features: __spreadValues({ hideStepTitle: !displayStepTitle }, features),
3809
- httpClient,
3810
- renderers: mergedRenderers,
3811
- onEvent: trackEvent,
3812
- onLog: logEvent,
3813
- onLink,
3814
- onCopy
3815
3911
  });
3816
- return /* @__PURE__ */ jsx82("div", { className, children: /* @__PURE__ */ jsx82(DynamicFlowCore, __spreadValues({}, coreProps)) });
3817
- }
3818
- var DynamicForm = forwardRef(function DynamicForm2(props, ref) {
3912
+ return [...(_d = props.renderers) != null ? _d : [], subflowRenderer, ...wiseRenderers];
3913
+ };
3914
+
3915
+ // src/dynamicFlow/useWiseToCoreProps.tsx
3916
+ var useWiseToCoreProps = (props) => {
3819
3917
  const {
3820
- className = "",
3821
- customFetch = globalThis.fetch,
3822
- renderers,
3823
3918
  displayStepTitle = true,
3824
3919
  features = {},
3920
+ customFetch = globalThis.fetch,
3921
+ renderers,
3825
3922
  onAnalytics,
3826
3923
  onEvent,
3827
- onLog,
3828
- onLink = openLinkInNewTab
3924
+ onLink = openLinkInNewTab,
3925
+ onLog
3829
3926
  } = props;
3830
- const { formatMessage } = useIntl15();
3831
- const createSnackBar = useSnackBarIfAvailable();
3832
3927
  const httpClient = useWiseHttpClient(customFetch);
3833
- const mergedRenderers = useMemo2(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
3928
+ const mergedRenderers = useMemo2(() => getMergedRenderers(props), [renderers]);
3834
3929
  const logEvent = useMemo2(() => getLogEvent(onLog), [onLog]);
3835
3930
  const trackEvent = useMemo2(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
3836
- const onCopy = (copiedContent) => {
3837
- if (copiedContent) {
3838
- createSnackBar({ text: formatMessage(messages_default.copied) });
3839
- } else {
3840
- createSnackBar({ text: formatMessage(messages_default.copyFailed) });
3841
- }
3842
- };
3843
- const coreProps = __spreadProps(__spreadValues({}, props), {
3931
+ const onCopy = useOnCopy();
3932
+ return __spreadProps(__spreadValues({}, props), {
3844
3933
  httpClient,
3845
- renderers: mergedRenderers,
3846
3934
  features: __spreadValues({ hideStepTitle: !displayStepTitle }, features),
3935
+ renderers: mergedRenderers,
3847
3936
  onEvent: trackEvent,
3848
3937
  onLog: logEvent,
3849
- onLink,
3850
- onCopy
3938
+ onCopy,
3939
+ onLink
3851
3940
  });
3852
- return /* @__PURE__ */ jsx82("div", { className, children: /* @__PURE__ */ jsx82(DynamicFormCore, __spreadProps(__spreadValues({}, coreProps), { ref })) });
3853
- });
3854
- var useWiseHttpClient = (httpClient) => {
3855
- const { locale } = useIntl15();
3856
- return useCallback(
3857
- async (input, init = {}) => {
3858
- const headers = new Headers(init.headers);
3859
- headers.set("accept-language", locale);
3860
- const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || void 0;
3861
- if (timeZone) {
3862
- headers.set("time-zone", timeZone);
3863
- }
3864
- const requestInit = __spreadProps(__spreadValues({}, init), { credentials: "include", headers });
3865
- return httpClient(input, requestInit).catch(handleRejection);
3866
- },
3867
- [httpClient, locale]
3868
- );
3869
- };
3870
- var handleRejection = (error) => {
3871
- if (error instanceof Error && error.message === "SCA_MODAL_CLOSED") {
3872
- return new Response(JSON.stringify({ validation: {} }), { status: 400 });
3873
- }
3874
- throw error;
3875
3941
  };
3876
3942
  var openLinkInNewTab = (url) => {
3877
3943
  var _a;
@@ -3883,10 +3949,44 @@ var openLinkInNewTab = (url) => {
3883
3949
  }
3884
3950
  };
3885
3951
 
3952
+ // src/dynamicFlow/DynamicFlow.tsx
3953
+ import { jsx as jsx85 } from "react/jsx-runtime";
3954
+ function DynamicFlow(props) {
3955
+ const { className = "" } = props;
3956
+ const dfProps = useWiseToCoreProps(props);
3957
+ const df = useDynamicFlow(dfProps);
3958
+ return /* @__PURE__ */ jsx85("div", { className, children: df.view });
3959
+ }
3960
+
3961
+ // src/dynamicFlow/DynamicFlowWithRef.tsx
3962
+ import {
3963
+ forwardRef,
3964
+ useImperativeHandle
3965
+ } from "react";
3966
+ import { useDynamicFlow as useDynamicFlow2 } from "@wise/dynamic-flow-client";
3967
+ import { jsx as jsx86 } from "react/jsx-runtime";
3968
+ var DynamicFlowWithRef = forwardRef(function DynamicFlowWithRef2(props, ref) {
3969
+ const { className = "" } = props;
3970
+ const dfProps = useWiseToCoreProps(props);
3971
+ const df = useDynamicFlow2(dfProps);
3972
+ useImperativeHandle(
3973
+ ref,
3974
+ () => ({
3975
+ getValue: async () => {
3976
+ var _a;
3977
+ return (_a = await df.controller.getSubmittableValue()) != null ? _a : null;
3978
+ },
3979
+ validate: () => df.controller.validate()
3980
+ }),
3981
+ [df]
3982
+ );
3983
+ return /* @__PURE__ */ jsx86("div", { className, children: df.view });
3984
+ });
3985
+
3886
3986
  // src/index.ts
3887
3987
  import { findRendererPropsByType } from "@wise/dynamic-flow-client";
3888
3988
 
3889
- // src/dynamicFlow/renderers.ts
3989
+ // src/dynamicFlow/renderers.tsx
3890
3990
  var Header11 = Header7;
3891
3991
  var Media2 = Media;
3892
3992
  var getMargin2 = getMargin;
@@ -4754,7 +4854,7 @@ var translations = languages.reduce(
4754
4854
  var i18n_default = translations;
4755
4855
  export {
4756
4856
  DynamicFlow,
4757
- DynamicForm,
4857
+ DynamicFlowWithRef,
4758
4858
  Header11 as Header,
4759
4859
  Media2 as Media,
4760
4860
  findRendererPropsByType,
@@ -1,27 +1,6 @@
1
- import type { ForwardRefExoticComponent, RefAttributes } from 'react';
2
- import type { DynamicFlowProps as DynamicFlowCoreProps, DynamicFormController } from '@wise/dynamic-flow-client';
3
- type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
4
- type Prettify<T> = {
1
+ import type { DynamicFlowWiseProps } from './DynamicFlowWiseProps';
2
+ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
3
+ export type Prettify<T> = {
5
4
  [K in keyof T]: T[K];
6
5
  } & {};
7
- export type DynamicFlowProps = Prettify<MakeOptional<Omit<DynamicFlowCoreProps, 'httpClient'>, 'renderers' | 'onLink'> & {
8
- className?: string;
9
- /**
10
- * @deprecated Use `features` prop with `hideStepTitle` instead.
11
- */
12
- displayStepTitle?: boolean;
13
- customFetch?: DynamicFlowCoreProps['httpClient'];
14
- onAnalytics?: DynamicFlowCoreProps['onEvent'];
15
- }>;
16
- export declare function DynamicFlow(props: DynamicFlowProps): import("react/jsx-runtime").JSX.Element;
17
- export type DynamicFormProps = Omit<DynamicFlowProps, 'onCompletion'> & {
18
- onValueChange?: () => void;
19
- onCompletion?: DynamicFlowProps['onCompletion'];
20
- };
21
- /**
22
- * DynamicForm is like DynamicFlow, but it also accepts a ForwardedRef.
23
- * This ref conforms to the DynamicFormController type, containing two functions: `getValue` and `validate`.
24
- * @experimental This component may be changed in the future without notice.
25
- */
26
- export declare const DynamicForm: ForwardRefExoticComponent<DynamicFormProps & RefAttributes<DynamicFormController>>;
27
- export {};
6
+ export declare function DynamicFlow(props: DynamicFlowWiseProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { DynamicFlowWiseProps } from './DynamicFlowWiseProps';
2
+ export declare function DynamicFlowModal(props: DynamicFlowWiseProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { DynamicFlowProps as DynamicFlowCoreProps } from '@wise/dynamic-flow-client';
2
+ import { Prettify, MakeOptional } from './DynamicFlow';
3
+ export type DynamicFlowWiseProps = Prettify<MakeOptional<Omit<DynamicFlowCoreProps, 'httpClient'>, 'renderers' | 'onLink'> & {
4
+ className?: string;
5
+ /**
6
+ * @deprecated Use `features` prop with `hideStepTitle` instead.
7
+ */
8
+ displayStepTitle?: boolean;
9
+ customFetch?: DynamicFlowCoreProps['httpClient'];
10
+ onAnalytics?: DynamicFlowCoreProps['onEvent'];
11
+ }>;
@@ -0,0 +1,22 @@
1
+ import { JsonElement } from '@wise/dynamic-flow-types/spec';
2
+ import { type ForwardRefExoticComponent, type RefAttributes } from 'react';
3
+ import type { DynamicFlowWiseProps } from './DynamicFlowWiseProps';
4
+ export type DynamicFlowWithRefProps = DynamicFlowWiseProps & {
5
+ onValueChange?: () => void;
6
+ };
7
+ export type DynamicFlowRef = {
8
+ /**
9
+ * Returns the current value of the form, even if it doesn't pass validation.
10
+ */
11
+ getValue: () => Promise<JsonElement>;
12
+ /**
13
+ * triggers validation in every UI component and returns whether or not the current value is valid.
14
+ */
15
+ validate: () => boolean;
16
+ };
17
+ /**
18
+ * DynamicFlowWithRef is like DynamicFlow, but it also accepts a ForwardedRef.
19
+ * This ref conforms to the DynamicFlowRef type, containing two functions: `getValue` and `validate`.
20
+ * @experimental This component may be changed in the future without notice.
21
+ */
22
+ export declare const DynamicFlowWithRef: ForwardRefExoticComponent<DynamicFlowWithRefProps & RefAttributes<DynamicFlowRef>>;
@@ -0,0 +1,3 @@
1
+ import type { Renderers } from '@wise/dynamic-flow-types/renderers';
2
+ import { DynamicFlowWiseProps } from './DynamicFlowWiseProps';
3
+ export declare const getMergedRenderers: (props: DynamicFlowWiseProps) => Renderers;
@@ -1,4 +1,4 @@
1
- import { DynamicFlowProps } from '@wise/dynamic-flow-client';
1
+ import { type DynamicFlowProps } from '@wise/dynamic-flow-client';
2
2
  type OnEvent = DynamicFlowProps['onEvent'];
3
3
  export declare const getTrackEvent: (onEvent: OnEvent, onAnalytics: OnEvent) => OnEvent;
4
4
  export {};
@@ -0,0 +1 @@
1
+ export declare const useOnCopy: () => (copiedContent: string | null) => void;
@@ -0,0 +1 @@
1
+ export declare const useWiseHttpClient: (httpClient: typeof globalThis.fetch) => typeof globalThis.fetch;
@@ -0,0 +1,3 @@
1
+ import { DynamicFlowWiseProps } from './DynamicFlowWiseProps';
2
+ import { DynamicFlowProps } from '@wise/dynamic-flow-client';
3
+ export declare const useWiseToCoreProps: (props: DynamicFlowWiseProps) => DynamicFlowProps;
@@ -1,7 +1,7 @@
1
1
  export { makeHttpClient as makeCustomFetch } from '@wise/dynamic-flow-client';
2
- export type { DynamicFormController } from '@wise/dynamic-flow-client';
3
- export type { DynamicFlowProps } from './dynamicFlow/DynamicFlow';
4
- export { DynamicFlow, DynamicForm } from './dynamicFlow/DynamicFlow';
2
+ export type { DynamicFlowWiseProps as DynamicFlowProps } from './dynamicFlow/DynamicFlowWiseProps';
3
+ export { DynamicFlow } from './dynamicFlow/DynamicFlow';
4
+ export { DynamicFlowWithRef, type DynamicFlowRef } from './dynamicFlow/DynamicFlowWithRef';
5
5
  export { findRendererPropsByType } from '@wise/dynamic-flow-client';
6
- export { Header, Media, getMargin } from './dynamicFlow/renderers';
6
+ export { getMargin, Header, Media } from './dynamicFlow/renderers';
7
7
  export { default as translations } from './i18n';
@@ -1,3 +1,4 @@
1
1
  export { default as NeptuneProviders } from './NeptuneProviders';
2
2
  export { renderWithProviders } from './rtl-utils';
3
+ export { respondWith } from './respond-with';
3
4
  export { wait } from './wait';
@@ -0,0 +1,2 @@
1
+ export declare const respondWith: (data: unknown, init?: ResponseInit) => Promise<Response>;
2
+ export declare const respondWithDelay: (data: unknown, delayMs: number, init?: ResponseInit) => Promise<Response>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client-internal",
3
- "version": "5.2.0",
3
+ "version": "5.4.0",
4
4
  "description": "Dynamic Flow web client for Wise",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -32,27 +32,27 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@chromatic-com/storybook": "4.1.3",
35
- "@formatjs/cli": "^6.9.0",
36
- "@storybook/addon-a11y": "^10.1.11",
37
- "@storybook/addon-docs": "^10.1.11",
38
- "@storybook/addon-links": "^10.1.11",
39
- "@storybook/react-vite": "10.1.11",
35
+ "@formatjs/cli": "^6.12.0",
36
+ "@storybook/addon-a11y": "^10.2.0",
37
+ "@storybook/addon-docs": "^10.2.0",
38
+ "@storybook/addon-links": "^10.2.0",
39
+ "@storybook/react-vite": "10.2.0",
40
40
  "@testing-library/dom": "10.4.1",
41
41
  "@testing-library/jest-dom": "6.9.1",
42
- "@testing-library/react": "16.3.1",
42
+ "@testing-library/react": "16.3.2",
43
43
  "@testing-library/user-event": "14.6.1",
44
- "@transferwise/components": "^46.118.0",
44
+ "@transferwise/components": "^46.121.1",
45
45
  "@transferwise/formatting": "^2.13.4",
46
- "@transferwise/icons": "4.0.1",
47
- "@transferwise/neptune-css": "14.26.0",
46
+ "@transferwise/icons": "4.0.2",
47
+ "@transferwise/neptune-css": "14.26.1",
48
48
  "@types/react": "18.3.27",
49
49
  "@types/react-dom": "18.3.7",
50
- "@wise/art": "2.25.0",
51
- "@wise/components-theming": "^1.9.1",
50
+ "@wise/art": "2.26.0",
51
+ "@wise/components-theming": "^1.10.0",
52
52
  "currency-flags": "4.0.7",
53
53
  "esbuild": "0.27.0",
54
- "eslint-plugin-storybook": "10.1.11",
55
- "framer-motion": "^12.23.26",
54
+ "eslint-plugin-storybook": "10.2.0",
55
+ "framer-motion": "^12.29.0",
56
56
  "npm-run-all2": "8.0.4",
57
57
  "postcss": "^8.5.6",
58
58
  "postcss-cli": "^11.0.1",
@@ -60,18 +60,18 @@
60
60
  "react": "18.3.1",
61
61
  "react-dom": "18.3.1",
62
62
  "react-intl": "6.8.9",
63
- "storybook": "^10.1.11",
63
+ "storybook": "^10.2.0",
64
64
  "stylelint": "16.26.1",
65
65
  "stylelint-config-standard": "36.0.1",
66
66
  "stylelint-no-unsupported-browser-features": "8.0.5",
67
- "stylelint-value-no-unknown-custom-properties": "6.1.0",
67
+ "stylelint-value-no-unknown-custom-properties": "6.1.1",
68
68
  "tsx": "4.21.0",
69
69
  "typescript": "5.9.3",
70
- "vitest": "4.0.16",
70
+ "vitest": "4.0.18",
71
71
  "vitest-fetch-mock": "0.4.5",
72
- "@wise/dynamic-flow-fixtures": "0.0.1",
73
72
  "@wise/dynamic-flow-renderers": "0.0.0",
74
- "@wise/dynamic-flow-types": "4.3.0"
73
+ "@wise/dynamic-flow-fixtures": "0.0.1",
74
+ "@wise/dynamic-flow-types": "4.5.0"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "@transferwise/components": "^46.104.0",
@@ -82,11 +82,11 @@
82
82
  "@wise/components-theming": "^1.8.0",
83
83
  "react": "^18",
84
84
  "react-dom": "^18",
85
- "react-intl": "^6"
85
+ "react-intl": "^6 || ^7"
86
86
  },
87
87
  "dependencies": {
88
- "@wise/dynamic-flow-client": "5.2.0",
89
- "@wise/dynamic-flow-types": "4.3.0"
88
+ "@wise/dynamic-flow-client": "5.4.0",
89
+ "@wise/dynamic-flow-types": "4.5.0"
90
90
  },
91
91
  "scripts": {
92
92
  "dev": "pnpm build:visual-tests && storybook dev -p 3005",