@wise/dynamic-flow-client 4.9.0 → 4.9.1

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
@@ -2020,6 +2020,9 @@ var createRootDomainComponent = (updateComponent) => {
2020
2020
  async getSubmittableValue() {
2021
2021
  return this.stepComponent ? this.stepComponent.getSubmittableValue() : null;
2022
2022
  },
2023
+ getSubmittableValueSync() {
2024
+ return this.stepComponent ? this.stepComponent.getSubmittableValueSync() : null;
2025
+ },
2023
2026
  validate() {
2024
2027
  return this.stepComponent ? this.stepComponent.validate() : false;
2025
2028
  },
@@ -3188,6 +3191,9 @@ var createStepComponent = (stepProps) => {
3188
3191
  async getSubmittableValue() {
3189
3192
  return getSubmittableData(this.schemaComponents);
3190
3193
  },
3194
+ getSubmittableValueSync() {
3195
+ return getSubmittableDataSync(this.schemaComponents);
3196
+ },
3191
3197
  getLocalValue() {
3192
3198
  return getLocalValues(this.schemaComponents);
3193
3199
  },
@@ -4825,6 +4831,7 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
4825
4831
  id,
4826
4832
  format,
4827
4833
  value,
4834
+ base64Value: null,
4828
4835
  _update(updateFn) {
4829
4836
  update(this, updateFn);
4830
4837
  },
@@ -4835,9 +4842,11 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
4835
4842
  },
4836
4843
  // Noop
4837
4844
  async onUpload(updatedValue) {
4845
+ const base64Value = this.format === "base64" && updatedValue ? await toBase64(updatedValue) : null;
4838
4846
  this._update((draft) => {
4839
4847
  draft.errors = [];
4840
4848
  draft.value = updatedValue;
4849
+ draft.base64Value = base64Value;
4841
4850
  });
4842
4851
  schemaOnChange == null ? void 0 : schemaOnChange();
4843
4852
  onValueChange();
@@ -4856,7 +4865,7 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
4856
4865
  return null;
4857
4866
  },
4858
4867
  getSubmittableValueSync() {
4859
- return null;
4868
+ return this.base64Value;
4860
4869
  },
4861
4870
  getSummary() {
4862
4871
  var _a2, _b;
@@ -4873,8 +4882,20 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
4873
4882
  return errors.length === 0;
4874
4883
  }
4875
4884
  }, rest);
4885
+ if (format === "base64" && value && !onPersistAsync) {
4886
+ void initialiseBase64Value(uploadComponent);
4887
+ }
4876
4888
  return uploadComponent;
4877
4889
  };
4890
+ var initialiseBase64Value = async (uploadComponent) => {
4891
+ const { format, value } = uploadComponent;
4892
+ const base64Value = format === "base64" && value ? await toBase64(value) : null;
4893
+ if (base64Value) {
4894
+ uploadComponent._update((draft) => {
4895
+ draft.base64Value = base64Value;
4896
+ });
4897
+ }
4898
+ };
4878
4899
 
4879
4900
  // src/revamp/domain/mappers/schema/blobSchemaToComponent.ts
4880
4901
  var blobSchemaToComponent = (schemaMapperProps, mapperProps) => {
@@ -6779,13 +6800,13 @@ function useDynamicFlowCore(props) {
6779
6800
  errorsOverride,
6780
6801
  analytics
6781
6802
  }) => {
6782
- var _a2, _b;
6803
+ var _a2;
6783
6804
  try {
6784
6805
  rootComponentRef.current.setLoadingState("refreshing");
6785
- const model = (_a2 = await rootComponentRef.current.getSubmittableValue()) != null ? _a2 : null;
6806
+ const model = rootComponentRef.current.getSubmittableValueSync();
6786
6807
  const command = await executeRefresh({
6787
6808
  abortSignal: abortCurrentAndGetNewAbortSignal(),
6788
- url: (_b = refreshUrl != null ? refreshUrl : rootComponentRef.current.getRefreshUrl()) != null ? _b : "",
6809
+ url: (_a2 = refreshUrl != null ? refreshUrl : rootComponentRef.current.getRefreshUrl()) != null ? _a2 : "",
6789
6810
  model,
6790
6811
  etag: etagRef.current,
6791
6812
  analytics,
package/build/main.mjs CHANGED
@@ -1977,6 +1977,9 @@ var createRootDomainComponent = (updateComponent) => {
1977
1977
  async getSubmittableValue() {
1978
1978
  return this.stepComponent ? this.stepComponent.getSubmittableValue() : null;
1979
1979
  },
1980
+ getSubmittableValueSync() {
1981
+ return this.stepComponent ? this.stepComponent.getSubmittableValueSync() : null;
1982
+ },
1980
1983
  validate() {
1981
1984
  return this.stepComponent ? this.stepComponent.validate() : false;
1982
1985
  },
@@ -3145,6 +3148,9 @@ var createStepComponent = (stepProps) => {
3145
3148
  async getSubmittableValue() {
3146
3149
  return getSubmittableData(this.schemaComponents);
3147
3150
  },
3151
+ getSubmittableValueSync() {
3152
+ return getSubmittableDataSync(this.schemaComponents);
3153
+ },
3148
3154
  getLocalValue() {
3149
3155
  return getLocalValues(this.schemaComponents);
3150
3156
  },
@@ -4782,6 +4788,7 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
4782
4788
  id,
4783
4789
  format,
4784
4790
  value,
4791
+ base64Value: null,
4785
4792
  _update(updateFn) {
4786
4793
  update(this, updateFn);
4787
4794
  },
@@ -4792,9 +4799,11 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
4792
4799
  },
4793
4800
  // Noop
4794
4801
  async onUpload(updatedValue) {
4802
+ const base64Value = this.format === "base64" && updatedValue ? await toBase64(updatedValue) : null;
4795
4803
  this._update((draft) => {
4796
4804
  draft.errors = [];
4797
4805
  draft.value = updatedValue;
4806
+ draft.base64Value = base64Value;
4798
4807
  });
4799
4808
  schemaOnChange == null ? void 0 : schemaOnChange();
4800
4809
  onValueChange();
@@ -4813,7 +4822,7 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
4813
4822
  return null;
4814
4823
  },
4815
4824
  getSubmittableValueSync() {
4816
- return null;
4825
+ return this.base64Value;
4817
4826
  },
4818
4827
  getSummary() {
4819
4828
  var _a2, _b;
@@ -4830,8 +4839,20 @@ var createUploadInputComponent = (uploadInputProps, updateComponent) => {
4830
4839
  return errors.length === 0;
4831
4840
  }
4832
4841
  }, rest);
4842
+ if (format === "base64" && value && !onPersistAsync) {
4843
+ void initialiseBase64Value(uploadComponent);
4844
+ }
4833
4845
  return uploadComponent;
4834
4846
  };
4847
+ var initialiseBase64Value = async (uploadComponent) => {
4848
+ const { format, value } = uploadComponent;
4849
+ const base64Value = format === "base64" && value ? await toBase64(value) : null;
4850
+ if (base64Value) {
4851
+ uploadComponent._update((draft) => {
4852
+ draft.base64Value = base64Value;
4853
+ });
4854
+ }
4855
+ };
4835
4856
 
4836
4857
  // src/revamp/domain/mappers/schema/blobSchemaToComponent.ts
4837
4858
  var blobSchemaToComponent = (schemaMapperProps, mapperProps) => {
@@ -6736,13 +6757,13 @@ function useDynamicFlowCore(props) {
6736
6757
  errorsOverride,
6737
6758
  analytics
6738
6759
  }) => {
6739
- var _a2, _b;
6760
+ var _a2;
6740
6761
  try {
6741
6762
  rootComponentRef.current.setLoadingState("refreshing");
6742
- const model = (_a2 = await rootComponentRef.current.getSubmittableValue()) != null ? _a2 : null;
6763
+ const model = rootComponentRef.current.getSubmittableValueSync();
6743
6764
  const command = await executeRefresh({
6744
6765
  abortSignal: abortCurrentAndGetNewAbortSignal(),
6745
- url: (_b = refreshUrl != null ? refreshUrl : rootComponentRef.current.getRefreshUrl()) != null ? _b : "",
6766
+ url: (_a2 = refreshUrl != null ? refreshUrl : rootComponentRef.current.getRefreshUrl()) != null ? _a2 : "",
6746
6767
  model,
6747
6768
  etag: etagRef.current,
6748
6769
  analytics,
@@ -15,6 +15,7 @@ export type RootDomainComponent = BaseComponent & {
15
15
  getLoadingState: () => LoadingState;
16
16
  getSchemaComponents: () => SchemaComponent[];
17
17
  getSubmittableValue: () => Promise<Model>;
18
+ getSubmittableValueSync: () => Model;
18
19
  validate: () => boolean;
19
20
  getTrackEvent: () => AnalyticsEventDispatcher<string> | null;
20
21
  setLoadingState: (loadingState: LoadingState) => void;
@@ -11,6 +11,7 @@ export type UploadInputComponent = BaseInputComponent<File | null> & {
11
11
  accepts?: string[];
12
12
  source?: UploadSource;
13
13
  validationAsyncState?: undefined;
14
+ base64Value: string | null;
14
15
  onUpload: (value: File | null) => Promise<void>;
15
16
  };
16
17
  export declare const createUploadInputComponent: (uploadInputProps: Pick<UploadInputComponent, "uid" | "id" | "accepts" | "analyticsId" | "alert" | "autoComplete" | "cameraConfig" | "control" | "errors" | "description" | "disabled" | "format" | "help" | "hidden" | "icon" | "image" | "maxSize" | "placeholder" | "required" | "source" | "title" | "value"> & {
@@ -27,6 +27,7 @@ export type StepDomainComponent = BaseComponent & {
27
27
  getModals: () => ModalComponent[];
28
28
  getLocalValue: () => LocalValue;
29
29
  getSubmittableValue: () => Promise<Model>;
30
+ getSubmittableValueSync: () => Model;
30
31
  validate: () => boolean;
31
32
  setLoadingState: (loadingState: LoadingState) => void;
32
33
  onBehavior: OnBehavior;
@@ -462,6 +462,7 @@ export declare const oneOfSchemaToComponent: (schemaMapperProps: SchemaMapperPro
462
462
  accepts?: string[];
463
463
  source?: import("../../../types").UploadSource;
464
464
  validationAsyncState?: undefined;
465
+ base64Value: string | null;
465
466
  onUpload: (value: File | null) => Promise<void>;
466
467
  } & {
467
468
  kind: "input";
@@ -475,6 +475,7 @@ export declare const persistAsyncSchemaToComponent: (schemaMapperProps: SchemaMa
475
475
  accepts?: string[];
476
476
  source?: import("../../types").UploadSource;
477
477
  validationAsyncState?: undefined;
478
+ base64Value: string | null;
478
479
  onUpload: (value: File | null) => Promise<void>;
479
480
  } & {
480
481
  kind: "input";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "4.9.0",
3
+ "version": "4.9.1",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -46,17 +46,17 @@
46
46
  "@testing-library/jest-dom": "6.6.3",
47
47
  "@testing-library/react": "16.3.0",
48
48
  "@testing-library/user-event": "14.6.1",
49
- "@transferwise/components": "46.100.0",
49
+ "@transferwise/components": "46.100.1",
50
50
  "@transferwise/formatting": "^2.13.3",
51
51
  "@transferwise/icons": "3.22.3",
52
- "@transferwise/neptune-css": "14.24.4",
52
+ "@transferwise/neptune-css": "14.24.5",
53
53
  "@types/jest": "29.5.14",
54
54
  "@types/node": "22.15.34",
55
55
  "@types/react": "18.3.23",
56
56
  "@types/react-dom": "18.3.7",
57
57
  "@types/react-intl": "3.0.0",
58
- "@wise/art": "2.22.0",
59
- "@wise/components-theming": "^1.6.3",
58
+ "@wise/art": "2.23.0",
59
+ "@wise/components-theming": "^1.6.4",
60
60
  "babel-jest": "30.0.2",
61
61
  "esbuild": "0.25.5",
62
62
  "eslint-plugin-storybook": "9.0.15",