tf-checkout-react 1.0.66 → 1.0.67

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.
@@ -18,6 +18,7 @@ import FormGroup from '@mui/material/FormGroup';
18
18
  import FormControlLabel from '@mui/material/FormControlLabel';
19
19
  import Checkbox from '@mui/material/Checkbox';
20
20
  import Select from '@mui/material/Select';
21
+ import MuiPhoneNumber from 'material-ui-phone-number';
21
22
  import { createTheme, ThemeProvider } from '@mui/material/styles';
22
23
  import Container from '@mui/material/Container';
23
24
  import Alert from '@mui/material/Alert';
@@ -927,6 +928,8 @@ var ENV = {
927
928
  };
928
929
 
929
930
  var isWindowDefined = typeof window !== 'undefined';
931
+ var allowedOrigins = ['http://localhost', 'gtsb.io', 'gatsbyjs.io', 'https://www.houseofx.nyc', 'https://tickets-staging.houseofx.nyc'];
932
+ var origin = isWindowDefined && window.location.origin;
930
933
  var ttfHeaders = {
931
934
  Accept: 'application/vnd.api+json',
932
935
  'Content-Type': 'application/vnd.api+json'
@@ -936,7 +939,9 @@ if (isWindowDefined && localStorage.getItem('auth_guest_token')) {
936
939
  ttfHeaders['Authorization-Guest'] = /*#__PURE__*/localStorage.getItem('auth_guest_token');
937
940
  }
938
941
 
939
- if (isWindowDefined && window.location.origin !== 'https://www.houseofx.nyc' && window.location.origin !== 'https://tickets-staging.houseofx.nyc' && !window.location.origin.includes('http://localhost')) {
942
+ if (isWindowDefined && !allowedOrigins.some(function (el) {
943
+ return origin && origin.includes(el);
944
+ })) {
940
945
  ttfHeaders['X-Source-Origin'] = 'houseofx.nyc';
941
946
  }
942
947
 
@@ -982,7 +987,9 @@ publicRequest.interceptors.request.use(function (config) {
982
987
  config.headers = _updatedHeaders;
983
988
  }
984
989
 
985
- if (isWindowDefined && window.location.origin !== 'https://www.houseofx.nyc' && window.location.origin !== 'https://tickets-staging.houseofx.nyc' && !window.location.origin.includes('http://localhost')) {
990
+ if (isWindowDefined && !allowedOrigins.some(function (el) {
991
+ return origin && origin.includes(el);
992
+ })) {
986
993
  var _updatedHeaders2 = _extends({}, config.headers, {
987
994
  'X-Source-Origin': 'houseofx.nyc'
988
995
  });
@@ -1844,6 +1851,109 @@ var ErrorFocusInternal = /*#__PURE__*/function (_Component) {
1844
1851
 
1845
1852
  var ErrorFocus = /*#__PURE__*/connect(ErrorFocusInternal);
1846
1853
 
1854
+ var currencyNormalizerCreator = function currencyNormalizerCreator(value, currency) {
1855
+ return !value ? '' : "" + getCurrencySymbolByCurrency(currency) + value;
1856
+ };
1857
+ var createFixedFloatNormalizer = function createFixedFloatNormalizer(fixedValue) {
1858
+ return function (value) {
1859
+ return value || "" + value === '0' ? (+value).toFixed(fixedValue) : '';
1860
+ };
1861
+ };
1862
+ var getCurrencySymbolByCurrency = function getCurrencySymbolByCurrency(currency) {
1863
+ if (currency === void 0) {
1864
+ currency = '';
1865
+ }
1866
+
1867
+ switch (currency) {
1868
+ case 'GBP':
1869
+ return '£';
1870
+
1871
+ case 'EUR':
1872
+ return '€';
1873
+
1874
+ case 'INR':
1875
+ return '₹';
1876
+
1877
+ case 'JMD':
1878
+ return 'J$';
1879
+
1880
+ case 'NZD':
1881
+ return 'NZ$';
1882
+
1883
+ case 'MYR':
1884
+ return 'RM';
1885
+
1886
+ case 'MXN':
1887
+ return 'Mex$';
1888
+
1889
+ case 'SGD':
1890
+ return 'S$';
1891
+
1892
+ case 'AUD':
1893
+ return 'A$';
1894
+
1895
+ case 'ZAR':
1896
+ return 'R';
1897
+
1898
+ case 'ke':
1899
+ return 'Ksh';
1900
+
1901
+ case 'TRY':
1902
+ return '₺';
1903
+
1904
+ case 'CAD':
1905
+ return 'CA$';
1906
+
1907
+ case 'THB':
1908
+ return '฿';
1909
+
1910
+ case 'ISK':
1911
+ return 'Kr';
1912
+
1913
+ case 'SEK':
1914
+ return 'kr';
1915
+
1916
+ default:
1917
+ return 'US$';
1918
+ }
1919
+ };
1920
+ var removePlusSign = function removePlusSign(string) {
1921
+ if (string === void 0) {
1922
+ string = '';
1923
+ }
1924
+
1925
+ return string.replace('+', '');
1926
+ };
1927
+
1928
+ var _excluded$2 = ["label", "field", "form", "setFieldValue"];
1929
+ var FormikPhoneNumberField = function FormikPhoneNumberField(_ref) {
1930
+ var label = _ref.label,
1931
+ field = _ref.field,
1932
+ _ref$form = _ref.form,
1933
+ touched = _ref$form.touched,
1934
+ errors = _ref$form.errors,
1935
+ setFieldValue = _ref.setFieldValue,
1936
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
1937
+
1938
+ var error = _get(errors, field.name);
1939
+
1940
+ var isTouched = Boolean(_get(touched, field.name));
1941
+ return React.createElement(MuiPhoneNumber, Object.assign({
1942
+ name: 'phone',
1943
+ onChange: function onChange(e) {
1944
+ return setFieldValue("phone", removePlusSign(e));
1945
+ },
1946
+ variant: "outlined",
1947
+ defaultCountry: 'us',
1948
+ disableDropdown: true,
1949
+ label: label,
1950
+ error: !!error && isTouched,
1951
+ helperText: isTouched && error,
1952
+ fullWidth: true,
1953
+ autoFormat: false
1954
+ }, rest));
1955
+ };
1956
+
1847
1957
  var getImage = function getImage(name) {
1848
1958
  if (name === void 0) {
1849
1959
  name = '';
@@ -2505,7 +2615,9 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2505
2615
  label: element.label,
2506
2616
  type: element.type,
2507
2617
  validate: getValidateFunctions(element, states),
2508
- component: element.type === 'checkbox' ? CheckboxField : element.type === 'select' ? SelectField : CustomField,
2618
+ setFieldValue: props.setFieldValue,
2619
+ onBlur: props.handleBlur,
2620
+ component: element.type === 'checkbox' ? CheckboxField : element.type === 'select' ? SelectField : element.type === 'phone' ? FormikPhoneNumberField : CustomField,
2509
2621
  selectOptions: element.name === 'country' ? countries : element.name === 'state' ? states : [],
2510
2622
  theme: theme
2511
2623
  })));
@@ -2577,73 +2689,6 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
2577
2689
  }));
2578
2690
  };
2579
2691
 
2580
- var currencyNormalizerCreator = function currencyNormalizerCreator(value, currency) {
2581
- return !value ? '' : "" + getCurrencySymbolByCurrency(currency) + value;
2582
- };
2583
- var createFixedFloatNormalizer = function createFixedFloatNormalizer(fixedValue) {
2584
- return function (value) {
2585
- return value || "" + value === '0' ? (+value).toFixed(fixedValue) : '';
2586
- };
2587
- };
2588
- var getCurrencySymbolByCurrency = function getCurrencySymbolByCurrency(currency) {
2589
- if (currency === void 0) {
2590
- currency = '';
2591
- }
2592
-
2593
- switch (currency) {
2594
- case 'GBP':
2595
- return '£';
2596
-
2597
- case 'EUR':
2598
- return '€';
2599
-
2600
- case 'INR':
2601
- return '₹';
2602
-
2603
- case 'JMD':
2604
- return 'J$';
2605
-
2606
- case 'NZD':
2607
- return 'NZ$';
2608
-
2609
- case 'MYR':
2610
- return 'RM';
2611
-
2612
- case 'MXN':
2613
- return 'Mex$';
2614
-
2615
- case 'SGD':
2616
- return 'S$';
2617
-
2618
- case 'AUD':
2619
- return 'A$';
2620
-
2621
- case 'ZAR':
2622
- return 'R';
2623
-
2624
- case 'ke':
2625
- return 'Ksh';
2626
-
2627
- case 'TRY':
2628
- return '₺';
2629
-
2630
- case 'CAD':
2631
- return 'CA$';
2632
-
2633
- case 'THB':
2634
- return '฿';
2635
-
2636
- case 'ISK':
2637
- return 'Kr';
2638
-
2639
- case 'SEK':
2640
- return 'kr';
2641
-
2642
- default:
2643
- return 'US$';
2644
- }
2645
- };
2646
-
2647
2692
  var options = {
2648
2693
  style: {
2649
2694
  base: {