tf-checkout-react 1.4.23-beta.0 → 1.4.23-beta.10

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 (99) hide show
  1. package/dist/api/auth.d.ts +5 -0
  2. package/dist/api/cart.d.ts +2 -0
  3. package/dist/api/checkout.d.ts +1 -0
  4. package/dist/api/common.d.ts +10 -0
  5. package/dist/api/index.d.ts +12 -32
  6. package/dist/api/interceptors.d.ts +1 -0
  7. package/dist/api/orders.d.ts +2 -0
  8. package/dist/api/payment.d.ts +5 -0
  9. package/dist/api/publicRequest.d.ts +10 -0
  10. package/dist/api/resale.d.ts +5 -0
  11. package/dist/components/billing-info-container/utils.d.ts +0 -28
  12. package/dist/components/common/CheckboxField.d.ts +1 -1
  13. package/dist/components/confirmationContainer/index.d.ts +1 -1
  14. package/dist/components/loginForm/index.d.ts +6 -22
  15. package/dist/components/loginModal/index.d.ts +15 -5
  16. package/dist/components/preRegistration/index.d.ts +4 -2
  17. package/dist/components/seatMapContainer/addToCart.d.ts +2 -2
  18. package/dist/components/seatMapContainer/utils.d.ts +1 -9
  19. package/dist/components/stripePayment/index.d.ts +1 -1
  20. package/dist/components/ticketsContainer/index.d.ts +2 -2
  21. package/dist/components/ticketsContainer/utils.d.ts +9 -0
  22. package/dist/components/waitingList/index.d.ts +1 -1
  23. package/dist/hooks/useLocalStorageListener.d.ts +1 -0
  24. package/dist/hooks/useOnline.d.ts +1 -0
  25. package/dist/tf-checkout-react.cjs.development.js +2623 -1911
  26. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  27. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  28. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  29. package/dist/tf-checkout-react.esm.js +2625 -1913
  30. package/dist/tf-checkout-react.esm.js.map +1 -1
  31. package/dist/types/order-data.d.ts +5 -5
  32. package/dist/utils/auth.d.ts +5 -5
  33. package/dist/utils/setConfigs.d.ts +0 -12
  34. package/package.json +1 -1
  35. package/src/api/auth.ts +44 -0
  36. package/src/api/cart.ts +28 -0
  37. package/src/api/checkout.ts +30 -0
  38. package/src/api/common.ts +129 -0
  39. package/src/api/guestTicketDelegation.ts +1 -1
  40. package/src/api/index.ts +83 -363
  41. package/src/api/interceptors.ts +104 -0
  42. package/src/api/orders.ts +30 -0
  43. package/src/api/payment.ts +77 -0
  44. package/src/api/preRegistrationComplete.ts +1 -1
  45. package/src/api/publicRequest.ts +40 -0
  46. package/src/api/resale.ts +28 -0
  47. package/src/components/addonsContainer/adapters/index.tsx +2 -4
  48. package/src/components/addonsContainer/index.tsx +23 -57
  49. package/src/components/billing-info-container/index.tsx +144 -214
  50. package/src/components/billing-info-container/utils.ts +9 -59
  51. package/src/components/common/CheckboxField.tsx +3 -4
  52. package/src/components/common/CustomField.tsx +1 -5
  53. package/src/components/common/NativeSelectFeild/index.tsx +1 -5
  54. package/src/components/common/socials.tsx +1 -1
  55. package/src/components/confirmationContainer/index.tsx +14 -12
  56. package/src/components/confirmationContainer/social-buttons.tsx +1 -1
  57. package/src/components/idVerificationContainer/index.tsx +7 -19
  58. package/src/components/loginForm/index.tsx +28 -41
  59. package/src/components/loginModal/index.tsx +161 -39
  60. package/src/components/myTicketsContainer/index.tsx +1 -1
  61. package/src/components/orderDetailsContainer/index.tsx +3 -3
  62. package/src/components/paymentContainer/index.tsx +23 -16
  63. package/src/components/preRegistration/Influancers.tsx +17 -14
  64. package/src/components/preRegistration/PreRegistrationComplete.tsx +23 -14
  65. package/src/components/preRegistration/PreRegistrationInformations.tsx +15 -6
  66. package/src/components/preRegistration/Prewards.tsx +15 -12
  67. package/src/components/preRegistration/ShareOptions.tsx +37 -23
  68. package/src/components/preRegistration/constants.tsx +10 -4
  69. package/src/components/preRegistration/index.tsx +50 -26
  70. package/src/components/registerForm/index.tsx +3 -6
  71. package/src/components/registerModal/index.tsx +4 -14
  72. package/src/components/rsvpContainer/index.tsx +18 -18
  73. package/src/components/seatMapContainer/addToCart.ts +9 -12
  74. package/src/components/seatMapContainer/index.tsx +74 -52
  75. package/src/components/seatMapContainer/utils.ts +3 -8
  76. package/src/components/signupModal/index.tsx +9 -30
  77. package/src/components/stripePayment/index.tsx +5 -2
  78. package/src/components/ticketResale/index.tsx +7 -6
  79. package/src/components/ticketsContainer/ReferralLogic.tsx +1 -1
  80. package/src/components/ticketsContainer/TicketRow.tsx +12 -5
  81. package/src/components/ticketsContainer/index.tsx +44 -32
  82. package/src/components/ticketsContainer/utils.ts +29 -5
  83. package/src/components/timerWidget/index.tsx +7 -11
  84. package/src/components/waitingList/index.tsx +18 -30
  85. package/src/hooks/useLocalStorageListener.ts +27 -0
  86. package/src/hooks/useOnline.ts +21 -0
  87. package/src/types/api/auth.d.ts +20 -12
  88. package/src/types/api/axiosResponse.d.ts +5 -5
  89. package/src/types/api/cart.d.ts +65 -0
  90. package/src/types/api/checkout.d.ts +41 -0
  91. package/src/types/api/common.d.ts +117 -0
  92. package/src/types/api/orders.d.ts +100 -0
  93. package/src/types/api/payment.d.ts +168 -0
  94. package/src/types/api/ticketResale.d.ts +13 -0
  95. package/src/types/order-data.ts +5 -5
  96. package/src/types/pre-registration-complete.d.ts +8 -5
  97. package/src/utils/auth.ts +3 -3
  98. package/src/utils/setConfigs.ts +2 -25
  99. package/src/types/auth.d.ts +0 -15
@@ -3,11 +3,11 @@ export interface IOrderData {
3
3
  id: string;
4
4
  product_name: string;
5
5
  ticketType: string;
6
- quantity: string;
7
- price: string;
8
- total: string;
6
+ quantity: string | number;
7
+ price: string | number;
8
+ total: string | number;
9
9
  currency: string;
10
- guest_count: string;
11
- pay_now: string;
10
+ guest_count: string | number;
11
+ pay_now: string | number;
12
12
  add_ons: IAddOn[];
13
13
  }
@@ -1,13 +1,13 @@
1
- export declare const setLoggedUserData: (data: IUserData) => {
2
- id: string;
1
+ export declare const setLoggedUserData: (data: IProfileData) => {
2
+ id: string | number;
3
3
  first_name: string;
4
4
  last_name: string;
5
5
  email: string;
6
6
  confirmEmail: string;
7
7
  city: string;
8
- country: string;
8
+ country: string | number;
9
9
  phone: string;
10
10
  street_address: string;
11
- state: string;
12
- zip: string;
11
+ state: string | number;
12
+ zip: string | number;
13
13
  };
@@ -1,12 +1,3 @@
1
- import { AxiosInstance } from 'axios';
2
- export declare const ttfHeaders: {
3
- [key: string]: any;
4
- };
5
- interface IPublicRequest extends AxiosInstance {
6
- setGuestToken: (token: string) => void;
7
- setAccessToken: (token: string) => void;
8
- setBaseUrl: (baseUrl: string) => void;
9
- }
10
1
  export interface IConfigs {
11
2
  BASE_URL: string;
12
3
  CLIENT_ID: string;
@@ -16,7 +7,4 @@ export interface IConfigs {
16
7
  [key: string]: string | number;
17
8
  }
18
9
  export declare const CONFIGS: IConfigs;
19
- export declare const publicRequest: IPublicRequest;
20
- export declare const setXSourceOrigin: (sourceOrigin: string) => void;
21
10
  export declare const setConfigs: (configs: IConfigs) => void;
22
- export {};
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.4.23-beta.0",
2
+ "version": "1.4.23-beta.10",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -0,0 +1,44 @@
1
+ import { AxiosRequestConfig, AxiosResponse } from 'axios'
2
+
3
+ import { CONFIGS } from '../utils'
4
+ import { publicRequest } from './publicRequest'
5
+
6
+ export const authorize = async (
7
+ data: IAuthorizeRequestData
8
+ ): Promise<IProfileResponse> => {
9
+ const response: AxiosResponse<IProfileResponse, AxiosRequestConfig> =
10
+ await publicRequest.post(
11
+ `/auth?clientId=${CONFIGS.CLIENT_ID || 'e9d8f8922797b4621e562255afe90dbf'}`,
12
+ data
13
+ )
14
+ return response.data
15
+ }
16
+
17
+ export const signUp = async (data: ISignupRequestData): Promise<IProfileResponse> => {
18
+ const response: AxiosResponse<IProfileResponse, AxiosRequestConfig> =
19
+ await publicRequest.post('auth/signup', { ...data })
20
+ return response.data
21
+ }
22
+
23
+ export const register = async (data: FormData): Promise<IProfileResponse> => {
24
+ const response: AxiosResponse<IProfileResponse, AxiosRequestConfig> =
25
+ await publicRequest.post('v1/oauth/register-rn', data)
26
+ return response.data
27
+ }
28
+
29
+ export const getProfileData = async (accessToken?: string): Promise<IProfileResponse> => {
30
+ const response: AxiosResponse<IProfileResponse, AxiosRequestConfig> =
31
+ await publicRequest.get('/customer/profile/', {
32
+ headers: {
33
+ ...publicRequest.defaults.headers.common,
34
+ Authorization: `Bearer ${accessToken}`,
35
+ },
36
+ })
37
+ return response.data
38
+ }
39
+
40
+ export const logout = async (): Promise<IAxiosResponseData> => {
41
+ const response: AxiosResponse<IAxiosResponseData, AxiosRequestConfig> =
42
+ await publicRequest.delete('/auth')
43
+ return response.data
44
+ }
@@ -0,0 +1,28 @@
1
+ import { AxiosRequestConfig, AxiosResponse } from 'axios'
2
+
3
+ import { isBrowser } from '../utils'
4
+ import { publicRequest } from './publicRequest'
5
+
6
+ export const addToCart = async (
7
+ id: string | number,
8
+ data: ICartRequestData
9
+ ): Promise<ICartResponse> => {
10
+ const response: AxiosResponse<ICartResponse, AxiosRequestConfig> =
11
+ await publicRequest.post(
12
+ `v1/event/${id}/add-to-cart/`,
13
+ { data },
14
+ {
15
+ headers: {
16
+ ...publicRequest.defaults.headers.common,
17
+ 'Referer-Url': isBrowser ? document.referrer : '',
18
+ },
19
+ }
20
+ )
21
+ return response.data
22
+ }
23
+
24
+ export const getCart = async (): Promise<IGetCartResponse> => {
25
+ const response: AxiosResponse<IGetCartResponse, AxiosRequestConfig> =
26
+ await publicRequest.get(`v1/cart`)
27
+ return response.data
28
+ }
@@ -0,0 +1,30 @@
1
+ import { AxiosRequestConfig, AxiosResponse } from 'axios'
2
+
3
+ import { publicRequest } from './publicRequest'
4
+
5
+ export const postOnCheckout = async (
6
+ data: any,
7
+ accessToken?: string,
8
+ freeTicket = false
9
+ ): Promise<ICheckoutResponse> => {
10
+ if (freeTicket) {
11
+ delete data.attributes.city
12
+ delete data.attributes.country
13
+ delete data.attributes.state
14
+ delete data.attributes.street_address
15
+ }
16
+
17
+ const response: AxiosResponse<ICheckoutResponse, AxiosRequestConfig> =
18
+ await publicRequest.post(
19
+ `v1/on-checkout`,
20
+ { data },
21
+ {
22
+ headers: {
23
+ ...publicRequest.defaults.headers.common,
24
+ Authorization: `Bearer ${accessToken}`,
25
+ },
26
+ }
27
+ )
28
+
29
+ return response.data
30
+ }
@@ -0,0 +1,129 @@
1
+ import { AxiosRequestConfig, AxiosResponse } from 'axios'
2
+ import _forEach from 'lodash/forEach'
3
+
4
+ import { getQueryVariable, isBrowser } from '../utils'
5
+ import { publicRequest } from './publicRequest'
6
+
7
+ export const getEvent = async (
8
+ id: string | number,
9
+ pk?: string
10
+ ): Promise<IEventResponse> => {
11
+ let referralValue = ''
12
+ if (isBrowser) {
13
+ const params = new URL(`${window.location}`)
14
+ const referralId = params.searchParams.get('ttf_r') || ''
15
+ const referral_key = window.localStorage.getItem('referral_key')
16
+ const [, referralIdlocal] = (referral_key || '').split('.')
17
+ referralValue = referralId || referralIdlocal
18
+ }
19
+
20
+ const response: AxiosResponse<IEventResponse, AxiosRequestConfig> =
21
+ await publicRequest.get(`v1/event/${id}`, {
22
+ params: { pk },
23
+ headers: {
24
+ ...publicRequest.defaults.headers.common,
25
+ 'Referer-Url': isBrowser ? document.referrer : '',
26
+ 'Referrer-Id': isBrowser ? referralValue : '',
27
+ },
28
+ })
29
+ return response.data
30
+ }
31
+
32
+ export const getTickets = async (
33
+ eventId: string | number,
34
+ promoCode: string,
35
+ pk?: string
36
+ ): Promise<ITicketsAdaptedResponse> => {
37
+ const invitationHash = getQueryVariable('invitation-hash')
38
+ const params = { pk } as Record<string, string | number | undefined>
39
+
40
+ if (invitationHash) {
41
+ params['invitation-hash'] = invitationHash
42
+ }
43
+
44
+ const headers = publicRequest.defaults.headers.common
45
+ if (promoCode) {
46
+ headers['Promotion-Event'] = String(eventId)
47
+ headers['Promotion-Code'] = promoCode
48
+ }
49
+
50
+ const response: AxiosResponse<ITicketsResponse, AxiosRequestConfig> =
51
+ await publicRequest.get(`v1/event/${eventId}/tickets/`, {
52
+ params,
53
+ headers,
54
+ })
55
+
56
+ const { tickets } = response.data.data.attributes
57
+ const ticketsArr: ITicketData[] = []
58
+ _forEach(tickets, item => {
59
+ ticketsArr.push(item)
60
+ })
61
+ const adaptedResponse: AxiosResponse<ITicketsAdaptedResponse, AxiosRequestConfig> = {
62
+ ...response,
63
+ data: {
64
+ ...response.data,
65
+ data: {
66
+ ...response.data.data,
67
+ attributes: {
68
+ ...response.data.data.attributes,
69
+ tickets: ticketsArr,
70
+ },
71
+ },
72
+ },
73
+ }
74
+
75
+ return adaptedResponse.data
76
+ }
77
+
78
+ export const getCountries = async (): Promise<ICountriesResponse> => {
79
+ const response: AxiosResponse<ICountriesResponse, AxiosRequestConfig> =
80
+ await publicRequest.get('/countries/list')
81
+ return response.data
82
+ }
83
+
84
+ export const getStates = async (countryId: string | number): Promise<IStatesResponse> => {
85
+ const response: AxiosResponse<IStatesResponse, AxiosRequestConfig> =
86
+ await publicRequest.get(`/countries/${countryId}/states/`)
87
+ return response.data
88
+ }
89
+
90
+ export const sendRSVPInfo = async (
91
+ eventId: number,
92
+ data: { data: IRSVPRequestData }
93
+ ): Promise<IRSVPResponse> => {
94
+ const response: AxiosResponse<IRSVPResponse, AxiosRequestConfig> =
95
+ await publicRequest.post(`v1/event/${eventId}/send-rsvp-info`, data)
96
+
97
+ return response.data
98
+ }
99
+
100
+ export const addToWaitingList = async (
101
+ id: number,
102
+ data: IWaitingListRequestData
103
+ ): Promise<IWaitingListResponse> => {
104
+ const response: AxiosResponse<IWaitingListResponse, AxiosRequestConfig> =
105
+ await publicRequest.post(`v1/event/${id}/add_to_waiting_list`, {
106
+ data,
107
+ })
108
+
109
+ return response.data
110
+ }
111
+
112
+ export const postReferralVisits = async (
113
+ eventId: string,
114
+ referralId: string
115
+ ): Promise<IAxiosResponseData> => {
116
+ const response: AxiosResponse<IAxiosResponseData, AxiosRequestConfig> =
117
+ await publicRequest.post(`v1/event/${eventId}/referrer/`, {
118
+ referrer: `${referralId}`,
119
+ })
120
+
121
+ return response.data
122
+ }
123
+
124
+ export const validatePhoneNumber = async (phone: string): Promise<IAxiosResponseData> => {
125
+ const response: AxiosResponse<IAxiosResponseData, AxiosRequestConfig> =
126
+ await publicRequest.get(`/v1/account/validate_phone?phone=${phone}`)
127
+
128
+ return response.data
129
+ }
@@ -1,6 +1,6 @@
1
1
  import { AxiosRequestConfig, AxiosResponse } from 'axios'
2
2
 
3
- import { publicRequest } from '../utils/setConfigs'
3
+ import { publicRequest } from './publicRequest'
4
4
 
5
5
  export const getCustomerExistsData = async (
6
6
  accessHash: string