@wise/dynamic-flow-client 3.0.1 → 3.0.2

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.
Files changed (25) hide show
  1. package/build/main.js +135 -74
  2. package/build/main.min.js +1 -1
  3. package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.d.ts +2 -1
  4. package/build/types/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.d.ts +2 -0
  5. package/build/types/revamp/domain/components/BooleanInputComponent.d.ts +6 -5
  6. package/build/types/revamp/domain/components/DateInputComponent.d.ts +6 -3
  7. package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +6 -3
  8. package/build/types/revamp/domain/components/NumberInputComponent.d.ts +6 -3
  9. package/build/types/revamp/domain/components/TextInputComponent.d.ts +6 -3
  10. package/build/types/revamp/domain/features/events/getAnalyticsEventDispatcher.d.ts +3 -2
  11. package/build/types/revamp/domain/features/utils/http-utils.d.ts +18 -0
  12. package/build/types/revamp/domain/features/validation/spec-utils.d.ts +2 -16
  13. package/build/types/revamp/domain/features/validationAsync/getComponentValidationAsync.d.ts +14 -0
  14. package/build/types/revamp/domain/features/validationAsync/getInitialValidationState.d.ts +2 -0
  15. package/build/types/revamp/domain/features/validationAsync/getPerformValidationAsync.d.ts +20 -0
  16. package/build/types/revamp/domain/mappers/schema/utils/getValidationAsyncInitialState.d.ts +5 -0
  17. package/build/types/revamp/domain/mappers/types.d.ts +2 -1
  18. package/build/types/revamp/domain/types.d.ts +8 -0
  19. package/build/types/revamp/flow/executeRefresh.d.ts +5 -2
  20. package/build/types/revamp/flow/executeSubmission.d.ts +12 -3
  21. package/build/types/revamp/flow/response-utils.d.ts +1 -0
  22. package/build/types/revamp/step/Step.d.ts +4 -2
  23. package/build/types/test-utils/fetch-utils.d.ts +1 -1
  24. package/package.json +2 -2
  25. /package/build/types/revamp/domain/features/persistAsync/{persist-async-utils.d.ts → getInitialPersistedState.d.ts} +0 -0
package/build/main.js CHANGED
@@ -69,7 +69,7 @@ var require_classnames = __commonJS({
69
69
  (function() {
70
70
  "use strict";
71
71
  var hasOwn = {}.hasOwnProperty;
72
- function classNames8() {
72
+ function classNames9() {
73
73
  var classes = "";
74
74
  for (var i = 0; i < arguments.length; i++) {
75
75
  var arg = arguments[i];
@@ -87,7 +87,7 @@ var require_classnames = __commonJS({
87
87
  return "";
88
88
  }
89
89
  if (Array.isArray(arg)) {
90
- return classNames8.apply(null, arg);
90
+ return classNames9.apply(null, arg);
91
91
  }
92
92
  if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
93
93
  return arg.toString();
@@ -110,14 +110,14 @@ var require_classnames = __commonJS({
110
110
  return value + newClass;
111
111
  }
112
112
  if (typeof module2 !== "undefined" && module2.exports) {
113
- classNames8.default = classNames8;
114
- module2.exports = classNames8;
113
+ classNames9.default = classNames9;
114
+ module2.exports = classNames9;
115
115
  } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
116
116
  define("classnames", [], function() {
117
- return classNames8;
117
+ return classNames9;
118
118
  });
119
119
  } else {
120
- window.classNames = classNames8;
120
+ window.classNames = classNames9;
121
121
  }
122
122
  })();
123
123
  }
@@ -1183,7 +1183,7 @@ function isReference(block) {
1183
1183
 
1184
1184
  // src/legacy/dynamicFlow/DynamicFlow.tsx
1185
1185
  var import_react47 = require("react");
1186
- var import_react_intl29 = require("react-intl");
1186
+ var import_react_intl30 = require("react-intl");
1187
1187
 
1188
1188
  // src/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
1189
1189
  var import_react2 = require("react");
@@ -2144,7 +2144,7 @@ function useExternalStepPolling(polling, onAction) {
2144
2144
 
2145
2145
  // src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
2146
2146
  var import_react34 = require("react");
2147
- var import_react_intl20 = require("react-intl");
2147
+ var import_react_intl21 = require("react-intl");
2148
2148
 
2149
2149
  // src/common/messages/generic-error.messages.ts
2150
2150
  var import_react_intl = require("react-intl");
@@ -2168,7 +2168,7 @@ var generic_error_messages_default = (0, import_react_intl.defineMessages)({
2168
2168
 
2169
2169
  // src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
2170
2170
  var import_react33 = require("react");
2171
- var import_react_intl19 = require("react-intl");
2171
+ var import_react_intl20 = require("react-intl");
2172
2172
 
2173
2173
  // src/legacy/common/constants/DateMode.ts
2174
2174
  var DateMode = {
@@ -2215,7 +2215,7 @@ var Size = {
2215
2215
  };
2216
2216
 
2217
2217
  // src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
2218
- var import_classnames7 = __toESM(require_classnames());
2218
+ var import_classnames8 = __toESM(require_classnames());
2219
2219
  var import_react32 = require("react");
2220
2220
 
2221
2221
  // src/legacy/layout/alert/DynamicAlert.tsx
@@ -2851,11 +2851,26 @@ var import_react12 = require("react");
2851
2851
  // src/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
2852
2852
  var import_components7 = require("@transferwise/components");
2853
2853
  var import_formatting = require("@transferwise/formatting");
2854
- var import_react_intl5 = require("react-intl");
2854
+ var import_react_intl6 = require("react-intl");
2855
2855
 
2856
- // src/common/messages/validation.messages.ts
2856
+ // src/common/messages/validation.array.messages.ts
2857
2857
  var import_react_intl4 = require("react-intl");
2858
- var validation_messages_default = (0, import_react_intl4.defineMessages)({
2858
+ var validation_array_messages_default = (0, import_react_intl4.defineMessages)({
2859
+ minItemsError: {
2860
+ id: "dynamicFlows.ArraySchema.minItemsError",
2861
+ defaultMessage: "Please add at least {minItems}.",
2862
+ description: "Customer inputs less than the expected number of values"
2863
+ },
2864
+ maxItemsError: {
2865
+ id: "dynamicFlows.ArraySchema.maxItemsError",
2866
+ defaultMessage: "Please add {maxItems} or fewer.",
2867
+ description: "Customer inputs more than the allowed number of values"
2868
+ }
2869
+ });
2870
+
2871
+ // src/common/messages/validation.messages.ts
2872
+ var import_react_intl5 = require("react-intl");
2873
+ var validation_messages_default = (0, import_react_intl5.defineMessages)({
2859
2874
  type: {
2860
2875
  id: "dynamicFlows.ControlFeedback.type",
2861
2876
  defaultMessage: "Incorrect type",
@@ -2934,7 +2949,7 @@ ControlFeedback.defaultProps = {
2934
2949
  validationAsyncSuccessMessage: null
2935
2950
  };
2936
2951
  function useDefaultValidationMessages(schema) {
2937
- const { formatMessage, locale } = (0, import_react_intl5.useIntl)();
2952
+ const { formatMessage, locale } = (0, import_react_intl6.useIntl)();
2938
2953
  const formattedMessages = {
2939
2954
  type: formatMessage(validation_messages_default.type),
2940
2955
  minimum: formatMessage(validation_messages_default.minimum, {
@@ -2949,6 +2964,12 @@ function useDefaultValidationMessages(schema) {
2949
2964
  maxLength: formatMessage(validation_messages_default.maxLength, {
2950
2965
  maxLength: schema.maxLength
2951
2966
  }),
2967
+ minItems: formatMessage(validation_array_messages_default.minItemsError, {
2968
+ minItems: schema.minItems
2969
+ }),
2970
+ maxItems: formatMessage(validation_array_messages_default.maxItemsError, {
2971
+ maxItems: schema.maxItems
2972
+ }),
2952
2973
  pattern: formatMessage(validation_messages_default.pattern),
2953
2974
  required: formatMessage(validation_messages_default.required)
2954
2975
  };
@@ -3015,11 +3036,11 @@ function constructUploadError(response) {
3015
3036
  }
3016
3037
 
3017
3038
  // src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.tsx
3018
- var import_react_intl8 = require("react-intl");
3039
+ var import_react_intl9 = require("react-intl");
3019
3040
 
3020
3041
  // src/legacy/common/messages.ts
3021
- var import_react_intl6 = require("react-intl");
3022
- var messages_default = (0, import_react_intl6.defineMessages)({
3042
+ var import_react_intl7 = require("react-intl");
3043
+ var messages_default = (0, import_react_intl7.defineMessages)({
3023
3044
  required: {
3024
3045
  id: "dynamicFlows.DefaultErrorMessages.required",
3025
3046
  defaultMessage: "Please fill out this field.",
@@ -3028,8 +3049,8 @@ var messages_default = (0, import_react_intl6.defineMessages)({
3028
3049
  });
3029
3050
 
3030
3051
  // src/common/messages/multi-file-upload.messages.js
3031
- var import_react_intl7 = require("react-intl");
3032
- var multi_file_upload_messages_default = (0, import_react_intl7.defineMessages)({
3052
+ var import_react_intl8 = require("react-intl");
3053
+ var multi_file_upload_messages_default = (0, import_react_intl8.defineMessages)({
3033
3054
  minItemsError: {
3034
3055
  id: "dynamicFlows.MultipleFileUploadSchema.minItemsError",
3035
3056
  defaultMessage: "Please upload at least {minItems} file(s).",
@@ -3052,7 +3073,7 @@ function useFormattedDefaultErrorMessages({
3052
3073
  maxItems,
3053
3074
  minItems
3054
3075
  }) {
3055
- const { formatMessage } = (0, import_react_intl8.useIntl)();
3076
+ const { formatMessage } = (0, import_react_intl9.useIntl)();
3056
3077
  const { maxFileSizeError, maxItemsError, minItemsError } = multi_file_upload_messages_default;
3057
3078
  return {
3058
3079
  maxFileSizeErrorMessage: formatMessage(maxFileSizeError),
@@ -3172,7 +3193,7 @@ function getValidationMessages(schema, required, defaultErrorMessages) {
3172
3193
  var import_components10 = require("@transferwise/components");
3173
3194
  var import_icons = require("@transferwise/icons");
3174
3195
  var import_react14 = require("react");
3175
- var import_react_intl11 = require("react-intl");
3196
+ var import_react_intl12 = require("react-intl");
3176
3197
 
3177
3198
  // src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.tsx
3178
3199
  var import_components9 = require("@transferwise/components");
@@ -3191,8 +3212,8 @@ function ItemSummaryOption({ item, onClick }) {
3191
3212
  }
3192
3213
 
3193
3214
  // src/common/messages/repeatable.messages.ts
3194
- var import_react_intl9 = require("react-intl");
3195
- var repeatable_messages_default = (0, import_react_intl9.defineMessages)({
3215
+ var import_react_intl10 = require("react-intl");
3216
+ var repeatable_messages_default = (0, import_react_intl10.defineMessages)({
3196
3217
  addItemTitle: {
3197
3218
  id: "dynamicFlows.ArraySchema.addItemTitle",
3198
3219
  defaultMessage: "Add Item",
@@ -3217,7 +3238,7 @@ var repeatable_messages_default = (0, import_react_intl9.defineMessages)({
3217
3238
 
3218
3239
  // src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.tsx
3219
3240
  var import_react13 = require("react");
3220
- var import_react_intl10 = require("react-intl");
3241
+ var import_react_intl11 = require("react-intl");
3221
3242
  var import_jsx_runtime21 = require("react/jsx-runtime");
3222
3243
  function RepeatableSchemaStep({
3223
3244
  type,
@@ -3228,7 +3249,7 @@ function RepeatableSchemaStep({
3228
3249
  onModelChange,
3229
3250
  onAction
3230
3251
  }) {
3231
- const { formatMessage } = (0, import_react_intl10.useIntl)();
3252
+ const { formatMessage } = (0, import_react_intl11.useIntl)();
3232
3253
  const [filename, setFilename] = (0, import_react13.useState)(void 0);
3233
3254
  const step = {
3234
3255
  layout: [
@@ -3471,9 +3492,19 @@ var schemaSummaryProvides = (summary, providesProp) => (
3471
3492
  );
3472
3493
 
3473
3494
  // src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
3495
+ var import_classnames3 = __toESM(require_classnames());
3474
3496
  var import_jsx_runtime22 = require("react/jsx-runtime");
3475
- function RepeatableSchema({ schema, model, errors, submitted, onChange }) {
3497
+ function RepeatableSchema({
3498
+ schema,
3499
+ model,
3500
+ errors,
3501
+ submitted,
3502
+ required = false,
3503
+ onChange
3504
+ }) {
3505
+ var _a;
3476
3506
  const [openModalType, setOpenModalType] = (0, import_react14.useState)(null);
3507
+ const [changed, setChanged] = (0, import_react14.useState)(false);
3477
3508
  const [itemSummaries, setItemSummaries] = (0, import_react14.useState)(() => {
3478
3509
  if (isObject(model) && !isArray(model)) {
3479
3510
  throw new Error(
@@ -3483,6 +3514,7 @@ function RepeatableSchema({ schema, model, errors, submitted, onChange }) {
3483
3514
  return model ? model.map((item) => getItemSummaryFromSchema(schema.items, item, schema == null ? void 0 : schema.summary)) : null;
3484
3515
  });
3485
3516
  const [editableItem, setEditableItem] = (0, import_react14.useState)({ item: null, model: null });
3517
+ const id = (0, import_react14.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
3486
3518
  const broadcastModelChange = (updatedItems) => {
3487
3519
  const updatedModel = updatedItems ? updatedItems.map(({ value }) => value) : null;
3488
3520
  onChange({
@@ -3499,14 +3531,15 @@ function RepeatableSchema({ schema, model, errors, submitted, onChange }) {
3499
3531
  setOpenModalType("edit");
3500
3532
  };
3501
3533
  const onSaveItem = (action, summaryTextOverride) => {
3502
- var _a;
3534
+ var _a2;
3535
+ setChanged(true);
3503
3536
  const updatedItem = action === "remove" ? null : getItemSummaryFromSchema(
3504
3537
  schema.items,
3505
3538
  editableItem.model,
3506
3539
  schema.summary,
3507
3540
  summaryTextOverride
3508
3541
  );
3509
- if (action !== "remove" && !isValidSchema((_a = updatedItem == null ? void 0 : updatedItem.value) != null ? _a : null, schema.items)) {
3542
+ if (action !== "remove" && !isValidSchema((_a2 = updatedItem == null ? void 0 : updatedItem.value) != null ? _a2 : null, schema.items)) {
3510
3543
  return;
3511
3544
  }
3512
3545
  const updatedItemSummaries = getUpdatedItemSummaries(action, {
@@ -3523,8 +3556,21 @@ function RepeatableSchema({ schema, model, errors, submitted, onChange }) {
3523
3556
  setEditableItem({ item: null, model: null });
3524
3557
  setOpenModalType(null);
3525
3558
  };
3526
- const { formatMessage } = (0, import_react_intl11.useIntl)();
3527
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
3559
+ const { formatMessage } = (0, import_react_intl12.useIntl)();
3560
+ const validations = getValidationFailures(model, schema, required);
3561
+ const base64ValidationMessages = useFormattedDefaultErrorMessages({
3562
+ minItems: schema.minItems,
3563
+ maxItems: schema.maxItems
3564
+ });
3565
+ const validationMessages = schema.items.type === "string" && schema.items.format === "base64url" ? {
3566
+ minItems: base64ValidationMessages.minItemsErrorMessage,
3567
+ maxItems: base64ValidationMessages.maxItemsErrorMessage,
3568
+ required: base64ValidationMessages.requiredMessage
3569
+ } : void 0;
3570
+ const formGroupClasses = {
3571
+ "has-error": (_a = errors && !isEmpty(errors)) != null ? _a : submitted && validations.length
3572
+ };
3573
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { id, className: (0, import_classnames3.default)(formGroupClasses), children: [
3528
3574
  schema.title && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_components10.Header, { title: schema.title }),
3529
3575
  itemSummaries == null ? void 0 : itemSummaries.map((itemSummary) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3530
3576
  ItemSummaryOption,
@@ -3562,6 +3608,21 @@ function RepeatableSchema({ schema, model, errors, submitted, onChange }) {
3562
3608
  ),
3563
3609
  onClose: onCancelEdit
3564
3610
  }
3611
+ ),
3612
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3613
+ ControlFeedback_default,
3614
+ {
3615
+ id: `${id}-feedback`,
3616
+ changed,
3617
+ focused: false,
3618
+ blurred: false,
3619
+ errors: typeof errors === "string" ? errors : void 0,
3620
+ submitted,
3621
+ schema,
3622
+ validations,
3623
+ validationMessages,
3624
+ infoMessage: null
3625
+ }
3565
3626
  )
3566
3627
  ] });
3567
3628
  }
@@ -3623,7 +3684,7 @@ var ArraySchema_default = ArraySchema;
3623
3684
 
3624
3685
  // src/legacy/jsonSchemaForm/objectSchema/ObjectSchema.tsx
3625
3686
  var import_components11 = require("@transferwise/components");
3626
- var import_classnames3 = __toESM(require_classnames());
3687
+ var import_classnames4 = __toESM(require_classnames());
3627
3688
  var import_react15 = require("react");
3628
3689
  var import_jsx_runtime25 = require("react/jsx-runtime");
3629
3690
  var getSchemaColumnClasses2 = (width) => ({
@@ -3673,7 +3734,7 @@ function ObjectSchema(props) {
3673
3734
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "row", children: orderedPropertyNames.map((propertyName) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3674
3735
  "div",
3675
3736
  {
3676
- className: (0, import_classnames3.default)(
3737
+ className: (0, import_classnames4.default)(
3677
3738
  getSchemaColumnClasses2(props.schema.properties[propertyName].width)
3678
3739
  ),
3679
3740
  children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
@@ -3703,16 +3764,16 @@ var ObjectSchema_default = ObjectSchema;
3703
3764
 
3704
3765
  // src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
3705
3766
  var import_components15 = require("@transferwise/components");
3706
- var import_classnames4 = __toESM(require_classnames());
3767
+ var import_classnames5 = __toESM(require_classnames());
3707
3768
  var import_react20 = require("react");
3708
3769
 
3709
3770
  // src/legacy/jsonSchemaForm/help/Help.tsx
3710
3771
  var import_components12 = require("@transferwise/components");
3711
- var import_react_intl13 = require("react-intl");
3772
+ var import_react_intl14 = require("react-intl");
3712
3773
 
3713
3774
  // src/common/messages/help.messages.ts
3714
- var import_react_intl12 = require("react-intl");
3715
- var help_messages_default = (0, import_react_intl12.defineMessages)({
3775
+ var import_react_intl13 = require("react-intl");
3776
+ var help_messages_default = (0, import_react_intl13.defineMessages)({
3716
3777
  helpAria: {
3717
3778
  id: "dynamicFlows.Help.ariaLabel",
3718
3779
  defaultMessage: "Click here for more info.",
@@ -3723,7 +3784,7 @@ var help_messages_default = (0, import_react_intl12.defineMessages)({
3723
3784
  // src/legacy/jsonSchemaForm/help/Help.tsx
3724
3785
  var import_jsx_runtime26 = require("react/jsx-runtime");
3725
3786
  function Help(props) {
3726
- const intl = (0, import_react_intl13.useIntl)();
3787
+ const intl = (0, import_react_intl14.useIntl)();
3727
3788
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3728
3789
  import_components12.Info,
3729
3790
  {
@@ -4646,7 +4707,7 @@ function OneOfSchema(props) {
4646
4707
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
4647
4708
  (props.schema.oneOf.length > 1 || isConstSchema(props.schema.oneOf[0])) && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
4648
4709
  props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DynamicAlert_default, { component: props.schema.alert }),
4649
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: (0, import_classnames4.default)(formGroupClasses), children: [
4710
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: (0, import_classnames5.default)(formGroupClasses), children: [
4650
4711
  getTitleAndHelp(props.schema, id),
4651
4712
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4652
4713
  SchemaFormControl_default,
@@ -4740,7 +4801,7 @@ OneOfSchema.defaultProps = {
4740
4801
  var OneOfSchema_default = OneOfSchema;
4741
4802
 
4742
4803
  // src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
4743
- var import_classnames5 = __toESM(require_classnames());
4804
+ var import_classnames6 = __toESM(require_classnames());
4744
4805
  var import_react22 = require("react");
4745
4806
 
4746
4807
  // src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
@@ -4845,7 +4906,7 @@ function PersistAsyncBlobSchema(props) {
4845
4906
  };
4846
4907
  const id = schema.$id || schema.persistAsync.schema.$id || schema.persistAsync.idProperty;
4847
4908
  const feedbackId = `${id}-feedback`;
4848
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: (0, import_classnames5.default)(formGroupClasses), children: [
4909
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: (0, import_classnames6.default)(formGroupClasses), children: [
4849
4910
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4850
4911
  UploadInputAdapter,
4851
4912
  __spreadValues({
@@ -5049,11 +5110,11 @@ var PromotedOneOfSchema_default = PromotedOneOfSchema;
5049
5110
 
5050
5111
  // src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
5051
5112
  var import_components19 = require("@transferwise/components");
5052
- var import_react_intl15 = require("react-intl");
5113
+ var import_react_intl16 = require("react-intl");
5053
5114
 
5054
5115
  // src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js
5055
- var import_react_intl14 = require("react-intl");
5056
- var ReadOnlySchema_messages_default = (0, import_react_intl14.defineMessages)({
5116
+ var import_react_intl15 = require("react-intl");
5117
+ var ReadOnlySchema_messages_default = (0, import_react_intl15.defineMessages)({
5057
5118
  yes: {
5058
5119
  id: "dynamicFlows.ReadOnlySchema.yes",
5059
5120
  defaultMessage: "Yes",
@@ -5070,7 +5131,7 @@ var ReadOnlySchema_messages_default = (0, import_react_intl14.defineMessages)({
5070
5131
  var import_jsx_runtime40 = require("react/jsx-runtime");
5071
5132
  function ReadOnlySchema({ schema, model }) {
5072
5133
  const { title = "" } = schema;
5073
- const { formatMessage } = (0, import_react_intl15.useIntl)();
5134
+ const { formatMessage } = (0, import_react_intl16.useIntl)();
5074
5135
  const value = getValueForSchema({ schema, model, formatMessage });
5075
5136
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components19.DefinitionList, { layout: import_components19.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: "" }] });
5076
5137
  }
@@ -5298,11 +5359,11 @@ var DynamicForm_default = DynamicForm;
5298
5359
 
5299
5360
  // src/legacy/layout/heading/DynamicHeading.tsx
5300
5361
  var import_components20 = require("@transferwise/components");
5301
- var import_classnames6 = __toESM(require_classnames());
5362
+ var import_classnames7 = __toESM(require_classnames());
5302
5363
  var import_jsx_runtime44 = require("react/jsx-runtime");
5303
5364
  var DynamicHeading = (props) => {
5304
5365
  const { text, size = "md", align = "left", margin = "md", control } = props.component;
5305
- const classes = (0, import_classnames6.default)(getTextAlignmentAndMargin({ align, margin }));
5366
+ const classes = (0, import_classnames7.default)(getTextAlignmentAndMargin({ align, margin }));
5306
5367
  return control === "display" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DisplayHeading, { size, text, classes }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(StandardHeading, { size, text, classes });
5307
5368
  };
5308
5369
  var StandardHeading = ({ size, text, classes }) => {
@@ -5571,11 +5632,11 @@ var DynamicLoadingIndicator_default = DynamicLoadingIndicator;
5571
5632
 
5572
5633
  // src/legacy/layout/paragraph/DynamicParagraph.tsx
5573
5634
  var import_components27 = require("@transferwise/components");
5574
- var import_react_intl17 = require("react-intl");
5635
+ var import_react_intl18 = require("react-intl");
5575
5636
 
5576
5637
  // src/common/messages/paragraph.messages.ts
5577
- var import_react_intl16 = require("react-intl");
5578
- var paragraph_messages_default = (0, import_react_intl16.defineMessages)({
5638
+ var import_react_intl17 = require("react-intl");
5639
+ var paragraph_messages_default = (0, import_react_intl17.defineMessages)({
5579
5640
  copy: {
5580
5641
  id: "dynamicFlows.DynamicParagraph.copy",
5581
5642
  defaultMessage: "Copy",
@@ -5611,14 +5672,14 @@ function BasicDynamicParagraph({ component }) {
5611
5672
  ] });
5612
5673
  }
5613
5674
  function CopyableDynamicParagraph({ component }) {
5614
- const { formatMessage } = (0, import_react_intl17.useIntl)();
5675
+ const { formatMessage } = (0, import_react_intl18.useIntl)();
5615
5676
  const createSnackbar = useSnackBarIfAvailable();
5616
5677
  const { text } = component;
5617
5678
  const copy = () => {
5618
5679
  var _a;
5619
5680
  (_a = navigator.clipboard) == null ? void 0 : _a.writeText(text).then(() => createSnackbar({ text: formatMessage(paragraph_messages_default.copied) })).catch(noop3);
5620
5681
  };
5621
- const classNames8 = `${getTextAlignmentAndMargin({
5682
+ const classNames9 = `${getTextAlignmentAndMargin({
5622
5683
  align: component.align,
5623
5684
  margin: "sm"
5624
5685
  })} form-control`;
@@ -5627,7 +5688,7 @@ function CopyableDynamicParagraph({ component }) {
5627
5688
  "input",
5628
5689
  {
5629
5690
  type: "text",
5630
- className: classNames8,
5691
+ className: classNames9,
5631
5692
  value: text,
5632
5693
  readOnly: true,
5633
5694
  style: { textOverflow: "ellipsis" }
@@ -5713,7 +5774,7 @@ var SearchInput = ({ title, value, onFocus, onChange }) => {
5713
5774
 
5714
5775
  // src/legacy/layout/search/SearchResults.tsx
5715
5776
  var import_components30 = require("@transferwise/components");
5716
- var import_react_intl18 = require("react-intl");
5777
+ var import_react_intl19 = require("react-intl");
5717
5778
  var import_jsx_runtime54 = require("react/jsx-runtime");
5718
5779
  function SearchResults({ results, emptyMessage, onSelect }) {
5719
5780
  if (results.length === 0) {
@@ -5733,7 +5794,7 @@ function SearchResults({ results, emptyMessage, onSelect }) {
5733
5794
  )) });
5734
5795
  }
5735
5796
  function ErrorResult({ onRetrySearch }) {
5736
- const intl = (0, import_react_intl18.useIntl)();
5797
+ const intl = (0, import_react_intl19.useIntl)();
5737
5798
  return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("p", { className: "m-t-2", children: [
5738
5799
  intl.formatMessage(generic_error_messages_default.genericError),
5739
5800
  "\xA0",
@@ -5976,7 +6037,7 @@ var BasicTypeSchema = (props) => {
5976
6037
  const feedbackId = `${id}-feedback`;
5977
6038
  return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
5978
6039
  props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(DynamicAlert_default, { component: props.schema.alert }),
5979
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: (0, import_classnames7.default)(formGroupClasses), children: [
6040
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: (0, import_classnames8.default)(formGroupClasses), children: [
5980
6041
  showLabel && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "d-inline-block m-b-1", children: [
5981
6042
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
5982
6043
  !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Help_default, { help: schemaHelp })
@@ -6035,7 +6096,7 @@ var controlTypesWithPersistOnChange = /* @__PURE__ */ new Set([
6035
6096
  ]);
6036
6097
  function PersistAsyncBasicSchema(props) {
6037
6098
  const { schema, required, submitted, errors, onChange, onPersistAsync } = props;
6038
- const intl = (0, import_react_intl19.useIntl)();
6099
+ const intl = (0, import_react_intl20.useIntl)();
6039
6100
  const httpClient = useHttpClient();
6040
6101
  const onEvent = useEventDispatcher();
6041
6102
  const [persistAsyncModel, setPersistAsyncModel] = (0, import_react33.useState)(null);
@@ -6133,7 +6194,7 @@ var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
6133
6194
  var usePersistAsync = (persistAsync) => {
6134
6195
  const [abortController, setAbortController] = (0, import_react34.useState)(null);
6135
6196
  const httpClient = useHttpClient();
6136
- const intl = (0, import_react_intl20.useIntl)();
6197
+ const intl = (0, import_react_intl21.useIntl)();
6137
6198
  const { schema } = persistAsync;
6138
6199
  async function handlePersistAsync(model) {
6139
6200
  const isInvalidSchema = model instanceof Blob ? !isBlobSchema(schema) : !isValidSchema(model, schema);
@@ -6364,12 +6425,12 @@ var import_react42 = require("react");
6364
6425
 
6365
6426
  // src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
6366
6427
  var import_react41 = require("react");
6367
- var import_react_intl25 = require("react-intl");
6428
+ var import_react_intl26 = require("react-intl");
6368
6429
  var import_react_webcam = __toESM(require_react_webcam());
6369
6430
 
6370
6431
  // src/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.ts
6371
- var import_react_intl21 = require("react-intl");
6372
- var CameraCapture_messages_default = (0, import_react_intl21.defineMessages)({
6432
+ var import_react_intl22 = require("react-intl");
6433
+ var CameraCapture_messages_default = (0, import_react_intl22.defineMessages)({
6373
6434
  reviewSubmit: {
6374
6435
  id: "dynamicFlows.CameraCapture.reviewSubmit",
6375
6436
  defaultMessage: "Yes, submit",
@@ -6429,14 +6490,14 @@ var CameraCapture_messages_default = (0, import_react_intl21.defineMessages)({
6429
6490
 
6430
6491
  // src/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.tsx
6431
6492
  var import_components32 = require("@transferwise/components");
6432
- var import_react_intl22 = require("react-intl");
6493
+ var import_react_intl23 = require("react-intl");
6433
6494
  var import_jsx_runtime60 = require("react/jsx-runtime");
6434
6495
  var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(CaptureButton, { onClick: onCapture }) });
6435
6496
  var ReviewBottomBar = ({
6436
6497
  onSubmit,
6437
6498
  onRetry
6438
6499
  }) => {
6439
- const intl = (0, import_react_intl22.useIntl)();
6500
+ const intl = (0, import_react_intl23.useIntl)();
6440
6501
  return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
6441
6502
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
6442
6503
  import_components32.Button,
@@ -6475,11 +6536,11 @@ var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime60.js
6475
6536
  );
6476
6537
 
6477
6538
  // src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
6478
- var import_react_intl24 = require("react-intl");
6539
+ var import_react_intl25 = require("react-intl");
6479
6540
 
6480
6541
  // src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.ts
6481
- var import_react_intl23 = require("react-intl");
6482
- var OrientationLockOverlay_messages_default = (0, import_react_intl23.defineMessages)({
6542
+ var import_react_intl24 = require("react-intl");
6543
+ var OrientationLockOverlay_messages_default = (0, import_react_intl24.defineMessages)({
6483
6544
  text: {
6484
6545
  id: "dynamicFlows.CameraCapture.rotatePhone.text",
6485
6546
  defaultMessage: "Rotate your phone to portrait view to take a photo",
@@ -6490,7 +6551,7 @@ var OrientationLockOverlay_messages_default = (0, import_react_intl23.defineMess
6490
6551
  // src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
6491
6552
  var import_jsx_runtime61 = require("react/jsx-runtime");
6492
6553
  function OrientationLockOverlay() {
6493
- const intl = (0, import_react_intl24.useIntl)();
6554
+ const intl = (0, import_react_intl25.useIntl)();
6494
6555
  return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "orientation-lock-overlay", children: [
6495
6556
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
6496
6557
  "img",
@@ -6777,7 +6838,7 @@ function CameraCapture({
6777
6838
  shouldLockOrientation,
6778
6839
  onEvent
6779
6840
  );
6780
- const intl = (0, import_react_intl25.useIntl)();
6841
+ const intl = (0, import_react_intl26.useIntl)();
6781
6842
  const handleCapture = (0, import_react41.useCallback)(async () => {
6782
6843
  var _a, _b, _c, _d, _e, _f;
6783
6844
  if (((_a = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _a.video) && ((_c = (_b = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _b.video) == null ? void 0 : _c.readyState) >= 3) {
@@ -7000,11 +7061,11 @@ function getFirstAction(step) {
7000
7061
  }
7001
7062
 
7002
7063
  // src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.tsx
7003
- var import_react_intl27 = require("react-intl");
7064
+ var import_react_intl28 = require("react-intl");
7004
7065
 
7005
7066
  // src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.messages.ts
7006
- var import_react_intl26 = require("react-intl");
7007
- var ExternalConfirmationStep_messages_default = (0, import_react_intl26.defineMessages)({
7067
+ var import_react_intl27 = require("react-intl");
7068
+ var ExternalConfirmationStep_messages_default = (0, import_react_intl27.defineMessages)({
7008
7069
  title: {
7009
7070
  id: "dynamicFlows.ExternalConfirmation.title",
7010
7071
  defaultMessage: "Please confirm",
@@ -7032,7 +7093,7 @@ var import_jsx_runtime66 = require("react/jsx-runtime");
7032
7093
  var noop5 = () => {
7033
7094
  };
7034
7095
  var ExternalConfirmationStep = ({ url, onClose }) => {
7035
- const { formatMessage } = (0, import_react_intl27.useIntl)();
7096
+ const { formatMessage } = (0, import_react_intl28.useIntl)();
7036
7097
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
7037
7098
  DynamicLayout_default,
7038
7099
  {
@@ -7309,10 +7370,10 @@ var import_react46 = require("react");
7309
7370
 
7310
7371
  // src/common/errorBoundary/ErrorBoundaryAlert.tsx
7311
7372
  var import_components37 = require("@transferwise/components");
7312
- var import_react_intl28 = require("react-intl");
7373
+ var import_react_intl29 = require("react-intl");
7313
7374
  var import_jsx_runtime70 = require("react/jsx-runtime");
7314
7375
  function ErrorBoundaryAlert({ onDismiss }) {
7315
- const { formatMessage } = (0, import_react_intl28.useIntl)();
7376
+ const { formatMessage } = (0, import_react_intl29.useIntl)();
7316
7377
  return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
7317
7378
  import_components37.Alert,
7318
7379
  {
@@ -7466,7 +7527,7 @@ var DynamicFlowComponent = ({
7466
7527
  onEvent = noop7,
7467
7528
  onLog = noop7
7468
7529
  }) => {
7469
- const { locale } = (0, import_react_intl29.useIntl)();
7530
+ const { locale } = (0, import_react_intl30.useIntl)();
7470
7531
  const {
7471
7532
  formErrors,
7472
7533
  globalError,