tf-checkout-react 1.0.103 → 1.0.106
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/dist/api/index.d.ts +3 -1
- package/dist/components/common/CustomField.d.ts +1 -1
- package/dist/components/common/DatePickerField.d.ts +14 -0
- package/dist/components/common/RedirectModal.d.ts +7 -0
- package/dist/components/countdown/index.d.ts +3 -1
- package/dist/components/orderDetailsContainer/ticketsTable.d.ts +2 -0
- package/dist/components/rsvpContainer/index.d.ts +7 -0
- package/dist/components/ticketResale/index.d.ts +5 -3
- package/dist/components/ticketsContainer/AccessCodeSection.d.ts +7 -0
- package/dist/components/ticketsContainer/PromoCodeSection.d.ts +5 -9
- package/dist/components/ticketsContainer/TicketsSection.d.ts +6 -3
- package/dist/components/ticketsContainer/index.d.ts +9 -2
- package/dist/components/timerWidget/index.d.ts +3 -3
- package/dist/images/cross.svg +44 -0
- package/dist/images/done.svg +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/tf-checkout-react.cjs.development.js +639 -223
- package/dist/tf-checkout-react.cjs.development.js.map +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
- package/dist/tf-checkout-react.esm.js +645 -231
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/package.json +89 -89
- package/src/.DS_Store +0 -0
- package/src/.d.ts +2 -2
- package/src/api/index.ts +300 -278
- package/src/assets/images/cross.svg +44 -0
- package/src/assets/images/done.svg +3 -3
- package/src/components/.DS_Store +0 -0
- package/src/components/billing-info-container/index.tsx +811 -799
- package/src/components/billing-info-container/style.css +105 -105
- package/src/components/billing-info-container/utils.ts +225 -224
- package/src/components/common/CheckboxField.tsx +41 -41
- package/src/components/common/CustomField.tsx +87 -84
- package/src/components/common/DatePickerField.tsx +98 -0
- package/src/components/common/FormikPhoneNumberField.tsx +51 -51
- package/src/components/common/Loader.tsx +9 -9
- package/src/components/common/RadioField.tsx +35 -35
- package/src/components/common/RedirectModal.tsx +43 -0
- package/src/components/common/SelectField.tsx +80 -80
- package/src/components/common/SnackbarAlert.tsx +53 -53
- package/src/components/common/index.tsx +4 -4
- package/src/components/confirmModal/index.tsx +51 -51
- package/src/components/confirmModal/style.css +21 -21
- package/src/components/confirmationContainer/config.ts +72 -72
- package/src/components/confirmationContainer/index.tsx +197 -197
- package/src/components/confirmationContainer/social-buttons.tsx +94 -94
- package/src/components/confirmationContainer/style.css +202 -202
- package/src/components/countdown/index.tsx +98 -89
- package/src/components/countdown/style.css +9 -9
- package/src/components/index.ts +7 -7
- package/src/components/loginModal/index.tsx +209 -209
- package/src/components/loginModal/style.css +71 -71
- package/src/components/myTicketsContainer/index.tsx +196 -196
- package/src/components/myTicketsContainer/row.tsx +41 -41
- package/src/components/myTicketsContainer/style.css +39 -39
- package/src/components/myTicketsContainer/tableConfig.tsx +34 -34
- package/src/components/orderDetailsContainer/index.tsx +252 -249
- package/src/components/orderDetailsContainer/style.css +72 -72
- package/src/components/orderDetailsContainer/ticketsTable.tsx +130 -124
- package/src/components/paymentContainer/index.tsx +285 -284
- package/src/components/registerModal/index.tsx +190 -190
- package/src/components/rsvpContainer/index.tsx +126 -0
- package/src/components/stripePayment/index.tsx +254 -253
- package/src/components/stripePayment/style.css +59 -59
- package/src/components/ticketResale/index.tsx +74 -56
- package/src/components/ticketResaleModal/index.tsx +215 -210
- package/src/components/ticketResaleModal/style.css +28 -28
- package/src/components/ticketsContainer/AccessCodeSection.tsx +50 -0
- package/src/components/ticketsContainer/PromoCodeSection.tsx +88 -99
- package/src/components/ticketsContainer/ReferralLogic.tsx +31 -33
- package/src/components/ticketsContainer/TicketRow.tsx +83 -83
- package/src/components/ticketsContainer/TicketsSection.tsx +90 -81
- package/src/components/ticketsContainer/index.tsx +464 -430
- package/src/components/ticketsContainer/style.css +181 -181
- package/src/components/ticketsContainer/utils.ts +11 -11
- package/src/components/timerWidget/index.tsx +87 -70
- package/src/components/timerWidget/style.css +34 -26
- package/src/components/waitingList/index.tsx +178 -178
- package/src/components/waitingList/style.css +26 -26
- package/src/env.ts +20 -20
- package/src/index.ts +15 -13
- package/src/normalizers/index.ts +45 -45
- package/src/types/billing-info-data.ts +37 -37
- package/src/types/payment-field.ts +7 -7
- package/src/types/referral-promotion.ts +7 -7
- package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +59 -59
- package/src/utils/downloadPDF.tsx +30 -30
- package/src/utils/formikErrorFocus.ts +24 -24
- package/src/utils/getImage.ts +14 -14
- package/src/utils/getQueryVariable.ts +13 -13
- package/src/utils/index.ts +5 -5
- package/src/utils/setConfigs.ts +26 -26
- package/src/utils/showZero.tsx +10 -10
- package/src/validators/index.ts +20 -20
|
@@ -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
|