tf-checkout-react 1.0.100 → 1.0.104

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.
Files changed (84) hide show
  1. package/dist/components/billing-info-container/index.d.ts +3 -1
  2. package/dist/components/common/RedirectModal.d.ts +7 -0
  3. package/dist/components/common/SnackbarAlert.d.ts +13 -0
  4. package/dist/components/confirmationContainer/index.d.ts +2 -1
  5. package/dist/components/ticketsContainer/index.d.ts +2 -1
  6. package/dist/env.d.ts +1 -0
  7. package/dist/images/done.svg +3 -3
  8. package/dist/index.d.ts +1 -0
  9. package/dist/tf-checkout-react.cjs.development.js +317 -136
  10. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  11. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  12. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  13. package/dist/tf-checkout-react.esm.js +318 -138
  14. package/dist/tf-checkout-react.esm.js.map +1 -1
  15. package/dist/tf-checkout-styles.css +1 -1
  16. package/package.json +89 -89
  17. package/src/.DS_Store +0 -0
  18. package/src/.d.ts +2 -2
  19. package/src/api/index.ts +293 -278
  20. package/src/assets/images/done.svg +3 -3
  21. package/src/components/.DS_Store +0 -0
  22. package/src/components/billing-info-container/index.tsx +796 -777
  23. package/src/components/billing-info-container/style.css +105 -105
  24. package/src/components/billing-info-container/utils.ts +224 -224
  25. package/src/components/common/CheckboxField.tsx +41 -41
  26. package/src/components/common/CustomField.tsx +84 -84
  27. package/src/components/common/FormikPhoneNumberField.tsx +51 -51
  28. package/src/components/common/Loader.tsx +9 -9
  29. package/src/components/common/RadioField.tsx +35 -35
  30. package/src/components/common/RedirectModal.tsx +43 -0
  31. package/src/components/common/SelectField.tsx +80 -80
  32. package/src/components/common/SnackbarAlert.tsx +54 -0
  33. package/src/components/common/index.tsx +4 -4
  34. package/src/components/confirmModal/index.tsx +51 -51
  35. package/src/components/confirmModal/style.css +21 -21
  36. package/src/components/confirmationContainer/config.ts +72 -72
  37. package/src/components/confirmationContainer/index.tsx +197 -194
  38. package/src/components/confirmationContainer/social-buttons.tsx +94 -94
  39. package/src/components/confirmationContainer/style.css +202 -202
  40. package/src/components/countdown/index.tsx +89 -89
  41. package/src/components/countdown/style.css +9 -9
  42. package/src/components/index.ts +7 -7
  43. package/src/components/loginModal/index.tsx +209 -209
  44. package/src/components/loginModal/style.css +71 -71
  45. package/src/components/myTicketsContainer/index.tsx +196 -137
  46. package/src/components/myTicketsContainer/row.tsx +41 -41
  47. package/src/components/myTicketsContainer/style.css +39 -39
  48. package/src/components/myTicketsContainer/tableConfig.tsx +34 -34
  49. package/src/components/orderDetailsContainer/index.tsx +249 -249
  50. package/src/components/orderDetailsContainer/style.css +72 -72
  51. package/src/components/orderDetailsContainer/ticketsTable.tsx +124 -124
  52. package/src/components/paymentContainer/index.tsx +284 -284
  53. package/src/components/registerModal/index.tsx +190 -190
  54. package/src/components/stripePayment/index.tsx +253 -253
  55. package/src/components/stripePayment/style.css +59 -59
  56. package/src/components/ticketResale/index.tsx +56 -56
  57. package/src/components/ticketResaleModal/index.tsx +210 -210
  58. package/src/components/ticketResaleModal/style.css +28 -28
  59. package/src/components/ticketsContainer/PromoCodeSection.tsx +99 -99
  60. package/src/components/ticketsContainer/ReferralLogic.tsx +33 -33
  61. package/src/components/ticketsContainer/TicketRow.tsx +83 -83
  62. package/src/components/ticketsContainer/TicketsSection.tsx +81 -81
  63. package/src/components/ticketsContainer/index.tsx +427 -409
  64. package/src/components/ticketsContainer/style.css +181 -181
  65. package/src/components/ticketsContainer/utils.ts +11 -11
  66. package/src/components/timerWidget/index.tsx +70 -70
  67. package/src/components/timerWidget/style.css +26 -26
  68. package/src/components/waitingList/index.tsx +178 -178
  69. package/src/components/waitingList/style.css +26 -26
  70. package/src/env.ts +20 -19
  71. package/src/index.ts +14 -13
  72. package/src/normalizers/index.ts +45 -45
  73. package/src/types/billing-info-data.ts +37 -37
  74. package/src/types/payment-field.ts +7 -7
  75. package/src/types/referral-promotion.ts +7 -7
  76. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +59 -59
  77. package/src/utils/downloadPDF.tsx +30 -30
  78. package/src/utils/formikErrorFocus.ts +24 -24
  79. package/src/utils/getImage.ts +14 -14
  80. package/src/utils/getQueryVariable.ts +13 -13
  81. package/src/utils/index.ts +5 -5
  82. package/src/utils/setConfigs.ts +26 -26
  83. package/src/utils/showZero.tsx +10 -10
  84. package/src/validators/index.ts +20 -20
@@ -1,7 +1,7 @@
1
- export interface IReferralPromotion {
2
- label: string;
3
- price: string;
4
- id?: number | string;
5
-
6
- subLabel?: string;
7
- }
1
+ export interface IReferralPromotion {
2
+ label: string;
3
+ price: string;
4
+ id?: number | string;
5
+
6
+ subLabel?: string;
7
+ }
@@ -1,59 +1,59 @@
1
- import _get from 'lodash/get'
2
-
3
- interface ICheckoutBody {
4
- attributes: {
5
- [key: string]: any;
6
- };
7
- }
8
-
9
- interface IticketHolder {
10
- first_name?: string;
11
- last_name?: string;
12
- phone?: string;
13
- email?: string;
14
- }
15
-
16
- export const createCheckoutDataBodyWithDefaultHolder = (
17
- ticketsQuantity: number,
18
- logedInValues: {},
19
- includeDob: boolean = false
20
- ): ICheckoutBody => {
21
- const ticket_holders: IticketHolder[] = []
22
-
23
- const first_name =
24
- _get(logedInValues, 'firstName') || _get(logedInValues, 'first_name') || ''
25
- const last_name =
26
- _get(logedInValues, 'lastName', '') ||
27
- _get(logedInValues, 'last_name') ||
28
- ''
29
- const phone = _get(logedInValues, 'phone', '')
30
- const email = _get(logedInValues, 'email', '')
31
-
32
- for (let i = 0; i <= ticketsQuantity - 1; i++) {
33
- const individualHolder = i
34
- ? { first_name: '', last_name: '', phone: '', email: '' }
35
- : { first_name, last_name, phone, email }
36
-
37
- ticket_holders.push(individualHolder)
38
- }
39
-
40
- const body: ICheckoutBody = {
41
- attributes: {
42
- ...logedInValues,
43
- email,
44
- confirm_email: email,
45
- first_name,
46
- last_name,
47
- ticket_holders,
48
- },
49
- }
50
-
51
- if (includeDob) {
52
- const holderAgeDate = new Date(_get(logedInValues, 'holderAge', ''))
53
- body.attributes.dob_day = holderAgeDate.getDate()
54
- body.attributes.dob_month = holderAgeDate.getMonth() + 1
55
- body.attributes.dob_year = holderAgeDate.getFullYear()
56
- }
57
-
58
- return body
59
- }
1
+ import _get from 'lodash/get'
2
+
3
+ interface ICheckoutBody {
4
+ attributes: {
5
+ [key: string]: any;
6
+ };
7
+ }
8
+
9
+ interface IticketHolder {
10
+ first_name?: string;
11
+ last_name?: string;
12
+ phone?: string;
13
+ email?: string;
14
+ }
15
+
16
+ export const createCheckoutDataBodyWithDefaultHolder = (
17
+ ticketsQuantity: number,
18
+ logedInValues: {},
19
+ includeDob: boolean = false
20
+ ): ICheckoutBody => {
21
+ const ticket_holders: IticketHolder[] = []
22
+
23
+ const first_name =
24
+ _get(logedInValues, 'firstName') || _get(logedInValues, 'first_name') || ''
25
+ const last_name =
26
+ _get(logedInValues, 'lastName', '') ||
27
+ _get(logedInValues, 'last_name') ||
28
+ ''
29
+ const phone = _get(logedInValues, 'phone', '')
30
+ const email = _get(logedInValues, 'email', '')
31
+
32
+ for (let i = 0; i <= ticketsQuantity - 1; i++) {
33
+ const individualHolder = i
34
+ ? { first_name: '', last_name: '', phone: '', email: '' }
35
+ : { first_name, last_name, phone, email }
36
+
37
+ ticket_holders.push(individualHolder)
38
+ }
39
+
40
+ const body: ICheckoutBody = {
41
+ attributes: {
42
+ ...logedInValues,
43
+ email,
44
+ confirm_email: email,
45
+ first_name,
46
+ last_name,
47
+ ticket_holders,
48
+ },
49
+ }
50
+
51
+ if (includeDob) {
52
+ const holderAgeDate = new Date(_get(logedInValues, 'holderAge', ''))
53
+ body.attributes.dob_day = holderAgeDate.getDate()
54
+ body.attributes.dob_month = holderAgeDate.getMonth() + 1
55
+ body.attributes.dob_year = holderAgeDate.getFullYear()
56
+ }
57
+
58
+ return body
59
+ }
@@ -1,30 +1,30 @@
1
- export const downloadPDF = (pdfUrl: string) => {
2
- if (typeof window === 'undefined') return
3
-
4
- const accessToken: string | null = localStorage.getItem('access_token')
5
-
6
- if (!accessToken) return
7
-
8
- fetch(pdfUrl, {
9
- headers: {
10
- Authorization: `Bearer ${accessToken}`,
11
- },
12
- })
13
- .then(async response => {
14
- const blobValue = await response.blob()
15
- const fileNameHeader = response.headers.get("content-disposition") || ''
16
- const fileName = fileNameHeader.split('"')[1]
17
- return { blobValue, fileName }
18
- })
19
- .then(({ blobValue, fileName }) => {
20
- if (!fileName) return
21
- const file = new Blob([blobValue], { type: 'application/pdf' })
22
- const fileURL = URL.createObjectURL(file)
23
- const link = document.createElement('a')
24
- link.href = fileURL
25
- link.setAttribute('download', fileName)
26
- document.body.appendChild(link)
27
- link.click()
28
- document.body.removeChild(link)
29
- })
30
- }
1
+ export const downloadPDF = (pdfUrl: string) => {
2
+ if (typeof window === 'undefined') return
3
+
4
+ const accessToken: string | null = localStorage.getItem('access_token')
5
+
6
+ if (!accessToken) return
7
+
8
+ fetch(pdfUrl, {
9
+ headers: {
10
+ Authorization: `Bearer ${accessToken}`,
11
+ },
12
+ })
13
+ .then(async response => {
14
+ const blobValue = await response.blob()
15
+ const fileNameHeader = response.headers.get("content-disposition") || ''
16
+ const fileName = fileNameHeader.split('"')[1]
17
+ return { blobValue, fileName }
18
+ })
19
+ .then(({ blobValue, fileName }) => {
20
+ if (!fileName) return
21
+ const file = new Blob([blobValue], { type: 'application/pdf' })
22
+ const fileURL = URL.createObjectURL(file)
23
+ const link = document.createElement('a')
24
+ link.href = fileURL
25
+ link.setAttribute('download', fileName)
26
+ document.body.appendChild(link)
27
+ link.click()
28
+ document.body.removeChild(link)
29
+ })
30
+ }
@@ -1,24 +1,24 @@
1
- import { connect, FormikContextType } from 'formik'
2
- import { Component } from 'react'
3
-
4
- interface IProps {
5
- formik: FormikContextType<any>;
6
- }
7
-
8
- class ErrorFocusInternal extends Component<IProps> {
9
- public componentDidUpdate(prevProps: IProps) {
10
- const { isSubmitting, isValidating, errors } = prevProps.formik
11
- const keys = Object.keys(errors)
12
- if (keys.length > 0 && isSubmitting && !isValidating) {
13
- const selector = `[name="${keys[0]}"]`
14
- const errorElement = document.querySelector(selector) as HTMLElement
15
- if (errorElement) {
16
- errorElement.focus()
17
- }
18
- }
19
- }
20
-
21
- public render = () => null;
22
- }
23
-
24
- export const ErrorFocus = connect<{}>(ErrorFocusInternal)
1
+ import { connect, FormikContextType } from 'formik'
2
+ import { Component } from 'react'
3
+
4
+ interface IProps {
5
+ formik: FormikContextType<any>;
6
+ }
7
+
8
+ class ErrorFocusInternal extends Component<IProps> {
9
+ public componentDidUpdate(prevProps: IProps) {
10
+ const { isSubmitting, isValidating, errors } = prevProps.formik
11
+ const keys = Object.keys(errors)
12
+ if (keys.length > 0 && isSubmitting && !isValidating) {
13
+ const selector = `[name="${keys[0]}"]`
14
+ const errorElement = document.querySelector(selector) as HTMLElement
15
+ if (errorElement) {
16
+ errorElement.focus()
17
+ }
18
+ }
19
+ }
20
+
21
+ public render = () => null;
22
+ }
23
+
24
+ export const ErrorFocus = connect<{}>(ErrorFocusInternal)
@@ -1,14 +1,14 @@
1
- export const getImage = (name: string = ''): any => {
2
- let image: any = ''
3
-
4
- if (!name.trim().length) {
5
- return image
6
- }
7
-
8
- if (process.env.NODE_ENV === 'production') {
9
- image = require(`./images/${name}`)
10
- return image.default
11
- }
12
-
13
- return image
14
- }
1
+ export const getImage = (name: string = ''): any => {
2
+ let image: any = ''
3
+
4
+ if (!name.trim().length) {
5
+ return image
6
+ }
7
+
8
+ if (process.env.NODE_ENV === 'production') {
9
+ image = require(`./images/${name}`)
10
+ return image.default
11
+ }
12
+
13
+ return image
14
+ }
@@ -1,13 +1,13 @@
1
- export const getQueryVariable = (variable: string) => {
2
- if (typeof window !== 'undefined') {
3
- const query = window.location.search.substring(1)
4
- const vars = query.split('&')
5
- for (let i = 0; i < vars.length; i++) {
6
- const pair = vars[i].split('=')
7
- if (pair[0] === variable) {
8
- return pair[1]
9
- }
10
- }
11
- }
12
- return false
13
- }
1
+ export const getQueryVariable = (variable: string) => {
2
+ if (typeof window !== 'undefined') {
3
+ const query = window.location.search.substring(1)
4
+ const vars = query.split('&')
5
+ for (let i = 0; i < vars.length; i++) {
6
+ const pair = vars[i].split('=')
7
+ if (pair[0] === variable) {
8
+ return pair[1]
9
+ }
10
+ }
11
+ }
12
+ return false
13
+ }
@@ -1,5 +1,5 @@
1
- export { setConfigs, CONFIGS } from './setConfigs'
2
- export { getQueryVariable } from './getQueryVariable'
3
- export { ErrorFocus } from './formikErrorFocus'
4
- export { downloadPDF } from './downloadPDF'
5
- export { createCheckoutDataBodyWithDefaultHolder } from './createCheckoutDataBodyWithDefaultHolder'
1
+ export { setConfigs, CONFIGS } from './setConfigs'
2
+ export { getQueryVariable } from './getQueryVariable'
3
+ export { ErrorFocus } from './formikErrorFocus'
4
+ export { downloadPDF } from './downloadPDF'
5
+ export { createCheckoutDataBodyWithDefaultHolder } from './createCheckoutDataBodyWithDefaultHolder'
@@ -1,26 +1,26 @@
1
- import _forEach from 'lodash/forEach'
2
- import { publicRequest, setXSourceOrigin } from '../api'
3
-
4
- interface IConfigs {
5
- BASE_URL: string;
6
- CLIENT_ID: string;
7
- CLIENT_SECRET: string;
8
- STRIPE_PUBLISHABLE_KEY: string;
9
- X_SOURCE_ORIGIN: string;
10
-
11
- [key: string]: string | number;
12
- }
13
-
14
- export const CONFIGS: IConfigs = {} as IConfigs
15
-
16
- export const setConfigs = (configs: IConfigs) => {
17
- _forEach(configs, (value, key) => {
18
- CONFIGS[key] = value
19
- })
20
-
21
- publicRequest.setBaseUrl(CONFIGS.BASE_URL)
22
-
23
- if (CONFIGS.X_SOURCE_ORIGIN) {
24
- setXSourceOrigin(CONFIGS.X_SOURCE_ORIGIN)
25
- }
26
- }
1
+ import _forEach from 'lodash/forEach'
2
+ import { publicRequest, setXSourceOrigin } from '../api'
3
+
4
+ interface IConfigs {
5
+ BASE_URL: string;
6
+ CLIENT_ID: string;
7
+ CLIENT_SECRET: string;
8
+ STRIPE_PUBLISHABLE_KEY: string;
9
+ X_SOURCE_ORIGIN: string;
10
+
11
+ [key: string]: string | number;
12
+ }
13
+
14
+ export const CONFIGS: IConfigs = {} as IConfigs
15
+
16
+ export const setConfigs = (configs: IConfigs) => {
17
+ _forEach(configs, (value, key) => {
18
+ CONFIGS[key] = value
19
+ })
20
+
21
+ publicRequest.setBaseUrl(CONFIGS.BASE_URL)
22
+
23
+ if (CONFIGS.X_SOURCE_ORIGIN) {
24
+ setXSourceOrigin(CONFIGS.X_SOURCE_ORIGIN)
25
+ }
26
+ }
@@ -1,10 +1,10 @@
1
- import _isNumber from 'lodash/isNumber'
2
-
3
- export const showZero = (value = 0) => {
4
- const intNumber = Number(value)
5
- return _isNumber(intNumber)
6
- ? intNumber >= 0 && intNumber < 10
7
- ? '0' + intNumber
8
- : intNumber
9
- : null
10
- }
1
+ import _isNumber from 'lodash/isNumber'
2
+
3
+ export const showZero = (value = 0) => {
4
+ const intNumber = Number(value)
5
+ return _isNumber(intNumber)
6
+ ? intNumber >= 0 && intNumber < 10
7
+ ? '0' + intNumber
8
+ : intNumber
9
+ : null
10
+ }
@@ -1,20 +1,20 @@
1
- const emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
2
-
3
- export const combineValidators = (...validators: any) => (...value: any) => {
4
- for (let i = 0; i < validators.length; ++i) {
5
- const error_message = validators[i](...value)
6
- if (error_message) return error_message
7
- }
8
- }
9
-
10
- export const requiredValidator = (value?: string | number, message?: string): string => {
11
- let errorMessage = ''
12
- if (!value) {
13
- errorMessage = message || 'Required'
14
- }
15
- return errorMessage
16
- }
17
-
18
- export const emailValidator = (email: string) => {
19
- return !emailRegex.test(email) ? 'Please enter a valid email address' : ''
20
- }
1
+ const emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
2
+
3
+ export const combineValidators = (...validators: any) => (...value: any) => {
4
+ for (let i = 0; i < validators.length; ++i) {
5
+ const error_message = validators[i](...value)
6
+ if (error_message) return error_message
7
+ }
8
+ }
9
+
10
+ export const requiredValidator = (value?: string | number, message?: string): string => {
11
+ let errorMessage = ''
12
+ if (!value) {
13
+ errorMessage = message || 'Required'
14
+ }
15
+ return errorMessage
16
+ }
17
+
18
+ export const emailValidator = (email: string) => {
19
+ return !emailRegex.test(email) ? 'Please enter a valid email address' : ''
20
+ }