tf-checkout-react 1.0.102 → 1.0.105

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 (80) hide show
  1. package/dist/components/common/RedirectModal.d.ts +7 -0
  2. package/dist/components/ticketsContainer/TicketsSection.d.ts +2 -1
  3. package/dist/components/ticketsContainer/index.d.ts +2 -1
  4. package/dist/images/done.svg +3 -3
  5. package/dist/index.d.ts +1 -0
  6. package/dist/tf-checkout-react.cjs.development.js +71 -25
  7. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  8. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  9. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  10. package/dist/tf-checkout-react.esm.js +71 -26
  11. package/dist/tf-checkout-react.esm.js.map +1 -1
  12. package/package.json +89 -89
  13. package/src/.d.ts +2 -2
  14. package/src/api/index.ts +293 -278
  15. package/src/assets/images/done.svg +3 -3
  16. package/src/components/billing-info-container/index.tsx +796 -796
  17. package/src/components/billing-info-container/style.css +105 -105
  18. package/src/components/billing-info-container/utils.ts +224 -224
  19. package/src/components/common/CheckboxField.tsx +41 -41
  20. package/src/components/common/CustomField.tsx +84 -84
  21. package/src/components/common/FormikPhoneNumberField.tsx +51 -51
  22. package/src/components/common/Loader.tsx +9 -9
  23. package/src/components/common/RadioField.tsx +35 -35
  24. package/src/components/common/RedirectModal.tsx +43 -0
  25. package/src/components/common/SelectField.tsx +80 -80
  26. package/src/components/common/SnackbarAlert.tsx +53 -53
  27. package/src/components/common/index.tsx +4 -4
  28. package/src/components/confirmModal/index.tsx +51 -51
  29. package/src/components/confirmModal/style.css +21 -21
  30. package/src/components/confirmationContainer/config.ts +72 -72
  31. package/src/components/confirmationContainer/index.tsx +197 -197
  32. package/src/components/confirmationContainer/social-buttons.tsx +94 -94
  33. package/src/components/confirmationContainer/style.css +202 -202
  34. package/src/components/countdown/index.tsx +89 -89
  35. package/src/components/countdown/style.css +9 -9
  36. package/src/components/index.ts +7 -7
  37. package/src/components/loginModal/index.tsx +209 -209
  38. package/src/components/loginModal/style.css +71 -71
  39. package/src/components/myTicketsContainer/index.tsx +196 -196
  40. package/src/components/myTicketsContainer/row.tsx +41 -41
  41. package/src/components/myTicketsContainer/style.css +39 -39
  42. package/src/components/myTicketsContainer/tableConfig.tsx +34 -34
  43. package/src/components/orderDetailsContainer/index.tsx +249 -249
  44. package/src/components/orderDetailsContainer/style.css +72 -72
  45. package/src/components/orderDetailsContainer/ticketsTable.tsx +124 -124
  46. package/src/components/paymentContainer/index.tsx +284 -284
  47. package/src/components/registerModal/index.tsx +190 -190
  48. package/src/components/stripePayment/index.tsx +253 -253
  49. package/src/components/stripePayment/style.css +59 -59
  50. package/src/components/ticketResale/index.tsx +56 -56
  51. package/src/components/ticketResaleModal/index.tsx +210 -210
  52. package/src/components/ticketResaleModal/style.css +28 -28
  53. package/src/components/ticketsContainer/PromoCodeSection.tsx +99 -99
  54. package/src/components/ticketsContainer/ReferralLogic.tsx +33 -33
  55. package/src/components/ticketsContainer/TicketRow.tsx +83 -83
  56. package/src/components/ticketsContainer/TicketsSection.tsx +85 -81
  57. package/src/components/ticketsContainer/index.tsx +430 -430
  58. package/src/components/ticketsContainer/style.css +181 -181
  59. package/src/components/ticketsContainer/utils.ts +11 -11
  60. package/src/components/timerWidget/index.tsx +70 -70
  61. package/src/components/timerWidget/style.css +26 -26
  62. package/src/components/waitingList/index.tsx +178 -178
  63. package/src/components/waitingList/style.css +26 -26
  64. package/src/env.ts +20 -20
  65. package/src/index.ts +14 -13
  66. package/src/normalizers/index.ts +45 -45
  67. package/src/types/billing-info-data.ts +37 -37
  68. package/src/types/payment-field.ts +7 -7
  69. package/src/types/referral-promotion.ts +7 -7
  70. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +59 -59
  71. package/src/utils/downloadPDF.tsx +30 -30
  72. package/src/utils/formikErrorFocus.ts +24 -24
  73. package/src/utils/getImage.ts +14 -14
  74. package/src/utils/getQueryVariable.ts +13 -13
  75. package/src/utils/index.ts +5 -5
  76. package/src/utils/setConfigs.ts +26 -26
  77. package/src/utils/showZero.tsx +10 -10
  78. package/src/validators/index.ts +20 -20
  79. package/src/.DS_Store +0 -0
  80. package/src/components/.DS_Store +0 -0
@@ -1,197 +1,197 @@
1
- /* eslint-disable react/no-unescaped-entities */
2
- import React, { useEffect, useRef, useState } from 'react'
3
- import './style.css'
4
- import _map from 'lodash/map'
5
- import _get from 'lodash/get'
6
- import { IReferralPromotion } from '../../types'
7
- import { getConfirmationData } from '../../api'
8
- import { AxiosError } from 'axios'
9
- import SocialButtons from './social-buttons'
10
-
11
- export interface IShareButton {
12
- mainLabel: string;
13
- subLabel: string;
14
- platform: string;
15
- shareData: any;
16
- }
17
-
18
- export interface IConfirmationPage {
19
- isReferralEnabled: boolean;
20
- showDefaultShareButtons: boolean;
21
- messengerAppId: string;
22
- shareButtons: IShareButton[];
23
- onGetConfirmationDataSuccess: (res: any) => void;
24
- onGetConfirmationDataError: (e: AxiosError) => void;
25
- onLinkCopied: () => void;
26
- orderHash?: string;
27
- }
28
-
29
- export const ConfirmationContainer = ({
30
- isReferralEnabled,
31
- showDefaultShareButtons,
32
- messengerAppId = '',
33
- shareButtons = [],
34
- onGetConfirmationDataSuccess = () => {},
35
- onGetConfirmationDataError = () => {},
36
- orderHash,
37
- onLinkCopied = () => {}
38
- }: IConfirmationPage) => {
39
- const inputRef = useRef(null)
40
- const [data, setData] = useState<any>(null)
41
-
42
- // 1. get payment complete data ---> v1/order/${orderHash}/payment/complete/
43
-
44
- useEffect(() => {
45
- (async () => {
46
- const dataEncoded =
47
- (typeof window !== 'undefined' &&
48
- window.localStorage.getItem('checkoutData')) ||
49
- ''
50
-
51
- const dataDecoded = dataEncoded
52
- ? JSON.parse(dataEncoded)
53
- : { hash: orderHash }
54
- const { hash } = dataDecoded
55
-
56
- if (hash) {
57
- try {
58
- const response = await getConfirmationData(hash)
59
- const data = _get(response, 'data.data.attributes')
60
- data.personal_share_sales = data.personal_share_sales.map(
61
- (d: any) => {
62
- const salesData: IReferralPromotion = {
63
- label: `If your friends buy ${d.sales} tickets`,
64
- price: '',
65
- }
66
- if (d.price === 0) {
67
- salesData.subLabel = 'Your ticket becomes'
68
- salesData.price = 'FREE!'
69
- } else {
70
- salesData.subLabel = 'Your ticket goes down to'
71
- salesData.price = data.currency.symbol + d.price?.toFixed(2)
72
- }
73
-
74
- return salesData
75
- }
76
- )
77
- data.personal_share_sales.unshift({
78
- label: 'Your ticket is currently',
79
- price: data.currency.symbol + data.product_price?.toFixed(2),
80
- })
81
- setData(data)
82
- onGetConfirmationDataSuccess(response.data)
83
- } catch (error) {
84
- onGetConfirmationDataError(error.response)
85
- }
86
- }
87
- })()
88
- }, [])
89
-
90
- const onChangeShareLink = (e: React.ChangeEvent<HTMLInputElement>) => {
91
- const newData = { ...data, personal_share_link: e.target.value }
92
- setData(newData)
93
- }
94
-
95
- return (
96
- <div className="confirmation-page">
97
- {data && (
98
- <>
99
- <p className="title">Your Tickets are Confirmed!</p>
100
- <div className="share-message-section">
101
- <span className="main">Your tickets have been emailed to you</span>
102
- <span className="helper">
103
- Please bring them with you to the event
104
- </span>
105
- </div>
106
- {data.disable_referral === false && isReferralEnabled && (
107
- <>
108
- <div className="referral_text_image_section">
109
- <div className="referral_text_section">
110
- <div className="referral_title_text">
111
- Your ticket can become
112
- <span className="strong-text"> cheaper </span>
113
- or even
114
- <span className="strong-text"> FREE!</span>
115
- </div>
116
- <div className="referral_text">
117
- <span className="strong-text"> Invite friends </span>
118
- and we'll refund up to
119
- <span className="strong-text"> 100% </span>
120
- of your ticket money, if they buy tickets as well!
121
- </div>
122
- </div>
123
- <img src={data.product_image} alt="No Data" />
124
- </div>
125
- <div className="share_wrapper">
126
- <div className="share_section">
127
- <div className="invitation_section">
128
- <div className="invitation_title">
129
- How do you invite your friends?
130
- </div>
131
- <div className="share_buttons">
132
- <div className="share-by-link">
133
- <h5 className="share-by-link label">
134
- Send them this link:
135
- </h5>
136
- <div className="share-btn-inner">
137
- <input
138
- ref={inputRef}
139
- className="share-input"
140
- value={data.personal_share_link}
141
- onChange={onChangeShareLink}
142
- />
143
- <div
144
- className="share-by-link-copy-icon"
145
- onClick={() => {
146
- navigator.clipboard.writeText(
147
- _get(inputRef, 'current.value')
148
- )
149
- onLinkCopied()
150
- }}
151
- >
152
- <img
153
- src="https://img.icons8.com/office/50/000000/copy.png"
154
- alt="copy"
155
- />
156
- </div>
157
- </div>
158
- </div>
159
- {(showDefaultShareButtons || !!shareButtons.length) && (
160
- <SocialButtons
161
- showDefaultShareButtons={showDefaultShareButtons}
162
- name={data.product_name}
163
- appId={messengerAppId}
164
- shareLink={data.personal_share_link}
165
- shareButtons={shareButtons}
166
- />
167
- )}
168
- </div>
169
- </div>
170
- </div>
171
- <div className="pricing-section">
172
- <div className="invitation_title">How much cheaper?</div>
173
- {_map(data.personal_share_sales, (pricing, index) => (
174
- <div key={index} className="pricing-section_wrapper">
175
- <div className="pricing-section_label">
176
- {pricing.label}
177
- {pricing.subLabel && (
178
- <div className="pricing-section_sublabel">
179
- {pricing.subLabel}
180
- </div>
181
- )}
182
- </div>
183
- <div className="pricing-section_price">
184
- {' '}
185
- {pricing.price}
186
- </div>
187
- </div>
188
- ))}
189
- </div>
190
- </div>
191
- </>
192
- )}
193
- </>
194
- )}
195
- </div>
196
- )
197
- }
1
+ /* eslint-disable react/no-unescaped-entities */
2
+ import React, { useEffect, useRef, useState } from 'react'
3
+ import './style.css'
4
+ import _map from 'lodash/map'
5
+ import _get from 'lodash/get'
6
+ import { IReferralPromotion } from '../../types'
7
+ import { getConfirmationData } from '../../api'
8
+ import { AxiosError } from 'axios'
9
+ import SocialButtons from './social-buttons'
10
+
11
+ export interface IShareButton {
12
+ mainLabel: string;
13
+ subLabel: string;
14
+ platform: string;
15
+ shareData: any;
16
+ }
17
+
18
+ export interface IConfirmationPage {
19
+ isReferralEnabled: boolean;
20
+ showDefaultShareButtons: boolean;
21
+ messengerAppId: string;
22
+ shareButtons: IShareButton[];
23
+ onGetConfirmationDataSuccess: (res: any) => void;
24
+ onGetConfirmationDataError: (e: AxiosError) => void;
25
+ onLinkCopied: () => void;
26
+ orderHash?: string;
27
+ }
28
+
29
+ export const ConfirmationContainer = ({
30
+ isReferralEnabled,
31
+ showDefaultShareButtons,
32
+ messengerAppId = '',
33
+ shareButtons = [],
34
+ onGetConfirmationDataSuccess = () => {},
35
+ onGetConfirmationDataError = () => {},
36
+ orderHash,
37
+ onLinkCopied = () => {}
38
+ }: IConfirmationPage) => {
39
+ const inputRef = useRef(null)
40
+ const [data, setData] = useState<any>(null)
41
+
42
+ // 1. get payment complete data ---> v1/order/${orderHash}/payment/complete/
43
+
44
+ useEffect(() => {
45
+ (async () => {
46
+ const dataEncoded =
47
+ (typeof window !== 'undefined' &&
48
+ window.localStorage.getItem('checkoutData')) ||
49
+ ''
50
+
51
+ const dataDecoded = dataEncoded
52
+ ? JSON.parse(dataEncoded)
53
+ : { hash: orderHash }
54
+ const { hash } = dataDecoded
55
+
56
+ if (hash) {
57
+ try {
58
+ const response = await getConfirmationData(hash)
59
+ const data = _get(response, 'data.data.attributes')
60
+ data.personal_share_sales = data.personal_share_sales.map(
61
+ (d: any) => {
62
+ const salesData: IReferralPromotion = {
63
+ label: `If your friends buy ${d.sales} tickets`,
64
+ price: '',
65
+ }
66
+ if (d.price === 0) {
67
+ salesData.subLabel = 'Your ticket becomes'
68
+ salesData.price = 'FREE!'
69
+ } else {
70
+ salesData.subLabel = 'Your ticket goes down to'
71
+ salesData.price = data.currency.symbol + d.price?.toFixed(2)
72
+ }
73
+
74
+ return salesData
75
+ }
76
+ )
77
+ data.personal_share_sales.unshift({
78
+ label: 'Your ticket is currently',
79
+ price: data.currency.symbol + data.product_price?.toFixed(2),
80
+ })
81
+ setData(data)
82
+ onGetConfirmationDataSuccess(response.data)
83
+ } catch (error) {
84
+ onGetConfirmationDataError(error.response)
85
+ }
86
+ }
87
+ })()
88
+ }, [])
89
+
90
+ const onChangeShareLink = (e: React.ChangeEvent<HTMLInputElement>) => {
91
+ const newData = { ...data, personal_share_link: e.target.value }
92
+ setData(newData)
93
+ }
94
+
95
+ return (
96
+ <div className="confirmation-page">
97
+ {data && (
98
+ <>
99
+ <p className="title">Your Tickets are Confirmed!</p>
100
+ <div className="share-message-section">
101
+ <span className="main">Your tickets have been emailed to you</span>
102
+ <span className="helper">
103
+ Please bring them with you to the event
104
+ </span>
105
+ </div>
106
+ {data.disable_referral === false && isReferralEnabled && (
107
+ <>
108
+ <div className="referral_text_image_section">
109
+ <div className="referral_text_section">
110
+ <div className="referral_title_text">
111
+ Your ticket can become
112
+ <span className="strong-text"> cheaper </span>
113
+ or even
114
+ <span className="strong-text"> FREE!</span>
115
+ </div>
116
+ <div className="referral_text">
117
+ <span className="strong-text"> Invite friends </span>
118
+ and we'll refund up to
119
+ <span className="strong-text"> 100% </span>
120
+ of your ticket money, if they buy tickets as well!
121
+ </div>
122
+ </div>
123
+ <img src={data.product_image} alt="No Data" />
124
+ </div>
125
+ <div className="share_wrapper">
126
+ <div className="share_section">
127
+ <div className="invitation_section">
128
+ <div className="invitation_title">
129
+ How do you invite your friends?
130
+ </div>
131
+ <div className="share_buttons">
132
+ <div className="share-by-link">
133
+ <h5 className="share-by-link label">
134
+ Send them this link:
135
+ </h5>
136
+ <div className="share-btn-inner">
137
+ <input
138
+ ref={inputRef}
139
+ className="share-input"
140
+ value={data.personal_share_link}
141
+ onChange={onChangeShareLink}
142
+ />
143
+ <div
144
+ className="share-by-link-copy-icon"
145
+ onClick={() => {
146
+ navigator.clipboard.writeText(
147
+ _get(inputRef, 'current.value')
148
+ )
149
+ onLinkCopied()
150
+ }}
151
+ >
152
+ <img
153
+ src="https://img.icons8.com/office/50/000000/copy.png"
154
+ alt="copy"
155
+ />
156
+ </div>
157
+ </div>
158
+ </div>
159
+ {(showDefaultShareButtons || !!shareButtons.length) && (
160
+ <SocialButtons
161
+ showDefaultShareButtons={showDefaultShareButtons}
162
+ name={data.product_name}
163
+ appId={messengerAppId}
164
+ shareLink={data.personal_share_link}
165
+ shareButtons={shareButtons}
166
+ />
167
+ )}
168
+ </div>
169
+ </div>
170
+ </div>
171
+ <div className="pricing-section">
172
+ <div className="invitation_title">How much cheaper?</div>
173
+ {_map(data.personal_share_sales, (pricing, index) => (
174
+ <div key={index} className="pricing-section_wrapper">
175
+ <div className="pricing-section_label">
176
+ {pricing.label}
177
+ {pricing.subLabel && (
178
+ <div className="pricing-section_sublabel">
179
+ {pricing.subLabel}
180
+ </div>
181
+ )}
182
+ </div>
183
+ <div className="pricing-section_price">
184
+ {' '}
185
+ {pricing.price}
186
+ </div>
187
+ </div>
188
+ ))}
189
+ </div>
190
+ </div>
191
+ </>
192
+ )}
193
+ </>
194
+ )}
195
+ </div>
196
+ )
197
+ }
@@ -1,94 +1,94 @@
1
- import React from 'react';
2
- import { IShareButton } from'./index'
3
- import config from './config'
4
-
5
- const SocialComponent = ({ mainLabel, subLabel, platform, shareData }: IShareButton) => {
6
- const Component = config(platform)?.component
7
- const Icon = config(platform)?.icon
8
-
9
- return (
10
- <>
11
- {Component && (
12
- <Component {...shareData}>
13
- <div className='social-media-sharing'>
14
- <div className='share-icon'>
15
- <Icon size={32} round />
16
- </div>
17
- <span className="share-text">
18
- {mainLabel}
19
- <br /> {subLabel}
20
- </span>
21
- </div>
22
- </Component>
23
- )}
24
- </>
25
- )
26
- }
27
-
28
- interface SocialButtonsTypes {
29
- shareLink: string;
30
- name: string;
31
- appId: string;
32
- showDefaultShareButtons: boolean;
33
- shareButtons: IShareButton[]
34
- }
35
-
36
- const SocialButtons = ({ showDefaultShareButtons, shareLink, name, appId, shareButtons }: SocialButtonsTypes) => {
37
- return (
38
- <>
39
- <div className="convenient_buttons">
40
- or use one of these convenient buttons:
41
- </div>
42
- <div className="social-media-btns">
43
- {showDefaultShareButtons && (
44
- <>
45
- <SocialComponent
46
- mainLabel='Share on'
47
- subLabel='Facebook'
48
- platform='facebook'
49
- shareData={{
50
- quote: name,
51
- url: shareLink
52
- }}
53
- />
54
- <SocialComponent
55
- mainLabel='Tweet to your'
56
- subLabel='Followers'
57
- platform='twitter'
58
- shareData={{
59
- title: name,
60
- url: shareLink
61
- }}
62
- />
63
- <SocialComponent
64
- mainLabel='Message friends on'
65
- subLabel='Facebook'
66
- platform='messenger'
67
- shareData={{
68
- appId: appId,
69
- url: shareLink
70
- }}
71
- />
72
- <SocialComponent
73
- mainLabel='Message friends on'
74
- subLabel='Whatsapp'
75
- platform='whatsapp'
76
- shareData={{
77
- title: name,
78
- url: shareLink
79
- }}
80
- />
81
- </>
82
- )}
83
- {shareButtons.map((shareButton: IShareButton, index: number) => (
84
- <SocialComponent key={index} {...shareButton} />
85
- ))}
86
- </div>
87
- {(showDefaultShareButtons || shareButtons.length) && (
88
- <p>We <strong>never</strong> post on Facebook without your permission!</p>
89
- )}
90
- </>
91
- )
92
- }
93
-
94
- export default SocialButtons
1
+ import React from 'react';
2
+ import { IShareButton } from'./index'
3
+ import config from './config'
4
+
5
+ const SocialComponent = ({ mainLabel, subLabel, platform, shareData }: IShareButton) => {
6
+ const Component = config(platform)?.component
7
+ const Icon = config(platform)?.icon
8
+
9
+ return (
10
+ <>
11
+ {Component && (
12
+ <Component {...shareData}>
13
+ <div className='social-media-sharing'>
14
+ <div className='share-icon'>
15
+ <Icon size={32} round />
16
+ </div>
17
+ <span className="share-text">
18
+ {mainLabel}
19
+ <br /> {subLabel}
20
+ </span>
21
+ </div>
22
+ </Component>
23
+ )}
24
+ </>
25
+ )
26
+ }
27
+
28
+ interface SocialButtonsTypes {
29
+ shareLink: string;
30
+ name: string;
31
+ appId: string;
32
+ showDefaultShareButtons: boolean;
33
+ shareButtons: IShareButton[]
34
+ }
35
+
36
+ const SocialButtons = ({ showDefaultShareButtons, shareLink, name, appId, shareButtons }: SocialButtonsTypes) => {
37
+ return (
38
+ <>
39
+ <div className="convenient_buttons">
40
+ or use one of these convenient buttons:
41
+ </div>
42
+ <div className="social-media-btns">
43
+ {showDefaultShareButtons && (
44
+ <>
45
+ <SocialComponent
46
+ mainLabel='Share on'
47
+ subLabel='Facebook'
48
+ platform='facebook'
49
+ shareData={{
50
+ quote: name,
51
+ url: shareLink
52
+ }}
53
+ />
54
+ <SocialComponent
55
+ mainLabel='Tweet to your'
56
+ subLabel='Followers'
57
+ platform='twitter'
58
+ shareData={{
59
+ title: name,
60
+ url: shareLink
61
+ }}
62
+ />
63
+ <SocialComponent
64
+ mainLabel='Message friends on'
65
+ subLabel='Facebook'
66
+ platform='messenger'
67
+ shareData={{
68
+ appId: appId,
69
+ url: shareLink
70
+ }}
71
+ />
72
+ <SocialComponent
73
+ mainLabel='Message friends on'
74
+ subLabel='Whatsapp'
75
+ platform='whatsapp'
76
+ shareData={{
77
+ title: name,
78
+ url: shareLink
79
+ }}
80
+ />
81
+ </>
82
+ )}
83
+ {shareButtons.map((shareButton: IShareButton, index: number) => (
84
+ <SocialComponent key={index} {...shareButton} />
85
+ ))}
86
+ </div>
87
+ {(showDefaultShareButtons || shareButtons.length) && (
88
+ <p>We <strong>never</strong> post on Facebook without your permission!</p>
89
+ )}
90
+ </>
91
+ )
92
+ }
93
+
94
+ export default SocialButtons