tf-checkout-react 1.2.17 → 1.2.18

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.17",
2
+ "version": "1.2.18",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -287,6 +287,9 @@ export const BillingInfoContainer = React.memo(
287
287
  })
288
288
  const [loading, setLoading] = useState(true)
289
289
  const [error, setError] = useState(null)
290
+ const [phoneValidationIsLoading, setPhoneValidationIsLoading] = useState(
291
+ false
292
+ )
290
293
  const emailLogged =
291
294
  _get(userData, 'email', '') || _get(userValues, 'email', '')
292
295
  const firstNameLogged =
@@ -830,6 +833,9 @@ export const BillingInfoContainer = React.memo(
830
833
  ]
831
834
  )}
832
835
  disableDropdown={element.disableDropdown}
836
+ setPhoneValidationIsLoading={
837
+ setPhoneValidationIsLoading
838
+ }
833
839
  />
834
840
  </div>
835
841
  ))}
@@ -846,7 +852,7 @@ export const BillingInfoContainer = React.memo(
846
852
  type="submit"
847
853
  variant="contained"
848
854
  className="login-register-button"
849
- disabled={props.isSubmitting}
855
+ disabled={props.isSubmitting || phoneValidationIsLoading}
850
856
  >
851
857
  {props.isSubmitting ? (
852
858
  <CircularProgress size={26} />
@@ -15,6 +15,7 @@ export interface IPhoneNumberField {
15
15
  type: string;
16
16
  disableDropdown: boolean;
17
17
  fill: boolean;
18
+ setPhoneValidationIsLoading: (isLoading: boolean) => void;
18
19
  }
19
20
 
20
21
  export const PhoneNumberField = ({
@@ -31,6 +32,7 @@ export const PhoneNumberField = ({
31
32
  },
32
33
  disableDropdown = true,
33
34
  fill = false,
35
+ setPhoneValidationIsLoading,
34
36
  }: IPhoneNumberField) => {
35
37
  const error = _get(errors, field.name)
36
38
  const isTouched = Boolean(_get(touched, field.name))
@@ -42,11 +44,8 @@ export const PhoneNumberField = ({
42
44
  )
43
45
 
44
46
  useEffect(() => {
45
- if (field.value === '+') {
46
- setFieldError(field.name, '')
47
- setFieldTouched(field.name, false)
48
- setFieldValue(field.name, '')
49
- return
47
+ if (field.value) {
48
+ setPhoneValidationIsLoading(true)
50
49
  }
51
50
 
52
51
  debounceCb(async () => {
@@ -64,6 +63,8 @@ export const PhoneNumberField = ({
64
63
  if (values[field.name]) {
65
64
  setFieldError(field.name, message)
66
65
  }
66
+ } finally {
67
+ setPhoneValidationIsLoading(false)
67
68
  }
68
69
  })
69
70
  // eslint-disable-next-line