tf-checkout-react 1.6.6 → 1.7.2
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/README.md +401 -59
- package/dist/adapters/customFields.d.ts +1 -0
- package/dist/api/checkout.d.ts +2 -0
- package/dist/api/common.d.ts +1 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/preRegistrationComplete.d.ts +1 -1
- package/dist/components/addonsContainer/AddonComponent.d.ts +6 -1
- package/dist/components/addonsContainer/SimpleAddonsContainer.d.ts +17 -0
- package/dist/components/addonsContainer/index.d.ts +6 -1
- package/dist/components/billing-info-container/hooks/index.d.ts +3 -0
- package/dist/components/billing-info-container/hooks/usePaymentContext.d.ts +5 -0
- package/dist/components/billing-info-container/hooks/usePaymentRedirect.d.ts +14 -0
- package/dist/components/billing-info-container/hooks/useStripePayment.d.ts +18 -0
- package/dist/components/billing-info-container/index.d.ts +13 -2
- package/dist/components/billing-info-container/utils.d.ts +26 -1
- package/dist/components/common/DatePickerField.d.ts +7 -1
- package/dist/components/common/PhoneNumberField.d.ts +1 -1
- package/dist/components/confirmationContainer/index.d.ts +4 -1
- package/dist/components/countdown/index.d.ts +1 -1
- package/dist/components/forgotPasswordModal/index.d.ts +2 -1
- package/dist/components/myTicketsContainer/index.d.ts +3 -2
- package/dist/components/orderDetailsContainer/index.d.ts +8 -1
- package/dist/components/paymentContainer/OrderDetails.d.ts +9 -0
- package/dist/components/paymentContainer/handlePayment.d.ts +15 -0
- package/dist/components/paymentContainer/index.d.ts +12 -6
- package/dist/components/preRegistration/FieldsSection.d.ts +7 -1
- package/dist/components/preRegistration/PreRegistrationComplete.d.ts +8 -0
- package/dist/components/preRegistration/constants.d.ts +2 -2
- package/dist/components/preRegistration/index.d.ts +6 -0
- package/dist/components/resetPasswordContainer/index.d.ts +2 -2
- package/dist/components/ticketsContainer/InfoIcon.d.ts +5 -0
- package/dist/components/ticketsContainer/TicketsSection.d.ts +3 -2
- package/dist/components/ticketsContainer/TimeSlotsSection.d.ts +25 -0
- package/dist/components/ticketsContainer/index.d.ts +29 -5
- package/dist/components/timerWidget/index.d.ts +2 -1
- package/dist/constants/index.d.ts +5 -0
- package/dist/index.d.ts +4 -1
- package/dist/tf-checkout-react.cjs.development.js +11284 -9565
- 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 +11293 -9577
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/dist/types/add_on.d.ts +1 -0
- package/dist/types/checkoutPageConfigs.d.ts +1 -1
- package/dist/types/order-data.d.ts +3 -1
- package/dist/utils/auth.d.ts +8 -0
- package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +1 -0
- package/dist/utils/customFields.d.ts +11 -0
- package/dist/utils/getDomain.d.ts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/setConfigs.d.ts +1 -0
- package/package.json +14 -8
- package/src/adapters/customFields.ts +7 -1
- package/src/api/auth.ts +2 -1
- package/src/api/checkout.ts +9 -4
- package/src/api/common.ts +49 -2
- package/src/api/index.ts +1 -0
- package/src/api/interceptors.ts +7 -23
- package/src/api/preRegistrationComplete.ts +1 -1
- package/src/api/publicRequest.ts +10 -0
- package/src/components/addonsContainer/AddonComponent.tsx +96 -11
- package/src/components/addonsContainer/SimpleAddonsContainer.tsx +420 -0
- package/src/components/addonsContainer/index.tsx +198 -47
- package/src/components/billing-info-container/hooks/index.ts +3 -0
- package/src/components/billing-info-container/hooks/usePaymentContext.ts +22 -0
- package/src/components/billing-info-container/hooks/usePaymentRedirect.ts +147 -0
- package/src/components/billing-info-container/hooks/useStripePayment.ts +121 -0
- package/src/components/billing-info-container/index.tsx +859 -418
- package/src/components/billing-info-container/{utils.ts → utils.tsx} +124 -1
- package/src/components/common/CheckboxField/index.tsx +1 -1
- package/src/components/common/CustomField.tsx +39 -3
- package/src/components/common/DatePickerField.tsx +25 -10
- package/src/components/common/PhoneNumberField.tsx +4 -2
- package/src/components/common/SnackbarAlert.tsx +32 -34
- package/src/components/confirmationContainer/config.ts +3 -3
- package/src/components/confirmationContainer/index.tsx +20 -1
- package/src/components/confirmationContainer/social-buttons.tsx +5 -3
- package/src/components/confirmationContainer/style.css +9 -5
- package/src/components/countdown/index.tsx +22 -22
- package/src/components/delegationsContainer/IssueComponent.tsx +2 -1
- package/src/components/forgotPasswordModal/index.tsx +44 -13
- package/src/components/loginForm/index.tsx +1 -1
- package/src/components/loginModal/index.tsx +19 -27
- package/src/components/loginModal/style.css +3 -1
- package/src/components/myTicketsContainer/index.tsx +13 -9
- package/src/components/orderDetailsContainer/index.tsx +206 -174
- package/src/components/paymentContainer/OrderDetails.tsx +257 -0
- package/src/components/paymentContainer/handlePayment.ts +86 -0
- package/src/components/paymentContainer/index.tsx +299 -259
- package/src/components/paymentContainer/style.css +141 -0
- package/src/components/preRegistration/FieldsSection.tsx +8 -0
- package/src/components/preRegistration/PreRegistrationComplete.tsx +138 -118
- package/src/components/preRegistration/PreRegistrationInformations.tsx +21 -15
- package/src/components/preRegistration/constants.tsx +10 -4
- package/src/components/preRegistration/index.tsx +233 -179
- package/src/components/preRegistration/style.css +3 -0
- package/src/components/registerForm/constants.tsx +3 -1
- package/src/components/registerForm/index.tsx +3 -3
- package/src/components/registerModal/index.tsx +47 -72
- package/src/components/resetPasswordContainer/index.tsx +20 -14
- package/src/components/seatMapContainer/TicketsSection.tsx +2 -2
- package/src/components/signupModal/index.tsx +13 -6
- package/src/components/ticketResale/index.tsx +7 -0
- package/src/components/ticketsContainer/InfoIcon.tsx +35 -0
- package/src/components/ticketsContainer/PromoCodeSection.tsx +34 -28
- package/src/components/ticketsContainer/TicketRow.tsx +1 -1
- package/src/components/ticketsContainer/TicketsSection.tsx +189 -57
- package/src/components/ticketsContainer/TimeSlotsSection.tsx +120 -0
- package/src/components/ticketsContainer/index.tsx +268 -106
- package/src/components/timerWidget/index.tsx +15 -3
- package/src/components/timerWidget/style.css +2 -1
- package/src/constants/index.ts +2 -0
- package/src/env.ts +14 -6
- package/src/hoc/CustomFields/index.tsx +9 -1
- package/src/index.ts +7 -2
- package/src/types/add_on.ts +1 -0
- package/src/types/api/cart.d.ts +8 -0
- package/src/types/api/checkout.d.ts +58 -7
- package/src/types/api/common.d.ts +30 -0
- package/src/types/api/orders.d.ts +19 -3
- package/src/types/api/payment.d.ts +6 -2
- package/src/types/api/preRegistrationComplete.d.ts +2 -2
- package/src/types/checkoutPageConfigs.ts +1 -1
- package/src/types/order-data.ts +3 -1
- package/src/types/pre-registration-complete.d.ts +6 -1
- package/src/utils/auth.ts +32 -0
- package/src/utils/cookies.ts +42 -11
- package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +3 -1
- package/src/utils/customFields.ts +22 -0
- package/src/utils/getDomain.ts +10 -4
- package/src/utils/index.ts +1 -1
- package/src/utils/setConfigs.ts +3 -1
- package/dist/components/stripePayment/index.d.ts +0 -24
- package/src/components/stripePayment/index.tsx +0 -281
- package/src/components/stripePayment/style.css +0 -60
|
@@ -3,6 +3,7 @@ import './style.css'
|
|
|
3
3
|
import _identity from 'lodash/identity'
|
|
4
4
|
import React, { memo, useState } from 'react'
|
|
5
5
|
import Countdown from 'react-countdown'
|
|
6
|
+
import ReactDOM from 'react-dom'
|
|
6
7
|
import SVG from 'react-inlinesvg'
|
|
7
8
|
|
|
8
9
|
import Cross from '../../assets/images/cross.svg'
|
|
@@ -12,6 +13,7 @@ export interface ITimerWidgetPage {
|
|
|
12
13
|
expires_at: number;
|
|
13
14
|
buyLoading?: boolean;
|
|
14
15
|
onCountdownFinish?: () => void;
|
|
16
|
+
container?: string;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export interface IRenderer {
|
|
@@ -25,6 +27,7 @@ const TimerWidget = ({
|
|
|
25
27
|
expires_at,
|
|
26
28
|
buyLoading,
|
|
27
29
|
onCountdownFinish = _identity,
|
|
30
|
+
container,
|
|
28
31
|
}: ITimerWidgetPage) => {
|
|
29
32
|
const [showTimer, setShowTimer] = useState(true)
|
|
30
33
|
|
|
@@ -59,9 +62,9 @@ const TimerWidget = ({
|
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
64
|
|
|
62
|
-
|
|
65
|
+
const timerComponent = (
|
|
63
66
|
<div className="timer">
|
|
64
|
-
<div className="close-icon" onClick={hideTimer}>
|
|
67
|
+
<div aria-hidden className="close-icon" onClick={hideTimer}>
|
|
65
68
|
<SVG src={Cross} width="10" height="10" fill="#fff" />
|
|
66
69
|
</div>
|
|
67
70
|
<div className="toast-message">
|
|
@@ -79,7 +82,16 @@ const TimerWidget = ({
|
|
|
79
82
|
</p>
|
|
80
83
|
</div>
|
|
81
84
|
</div>
|
|
82
|
-
)
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
return showTimer && !!expires_at
|
|
88
|
+
? container
|
|
89
|
+
? ReactDOM.createPortal(
|
|
90
|
+
timerComponent,
|
|
91
|
+
document.querySelector(container) as HTMLElement
|
|
92
|
+
)
|
|
93
|
+
: timerComponent
|
|
94
|
+
: null
|
|
83
95
|
}
|
|
84
96
|
|
|
85
97
|
export default memo(TimerWidget)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.timer {
|
|
2
|
-
position:
|
|
2
|
+
position: fixed;
|
|
3
3
|
pointer-events: auto;
|
|
4
4
|
background-color: #000000;
|
|
5
5
|
overflow: hidden;
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
color: #fff;
|
|
19
19
|
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=);
|
|
20
20
|
right: 15px;
|
|
21
|
+
z-index: 9;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
.timer .close-icon {
|
package/src/constants/index.ts
CHANGED
package/src/env.ts
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
// preview
|
|
2
2
|
export const ENV = {
|
|
3
|
-
EVENT_ID:
|
|
4
|
-
BASE_URL: 'https://test.ticketfairy.com',
|
|
5
|
-
CLIENT_ID: 'e9d8f8922797b4621e562255afe90dbf',
|
|
6
|
-
CLIENT_SECRET: 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9',
|
|
3
|
+
// EVENT_ID: 13090,
|
|
4
|
+
// BASE_URL: 'https://test.ticketfairy.com',
|
|
5
|
+
// CLIENT_ID: 'e9d8f8922797b4621e562255afe90dbf',
|
|
6
|
+
// CLIENT_SECRET: 'b89c191eff22fdcf84ac9bfd88d005355a151ec2c83b26b9',
|
|
7
|
+
// STRIPE_PUBLISHABLE_KEY:
|
|
8
|
+
// 'pk_test_51H4BkOGqveRD6EShliLrT9vd7mPOBPvQSuqmvc3wIinDqxWsCLeS2N7HonPPn6MhjU35ayYy5v4I6MLlD4jNWrd000NSgAF6UL',
|
|
9
|
+
// BRAND_SLUG: 'test-mana-brand',
|
|
10
|
+
// X_SOURCE_ORIGIN: 'manacommon.com'
|
|
11
|
+
EVENT_ID: 6607,
|
|
12
|
+
BASE_URL: 'https://ttf.localhost',
|
|
13
|
+
CLIENT_ID: '11b907373250ac4813129922b039a828',
|
|
14
|
+
CLIENT_SECRET: '48118a9b8ffd4b120dc63861e6d6c0202fef4a5dbc46b53b',
|
|
7
15
|
STRIPE_PUBLISHABLE_KEY:
|
|
8
16
|
'pk_test_51H4BkOGqveRD6EShliLrT9vd7mPOBPvQSuqmvc3wIinDqxWsCLeS2N7HonPPn6MhjU35ayYy5v4I6MLlD4jNWrd000NSgAF6UL',
|
|
9
|
-
BRAND_SLUG: '
|
|
10
|
-
X_SOURCE_ORIGIN: '
|
|
17
|
+
BRAND_SLUG: 'nop',
|
|
18
|
+
X_SOURCE_ORIGIN: 'ttf.localhost'
|
|
11
19
|
}
|
|
12
20
|
|
|
13
21
|
// prod
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
getFieldsKeys,
|
|
10
10
|
getQueryVariable,
|
|
11
11
|
} from '../../utils'
|
|
12
|
+
import { getAddOnDataWithCustomFields } from '../../utils/customFields'
|
|
12
13
|
|
|
13
14
|
const withCustomFields = (Children: any) => (props: any) => {
|
|
14
15
|
const {
|
|
@@ -27,18 +28,21 @@ const withCustomFields = (Children: any) => (props: any) => {
|
|
|
27
28
|
const [customFieldsData, setCustomFieldsData] = useState({} as any)
|
|
28
29
|
const [customFieldsOrderKeys, setCustomFieldsOrderKeys] = useState([] as any)
|
|
29
30
|
const [customFieldsTicketHolderKeys, setCustomFieldsTicketHolderKeys] = useState([] as any)
|
|
31
|
+
const [customFieldsAddOnKeys, setCustomFieldsAddOnKeys] = useState([] as any)
|
|
30
32
|
|
|
31
33
|
const getFields = async () => {
|
|
32
34
|
try {
|
|
33
|
-
const eventId = getQueryVariable('event_id') || ''
|
|
35
|
+
const eventId = getQueryVariable('event_id') || getQueryVariable("eventId") || ''
|
|
34
36
|
const customFields = await getCustomFields(eventId)
|
|
35
37
|
|
|
36
38
|
const orderFieldsKeys = getFieldsKeys(_get(customFields, 'orderFields', []))
|
|
37
39
|
const ticketHoldersFieldsKeys = getFieldsKeys(_get(customFields, 'ticketsFields', []))
|
|
40
|
+
const addOnFieldsKeys = getFieldsKeys(_get(customFields, 'addOnFields', []))
|
|
38
41
|
|
|
39
42
|
setCustomFieldsTicketHolderKeys(ticketHoldersFieldsKeys)
|
|
40
43
|
setCustomFieldsOrderKeys(orderFieldsKeys)
|
|
41
44
|
setCustomFieldsData(customFields)
|
|
45
|
+
setCustomFieldsAddOnKeys(addOnFieldsKeys)
|
|
42
46
|
|
|
43
47
|
onGetCustomFieldsSuccess(customFields)
|
|
44
48
|
} catch (e) {
|
|
@@ -59,6 +63,8 @@ const withCustomFields = (Children: any) => (props: any) => {
|
|
|
59
63
|
ticketHoldersWithCustomFields,
|
|
60
64
|
} = getDataWithCustomFields(data, ticketHoldersFields, customFieldsData)
|
|
61
65
|
|
|
66
|
+
const { addOnDataWithCustomFields } = getAddOnDataWithCustomFields(customFieldsData)
|
|
67
|
+
|
|
62
68
|
if (lodaing) {
|
|
63
69
|
return <CircularProgress size={50} />
|
|
64
70
|
}
|
|
@@ -70,6 +76,8 @@ const withCustomFields = (Children: any) => (props: any) => {
|
|
|
70
76
|
ticketHoldersFields={ticketHoldersWithCustomFields}
|
|
71
77
|
customFieldsOrderKeys={customFieldsOrderKeys}
|
|
72
78
|
customFieldsTicketHolderKeys={customFieldsTicketHolderKeys}
|
|
79
|
+
customFieldsAddOnKeys={customFieldsAddOnKeys}
|
|
80
|
+
addOnDataWithCustomFields={addOnDataWithCustomFields}
|
|
73
81
|
/>
|
|
74
82
|
)
|
|
75
83
|
}
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { currencyNormalizerCreator, createFixedFloatNormalizer } from './normali
|
|
|
6
6
|
export { LoginModal } from './components/loginModal'
|
|
7
7
|
export { MyTicketsContainer } from './components/myTicketsContainer'
|
|
8
8
|
export { OrderDetailsContainer } from './components/orderDetailsContainer'
|
|
9
|
-
export {
|
|
9
|
+
export { DEFAULT_FEES_STYLE } from './constants/index'
|
|
10
10
|
export { TicketResaleContainer } from './components'
|
|
11
11
|
export { RedirectModal } from './components/common/RedirectModal'
|
|
12
12
|
export { RsvpContainer } from './components/rsvpContainer'
|
|
@@ -22,4 +22,9 @@ export { DelegationsContainer } from './components/delegationsContainer'
|
|
|
22
22
|
export { PoweredBy } from './components/common/PoweredBy'
|
|
23
23
|
export { SeatMapContainer } from './components/seatMapContainer'
|
|
24
24
|
export { IDVerification } from './components/idVerificationContainer'
|
|
25
|
-
export { VERIFICATION_STATUSES } from './components/idVerificationContainer/constants'
|
|
25
|
+
export { VERIFICATION_STATUSES } from './components/idVerificationContainer/constants'
|
|
26
|
+
|
|
27
|
+
export { setConfigs } from './utils/setConfigs'
|
|
28
|
+
export { logoutUser } from './utils/auth'
|
|
29
|
+
|
|
30
|
+
export { OrderDetails } from './components/paymentContainer/OrderDetails'
|
package/src/types/add_on.ts
CHANGED
package/src/types/api/cart.d.ts
CHANGED
|
@@ -21,12 +21,19 @@ interface ICartRequestData {
|
|
|
21
21
|
attributes: ICartData;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
interface ICart {
|
|
25
|
+
id: string;
|
|
26
|
+
price: number;
|
|
27
|
+
quantity: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
24
30
|
interface ICartResponseData {
|
|
25
31
|
ageRequired: boolean;
|
|
26
32
|
namesRequired: boolean;
|
|
27
33
|
phoneRequired: boolean;
|
|
28
34
|
skipBillingPage: boolean;
|
|
29
35
|
minimumAge?: string | null;
|
|
36
|
+
cart?: ICart[];
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
interface ICartResponseExtendedData extends ICartResponseData {
|
|
@@ -40,6 +47,7 @@ interface ICartResponse extends IAxiosResponseData {
|
|
|
40
47
|
attributes: ICartResponseData;
|
|
41
48
|
relationships: Array<unknown>;
|
|
42
49
|
type: string;
|
|
50
|
+
cart: ICart[];
|
|
43
51
|
};
|
|
44
52
|
}
|
|
45
53
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { StripeElementsOptions } from '@stripe/stripe-js'
|
|
2
|
+
|
|
1
3
|
interface ITicketHolderData {
|
|
2
4
|
firstName?: string;
|
|
3
5
|
lastName?: string;
|
|
@@ -23,13 +25,62 @@ interface ICheckoutData {
|
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
interface ICheckoutResponseData {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
hash?: string;
|
|
29
|
+
total?: string;
|
|
30
|
+
cart_price_breakdown?: {
|
|
31
|
+
total: number;
|
|
32
|
+
debt: number;
|
|
33
|
+
guest_count: number;
|
|
34
|
+
guest_revenue: number;
|
|
35
|
+
currency: {
|
|
36
|
+
currency: string;
|
|
37
|
+
decimal_places: number;
|
|
38
|
+
symbol: string;
|
|
39
|
+
};
|
|
40
|
+
insurance_amount: number;
|
|
41
|
+
goods_tax: number;
|
|
42
|
+
goods_tax_name: string;
|
|
43
|
+
total_add_ons: number;
|
|
44
|
+
payment_option_additional_fees: number;
|
|
45
|
+
tickets_price_breakdown: [
|
|
46
|
+
{
|
|
47
|
+
fees_breakdown: Array<{
|
|
48
|
+
name: string;
|
|
49
|
+
amount: number;
|
|
50
|
+
}>;
|
|
51
|
+
is_table: boolean;
|
|
52
|
+
ticket_type_name: string;
|
|
53
|
+
ticket_type_id: string;
|
|
54
|
+
quantity: number;
|
|
55
|
+
fees_per_ticket: number;
|
|
56
|
+
discount: number;
|
|
57
|
+
description: string;
|
|
58
|
+
refund_on_checkin: boolean;
|
|
59
|
+
price_per_ticket: string;
|
|
60
|
+
cost_per_ticket: string;
|
|
61
|
+
total_price: number;
|
|
62
|
+
}
|
|
63
|
+
];
|
|
64
|
+
add_ons_price_breakdown: [];
|
|
65
|
+
insurance_items_breakdown: [];
|
|
66
|
+
event_name: string;
|
|
67
|
+
};
|
|
68
|
+
additional_payment_information?: {
|
|
69
|
+
basic_config: {
|
|
70
|
+
apiKey: string;
|
|
71
|
+
accountId: string;
|
|
72
|
+
};
|
|
73
|
+
elements_config: StripeElementsOptions;
|
|
74
|
+
additional_config: {
|
|
75
|
+
decimalMultiplier: number;
|
|
76
|
+
canChangeCaptureMode: boolean;
|
|
77
|
+
};
|
|
78
|
+
stripe_wallets: {
|
|
79
|
+
applePay?: 'auto' | 'never';
|
|
80
|
+
googlePay?: 'auto' | 'never';
|
|
81
|
+
};
|
|
82
|
+
payment_plan_available: boolean;
|
|
83
|
+
};
|
|
33
84
|
}
|
|
34
85
|
|
|
35
86
|
interface ICheckoutResponse extends IAxiosResponseData {
|
|
@@ -14,7 +14,20 @@ interface IEventResponseData {
|
|
|
14
14
|
startDate: string;
|
|
15
15
|
timezone: string;
|
|
16
16
|
country: any;
|
|
17
|
+
timeslotSettings: ITimeslotSettings | undefined | null;
|
|
18
|
+
preregEnabled: boolean;
|
|
19
|
+
preregStarted: boolean;
|
|
20
|
+
preregEnded: boolean;
|
|
17
21
|
}
|
|
22
|
+
|
|
23
|
+
interface ITimeslotSettings {
|
|
24
|
+
minPricePerDate: any;
|
|
25
|
+
showPrice: boolean;
|
|
26
|
+
groupsInfo: any;
|
|
27
|
+
availableDates: string[];
|
|
28
|
+
timeSlotDateInfo: any;
|
|
29
|
+
}
|
|
30
|
+
|
|
18
31
|
interface IEventResponse extends IAxiosResponseData {
|
|
19
32
|
data: {
|
|
20
33
|
attributes: IEventResponseData;
|
|
@@ -62,6 +75,11 @@ interface ITicketsResponseData {
|
|
|
62
75
|
interface ITicketsAdaptedResponseData extends ITicketsResponseData {
|
|
63
76
|
tickets: ITicketData[];
|
|
64
77
|
}
|
|
78
|
+
|
|
79
|
+
interface ITimeslotsAdaptedData extends ITicketsResponseData {
|
|
80
|
+
timeslots: {[key: string]: { [key: string]: ITicketData[] }};
|
|
81
|
+
}
|
|
82
|
+
|
|
65
83
|
interface ITicketsResponse extends IAxiosResponseData {
|
|
66
84
|
data: {
|
|
67
85
|
attributes: ITicketsResponseData;
|
|
@@ -77,6 +95,14 @@ interface ITicketsAdaptedResponse extends IAxiosResponseData {
|
|
|
77
95
|
};
|
|
78
96
|
}
|
|
79
97
|
|
|
98
|
+
interface ITimeslotsAdaptedResponse extends IAxiosResponseData {
|
|
99
|
+
data: {
|
|
100
|
+
attributes: ITimeslotsAdaptedData;
|
|
101
|
+
relationships: Array<unknown>;
|
|
102
|
+
type: string;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
80
106
|
// Countries
|
|
81
107
|
interface ICountriesAdaptedData {
|
|
82
108
|
label: string;
|
|
@@ -117,3 +143,7 @@ interface IRSVPRequestData {
|
|
|
117
143
|
email: string;
|
|
118
144
|
}
|
|
119
145
|
type IRSVPResponse = IAxiosResponseData
|
|
146
|
+
|
|
147
|
+
interface TimeSlotsResponse extends IAxiosResponseData {
|
|
148
|
+
data: string[];
|
|
149
|
+
}
|
|
@@ -57,18 +57,34 @@ interface IOrderAddOn {
|
|
|
57
57
|
interface IOrderTicketAddOn {
|
|
58
58
|
status: string;
|
|
59
59
|
name: string;
|
|
60
|
+
groupName: string;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
interface
|
|
63
|
+
interface ITicketTypes {
|
|
64
|
+
add_ons?: IOrderTicketAddOn[];
|
|
63
65
|
hash: string;
|
|
66
|
+
ticket_type: string;
|
|
67
|
+
holder_name: string;
|
|
68
|
+
status: string;
|
|
69
|
+
pdf_link: string;
|
|
70
|
+
is_sellable: boolean;
|
|
71
|
+
is_on_sale?: boolean;
|
|
72
|
+
event_name: string;
|
|
73
|
+
currency: string;
|
|
74
|
+
ticket_type_hash: string;
|
|
75
|
+
ticket_type_is_active?: boolean;
|
|
76
|
+
canSellTicket?: boolean;
|
|
77
|
+
retain_amount_on_sale: number | string;
|
|
78
|
+
ticketsTitle: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface IOrderTicketData extends ITicketTypes {
|
|
64
82
|
qrData: string;
|
|
65
83
|
ticketType: string;
|
|
66
84
|
description: string | null;
|
|
67
85
|
descriptionPlain: string | null;
|
|
68
86
|
holderName: string;
|
|
69
|
-
status: string;
|
|
70
87
|
eventName: string;
|
|
71
|
-
currency: string;
|
|
72
88
|
resaleFeeAmount: number;
|
|
73
89
|
holderEmail: string;
|
|
74
90
|
holderPhone: string | null;
|
|
@@ -18,6 +18,7 @@ interface IPaymentOrderDetails {
|
|
|
18
18
|
id: string;
|
|
19
19
|
name: string;
|
|
20
20
|
price: number | string;
|
|
21
|
+
cost: number | string;
|
|
21
22
|
quantity: number | string;
|
|
22
23
|
guest_count?: string | number;
|
|
23
24
|
}>;
|
|
@@ -25,6 +26,8 @@ interface IPaymentOrderDetails {
|
|
|
25
26
|
pay_now?: string | number;
|
|
26
27
|
guest_count?: string | number;
|
|
27
28
|
debt?: number;
|
|
29
|
+
subtotal?: number | string;
|
|
30
|
+
fees?: number | string;
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
interface IPaymentMethodData {
|
|
@@ -34,7 +37,8 @@ interface IPaymentMethodData {
|
|
|
34
37
|
stripe_payment_plan_enabled: boolean;
|
|
35
38
|
stripe_payment_plan_configuration: any;
|
|
36
39
|
stripeConnectedAccount: string;
|
|
37
|
-
|
|
40
|
+
stripe_publishable_key: string;
|
|
41
|
+
payment_method_types?: string[];
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
interface IShippingBillingInfoData {
|
|
@@ -171,4 +175,4 @@ interface ICheckoutCompleteDataResponse extends IAxiosResponseData {
|
|
|
171
175
|
relationships: Array<unknown>;
|
|
172
176
|
type: string;
|
|
173
177
|
};
|
|
174
|
-
}
|
|
178
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface IInfluencerData {
|
|
2
2
|
customer_id: string;
|
|
3
3
|
data_capture: any;
|
|
4
4
|
email: string;
|
|
@@ -25,7 +25,7 @@ interface IPrizeData {
|
|
|
25
25
|
|
|
26
26
|
interface IInfluancersData {
|
|
27
27
|
attributes: {
|
|
28
|
-
influencers:
|
|
28
|
+
influencers: IInfluencerData[];
|
|
29
29
|
prizes: IPrizeData[];
|
|
30
30
|
};
|
|
31
31
|
relationships: Array<unknown>;
|
|
@@ -2,7 +2,7 @@ export interface ICheckoutPageConfigs {
|
|
|
2
2
|
age_required: boolean;
|
|
3
3
|
event_id: string;
|
|
4
4
|
has_add_on: boolean;
|
|
5
|
-
minimum_age
|
|
5
|
+
minimum_age?: number | string | null;
|
|
6
6
|
names_required: boolean;
|
|
7
7
|
phone_required: boolean;
|
|
8
8
|
skip_billing_page: boolean;
|
package/src/types/order-data.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { IAddOn } from './add_on'
|
|
|
3
3
|
export interface IOrderData {
|
|
4
4
|
id: string;
|
|
5
5
|
product_name: string;
|
|
6
|
-
ticketType: string
|
|
6
|
+
ticketType: string | Array<any>;
|
|
7
7
|
quantity: string | number;
|
|
8
8
|
price: string | number;
|
|
9
9
|
total: string | number;
|
|
@@ -11,4 +11,6 @@ export interface IOrderData {
|
|
|
11
11
|
guest_count: string | number;
|
|
12
12
|
pay_now: string | number;
|
|
13
13
|
add_ons: IAddOn[];
|
|
14
|
+
cost: string | number;
|
|
15
|
+
expires_at?: number;
|
|
14
16
|
}
|
|
@@ -5,7 +5,7 @@ interface IPrewardsProps {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
interface IInfluancersProps {
|
|
8
|
-
data: Array<
|
|
8
|
+
data: Array<IInfluencerData>;
|
|
9
9
|
classNamePrefix: string;
|
|
10
10
|
headerNode?: string | Node;
|
|
11
11
|
}
|
|
@@ -28,6 +28,11 @@ interface IPreRegistrationInformationProps {
|
|
|
28
28
|
onGetPreregistrationDataError?: () => void;
|
|
29
29
|
influancersHeaderNode?: string | Node;
|
|
30
30
|
prewardsHeaderNode?: string | Node;
|
|
31
|
+
|
|
32
|
+
themeOptions?: ThemeOptions & {
|
|
33
|
+
input?: CSSProperties;
|
|
34
|
+
checkbox?: CSSProperties;
|
|
35
|
+
};
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
interface IPreRegistrationCompleteProps extends IShareOptionsProps {
|
package/src/utils/auth.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { AxiosError } from 'axios'
|
|
2
|
+
|
|
3
|
+
import { logout } from '../api'
|
|
4
|
+
import { deleteCookieByName } from './cookies'
|
|
5
|
+
import { isBrowser } from './isBrowser'
|
|
6
|
+
|
|
1
7
|
export const setLoggedUserData = (data: IProfileData) => ({
|
|
2
8
|
id: data.id,
|
|
3
9
|
first_name: data.firstName,
|
|
@@ -11,3 +17,29 @@ export const setLoggedUserData = (data: IProfileData) => ({
|
|
|
11
17
|
state: data?.stateId || '',
|
|
12
18
|
zip: data?.zipCode || '',
|
|
13
19
|
})
|
|
20
|
+
|
|
21
|
+
interface LogoutUserParams {
|
|
22
|
+
onLogoutSuccess?: () => void;
|
|
23
|
+
onLogoutError?: (error: AxiosError) => void;
|
|
24
|
+
setIsLogged?: (isLogged: boolean) => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const logoutUser = async ({
|
|
28
|
+
onLogoutSuccess,
|
|
29
|
+
onLogoutError,
|
|
30
|
+
setIsLogged,
|
|
31
|
+
}: LogoutUserParams) => {
|
|
32
|
+
try {
|
|
33
|
+
await logout()
|
|
34
|
+
onLogoutSuccess && onLogoutSuccess()
|
|
35
|
+
if (isBrowser) {
|
|
36
|
+
window.localStorage.removeItem('user_data')
|
|
37
|
+
setIsLogged && setIsLogged(false)
|
|
38
|
+
const event = new window.CustomEvent('tf-logout')
|
|
39
|
+
deleteCookieByName('X-TF-ECOMMERCE')
|
|
40
|
+
window.document.dispatchEvent(event)
|
|
41
|
+
}
|
|
42
|
+
} catch (e) {
|
|
43
|
+
onLogoutError && onLogoutError(e as AxiosError)
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/utils/cookies.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { getDomain } from './getDomain'
|
|
2
2
|
|
|
3
|
+
let generalDomain: string
|
|
4
|
+
|
|
3
5
|
export function setCustomCookie(name: string, value: string, days = 5) {
|
|
4
6
|
let expires = ''
|
|
5
7
|
if (days) {
|
|
@@ -7,11 +9,25 @@ export function setCustomCookie(name: string, value: string, days = 5) {
|
|
|
7
9
|
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000)
|
|
8
10
|
expires = '; expires=' + date.toUTCString()
|
|
9
11
|
}
|
|
10
|
-
if (typeof window
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
if (typeof window === 'undefined') {
|
|
13
|
+
return
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const { hostname } = window.location
|
|
17
|
+
|
|
18
|
+
if (generalDomain && generalDomain.endsWith(getDomain(hostname))) {
|
|
19
|
+
document.cookie = name + '=' + (value || '') + expires + `; path=/;domain=${generalDomain}`
|
|
20
|
+
return
|
|
14
21
|
}
|
|
22
|
+
|
|
23
|
+
let previousDomain = undefined
|
|
24
|
+
let domain = undefined
|
|
25
|
+
do {
|
|
26
|
+
previousDomain = domain
|
|
27
|
+
domain = getDomain(hostname, undefined, previousDomain)
|
|
28
|
+
document.cookie = name + '=' + (value || '') + expires + `; path=/;domain=${domain}`
|
|
29
|
+
} while (getCookieByName(name) === '' && hostname !== domain)
|
|
30
|
+
generalDomain = domain
|
|
15
31
|
}
|
|
16
32
|
|
|
17
33
|
export function getCookieByName(cname: string) {
|
|
@@ -31,12 +47,27 @@ export function getCookieByName(cname: string) {
|
|
|
31
47
|
}
|
|
32
48
|
|
|
33
49
|
export function deleteCookieByName(name: string) {
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
document.cookie =
|
|
37
|
-
name +
|
|
38
|
-
'=; Path=/' +
|
|
39
|
-
`; domain=${domain}` +
|
|
40
|
-
'; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'
|
|
50
|
+
if (getCookieByName(name) === '') {
|
|
51
|
+
return
|
|
41
52
|
}
|
|
53
|
+
|
|
54
|
+
if (typeof window === 'undefined') {
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const { hostname } = window.location
|
|
59
|
+
|
|
60
|
+
if (generalDomain && generalDomain.endsWith(getDomain(hostname))) {
|
|
61
|
+
document.cookie = name + `=; Path=/;domain=${generalDomain}; Expires=Thu, 01 Jan 1970 00:00:01 GMT;`
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let previousDomain = undefined
|
|
66
|
+
let domain = undefined
|
|
67
|
+
do {
|
|
68
|
+
previousDomain = domain
|
|
69
|
+
domain = getDomain(hostname, undefined, previousDomain)
|
|
70
|
+
document.cookie = name + `=; Path=/;domain=${domain}; Expires=Thu, 01 Jan 1970 00:00:01 GMT;`
|
|
71
|
+
} while (getCookieByName(name) !== '' && hostname !== domain)
|
|
72
|
+
generalDomain = domain
|
|
42
73
|
}
|
|
@@ -24,6 +24,7 @@ interface IUserCredentialsValues {
|
|
|
24
24
|
emailLogged?: string;
|
|
25
25
|
firstNameLogged?: string;
|
|
26
26
|
lastNameLogged?: string;
|
|
27
|
+
phoneLogged?: string;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export const createCheckoutDataBodyWithDefaultHolder = (
|
|
@@ -45,7 +46,8 @@ export const createCheckoutDataBodyWithDefaultHolder = (
|
|
|
45
46
|
_get(logedInValues, 'last_name') ||
|
|
46
47
|
_get(userCredentials, 'lastNameLogged') ||
|
|
47
48
|
''
|
|
48
|
-
const phone =
|
|
49
|
+
const phone =
|
|
50
|
+
_get(logedInValues, 'phone') || _get(userCredentials, 'phoneLogged') || ''
|
|
49
51
|
const email =
|
|
50
52
|
_get(logedInValues, 'email') || _get(userCredentials, 'emailLogged') || ''
|
|
51
53
|
|
|
@@ -54,5 +54,27 @@ export const getDataWithCustomFields = (
|
|
|
54
54
|
return { dataWithCustomFields, ticketHoldersWithCustomFields }
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
export const getAddOnDataWithCustomFields = (customFields: any) => {
|
|
58
|
+
// Custom Fields are not specified case
|
|
59
|
+
if (_isEmpty(customFields)) {
|
|
60
|
+
return { addOnDataWithCustomFields: [] }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Add Custom Fields for Order
|
|
64
|
+
const orderWithCustomFields = [
|
|
65
|
+
{
|
|
66
|
+
id: 1,
|
|
67
|
+
groupClassname: 'billing-info-container__customFields',
|
|
68
|
+
groupItems: [...customFields.addOnFields],
|
|
69
|
+
},
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
const addOnDataWithCustomFields = {
|
|
73
|
+
fields: orderWithCustomFields,
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return { addOnDataWithCustomFields }
|
|
77
|
+
}
|
|
78
|
+
|
|
57
79
|
export const getFieldsKeys = (customFields: any) =>
|
|
58
80
|
_map(customFields, field => field.name)
|
package/src/utils/getDomain.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
export function getDomain(url: string, subdomain?: string): string {
|
|
1
|
+
export function getDomain(url: string, subdomain?: string, publicSuffix?: string): string {
|
|
2
2
|
let updatedUrl: any = url.replace(/(https?:\/\/)?(www.)?/i, '')
|
|
3
3
|
|
|
4
4
|
if (!subdomain) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
if (publicSuffix) {
|
|
6
|
+
const updatedPublicSuffix = publicSuffix.startsWith('.') ? publicSuffix : '.' + publicSuffix
|
|
7
|
+
updatedUrl = url.replace(updatedPublicSuffix, '').split('.')
|
|
8
|
+
updatedUrl = updatedUrl.length > 0 ? updatedUrl[updatedUrl.length - 1] : ''
|
|
9
|
+
updatedUrl += updatedPublicSuffix
|
|
10
|
+
} else {
|
|
11
|
+
updatedUrl = updatedUrl.split(".")
|
|
12
|
+
updatedUrl = updatedUrl.slice(updatedUrl.length - 2).join(".")
|
|
13
|
+
}
|
|
8
14
|
}
|
|
9
15
|
|
|
10
16
|
if (updatedUrl.indexOf('/') !== -1) {
|
package/src/utils/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { createMarkup } from './createMarkup'
|
|
|
9
9
|
export { replaceVarInString } from './replaceVarInString'
|
|
10
10
|
export { isBrowser } from './isBrowser'
|
|
11
11
|
export { getFormInitialValues } from './form'
|
|
12
|
-
export { setLoggedUserData } from './auth'
|
|
12
|
+
export { setLoggedUserData, logoutUser } from './auth'
|
|
13
13
|
export { getDataWithCustomFields, getFieldsKeys } from './customFields'
|
|
14
14
|
export { createElementFromHTML } from './htmlNodeFromString'
|
|
15
15
|
export { isJson } from './jsonUtils'
|