@wise/dynamic-flow-client 2.2.0 → 3.0.0-next-9cca10.3
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 +535 -381
- package/build/main.min.js +1 -1
- package/build/types/jsonSchemaForm/schemaFormControl/SchemaFormControl.d.ts +0 -2
- package/build/types/jsonSchemaForm/schemaFormControl/utils/control-type-utils.d.ts +2 -0
- package/build/types/jsonSchemaForm/schemaFormControl/utils/mapping-utils.d.ts +3 -1
- package/package.json +40 -40
package/build/main.js
CHANGED
|
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function __init() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
8
11
|
var __commonJS = (cb, mod) => function __require() {
|
|
9
12
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
13
|
};
|
|
@@ -82,9 +85,135 @@ var require_classnames = __commonJS({
|
|
|
82
85
|
}
|
|
83
86
|
});
|
|
84
87
|
|
|
85
|
-
// ../../node_modules/.pnpm/
|
|
88
|
+
// ../../node_modules/.pnpm/clsx@2.0.0/node_modules/clsx/dist/clsx.mjs
|
|
89
|
+
var init_clsx = __esm({
|
|
90
|
+
"../../node_modules/.pnpm/clsx@2.0.0/node_modules/clsx/dist/clsx.mjs"() {
|
|
91
|
+
"use strict";
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// ../../node_modules/.pnpm/@wise+art@2.8.4_react-dom@18.2.0_react@18.2.0/node_modules/@wise/art/dist/index-d76005d8.esm.js
|
|
96
|
+
var import_react15, import_jsx_runtime27, unknownFlagName, Flag, Sizes, ImageSizes, imageSizes, Assets, RenderMode;
|
|
97
|
+
var init_index_d76005d8_esm = __esm({
|
|
98
|
+
"../../node_modules/.pnpm/@wise+art@2.8.4_react-dom@18.2.0_react@18.2.0/node_modules/@wise/art/dist/index-d76005d8.esm.js"() {
|
|
99
|
+
"use strict";
|
|
100
|
+
import_react15 = require("react");
|
|
101
|
+
import_jsx_runtime27 = require("react/jsx-runtime");
|
|
102
|
+
init_clsx();
|
|
103
|
+
unknownFlagName = "wise";
|
|
104
|
+
Flag = ({
|
|
105
|
+
code,
|
|
106
|
+
intrinsicSize = 64
|
|
107
|
+
}) => {
|
|
108
|
+
const [fallback, setFallback] = (0, import_react15.useState)(null);
|
|
109
|
+
(0, import_react15.useEffect)(() => {
|
|
110
|
+
setFallback(null);
|
|
111
|
+
}, [code]);
|
|
112
|
+
const detailed = intrinsicSize >= 150;
|
|
113
|
+
const name = fallback !== "unknown" ? `${code.toLowerCase()}${fallback == null && detailed ? "-detailed" : ""}` : unknownFlagName;
|
|
114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", {
|
|
115
|
+
src: `https://wise.com/web-art/assets/flags/${name}.svg`,
|
|
116
|
+
alt: "",
|
|
117
|
+
width: intrinsicSize,
|
|
118
|
+
height: intrinsicSize,
|
|
119
|
+
onError: () => {
|
|
120
|
+
setFallback((prev) => prev == null && detailed ? "simple" : "unknown");
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
(function(Sizes2) {
|
|
125
|
+
Sizes2["SMALL"] = "small";
|
|
126
|
+
Sizes2["MEDIUM"] = "medium";
|
|
127
|
+
Sizes2["LARGE"] = "large";
|
|
128
|
+
})(Sizes || (Sizes = {}));
|
|
129
|
+
ImageSizes = {
|
|
130
|
+
[Sizes.SMALL]: 200,
|
|
131
|
+
[Sizes.MEDIUM]: 300,
|
|
132
|
+
[Sizes.LARGE]: 500
|
|
133
|
+
};
|
|
134
|
+
imageSizes = {
|
|
135
|
+
[Sizes.SMALL]: 200,
|
|
136
|
+
[Sizes.MEDIUM]: 300,
|
|
137
|
+
[Sizes.LARGE]: 500
|
|
138
|
+
};
|
|
139
|
+
(function(Assets2) {
|
|
140
|
+
Assets2["BELL"] = "bell";
|
|
141
|
+
Assets2["BRIEFCASE"] = "briefcase";
|
|
142
|
+
Assets2["BUSINESS_CARD"] = "business-card";
|
|
143
|
+
Assets2["CALENDAR"] = "calendar";
|
|
144
|
+
Assets2["CHECK_MARK"] = "check-mark";
|
|
145
|
+
Assets2["CLOSED_WINDOW"] = "closed-window";
|
|
146
|
+
Assets2["COIN_PILE_DOWN"] = "coin-pile-down";
|
|
147
|
+
Assets2["COIN_PILE_UP"] = "coin-pile-up";
|
|
148
|
+
Assets2["CONFETTI"] = "confetti";
|
|
149
|
+
Assets2["CONSTRUCTION_FENCE"] = "construction-fence";
|
|
150
|
+
Assets2["CONVERT"] = "convert";
|
|
151
|
+
Assets2["COOKIE"] = "cookie";
|
|
152
|
+
Assets2["DIGITAL_CARD_2"] = "digital-card-2";
|
|
153
|
+
Assets2["DIGITAL_CARD"] = "digital-card";
|
|
154
|
+
Assets2["DOCUMENTS"] = "documents";
|
|
155
|
+
Assets2["DOOR"] = "door";
|
|
156
|
+
Assets2["ECO_CARD"] = "eco-card";
|
|
157
|
+
Assets2["ELECTRIC_PLUG"] = "electric-plug";
|
|
158
|
+
Assets2["EMAIL_SUCCESS"] = "email-success";
|
|
159
|
+
Assets2["EMAIL"] = "email";
|
|
160
|
+
Assets2["EXCLAMATION_MARK"] = "exclamation-mark";
|
|
161
|
+
Assets2["FLAG"] = "flag";
|
|
162
|
+
Assets2["FLOWER"] = "flower";
|
|
163
|
+
Assets2["GEAR"] = "gear";
|
|
164
|
+
Assets2["GLOBE"] = "globe";
|
|
165
|
+
Assets2["GRAPH"] = "graph";
|
|
166
|
+
Assets2["HEART_2"] = "heart-2";
|
|
167
|
+
Assets2["HEART_3"] = "heart-3";
|
|
168
|
+
Assets2["HEART_4"] = "heart-4";
|
|
169
|
+
Assets2["HEART_5"] = "heart-5";
|
|
170
|
+
Assets2["HEART"] = "heart";
|
|
171
|
+
Assets2["HOUSE"] = "house";
|
|
172
|
+
Assets2["ID_CARD"] = "id-card";
|
|
173
|
+
Assets2["INFINITE"] = "infinite";
|
|
174
|
+
Assets2["INVITE_LETTER"] = "invite-letter";
|
|
175
|
+
Assets2["JARS"] = "jars";
|
|
176
|
+
Assets2["KEY"] = "key";
|
|
177
|
+
Assets2["LIGHT_BULB"] = "light-bulb";
|
|
178
|
+
Assets2["LOCK"] = "lock";
|
|
179
|
+
Assets2["MAGNIFYING_GLASS"] = "magnifying-glass";
|
|
180
|
+
Assets2["MAP"] = "map";
|
|
181
|
+
Assets2["MARBLE_CARD_BUSINESS"] = "marble-card-business";
|
|
182
|
+
Assets2["MARBLE_CARD"] = "marble-card";
|
|
183
|
+
Assets2["MARBLE"] = "marble";
|
|
184
|
+
Assets2["MEGAPHONE"] = "megaphone";
|
|
185
|
+
Assets2["MULTI_CURRENCY"] = "multi-currency";
|
|
186
|
+
Assets2["ONE_INVITE_LETTER_OPENED"] = "one-invite-letter-opened";
|
|
187
|
+
Assets2["PALM_TREE"] = "palm-tree";
|
|
188
|
+
Assets2["PERCENTAGE"] = "percentage";
|
|
189
|
+
Assets2["PERSONAL_CARD"] = "personal-card";
|
|
190
|
+
Assets2["PHONES"] = "phones";
|
|
191
|
+
Assets2["PIE_CHART"] = "pie-chart";
|
|
192
|
+
Assets2["PLANE_2"] = "plane-2";
|
|
193
|
+
Assets2["PLANE"] = "plane";
|
|
194
|
+
Assets2["PUZZLE_PIECES"] = "puzzle-pieces";
|
|
195
|
+
Assets2["QUESTION_MARK"] = "question-mark";
|
|
196
|
+
Assets2["RECEIVE"] = "receive";
|
|
197
|
+
Assets2["REMINDER_LETTER"] = "reminder-letter";
|
|
198
|
+
Assets2["SAND_TIMER"] = "sand-timer";
|
|
199
|
+
Assets2["SHOPPING_BAG"] = "shopping-bag";
|
|
200
|
+
Assets2["SKIP_AUTHENTICATION"] = "skip-authentication";
|
|
201
|
+
Assets2["SPEECH_BUBBLE"] = "speech-bubble";
|
|
202
|
+
Assets2["TOOL"] = "tool";
|
|
203
|
+
Assets2["TWO_INVITE_LETTERS_OPENED"] = "two-invite-letters-opened";
|
|
204
|
+
Assets2["WALLET"] = "wallet";
|
|
205
|
+
})(Assets || (Assets = {}));
|
|
206
|
+
(function(RenderMode2) {
|
|
207
|
+
RenderMode2[RenderMode2["INIT"] = 0] = "INIT";
|
|
208
|
+
RenderMode2[RenderMode2["FALLBACK"] = 1] = "FALLBACK";
|
|
209
|
+
RenderMode2[RenderMode2["ASSET_3D"] = 2] = "ASSET_3D";
|
|
210
|
+
})(RenderMode || (RenderMode = {}));
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
// ../../node_modules/.pnpm/react-webcam@7.1.1_react-dom@18.2.0_react@18.2.0/node_modules/react-webcam/dist/react-webcam.js
|
|
86
215
|
var require_react_webcam = __commonJS({
|
|
87
|
-
"../../node_modules/.pnpm/react-webcam@7.1.
|
|
216
|
+
"../../node_modules/.pnpm/react-webcam@7.1.1_react-dom@18.2.0_react@18.2.0/node_modules/react-webcam/dist/react-webcam.js"(exports, module2) {
|
|
88
217
|
"use strict";
|
|
89
218
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
90
219
|
if (typeof exports === "object" && typeof module2 === "object")
|
|
@@ -839,7 +968,7 @@ function isReference(block) {
|
|
|
839
968
|
}
|
|
840
969
|
|
|
841
970
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
842
|
-
var
|
|
971
|
+
var import_react43 = require("react");
|
|
843
972
|
var import_react_intl32 = require("react-intl");
|
|
844
973
|
|
|
845
974
|
// src/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
@@ -1778,7 +1907,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
1778
1907
|
}
|
|
1779
1908
|
|
|
1780
1909
|
// src/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
1781
|
-
var
|
|
1910
|
+
var import_react31 = require("react");
|
|
1782
1911
|
var import_react_intl21 = require("react-intl");
|
|
1783
1912
|
|
|
1784
1913
|
// src/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js
|
|
@@ -1792,7 +1921,7 @@ var PersistAsyncSchema_messages_default = (0, import_react_intl.defineMessages)(
|
|
|
1792
1921
|
});
|
|
1793
1922
|
|
|
1794
1923
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
1795
|
-
var
|
|
1924
|
+
var import_react30 = require("react");
|
|
1796
1925
|
var import_react_intl20 = require("react-intl");
|
|
1797
1926
|
|
|
1798
1927
|
// src/common/constants/DateMode.ts
|
|
@@ -1837,7 +1966,7 @@ var Size = {
|
|
|
1837
1966
|
|
|
1838
1967
|
// src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
1839
1968
|
var import_classnames6 = __toESM(require_classnames());
|
|
1840
|
-
var
|
|
1969
|
+
var import_react29 = require("react");
|
|
1841
1970
|
|
|
1842
1971
|
// src/layout/alert/DynamicAlert.tsx
|
|
1843
1972
|
var import_components2 = require("@transferwise/components");
|
|
@@ -2401,7 +2530,7 @@ var DynamicExternal = ({ component, onAction }) => {
|
|
|
2401
2530
|
var DynamicExternal_default = DynamicExternal;
|
|
2402
2531
|
|
|
2403
2532
|
// src/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
2404
|
-
var
|
|
2533
|
+
var import_react23 = require("react");
|
|
2405
2534
|
|
|
2406
2535
|
// src/jsonSchemaForm/allOfSchema/AllOfSchema.tsx
|
|
2407
2536
|
var import_classnames = __toESM(require_classnames());
|
|
@@ -3323,7 +3452,7 @@ var ObjectSchema_default = ObjectSchema;
|
|
|
3323
3452
|
|
|
3324
3453
|
// src/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
3325
3454
|
var import_classnames4 = __toESM(require_classnames());
|
|
3326
|
-
var
|
|
3455
|
+
var import_react18 = require("react");
|
|
3327
3456
|
|
|
3328
3457
|
// src/jsonSchemaForm/help/Help.tsx
|
|
3329
3458
|
var import_components10 = require("@transferwise/components");
|
|
@@ -3357,7 +3486,7 @@ var Help = (props) => {
|
|
|
3357
3486
|
var Help_default = Help;
|
|
3358
3487
|
|
|
3359
3488
|
// src/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
3360
|
-
var
|
|
3489
|
+
var import_react17 = require("react");
|
|
3361
3490
|
|
|
3362
3491
|
// src/formControl/FormControl.tsx
|
|
3363
3492
|
var import_components11 = require("@transferwise/components");
|
|
@@ -3551,8 +3680,6 @@ var FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3551
3680
|
min,
|
|
3552
3681
|
max,
|
|
3553
3682
|
searchPlaceholder,
|
|
3554
|
-
searchValue,
|
|
3555
|
-
onSearchChange,
|
|
3556
3683
|
size,
|
|
3557
3684
|
uploadProps,
|
|
3558
3685
|
label,
|
|
@@ -3592,27 +3719,40 @@ var FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3592
3719
|
);
|
|
3593
3720
|
case FormControlType.SELECT: {
|
|
3594
3721
|
const search = options.length >= 20;
|
|
3595
|
-
|
|
3596
|
-
|
|
3722
|
+
const items = options;
|
|
3723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "d-flex flex-column", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3724
|
+
import_components11.SelectInput,
|
|
3597
3725
|
{
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3726
|
+
items: items.map((value2) => ({
|
|
3727
|
+
type: "option",
|
|
3728
|
+
value: value2,
|
|
3729
|
+
disabled: value2.disabled
|
|
3730
|
+
})),
|
|
3731
|
+
value: this.getSelectedOption(options) ?? null,
|
|
3732
|
+
renderValue: (value2) => {
|
|
3733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3734
|
+
import_components11.SelectInputOptionContent,
|
|
3735
|
+
{
|
|
3736
|
+
title: value2.label,
|
|
3737
|
+
note: value2.note || value2.secondary || "",
|
|
3738
|
+
icon: value2.icon
|
|
3739
|
+
}
|
|
3740
|
+
);
|
|
3741
|
+
},
|
|
3742
|
+
filterable: search,
|
|
3603
3743
|
disabled,
|
|
3604
3744
|
placeholder,
|
|
3605
|
-
searchPlaceholder,
|
|
3606
|
-
searchValue,
|
|
3745
|
+
filterPlaceholder: searchPlaceholder,
|
|
3607
3746
|
onChange: (option) => {
|
|
3608
|
-
this.setState({ selectedOption: option
|
|
3609
|
-
this.
|
|
3747
|
+
this.setState({ selectedOption: option });
|
|
3748
|
+
this.handleOnChange(option.value);
|
|
3610
3749
|
},
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3750
|
+
onClear: () => {
|
|
3751
|
+
this.setState({ selectedOption: void 0 });
|
|
3752
|
+
this.props.onChange(null);
|
|
3753
|
+
}
|
|
3614
3754
|
}
|
|
3615
|
-
);
|
|
3755
|
+
) });
|
|
3616
3756
|
}
|
|
3617
3757
|
case FormControlType.TAB:
|
|
3618
3758
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
@@ -3876,7 +4016,15 @@ var FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3876
4016
|
|
|
3877
4017
|
// src/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
3878
4018
|
var import_components12 = require("@transferwise/components");
|
|
3879
|
-
|
|
4019
|
+
|
|
4020
|
+
// ../../node_modules/.pnpm/@wise+art@2.8.4_react-dom@18.2.0_react@18.2.0/node_modules/@wise/art/dist/index.esm.js
|
|
4021
|
+
init_index_d76005d8_esm();
|
|
4022
|
+
var import_react16 = require("react");
|
|
4023
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4024
|
+
init_clsx();
|
|
4025
|
+
|
|
4026
|
+
// src/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
4027
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3880
4028
|
var mapConstSchemaToOption = (schema, controlType) => {
|
|
3881
4029
|
switch (controlType) {
|
|
3882
4030
|
case "select":
|
|
@@ -3912,37 +4060,37 @@ var mapKeywordsToSearchStrings = (searchStrings) => isArray(searchStrings) ? { s
|
|
|
3912
4060
|
var mapImage = (image) => {
|
|
3913
4061
|
if (image?.url) {
|
|
3914
4062
|
return {
|
|
3915
|
-
icon: /* @__PURE__ */ (0,
|
|
4063
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "media", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { src: image.url, alt: image.name || "" }) }) })
|
|
3916
4064
|
};
|
|
3917
4065
|
}
|
|
3918
4066
|
return null;
|
|
3919
4067
|
};
|
|
3920
4068
|
var getIconPropertyForSelectOption = (icon) => {
|
|
3921
4069
|
if (icon?.name && isFlagIcon(icon.name)) {
|
|
3922
|
-
return {
|
|
4070
|
+
return { icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Flag, { code: icon.name.substring(5), intrinsicSize: 24 }) };
|
|
3923
4071
|
}
|
|
3924
4072
|
if (icon?.name && isValidIconName(icon.name)) {
|
|
3925
|
-
return { icon: /* @__PURE__ */ (0,
|
|
4073
|
+
return { icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DynamicIcon_default, { type: icon.name }) };
|
|
3926
4074
|
}
|
|
3927
4075
|
if (icon?.text) {
|
|
3928
|
-
return { icon: /* @__PURE__ */ (0,
|
|
4076
|
+
return { icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: icon.text }) };
|
|
3929
4077
|
}
|
|
3930
4078
|
return null;
|
|
3931
4079
|
};
|
|
3932
4080
|
var getAvatarPropertyForRadioOption = ({ image, icon }) => {
|
|
3933
4081
|
if (image?.url) {
|
|
3934
4082
|
return {
|
|
3935
|
-
avatar: /* @__PURE__ */ (0,
|
|
4083
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components12.Avatar, { type: import_components12.AvatarType.THUMBNAIL, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { src: image.url, alt: "" }) })
|
|
3936
4084
|
};
|
|
3937
4085
|
}
|
|
3938
4086
|
if (icon?.name && isValidIconName(icon.name)) {
|
|
3939
4087
|
return {
|
|
3940
|
-
avatar: /* @__PURE__ */ (0,
|
|
4088
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components12.Avatar, { type: import_components12.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DynamicIcon_default, { type: icon.name }) })
|
|
3941
4089
|
};
|
|
3942
4090
|
}
|
|
3943
4091
|
if (icon?.text) {
|
|
3944
4092
|
return {
|
|
3945
|
-
avatar: /* @__PURE__ */ (0,
|
|
4093
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components12.Avatar, { type: import_components12.AvatarType.INITIALS, children: icon.text })
|
|
3946
4094
|
};
|
|
3947
4095
|
}
|
|
3948
4096
|
return null;
|
|
@@ -3952,8 +4100,10 @@ var mapSchemaToUploadOptions = ({ accepts }) => ({
|
|
|
3952
4100
|
});
|
|
3953
4101
|
var getOptionDescription = (title, description) => {
|
|
3954
4102
|
if (title && description) {
|
|
3955
|
-
|
|
3956
|
-
|
|
4103
|
+
if ((title + description).length > 50) {
|
|
4104
|
+
return { secondary: description };
|
|
4105
|
+
}
|
|
4106
|
+
return { note: description };
|
|
3957
4107
|
}
|
|
3958
4108
|
return void 0;
|
|
3959
4109
|
};
|
|
@@ -3964,19 +4114,12 @@ var getDisabled = (disabled) => {
|
|
|
3964
4114
|
return void 0;
|
|
3965
4115
|
};
|
|
3966
4116
|
|
|
3967
|
-
// src/jsonSchemaForm/schemaFormControl/
|
|
3968
|
-
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3969
|
-
var isNativeInput = (propsSchemaType) => {
|
|
3970
|
-
return propsSchemaType === "string" || propsSchemaType === "number";
|
|
3971
|
-
};
|
|
4117
|
+
// src/jsonSchemaForm/schemaFormControl/utils/control-type-utils.tsx
|
|
3972
4118
|
var getControlType = (schema) => {
|
|
3973
4119
|
if (isOneOfSchema(schema)) {
|
|
3974
4120
|
if (schema.control === FormControlType.TAB && schema.oneOf.length > 3) {
|
|
3975
4121
|
return FormControlType.SELECT;
|
|
3976
4122
|
}
|
|
3977
|
-
if (schema.oneOf.length === 2 && !schema.control) {
|
|
3978
|
-
return FormControlType.RADIO;
|
|
3979
|
-
}
|
|
3980
4123
|
return schema.control || FormControlType.SELECT;
|
|
3981
4124
|
}
|
|
3982
4125
|
if ("control" in schema && schema.control) {
|
|
@@ -4004,6 +4147,12 @@ var getControlType = (schema) => {
|
|
|
4004
4147
|
}
|
|
4005
4148
|
return schema.type;
|
|
4006
4149
|
};
|
|
4150
|
+
|
|
4151
|
+
// src/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
4152
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4153
|
+
var isNativeInput = (propsSchemaType) => {
|
|
4154
|
+
return propsSchemaType === "string" || propsSchemaType === "number";
|
|
4155
|
+
};
|
|
4007
4156
|
var getOptions = (schema, controlType) => {
|
|
4008
4157
|
if (schema.oneOf) {
|
|
4009
4158
|
return schema.oneOf.map((childSchema) => mapConstSchemaToOption(childSchema, controlType));
|
|
@@ -4018,7 +4167,7 @@ var SchemaFormControl = (props) => {
|
|
|
4018
4167
|
onChange(getValidBasicModelOrNull(value2, schema), type);
|
|
4019
4168
|
};
|
|
4020
4169
|
const controlType = getControlType(schema);
|
|
4021
|
-
(0,
|
|
4170
|
+
(0, import_react17.useEffect)(() => {
|
|
4022
4171
|
warnIfInvalidSchema(schema, log, controlType);
|
|
4023
4172
|
}, [JSON.stringify(schema), log, controlType]);
|
|
4024
4173
|
const options = schema.values || getOptions(schema, controlType);
|
|
@@ -4042,7 +4191,7 @@ var SchemaFormControl = (props) => {
|
|
|
4042
4191
|
uploadProps: mapSchemaToUploadOptions(schema),
|
|
4043
4192
|
describedBy
|
|
4044
4193
|
};
|
|
4045
|
-
return /* @__PURE__ */ (0,
|
|
4194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { "aria-describedby": describedBy, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FormControl, { type: controlType, value: safeValue, ...events, ...controlProps }) });
|
|
4046
4195
|
};
|
|
4047
4196
|
SchemaFormControl.defaultProps = {
|
|
4048
4197
|
value: null,
|
|
@@ -4071,17 +4220,17 @@ var warnIfInvalidSchema = (schema, log, controlType) => {
|
|
|
4071
4220
|
var SchemaFormControl_default = SchemaFormControl;
|
|
4072
4221
|
|
|
4073
4222
|
// src/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
4074
|
-
var
|
|
4223
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4075
4224
|
var OneOfSchema = (props) => {
|
|
4076
4225
|
const onEvent = useEventDispatcher();
|
|
4077
|
-
const [changed, setChanged] = (0,
|
|
4078
|
-
const [focused, setFocused] = (0,
|
|
4079
|
-
const [blurred, setBlurred] = (0,
|
|
4080
|
-
const id = (0,
|
|
4081
|
-
const [schemaIndex, setSchemaIndex] = (0,
|
|
4226
|
+
const [changed, setChanged] = (0, import_react18.useState)(false);
|
|
4227
|
+
const [focused, setFocused] = (0, import_react18.useState)(false);
|
|
4228
|
+
const [blurred, setBlurred] = (0, import_react18.useState)(false);
|
|
4229
|
+
const id = (0, import_react18.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
4230
|
+
const [schemaIndex, setSchemaIndex] = (0, import_react18.useState)(
|
|
4082
4231
|
getActiveSchemaIndex(props.schema, props.model)
|
|
4083
4232
|
);
|
|
4084
|
-
const [models, setModels] = (0,
|
|
4233
|
+
const [models, setModels] = (0, import_react18.useState)(getModelPartsForSchemas(props.model, props.schema.oneOf));
|
|
4085
4234
|
const debouncedTrackEvent = useDebouncedFunction(onEvent, 200);
|
|
4086
4235
|
const onSearchChange = (searchValue) => {
|
|
4087
4236
|
debouncedTrackEvent("Dynamic Flow - OneOf Searched", {
|
|
@@ -4089,7 +4238,7 @@ var OneOfSchema = (props) => {
|
|
|
4089
4238
|
searchValueLength: searchValue.length
|
|
4090
4239
|
});
|
|
4091
4240
|
};
|
|
4092
|
-
(0,
|
|
4241
|
+
(0, import_react18.useEffect)(() => {
|
|
4093
4242
|
const modelIndex = getValidIndexFromValue(props.schema, props.model);
|
|
4094
4243
|
const defaultIndex = getValidIndexFromValue(props.schema, props.schema.default);
|
|
4095
4244
|
if (modelIndex === -1 && defaultIndex >= 0) {
|
|
@@ -4145,25 +4294,27 @@ var OneOfSchema = (props) => {
|
|
|
4145
4294
|
"has-error": !changed && props.errors && !isEmpty(props.errors) || (props.submitted || changed && blurred) && validations.length
|
|
4146
4295
|
};
|
|
4147
4296
|
const feedbackId = `${id}-feedback`;
|
|
4148
|
-
return /* @__PURE__ */ (0,
|
|
4149
|
-
(props.schema.oneOf.length > 1 || isConstSchema(props.schema.oneOf[0])) && /* @__PURE__ */ (0,
|
|
4150
|
-
/* @__PURE__ */ (0,
|
|
4151
|
-
getTitleAndHelp(
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
4298
|
+
(props.schema.oneOf.length > 1 || isConstSchema(props.schema.oneOf[0])) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
4299
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: (0, import_classnames4.default)(formGroupClasses), children: [
|
|
4300
|
+
getTitleAndHelp(
|
|
4301
|
+
props.schema,
|
|
4302
|
+
id,
|
|
4303
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4304
|
+
SchemaFormControl_default,
|
|
4305
|
+
{
|
|
4306
|
+
id,
|
|
4307
|
+
schema: schemaForSelect,
|
|
4308
|
+
value: schemaIndex,
|
|
4309
|
+
disabled: props.disabled,
|
|
4310
|
+
onChange: onChooseNewSchema,
|
|
4311
|
+
onFocus,
|
|
4312
|
+
onBlur,
|
|
4313
|
+
onSearchChange
|
|
4314
|
+
}
|
|
4315
|
+
)
|
|
4165
4316
|
),
|
|
4166
|
-
/* @__PURE__ */ (0,
|
|
4317
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4167
4318
|
ControlFeedback_default,
|
|
4168
4319
|
{
|
|
4169
4320
|
id: feedbackId,
|
|
@@ -4178,9 +4329,9 @@ var OneOfSchema = (props) => {
|
|
|
4178
4329
|
}
|
|
4179
4330
|
)
|
|
4180
4331
|
] }),
|
|
4181
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
4332
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DynamicAlert_default, { component: props.schema.alert })
|
|
4182
4333
|
] }),
|
|
4183
|
-
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0,
|
|
4334
|
+
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4184
4335
|
GenericSchema_default,
|
|
4185
4336
|
{
|
|
4186
4337
|
schema: props.schema.oneOf[schemaIndex],
|
|
@@ -4195,16 +4346,19 @@ var OneOfSchema = (props) => {
|
|
|
4195
4346
|
)
|
|
4196
4347
|
] });
|
|
4197
4348
|
};
|
|
4198
|
-
function getTitleAndHelp(schema, id) {
|
|
4199
|
-
const
|
|
4200
|
-
const
|
|
4349
|
+
function getTitleAndHelp(schema, id, children) {
|
|
4350
|
+
const type = getControlType(schema);
|
|
4351
|
+
const helpElement = schema.help ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Help_default, { help: schema.help }) : null;
|
|
4352
|
+
const titleElement = isConstSchema(schema.oneOf[0]) ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "control-label d-inline", htmlFor: type === "select" ? void 0 : id, children: [
|
|
4201
4353
|
schema.title,
|
|
4202
4354
|
" ",
|
|
4203
|
-
helpElement
|
|
4204
|
-
|
|
4355
|
+
helpElement,
|
|
4356
|
+
children
|
|
4357
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("h4", { className: "m-b-2", children: [
|
|
4205
4358
|
schema.title,
|
|
4206
4359
|
" ",
|
|
4207
|
-
helpElement
|
|
4360
|
+
helpElement,
|
|
4361
|
+
children
|
|
4208
4362
|
] });
|
|
4209
4363
|
return schema.title ? titleElement : helpElement;
|
|
4210
4364
|
}
|
|
@@ -4242,12 +4396,12 @@ var OneOfSchema_default = OneOfSchema;
|
|
|
4242
4396
|
|
|
4243
4397
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4244
4398
|
var import_classnames5 = __toESM(require_classnames());
|
|
4245
|
-
var
|
|
4399
|
+
var import_react20 = require("react");
|
|
4246
4400
|
|
|
4247
4401
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
|
|
4248
4402
|
var import_components13 = require("@transferwise/components");
|
|
4249
|
-
var
|
|
4250
|
-
var
|
|
4403
|
+
var import_react19 = require("react");
|
|
4404
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4251
4405
|
var UploadInputAdapter = (props) => {
|
|
4252
4406
|
const {
|
|
4253
4407
|
id,
|
|
@@ -4263,7 +4417,7 @@ var UploadInputAdapter = (props) => {
|
|
|
4263
4417
|
onCancel
|
|
4264
4418
|
} = props;
|
|
4265
4419
|
const onEvent = useEventDispatcher();
|
|
4266
|
-
const files = (0,
|
|
4420
|
+
const files = (0, import_react19.useMemo)(() => fileId ? [{ id: fileId, status: import_components13.Status.SUCCEEDED }] : [], [fileId]);
|
|
4267
4421
|
const uploadFile = (formData) => {
|
|
4268
4422
|
onEvent("Dynamic Flow - PersistAsync", { status: "pending", schemaId: id });
|
|
4269
4423
|
return httpClient(`${httpOptions.url}`, {
|
|
@@ -4281,7 +4435,7 @@ var UploadInputAdapter = (props) => {
|
|
|
4281
4435
|
}
|
|
4282
4436
|
});
|
|
4283
4437
|
};
|
|
4284
|
-
return /* @__PURE__ */ (0,
|
|
4438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4285
4439
|
import_components13.UploadInput,
|
|
4286
4440
|
{
|
|
4287
4441
|
id,
|
|
@@ -4301,12 +4455,12 @@ var UploadInputAdapter = (props) => {
|
|
|
4301
4455
|
};
|
|
4302
4456
|
|
|
4303
4457
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4304
|
-
var
|
|
4458
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4305
4459
|
var PersistAsyncBlobSchema = (props) => {
|
|
4306
|
-
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0,
|
|
4307
|
-
const [persistAsyncValidations, setPersistAsyncValidations] = (0,
|
|
4308
|
-
const [validations, setValidations] = (0,
|
|
4309
|
-
const [changed, setChanged] = (0,
|
|
4460
|
+
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, import_react20.useState)({});
|
|
4461
|
+
const [persistAsyncValidations, setPersistAsyncValidations] = (0, import_react20.useState)(null);
|
|
4462
|
+
const [validations, setValidations] = (0, import_react20.useState)([]);
|
|
4463
|
+
const [changed, setChanged] = (0, import_react20.useState)(false);
|
|
4310
4464
|
const httpClient = useHttpClient();
|
|
4311
4465
|
const onEvent = useEventDispatcher();
|
|
4312
4466
|
const refreshValidations = () => {
|
|
@@ -4314,7 +4468,7 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4314
4468
|
setValidations(getValidationFailures(props.model, props.schema, !!props.required));
|
|
4315
4469
|
}
|
|
4316
4470
|
};
|
|
4317
|
-
(0,
|
|
4471
|
+
(0, import_react20.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
4318
4472
|
const onSuccess = async (httpResponse, _fileName) => {
|
|
4319
4473
|
const jsonResponse = await httpResponse.json();
|
|
4320
4474
|
const id2 = getIdFromResponse(props.schema.persistAsync.idProperty, jsonResponse);
|
|
@@ -4345,8 +4499,8 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4345
4499
|
};
|
|
4346
4500
|
const id = props.schema.$id || props.schema.persistAsync.schema.$id || props.schema.persistAsync.idProperty;
|
|
4347
4501
|
const feedbackId = `${id}-feedback`;
|
|
4348
|
-
return /* @__PURE__ */ (0,
|
|
4349
|
-
/* @__PURE__ */ (0,
|
|
4502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: (0, import_classnames5.default)(formGroupClasses), children: [
|
|
4503
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4350
4504
|
UploadInputAdapter,
|
|
4351
4505
|
{
|
|
4352
4506
|
id,
|
|
@@ -4364,7 +4518,7 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4364
4518
|
...mapSchemaToUploadOptions(props.schema.persistAsync.schema)
|
|
4365
4519
|
}
|
|
4366
4520
|
) }),
|
|
4367
|
-
/* @__PURE__ */ (0,
|
|
4521
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4368
4522
|
ControlFeedback_default,
|
|
4369
4523
|
{
|
|
4370
4524
|
id: feedbackId,
|
|
@@ -4390,19 +4544,19 @@ PersistAsyncBlobSchema.defaultProps = {
|
|
|
4390
4544
|
var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
|
|
4391
4545
|
|
|
4392
4546
|
// src/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
|
|
4393
|
-
var
|
|
4547
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4394
4548
|
var PersistAsyncSchema = (props) => {
|
|
4395
4549
|
const { schema } = props;
|
|
4396
4550
|
const persistAsyncSchemaType = schema.persistAsync.schema.type;
|
|
4397
4551
|
if (persistAsyncSchemaType === "blob") {
|
|
4398
|
-
return /* @__PURE__ */ (0,
|
|
4552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4399
4553
|
PersistAsyncBlobSchema_default,
|
|
4400
4554
|
{
|
|
4401
4555
|
...props
|
|
4402
4556
|
}
|
|
4403
4557
|
);
|
|
4404
4558
|
}
|
|
4405
|
-
return /* @__PURE__ */ (0,
|
|
4559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PersistAsyncBasicSchema_default, { ...props });
|
|
4406
4560
|
};
|
|
4407
4561
|
PersistAsyncSchema.defaultProps = {
|
|
4408
4562
|
required: false
|
|
@@ -4410,7 +4564,7 @@ PersistAsyncSchema.defaultProps = {
|
|
|
4410
4564
|
var PersistAsyncSchema_default = PersistAsyncSchema;
|
|
4411
4565
|
|
|
4412
4566
|
// src/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
4413
|
-
var
|
|
4567
|
+
var import_react21 = require("react");
|
|
4414
4568
|
|
|
4415
4569
|
// src/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.ts
|
|
4416
4570
|
var getSelectionFromModel = (schema, model) => {
|
|
@@ -4423,7 +4577,7 @@ var getSelectionFromModel = (schema, model) => {
|
|
|
4423
4577
|
|
|
4424
4578
|
// src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.tsx
|
|
4425
4579
|
var import_components14 = require("@transferwise/components");
|
|
4426
|
-
var
|
|
4580
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4427
4581
|
var PromotedOneOfCheckboxControl = (props) => {
|
|
4428
4582
|
const { id, selection, setSelection } = props;
|
|
4429
4583
|
const { promoted, other, checkedMeans } = props.promotion;
|
|
@@ -4434,14 +4588,14 @@ var PromotedOneOfCheckboxControl = (props) => {
|
|
|
4434
4588
|
const toggleSelection = () => {
|
|
4435
4589
|
setSelection(checked ? selectionWhenUnchecked : selectionWhenChecked);
|
|
4436
4590
|
};
|
|
4437
|
-
return /* @__PURE__ */ (0,
|
|
4591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "form-group", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_components14.Checkbox, { id, label: title, checked, onChange: toggleSelection }) });
|
|
4438
4592
|
};
|
|
4439
4593
|
PromotedOneOfCheckboxControl.defaultProps = {};
|
|
4440
4594
|
var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
|
|
4441
4595
|
|
|
4442
4596
|
// src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
|
|
4443
4597
|
var import_components15 = require("@transferwise/components");
|
|
4444
|
-
var
|
|
4598
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4445
4599
|
var PromotedOneOfRadioControl = (props) => {
|
|
4446
4600
|
const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
|
|
4447
4601
|
const radios = [
|
|
@@ -4459,9 +4613,9 @@ var PromotedOneOfRadioControl = (props) => {
|
|
|
4459
4613
|
...getAvatarPropertyForRadioOption(promotion.other)
|
|
4460
4614
|
}
|
|
4461
4615
|
];
|
|
4462
|
-
return /* @__PURE__ */ (0,
|
|
4463
|
-
title && /* @__PURE__ */ (0,
|
|
4464
|
-
/* @__PURE__ */ (0,
|
|
4616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "form-group", children: [
|
|
4617
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("label", { className: "control-label", htmlFor: id, children: title }),
|
|
4618
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4465
4619
|
import_components15.RadioGroup,
|
|
4466
4620
|
{
|
|
4467
4621
|
name: "promoted-selection",
|
|
@@ -4479,16 +4633,16 @@ PromotedOneOfRadioControl.defaultProps = {
|
|
|
4479
4633
|
var PromotedOneOfRadioControl_default = PromotedOneOfRadioControl;
|
|
4480
4634
|
|
|
4481
4635
|
// src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.tsx
|
|
4482
|
-
var
|
|
4636
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4483
4637
|
var PromotedOneOfControl = (props) => {
|
|
4484
4638
|
const controlType = props.promotion.control || "radio";
|
|
4485
4639
|
switch (controlType) {
|
|
4486
4640
|
case "radio":
|
|
4487
|
-
return /* @__PURE__ */ (0,
|
|
4641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PromotedOneOfRadioControl_default, { ...props });
|
|
4488
4642
|
case "checkbox":
|
|
4489
|
-
return /* @__PURE__ */ (0,
|
|
4643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PromotedOneOfCheckboxControl_default, { ...props });
|
|
4490
4644
|
default:
|
|
4491
|
-
return /* @__PURE__ */ (0,
|
|
4645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, {});
|
|
4492
4646
|
}
|
|
4493
4647
|
};
|
|
4494
4648
|
PromotedOneOfControl.defaultProps = {
|
|
@@ -4498,19 +4652,19 @@ PromotedOneOfControl.defaultProps = {
|
|
|
4498
4652
|
var PromotedOneOfControl_default = PromotedOneOfControl;
|
|
4499
4653
|
|
|
4500
4654
|
// src/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
4501
|
-
var
|
|
4655
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4502
4656
|
var isPromoted = (schema) => schema.promoted === true;
|
|
4503
4657
|
var PromotedOneOfSchema = (props) => {
|
|
4504
|
-
const [selection, setSelection] = (0,
|
|
4658
|
+
const [selection, setSelection] = (0, import_react21.useState)(
|
|
4505
4659
|
getSelectionFromModel(props.schema, props.model) || props.schema.promotion?.default || "promoted"
|
|
4506
4660
|
);
|
|
4507
4661
|
const promotedAlert = props.schema.alert;
|
|
4508
4662
|
const promotedOneOf = props.schema.oneOf.find(isPromoted);
|
|
4509
4663
|
const promotedObjectSchema = getPromotedObjectSchema(promotedOneOf);
|
|
4510
4664
|
const otherOneOf = getOtherOneOf(props.schema);
|
|
4511
|
-
return /* @__PURE__ */ (0,
|
|
4512
|
-
promotedAlert && /* @__PURE__ */ (0,
|
|
4513
|
-
/* @__PURE__ */ (0,
|
|
4665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
4666
|
+
promotedAlert && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DynamicAlert_default, { component: promotedAlert }),
|
|
4667
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4514
4668
|
PromotedOneOfControl_default,
|
|
4515
4669
|
{
|
|
4516
4670
|
id: props.schema.$id,
|
|
@@ -4521,8 +4675,8 @@ var PromotedOneOfSchema = (props) => {
|
|
|
4521
4675
|
setSelection
|
|
4522
4676
|
}
|
|
4523
4677
|
),
|
|
4524
|
-
selection === "promoted" && /* @__PURE__ */ (0,
|
|
4525
|
-
selection === "other" && /* @__PURE__ */ (0,
|
|
4678
|
+
selection === "promoted" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ObjectSchema_default, { ...props, schema: promotedObjectSchema }),
|
|
4679
|
+
selection === "other" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(GenericSchema_default, { ...props, schema: otherOneOf })
|
|
4526
4680
|
] });
|
|
4527
4681
|
};
|
|
4528
4682
|
function getPromotedObjectSchema(promotedSchema) {
|
|
@@ -4571,12 +4725,12 @@ var ReadOnlySchema_messages_default = (0, import_react_intl14.defineMessages)({
|
|
|
4571
4725
|
});
|
|
4572
4726
|
|
|
4573
4727
|
// src/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
4574
|
-
var
|
|
4728
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
4575
4729
|
var ReadOnlySchema = ({ schema, model }) => {
|
|
4576
4730
|
const { title = "" } = schema;
|
|
4577
4731
|
const { formatMessage } = (0, import_react_intl15.useIntl)();
|
|
4578
4732
|
const value = getValueForSchema({ schema, model, formatMessage });
|
|
4579
|
-
return /* @__PURE__ */ (0,
|
|
4733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components16.DefinitionList, { layout: import_components16.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: "" }] });
|
|
4580
4734
|
};
|
|
4581
4735
|
var ReadOnlySchema_default = ReadOnlySchema;
|
|
4582
4736
|
function getValueForSchema({
|
|
@@ -4609,7 +4763,7 @@ function getSelectedOneOf(schema, model) {
|
|
|
4609
4763
|
function getValueFromOption(option) {
|
|
4610
4764
|
const text = option.title && option.description ? `${option.title} - ${option.description}` : option.title || "";
|
|
4611
4765
|
const icon = getAvatarPropertyForRadioOption({ icon: option.icon });
|
|
4612
|
-
return icon?.avatar ? /* @__PURE__ */ (0,
|
|
4766
|
+
return icon?.avatar ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
4613
4767
|
icon.avatar,
|
|
4614
4768
|
" ",
|
|
4615
4769
|
text
|
|
@@ -4617,22 +4771,22 @@ function getValueFromOption(option) {
|
|
|
4617
4771
|
}
|
|
4618
4772
|
|
|
4619
4773
|
// src/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
|
|
4620
|
-
var
|
|
4621
|
-
var
|
|
4774
|
+
var import_react22 = require("react");
|
|
4775
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
4622
4776
|
var ValidationAsyncSchema = (props) => {
|
|
4623
4777
|
const { schema, model, required, submitted, errors, onChange } = props;
|
|
4624
|
-
const [validationAsyncModel, setValidationAsyncModel] = (0,
|
|
4625
|
-
const previousRequestedModelReference = (0,
|
|
4626
|
-
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0,
|
|
4778
|
+
const [validationAsyncModel, setValidationAsyncModel] = (0, import_react22.useState)(model);
|
|
4779
|
+
const previousRequestedModelReference = (0, import_react22.useRef)(null);
|
|
4780
|
+
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0, import_react22.useState)(
|
|
4627
4781
|
null
|
|
4628
4782
|
);
|
|
4629
|
-
const [validationAsyncErrors, setValidationAsyncErrors] = (0,
|
|
4630
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
4631
|
-
const [abortController, setAbortController] = (0,
|
|
4783
|
+
const [validationAsyncErrors, setValidationAsyncErrors] = (0, import_react22.useState)(null);
|
|
4784
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react22.useState)(false);
|
|
4785
|
+
const [abortController, setAbortController] = (0, import_react22.useState)(null);
|
|
4632
4786
|
const httpClient = useHttpClient();
|
|
4633
4787
|
const onEvent = useEventDispatcher();
|
|
4634
4788
|
const log = useLogger();
|
|
4635
|
-
(0,
|
|
4789
|
+
(0, import_react22.useEffect)(() => {
|
|
4636
4790
|
if (!schema.validationAsync.method) {
|
|
4637
4791
|
log.warning(
|
|
4638
4792
|
"Invalid schema or model",
|
|
@@ -4703,20 +4857,20 @@ var ValidationAsyncSchema = (props) => {
|
|
|
4703
4857
|
required,
|
|
4704
4858
|
schema
|
|
4705
4859
|
};
|
|
4706
|
-
return /* @__PURE__ */ (0,
|
|
4860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(BasicTypeSchema_default, { ...basicTypeSchemaProps });
|
|
4707
4861
|
};
|
|
4708
4862
|
ValidationAsyncSchema.defaultProps = { required: false };
|
|
4709
4863
|
var ValidationAsyncSchema_default = ValidationAsyncSchema;
|
|
4710
4864
|
|
|
4711
4865
|
// src/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
4712
|
-
var
|
|
4713
|
-
var
|
|
4866
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
4867
|
+
var import_react24 = require("react");
|
|
4714
4868
|
var GenericSchemaForm = (props) => {
|
|
4715
4869
|
const { schema, model = null, errors = null, hideTitle = false, disabled = false } = props;
|
|
4716
4870
|
const schemaProps = { ...props, model, errors, hideTitle, disabled };
|
|
4717
4871
|
const type = getSchemaType(schema);
|
|
4718
4872
|
const log = useLogger();
|
|
4719
|
-
(0,
|
|
4873
|
+
(0, import_react23.useEffect)(() => {
|
|
4720
4874
|
if (!isValidGenericSchema(schema, model, errors)) {
|
|
4721
4875
|
log.error(
|
|
4722
4876
|
"Invalid schema or model",
|
|
@@ -4726,27 +4880,27 @@ var GenericSchemaForm = (props) => {
|
|
|
4726
4880
|
}, [JSON.stringify(schema), JSON.stringify(model), JSON.stringify(errors), type, log]);
|
|
4727
4881
|
switch (type) {
|
|
4728
4882
|
case "readOnly":
|
|
4729
|
-
return /* @__PURE__ */ (0,
|
|
4883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ReadOnlySchema_default, { ...schemaProps });
|
|
4730
4884
|
case "persistAsync":
|
|
4731
|
-
return /* @__PURE__ */ (0,
|
|
4885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PersistAsyncSchema_default, { ...schemaProps });
|
|
4732
4886
|
case "validationAsync":
|
|
4733
|
-
return /* @__PURE__ */ (0,
|
|
4887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ValidationAsyncSchema_default, { ...schemaProps });
|
|
4734
4888
|
case "basic": {
|
|
4735
4889
|
const basicTypeProps = { infoMessage: null, ...schemaProps };
|
|
4736
|
-
return /* @__PURE__ */ (0,
|
|
4890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(BasicTypeSchema_default, { ...basicTypeProps });
|
|
4737
4891
|
}
|
|
4738
4892
|
case "object":
|
|
4739
|
-
return /* @__PURE__ */ (0,
|
|
4893
|
+
return /* @__PURE__ */ (0, import_react24.createElement)(ObjectSchema_default, { ...schemaProps, key: JSON.stringify(schema) });
|
|
4740
4894
|
case "array":
|
|
4741
|
-
return /* @__PURE__ */ (0,
|
|
4895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ArraySchema_default, { ...schemaProps });
|
|
4742
4896
|
case "promotedOneOf":
|
|
4743
|
-
return /* @__PURE__ */ (0,
|
|
4897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PromotedOneOfSchema_default, { ...schemaProps });
|
|
4744
4898
|
case "oneOf":
|
|
4745
|
-
return /* @__PURE__ */ (0,
|
|
4899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(OneOfSchema_default, { ...schemaProps });
|
|
4746
4900
|
case "allOf":
|
|
4747
|
-
return /* @__PURE__ */ (0,
|
|
4901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(AllOfSchema_default, { ...schemaProps });
|
|
4748
4902
|
}
|
|
4749
|
-
return /* @__PURE__ */ (0,
|
|
4903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, {});
|
|
4750
4904
|
};
|
|
4751
4905
|
var GenericSchema_default = GenericSchemaForm;
|
|
4752
4906
|
var isValidGenericSchema = (schema, model, errors) => {
|
|
@@ -4773,7 +4927,7 @@ var isValidGenericSchema = (schema, model, errors) => {
|
|
|
4773
4927
|
};
|
|
4774
4928
|
|
|
4775
4929
|
// src/jsonSchemaForm/JsonSchemaForm.tsx
|
|
4776
|
-
var
|
|
4930
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4777
4931
|
var JsonSchemaForm = (props) => {
|
|
4778
4932
|
const schemaProps = {
|
|
4779
4933
|
model: null,
|
|
@@ -4783,26 +4937,26 @@ var JsonSchemaForm = (props) => {
|
|
|
4783
4937
|
...props
|
|
4784
4938
|
};
|
|
4785
4939
|
if (useHasHttpClientProvider() || schemaProps.baseUrl == null) {
|
|
4786
|
-
return /* @__PURE__ */ (0,
|
|
4940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(GenericSchema_default, { ...schemaProps });
|
|
4787
4941
|
}
|
|
4788
|
-
return /* @__PURE__ */ (0,
|
|
4942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4789
4943
|
Providers,
|
|
4790
4944
|
{
|
|
4791
4945
|
baseUrl: schemaProps.baseUrl,
|
|
4792
4946
|
onEvent: schemaProps.onEvent,
|
|
4793
4947
|
onLog: schemaProps.onLog,
|
|
4794
|
-
children: /* @__PURE__ */ (0,
|
|
4948
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(GenericSchema_default, { ...schemaProps })
|
|
4795
4949
|
}
|
|
4796
4950
|
);
|
|
4797
4951
|
};
|
|
4798
4952
|
var JsonSchemaForm_default = JsonSchemaForm;
|
|
4799
4953
|
var Providers = ({ baseUrl, onEvent, onLog, children }) => {
|
|
4800
|
-
return /* @__PURE__ */ (0,
|
|
4954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog: onLog ?? noop2, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4801
4955
|
EventsContextProvider,
|
|
4802
4956
|
{
|
|
4803
4957
|
metadata: { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm" },
|
|
4804
4958
|
onEvent: onEvent ?? noop2,
|
|
4805
|
-
children: /* @__PURE__ */ (0,
|
|
4959
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children })
|
|
4806
4960
|
}
|
|
4807
4961
|
) });
|
|
4808
4962
|
};
|
|
@@ -4810,11 +4964,11 @@ var noop2 = () => {
|
|
|
4810
4964
|
};
|
|
4811
4965
|
|
|
4812
4966
|
// src/layout/form/DynamicForm.tsx
|
|
4813
|
-
var
|
|
4967
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
4814
4968
|
var DynamicForm = (props) => {
|
|
4815
4969
|
const form = props.component;
|
|
4816
4970
|
const formSchema = form.schema;
|
|
4817
|
-
return /* @__PURE__ */ (0,
|
|
4971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: getMargin(form.margin || "md"), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4818
4972
|
JsonSchemaForm_default,
|
|
4819
4973
|
{
|
|
4820
4974
|
schema: formSchema,
|
|
@@ -4831,46 +4985,46 @@ var DynamicForm = (props) => {
|
|
|
4831
4985
|
var DynamicForm_default = DynamicForm;
|
|
4832
4986
|
|
|
4833
4987
|
// src/layout/heading/DynamicHeading.tsx
|
|
4834
|
-
var
|
|
4988
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
4835
4989
|
var DynamicHeading = (props) => {
|
|
4836
4990
|
const { text, size = "md", align = "left", margin = "md" } = props.component;
|
|
4837
4991
|
const classes = getTextAlignmentAndMargin({ align, margin });
|
|
4838
4992
|
switch (size) {
|
|
4839
4993
|
case "xs":
|
|
4840
|
-
return /* @__PURE__ */ (0,
|
|
4994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("h5", { className: classes, children: text });
|
|
4841
4995
|
case "sm":
|
|
4842
|
-
return /* @__PURE__ */ (0,
|
|
4996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("h4", { className: classes, children: text });
|
|
4843
4997
|
case "lg":
|
|
4844
|
-
return /* @__PURE__ */ (0,
|
|
4998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("h2", { className: classes, children: text });
|
|
4845
4999
|
case "xl":
|
|
4846
|
-
return /* @__PURE__ */ (0,
|
|
5000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("h1", { className: classes, children: text });
|
|
4847
5001
|
case "md":
|
|
4848
5002
|
default:
|
|
4849
|
-
return /* @__PURE__ */ (0,
|
|
5003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("h3", { className: classes, children: text });
|
|
4850
5004
|
}
|
|
4851
5005
|
};
|
|
4852
5006
|
var DynamicHeading_default = DynamicHeading;
|
|
4853
5007
|
|
|
4854
5008
|
// src/layout/markdown/DynamicMarkdown.tsx
|
|
4855
5009
|
var import_components17 = require("@transferwise/components");
|
|
4856
|
-
var
|
|
5010
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
4857
5011
|
var DynamicMarkdown = ({ component }) => {
|
|
4858
5012
|
const { content, align, margin } = component;
|
|
4859
|
-
return /* @__PURE__ */ (0,
|
|
5013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_components17.Markdown, { config: { link: { target: "_blank" } }, children: content }) });
|
|
4860
5014
|
};
|
|
4861
5015
|
var DynamicInfo = ({ component }) => {
|
|
4862
|
-
return /* @__PURE__ */ (0,
|
|
5016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: getTextAlignmentAndMargin(component), children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_components17.Markdown, { config: { link: { target: "_blank" } }, children: component.markdown }) });
|
|
4863
5017
|
};
|
|
4864
5018
|
|
|
4865
5019
|
// src/layout/image/DynamicImage.tsx
|
|
4866
5020
|
var import_components18 = require("@transferwise/components");
|
|
4867
|
-
var
|
|
4868
|
-
var
|
|
5021
|
+
var import_react25 = require("react");
|
|
5022
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
4869
5023
|
var DynamicImage = ({ component: image }) => {
|
|
4870
5024
|
const { url, size, text, margin, accessibilityDescription } = image;
|
|
4871
5025
|
const httpClient = useHttpClient();
|
|
4872
|
-
const [imageSource, setImageSource] = (0,
|
|
4873
|
-
(0,
|
|
5026
|
+
const [imageSource, setImageSource] = (0, import_react25.useState)("");
|
|
5027
|
+
(0, import_react25.useEffect)(() => {
|
|
4874
5028
|
void getImageSource(httpClient, url).then(setImageSource);
|
|
4875
5029
|
}, [url, httpClient]);
|
|
4876
5030
|
const imageProps = {
|
|
@@ -4882,7 +5036,7 @@ var DynamicImage = ({ component: image }) => {
|
|
|
4882
5036
|
if (!imageSource) {
|
|
4883
5037
|
return null;
|
|
4884
5038
|
}
|
|
4885
|
-
return /* @__PURE__ */ (0,
|
|
5039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_components18.Image, { className: `img-responsive ${getMargin(margin || "md")}`, ...imageProps }) });
|
|
4886
5040
|
};
|
|
4887
5041
|
var readImageBlobAsDataURL = (imageBlob) => {
|
|
4888
5042
|
return new Promise((resolve, reject) => {
|
|
@@ -4915,47 +5069,47 @@ var DynamicImage_default = DynamicImage;
|
|
|
4915
5069
|
|
|
4916
5070
|
// src/layout/instructions/DynamicInstructions.tsx
|
|
4917
5071
|
var import_components19 = require("@transferwise/components");
|
|
4918
|
-
var
|
|
5072
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
4919
5073
|
var doContext = ["positive", "neutral"];
|
|
4920
5074
|
var dontContext = ["warning", "negative"];
|
|
4921
5075
|
var DynamicInstructions = ({ component }) => {
|
|
4922
5076
|
const { items } = component;
|
|
4923
5077
|
const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
|
|
4924
5078
|
const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
|
|
4925
|
-
return /* @__PURE__ */ (0,
|
|
4926
|
-
component.title ? /* @__PURE__ */ (0,
|
|
4927
|
-
/* @__PURE__ */ (0,
|
|
5079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: getMargin(component.margin || "md"), children: [
|
|
5080
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components19.Header, { title: component.title }) : null,
|
|
5081
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components19.InstructionsList, { dos, donts })
|
|
4928
5082
|
] });
|
|
4929
5083
|
};
|
|
4930
5084
|
var DynamicInstructions_default = DynamicInstructions;
|
|
4931
5085
|
|
|
4932
5086
|
// src/layout/DynamicLayout.tsx
|
|
4933
|
-
var
|
|
5087
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
4934
5088
|
var getKey = (component) => JSON.stringify(component);
|
|
4935
5089
|
var DynamicLayout = (props) => {
|
|
4936
5090
|
const { components, model, submitted, errors, onModelChange, onAction, onPersistAsync, baseUrl } = props;
|
|
4937
5091
|
const renderComponent = (component) => {
|
|
4938
5092
|
switch (component.type) {
|
|
4939
5093
|
case "heading":
|
|
4940
|
-
return /* @__PURE__ */ (0,
|
|
5094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DynamicHeading_default, { component }, getKey(component));
|
|
4941
5095
|
case "paragraph":
|
|
4942
|
-
return /* @__PURE__ */ (0,
|
|
5096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DynamicParagraph_default, { component }, getKey(component));
|
|
4943
5097
|
case "image":
|
|
4944
|
-
return /* @__PURE__ */ (0,
|
|
5098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DynamicImage_default, { component }, getKey(component));
|
|
4945
5099
|
case "alert":
|
|
4946
|
-
return /* @__PURE__ */ (0,
|
|
5100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DynamicAlert_default, { component }, getKey(component));
|
|
4947
5101
|
case "review":
|
|
4948
|
-
return /* @__PURE__ */ (0,
|
|
5102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DynamicReview_default, { component, onAction }, getKey(component));
|
|
4949
5103
|
case "divider":
|
|
4950
|
-
return /* @__PURE__ */ (0,
|
|
5104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DynamicDivider_default, { component }, getKey(component));
|
|
4951
5105
|
case "info":
|
|
4952
|
-
return /* @__PURE__ */ (0,
|
|
5106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DynamicInfo, { component }, getKey(component));
|
|
4953
5107
|
case "instructions":
|
|
4954
|
-
return /* @__PURE__ */ (0,
|
|
5108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DynamicInstructions_default, { component }, getKey(component));
|
|
4955
5109
|
case "markdown":
|
|
4956
|
-
return /* @__PURE__ */ (0,
|
|
5110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DynamicMarkdown, { component }, getKey(component));
|
|
4957
5111
|
case "columns":
|
|
4958
|
-
return /* @__PURE__ */ (0,
|
|
5112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
4959
5113
|
DynamicColumns_default,
|
|
4960
5114
|
{
|
|
4961
5115
|
component,
|
|
@@ -4969,7 +5123,7 @@ var DynamicLayout = (props) => {
|
|
|
4969
5123
|
getKey(component)
|
|
4970
5124
|
);
|
|
4971
5125
|
case "form":
|
|
4972
|
-
return /* @__PURE__ */ (0,
|
|
5126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
4973
5127
|
DynamicForm_default,
|
|
4974
5128
|
{
|
|
4975
5129
|
component,
|
|
@@ -4982,9 +5136,9 @@ var DynamicLayout = (props) => {
|
|
|
4982
5136
|
getKey({ ...component, errors: errors ?? null })
|
|
4983
5137
|
);
|
|
4984
5138
|
case "button":
|
|
4985
|
-
return /* @__PURE__ */ (0,
|
|
5139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DynamicButton_default, { component, onAction }, getKey(component));
|
|
4986
5140
|
case "box":
|
|
4987
|
-
return /* @__PURE__ */ (0,
|
|
5141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
4988
5142
|
DynamicBox_default,
|
|
4989
5143
|
{
|
|
4990
5144
|
component,
|
|
@@ -4998,34 +5152,34 @@ var DynamicLayout = (props) => {
|
|
|
4998
5152
|
getKey(component)
|
|
4999
5153
|
);
|
|
5000
5154
|
case "decision":
|
|
5001
|
-
return /* @__PURE__ */ (0,
|
|
5155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DynamicDecision_default, { component, onAction }, getKey(component));
|
|
5002
5156
|
case "external":
|
|
5003
|
-
return /* @__PURE__ */ (0,
|
|
5157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DynamicExternal_default, { component, onAction }, getKey(component));
|
|
5004
5158
|
case "list":
|
|
5005
5159
|
case "status-list":
|
|
5006
|
-
return /* @__PURE__ */ (0,
|
|
5160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DynamicStatusList_default, { component, onAction }, getKey(component));
|
|
5007
5161
|
case "loading-indicator":
|
|
5008
|
-
return /* @__PURE__ */ (0,
|
|
5162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DynamicLoadingIndicator_default, { component }, getKey(component));
|
|
5009
5163
|
case "search":
|
|
5010
|
-
return /* @__PURE__ */ (0,
|
|
5164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DynamicSearch_default, { component, onAction }, getKey(component));
|
|
5011
5165
|
default:
|
|
5012
|
-
return /* @__PURE__ */ (0,
|
|
5166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", {}, getKey(component));
|
|
5013
5167
|
}
|
|
5014
5168
|
};
|
|
5015
5169
|
if (useHasHttpClientProvider() || baseUrl == null) {
|
|
5016
|
-
return /* @__PURE__ */ (0,
|
|
5170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_jsx_runtime48.Fragment, { children: components.map(renderComponent) });
|
|
5017
5171
|
} else {
|
|
5018
|
-
return /* @__PURE__ */ (0,
|
|
5172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
|
|
5019
5173
|
}
|
|
5020
5174
|
};
|
|
5021
5175
|
var DynamicLayout_default = DynamicLayout;
|
|
5022
5176
|
|
|
5023
5177
|
// src/layout/list/DynamicStatusList.tsx
|
|
5024
5178
|
var import_components20 = require("@transferwise/components");
|
|
5025
|
-
var
|
|
5179
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
5026
5180
|
var DynamicStatusList = ({ component }) => {
|
|
5027
|
-
return /* @__PURE__ */ (0,
|
|
5028
|
-
component.title ? /* @__PURE__ */ (0,
|
|
5181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: getMargin(component.margin || "md"), children: [
|
|
5182
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("h4", { className: "m-b-2", children: [
|
|
5029
5183
|
" ",
|
|
5030
5184
|
component.title,
|
|
5031
5185
|
" "
|
|
@@ -5038,10 +5192,10 @@ var mapListItemToSummary = ({ title, description, icon, status }) => {
|
|
|
5038
5192
|
key: `${title}/${description || ""}`,
|
|
5039
5193
|
title,
|
|
5040
5194
|
description,
|
|
5041
|
-
...icon?.name ? { icon: /* @__PURE__ */ (0,
|
|
5195
|
+
...icon?.name ? { icon: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(DynamicIcon_default, { type: icon.name }) } : {},
|
|
5042
5196
|
...status ? { status: statusMap[status] } : {}
|
|
5043
5197
|
};
|
|
5044
|
-
return /* @__PURE__ */ (0,
|
|
5198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components20.Summary, { ...props });
|
|
5045
5199
|
};
|
|
5046
5200
|
var statusListMap = {
|
|
5047
5201
|
done: "done",
|
|
@@ -5058,10 +5212,10 @@ var DynamicStatusList_default = DynamicStatusList;
|
|
|
5058
5212
|
|
|
5059
5213
|
// src/layout/loadingIndicator/DynamicLoadingIndicator.tsx
|
|
5060
5214
|
var import_components21 = require("@transferwise/components");
|
|
5061
|
-
var
|
|
5215
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
5062
5216
|
var DynamicLoadingIndicator = ({ component }) => {
|
|
5063
5217
|
const { margin, size = "md" } = component;
|
|
5064
|
-
return /* @__PURE__ */ (0,
|
|
5218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5065
5219
|
import_components21.Loader,
|
|
5066
5220
|
{
|
|
5067
5221
|
size,
|
|
@@ -5095,18 +5249,18 @@ var DynamicParagraph_messages_default = (0, import_react_intl16.defineMessages)(
|
|
|
5095
5249
|
|
|
5096
5250
|
// src/layout/paragraph/useSnackBarIfAvailable.ts
|
|
5097
5251
|
var import_components22 = require("@transferwise/components");
|
|
5098
|
-
var
|
|
5252
|
+
var import_react26 = require("react");
|
|
5099
5253
|
function useSnackBarIfAvailable() {
|
|
5100
|
-
const context = (0,
|
|
5254
|
+
const context = (0, import_react26.useContext)(import_components22.SnackbarContext);
|
|
5101
5255
|
return context ? context.createSnackbar : noop3;
|
|
5102
5256
|
}
|
|
5103
5257
|
function noop3() {
|
|
5104
5258
|
}
|
|
5105
5259
|
|
|
5106
5260
|
// src/layout/paragraph/DynamicParagraph.tsx
|
|
5107
|
-
var
|
|
5108
|
-
var DynamicParagraph = ({ component }) => component.control === "copyable" ? /* @__PURE__ */ (0,
|
|
5109
|
-
var BasicDynamicParagraph = ({ component }) => /* @__PURE__ */ (0,
|
|
5261
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
5262
|
+
var DynamicParagraph = ({ component }) => component.control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(BasicDynamicParagraph, { component });
|
|
5263
|
+
var BasicDynamicParagraph = ({ component }) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("p", { className: getTextAlignmentAndMargin(component), children: [
|
|
5110
5264
|
" ",
|
|
5111
5265
|
component.text,
|
|
5112
5266
|
" "
|
|
@@ -5119,8 +5273,8 @@ var CopyableDynamicParagraph = ({ component }) => {
|
|
|
5119
5273
|
navigator.clipboard?.writeText(text).then(() => createSnackbar({ text: formatMessage(DynamicParagraph_messages_default.copied) })).catch(noop4);
|
|
5120
5274
|
};
|
|
5121
5275
|
const classNames7 = getTextAlignmentAndMargin({ align: component.align }) + " form-control";
|
|
5122
|
-
return /* @__PURE__ */ (0,
|
|
5123
|
-
/* @__PURE__ */ (0,
|
|
5276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: getTextAlignmentAndMargin(component), children: [
|
|
5277
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5124
5278
|
"input",
|
|
5125
5279
|
{
|
|
5126
5280
|
type: "text",
|
|
@@ -5130,7 +5284,7 @@ var CopyableDynamicParagraph = ({ component }) => {
|
|
|
5130
5284
|
style: { textOverflow: "ellipsis" }
|
|
5131
5285
|
}
|
|
5132
5286
|
),
|
|
5133
|
-
/* @__PURE__ */ (0,
|
|
5287
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components23.Button, { block: true, onClick: copy, className: getMargin("sm"), children: formatMessage(DynamicParagraph_messages_default.copy) })
|
|
5134
5288
|
] });
|
|
5135
5289
|
};
|
|
5136
5290
|
function noop4() {
|
|
@@ -5139,7 +5293,7 @@ var DynamicParagraph_default = DynamicParagraph;
|
|
|
5139
5293
|
|
|
5140
5294
|
// src/layout/review/DynamicReview.tsx
|
|
5141
5295
|
var import_components24 = require("@transferwise/components");
|
|
5142
|
-
var
|
|
5296
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
5143
5297
|
var getDefinitions = (orientation, review) => {
|
|
5144
5298
|
return review.fields.map(
|
|
5145
5299
|
({ label, value, help }, index) => {
|
|
@@ -5153,14 +5307,14 @@ var getDefinitions = (orientation, review) => {
|
|
|
5153
5307
|
};
|
|
5154
5308
|
var getFieldValue = (value, help, orientation) => {
|
|
5155
5309
|
if (help) {
|
|
5156
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0,
|
|
5157
|
-
/* @__PURE__ */ (0,
|
|
5310
|
+
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
5311
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Help_default, { help }),
|
|
5158
5312
|
" ",
|
|
5159
5313
|
value
|
|
5160
|
-
] }) : /* @__PURE__ */ (0,
|
|
5314
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
5161
5315
|
value,
|
|
5162
5316
|
" ",
|
|
5163
|
-
/* @__PURE__ */ (0,
|
|
5317
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Help_default, { help })
|
|
5164
5318
|
] });
|
|
5165
5319
|
}
|
|
5166
5320
|
return value;
|
|
@@ -5173,7 +5327,7 @@ var DynamicReview = (props) => {
|
|
|
5173
5327
|
const review = props.component;
|
|
5174
5328
|
const margin = getMargin(review.margin || "xs");
|
|
5175
5329
|
const getReviewAction = (action) => {
|
|
5176
|
-
return /* @__PURE__ */ (0,
|
|
5330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5177
5331
|
"a",
|
|
5178
5332
|
{
|
|
5179
5333
|
href: action.url,
|
|
@@ -5188,26 +5342,26 @@ var DynamicReview = (props) => {
|
|
|
5188
5342
|
);
|
|
5189
5343
|
};
|
|
5190
5344
|
const orientation = getReviewLayout(review);
|
|
5191
|
-
return /* @__PURE__ */ (0,
|
|
5192
|
-
review.title && /* @__PURE__ */ (0,
|
|
5345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
5346
|
+
review.title && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("h6", { className: `m-b-2 ${margin}`, children: [
|
|
5193
5347
|
review.title,
|
|
5194
5348
|
review.action && getReviewAction(review.action)
|
|
5195
5349
|
] }),
|
|
5196
|
-
/* @__PURE__ */ (0,
|
|
5350
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: review.title ? "" : margin, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components24.DefinitionList, { layout: orientation, definitions: getDefinitions(orientation, review) }) })
|
|
5197
5351
|
] });
|
|
5198
5352
|
};
|
|
5199
5353
|
var DynamicReview_default = DynamicReview;
|
|
5200
5354
|
|
|
5201
5355
|
// src/layout/search/DynamicSearch.tsx
|
|
5202
|
-
var
|
|
5356
|
+
var import_react28 = require("react");
|
|
5203
5357
|
|
|
5204
5358
|
// src/layout/search/SearchInput.tsx
|
|
5205
5359
|
var import_components25 = require("@transferwise/components");
|
|
5206
|
-
var
|
|
5360
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
5207
5361
|
var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
5208
|
-
return /* @__PURE__ */ (0,
|
|
5362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "control-label d-inline", children: [
|
|
5209
5363
|
title,
|
|
5210
|
-
/* @__PURE__ */ (0,
|
|
5364
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
5211
5365
|
import_components25.Input,
|
|
5212
5366
|
{
|
|
5213
5367
|
type: "text",
|
|
@@ -5239,13 +5393,13 @@ var ErrorBoundary_messages_default = (0, import_react_intl18.defineMessages)({
|
|
|
5239
5393
|
});
|
|
5240
5394
|
|
|
5241
5395
|
// src/layout/search/SearchResults.tsx
|
|
5242
|
-
var
|
|
5396
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
5243
5397
|
var SearchResults = ({ results, emptyMessage, onSelect }) => {
|
|
5244
5398
|
if (results.length === 0) {
|
|
5245
|
-
return /* @__PURE__ */ (0,
|
|
5399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "m-t-2", children: emptyMessage });
|
|
5246
5400
|
}
|
|
5247
|
-
return /* @__PURE__ */ (0,
|
|
5248
|
-
return /* @__PURE__ */ (0,
|
|
5401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components26.NavigationOptionsList, { children: results.map((result) => {
|
|
5402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5249
5403
|
import_components26.NavigationOption,
|
|
5250
5404
|
{
|
|
5251
5405
|
title: result.title,
|
|
@@ -5261,10 +5415,10 @@ var SearchResults = ({ results, emptyMessage, onSelect }) => {
|
|
|
5261
5415
|
};
|
|
5262
5416
|
var ErrorResult = ({ onRetrySearch }) => {
|
|
5263
5417
|
const intl = (0, import_react_intl19.useIntl)();
|
|
5264
|
-
return /* @__PURE__ */ (0,
|
|
5418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("p", { className: "m-t-2", children: [
|
|
5265
5419
|
intl.formatMessage(ErrorBoundary_messages_default.errorAlert),
|
|
5266
5420
|
"\xA0",
|
|
5267
|
-
/* @__PURE__ */ (0,
|
|
5421
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5268
5422
|
"a",
|
|
5269
5423
|
{
|
|
5270
5424
|
href: "/",
|
|
@@ -5279,15 +5433,15 @@ var ErrorResult = ({ onRetrySearch }) => {
|
|
|
5279
5433
|
};
|
|
5280
5434
|
|
|
5281
5435
|
// src/layout/search/useSearch.tsx
|
|
5282
|
-
var
|
|
5436
|
+
var import_react27 = require("react");
|
|
5283
5437
|
var headers = { "Content-Type": "application/json" };
|
|
5284
5438
|
var useSearch = (defaultSearchConfig) => {
|
|
5285
|
-
const [state, setState] = (0,
|
|
5439
|
+
const [state, setState] = (0, import_react27.useState)({
|
|
5286
5440
|
status: "idle"
|
|
5287
5441
|
});
|
|
5288
|
-
const abortControllerRef = (0,
|
|
5442
|
+
const abortControllerRef = (0, import_react27.useRef)(null);
|
|
5289
5443
|
const httpClient = useHttpClient();
|
|
5290
|
-
const search = (0,
|
|
5444
|
+
const search = (0, import_react27.useCallback)(
|
|
5291
5445
|
async (query, { url, method, param } = defaultSearchConfig) => {
|
|
5292
5446
|
abortControllerRef.current?.abort();
|
|
5293
5447
|
if (!query) {
|
|
@@ -5349,14 +5503,14 @@ var addQueryParameter = (url, key, value) => {
|
|
|
5349
5503
|
};
|
|
5350
5504
|
|
|
5351
5505
|
// src/layout/search/DynamicSearch.tsx
|
|
5352
|
-
var
|
|
5506
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
5353
5507
|
var DEBOUNCE_TIME = 400;
|
|
5354
5508
|
var DynamicSearch = ({ component, onAction }) => {
|
|
5355
|
-
const [query, setQuery] = (0,
|
|
5509
|
+
const [query, setQuery] = (0, import_react28.useState)("");
|
|
5356
5510
|
const { title, margin, url, method, param, emptyMessage } = component;
|
|
5357
5511
|
const { status, results, search } = useSearch({ url, method, param });
|
|
5358
5512
|
const onEvent = useEventDispatcher();
|
|
5359
|
-
const debouncedSearch = (0,
|
|
5513
|
+
const debouncedSearch = (0, import_react28.useMemo)(() => debounce(search, DEBOUNCE_TIME), [search]);
|
|
5360
5514
|
const onSearchStart = () => {
|
|
5361
5515
|
onEvent("Dynamic Flow - Search Started", {});
|
|
5362
5516
|
};
|
|
@@ -5383,17 +5537,17 @@ var DynamicSearch = ({ component, onAction }) => {
|
|
|
5383
5537
|
setQuery(query);
|
|
5384
5538
|
void search(query);
|
|
5385
5539
|
};
|
|
5386
|
-
return /* @__PURE__ */ (0,
|
|
5387
|
-
/* @__PURE__ */ (0,
|
|
5388
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
5389
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
5390
|
-
status === "success" && /* @__PURE__ */ (0,
|
|
5540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: getMargin(margin), children: [
|
|
5541
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SearchInput, { title, value: query, onChange, onFocus: onSearchStart }),
|
|
5542
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DynamicLoadingIndicator_default, { component: { type: "loading-indicator", size: "sm" } }),
|
|
5543
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ErrorResult, { onRetrySearch }),
|
|
5544
|
+
status === "success" && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SearchResults, { results, emptyMessage, onSelect: onResultSelected })
|
|
5391
5545
|
] });
|
|
5392
5546
|
};
|
|
5393
5547
|
var DynamicSearch_default = DynamicSearch;
|
|
5394
5548
|
|
|
5395
5549
|
// src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
5396
|
-
var
|
|
5550
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
5397
5551
|
var isNullish = (value) => isNull(value) || isUndefined(value);
|
|
5398
5552
|
var getDefaultValue = (schema) => {
|
|
5399
5553
|
return schema.type === "boolean" && isNullish(schema.default) ? false : schema.default;
|
|
@@ -5429,13 +5583,13 @@ var BasicTypeSchema = (props) => {
|
|
|
5429
5583
|
props.onBlur();
|
|
5430
5584
|
}
|
|
5431
5585
|
};
|
|
5432
|
-
const [model, setModel] = (0,
|
|
5433
|
-
const [lastModel, setLastModel] = (0,
|
|
5434
|
-
const [changed, setChanged] = (0,
|
|
5435
|
-
const [focused, setFocused] = (0,
|
|
5436
|
-
const [blurred, setBlurred] = (0,
|
|
5437
|
-
const [validations, setValidations] = (0,
|
|
5438
|
-
const id = (0,
|
|
5586
|
+
const [model, setModel] = (0, import_react29.useState)(props.model ?? null);
|
|
5587
|
+
const [lastModel, setLastModel] = (0, import_react29.useState)(props.model ?? null);
|
|
5588
|
+
const [changed, setChanged] = (0, import_react29.useState)(false);
|
|
5589
|
+
const [focused, setFocused] = (0, import_react29.useState)(false);
|
|
5590
|
+
const [blurred, setBlurred] = (0, import_react29.useState)(false);
|
|
5591
|
+
const [validations, setValidations] = (0, import_react29.useState)([]);
|
|
5592
|
+
const id = (0, import_react29.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
5439
5593
|
const onSchemaChange = () => {
|
|
5440
5594
|
const defaultValue = getDefaultValue(props.schema);
|
|
5441
5595
|
if (isNullish(model) && !isNullish(defaultValue)) {
|
|
@@ -5450,9 +5604,9 @@ var BasicTypeSchema = (props) => {
|
|
|
5450
5604
|
};
|
|
5451
5605
|
const isConst = props.schema.const;
|
|
5452
5606
|
const isHidden = props.schema.hidden || isConst;
|
|
5453
|
-
(0,
|
|
5454
|
-
(0,
|
|
5455
|
-
(0,
|
|
5607
|
+
(0, import_react29.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
5608
|
+
(0, import_react29.useEffect)(onSchemaChange, [props.schema]);
|
|
5609
|
+
(0, import_react29.useEffect)(() => {
|
|
5456
5610
|
const newModel = props.model ?? null;
|
|
5457
5611
|
if (newModel !== model) {
|
|
5458
5612
|
setModel(newModel);
|
|
@@ -5466,15 +5620,15 @@ var BasicTypeSchema = (props) => {
|
|
|
5466
5620
|
const showLabel = props.schema.format !== "file" && props.schema.type !== "boolean";
|
|
5467
5621
|
const schemaHelp = props.schema.help;
|
|
5468
5622
|
const feedbackId = `${id}-feedback`;
|
|
5469
|
-
return !isHidden ? /* @__PURE__ */ (0,
|
|
5470
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
5471
|
-
/* @__PURE__ */ (0,
|
|
5472
|
-
showLabel && /* @__PURE__ */ (0,
|
|
5473
|
-
/* @__PURE__ */ (0,
|
|
5474
|
-
!!schemaHelp && /* @__PURE__ */ (0,
|
|
5623
|
+
return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
5624
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
5625
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: (0, import_classnames6.default)(formGroupClasses), children: [
|
|
5626
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "d-inline-block", children: [
|
|
5627
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
|
|
5628
|
+
!!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Help_default, { help: schemaHelp })
|
|
5475
5629
|
] }),
|
|
5476
|
-
!showLabel && !!schemaHelp && /* @__PURE__ */ (0,
|
|
5477
|
-
/* @__PURE__ */ (0,
|
|
5630
|
+
!showLabel && !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Help_default, { help: schemaHelp }),
|
|
5631
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5478
5632
|
SchemaFormControl_default,
|
|
5479
5633
|
{
|
|
5480
5634
|
id,
|
|
@@ -5487,7 +5641,7 @@ var BasicTypeSchema = (props) => {
|
|
|
5487
5641
|
describedBy: feedbackId
|
|
5488
5642
|
}
|
|
5489
5643
|
),
|
|
5490
|
-
/* @__PURE__ */ (0,
|
|
5644
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5491
5645
|
ControlFeedback_default,
|
|
5492
5646
|
{
|
|
5493
5647
|
id: feedbackId,
|
|
@@ -5512,7 +5666,7 @@ BasicTypeSchema.defaultProps = {
|
|
|
5512
5666
|
var BasicTypeSchema_default = BasicTypeSchema;
|
|
5513
5667
|
|
|
5514
5668
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
5515
|
-
var
|
|
5669
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
5516
5670
|
var getIdFromResponse = (idProperty, response) => {
|
|
5517
5671
|
return response[idProperty];
|
|
5518
5672
|
};
|
|
@@ -5531,12 +5685,12 @@ var PersistAsyncBasicSchema = (props) => {
|
|
|
5531
5685
|
const intl = (0, import_react_intl20.useIntl)();
|
|
5532
5686
|
const httpClient = useHttpClient();
|
|
5533
5687
|
const onEvent = useEventDispatcher();
|
|
5534
|
-
const [persistAsyncModel, setPersistAsyncModel] = (0,
|
|
5688
|
+
const [persistAsyncModel, setPersistAsyncModel] = (0, import_react30.useState)(null);
|
|
5535
5689
|
const previousPersistAsyncModel = usePrevious(persistAsyncModel);
|
|
5536
|
-
const [persistAsyncError, setPersistAsyncError] = (0,
|
|
5537
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
5538
|
-
const [abortController, setAbortController] = (0,
|
|
5539
|
-
(0,
|
|
5690
|
+
const [persistAsyncError, setPersistAsyncError] = (0, import_react30.useState)(null);
|
|
5691
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react30.useState)(false);
|
|
5692
|
+
const [abortController, setAbortController] = (0, import_react30.useState)(null);
|
|
5693
|
+
(0, import_react30.useEffect)(() => {
|
|
5540
5694
|
if (controlTypesWithPersistOnChange.has(
|
|
5541
5695
|
// TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
|
|
5542
5696
|
getControlType(schema.persistAsync.schema)
|
|
@@ -5603,7 +5757,7 @@ var PersistAsyncBasicSchema = (props) => {
|
|
|
5603
5757
|
setPersistAsyncModel(newPersistAsyncModel);
|
|
5604
5758
|
}
|
|
5605
5759
|
};
|
|
5606
|
-
return /* @__PURE__ */ (0,
|
|
5760
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
5607
5761
|
BasicTypeSchema_default,
|
|
5608
5762
|
{
|
|
5609
5763
|
required,
|
|
@@ -5624,7 +5778,7 @@ var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
|
|
|
5624
5778
|
|
|
5625
5779
|
// src/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
5626
5780
|
var usePersistAsync = (persistAsync) => {
|
|
5627
|
-
const [abortController, setAbortController] = (0,
|
|
5781
|
+
const [abortController, setAbortController] = (0, import_react31.useState)(null);
|
|
5628
5782
|
const httpClient = useHttpClient();
|
|
5629
5783
|
const intl = (0, import_react_intl21.useIntl)();
|
|
5630
5784
|
const { schema } = persistAsync;
|
|
@@ -5705,7 +5859,7 @@ function hasStringMessage(value) {
|
|
|
5705
5859
|
}
|
|
5706
5860
|
|
|
5707
5861
|
// src/common/hooks/usePolling/usePolling.tsx
|
|
5708
|
-
var
|
|
5862
|
+
var import_react32 = require("react");
|
|
5709
5863
|
function usePolling({
|
|
5710
5864
|
asyncFn,
|
|
5711
5865
|
interval,
|
|
@@ -5714,9 +5868,9 @@ function usePolling({
|
|
|
5714
5868
|
onPollingResponse,
|
|
5715
5869
|
onFailure
|
|
5716
5870
|
}) {
|
|
5717
|
-
const onPollingResponseReference = (0,
|
|
5718
|
-
const onFailureReference = (0,
|
|
5719
|
-
const poll = (0,
|
|
5871
|
+
const onPollingResponseReference = (0, import_react32.useRef)(onPollingResponse);
|
|
5872
|
+
const onFailureReference = (0, import_react32.useRef)(onFailure);
|
|
5873
|
+
const poll = (0, import_react32.useMemo)(
|
|
5720
5874
|
() => createPollingClosure(
|
|
5721
5875
|
asyncFn,
|
|
5722
5876
|
maxAttempts,
|
|
@@ -5726,7 +5880,7 @@ function usePolling({
|
|
|
5726
5880
|
),
|
|
5727
5881
|
[asyncFn, maxAttempts, maxConsecutiveFails]
|
|
5728
5882
|
);
|
|
5729
|
-
(0,
|
|
5883
|
+
(0, import_react32.useEffect)(() => {
|
|
5730
5884
|
if (interval > 0) {
|
|
5731
5885
|
const intervalReference = setInterval(() => {
|
|
5732
5886
|
poll();
|
|
@@ -5734,7 +5888,7 @@ function usePolling({
|
|
|
5734
5888
|
return () => clearInterval(intervalReference);
|
|
5735
5889
|
}
|
|
5736
5890
|
}, [poll, interval]);
|
|
5737
|
-
(0,
|
|
5891
|
+
(0, import_react32.useEffect)(() => {
|
|
5738
5892
|
onPollingResponseReference.current = onPollingResponse;
|
|
5739
5893
|
onFailureReference.current = onFailure;
|
|
5740
5894
|
}, [onPollingResponse, onFailure]);
|
|
@@ -5763,20 +5917,20 @@ function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, onPolli
|
|
|
5763
5917
|
}
|
|
5764
5918
|
|
|
5765
5919
|
// src/common/hooks/usePrevious/usePrevious.js
|
|
5766
|
-
var
|
|
5920
|
+
var import_react33 = require("react");
|
|
5767
5921
|
var usePrevious = (value) => {
|
|
5768
|
-
const reference = (0,
|
|
5769
|
-
(0,
|
|
5922
|
+
const reference = (0, import_react33.useRef)();
|
|
5923
|
+
(0, import_react33.useEffect)(() => {
|
|
5770
5924
|
reference.current = value;
|
|
5771
5925
|
}, [value]);
|
|
5772
5926
|
return reference.current;
|
|
5773
5927
|
};
|
|
5774
5928
|
|
|
5775
5929
|
// src/common/hooks/useStepPolling/useStepPolling.tsx
|
|
5776
|
-
var
|
|
5930
|
+
var import_react34 = require("react");
|
|
5777
5931
|
function useStepPolling(polling, onAction) {
|
|
5778
5932
|
const httpClient = useHttpClient();
|
|
5779
|
-
const asyncFn = (0,
|
|
5933
|
+
const asyncFn = (0, import_react34.useMemo)(() => {
|
|
5780
5934
|
if (polling) {
|
|
5781
5935
|
return () => {
|
|
5782
5936
|
return httpClient(polling.url).then((response) => {
|
|
@@ -5791,7 +5945,7 @@ function useStepPolling(polling, onAction) {
|
|
|
5791
5945
|
return void 0;
|
|
5792
5946
|
}
|
|
5793
5947
|
}, [polling, httpClient]);
|
|
5794
|
-
const onPollingResponse = (0,
|
|
5948
|
+
const onPollingResponse = (0, import_react34.useCallback)(
|
|
5795
5949
|
(pollingResponse) => {
|
|
5796
5950
|
if (pollingResponse?.action) {
|
|
5797
5951
|
onAction(pollingResponse.action);
|
|
@@ -5807,7 +5961,7 @@ function useStepPolling(polling, onAction) {
|
|
|
5807
5961
|
maxAttempts: polling?.maxAttempts || 0,
|
|
5808
5962
|
maxConsecutiveFails: 1,
|
|
5809
5963
|
onPollingResponse,
|
|
5810
|
-
onFailure: (0,
|
|
5964
|
+
onFailure: (0, import_react34.useCallback)(() => {
|
|
5811
5965
|
if (polling) {
|
|
5812
5966
|
onAction(polling.onError.action);
|
|
5813
5967
|
}
|
|
@@ -5816,7 +5970,7 @@ function useStepPolling(polling, onAction) {
|
|
|
5816
5970
|
}
|
|
5817
5971
|
|
|
5818
5972
|
// src/step/layoutStep/LayoutStep.tsx
|
|
5819
|
-
var
|
|
5973
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
5820
5974
|
var getComponents = (step, options) => {
|
|
5821
5975
|
if (isEmpty(step)) {
|
|
5822
5976
|
return [];
|
|
@@ -5838,7 +5992,7 @@ var LayoutStep = (props) => {
|
|
|
5838
5992
|
onEvent("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
|
|
5839
5993
|
};
|
|
5840
5994
|
useStepPolling(stepSpecification.polling, onAction);
|
|
5841
|
-
return /* @__PURE__ */ (0,
|
|
5995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5842
5996
|
DynamicLayout_default,
|
|
5843
5997
|
{
|
|
5844
5998
|
components,
|
|
@@ -5854,10 +6008,10 @@ var LayoutStep = (props) => {
|
|
|
5854
6008
|
var LayoutStep_default = LayoutStep;
|
|
5855
6009
|
|
|
5856
6010
|
// src/step/cameraStep/CameraStep.tsx
|
|
5857
|
-
var
|
|
6011
|
+
var import_react38 = require("react");
|
|
5858
6012
|
|
|
5859
6013
|
// src/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
5860
|
-
var
|
|
6014
|
+
var import_react37 = require("react");
|
|
5861
6015
|
var import_react_intl28 = require("react-intl");
|
|
5862
6016
|
var import_react_webcam = __toESM(require_react_webcam());
|
|
5863
6017
|
|
|
@@ -5884,15 +6038,15 @@ var CameraCapture_messages_default = (0, import_react_intl22.defineMessages)({
|
|
|
5884
6038
|
// src/step/cameraStep/cameraCapture/components/index.tsx
|
|
5885
6039
|
var import_components27 = require("@transferwise/components");
|
|
5886
6040
|
var import_react_intl23 = require("react-intl");
|
|
5887
|
-
var
|
|
5888
|
-
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0,
|
|
6041
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
6042
|
+
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(CaptureButton, { onClick: onCapture }) });
|
|
5889
6043
|
var ReviewBottomBar = ({
|
|
5890
6044
|
onSubmit,
|
|
5891
6045
|
onRetry
|
|
5892
6046
|
}) => {
|
|
5893
6047
|
const intl = (0, import_react_intl23.useIntl)();
|
|
5894
|
-
return /* @__PURE__ */ (0,
|
|
5895
|
-
/* @__PURE__ */ (0,
|
|
6048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
|
|
6049
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5896
6050
|
import_components27.Button,
|
|
5897
6051
|
{
|
|
5898
6052
|
className: "m-b-1",
|
|
@@ -5903,7 +6057,7 @@ var ReviewBottomBar = ({
|
|
|
5903
6057
|
children: intl.formatMessage(CameraCapture_messages_default.reviewSubmit)
|
|
5904
6058
|
}
|
|
5905
6059
|
),
|
|
5906
|
-
/* @__PURE__ */ (0,
|
|
6060
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5907
6061
|
import_components27.Button,
|
|
5908
6062
|
{
|
|
5909
6063
|
className: "m-b-2",
|
|
@@ -5917,19 +6071,19 @@ var ReviewBottomBar = ({
|
|
|
5917
6071
|
)
|
|
5918
6072
|
] }) }) });
|
|
5919
6073
|
};
|
|
5920
|
-
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
6074
|
+
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
5921
6075
|
"button",
|
|
5922
6076
|
{
|
|
5923
6077
|
type: "button",
|
|
5924
6078
|
className: "camera-capture-btn m-b-2",
|
|
5925
6079
|
"data-testid": "camera-capture-button",
|
|
5926
6080
|
onClick,
|
|
5927
|
-
children: /* @__PURE__ */ (0,
|
|
6081
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "camera-capture-btn-inner" })
|
|
5928
6082
|
}
|
|
5929
6083
|
);
|
|
5930
6084
|
|
|
5931
6085
|
// src/step/cameraStep/cameraCapture/hooks/index.ts
|
|
5932
|
-
var
|
|
6086
|
+
var import_react35 = require("react");
|
|
5933
6087
|
|
|
5934
6088
|
// src/step/cameraStep/cameraCapture/utils/index.ts
|
|
5935
6089
|
var isSelfieCamera = (stream) => {
|
|
@@ -5963,7 +6117,7 @@ var getVideoCapabilities = (videoStream) => getVideoTrack(videoStream)?.getCapab
|
|
|
5963
6117
|
|
|
5964
6118
|
// src/step/cameraStep/cameraCapture/hooks/index.ts
|
|
5965
6119
|
var useVideoConstraints = (direction) => {
|
|
5966
|
-
const [videoConstraints, setVideoConstraints] = (0,
|
|
6120
|
+
const [videoConstraints, setVideoConstraints] = (0, import_react35.useState)();
|
|
5967
6121
|
const defaultVideoConstraints = {
|
|
5968
6122
|
facingMode: direction === "front" ? "user" : "environment",
|
|
5969
6123
|
height: { min: 480, max: 1080, ideal: 720 },
|
|
@@ -5971,7 +6125,7 @@ var useVideoConstraints = (direction) => {
|
|
|
5971
6125
|
frameRate: 30,
|
|
5972
6126
|
aspectRatio: 16 / 9
|
|
5973
6127
|
};
|
|
5974
|
-
(0,
|
|
6128
|
+
(0, import_react35.useEffect)(() => {
|
|
5975
6129
|
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
5976
6130
|
}, [direction]);
|
|
5977
6131
|
const getVideoConstraints = async (direction2) => {
|
|
@@ -5990,8 +6144,8 @@ var useVideoConstraints = (direction) => {
|
|
|
5990
6144
|
};
|
|
5991
6145
|
|
|
5992
6146
|
// src/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
5993
|
-
var
|
|
5994
|
-
var
|
|
6147
|
+
var import_react36 = require("react");
|
|
6148
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
5995
6149
|
var captureButtonHeight = 92;
|
|
5996
6150
|
var reviewButtonsHeight = 120;
|
|
5997
6151
|
var imageHeight = 40;
|
|
@@ -6007,8 +6161,8 @@ var Overlay = ({
|
|
|
6007
6161
|
instructions,
|
|
6008
6162
|
reviewInstructions
|
|
6009
6163
|
}) => {
|
|
6010
|
-
const svgReference = (0,
|
|
6011
|
-
(0,
|
|
6164
|
+
const svgReference = (0, import_react36.useRef)(null);
|
|
6165
|
+
(0, import_react36.useEffect)(() => {
|
|
6012
6166
|
const listener = debounce(() => {
|
|
6013
6167
|
if (svgReference.current?.innerHTML) {
|
|
6014
6168
|
const reference = svgReference.current;
|
|
@@ -6019,18 +6173,18 @@ var Overlay = ({
|
|
|
6019
6173
|
return () => window.removeEventListener("resize", listener);
|
|
6020
6174
|
});
|
|
6021
6175
|
let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
|
|
6022
|
-
let helperBox = /* @__PURE__ */ (0,
|
|
6023
|
-
imageUrl && /* @__PURE__ */ (0,
|
|
6024
|
-
title && /* @__PURE__ */ (0,
|
|
6025
|
-
instructions && /* @__PURE__ */ (0,
|
|
6176
|
+
let helperBox = /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
6177
|
+
imageUrl && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
|
|
6178
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h4", { className: "camera-capture-title", children: title }),
|
|
6179
|
+
instructions && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("small", { className: "camera-capture-instructions", children: instructions })
|
|
6026
6180
|
] });
|
|
6027
6181
|
const frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
6028
6182
|
if (reviewInstructions) {
|
|
6029
6183
|
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
6030
|
-
helperBox = /* @__PURE__ */ (0,
|
|
6184
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
|
|
6031
6185
|
const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
6032
6186
|
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
6033
|
-
helperBox = /* @__PURE__ */ (0,
|
|
6187
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_jsx_runtime60.Fragment, {});
|
|
6034
6188
|
}
|
|
6035
6189
|
}
|
|
6036
6190
|
const framePosition = {
|
|
@@ -6048,14 +6202,14 @@ var Overlay = ({
|
|
|
6048
6202
|
width: "90%"
|
|
6049
6203
|
}
|
|
6050
6204
|
};
|
|
6051
|
-
return /* @__PURE__ */ (0,
|
|
6052
|
-
/* @__PURE__ */ (0,
|
|
6053
|
-
/* @__PURE__ */ (0,
|
|
6054
|
-
/* @__PURE__ */ (0,
|
|
6205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
6206
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("mask", { id: "mask", children: [
|
|
6207
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
|
|
6208
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("image", { href: overlay, ...framePosition })
|
|
6055
6209
|
] }) }),
|
|
6056
|
-
overlay && /* @__PURE__ */ (0,
|
|
6057
|
-
outline && /* @__PURE__ */ (0,
|
|
6058
|
-
/* @__PURE__ */ (0,
|
|
6210
|
+
overlay && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
|
|
6211
|
+
outline && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("image", { href: outline, ...framePosition }),
|
|
6212
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "camera-capture-text-and-image-container", ...helperBoxPosition, children: helperBox }) })
|
|
6059
6213
|
] });
|
|
6060
6214
|
};
|
|
6061
6215
|
var Overlay_default = Overlay;
|
|
@@ -6085,13 +6239,13 @@ var NoCameraAccess_messages_default = (0, import_react_intl24.defineMessages)({
|
|
|
6085
6239
|
});
|
|
6086
6240
|
|
|
6087
6241
|
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
|
|
6088
|
-
var
|
|
6242
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
6089
6243
|
var NoCameraAccess = ({ onAction }) => {
|
|
6090
6244
|
const intl = (0, import_react_intl25.useIntl)();
|
|
6091
|
-
return /* @__PURE__ */ (0,
|
|
6092
|
-
/* @__PURE__ */ (0,
|
|
6093
|
-
/* @__PURE__ */ (0,
|
|
6094
|
-
/* @__PURE__ */ (0,
|
|
6245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { id: "no-camera-access", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
6246
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(NoCameraAccess_messages_default.title) }),
|
|
6247
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(NoCameraAccess_messages_default.paragraph) }),
|
|
6248
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_components28.Button, { block: true, onClick: onAction, children: intl.formatMessage(NoCameraAccess_messages_default.action) })
|
|
6095
6249
|
] }) }) }) });
|
|
6096
6250
|
};
|
|
6097
6251
|
var NoCameraAccess_default = NoCameraAccess;
|
|
@@ -6115,12 +6269,12 @@ var CameraNotSupported_messages_default = (0, import_react_intl26.defineMessages
|
|
|
6115
6269
|
});
|
|
6116
6270
|
|
|
6117
6271
|
// src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
|
|
6118
|
-
var
|
|
6272
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
6119
6273
|
var CameraNotSupported = () => {
|
|
6120
6274
|
const intl = (0, import_react_intl27.useIntl)();
|
|
6121
|
-
return /* @__PURE__ */ (0,
|
|
6122
|
-
/* @__PURE__ */ (0,
|
|
6123
|
-
/* @__PURE__ */ (0,
|
|
6275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { id: "camera-not-supported", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
6276
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(CameraNotSupported_messages_default.title) }),
|
|
6277
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(CameraNotSupported_messages_default.paragraph) })
|
|
6124
6278
|
] }) }) }) });
|
|
6125
6279
|
};
|
|
6126
6280
|
var CameraNotSupported_default = CameraNotSupported;
|
|
@@ -6145,7 +6299,7 @@ var getCameraStartedProperties = async (props, videoStream) => {
|
|
|
6145
6299
|
};
|
|
6146
6300
|
|
|
6147
6301
|
// src/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
6148
|
-
var
|
|
6302
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
6149
6303
|
var CameraCapture = ({
|
|
6150
6304
|
direction = "back",
|
|
6151
6305
|
overlay = "",
|
|
@@ -6157,14 +6311,14 @@ var CameraCapture = ({
|
|
|
6157
6311
|
onCapture,
|
|
6158
6312
|
onEvent
|
|
6159
6313
|
}) => {
|
|
6160
|
-
const [mode, setMode] = (0,
|
|
6161
|
-
const [isVideoMirrored, setIsVideoMirrored] = (0,
|
|
6162
|
-
const [ready, setReady] = (0,
|
|
6163
|
-
const [reviewImage, setReviewImage] = (0,
|
|
6164
|
-
const webcamReference = (0,
|
|
6314
|
+
const [mode, setMode] = (0, import_react37.useState)("CAPTURE");
|
|
6315
|
+
const [isVideoMirrored, setIsVideoMirrored] = (0, import_react37.useState)(false);
|
|
6316
|
+
const [ready, setReady] = (0, import_react37.useState)(false);
|
|
6317
|
+
const [reviewImage, setReviewImage] = (0, import_react37.useState)();
|
|
6318
|
+
const webcamReference = (0, import_react37.useRef)(null);
|
|
6165
6319
|
const { videoConstraints } = useVideoConstraints(direction);
|
|
6166
6320
|
const intl = (0, import_react_intl28.useIntl)();
|
|
6167
|
-
const handleCapture = (0,
|
|
6321
|
+
const handleCapture = (0, import_react37.useCallback)(async () => {
|
|
6168
6322
|
if (webcamReference?.current?.video && webcamReference?.current?.video?.readyState >= 3) {
|
|
6169
6323
|
webcamReference?.current?.video?.pause();
|
|
6170
6324
|
const canvas = await generateCanvasFromVideo(webcamReference?.current?.video);
|
|
@@ -6185,7 +6339,7 @@ var CameraCapture = ({
|
|
|
6185
6339
|
);
|
|
6186
6340
|
}
|
|
6187
6341
|
}, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
|
|
6188
|
-
const handleUserMediaError = (0,
|
|
6342
|
+
const handleUserMediaError = (0, import_react37.useCallback)(
|
|
6189
6343
|
(error) => {
|
|
6190
6344
|
if (error instanceof DOMException && error?.name === "NotAllowedError") {
|
|
6191
6345
|
setMode("NO_CAMERA_ACCESS");
|
|
@@ -6197,7 +6351,7 @@ var CameraCapture = ({
|
|
|
6197
6351
|
},
|
|
6198
6352
|
[setMode, onEvent]
|
|
6199
6353
|
);
|
|
6200
|
-
const handleUserMedia = (0,
|
|
6354
|
+
const handleUserMedia = (0, import_react37.useCallback)(
|
|
6201
6355
|
(stream) => {
|
|
6202
6356
|
setReady(true);
|
|
6203
6357
|
setIsVideoMirrored(isSelfieCamera(stream));
|
|
@@ -6213,8 +6367,8 @@ var CameraCapture = ({
|
|
|
6213
6367
|
setReviewImage(void 0);
|
|
6214
6368
|
};
|
|
6215
6369
|
const handleRetryCameraAccess = () => setMode("CAPTURE");
|
|
6216
|
-
const captureScreen = /* @__PURE__ */ (0,
|
|
6217
|
-
videoConstraints && /* @__PURE__ */ (0,
|
|
6370
|
+
const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
6371
|
+
videoConstraints && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
6218
6372
|
import_react_webcam.default,
|
|
6219
6373
|
{
|
|
6220
6374
|
ref: webcamReference,
|
|
@@ -6225,7 +6379,7 @@ var CameraCapture = ({
|
|
|
6225
6379
|
onUserMedia: handleUserMedia
|
|
6226
6380
|
}
|
|
6227
6381
|
),
|
|
6228
|
-
/* @__PURE__ */ (0,
|
|
6382
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
6229
6383
|
Overlay_default,
|
|
6230
6384
|
{
|
|
6231
6385
|
overlay,
|
|
@@ -6235,11 +6389,11 @@ var CameraCapture = ({
|
|
|
6235
6389
|
instructions
|
|
6236
6390
|
}
|
|
6237
6391
|
),
|
|
6238
|
-
ready && /* @__PURE__ */ (0,
|
|
6392
|
+
ready && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(CaptureBottomBar, { onCapture: () => void handleCapture() })
|
|
6239
6393
|
] });
|
|
6240
|
-
const reviewScreen = /* @__PURE__ */ (0,
|
|
6241
|
-
/* @__PURE__ */ (0,
|
|
6242
|
-
/* @__PURE__ */ (0,
|
|
6394
|
+
const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
6395
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("img", { className: "review-image", src: reviewImage?.source, alt: "" }),
|
|
6396
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
6243
6397
|
Overlay_default,
|
|
6244
6398
|
{
|
|
6245
6399
|
overlay,
|
|
@@ -6249,19 +6403,19 @@ var CameraCapture = ({
|
|
|
6249
6403
|
reviewInstructions: intl.formatMessage(CameraCapture_messages_default.reviewInstructions)
|
|
6250
6404
|
}
|
|
6251
6405
|
),
|
|
6252
|
-
/* @__PURE__ */ (0,
|
|
6406
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
|
|
6253
6407
|
] });
|
|
6254
|
-
return /* @__PURE__ */ (0,
|
|
6408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("section", { className: "camera-capture", children: [
|
|
6255
6409
|
mode === "CAPTURE" && captureScreen,
|
|
6256
6410
|
mode === "REVIEW" && reviewScreen,
|
|
6257
|
-
mode === "NO_CAMERA_ACCESS" && /* @__PURE__ */ (0,
|
|
6258
|
-
mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0,
|
|
6411
|
+
mode === "NO_CAMERA_ACCESS" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(NoCameraAccess_default, { onAction: handleRetryCameraAccess }),
|
|
6412
|
+
mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(CameraNotSupported_default, {})
|
|
6259
6413
|
] });
|
|
6260
6414
|
};
|
|
6261
6415
|
var CameraCapture_default = CameraCapture;
|
|
6262
6416
|
|
|
6263
6417
|
// src/step/cameraStep/CameraStep.tsx
|
|
6264
|
-
var
|
|
6418
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
6265
6419
|
function blobToBase64(blob) {
|
|
6266
6420
|
return new Promise((resolve, _) => {
|
|
6267
6421
|
const reader = new FileReader();
|
|
@@ -6279,8 +6433,8 @@ var CameraStep = (props) => {
|
|
|
6279
6433
|
const { assets, direction, instructions } = cameraConfig || {};
|
|
6280
6434
|
const { overlay, outline } = assets || {};
|
|
6281
6435
|
const { url: imageUrl } = image || {};
|
|
6282
|
-
const [captureClicked, setCaptureClicked] = (0,
|
|
6283
|
-
(0,
|
|
6436
|
+
const [captureClicked, setCaptureClicked] = (0, import_react38.useState)(false);
|
|
6437
|
+
(0, import_react38.useEffect)(() => {
|
|
6284
6438
|
if (captureClicked) {
|
|
6285
6439
|
onAction(action);
|
|
6286
6440
|
}
|
|
@@ -6299,7 +6453,7 @@ var CameraStep = (props) => {
|
|
|
6299
6453
|
});
|
|
6300
6454
|
}
|
|
6301
6455
|
};
|
|
6302
|
-
return /* @__PURE__ */ (0,
|
|
6456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6303
6457
|
CameraCapture_default,
|
|
6304
6458
|
{
|
|
6305
6459
|
overlay,
|
|
@@ -6375,12 +6529,12 @@ var ExternalConfirmationStep_messages_default = (0, import_react_intl29.defineMe
|
|
|
6375
6529
|
});
|
|
6376
6530
|
|
|
6377
6531
|
// src/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6378
|
-
var
|
|
6532
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
6379
6533
|
var noop5 = () => {
|
|
6380
6534
|
};
|
|
6381
6535
|
var ExternalConfirmationStep = ({ url, onClose }) => {
|
|
6382
6536
|
const { formatMessage } = (0, import_react_intl30.useIntl)();
|
|
6383
|
-
return /* @__PURE__ */ (0,
|
|
6537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
6384
6538
|
DynamicLayout_default,
|
|
6385
6539
|
{
|
|
6386
6540
|
components: [
|
|
@@ -6447,9 +6601,9 @@ function getOrigin(url) {
|
|
|
6447
6601
|
// src/dynamicFlow/BackButton.tsx
|
|
6448
6602
|
var import_components30 = require("@transferwise/components");
|
|
6449
6603
|
var import_icons2 = require("@transferwise/icons");
|
|
6450
|
-
var
|
|
6604
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
6451
6605
|
var BackButton = ({ title, action, onAction }) => {
|
|
6452
|
-
return /* @__PURE__ */ (0,
|
|
6606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
6453
6607
|
"a",
|
|
6454
6608
|
{
|
|
6455
6609
|
onClick: (event) => {
|
|
@@ -6460,8 +6614,8 @@ var BackButton = ({ title, action, onAction }) => {
|
|
|
6460
6614
|
className: "df-back-btn",
|
|
6461
6615
|
"aria-label": title,
|
|
6462
6616
|
children: [
|
|
6463
|
-
/* @__PURE__ */ (0,
|
|
6464
|
-
/* @__PURE__ */ (0,
|
|
6617
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "sr-only", children: title }),
|
|
6618
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_components30.Avatar, { type: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_icons2.ArrowLeft, { size: "24" }) })
|
|
6465
6619
|
]
|
|
6466
6620
|
}
|
|
6467
6621
|
);
|
|
@@ -6469,7 +6623,7 @@ var BackButton = ({ title, action, onAction }) => {
|
|
|
6469
6623
|
var BackButton_default = BackButton;
|
|
6470
6624
|
|
|
6471
6625
|
// src/dynamicFlow/DynamicFlowStep.tsx
|
|
6472
|
-
var
|
|
6626
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
6473
6627
|
var DynamicFlowStep = (props) => {
|
|
6474
6628
|
const { step, globalError, onAction } = props;
|
|
6475
6629
|
const externalUrl = step?.external?.url;
|
|
@@ -6479,23 +6633,23 @@ var DynamicFlowStep = (props) => {
|
|
|
6479
6633
|
return null;
|
|
6480
6634
|
}
|
|
6481
6635
|
if (externalUrl && requiresManualTrigger) {
|
|
6482
|
-
return /* @__PURE__ */ (0,
|
|
6636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
|
|
6483
6637
|
}
|
|
6484
6638
|
if (isCameraStep(step)) {
|
|
6485
|
-
return /* @__PURE__ */ (0,
|
|
6639
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(CameraStep_default, { ...props, step });
|
|
6486
6640
|
}
|
|
6487
|
-
return /* @__PURE__ */ (0,
|
|
6488
|
-
backButton && /* @__PURE__ */ (0,
|
|
6489
|
-
globalError ? /* @__PURE__ */ (0,
|
|
6490
|
-
/* @__PURE__ */ (0,
|
|
6641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
|
|
6642
|
+
backButton && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(BackButton_default, { ...backButton, onAction }),
|
|
6643
|
+
globalError ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
|
|
6644
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(LayoutStep_default, { ...props, stepSpecification: step })
|
|
6491
6645
|
] });
|
|
6492
6646
|
};
|
|
6493
6647
|
|
|
6494
6648
|
// src/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.ts
|
|
6495
|
-
var
|
|
6649
|
+
var import_react39 = require("react");
|
|
6496
6650
|
var DEBOUNCE_DELAY = 1e3;
|
|
6497
6651
|
function useDebouncedRefresh(fetchRefresh) {
|
|
6498
|
-
const map = (0,
|
|
6652
|
+
const map = (0, import_react39.useRef)(/* @__PURE__ */ new Map());
|
|
6499
6653
|
const retrieveOrCreate = (key) => {
|
|
6500
6654
|
if (map.current.has(key)) {
|
|
6501
6655
|
return map.current.get(key);
|
|
@@ -6518,11 +6672,11 @@ function useDebouncedRefresh(fetchRefresh) {
|
|
|
6518
6672
|
var shouldDebounceSchema = (schema) => getSchemaType(schema) === "basic" && schema.type !== "boolean" && schema.format !== "base64url";
|
|
6519
6673
|
|
|
6520
6674
|
// src/dynamicFlow/utils/useDynamicFlowState.ts
|
|
6521
|
-
var
|
|
6675
|
+
var import_react40 = require("react");
|
|
6522
6676
|
var useDynamicFlowState = (initialStep) => {
|
|
6523
|
-
const [formErrors, setFormErrors] = (0,
|
|
6524
|
-
const [globalError, setGlobalError] = (0,
|
|
6525
|
-
const [stepAndModels, setStepAndModels] = (0,
|
|
6677
|
+
const [formErrors, setFormErrors] = (0, import_react40.useState)(initialStep?.errors?.validation);
|
|
6678
|
+
const [globalError, setGlobalError] = (0, import_react40.useState)(initialStep?.errors?.error);
|
|
6679
|
+
const [stepAndModels, setStepAndModels] = (0, import_react40.useState)({
|
|
6526
6680
|
step: initialStep || void 0,
|
|
6527
6681
|
models: initialStep?.model ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
|
|
6528
6682
|
etag: void 0
|
|
@@ -6552,7 +6706,7 @@ var useDynamicFlowState = (initialStep) => {
|
|
|
6552
6706
|
return updatedState;
|
|
6553
6707
|
});
|
|
6554
6708
|
};
|
|
6555
|
-
const modelIsValid = (0,
|
|
6709
|
+
const modelIsValid = (0, import_react40.useMemo)(
|
|
6556
6710
|
() => areModelsValid(models, getAllValidatableSchemas(step)),
|
|
6557
6711
|
[models, step]
|
|
6558
6712
|
);
|
|
@@ -6632,8 +6786,8 @@ var isInlineSchema = (schema) => {
|
|
|
6632
6786
|
|
|
6633
6787
|
// src/dynamicFlow/utils/useLoader.tsx
|
|
6634
6788
|
var import_components31 = require("@transferwise/components");
|
|
6635
|
-
var
|
|
6636
|
-
var
|
|
6789
|
+
var import_react41 = require("react");
|
|
6790
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
6637
6791
|
function useLoader(loaderConfig, initialState) {
|
|
6638
6792
|
const config = {
|
|
6639
6793
|
size: import_components31.Size.EXTRA_LARGE,
|
|
@@ -6641,9 +6795,9 @@ function useLoader(loaderConfig, initialState) {
|
|
|
6641
6795
|
submission: false,
|
|
6642
6796
|
...loaderConfig
|
|
6643
6797
|
};
|
|
6644
|
-
const [loadingState, setLoadingState] = (0,
|
|
6798
|
+
const [loadingState, setLoadingState] = (0, import_react41.useState)(initialState);
|
|
6645
6799
|
const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
|
|
6646
|
-
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0,
|
|
6800
|
+
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
6647
6801
|
import_components31.Loader,
|
|
6648
6802
|
{
|
|
6649
6803
|
size: config.size,
|
|
@@ -6655,15 +6809,15 @@ function useLoader(loaderConfig, initialState) {
|
|
|
6655
6809
|
}
|
|
6656
6810
|
|
|
6657
6811
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundary.tsx
|
|
6658
|
-
var
|
|
6812
|
+
var import_react42 = require("react");
|
|
6659
6813
|
|
|
6660
6814
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.tsx
|
|
6661
6815
|
var import_components32 = require("@transferwise/components");
|
|
6662
6816
|
var import_react_intl31 = require("react-intl");
|
|
6663
|
-
var
|
|
6817
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
6664
6818
|
var ErrorBoundaryAlert = ({ onDismiss }) => {
|
|
6665
6819
|
const { formatMessage } = (0, import_react_intl31.useIntl)();
|
|
6666
|
-
return /* @__PURE__ */ (0,
|
|
6820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6667
6821
|
import_components32.Alert,
|
|
6668
6822
|
{
|
|
6669
6823
|
action: {
|
|
@@ -6679,10 +6833,10 @@ var ErrorBoundaryAlert = ({ onDismiss }) => {
|
|
|
6679
6833
|
};
|
|
6680
6834
|
|
|
6681
6835
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundary.tsx
|
|
6682
|
-
var
|
|
6836
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
6683
6837
|
var noop6 = () => {
|
|
6684
6838
|
};
|
|
6685
|
-
var ErrorBoundary = class extends
|
|
6839
|
+
var ErrorBoundary = class extends import_react42.Component {
|
|
6686
6840
|
constructor(props) {
|
|
6687
6841
|
super(props);
|
|
6688
6842
|
this.handleErrorReset = () => {
|
|
@@ -6700,8 +6854,8 @@ var ErrorBoundary = class extends import_react40.Component {
|
|
|
6700
6854
|
render() {
|
|
6701
6855
|
const { children } = this.props;
|
|
6702
6856
|
const { hasError, isFatalError } = this.state;
|
|
6703
|
-
return /* @__PURE__ */ (0,
|
|
6704
|
-
hasError && /* @__PURE__ */ (0,
|
|
6857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
6858
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorBoundaryAlert, { onDismiss: this.handleErrorReset }),
|
|
6705
6859
|
!isFatalError && children
|
|
6706
6860
|
] });
|
|
6707
6861
|
}
|
|
@@ -6805,7 +6959,7 @@ var assertResponseIsValid = (response) => {
|
|
|
6805
6959
|
var isResponse = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
|
|
6806
6960
|
|
|
6807
6961
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
6808
|
-
var
|
|
6962
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
6809
6963
|
var noop7 = () => {
|
|
6810
6964
|
};
|
|
6811
6965
|
var DynamicFlowComponent = ({
|
|
@@ -6833,21 +6987,21 @@ var DynamicFlowComponent = ({
|
|
|
6833
6987
|
setStepAndEtag,
|
|
6834
6988
|
setSchemaModel
|
|
6835
6989
|
} = useDynamicFlowState(initialStep);
|
|
6836
|
-
const [submitted, setSubmitted] = (0,
|
|
6990
|
+
const [submitted, setSubmitted] = (0, import_react43.useState)(false);
|
|
6837
6991
|
const { isLoading, loader, setLoadingState } = useLoader(
|
|
6838
6992
|
loaderConfig,
|
|
6839
6993
|
initialStep ? "idle" : "initial"
|
|
6840
6994
|
);
|
|
6841
6995
|
const logCritical = getLogger("critical", onLog, flowId, step?.id || step?.key);
|
|
6842
|
-
const analyticsMetadata = (0,
|
|
6996
|
+
const analyticsMetadata = (0, import_react43.useMemo)(
|
|
6843
6997
|
() => ({ flowId, stepId: step?.id || step?.key, ...step?.analytics ?? {} }),
|
|
6844
6998
|
[flowId, step]
|
|
6845
6999
|
);
|
|
6846
|
-
const dispatchEvent = (0,
|
|
7000
|
+
const dispatchEvent = (0, import_react43.useMemo)(
|
|
6847
7001
|
() => getEventDispatcher(onEvent, analyticsMetadata),
|
|
6848
7002
|
[onEvent, analyticsMetadata]
|
|
6849
7003
|
);
|
|
6850
|
-
const dfHttpClient = (0,
|
|
7004
|
+
const dfHttpClient = (0, import_react43.useCallback)(
|
|
6851
7005
|
({ action, data, etag: etag2 }) => {
|
|
6852
7006
|
const { url, method = "POST" } = action;
|
|
6853
7007
|
return httpClient(url ?? "", {
|
|
@@ -6898,17 +7052,17 @@ var DynamicFlowComponent = ({
|
|
|
6898
7052
|
dispatchEventAndComplete({ ...exitResult, ...actionResult });
|
|
6899
7053
|
};
|
|
6900
7054
|
const debouncedRefresh = useDebouncedRefresh(performRefresh);
|
|
6901
|
-
const dispatchEventAndComplete = (0,
|
|
7055
|
+
const dispatchEventAndComplete = (0, import_react43.useCallback)(
|
|
6902
7056
|
(result) => {
|
|
6903
7057
|
dispatchEvent("Dynamic Flow - Flow Finished", { result: "success" });
|
|
6904
7058
|
onCompletion(result);
|
|
6905
7059
|
},
|
|
6906
7060
|
[onCompletion, dispatchEvent]
|
|
6907
7061
|
);
|
|
6908
|
-
(0,
|
|
7062
|
+
(0, import_react43.useEffect)(() => {
|
|
6909
7063
|
dispatchEvent("Dynamic Flow - Flow Started", {});
|
|
6910
7064
|
}, []);
|
|
6911
|
-
(0,
|
|
7065
|
+
(0, import_react43.useEffect)(() => {
|
|
6912
7066
|
if (!initialStep) {
|
|
6913
7067
|
const action = {
|
|
6914
7068
|
id: "#initial-step-request",
|
|
@@ -7025,7 +7179,7 @@ var DynamicFlowComponent = ({
|
|
|
7025
7179
|
await actionHandler(action);
|
|
7026
7180
|
}
|
|
7027
7181
|
};
|
|
7028
|
-
return /* @__PURE__ */ (0,
|
|
7182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(LogProvider, { flowId, stepId: step?.id || step?.key, onLog, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DynamicFlowProvider, { loading: isLoading, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(HttpClientProvider, { httpClient, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7029
7183
|
DynamicFlowStep,
|
|
7030
7184
|
{
|
|
7031
7185
|
step,
|
|
@@ -7041,7 +7195,7 @@ var DynamicFlowComponent = ({
|
|
|
7041
7195
|
}
|
|
7042
7196
|
) }) }) }) });
|
|
7043
7197
|
};
|
|
7044
|
-
var DynamicFlow = (props) => /* @__PURE__ */ (0,
|
|
7198
|
+
var DynamicFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DynamicFlowComponent, { ...props }) });
|
|
7045
7199
|
var DynamicFlow_default = DynamicFlow;
|
|
7046
7200
|
var combineModels2 = (formModels) => {
|
|
7047
7201
|
return Object.values(formModels).reduce((previous, model) => ({ ...previous, ...model }), {});
|