@wise/dynamic-flow-client 4.8.6 → 4.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/main.js CHANGED
@@ -3381,7 +3381,8 @@ var createNumberInputComponent = (numberInputProps, updateComponent) => {
3381
3381
  const isValid = this.validate();
3382
3382
  performOnChange == null ? void 0 : performOnChange.flush();
3383
3383
  if (isValid) {
3384
- void (onPersistAsync == null ? void 0 : onPersistAsync());
3384
+ void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
3385
+ }));
3385
3386
  validateAsync == null ? void 0 : validateAsync.flush();
3386
3387
  }
3387
3388
  },
@@ -4806,7 +4807,12 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
4806
4807
  });
4807
4808
  schemaOnChange == null ? void 0 : schemaOnChange();
4808
4809
  onValueChange();
4809
- await (onPersistAsync == null ? void 0 : onPersistAsync());
4810
+ await (onPersistAsync == null ? void 0 : onPersistAsync().catch((e) => {
4811
+ this._update((draft) => {
4812
+ draft.value = null;
4813
+ });
4814
+ throw e;
4815
+ }));
4810
4816
  },
4811
4817
  async getSubmittableValue() {
4812
4818
  const file = this.getLocalValue();
@@ -4905,7 +4911,8 @@ var createBooleanInputComponent = (booleanInputProps, updateComponent) => {
4905
4911
  draft.value = updatedValue;
4906
4912
  });
4907
4913
  schemaOnChange == null ? void 0 : schemaOnChange();
4908
- void (onPersistAsync == null ? void 0 : onPersistAsync());
4914
+ void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
4915
+ }));
4909
4916
  validateAsync == null ? void 0 : validateAsync(this, this.getLocalValue()).catch(() => {
4910
4917
  });
4911
4918
  onValueChange();
@@ -5032,7 +5039,8 @@ var createIntegerInputComponent = (integerInputProps, updateComponent) => {
5032
5039
  const isValid = this.validate();
5033
5040
  performOnChange == null ? void 0 : performOnChange.flush();
5034
5041
  if (isValid) {
5035
- void (onPersistAsync == null ? void 0 : onPersistAsync());
5042
+ void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
5043
+ }));
5036
5044
  validateAsync == null ? void 0 : validateAsync.flush();
5037
5045
  }
5038
5046
  },
@@ -5460,7 +5468,8 @@ var createDateInputComponent = (textInputProps, updateComponent) => {
5460
5468
  }
5461
5469
  onValueChange();
5462
5470
  if (getValidationErrors(updatedValue).length === 0) {
5463
- void (onPersistAsync == null ? void 0 : onPersistAsync());
5471
+ void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
5472
+ }));
5464
5473
  }
5465
5474
  },
5466
5475
  async getSubmittableValue() {
@@ -5602,7 +5611,8 @@ var createTextInputComponent = (textInputProps, updateComponent) => {
5602
5611
  const isValid = this.validate();
5603
5612
  performOnChange == null ? void 0 : performOnChange.flush();
5604
5613
  if (isValid) {
5605
- void (onPersistAsync == null ? void 0 : onPersistAsync());
5614
+ void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
5615
+ }));
5606
5616
  validateAsync == null ? void 0 : validateAsync.flush();
5607
5617
  }
5608
5618
  },
@@ -5806,7 +5816,10 @@ var createPersistAsyncComponent = (props, performPersistAsync, schemaOnChange, u
5806
5816
  this._update((draft) => {
5807
5817
  draft.lastResponse = null;
5808
5818
  draft.lastSubmitted = null;
5809
- draft.errors = error instanceof Error ? [error.message] : [];
5819
+ draft.submission = Promise.resolve(null);
5820
+ if (this.component.type !== "upload") {
5821
+ draft.errors = error instanceof Error ? [error.message] : [];
5822
+ }
5810
5823
  });
5811
5824
  throw error;
5812
5825
  });
@@ -5829,8 +5842,7 @@ var persistAsyncSchemaToComponent = (schemaMapperProps, mapperProps) => {
5829
5842
  const { uid, schema, model, localValue } = schemaMapperProps;
5830
5843
  const { persistAsync } = schema;
5831
5844
  const performPersistAsync = getPerformPersistAsyncFn(schema, persistAsync, mapperProps);
5832
- const onPersistAsync = async () => paComponent.persist().catch(() => {
5833
- }).then(() => {
5845
+ const onPersistAsync = async () => paComponent.persist().then(() => {
5834
5846
  });
5835
5847
  const childComponent = mapSchemaToComponent(
5836
5848
  __spreadProps(__spreadValues({}, schemaMapperProps), { uid: `${uid}-persist`, schema: persistAsync.schema, onPersistAsync }),
@@ -6623,6 +6635,7 @@ function useDynamicFlowCore(props) {
6623
6635
  break;
6624
6636
  }
6625
6637
  case "refresh": {
6638
+ rootComponentRef.current.dismissAllModals();
6626
6639
  await onRefresh({ refreshUrl: behavior.url, analytics: behavior.analytics });
6627
6640
  break;
6628
6641
  }
package/build/main.mjs CHANGED
@@ -3338,7 +3338,8 @@ var createNumberInputComponent = (numberInputProps, updateComponent) => {
3338
3338
  const isValid = this.validate();
3339
3339
  performOnChange == null ? void 0 : performOnChange.flush();
3340
3340
  if (isValid) {
3341
- void (onPersistAsync == null ? void 0 : onPersistAsync());
3341
+ void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
3342
+ }));
3342
3343
  validateAsync == null ? void 0 : validateAsync.flush();
3343
3344
  }
3344
3345
  },
@@ -4763,7 +4764,12 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
4763
4764
  });
4764
4765
  schemaOnChange == null ? void 0 : schemaOnChange();
4765
4766
  onValueChange();
4766
- await (onPersistAsync == null ? void 0 : onPersistAsync());
4767
+ await (onPersistAsync == null ? void 0 : onPersistAsync().catch((e) => {
4768
+ this._update((draft) => {
4769
+ draft.value = null;
4770
+ });
4771
+ throw e;
4772
+ }));
4767
4773
  },
4768
4774
  async getSubmittableValue() {
4769
4775
  const file = this.getLocalValue();
@@ -4862,7 +4868,8 @@ var createBooleanInputComponent = (booleanInputProps, updateComponent) => {
4862
4868
  draft.value = updatedValue;
4863
4869
  });
4864
4870
  schemaOnChange == null ? void 0 : schemaOnChange();
4865
- void (onPersistAsync == null ? void 0 : onPersistAsync());
4871
+ void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
4872
+ }));
4866
4873
  validateAsync == null ? void 0 : validateAsync(this, this.getLocalValue()).catch(() => {
4867
4874
  });
4868
4875
  onValueChange();
@@ -4989,7 +4996,8 @@ var createIntegerInputComponent = (integerInputProps, updateComponent) => {
4989
4996
  const isValid = this.validate();
4990
4997
  performOnChange == null ? void 0 : performOnChange.flush();
4991
4998
  if (isValid) {
4992
- void (onPersistAsync == null ? void 0 : onPersistAsync());
4999
+ void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
5000
+ }));
4993
5001
  validateAsync == null ? void 0 : validateAsync.flush();
4994
5002
  }
4995
5003
  },
@@ -5417,7 +5425,8 @@ var createDateInputComponent = (textInputProps, updateComponent) => {
5417
5425
  }
5418
5426
  onValueChange();
5419
5427
  if (getValidationErrors(updatedValue).length === 0) {
5420
- void (onPersistAsync == null ? void 0 : onPersistAsync());
5428
+ void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
5429
+ }));
5421
5430
  }
5422
5431
  },
5423
5432
  async getSubmittableValue() {
@@ -5559,7 +5568,8 @@ var createTextInputComponent = (textInputProps, updateComponent) => {
5559
5568
  const isValid = this.validate();
5560
5569
  performOnChange == null ? void 0 : performOnChange.flush();
5561
5570
  if (isValid) {
5562
- void (onPersistAsync == null ? void 0 : onPersistAsync());
5571
+ void (onPersistAsync == null ? void 0 : onPersistAsync().catch(() => {
5572
+ }));
5563
5573
  validateAsync == null ? void 0 : validateAsync.flush();
5564
5574
  }
5565
5575
  },
@@ -5763,7 +5773,10 @@ var createPersistAsyncComponent = (props, performPersistAsync, schemaOnChange, u
5763
5773
  this._update((draft) => {
5764
5774
  draft.lastResponse = null;
5765
5775
  draft.lastSubmitted = null;
5766
- draft.errors = error instanceof Error ? [error.message] : [];
5776
+ draft.submission = Promise.resolve(null);
5777
+ if (this.component.type !== "upload") {
5778
+ draft.errors = error instanceof Error ? [error.message] : [];
5779
+ }
5767
5780
  });
5768
5781
  throw error;
5769
5782
  });
@@ -5786,8 +5799,7 @@ var persistAsyncSchemaToComponent = (schemaMapperProps, mapperProps) => {
5786
5799
  const { uid, schema, model, localValue } = schemaMapperProps;
5787
5800
  const { persistAsync } = schema;
5788
5801
  const performPersistAsync = getPerformPersistAsyncFn(schema, persistAsync, mapperProps);
5789
- const onPersistAsync = async () => paComponent.persist().catch(() => {
5790
- }).then(() => {
5802
+ const onPersistAsync = async () => paComponent.persist().then(() => {
5791
5803
  });
5792
5804
  const childComponent = mapSchemaToComponent(
5793
5805
  __spreadProps(__spreadValues({}, schemaMapperProps), { uid: `${uid}-persist`, schema: persistAsync.schema, onPersistAsync }),
@@ -6580,6 +6592,7 @@ function useDynamicFlowCore(props) {
6580
6592
  break;
6581
6593
  }
6582
6594
  case "refresh": {
6595
+ rootComponentRef.current.dismissAllModals();
6583
6596
  await onRefresh({ refreshUrl: behavior.url, analytics: behavior.analytics });
6584
6597
  break;
6585
6598
  }
@@ -1,4 +1,4 @@
1
- import { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
1
+ import type { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
2
2
  import type { IsInvalidCheck } from '../features/validation/value-checks';
3
3
  import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
4
4
  import type { Autocapitalization, BaseInputComponent, OnPersistAsync, OnValueChange, RepeatableSummary, Suggestions, UpdateComponent, ValidationAsyncState } from '../types';
@@ -35,10 +35,10 @@ import type { SelectInputComponent } from './components/SelectInputComponent';
35
35
  import type { StatusListComponent } from './components/StatusListComponent';
36
36
  import type { ExternalConfirmationComponent } from './components/step/ExternalConfirmationComponent';
37
37
  import type { StepDomainComponent } from './components/step/StepDomainComponent';
38
+ import type { TabsComponent } from './components/TabsComponent';
38
39
  import type { TextInputComponent } from './components/TextInputComponent';
39
40
  import type { TupleComponent } from './components/TupleComponent';
40
41
  import type { UploadInputComponent } from './components/UploadInputComponent';
41
- import { TabsComponent } from './components/TabsComponent';
42
42
  export type DomainComponent = SchemaComponent | LayoutComponent | RootDomainComponent | StepDomainComponent;
43
43
  export type SchemaComponent = PersistAsyncComponent | AllOfComponent | BooleanInputComponent | ConstComponent | DateInputComponent | IntegerInputComponent | MultiSelectComponent | MultiUploadInputComponent | NumberInputComponent | ObjectComponent | RepeatableComponent | SelectInputComponent | TextInputComponent | TupleComponent | UploadInputComponent;
44
44
  export type LayoutComponent = AlertComponent | BoxComponent | ButtonComponent | ColumnsComponent | ContainerComponent | DecisionComponent | DividerComponent | ExternalConfirmationComponent | FormComponent | HeadingComponent | ImageComponent | InstructionsComponent | ListComponent | LoadingIndicatorComponent | MarkdownComponent | ModalComponent | ModalContentComponent | ParagraphComponent | ReviewComponent | SearchComponent | SectionComponent | StatusListComponent | TabsComponent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "4.8.6",
3
+ "version": "4.8.7",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -78,8 +78,8 @@
78
78
  "stylelint-value-no-unknown-custom-properties": "6.0.1",
79
79
  "tsx": "4.20.3",
80
80
  "typescript": "5.8.3",
81
- "@wise/dynamic-flow-renderers": "0.0.0",
82
- "@wise/dynamic-flow-fixtures": "0.0.1"
81
+ "@wise/dynamic-flow-fixtures": "0.0.1",
82
+ "@wise/dynamic-flow-renderers": "0.0.0"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "@transferwise/components": "^46.92.0",