tf-checkout-react 1.0.91 → 1.0.95

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.0.91",
2
+ "version": "1.0.95",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "prettier": {
31
31
  "printWidth": 80,
32
- "semi": true,
32
+ "semi": false,
33
33
  "singleQuote": true,
34
34
  "trailingComma": "es5"
35
35
  },
package/src/api/index.ts CHANGED
@@ -100,10 +100,7 @@ export const setXSourceOrigin = (sourceOrigin: string) => {
100
100
  }
101
101
 
102
102
  export const setCustomHeader = (response: any) => {
103
- const guestHeaderResponseValue = _get(
104
- response,
105
- 'headers.authorization-guest'
106
- )
103
+ const guestHeaderResponseValue = _get(response, 'headers.authorization-guest')
107
104
  const guestHeaderExistingValue = _get(
108
105
  response,
109
106
  'config.headers[Authorization-Guest]'
@@ -141,10 +138,10 @@ export function getTickets(id: string | number, promoCode: string) {
141
138
  .get(`v1/event/${id}/tickets/`, {
142
139
  headers: promoCode
143
140
  ? {
144
- ...ttfHeaders,
145
- 'Promotion-Event': String(id),
146
- 'Promotion-Code': promoCode,
147
- }
141
+ ...ttfHeaders,
142
+ 'Promotion-Event': String(id),
143
+ 'Promotion-Code': promoCode,
144
+ }
148
145
  : { ...ttfHeaders },
149
146
  })
150
147
  .catch(error => {
@@ -241,7 +238,7 @@ export const getStates = (countryId: string) =>
241
238
 
242
239
  export const getOrders = (page: number, limit: number, eventSlug: string) =>
243
240
  publicRequest.get(
244
- `/v1/account/orders/?page=${page}&limit=${limit}&filter[event]=${eventSlug}`
241
+ `/v1/account/orders/?page=${page}&limit=${limit}&filter[event]=${eventSlug}&filter[brand]=${CONFIGS.BRAND_SLUG}`
245
242
  )
246
243
 
247
244
  export const getOrderDetails = (orderId: string) =>
@@ -252,3 +249,8 @@ export const addToWaitingList = (id: number, data: any) =>
252
249
 
253
250
  export const getConditions = (eventId: string) =>
254
251
  publicRequest.get(`v1/event/${eventId}/conditions`)
252
+
253
+ export const postReferralVisits = (eventId: string, referralId: string) =>
254
+ publicRequest.post(`/v1/event/${eventId}/referrer/`, {
255
+ referrer: `${referralId}`,
256
+ })
@@ -263,6 +263,7 @@ export const BillingInfoContainer = ({
263
263
  const optedInFieldValue: boolean = _get(cartInfoData, 'optedIn', false)
264
264
  const ttfOptIn: boolean = Boolean(_get(cartInfoData, 'ttfOptIn', false))
265
265
  const hideTtfOptIn: boolean = _get(cartInfoData, 'hide_ttf_opt_in', true)
266
+ const flagRequirePhone: boolean = _get(cartInfoData, 'flagRequirePhone', false)
266
267
 
267
268
  // Get prevProps
268
269
  const prevData = useRef(data)
@@ -618,6 +619,9 @@ export const BillingInfoContainer = ({
618
619
  if (el.name === 'ttf_opt_in' && hideTtfOptIn) {
619
620
  return false
620
621
  }
622
+ if (el.name === 'phone' && !flagRequirePhone) {
623
+ el.required = true
624
+ }
621
625
  return true
622
626
  }),
623
627
  element =>
@@ -638,7 +642,8 @@ export const BillingInfoContainer = ({
638
642
  type={element.type}
639
643
  validate={getValidateFunctions(
640
644
  element,
641
- states
645
+ states,
646
+ props.values
642
647
  )}
643
648
  setFieldValue={props.setFieldValue}
644
649
  onBlur={props.handleBlur}
@@ -8,6 +8,7 @@ import { CONFIGS } from '../../utils'
8
8
  import { IGroupItem } from '../../types'
9
9
  import { combineValidators, requiredValidator } from '../../validators'
10
10
  import { nanoid } from 'nanoid'
11
+ import { FormikValues } from 'formik'
11
12
 
12
13
  export interface ILoggedInValues {
13
14
  emailLogged?: string;
@@ -176,7 +177,8 @@ export const createCheckoutDataBody = (
176
177
 
177
178
  export const getValidateFunctions = (
178
179
  element: IGroupItem,
179
- states: Array<{ [key: string]: any }>
180
+ states: Array<{ [key: string]: any }>,
181
+ values: FormikValues
180
182
  ) => {
181
183
  const validationFunctions: any[] = []
182
184
 
@@ -193,6 +195,14 @@ export const getValidateFunctions = (
193
195
  validationFunctions.push(element.onValidate)
194
196
  }
195
197
 
198
+ if (element.name === 'confirmEmail') {
199
+ const isSameEmail = (confirmEmail?: string) =>
200
+ values.email !== confirmEmail
201
+ ? 'Please confirm your email address correctly'
202
+ : null
203
+ validationFunctions.push(isSameEmail)
204
+ }
205
+
196
206
  return combineValidators(...validationFunctions)
197
207
  }
198
208
 
@@ -84,6 +84,9 @@ const SocialButtons = ({ showDefaultShareButtons, shareLink, name, appId, shareB
84
84
  <SocialComponent key={index} {...shareButton} />
85
85
  ))}
86
86
  </div>
87
+ {(showDefaultShareButtons || shareButtons.length) && (
88
+ <p>We <strong>never</strong> post on Facebook without your permission!</p>
89
+ )}
87
90
  </>
88
91
  )
89
92
  }
@@ -0,0 +1,33 @@
1
+ import { useEffect } from 'react'
2
+ import { postReferralVisits } from '../../api'
3
+
4
+ interface IReferralLogicProps {
5
+ eventId: string | number;
6
+ }
7
+
8
+ export const ReferralLogic = (props: IReferralLogicProps) => {
9
+ const { eventId } = props
10
+ const isWindowDefined = typeof window !== 'undefined'
11
+
12
+ useEffect(() => {
13
+ if (isWindowDefined) {
14
+ const params: URLSearchParams = new URL(`${window.location}`).searchParams
15
+ const referralId = params.get('ttf_r') || ''
16
+ const isAlreadyCounted = !!localStorage.getItem('referral_key')
17
+
18
+ if (referralId && eventId && !isAlreadyCounted) {
19
+ (async () => {
20
+ try {
21
+ await postReferralVisits(`${eventId}`, referralId)
22
+ localStorage.setItem(
23
+ 'referral_key',
24
+ [eventId, '.', referralId].join('')
25
+ )
26
+ } catch (error) {}
27
+ })()
28
+ }
29
+ }
30
+ }, [])
31
+
32
+ return null
33
+ }
@@ -57,7 +57,7 @@ export const TicketsSection = ({
57
57
  <p>{ticketPrice}</p>
58
58
  {!isSoldOut && !ticketIsFree && (
59
59
  <p className="fees">
60
- {ticket.taxesIncluded ? '(incl. Fees)' : '(excl. Fees)'}
60
+ {ticket.feeIncluded ? '(incl. Fees)' : '(excl. Fees)'}
61
61
  </p>
62
62
  )}
63
63
  </div>
@@ -26,6 +26,7 @@ import { createCheckoutDataBodyWithDefaultHolder, getQueryVariable } from '../..
26
26
  import { ThemeProvider } from '@mui/private-theming'
27
27
  import { createTheme, ThemeOptions } from '@mui/material'
28
28
  import { CSSProperties } from '@mui/styles'
29
+ import { ReferralLogic } from './ReferralLogic'
29
30
 
30
31
  function Loader() {
31
32
  return (
@@ -315,6 +316,7 @@ export const TicketsContainer = ({
315
316
 
316
317
  return (
317
318
  <ThemeProvider theme={themeMui}>
319
+ <ReferralLogic eventId={eventId} />
318
320
  <div className={`get-tickets-page ${theme}`} style={contentStyle}>
319
321
  {isLoading ? (
320
322
  <Loader />