tf-checkout-react 1.2.10 → 1.2.13

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.10",
2
+ "version": "1.2.13",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -87,13 +87,13 @@
87
87
  "jwt-decode": "^3.1.2",
88
88
  "lodash": "^4.17.21",
89
89
  "lodash-es": "^4.17.21",
90
- "material-ui-phone-number": "^3.0.0",
91
90
  "moment-timezone": "^0.5.34",
92
91
  "nanoid": "^3.1.30",
93
92
  "prop-types": "^15.7.2",
94
93
  "react-bootstrap": "^2.0.2",
95
94
  "react-countdown": "^2.3.2",
96
95
  "react-inlinesvg": "^2.3.0",
96
+ "react-phone-input-2": "^2.15.1",
97
97
  "react-share": "^4.4.0",
98
98
  "yup": "^0.32.11"
99
99
  }
@@ -108,9 +108,11 @@ export interface IBillingInfoPage {
108
108
  logo?: string;
109
109
  showForgotPasswordButton?: boolean;
110
110
  showSignUpButton?: boolean;
111
+ brandOptIn?: boolean;
111
112
  }
112
113
 
113
114
  const LogicRunner: FC<{
115
+ brandOptIn?: boolean;
114
116
  values: any;
115
117
  setStates: React.Dispatch<any>;
116
118
  setFieldValue: any;
@@ -128,6 +130,7 @@ const LogicRunner: FC<{
128
130
  onGetStatesSuccess,
129
131
  onGetStatesError,
130
132
  shouldFetchCountries,
133
+ brandOptIn
131
134
  }) => {
132
135
  const prevCountry = useRef(values.country)
133
136
  useEffect(() => {
@@ -173,7 +176,7 @@ const LogicRunner: FC<{
173
176
  street_address: parsedData?.street_address || '',
174
177
  country: parsedData?.country || '1',
175
178
  zip: parsedData?.zip || '',
176
- brand_opt_in: parsedData?.brand_opt_in || false,
179
+ brand_opt_in: brandOptIn ? brandOptIn : (parsedData?.brand_opt_in || false),
177
180
  city: parsedData?.city || '',
178
181
  confirmPassword: '',
179
182
  password: '',
@@ -236,6 +239,7 @@ export const BillingInfoContainer = ({
236
239
  logo,
237
240
  showForgotPasswordButton = false,
238
241
  showSignUpButton = false,
242
+ brandOptIn = false,
239
243
  }: IBillingInfoPage) => {
240
244
  const themeMui = createTheme(themeOptions)
241
245
  const isWindowDefined = typeof window !== 'undefined'
@@ -287,7 +291,8 @@ export const BillingInfoContainer = ({
287
291
  const showDOB = getQueryVariable('age_required') === 'true'
288
292
  const showTicketHolders = getQueryVariable('names_required') === 'true'
289
293
  const eventId = getQueryVariable('event_id')
290
- const optedInFieldValue: boolean = _get(cartInfoData, 'optedIn', false)
294
+ const optedInFieldValue: boolean = brandOptIn
295
+ ? brandOptIn : _get(cartInfoData, 'optedIn', false)
291
296
  const ttfOptIn = Boolean(_get(cartInfoData, 'ttfOptIn', false))
292
297
  const hideTtfOptIn: boolean = _get(cartInfoData, 'hide_ttf_opt_in', true)
293
298
  const expirationTime = _get(cartInfoData, 'expiresAt')
@@ -616,6 +621,7 @@ export const BillingInfoContainer = ({
616
621
  <Form onSubmit={props.handleSubmit}>
617
622
  <ErrorFocus />
618
623
  <LogicRunner
624
+ brandOptIn={brandOptIn}
619
625
  values={props.values}
620
626
  setStates={setStates}
621
627
  setFieldValue={props.setFieldValue}
@@ -781,7 +787,6 @@ export const BillingInfoContainer = ({
781
787
  name={`${element.name}-${index}`}
782
788
  label={element.label}
783
789
  type={element.type}
784
- required={true}
785
790
  component={
786
791
  element.type === 'checkbox'
787
792
  ? CheckboxField
@@ -1,8 +1,10 @@
1
+ import 'react-phone-input-2/lib/material.css'
2
+
1
3
  import { FieldInputProps, FormikProps } from 'formik'
2
4
  import _debounce from 'lodash/debounce'
3
5
  import _get from 'lodash/get'
4
- import MuiPhoneNumber from 'material-ui-phone-number'
5
6
  import React, { useCallback, useEffect } from 'react'
7
+ import PhoneInput, { CountryData } from 'react-phone-input-2'
6
8
 
7
9
  import { validatePhoneNumber } from '../../api'
8
10
 
@@ -14,7 +16,7 @@ export interface IPhoneNumberField {
14
16
  // optional
15
17
  type: string;
16
18
  disableDropdown: boolean;
17
- fill: boolean
19
+ fill: boolean;
18
20
  }
19
21
 
20
22
  export const PhoneNumberField = ({
@@ -28,9 +30,10 @@ export const PhoneNumberField = ({
28
30
  values,
29
31
  initialValues,
30
32
  setFieldValue,
33
+ setFieldTouched,
31
34
  },
32
35
  disableDropdown = true,
33
- fill = false
36
+ fill = false,
34
37
  }: IPhoneNumberField) => {
35
38
  const error = _get(errors, field.name)
36
39
  const isTouched = Boolean(_get(touched, field.name))
@@ -42,6 +45,12 @@ export const PhoneNumberField = ({
42
45
  )
43
46
 
44
47
  useEffect(() => {
48
+ if (field.value === '+') {
49
+ setFieldError(field.name, '')
50
+ setFieldTouched(field.name, false)
51
+ return
52
+ }
53
+
45
54
  if (field.value) {
46
55
  setStatus({ [field.name]: true })
47
56
  }
@@ -66,19 +75,44 @@ export const PhoneNumberField = ({
66
75
  }, [field.value])
67
76
 
68
77
  return (
69
- <MuiPhoneNumber
70
- name={field.name}
71
- value={fill ? values.phone : initialValues.phone}
72
- onChange={(e: any) => setFieldValue(field.name, e)}
73
- variant="outlined"
74
- defaultCountry="us"
75
- disableDropdown={disableDropdown}
76
- label={label}
77
- error={!!error && isTouched}
78
- helperText={isTouched && error}
79
- fullWidth
80
- autoFormat={false}
81
- disableAreaCodes={true}
82
- />
78
+ <>
79
+ <PhoneInput
80
+ key={field.name}
81
+ value={fill ? values.phone : initialValues.phone}
82
+ onChange={(value, data: CountryData) => {
83
+ if (data.dialCode !== value) {
84
+ setFieldTouched(field.name, true)
85
+ setFieldValue(field.name, value)
86
+ } else {
87
+ setFieldValue(field.name, '')
88
+ setFieldError(field.name, '')
89
+ }
90
+ }}
91
+ country="us"
92
+ disableDropdown={disableDropdown}
93
+ specialLabel={label}
94
+ autoFormat={false}
95
+ inputStyle={{ width: '100%' }}
96
+ />
97
+ {!!error && isTouched && (
98
+ <p
99
+ style={{
100
+ fontFamily: '"Roboto","Helvetica","Arial",sans-serif',
101
+ fontWeight: '400',
102
+ fontSize: '0.75rem',
103
+ lineHeight: '1.66',
104
+ letterSpacing: '0.03333em',
105
+ textAlign: 'left',
106
+ marginTop: '3px',
107
+ marginRight: '14px',
108
+ marginBottom: '0',
109
+ marginLeft: '14px',
110
+ color: '#d32f2f',
111
+ }}
112
+ >
113
+ {error}
114
+ </p>
115
+ )}
116
+ </>
83
117
  )
84
118
  }
@@ -18,6 +18,7 @@ import TicketsTable, { ITicketTypes } from './ticketsTable'
18
18
  import { TicketResaleModal, InitialValuesTypes } from '../ticketResaleModal'
19
19
  import ConfirmModal from '../confirmModal'
20
20
  import { resaleTicket, removeFromResale } from '../../api'
21
+ import moment from 'moment-timezone'
21
22
 
22
23
  interface TicketTypes {
23
24
  currency: string;
@@ -166,8 +167,9 @@ export const OrderDetailsContainer = ({
166
167
  }
167
168
 
168
169
  let orderSummery = `ID ${data.id}, placed`
169
- if (data.date) {
170
- orderSummery += ` ${data.date}`
170
+ if (data.date && data.timezone) {
171
+ const date = moment.tz(data.date, data.timezone).format("dddd, DD MMMM YYYY")
172
+ orderSummery += ` ${date}`
171
173
  }
172
174
 
173
175
  return (
@@ -191,10 +191,9 @@ export const PaymentContainer = ({
191
191
  const {
192
192
  order_details: { order_hash },
193
193
  } = reviewData
194
- const paymentSuccessResponse =
195
- total === '0.00'
196
- ? await handleFreeSuccess(order_hash)
197
- : await handlePaymentSuccess(order_hash)
194
+ const paymentSuccessResponse = isFreeTickets
195
+ ? await handleFreeSuccess(order_hash)
196
+ : await handlePaymentSuccess(order_hash)
198
197
  if (paymentSuccessResponse.status === 200) {
199
198
  handlePayment(paymentSuccessResponse)
200
199
  setPaymentIsLoading(false)