tf-checkout-react 1.3.12-beta.1 → 1.3.12-beta.11

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 (175) hide show
  1. package/README.md +354 -160
  2. package/dist/api/index.d.ts +17 -2
  3. package/dist/api/preRegistrationComplete.d.ts +2 -0
  4. package/dist/components/addonsContainer/index.d.ts +2 -1
  5. package/dist/components/billing-info-container/index.d.ts +4 -1
  6. package/dist/components/billing-info-container/utils.d.ts +6 -2
  7. package/dist/components/common/CheckboxField.d.ts +1 -1
  8. package/dist/components/common/CopyField.d.ts +12 -0
  9. package/dist/components/common/CopyMessageModal.d.ts +7 -0
  10. package/dist/components/common/CustomField.d.ts +8 -3
  11. package/dist/components/common/DatePickerField.d.ts +1 -1
  12. package/dist/components/common/Loader.d.ts +1 -1
  13. package/dist/components/common/ModalComponent/index.d.ts +16 -0
  14. package/dist/components/common/{SelectField.d.ts → NativeSelectFeild/index.d.ts} +1 -1
  15. package/dist/components/common/PhoneNumberField.d.ts +3 -1
  16. package/dist/components/common/PoweredBy.d.ts +2 -0
  17. package/dist/components/common/RadioGroupField/index.d.ts +17 -0
  18. package/dist/components/common/SelectField/index.d.ts +19 -0
  19. package/dist/components/common/index.d.ts +4 -0
  20. package/dist/components/common/socials.d.ts +9 -0
  21. package/dist/components/confirmModal/index.d.ts +1 -1
  22. package/dist/components/confirmationContainer/index.d.ts +5 -1
  23. package/dist/components/confirmationContainer/social-buttons.d.ts +6 -2
  24. package/dist/components/forgotPasswordModal/index.d.ts +1 -0
  25. package/dist/components/idVerificationContainer/VerificationPendingModal.d.ts +10 -0
  26. package/dist/components/idVerificationContainer/constants.d.ts +16 -0
  27. package/dist/components/idVerificationContainer/index.d.ts +16 -0
  28. package/dist/components/index.d.ts +2 -0
  29. package/dist/components/loginForm/index.d.ts +1 -0
  30. package/dist/components/myTicketsContainer/index.d.ts +5 -2
  31. package/dist/components/myTicketsContainer/row.d.ts +1 -13
  32. package/dist/components/myTicketsContainer/tableConfig.d.ts +2 -2
  33. package/dist/components/orderDetailsContainer/index.d.ts +7 -1
  34. package/dist/components/orderDetailsContainer/ticketsTable.d.ts +6 -1
  35. package/dist/components/paymentContainer/index.d.ts +3 -1
  36. package/dist/components/preRegistration/Influancers.d.ts +2 -0
  37. package/dist/components/preRegistration/PreRegistrationComplete.d.ts +5 -0
  38. package/dist/components/preRegistration/PreRegistrationInformations.d.ts +2 -0
  39. package/dist/components/preRegistration/Prewards.d.ts +2 -0
  40. package/dist/components/preRegistration/ShareOptions.d.ts +2 -0
  41. package/dist/components/preRegistration/index.d.ts +5 -0
  42. package/dist/components/preRegistration/utils.d.ts +2 -0
  43. package/dist/components/registerModal/index.d.ts +3 -2
  44. package/dist/components/seatMapContainer/SeatMapComponent.d.ts +8 -0
  45. package/dist/components/seatMapContainer/TicketsSection.d.ts +9 -0
  46. package/dist/components/seatMapContainer/addToCart.d.ts +21 -0
  47. package/dist/components/seatMapContainer/index.d.ts +2 -0
  48. package/dist/components/seatMapContainer/utils.d.ts +14 -0
  49. package/dist/components/signupModal/index.d.ts +3 -2
  50. package/dist/components/stripePayment/index.d.ts +2 -2
  51. package/dist/components/ticketResale/index.d.ts +2 -1
  52. package/dist/components/ticketsContainer/PromoCodeSection.d.ts +3 -1
  53. package/dist/components/ticketsContainer/TicketRow.d.ts +4 -1
  54. package/dist/components/ticketsContainer/TicketsSection.d.ts +10 -3
  55. package/dist/components/ticketsContainer/index.d.ts +20 -2
  56. package/dist/components/timerWidget/index.d.ts +1 -1
  57. package/dist/components/waitingList/index.d.ts +2 -1
  58. package/dist/constants/index.d.ts +1 -0
  59. package/dist/hooks/index.d.ts +1 -0
  60. package/dist/hooks/usePixel.d.ts +6 -0
  61. package/dist/images/instagram.svg +5 -0
  62. package/dist/images/spotify.svg +6 -0
  63. package/dist/index.d.ts +8 -1
  64. package/dist/tf-checkout-react.cjs.development.js +6036 -4362
  65. package/dist/tf-checkout-react.cjs.development.js.map +1 -1
  66. package/dist/tf-checkout-react.cjs.production.min.js +1 -1
  67. package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
  68. package/dist/tf-checkout-react.esm.js +6044 -4378
  69. package/dist/tf-checkout-react.esm.js.map +1 -1
  70. package/dist/tf-checkout-styles.css +1 -1
  71. package/dist/types/checkoutPageConfigs.d.ts +3 -0
  72. package/dist/types/order-data.d.ts +3 -0
  73. package/dist/types/verification.d.ts +11 -0
  74. package/dist/utils/auth.d.ts +13 -0
  75. package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +9 -2
  76. package/dist/utils/htmlNodeFromString.d.ts +1 -0
  77. package/dist/utils/index.d.ts +4 -0
  78. package/dist/utils/isBrowser.d.ts +1 -0
  79. package/dist/utils/isValidNumber.d.ts +1 -0
  80. package/dist/utils/jsonUtils.d.ts +1 -0
  81. package/dist/validators/index.d.ts +2 -1
  82. package/package.json +23 -10
  83. package/src/.d.ts +4 -2
  84. package/src/api/index.ts +168 -27
  85. package/src/api/preRegistrationComplete.ts +27 -0
  86. package/src/assets/images/instagram.svg +5 -0
  87. package/src/assets/images/spotify.svg +6 -0
  88. package/src/components/addonsContainer/AddonComponent.tsx +2 -2
  89. package/src/components/addonsContainer/index.tsx +24 -2
  90. package/src/components/billing-info-container/index.tsx +516 -392
  91. package/src/components/billing-info-container/utils.ts +91 -20
  92. package/src/components/common/CheckboxField.tsx +17 -8
  93. package/src/components/common/CopyField.tsx +53 -0
  94. package/src/components/common/CopyMessageModal.tsx +34 -0
  95. package/src/components/common/CustomField.tsx +51 -18
  96. package/src/components/common/DatePickerField.tsx +50 -49
  97. package/src/components/common/FormikPhoneNumberField.tsx +11 -11
  98. package/src/components/common/Loader.tsx +6 -8
  99. package/src/components/common/ModalComponent/index.tsx +68 -0
  100. package/src/components/common/{SelectField.tsx → NativeSelectFeild/index.tsx} +1 -1
  101. package/src/components/common/PhoneNumberField.tsx +8 -4
  102. package/src/components/common/PoweredBy.tsx +15 -0
  103. package/src/components/common/RadioGroupField/index.tsx +76 -0
  104. package/src/components/common/SelectField/index.tsx +104 -0
  105. package/src/components/common/index.tsx +5 -1
  106. package/src/components/common/socials.tsx +31 -0
  107. package/src/components/confirmModal/index.tsx +16 -9
  108. package/src/components/confirmationContainer/config.ts +62 -55
  109. package/src/components/confirmationContainer/index.tsx +95 -71
  110. package/src/components/confirmationContainer/social-buttons.tsx +104 -65
  111. package/src/components/forgotPasswordModal/index.tsx +4 -0
  112. package/src/components/idVerificationContainer/VerificationPendingModal.tsx +47 -0
  113. package/src/components/idVerificationContainer/constants.ts +19 -0
  114. package/src/components/idVerificationContainer/index.tsx +283 -0
  115. package/src/components/index.ts +3 -1
  116. package/src/components/loginForm/index.tsx +4 -0
  117. package/src/components/myTicketsContainer/index.tsx +28 -10
  118. package/src/components/myTicketsContainer/row.tsx +33 -27
  119. package/src/components/myTicketsContainer/tableConfig.tsx +58 -17
  120. package/src/components/myTicketsContainer/types.d.ts +41 -0
  121. package/src/components/orderDetailsContainer/index.tsx +179 -147
  122. package/src/components/orderDetailsContainer/ticketsTable.tsx +11 -4
  123. package/src/components/paymentContainer/index.tsx +167 -25
  124. package/src/components/preRegistration/FieldsSection.tsx +14 -8
  125. package/src/components/preRegistration/Influancers.tsx +31 -0
  126. package/src/components/preRegistration/PreRegistrationComplete.tsx +96 -0
  127. package/src/components/preRegistration/PreRegistrationInformations.tsx +45 -0
  128. package/src/components/preRegistration/Prewards.tsx +38 -0
  129. package/src/components/preRegistration/ShareOptions.tsx +46 -0
  130. package/src/components/preRegistration/index.tsx +62 -16
  131. package/src/components/preRegistration/utils.ts +35 -0
  132. package/src/components/registerModal/index.tsx +11 -5
  133. package/src/components/seatMapContainer/SeatMapComponent.tsx +73 -0
  134. package/src/components/seatMapContainer/TicketsSection.tsx +285 -0
  135. package/src/components/seatMapContainer/addToCart.ts +82 -0
  136. package/src/components/seatMapContainer/index.tsx +426 -0
  137. package/src/components/seatMapContainer/utils.ts +138 -0
  138. package/src/components/signupModal/index.tsx +22 -16
  139. package/src/components/stripePayment/index.tsx +23 -18
  140. package/src/components/ticketResale/index.tsx +14 -9
  141. package/src/components/ticketResaleModal/index.tsx +4 -3
  142. package/src/components/ticketsContainer/PromoCodeSection.tsx +21 -12
  143. package/src/components/ticketsContainer/ReferralLogic.tsx +4 -2
  144. package/src/components/ticketsContainer/TicketRow.tsx +29 -19
  145. package/src/components/ticketsContainer/TicketsSection.tsx +129 -40
  146. package/src/components/ticketsContainer/index.tsx +220 -26
  147. package/src/components/ticketsContainer/style.css +0 -3
  148. package/src/components/ticketsContainer/utils.ts +1 -1
  149. package/src/components/timerWidget/index.tsx +9 -7
  150. package/src/components/waitingList/index.tsx +3 -2
  151. package/src/constants/index.ts +1 -0
  152. package/src/env.ts +1 -1
  153. package/src/hooks/index.ts +1 -0
  154. package/src/hooks/usePixel.ts +88 -0
  155. package/src/index.ts +9 -4
  156. package/src/normalizers/index.ts +8 -5
  157. package/src/types/api/axiosResponse.d.ts +6 -0
  158. package/src/types/api/preRegistrationComplete.d.ts +70 -0
  159. package/src/types/auth.d.ts +15 -0
  160. package/src/types/checkoutPageConfigs.ts +3 -0
  161. package/src/types/order-data.ts +3 -0
  162. package/src/types/pre-registration-complete.d.ts +32 -0
  163. package/src/types/seatMap.d.ts +158 -0
  164. package/src/types/verification.ts +11 -0
  165. package/src/utils/auth.ts +13 -0
  166. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +6 -2
  167. package/src/utils/htmlNodeFromString.ts +6 -0
  168. package/src/utils/index.ts +4 -0
  169. package/src/utils/isBrowser.ts +2 -0
  170. package/src/utils/isValidNumber.ts +8 -0
  171. package/src/utils/jsonUtils.ts +8 -0
  172. package/src/validators/index.ts +25 -5
  173. package/src/.DS_Store +0 -0
  174. package/src/components/.DS_Store +0 -0
  175. package/src/components/confirmModal/style.css +0 -21
package/README.md CHANGED
@@ -1,7 +1,13 @@
1
1
  # tf-checkout-react
2
+
2
3
   
3
4
 
5
+ <details>
6
+ <summary><strong>Table of Contents</strong></summary>
7
+
4
8
  - [About The Project](#about-the-project)
9
+ - [Intergrations](#intergrations)
10
+ - [WebFlow](#webflow)
5
11
  - [Getting started](#getting-started)
6
12
  - [Prerequisites](#prerequisites)
7
13
  - [Installation](#installation)
@@ -11,37 +17,66 @@
11
17
  - [Set configuration](#set-configuration)
12
18
  - [Features/Functionalities](#featuresfunctionalities)
13
19
  - [Login](#login)
20
+ - [Login Modal Interface](#login-modal-interface)
14
21
  - [Tickets Container](#tickets-container)
22
+ - [Tickets Container Interface](#tickets-container-interface)
15
23
  - [Billing Container](#billing-container)
16
- - [Checkout Containers](#checkout-containers)
24
+ - [Billing Container Interface](#billing-container-interface)
25
+ - [Checkout Container](#checkout-container)
26
+ - [Checkout Container Interface](#checkout-container-interface)
17
27
  - [Confirmation Container](#confirmation-container)
28
+ - [Confirmation Container Interface](#confirmation-container-interface)
18
29
  - [Orders Container](#orders-container)
19
- - [Order Container](#order-container)
30
+ - [Orders Container Interface](#orders-container-interface)
31
+ - [Order Details Container](#order-details-container)
32
+ - [Order Details Container Interface](#order-details-container-interface)
20
33
  - [Commands](#commands)
21
34
  - [Rollup](#rollup)
22
35
  - [TypeScript](#typescript)
23
36
  - [GitHub Actions](#github-actions)
24
37
 
38
+ </details>
39
+
25
40
  &nbsp;
41
+
26
42
  # About The Project
27
43
 
28
44
  This package containes Ticketfairy checkout functionality. Besides that package provides different functionalities connected with checkout functionality, such as `login/register`, `order management functionality`, `resale functionality`, `referrals functionality`, etc.
29
45
 
30
46
  &nbsp;
47
+
48
+ # Intergrations
49
+
50
+ ## [WebFlow](/webflow/public/INTEGRATION.md)
51
+
52
+ ## Clients (Minimal version required)
53
+
54
+ - Mana Common (1.3.19)
55
+ - Restlesnites (1.3.3)
56
+
57
+ &nbsp;
58
+
31
59
  # Getting started
60
+
32
61
  ## Prerequisites
62
+
33
63
  - node >= 12.14.1
34
64
  - npm >= 6.13.4
65
+
35
66
  ## Installation
67
+
36
68
  ### Existing project
37
69
 
38
70
  ```
39
71
  npm i tf-checkout-react
40
72
  ```
73
+
41
74
  or
75
+
42
76
  ```
43
77
  yarn add tf-checkout-react
44
78
  ```
79
+
45
80
  ### Run Independently
46
81
 
47
82
  - Clone this repo: `git clone https://github.com/theticketfairy/tf-checkout-react.git`
@@ -57,6 +92,8 @@ Project will run under `localhost:3002`. Port can be changed from `package.json`
57
92
 
58
93
  ## Set configuration
59
94
 
95
+ In order to make this package work properly, you need to set some configurations, otherwise the default configurations will be used. Currently only configuration which is needed for production, is `BASE_URL`. Other configurations written below are only for development/test environments.
96
+
60
97
  Import `setConfigs` function from the package.
61
98
 
62
99
  ```
@@ -65,10 +102,16 @@ import { setConfigs } from 'tf-checkout-react'
65
102
 
66
103
  Call it in the root and pass neccesary options. Here are available options:
67
104
 
105
+ ### Configurations for production
106
+
68
107
  - BASE_URL - need for making API calls (default: `https://www.ticketfairy.com`)
69
- - EVENT_ID - only for local testing
70
- - BRAND_SLUG - only for local testing
71
- - X_SOURCE_ORIGIN - need for local environment. This header will be included in every API request (ex. `houseofx.nyc`)
108
+
109
+ ### Configurations for development/testing
110
+
111
+ - BASE_URL - need for making API calls
112
+ - EVENT_ID - get and use specific event data
113
+ - BRAND_SLUG - slug of the event's parent/owner brand
114
+ - X_SOURCE_ORIGIN - need for local environment. This header will be included in every API request.
72
115
 
73
116
  &nbsp;
74
117
 
@@ -76,206 +119,355 @@ Call it in the root and pass neccesary options. Here are available options:
76
119
 
77
120
  ## Login
78
121
 
79
- Used to authenticate user. Import `LoginModal` from package. `LoginModal` component provides login form with validations and error handlings. Also it provides callback functions for every action and API call.
122
+ ### Used to authenticate user. Contains `email` and `password` fields.
80
123
 
81
- ### `props`
124
+ Import `LoginModal` from package. `LoginModal` component provides login form with validations and error handlings. Also it provides callback functions for every action and API call.
82
125
 
83
- ```
84
- interface Props {
85
- onClose: () => void;
86
- onLogin: () => void;
87
- alreadyHasUser?: boolean;
88
- userExpired?: boolean;
89
- onAuthorizeSuccess?: (res: any) => void;
90
- onAuthorizeError?: (e: AxiosError) => void;
91
- onGetProfileDataSuccess?: (res: any) => void;
92
- onGetProfileDataError?: (e: AxiosError) => void;
93
- modalClassname?: string;
94
- }
95
- ```
126
+ ### Login Modal Interface
127
+
128
+ <details>
129
+ <summary><b>props</b></summary>
130
+
131
+ | Property | Type | Required | Default Value | Description |
132
+ | ------------------------ | ------------------------- | -------- | ------------------------------- | -------------------------------------------------- |
133
+ | onLogin | Function: () => void | yes | N/A | Called after log in request’s success. |
134
+ | onClose | Function: () => void | yes | N/A | Called on modal close. |
135
+ | onGetProfileDataSuccess | Function: (data) => void | no | value => value | Called after fetching user data request’s success. |
136
+ | onGetProfileDataError | Function: (error) => void | no | value => value | Called after fetching user data request’s failure. |
137
+ | onForgotPassword | Function: () => void | no | value => value | Called on “Forgot Password” button click. |
138
+ | onSignup | Function: () => void | no | value => value | Called on “Sign Up” button click. |
139
+ | modalClassname | string | no | " " | Login modal main container class. |
140
+ | logo | string / URL / path | no | TheTicketFairy black logo (URL) | Login modal top section’s logo. |
141
+ | showForgotPasswordButton | boolean | no | false | Display “Forgot Password” button. |
142
+ | showSignUpButton | boolean | no | false | Display “Sign Up” button. |
143
+
144
+ </details>
96
145
 
97
146
  &nbsp;
98
- ## Tickets Container
99
147
 
100
- Tickets container/component will retrieve and show a list of tickets corresponding to `eventId`. It also containes `PromoCode`, `AccessCode`, `WaitingLsit` and `SessionButtons` functionalities.
148
+ ## Register
101
149
 
102
- ### `props`
150
+ ### Used to register new user. Contains `firstName`, `lastName`, `email`, `password` and `confirmPassword` fields.
103
151
 
104
- ```
105
- interface Props {
106
- eventId: number;
107
- getTicketsLabel?: string;
108
- contentStyle?: React.CSSProperties;
109
-
110
- onAddToCartSuccess: (response: CartSuccess) => void;
111
- onAddToCartError: (e: AxiosError) => void;
112
- onGetTicketsSuccess: (response: any) => void;
113
- onGetTicketsError: (e: AxiosError) => void;
114
- onLogoutSuccess: () => void;
115
- onLogoutError: (e: AxiosError) => void;
116
- onLoginSuccess: () => void;
117
-
118
- theme?: 'light' | 'dark';
119
- themeOptions?: ThemeOptions & {
120
- input?: CSSProperties;
121
- checkbox?: CSSProperties;
122
- };
123
-
124
- queryPromoCode?: string;
125
- isPromotionsEnabled?: boolean;
126
- isAccessCodeEnabled?: boolean;
127
-
128
- hideSessionButtons?: boolean;
129
- hideWaitingList?: boolean;
130
- enableBillingInfoAutoCreate?: boolean;
131
- isButtonScrollable?: boolean;
132
- sortBySoldOut?: boolean;
133
- disableCountdownLeadingZero?: boolean;
134
- }
135
- ```
152
+ `RegisterModal` component provides register form with validations and error handlings. Also it provides callback functions for every action and API call.
153
+
154
+ ### Register Modal Interface
155
+
156
+ <details>
157
+ <summary><b>props</b></summary>
158
+
159
+ | Property | Type | Required | Default Value | Description |
160
+ | ----------------------- | ------------------------- | -------- | -------------- | -------------------------------------------------------- |
161
+ | onRegister (deprecated) | Function: () => void | no | N/A | - |
162
+ | onClose | Function: () => void | yes | N/A | Called on modal close, after register request's success. |
163
+ | onGetProfileDataSuccess | Function: (data) => void | no | value => value | Called after fetching user data request’s success. |
164
+ | onGetProfileDataError | Function: (error) => void | no | value => value | Called after fetching user data request’s failure. |
165
+
166
+ </details>
167
+
168
+ &nbsp;
169
+
170
+ ## Forgot Password
171
+
172
+ ### Used to recover forgot password of user. Contains `email` field.
173
+
174
+ `ForgotPasswordModal` component provides forgot password form with validations and error handlings. Also it provides callback functions for every action and API call.
175
+
176
+ ### Forgot Password Modal Interface
177
+
178
+ <details>
179
+ <summary><b>props</b></summary>
180
+
181
+ | Property | Type | Required | Default Value | Description |
182
+ | ----------------------- | ------------------------- | -------- | -------------- | -------------------------------------------------------- |
183
+ | onLogin | Function: () => void | yes | N/A | Called on "Back to Log In" button click. |
184
+ | onClose | Function: () => void | yes | N/A | Called on modal close, after register request's success. |
185
+ | onForgotPasswordSuccess | Function: (data) => void | no | value => value | Called after forgot password request’s success. |
186
+ | onForgotPasswordError | Function: (error) => void | no | value => value | Called after forgot password request’s failure. |
187
+
188
+ </details>
189
+
190
+ &nbsp;
191
+
192
+ ## Tickets Container
193
+
194
+ Tickets container/component will retrieve and show a list of tickets corresponding to selected event. It also containes `PromoCode`, `AccessCode`, `WaitingLsit` and `SessionButtons` functionalities.
195
+
196
+ ### Tickets Container Interface
197
+
198
+ <details>
199
+ <summary><b>props</b></summary>
200
+
201
+ | Property | Type | Required | Default value | Description |
202
+ | ---------------------------------------- | ------------------------- | -------- | -------------- | --------------------------------------------------------------------------------------------------------------- |
203
+ | eventId | string/number | yes | N/A | |
204
+ | getTicketsLabel | string | no | “Get Tickets" | “Get Tickets” button label. |
205
+ | contentStyle | CSSProperties | no | {} | Main div container styles. |
206
+ | theme | ‘light’, ‘dark' | no | ‘light' | Main div class. |
207
+ | themeOptions | MUI ThemeOptions | no | N/A | MUI Theme Provider’s theme. |
208
+ | queryPromoCode (deprecated) | string | no | N/A | Promo code value get from URL query parameters. |
209
+ | isPromotionsEnabled | boolean | no | false | Enable Promotions feature. |
210
+ | isAccessCodeEnabled | boolean | no | false | Enable Access Code feature. |
211
+ | hideTicketsHeader | boolean | no | false | Hides section header component. |
212
+ | hideSessionButtons | boolean | no | false | Hide “My Tickets” and “Log Out” buttons. |
213
+ | hideWaitingList | boolean | no | false | Disable Waiting List feature. |
214
+ | enableBillingInfoAutoCreate | boolean | no | true | Enable to automatically create billing info data, instead of manually creation by user. |
215
+ | enableInfluencersSection | boolean | no | true | Display Influencers section. |
216
+ | enableAddOns | boolean | no | true | Enable Add-Ons feature. |
217
+ | isButtonScrollable (deprecated) | boolean | no | false | Enable “Get Tickets” button’s scroll. |
218
+ | sortBySoldOut | boolean | no | false | Enable to sort tickets by sort order and sold out status. By default tickets will be sorted only by sort order. |
219
+ | disableCountdownLeadingZero (deprecated) | boolean | no | false | - |
220
+ | isLoggedIn (deprecated) | boolean | no | false | - |
221
+ | actionsSectionComponent | ReactNode | no | N/A | Custom component instead of “Get Tickets” button. |
222
+ | ticketsHeaderComponent | ReactNode | no | N/A | Tickets section header component. |
223
+ | onAddToCartSuccess | Function: (data) => void | no | value => value | Called after add to cart request’s success. |
224
+ | onAddToCartError | Function: (error) => void | no | value => value | Called after add to cart request’s failure. |
225
+ | onGetTicketsSuccess | Function: (data) => void | no | value => value | Called after fetching tickets request’s success. |
226
+ | onGetTicketsError | Function: (error) => void | no | value => value | Called after fetching tickets request’s failure. |
227
+ | onLogoutSuccess | Function: () => void | no | value => value | Called after log out request’s success. |
228
+ | onLogoutError | Function: (error) => void | no | value => value | Called after log out request’s failure. |
229
+ | onLoginSuccess | Function: () => void | no | value => value | Called after log in request’s success. |
230
+
231
+ </details>
136
232
 
137
233
  &nbsp;
234
+
138
235
  ## Billing Container
139
236
 
140
237
  Billing container provides form for filling user's data. Form contains `user info`, `age` and `ticket holders` sections. Depending on event's requirements billing information form may differ. Form will autofill all available information and in case of all required fields are autofilled, billing page will redirect to payment page. Form submition will automatically register new user, if there is no existing user with provided email.
141
238
 
142
- ### `props`
143
-
144
- ```
145
- interface Props {
146
- data?: IBillingInfoData[];
147
- ticketHoldersFields?: IBillingInfoData;
148
- initialValues?: FormikValues;
149
- handleSubmit?: (
150
- values: FormikValues,
151
- formikHelpers: FormikHelpers<FormikValues>,
152
- eventId: any,
153
- res: any
154
- ) => void;
155
- onSubmitError?: (e: AxiosError) => void;
156
-
157
- onRegisterSuccess?: (value: any) => void;
158
- onRegisterError?: (e: AxiosError, email: string) => void;
159
- onGetCartSuccess?: (res: any) => void;
160
- onGetCartError?: (e: AxiosError) => void;
161
- onGetCountriesSuccess?: (res: any) => void;
162
- onGetCountriesError?: (e: AxiosError) => void;
163
- onGetStatesSuccess?: (res: any) => void;
164
- onGetStatesError?: (e: AxiosError) => void;
165
- onGetProfileDataSuccess?: (res: any) => void;
166
- onGetProfileDataError?: (e: AxiosError) => void;
167
- onAuthorizeSuccess?: () => void;
168
- onAuthorizeError?: (e: AxiosError) => void;
169
- onSkipBillingPage: (data: any) => void;
170
- onCountdownFinish?: () => void;
171
-
172
- isLoggedIn?: boolean;
173
- onLogin?: () => void;
174
- onLoginSuccess?: () => void;
175
- onErrorClose?: () => void;
176
-
177
- theme?: 'light' | 'dark';
178
- themeOptions?: ThemeOptions & {
179
- input?: CSSProperties;
180
- checkbox?: CSSProperties;
181
- };
182
-
183
- buttonName?: string;
184
- accountInfoTitle?: string | JSX.Element;
185
- hideLogo?: boolean;
186
- hideErrorsAlertSection?: boolean;
187
- skipPage?: boolean;
188
- canSkipHolderNames?: boolean;
189
- shouldFetchCountries?: boolean;
190
- enableTimer?: boolean;
191
- }
192
- ```
239
+ ### Billing Container Interface
240
+
241
+ Billing container interface extends [Login Modal Interface](#login-modal-interface), [Register Modal Interface](#register-modal-interface), [Forgot Password Modal Interface](#forgot-password-modal-interface).
242
+
243
+ <details>
244
+ <summary><b>props</b></summary>
245
+
246
+ | Property | Type | Required | Default Value | Description |
247
+ | --------------------------------- | -------------------------------------------------------- | -------- | ----------------------- | --------------------------------------------------------------------------------------------------- |
248
+ | data | IBillingInfoData[] | no | [] | Form fields list to be rendered to collect billing info data. |
249
+ | ticketHoldersFields | IBillingInfoData[] | no | [{ id: 1, fields: [] }] | Form fields list to be rendered to collect ticket holders data. |
250
+ | initialValues (deprecated) | { [key: string]: any } | no | {} | Form’s initial values. |
251
+ | theme | 'light' / 'dark' | no | 'light' | MUI Theme Provider’s theme. |
252
+ | isLoggedIn (deprecated) | boolean | no | false | - |
253
+ | accountInfoTitle | string / JSX.Element | no | “” | Render some text or JSX component above Login section. Do not available if there is logged in user. |
254
+ | hideLogo | boolean | no | false | Hide TicketFairy logo under “Login” button. |
255
+ | themeOptions | MUI ThemeOptions | no | N/A | MUI Theme Provider’s theme. |
256
+ | hideErrorsAlertSection | boolean | no | false | Hide form submit errors rendered by package. |
257
+ | skipPage | boolean | no | false | Enable skipping Billing Info page. |
258
+ | canSkipHolderNames | boolean | no | false | Enable to autogenerate ticket holders’ data, if ticket holders’ data are not required. |
259
+ | shouldFetchCountries (deprecated) | boolean | no | true | Enable to fetch countries list from TicketFairy. |
260
+ | enableTimer | boolean | no | false | Display whole checkout process timer. |
261
+ | brandOptIn (deprecated) | boolean | no | false | - |
262
+ | handleSubmit | Function: (data, helpers, eventId, responseData) => void | no | value => value | Called after billing info data submit request’s success. |
263
+ | onSubmitError | Function: (error) => void | no | value => value | Called after billing info data submit request’s failure. |
264
+ | onGetCartSuccess | Function: (data) => void | no | value => value | Called after fetching cart data request’s success. |
265
+ | onGetCartError | Function: (error) => void | no | value => value | Called after fetching cart data request’s failure. |
266
+ | onLogin (deprecated) | - | - | - | - |
267
+ | onErrorClose | Function: () => void | no | value => value | Called after closing error alert component. |
268
+ | onSkipBillingPage | Function: (data) => void | no | value => value | Called if skipPage is true. |
269
+
270
+ </details>
193
271
 
194
272
  &nbsp;
195
- ## Checkout Containers
273
+
274
+ ## Checkout Container
196
275
 
197
276
  Will show the order details and a card form that the user will need to fill with its card details.
198
277
  TicketFairy doesn't store any card related data, we use [Stripe](https://stripe.com/) as payments solution.
199
278
 
200
- ### `props`
201
-
202
- ```
203
- interface Props {
204
- paymentFields: IPaymentField[];
205
- handlePayment: any;
206
- checkoutData: any;
207
- formTitle?: string;
208
- errorText?: string;
209
- onErrorClose?: () => void;
210
- onGetPaymentDataSuccess: (value: any) => void;
211
- onGetPaymentDataError: (value: AxiosError) => void;
212
- onPaymentError: (value: AxiosError) => void;
213
- stripeCardOptions?: StripeCardNumberElementOptions;
214
- disableZipSection: boolean;
215
- themeOptions?: ThemeOptions & {
216
- input?: CSSProperties;
217
- checkbox?: CSSProperties;
218
- };
219
- elementsOptions?: StripeElementsOptions;
220
- onCountdownFinish?: () => void;
221
- enableTimer?: boolean;
222
- }
223
- ```
279
+ ### Checkout Container Interface
280
+
281
+ <details>
282
+ <summary><b>props</b></summary>
283
+
284
+ | Property | Type | Required | Default Value | Description |
285
+ | -------------------------- | ------------------------------- | -------- | ------------------ | ----------------------------------------------------------- |
286
+ | paymentFields | IPaymentField[] | yes | N/A | Define which field’s data should be displayed. |
287
+ | handlePayment (deprecated) | Function: (data) => void | yes | N/A | Called after payment request’s success. |
288
+ | onPaymentError | Function: (error) => void | yes | value => value | Called after payment request’s failure. |
289
+ | checkoutData (deprecated) | { hash: string; total: string } | yes | N/A | Object which contains checkout hash and order’s total cost. |
290
+ | onGetPaymentDataSuccess | Function: (data) => void | yes | value => value | Called after fetching payment data request’s success. |
291
+ | onGetPaymentDataError | Function: (error) => void | yes | value => value | Called after fetching payment data request’s failure. |
292
+ | onCountdownFinish | Function: () => void | yes | value => value | Called after checkout time expired. |
293
+ | enableTimer | boolean | no | false | Enable checkout process timer. |
294
+ | enablePaymentPlan | boolean | no | false | Enable pay with payment plan feature. |
295
+ | disableZipSection | boolean | no | false | Hide “Zip code” field. |
296
+ | paymentButtonText | string | no | “Pay” | Custom text for “Pay” button. |
297
+ | stripeCardOptions | StripeCardNumberElementOptions | no | {} | Custom styles for Stripe card. |
298
+ | themeOptions | MUI ThemeOptions | no | N/A | MUI Theme Provider’s theme. |
299
+ | formTitle | string | no | “Get Your Tickets” | Custom text for payment form title. |
300
+ | errorText (deprecated) | string | no | N/A | Payment confirmation error text. |
301
+ | onErrorClose | Function: () => void | no | N/A | Called after closing error alert component. |
302
+ | elementsOptions | StripeElementsOptions | no | N/A | Custom Stripe card elements. |
303
+
304
+ </details>
224
305
 
225
306
  &nbsp;
307
+
226
308
  ## Confirmation Container
227
309
 
228
310
  This is shown once the payment is successfully completed, could show components to share the purchase in social media or refer it with friends to get discounts on the purchase.
229
311
 
230
- ### `props`
312
+ ### Confirmation Container Interface
231
313
 
232
- ```
233
- interface Props {
234
- isReferralEnabled: boolean;
235
- showDefaultShareButtons: boolean;
236
- messengerAppId: string;
237
- shareButtons: IShareButton[];
238
- orderHash?: string;
239
-
240
- onGetConfirmationDataSuccess: (res: any) => void;
241
- onGetConfirmationDataError: (e: AxiosError) => void;
242
- onLinkCopied: () => void;
243
- }
244
- ```
314
+ <details>
315
+ <summary><b>props</b></summary>
316
+
317
+ | Property | Type | Required | Default Value | Description |
318
+ | ---------------------------- | ------------------------------------- | -------- | ------------------------------------------- | ----------------------------------------------------- |
319
+ | isReferralEnabled | boolean | yes | false | Enable Referrals feature. |
320
+ | showDefaultShareButtons | boolean | yes | false | Display social media share buttons.<sup>[1](#1)</sup> |
321
+ | messengerAppId | string | yes | “” | Facebook app ID. |
322
+ | shareButtons | IShareButton[] <sup>[1](#1)</sup> | yes | [] | Custom social media share buttons. |
323
+ | confirmationLabels | IConfirmationLabels<sup>[2](#2)</sup> | yes | defaultConfirmationLabels<sup>[2](#2)</sup> | Custom texts to display on Confirmation page. |
324
+ | onLinkCopied | Function: () => void | no | value => value | Called after personal share link copy. |
325
+ | onGetConfirmationDataSuccess | Function: (data) => void | no | value => value | Called after order confirmation request’s success. |
326
+ | onGetConfirmationDataError | Function: (error) => void | no | value => value | Called after order confirmation request’s failure. |
327
+ | hasCopyIcon | boolean | no | true | Display Copy icon near personal share link. |
328
+ | orderHash (deprecated) | string | no | N/A | - |
329
+
330
+ </details>
245
331
 
246
332
  &nbsp;
333
+
247
334
  ## Orders Container
248
335
 
249
336
  Will show the purchased orders for the logged user.
250
337
 
251
- ### `props`
338
+ ### Orders Container Interface
339
+
340
+ Orders container interface extends [Login Modal Interface](#login-modal-interface).
341
+
342
+ <details>
343
+ <summary><b>props</b></summary>
344
+
345
+ | Property | Type | Required | Default Value | Description |
346
+ | ------------------ | ------------------------------ | -------- | -------------- | ---------------------------------------------------- |
347
+ | handleDetailsInfo | Function: (id: string) => void | yes | value => value | Called on "Order Details" button click. |
348
+ | onGetOrdersSuccess | Function: (data) => void | yes | value => value | Called after fetching orders data request’s success. |
349
+ | onGetOrdersError | Function: (error) => void | yes | value => value | Called after fetching orders data request’s failure. |
350
+ | theme | 'light' / 'dark' | no | ‘dark' | Main container class. |
351
+
352
+ </details>
353
+
354
+ &nbsp;
355
+
356
+ ## Order Details Container
357
+
358
+ Will show the purchased order details. Contains `order PDF download` and `ticket resale` functionalities. Currently both functionalities are enabled by default.
359
+
360
+ ### Order Details Container Interface
361
+
362
+ <details>
363
+ <summary><b>props</b></summary>
364
+
365
+ | Property | Type | Required | Default Value | Description |
366
+ | ------------------------- | ----------------------------------------- | -------- | -------------------------------------------- | ---------------------------------------------------------------------------------------- |
367
+ | columns | [ { label: string } ] | yes | [] | Order details table’s columns’ labels. |
368
+ | ticketsTableColumns | ITicketsTableColumns[] <sup>[3](#3)</sup> | no | defaultTicketsTableColumns<sup>[3](#3)</sup> | Order’s tickets table’s columns. |
369
+ | displayColumnNameInRow | boolean | no | false | Display column’s names in row, instead of table header. |
370
+ | personalLinkIcon | string | no | “” | Custom icon to display near personal share link. |
371
+ | onGetOrdersSuccess | Function: (data) => void | no | value => value | Called after fetching order data request’s success. |
372
+ | onGetOrdersError | Function: (error) => void | no | value => value | Called after fetching order data request’s failure. |
373
+ | onResaleTicketSuccess | Function: (data) => void | no | value => value | Called after resale ticket request’s success. |
374
+ | onResaleTicketError | Function: (error) => void | no | value => value | Called after resale ticket request’s failure. |
375
+ | onRemoveFromResaleSuccess | Function: (data) => void | no | value => value | Called after remove from resale ticket request’s success. |
376
+ | onRemoveFromResaleError | Function: (error) => void | no | value => value | Called after remove from resale ticket request’s failure. |
377
+ | onReturnButtonClick | Function: () => void | no | N/A | Called on “Return” button click. If not passed, button click will redirect to ‘/orders’. |
378
+
379
+ </details>
380
+
381
+ &nbsp;
382
+
383
+ ## Ticket Resale Container
384
+
385
+ Container renders information about accepting or declining of resold tickets. It will automatically redirect to home page, if not valid hash is provided in URL.
386
+
387
+ ### Ticket Resale Container Interface
252
388
 
389
+ <details>
390
+ <summary><b>props</b></summary>
391
+
392
+ | Property | Type | Required | Default Value | Description |
393
+ | ------------------------------ | ------------------------- | -------- | -------------- | ---------------------------------------------- |
394
+ | onProcessTicketSuccess | Function: (data) => void | no | value => value | Called after process ticket request’s success. |
395
+ | onGetOrdersError | Function: (error) => void | no | value => value | Called after process ticket request’s failure. |
396
+ | onDeclineTicketPurchaseSuccess | Function: (data) => void | no | value => value | Called after decline ticket request’s success. |
397
+ | onDeclineTicketPurchaseError | Function: (error) => void | no | value => value | Called after decline ticket request’s failure. |
398
+
399
+ </details>
400
+
401
+ &nbsp;
402
+
403
+ <details>
404
+ <summary><small id="1">1. Share buttons</small></summary>
405
+
406
+ ```
407
+ IShareButton {
408
+ mainLabel: string;
409
+ subLabel: string;
410
+ platform: string;
411
+ shareData: any;
412
+ }
413
+ ```
414
+
415
+ ```
416
+ Default share options if `showDefaultShareButtons` is true, are: "Share on Facebook", "Tweet to your Followers", "Message friends on Facebook" and "Message friends on WhatsApp".
253
417
  ```
254
- interface Props {
255
- handleDetailsInfo: (id: string) => void;
256
- onGetOrdersSuccess: (res: any) => void;
257
- onGetOrdersError: (err: any) => void;
258
418
 
259
- theme?: 'light' | 'dark';
419
+ </details>
420
+
421
+ <details>
422
+ <summary><small id="2">2. Confirmation Labels</small></summary>
423
+
424
+ ```
425
+ IConfirmationLabels {
426
+ confirmationTitle?: string;
427
+ confirmationMain?: string;
428
+ confirmationHelper?: string
260
429
  }
261
430
  ```
262
431
 
263
- &nbsp;
264
- ## Order Container
432
+ ```
433
+ const defaultConfirmationLabels = {
434
+ confirmationTitle = "Your Tickets are Confirmed!",
435
+ confirmationMain = "Your tickets are available in My Tickets section",
436
+ confirmationHelper = "Please bring them with you to the event"
437
+ }
438
+ ```
265
439
 
266
- Will show the purchased order details. Contains `order PDF download` and `ticket resale` functionalities. Currently both functionalities are enabled by default.
440
+ </details>
267
441
 
268
- ### `props`
442
+ <details>
443
+ <summary><small id="3">3. Tickets table columns</small></summary>
269
444
 
270
445
  ```
271
- interface Props {
272
- onGetOrderSuccess: (res: any) => void;
273
- onGetOrderError: (err: any) => void;
446
+ interface ITicketsTableColumns {
447
+ id?: string | number;
448
+ key: keyof ITicketTypes & keyof IActionColumns;
449
+ label: string | number | null | undefined;
450
+ }
451
+
452
+ interface IActionColumns {
453
+ download?: boolean;
454
+ sell_ticket?: boolean;
274
455
  }
275
456
  ```
276
457
 
277
- &nbsp;
278
- ## Commands
458
+ ```
459
+ const defaultTicketsTableColumns = [
460
+ { key: 'ticket_type', label: 'Ticket Type' },
461
+ { key: 'holder_name', label: 'Ticket Holder' },
462
+ { key: 'status', label: 'Status' },
463
+ { key: 'download', label: '' },
464
+ { key: 'sell_ticket', label: '' }
465
+ ]
466
+ ```
467
+
468
+ </details>
469
+
470
+ # Commands
279
471
 
280
472
  TSDX scaffolds your new library inside `/src`, and also sets up a [Parcel-based](https://parceljs.org) playground for it inside `/example`.
281
473
 
@@ -300,11 +492,13 @@ The default example imports and live reloads whatever is in `/dist`, so if you a
300
492
  To do a one-off build, use `npm run build` or `yarn build`.
301
493
 
302
494
  &nbsp;
495
+
303
496
  ### Rollup
304
497
 
305
498
  TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.
306
499
 
307
500
  &nbsp;
501
+
308
502
  ### TypeScript
309
503
 
310
504
  `tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs.