@wise/dynamic-flow-client-internal 5.3.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/build/main.css +6 -0
- package/build/main.js +158 -64
- package/build/main.mjs +152 -58
- package/build/types/dynamicFlow/DynamicFlow.d.ts +2 -2
- package/build/types/dynamicFlow/DynamicFlowModal.d.ts +2 -0
- package/build/types/dynamicFlow/{DynamicFlowProps.d.ts → DynamicFlowWiseProps.d.ts} +1 -1
- package/build/types/dynamicFlow/DynamicFlowWithRef.d.ts +2 -2
- package/build/types/dynamicFlow/getMergedRenderers.d.ts +3 -0
- package/build/types/dynamicFlow/telemetry/getTrackEvent.d.ts +1 -1
- package/build/types/dynamicFlow/useWiseToCoreProps.d.ts +3 -0
- package/build/types/index.d.ts +1 -1
- package/build/types/test-utils/index.d.ts +1 -0
- package/build/types/test-utils/respond-with.d.ts +2 -0
- package/package.json +16 -16
- package/build/types/dynamicFlow/useDynamicFlowWise.d.ts +0 -3
package/build/main.css
CHANGED
package/build/main.js
CHANGED
|
@@ -127,16 +127,74 @@ __export(index_exports, {
|
|
|
127
127
|
DynamicFlowWithRef: () => DynamicFlowWithRef,
|
|
128
128
|
Header: () => Header11,
|
|
129
129
|
Media: () => Media2,
|
|
130
|
-
findRendererPropsByType: () =>
|
|
130
|
+
findRendererPropsByType: () => import_dynamic_flow_client7.findRendererPropsByType,
|
|
131
131
|
getMargin: () => getMargin2,
|
|
132
|
-
makeCustomFetch: () =>
|
|
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_client6 = require("@wise/dynamic-flow-client");
|
|
137
|
+
|
|
138
|
+
// src/dynamicFlow/DynamicFlow.tsx
|
|
136
139
|
var import_dynamic_flow_client3 = require("@wise/dynamic-flow-client");
|
|
137
140
|
|
|
138
|
-
// src/dynamicFlow/
|
|
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
|
|
139
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
|
+
};
|
|
140
198
|
|
|
141
199
|
// ../renderers/src/AlertRenderer.tsx
|
|
142
200
|
var import_components = require("@transferwise/components");
|
|
@@ -1147,7 +1205,7 @@ var import_react4 = require("react");
|
|
|
1147
1205
|
// ../renderers/src/utils/api-utils.ts
|
|
1148
1206
|
function isRelativePath(url = "") {
|
|
1149
1207
|
return !["https://", "http://", "data:"].some(
|
|
1150
|
-
(
|
|
1208
|
+
(prefix2) => url.startsWith(prefix2) && url.length > prefix2.length
|
|
1151
1209
|
);
|
|
1152
1210
|
}
|
|
1153
1211
|
|
|
@@ -3510,9 +3568,10 @@ var DecisionRenderer = {
|
|
|
3510
3568
|
};
|
|
3511
3569
|
var renderDecisionList = ({ options, control }) => {
|
|
3512
3570
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_jsx_runtime78.Fragment, { children: options.map((_a) => {
|
|
3513
|
-
var _b = _a, {
|
|
3571
|
+
var _b = _a, { onClick } = _b, rest = __objRest(_b, ["onClick"]);
|
|
3514
3572
|
const {
|
|
3515
3573
|
description,
|
|
3574
|
+
disabled,
|
|
3516
3575
|
media,
|
|
3517
3576
|
title: itemTitle,
|
|
3518
3577
|
href,
|
|
@@ -3729,43 +3788,30 @@ var getWiseRenderers = () => [
|
|
|
3729
3788
|
ReviewLegacyRenderer_default
|
|
3730
3789
|
];
|
|
3731
3790
|
|
|
3732
|
-
// src/
|
|
3733
|
-
var
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
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
|
+
);
|
|
3751
3813
|
}
|
|
3752
|
-
}
|
|
3753
|
-
};
|
|
3754
|
-
var logToRollbar = (level, message, extra) => {
|
|
3755
|
-
try {
|
|
3756
|
-
const rollbar = typeof window.Rollbar !== "undefined" ? window.Rollbar : void 0;
|
|
3757
|
-
rollbar == null ? void 0 : rollbar[level](message, extra);
|
|
3758
|
-
} catch (error) {
|
|
3759
|
-
console.error("Failed to log to Rollbar", error);
|
|
3760
|
-
}
|
|
3761
|
-
};
|
|
3762
|
-
|
|
3763
|
-
// src/dynamicFlow/telemetry/getTrackEvent.ts
|
|
3764
|
-
var getTrackEvent = (onEvent, onAnalytics) => (name, properties) => {
|
|
3765
|
-
onEvent == null ? void 0 : onEvent(name, properties);
|
|
3766
|
-
if (!name.includes(ThemeRequiredEventName)) {
|
|
3767
|
-
onAnalytics == null ? void 0 : onAnalytics(name, properties);
|
|
3768
|
-
}
|
|
3814
|
+
};
|
|
3769
3815
|
};
|
|
3770
3816
|
|
|
3771
3817
|
// src/dynamicFlow/useOnCopy.tsx
|
|
@@ -3829,33 +3875,78 @@ var handleRejection = (error) => {
|
|
|
3829
3875
|
throw error;
|
|
3830
3876
|
};
|
|
3831
3877
|
|
|
3832
|
-
// src/dynamicFlow/
|
|
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");
|
|
3833
3899
|
var wiseRenderers = getWiseRenderers();
|
|
3834
|
-
var
|
|
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) => {
|
|
3835
3926
|
const {
|
|
3836
|
-
customFetch = globalThis.fetch,
|
|
3837
|
-
renderers,
|
|
3838
3927
|
displayStepTitle = true,
|
|
3839
3928
|
features = {},
|
|
3929
|
+
customFetch = globalThis.fetch,
|
|
3930
|
+
renderers,
|
|
3840
3931
|
onAnalytics,
|
|
3841
3932
|
onEvent,
|
|
3842
|
-
|
|
3843
|
-
|
|
3933
|
+
onLink = openLinkInNewTab,
|
|
3934
|
+
onLog
|
|
3844
3935
|
} = props;
|
|
3845
3936
|
const httpClient = useWiseHttpClient(customFetch);
|
|
3846
|
-
const mergedRenderers = (0, import_react21.useMemo)(() =>
|
|
3937
|
+
const mergedRenderers = (0, import_react21.useMemo)(() => getMergedRenderers(props), [renderers]);
|
|
3847
3938
|
const logEvent = (0, import_react21.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
3848
3939
|
const trackEvent = (0, import_react21.useMemo)(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
|
|
3849
3940
|
const onCopy = useOnCopy();
|
|
3850
|
-
return
|
|
3851
|
-
features: __spreadValues({ hideStepTitle: !displayStepTitle }, features),
|
|
3941
|
+
return __spreadProps(__spreadValues({}, props), {
|
|
3852
3942
|
httpClient,
|
|
3943
|
+
features: __spreadValues({ hideStepTitle: !displayStepTitle }, features),
|
|
3853
3944
|
renderers: mergedRenderers,
|
|
3854
3945
|
onEvent: trackEvent,
|
|
3855
3946
|
onLog: logEvent,
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
})
|
|
3947
|
+
onCopy,
|
|
3948
|
+
onLink
|
|
3949
|
+
});
|
|
3859
3950
|
};
|
|
3860
3951
|
var openLinkInNewTab = (url) => {
|
|
3861
3952
|
var _a;
|
|
@@ -3868,19 +3959,22 @@ var openLinkInNewTab = (url) => {
|
|
|
3868
3959
|
};
|
|
3869
3960
|
|
|
3870
3961
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
3871
|
-
var
|
|
3962
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
3872
3963
|
function DynamicFlow(props) {
|
|
3873
3964
|
const { className = "" } = props;
|
|
3874
|
-
const
|
|
3875
|
-
|
|
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 });
|
|
3876
3968
|
}
|
|
3877
3969
|
|
|
3878
3970
|
// src/dynamicFlow/DynamicFlowWithRef.tsx
|
|
3879
3971
|
var import_react22 = require("react");
|
|
3880
|
-
var
|
|
3972
|
+
var import_dynamic_flow_client4 = require("@wise/dynamic-flow-client");
|
|
3973
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
3881
3974
|
var DynamicFlowWithRef = (0, import_react22.forwardRef)(function DynamicFlowWithRef2(props, ref) {
|
|
3882
3975
|
const { className = "" } = props;
|
|
3883
|
-
const
|
|
3976
|
+
const dfProps = useWiseToCoreProps(props);
|
|
3977
|
+
const df = (0, import_dynamic_flow_client4.useDynamicFlow)(dfProps);
|
|
3884
3978
|
(0, import_react22.useImperativeHandle)(
|
|
3885
3979
|
ref,
|
|
3886
3980
|
() => ({
|
|
@@ -3892,19 +3986,19 @@ var DynamicFlowWithRef = (0, import_react22.forwardRef)(function DynamicFlowWith
|
|
|
3892
3986
|
}),
|
|
3893
3987
|
[df]
|
|
3894
3988
|
);
|
|
3895
|
-
return /* @__PURE__ */ (0,
|
|
3989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className, children: df.view });
|
|
3896
3990
|
});
|
|
3897
3991
|
|
|
3898
3992
|
// src/index.ts
|
|
3899
|
-
var
|
|
3993
|
+
var import_dynamic_flow_client7 = require("@wise/dynamic-flow-client");
|
|
3900
3994
|
|
|
3901
|
-
// src/dynamicFlow/renderers.
|
|
3995
|
+
// src/dynamicFlow/renderers.tsx
|
|
3902
3996
|
var Header11 = Header7;
|
|
3903
3997
|
var Media2 = Media;
|
|
3904
3998
|
var getMargin2 = getMargin;
|
|
3905
3999
|
|
|
3906
4000
|
// src/i18n/index.ts
|
|
3907
|
-
var
|
|
4001
|
+
var import_dynamic_flow_client5 = require("@wise/dynamic-flow-client");
|
|
3908
4002
|
|
|
3909
4003
|
// src/i18n/cs.json
|
|
3910
4004
|
var cs_default = {
|
|
@@ -4757,10 +4851,10 @@ var wiseTranslations = {
|
|
|
4757
4851
|
"zh-HK": zh_HK_default
|
|
4758
4852
|
};
|
|
4759
4853
|
var languages = Array.from(
|
|
4760
|
-
/* @__PURE__ */ new Set([...Object.keys(
|
|
4854
|
+
/* @__PURE__ */ new Set([...Object.keys(import_dynamic_flow_client5.translations), ...Object.keys(wiseTranslations)])
|
|
4761
4855
|
);
|
|
4762
4856
|
var translations = languages.reduce(
|
|
4763
|
-
(acc, lang) => __spreadProps(__spreadValues({}, acc), { [lang]: __spreadValues(__spreadValues({},
|
|
4857
|
+
(acc, lang) => __spreadProps(__spreadValues({}, acc), { [lang]: __spreadValues(__spreadValues({}, import_dynamic_flow_client5.translations[lang]), wiseTranslations[lang]) }),
|
|
4764
4858
|
{}
|
|
4765
4859
|
);
|
|
4766
4860
|
var i18n_default = translations;
|
package/build/main.mjs
CHANGED
|
@@ -117,9 +117,67 @@ var require_classnames = __commonJS({
|
|
|
117
117
|
// src/index.ts
|
|
118
118
|
import { makeHttpClient } from "@wise/dynamic-flow-client";
|
|
119
119
|
|
|
120
|
-
// src/dynamicFlow/
|
|
120
|
+
// src/dynamicFlow/DynamicFlow.tsx
|
|
121
121
|
import { useDynamicFlow } from "@wise/dynamic-flow-client";
|
|
122
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
|
+
};
|
|
180
|
+
|
|
123
181
|
// ../renderers/src/AlertRenderer.tsx
|
|
124
182
|
import { Alert } from "@transferwise/components";
|
|
125
183
|
|
|
@@ -1129,7 +1187,7 @@ import { useEffect as useEffect4, useState as useState3 } from "react";
|
|
|
1129
1187
|
// ../renderers/src/utils/api-utils.ts
|
|
1130
1188
|
function isRelativePath(url = "") {
|
|
1131
1189
|
return !["https://", "http://", "data:"].some(
|
|
1132
|
-
(
|
|
1190
|
+
(prefix2) => url.startsWith(prefix2) && url.length > prefix2.length
|
|
1133
1191
|
);
|
|
1134
1192
|
}
|
|
1135
1193
|
|
|
@@ -3501,9 +3559,10 @@ var DecisionRenderer = {
|
|
|
3501
3559
|
};
|
|
3502
3560
|
var renderDecisionList = ({ options, control }) => {
|
|
3503
3561
|
return /* @__PURE__ */ jsx78(Fragment11, { children: options.map((_a) => {
|
|
3504
|
-
var _b = _a, {
|
|
3562
|
+
var _b = _a, { onClick } = _b, rest = __objRest(_b, ["onClick"]);
|
|
3505
3563
|
const {
|
|
3506
3564
|
description,
|
|
3565
|
+
disabled,
|
|
3507
3566
|
media,
|
|
3508
3567
|
title: itemTitle,
|
|
3509
3568
|
href,
|
|
@@ -3720,43 +3779,30 @@ var getWiseRenderers = () => [
|
|
|
3720
3779
|
ReviewLegacyRenderer_default
|
|
3721
3780
|
];
|
|
3722
3781
|
|
|
3723
|
-
// src/
|
|
3724
|
-
import {
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
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
|
+
);
|
|
3742
3804
|
}
|
|
3743
|
-
}
|
|
3744
|
-
};
|
|
3745
|
-
var logToRollbar = (level, message, extra) => {
|
|
3746
|
-
try {
|
|
3747
|
-
const rollbar = typeof window.Rollbar !== "undefined" ? window.Rollbar : void 0;
|
|
3748
|
-
rollbar == null ? void 0 : rollbar[level](message, extra);
|
|
3749
|
-
} catch (error) {
|
|
3750
|
-
console.error("Failed to log to Rollbar", error);
|
|
3751
|
-
}
|
|
3752
|
-
};
|
|
3753
|
-
|
|
3754
|
-
// src/dynamicFlow/telemetry/getTrackEvent.ts
|
|
3755
|
-
var getTrackEvent = (onEvent, onAnalytics) => (name, properties) => {
|
|
3756
|
-
onEvent == null ? void 0 : onEvent(name, properties);
|
|
3757
|
-
if (!name.includes(ThemeRequiredEventName)) {
|
|
3758
|
-
onAnalytics == null ? void 0 : onAnalytics(name, properties);
|
|
3759
|
-
}
|
|
3805
|
+
};
|
|
3760
3806
|
};
|
|
3761
3807
|
|
|
3762
3808
|
// src/dynamicFlow/useOnCopy.tsx
|
|
@@ -3820,33 +3866,78 @@ var handleRejection = (error) => {
|
|
|
3820
3866
|
throw error;
|
|
3821
3867
|
};
|
|
3822
3868
|
|
|
3823
|
-
// src/dynamicFlow/
|
|
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
|
+
}
|
|
3887
|
+
|
|
3888
|
+
// src/dynamicFlow/getMergedRenderers.tsx
|
|
3889
|
+
import { jsx as jsx84 } from "react/jsx-runtime";
|
|
3824
3890
|
var wiseRenderers = getWiseRenderers();
|
|
3825
|
-
var
|
|
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
|
+
);
|
|
3910
|
+
}
|
|
3911
|
+
});
|
|
3912
|
+
return [...(_d = props.renderers) != null ? _d : [], subflowRenderer, ...wiseRenderers];
|
|
3913
|
+
};
|
|
3914
|
+
|
|
3915
|
+
// src/dynamicFlow/useWiseToCoreProps.tsx
|
|
3916
|
+
var useWiseToCoreProps = (props) => {
|
|
3826
3917
|
const {
|
|
3827
|
-
customFetch = globalThis.fetch,
|
|
3828
|
-
renderers,
|
|
3829
3918
|
displayStepTitle = true,
|
|
3830
3919
|
features = {},
|
|
3920
|
+
customFetch = globalThis.fetch,
|
|
3921
|
+
renderers,
|
|
3831
3922
|
onAnalytics,
|
|
3832
3923
|
onEvent,
|
|
3833
|
-
|
|
3834
|
-
|
|
3924
|
+
onLink = openLinkInNewTab,
|
|
3925
|
+
onLog
|
|
3835
3926
|
} = props;
|
|
3836
3927
|
const httpClient = useWiseHttpClient(customFetch);
|
|
3837
|
-
const mergedRenderers = useMemo2(() =>
|
|
3928
|
+
const mergedRenderers = useMemo2(() => getMergedRenderers(props), [renderers]);
|
|
3838
3929
|
const logEvent = useMemo2(() => getLogEvent(onLog), [onLog]);
|
|
3839
3930
|
const trackEvent = useMemo2(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
|
|
3840
3931
|
const onCopy = useOnCopy();
|
|
3841
|
-
return
|
|
3842
|
-
features: __spreadValues({ hideStepTitle: !displayStepTitle }, features),
|
|
3932
|
+
return __spreadProps(__spreadValues({}, props), {
|
|
3843
3933
|
httpClient,
|
|
3934
|
+
features: __spreadValues({ hideStepTitle: !displayStepTitle }, features),
|
|
3844
3935
|
renderers: mergedRenderers,
|
|
3845
3936
|
onEvent: trackEvent,
|
|
3846
3937
|
onLog: logEvent,
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
})
|
|
3938
|
+
onCopy,
|
|
3939
|
+
onLink
|
|
3940
|
+
});
|
|
3850
3941
|
};
|
|
3851
3942
|
var openLinkInNewTab = (url) => {
|
|
3852
3943
|
var _a;
|
|
@@ -3859,11 +3950,12 @@ var openLinkInNewTab = (url) => {
|
|
|
3859
3950
|
};
|
|
3860
3951
|
|
|
3861
3952
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
3862
|
-
import { jsx as
|
|
3953
|
+
import { jsx as jsx85 } from "react/jsx-runtime";
|
|
3863
3954
|
function DynamicFlow(props) {
|
|
3864
3955
|
const { className = "" } = props;
|
|
3865
|
-
const
|
|
3866
|
-
|
|
3956
|
+
const dfProps = useWiseToCoreProps(props);
|
|
3957
|
+
const df = useDynamicFlow(dfProps);
|
|
3958
|
+
return /* @__PURE__ */ jsx85("div", { className, children: df.view });
|
|
3867
3959
|
}
|
|
3868
3960
|
|
|
3869
3961
|
// src/dynamicFlow/DynamicFlowWithRef.tsx
|
|
@@ -3871,10 +3963,12 @@ import {
|
|
|
3871
3963
|
forwardRef,
|
|
3872
3964
|
useImperativeHandle
|
|
3873
3965
|
} from "react";
|
|
3874
|
-
import {
|
|
3966
|
+
import { useDynamicFlow as useDynamicFlow2 } from "@wise/dynamic-flow-client";
|
|
3967
|
+
import { jsx as jsx86 } from "react/jsx-runtime";
|
|
3875
3968
|
var DynamicFlowWithRef = forwardRef(function DynamicFlowWithRef2(props, ref) {
|
|
3876
3969
|
const { className = "" } = props;
|
|
3877
|
-
const
|
|
3970
|
+
const dfProps = useWiseToCoreProps(props);
|
|
3971
|
+
const df = useDynamicFlow2(dfProps);
|
|
3878
3972
|
useImperativeHandle(
|
|
3879
3973
|
ref,
|
|
3880
3974
|
() => ({
|
|
@@ -3886,13 +3980,13 @@ var DynamicFlowWithRef = forwardRef(function DynamicFlowWithRef2(props, ref) {
|
|
|
3886
3980
|
}),
|
|
3887
3981
|
[df]
|
|
3888
3982
|
);
|
|
3889
|
-
return /* @__PURE__ */
|
|
3983
|
+
return /* @__PURE__ */ jsx86("div", { className, children: df.view });
|
|
3890
3984
|
});
|
|
3891
3985
|
|
|
3892
3986
|
// src/index.ts
|
|
3893
3987
|
import { findRendererPropsByType } from "@wise/dynamic-flow-client";
|
|
3894
3988
|
|
|
3895
|
-
// src/dynamicFlow/renderers.
|
|
3989
|
+
// src/dynamicFlow/renderers.tsx
|
|
3896
3990
|
var Header11 = Header7;
|
|
3897
3991
|
var Media2 = Media;
|
|
3898
3992
|
var getMargin2 = getMargin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DynamicFlowWiseProps } from './DynamicFlowWiseProps';
|
|
2
2
|
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
3
3
|
export type Prettify<T> = {
|
|
4
4
|
[K in keyof T]: T[K];
|
|
5
5
|
} & {};
|
|
6
|
-
export declare function DynamicFlow(props:
|
|
6
|
+
export declare function DynamicFlow(props: DynamicFlowWiseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DynamicFlowProps as DynamicFlowCoreProps } from '@wise/dynamic-flow-client';
|
|
2
2
|
import { Prettify, MakeOptional } from './DynamicFlow';
|
|
3
|
-
export type
|
|
3
|
+
export type DynamicFlowWiseProps = Prettify<MakeOptional<Omit<DynamicFlowCoreProps, 'httpClient'>, 'renderers' | 'onLink'> & {
|
|
4
4
|
className?: string;
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated Use `features` prop with `hideStepTitle` instead.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JsonElement } from '@wise/dynamic-flow-types/spec';
|
|
2
2
|
import { type ForwardRefExoticComponent, type RefAttributes } from 'react';
|
|
3
|
-
import type {
|
|
4
|
-
export type DynamicFlowWithRefProps =
|
|
3
|
+
import type { DynamicFlowWiseProps } from './DynamicFlowWiseProps';
|
|
4
|
+
export type DynamicFlowWithRefProps = DynamicFlowWiseProps & {
|
|
5
5
|
onValueChange?: () => void;
|
|
6
6
|
};
|
|
7
7
|
export type DynamicFlowRef = {
|
|
@@ -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 {};
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { makeHttpClient as makeCustomFetch } from '@wise/dynamic-flow-client';
|
|
2
|
-
export type { DynamicFlowProps } from './dynamicFlow/
|
|
2
|
+
export type { DynamicFlowWiseProps as DynamicFlowProps } from './dynamicFlow/DynamicFlowWiseProps';
|
|
3
3
|
export { DynamicFlow } from './dynamicFlow/DynamicFlow';
|
|
4
4
|
export { DynamicFlowWithRef, type DynamicFlowRef } from './dynamicFlow/DynamicFlowWithRef';
|
|
5
5
|
export { findRendererPropsByType } from '@wise/dynamic-flow-client';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client-internal",
|
|
3
|
-
"version": "5.
|
|
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,14 +32,14 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@chromatic-com/storybook": "4.1.3",
|
|
35
|
-
"@formatjs/cli": "^6.
|
|
36
|
-
"@storybook/addon-a11y": "^10.
|
|
37
|
-
"@storybook/addon-docs": "^10.
|
|
38
|
-
"@storybook/addon-links": "^10.
|
|
39
|
-
"@storybook/react-vite": "10.
|
|
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.
|
|
42
|
+
"@testing-library/react": "16.3.2",
|
|
43
43
|
"@testing-library/user-event": "14.6.1",
|
|
44
44
|
"@transferwise/components": "^46.121.1",
|
|
45
45
|
"@transferwise/formatting": "^2.13.4",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
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.
|
|
55
|
-
"framer-motion": "^12.
|
|
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.
|
|
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.
|
|
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.
|
|
70
|
+
"vitest": "4.0.18",
|
|
71
71
|
"vitest-fetch-mock": "0.4.5",
|
|
72
72
|
"@wise/dynamic-flow-renderers": "0.0.0",
|
|
73
73
|
"@wise/dynamic-flow-fixtures": "0.0.1",
|
|
74
|
-
"@wise/dynamic-flow-types": "4.
|
|
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.
|
|
89
|
-
"@wise/dynamic-flow-types": "4.
|
|
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",
|