tf-checkout-react 1.7.30 → 2.0.0-beta.0

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 (453) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +141 -1033
  3. package/dist/checkout.css +17 -0
  4. package/dist/index.d.mts +3930 -0
  5. package/dist/index.d.ts +3930 -30
  6. package/dist/index.esm.js +9123 -0
  7. package/dist/index.esm.js.map +1 -0
  8. package/dist/index.js +9277 -6
  9. package/dist/index.js.map +1 -0
  10. package/dist/styles/addons.css +75 -0
  11. package/dist/styles/auth.css +294 -0
  12. package/dist/styles/billing.css +98 -0
  13. package/dist/styles/confirmation.css +51 -0
  14. package/dist/styles/foundation.css +146 -0
  15. package/dist/styles/payment.css +179 -0
  16. package/dist/styles/primitives.css +356 -0
  17. package/dist/styles/seat-map.css +46 -0
  18. package/dist/styles/tickets.css +285 -0
  19. package/dist/styles/verification-confirmation.css +258 -0
  20. package/package.json +93 -78
  21. package/src/.d.ts +1 -1
  22. package/src/CardInput.tsx +374 -0
  23. package/src/EmbeddedCheckout.tsx +400 -0
  24. package/src/ResumedCheckout.tsx +132 -0
  25. package/src/auth/AuthModal.tsx +231 -0
  26. package/src/auth/ForgotPasswordForm.tsx +93 -0
  27. package/src/auth/LoginForm.tsx +104 -0
  28. package/src/auth/PasswordInput.tsx +33 -0
  29. package/src/auth/RegisterForm.tsx +333 -0
  30. package/src/auth/ResetPasswordForm.tsx +112 -0
  31. package/src/auth/index.ts +5 -0
  32. package/src/checkout.css +17 -0
  33. package/src/configure.ts +29 -0
  34. package/src/confirmer.ts +439 -0
  35. package/src/index.ts +41 -30
  36. package/src/instance.ts +21 -0
  37. package/src/sections/AddOns.tsx +241 -0
  38. package/src/sections/BillingInfo.tsx +743 -0
  39. package/src/sections/Confirmation.tsx +146 -0
  40. package/src/sections/IDVerification.tsx +76 -0
  41. package/src/sections/OrderConfirmation.tsx +277 -0
  42. package/src/sections/OrderIDVerification.tsx +117 -0
  43. package/src/sections/OrderSummary.tsx +84 -0
  44. package/src/sections/Payment.tsx +541 -0
  45. package/src/sections/SeatMap.tsx +512 -0
  46. package/src/sections/Tickets.tsx +573 -0
  47. package/src/sections/billing/BillingAddressFields.tsx +138 -0
  48. package/src/sections/billing/BuyerField.tsx +75 -0
  49. package/src/sections/billing/TicketHoldersCard.tsx +119 -0
  50. package/src/sections/billing/types.ts +10 -0
  51. package/src/sections/index.ts +15 -0
  52. package/src/sections/seatMap.utils.ts +105 -0
  53. package/src/styles/addons.css +75 -0
  54. package/src/styles/auth.css +294 -0
  55. package/src/styles/billing.css +98 -0
  56. package/src/styles/confirmation.css +51 -0
  57. package/src/styles/foundation.css +146 -0
  58. package/src/styles/payment.css +179 -0
  59. package/src/styles/primitives.css +356 -0
  60. package/src/styles/seat-map.css +46 -0
  61. package/src/styles/tickets.css +285 -0
  62. package/src/styles/verification-confirmation.css +258 -0
  63. package/src/typings.d.ts +2 -2
  64. package/src/ui/Button.tsx +38 -0
  65. package/src/ui/Card.tsx +54 -0
  66. package/src/ui/CheckoutProvider.tsx +172 -0
  67. package/src/ui/CustomFields.tsx +195 -0
  68. package/src/ui/Field.tsx +114 -0
  69. package/src/ui/I18nProvider.tsx +36 -0
  70. package/src/ui/InstallmentPicker.tsx +69 -0
  71. package/src/ui/Loader.tsx +12 -0
  72. package/src/ui/PaymentMethods.tsx +133 -0
  73. package/src/ui/PriceLine.tsx +24 -0
  74. package/src/ui/QuantitySelect.tsx +50 -0
  75. package/src/ui/Stepper.tsx +36 -0
  76. package/src/ui/Timer.tsx +34 -0
  77. package/src/ui/TimerBanner.tsx +55 -0
  78. package/src/ui/cx.ts +3 -0
  79. package/src/ui/index.ts +54 -0
  80. package/src/ui/theme.ts +83 -0
  81. package/src/useCheckout.ts +35 -0
  82. package/src/xendit.ts +438 -0
  83. package/dist/adapters/customFields.d.ts +0 -12
  84. package/dist/adapters/index.d.ts +0 -1
  85. package/dist/api/auth.d.ts +0 -27
  86. package/dist/api/cart.d.ts +0 -2
  87. package/dist/api/checkout.d.ts +0 -3
  88. package/dist/api/common.d.ts +0 -11
  89. package/dist/api/guestTicketDelegation.d.ts +0 -47
  90. package/dist/api/index.d.ts +0 -82
  91. package/dist/api/interceptors.d.ts +0 -1
  92. package/dist/api/orders.d.ts +0 -2
  93. package/dist/api/payment.d.ts +0 -5
  94. package/dist/api/preRegistrationComplete.d.ts +0 -3
  95. package/dist/api/publicRequest.d.ts +0 -9
  96. package/dist/api/resale.d.ts +0 -5
  97. package/dist/components/account-settings/index.d.ts +0 -3
  98. package/dist/components/addonsContainer/AddonComponent.d.ts +0 -18
  99. package/dist/components/addonsContainer/SimpleAddonsContainer.d.ts +0 -20
  100. package/dist/components/addonsContainer/adapters/index.d.ts +0 -12
  101. package/dist/components/addonsContainer/index.d.ts +0 -22
  102. package/dist/components/addonsContainer/normalizers/index.d.ts +0 -1
  103. package/dist/components/addonsContainer/useAddons.d.ts +0 -23
  104. package/dist/components/addonsContainer/utils/index.d.ts +0 -16
  105. package/dist/components/billing-info-container/hooks/index.d.ts +0 -3
  106. package/dist/components/billing-info-container/hooks/usePaymentContext.d.ts +0 -5
  107. package/dist/components/billing-info-container/hooks/usePaymentRedirect.d.ts +0 -14
  108. package/dist/components/billing-info-container/hooks/useStripePayment.d.ts +0 -18
  109. package/dist/components/billing-info-container/index.d.ts +0 -69
  110. package/dist/components/billing-info-container/utils.d.ts +0 -59
  111. package/dist/components/common/Checkbox.d.ts +0 -11
  112. package/dist/components/common/CheckboxField/index.d.ts +0 -9
  113. package/dist/components/common/CopyField.d.ts +0 -12
  114. package/dist/components/common/CopyMessageModal.d.ts +0 -7
  115. package/dist/components/common/CustomField.d.ts +0 -26
  116. package/dist/components/common/DatePickerField.d.ts +0 -20
  117. package/dist/components/common/FieldSection/index.d.ts +0 -19
  118. package/dist/components/common/FieldSection/utils/index.d.ts +0 -8
  119. package/dist/components/common/FormikPhoneNumberField.d.ts +0 -11
  120. package/dist/components/common/Loader.d.ts +0 -2
  121. package/dist/components/common/ModalComponent/index.d.ts +0 -16
  122. package/dist/components/common/NativeSelectFeild/index.d.ts +0 -21
  123. package/dist/components/common/PhoneNumberField.d.ts +0 -14
  124. package/dist/components/common/PoweredBy.d.ts +0 -2
  125. package/dist/components/common/RadioField.d.ts +0 -11
  126. package/dist/components/common/RadioGroupField/index.d.ts +0 -17
  127. package/dist/components/common/RedirectModal.d.ts +0 -7
  128. package/dist/components/common/SelectField/index.d.ts +0 -19
  129. package/dist/components/common/SnackbarAlert.d.ts +0 -13
  130. package/dist/components/common/index.d.ts +0 -11
  131. package/dist/components/common/socials.d.ts +0 -10
  132. package/dist/components/confirmModal/index.d.ts +0 -10
  133. package/dist/components/confirmationContainer/config.d.ts +0 -1
  134. package/dist/components/confirmationContainer/index.d.ts +0 -46
  135. package/dist/components/confirmationContainer/social-buttons.d.ts +0 -16
  136. package/dist/components/countdown/index.d.ts +0 -14
  137. package/dist/components/delegationsContainer/IssueComponent.d.ts +0 -10
  138. package/dist/components/delegationsContainer/IssueTicketForm.d.ts +0 -9
  139. package/dist/components/delegationsContainer/TicketsAssignedTable.d.ts +0 -11
  140. package/dist/components/delegationsContainer/TicketsAvailableTable.d.ts +0 -11
  141. package/dist/components/delegationsContainer/index.d.ts +0 -10
  142. package/dist/components/forgotPasswordModal/index.d.ts +0 -12
  143. package/dist/components/idVerificationContainer/VerificationPendingModal.d.ts +0 -10
  144. package/dist/components/idVerificationContainer/constants.d.ts +0 -21
  145. package/dist/components/idVerificationContainer/index.d.ts +0 -16
  146. package/dist/components/index.d.ts +0 -12
  147. package/dist/components/loginForm/index.d.ts +0 -31
  148. package/dist/components/loginModal/SignUpForm.d.ts +0 -10
  149. package/dist/components/loginModal/constants.d.ts +0 -39
  150. package/dist/components/loginModal/index.d.ts +0 -22
  151. package/dist/components/myTicketsContainer/index.d.ts +0 -16
  152. package/dist/components/myTicketsContainer/row.d.ts +0 -3
  153. package/dist/components/myTicketsContainer/tableConfig.d.ts +0 -5
  154. package/dist/components/orderDetailsContainer/CustomFieldsForm.d.ts +0 -12
  155. package/dist/components/orderDetailsContainer/TicketHolderCustomFields.d.ts +0 -10
  156. package/dist/components/orderDetailsContainer/index.d.ts +0 -66
  157. package/dist/components/orderDetailsContainer/ticketsTable.d.ts +0 -46
  158. package/dist/components/orderDetailsContainer/utils/index.d.ts +0 -6
  159. package/dist/components/paymentContainer/OrderDetails.d.ts +0 -9
  160. package/dist/components/paymentContainer/PaymentPlanSection.d.ts +0 -10
  161. package/dist/components/paymentContainer/handlePayment.d.ts +0 -15
  162. package/dist/components/paymentContainer/index.d.ts +0 -39
  163. package/dist/components/preRegistration/FieldsSection.d.ts +0 -19
  164. package/dist/components/preRegistration/Influancers.d.ts +0 -2
  165. package/dist/components/preRegistration/PreRegistrationComplete.d.ts +0 -13
  166. package/dist/components/preRegistration/PreRegistrationInformations.d.ts +0 -2
  167. package/dist/components/preRegistration/Prewards.d.ts +0 -2
  168. package/dist/components/preRegistration/ShareOptions.d.ts +0 -2
  169. package/dist/components/preRegistration/constants.d.ts +0 -2
  170. package/dist/components/preRegistration/index.d.ts +0 -23
  171. package/dist/components/preRegistration/utils.d.ts +0 -12
  172. package/dist/components/registerForm/adapters/index.d.ts +0 -4
  173. package/dist/components/registerForm/constants.d.ts +0 -1
  174. package/dist/components/registerForm/index.d.ts +0 -16
  175. package/dist/components/registerModal/index.d.ts +0 -12
  176. package/dist/components/resetPasswordContainer/index.d.ts +0 -10
  177. package/dist/components/rsvpContainer/index.d.ts +0 -7
  178. package/dist/components/seatMapContainer/SeatMapComponent.d.ts +0 -8
  179. package/dist/components/seatMapContainer/TicketsSection.d.ts +0 -9
  180. package/dist/components/seatMapContainer/addToCart.d.ts +0 -14
  181. package/dist/components/seatMapContainer/index.d.ts +0 -2
  182. package/dist/components/seatMapContainer/utils.d.ts +0 -6
  183. package/dist/components/signupModal/index.d.ts +0 -12
  184. package/dist/components/ticketResale/index.d.ts +0 -12
  185. package/dist/components/ticketResaleModal/index.d.ts +0 -19
  186. package/dist/components/ticketsContainer/AccessCodeSection.d.ts +0 -7
  187. package/dist/components/ticketsContainer/InfoIcon.d.ts +0 -5
  188. package/dist/components/ticketsContainer/PromoCodeSection.d.ts +0 -15
  189. package/dist/components/ticketsContainer/ReferralLogic.d.ts +0 -5
  190. package/dist/components/ticketsContainer/TicketRow.d.ts +0 -13
  191. package/dist/components/ticketsContainer/TicketsSection.d.ts +0 -20
  192. package/dist/components/ticketsContainer/TimeSlotTicketRow.d.ts +0 -19
  193. package/dist/components/ticketsContainer/TimeSlotsSection.d.ts +0 -25
  194. package/dist/components/ticketsContainer/index.d.ts +0 -93
  195. package/dist/components/ticketsContainer/utils.d.ts +0 -13
  196. package/dist/components/timerWidget/index.d.ts +0 -16
  197. package/dist/components/waitingList/index.d.ts +0 -9
  198. package/dist/constants/index.d.ts +0 -7
  199. package/dist/env.d.ts +0 -16
  200. package/dist/hoc/CustomFields/index.d.ts +0 -3
  201. package/dist/hoc/index.d.ts +0 -1
  202. package/dist/hooks/index.d.ts +0 -1
  203. package/dist/hooks/useCookieListener.d.ts +0 -1
  204. package/dist/hooks/useEventListener.d.ts +0 -1
  205. package/dist/hooks/useLocalStorageListener.d.ts +0 -1
  206. package/dist/hooks/useOnline.d.ts +0 -1
  207. package/dist/hooks/usePixel.d.ts +0 -6
  208. package/dist/images/Polygon.png +0 -0
  209. package/dist/images/cross.svg +0 -44
  210. package/dist/images/done.svg +0 -3
  211. package/dist/images/edit.svg +0 -10
  212. package/dist/images/email.svg +0 -1
  213. package/dist/images/instagram.svg +0 -5
  214. package/dist/images/logo-ttf.png +0 -0
  215. package/dist/images/spotify.svg +0 -6
  216. package/dist/images/user.svg +0 -1
  217. package/dist/images/xmark.svg +0 -92
  218. package/dist/normalizers/index.d.ts +0 -4
  219. package/dist/tf-checkout-react.cjs.development.js +0 -16149
  220. package/dist/tf-checkout-react.cjs.development.js.map +0 -1
  221. package/dist/tf-checkout-react.cjs.production.min.js +0 -2
  222. package/dist/tf-checkout-react.cjs.production.min.js.map +0 -1
  223. package/dist/tf-checkout-react.esm.js +0 -16116
  224. package/dist/tf-checkout-react.esm.js.map +0 -1
  225. package/dist/tf-checkout-styles.css +0 -1
  226. package/dist/types/add_on.d.ts +0 -8
  227. package/dist/types/billing-info-data.d.ts +0 -27
  228. package/dist/types/checkoutPageConfigs.d.ts +0 -13
  229. package/dist/types/index.d.ts +0 -6
  230. package/dist/types/order-data.d.ts +0 -15
  231. package/dist/types/payment-field.d.ts +0 -6
  232. package/dist/types/payment-plan-configuration.d.ts +0 -18
  233. package/dist/types/referral-promotion.d.ts +0 -6
  234. package/dist/types/verification.d.ts +0 -12
  235. package/dist/utils/adaptStripeErrors.d.ts +0 -8
  236. package/dist/utils/auth.d.ts +0 -21
  237. package/dist/utils/cookies.d.ts +0 -3
  238. package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +0 -23
  239. package/dist/utils/createMarkup.d.ts +0 -3
  240. package/dist/utils/customFields.d.ts +0 -35
  241. package/dist/utils/downloadPDF.d.ts +0 -1
  242. package/dist/utils/form.d.ts +0 -3
  243. package/dist/utils/formikErrorFocus.d.ts +0 -2
  244. package/dist/utils/getDomain.d.ts +0 -1
  245. package/dist/utils/getImage.d.ts +0 -1
  246. package/dist/utils/getQueryVariable.d.ts +0 -1
  247. package/dist/utils/htmlNodeFromString.d.ts +0 -1
  248. package/dist/utils/index.d.ts +0 -15
  249. package/dist/utils/isBrowser.d.ts +0 -1
  250. package/dist/utils/isValidNumber.d.ts +0 -1
  251. package/dist/utils/jsonUtils.d.ts +0 -1
  252. package/dist/utils/replaceVarInString.d.ts +0 -1
  253. package/dist/utils/setConfigs.d.ts +0 -11
  254. package/dist/utils/showZero.d.ts +0 -1
  255. package/dist/validators/index.d.ts +0 -8
  256. package/src/adapters/customFields.ts +0 -85
  257. package/src/adapters/index.ts +0 -1
  258. package/src/api/auth.ts +0 -88
  259. package/src/api/cart.ts +0 -28
  260. package/src/api/checkout.ts +0 -28
  261. package/src/api/common.ts +0 -190
  262. package/src/api/guestTicketDelegation.ts +0 -79
  263. package/src/api/index.ts +0 -346
  264. package/src/api/interceptors.ts +0 -77
  265. package/src/api/orders.ts +0 -30
  266. package/src/api/payment.ts +0 -77
  267. package/src/api/preRegistrationComplete.ts +0 -37
  268. package/src/api/publicRequest.ts +0 -47
  269. package/src/api/resale.ts +0 -28
  270. package/src/assets/images/Polygon.png +0 -0
  271. package/src/assets/images/cross.svg +0 -44
  272. package/src/assets/images/done.svg +0 -3
  273. package/src/assets/images/edit.svg +0 -10
  274. package/src/assets/images/email.svg +0 -1
  275. package/src/assets/images/instagram.svg +0 -5
  276. package/src/assets/images/logo-ttf.png +0 -0
  277. package/src/assets/images/spotify.svg +0 -6
  278. package/src/assets/images/user.svg +0 -1
  279. package/src/assets/images/xmark.svg +0 -92
  280. package/src/components/account-settings/index.tsx +0 -161
  281. package/src/components/account-settings/style.css +0 -200
  282. package/src/components/addonsContainer/AddonComponent.tsx +0 -204
  283. package/src/components/addonsContainer/SimpleAddonsContainer.tsx +0 -459
  284. package/src/components/addonsContainer/adapters/index.tsx +0 -62
  285. package/src/components/addonsContainer/index.tsx +0 -353
  286. package/src/components/addonsContainer/normalizers/index.ts +0 -5
  287. package/src/components/addonsContainer/useAddons.ts +0 -248
  288. package/src/components/addonsContainer/utils/index.tsx +0 -231
  289. package/src/components/billing-info-container/hooks/index.ts +0 -3
  290. package/src/components/billing-info-container/hooks/usePaymentContext.ts +0 -22
  291. package/src/components/billing-info-container/hooks/usePaymentRedirect.ts +0 -145
  292. package/src/components/billing-info-container/hooks/useStripePayment.ts +0 -119
  293. package/src/components/billing-info-container/index.tsx +0 -1695
  294. package/src/components/billing-info-container/style.css +0 -150
  295. package/src/components/billing-info-container/utils.tsx +0 -413
  296. package/src/components/common/Checkbox.tsx +0 -51
  297. package/src/components/common/CheckboxField/index.tsx +0 -41
  298. package/src/components/common/CopyField.tsx +0 -53
  299. package/src/components/common/CopyMessageModal.tsx +0 -34
  300. package/src/components/common/CustomField.tsx +0 -168
  301. package/src/components/common/DatePickerField.tsx +0 -126
  302. package/src/components/common/FieldSection/index.tsx +0 -141
  303. package/src/components/common/FieldSection/utils/index.tsx +0 -92
  304. package/src/components/common/FormikPhoneNumberField.tsx +0 -51
  305. package/src/components/common/Loader.tsx +0 -8
  306. package/src/components/common/ModalComponent/index.tsx +0 -68
  307. package/src/components/common/NativeSelectFeild/index.tsx +0 -86
  308. package/src/components/common/PhoneNumberField.tsx +0 -117
  309. package/src/components/common/PoweredBy.tsx +0 -15
  310. package/src/components/common/RadioField.tsx +0 -36
  311. package/src/components/common/RadioGroupField/index.tsx +0 -76
  312. package/src/components/common/RedirectModal.tsx +0 -43
  313. package/src/components/common/SelectField/index.tsx +0 -104
  314. package/src/components/common/SnackbarAlert.tsx +0 -52
  315. package/src/components/common/index.tsx +0 -11
  316. package/src/components/common/socials.tsx +0 -33
  317. package/src/components/confirmModal/index.tsx +0 -60
  318. package/src/components/confirmationContainer/config.ts +0 -79
  319. package/src/components/confirmationContainer/index.tsx +0 -349
  320. package/src/components/confirmationContainer/social-buttons.tsx +0 -149
  321. package/src/components/confirmationContainer/style.css +0 -206
  322. package/src/components/countdown/index.tsx +0 -100
  323. package/src/components/countdown/style.css +0 -10
  324. package/src/components/delegationsContainer/IssueComponent.tsx +0 -156
  325. package/src/components/delegationsContainer/IssueTicketForm.tsx +0 -109
  326. package/src/components/delegationsContainer/TicketsAssignedTable.tsx +0 -55
  327. package/src/components/delegationsContainer/TicketsAvailableTable.tsx +0 -54
  328. package/src/components/delegationsContainer/index.tsx +0 -83
  329. package/src/components/forgotPasswordModal/index.tsx +0 -138
  330. package/src/components/forgotPasswordModal/style.css +0 -47
  331. package/src/components/idVerificationContainer/VerificationPendingModal.tsx +0 -47
  332. package/src/components/idVerificationContainer/constants.ts +0 -27
  333. package/src/components/idVerificationContainer/index.tsx +0 -323
  334. package/src/components/index.ts +0 -12
  335. package/src/components/loginForm/index.tsx +0 -202
  336. package/src/components/loginModal/SignUpForm.tsx +0 -329
  337. package/src/components/loginModal/constants.ts +0 -46
  338. package/src/components/loginModal/index.tsx +0 -263
  339. package/src/components/loginModal/style.css +0 -116
  340. package/src/components/myTicketsContainer/index.tsx +0 -228
  341. package/src/components/myTicketsContainer/row.tsx +0 -46
  342. package/src/components/myTicketsContainer/style.css +0 -40
  343. package/src/components/myTicketsContainer/tableConfig.tsx +0 -80
  344. package/src/components/myTicketsContainer/types.d.ts +0 -41
  345. package/src/components/orderDetailsContainer/CustomFieldsForm.tsx +0 -75
  346. package/src/components/orderDetailsContainer/TicketHolderCustomFields.tsx +0 -100
  347. package/src/components/orderDetailsContainer/index.tsx +0 -586
  348. package/src/components/orderDetailsContainer/style.css +0 -77
  349. package/src/components/orderDetailsContainer/ticketsTable.tsx +0 -246
  350. package/src/components/orderDetailsContainer/utils/index.tsx +0 -55
  351. package/src/components/paymentContainer/OrderDetails.tsx +0 -277
  352. package/src/components/paymentContainer/PaymentPlanSection.tsx +0 -169
  353. package/src/components/paymentContainer/handlePayment.ts +0 -86
  354. package/src/components/paymentContainer/index.tsx +0 -643
  355. package/src/components/paymentContainer/style.css +0 -196
  356. package/src/components/preRegistration/FieldsSection.tsx +0 -150
  357. package/src/components/preRegistration/Influancers.tsx +0 -34
  358. package/src/components/preRegistration/PreRegistrationComplete.tsx +0 -186
  359. package/src/components/preRegistration/PreRegistrationInformations.tsx +0 -60
  360. package/src/components/preRegistration/Prewards.tsx +0 -41
  361. package/src/components/preRegistration/ShareOptions.tsx +0 -77
  362. package/src/components/preRegistration/constants.tsx +0 -169
  363. package/src/components/preRegistration/index.tsx +0 -330
  364. package/src/components/preRegistration/style.css +0 -3
  365. package/src/components/preRegistration/utils.ts +0 -163
  366. package/src/components/registerForm/adapters/index.tsx +0 -10
  367. package/src/components/registerForm/constants.tsx +0 -98
  368. package/src/components/registerForm/index.tsx +0 -188
  369. package/src/components/registerModal/index.tsx +0 -154
  370. package/src/components/registerModal/style.css +0 -18
  371. package/src/components/resetPasswordContainer/index.tsx +0 -102
  372. package/src/components/resetPasswordContainer/style.css +0 -36
  373. package/src/components/rsvpContainer/index.tsx +0 -126
  374. package/src/components/seatMapContainer/SeatMapComponent.tsx +0 -77
  375. package/src/components/seatMapContainer/TicketsSection.tsx +0 -286
  376. package/src/components/seatMapContainer/addToCart.ts +0 -66
  377. package/src/components/seatMapContainer/index.tsx +0 -443
  378. package/src/components/seatMapContainer/utils.ts +0 -133
  379. package/src/components/signupModal/index.tsx +0 -178
  380. package/src/components/signupModal/style.css +0 -58
  381. package/src/components/ticketResale/index.tsx +0 -86
  382. package/src/components/ticketResaleModal/index.tsx +0 -224
  383. package/src/components/ticketResaleModal/style.css +0 -28
  384. package/src/components/ticketsContainer/AccessCodeSection.tsx +0 -50
  385. package/src/components/ticketsContainer/InfoIcon.tsx +0 -35
  386. package/src/components/ticketsContainer/PromoCodeSection.tsx +0 -116
  387. package/src/components/ticketsContainer/ReferralLogic.tsx +0 -33
  388. package/src/components/ticketsContainer/TicketRow.tsx +0 -107
  389. package/src/components/ticketsContainer/TicketsSection.tsx +0 -350
  390. package/src/components/ticketsContainer/TimeSlotTicketRow.tsx +0 -243
  391. package/src/components/ticketsContainer/TimeSlotsSection.tsx +0 -194
  392. package/src/components/ticketsContainer/index.tsx +0 -986
  393. package/src/components/ticketsContainer/style.css +0 -178
  394. package/src/components/ticketsContainer/utils.ts +0 -35
  395. package/src/components/timerWidget/index.tsx +0 -97
  396. package/src/components/timerWidget/style.css +0 -35
  397. package/src/components/waitingList/index.tsx +0 -190
  398. package/src/components/waitingList/style.css +0 -27
  399. package/src/constants/index.ts +0 -3
  400. package/src/env.ts +0 -29
  401. package/src/hoc/CustomFields/index.tsx +0 -85
  402. package/src/hoc/index.ts +0 -1
  403. package/src/hooks/index.ts +0 -1
  404. package/src/hooks/useCookieListener.ts +0 -32
  405. package/src/hooks/useEventListener.ts +0 -32
  406. package/src/hooks/useLocalStorageListener.ts +0 -32
  407. package/src/hooks/useOnline.ts +0 -21
  408. package/src/hooks/usePixel.ts +0 -88
  409. package/src/normalizers/index.ts +0 -49
  410. package/src/types/add_on.ts +0 -8
  411. package/src/types/api/auth.d.ts +0 -63
  412. package/src/types/api/axiosResponse.d.ts +0 -6
  413. package/src/types/api/cart.d.ts +0 -73
  414. package/src/types/api/checkout.d.ts +0 -92
  415. package/src/types/api/common.d.ts +0 -153
  416. package/src/types/api/guestTicketDelegation.d.ts +0 -18
  417. package/src/types/api/orders.d.ts +0 -116
  418. package/src/types/api/payment.d.ts +0 -180
  419. package/src/types/api/preRegistration.d.ts +0 -11
  420. package/src/types/api/preRegistrationComplete.d.ts +0 -95
  421. package/src/types/api/ticketResale.d.ts +0 -13
  422. package/src/types/billing-info-data.ts +0 -37
  423. package/src/types/checkoutPageConfigs.ts +0 -13
  424. package/src/types/formFields.d.ts +0 -29
  425. package/src/types/index.ts +0 -6
  426. package/src/types/order-data.ts +0 -16
  427. package/src/types/payment-field.ts +0 -7
  428. package/src/types/payment-plan-configuration.ts +0 -19
  429. package/src/types/pre-registration-complete.d.ts +0 -47
  430. package/src/types/referral-promotion.ts +0 -7
  431. package/src/types/seatMap.d.ts +0 -159
  432. package/src/types/verification.ts +0 -12
  433. package/src/utils/adaptStripeErrors.ts +0 -26
  434. package/src/utils/auth.ts +0 -45
  435. package/src/utils/cookies.ts +0 -73
  436. package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +0 -81
  437. package/src/utils/createMarkup.ts +0 -1
  438. package/src/utils/customFields.ts +0 -80
  439. package/src/utils/downloadPDF.tsx +0 -42
  440. package/src/utils/form.ts +0 -34
  441. package/src/utils/formikErrorFocus.ts +0 -24
  442. package/src/utils/getDomain.ts +0 -21
  443. package/src/utils/getImage.ts +0 -14
  444. package/src/utils/getQueryVariable.ts +0 -13
  445. package/src/utils/htmlNodeFromString.ts +0 -6
  446. package/src/utils/index.ts +0 -15
  447. package/src/utils/isBrowser.ts +0 -2
  448. package/src/utils/isValidNumber.ts +0 -8
  449. package/src/utils/jsonUtils.ts +0 -8
  450. package/src/utils/replaceVarInString.ts +0 -9
  451. package/src/utils/setConfigs.ts +0 -24
  452. package/src/utils/showZero.tsx +0 -10
  453. package/src/validators/index.ts +0 -61
package/README.md CHANGED
@@ -1,1086 +1,194 @@
1
1
  # tf-checkout-react
2
2
 
3
-  
3
+ The TicketFairy checkout for the web. Drop in one component and you have ticket
4
+ selection, add-ons, buyer details, payment, ID verification, and the receipt —
5
+ or compose the sections yourself.
4
6
 
5
- <details open>
6
- <summary>
7
- <strong>Table of Contents</strong>
8
- </summary>
9
-
10
- - [tf-checkout-react](#tf-checkout-react)
11
- - [Code style and formatting](#code-style-and-formatting)
12
- - [Introduction](#introduction)
13
- - [Intergrations](#intergrations)
14
- - [WebFlow](#webflow)
15
- - [Prerequisites](#prerequisites)
16
- - [Installation](#installation)
17
- - [Run Independently](#run-independently)
18
- - [Usage](#usage)
19
- - [Set configuration](#set-configuration)
20
- - [Configurations for production](#configurations-for-production)
21
- - [Configurations for development/testing](#configurations-for-developmenttesting)
22
- - [Functionalities](#functionalities)
23
- - [Login](#login)
24
- - [Register](#register)
25
- - [Forgot Password](#forgot-password)
26
- - [Promo Code](#promo-code)
27
- - [**Note that package automatically calls component in `TicketsContainer`**](#note-that-package-automatically-calls-component-in-ticketscontainer)
28
- - [Access Code](#access-code)
29
- - [**Note that package automatically calls component in `TicketsContainer`**](#note-that-package-automatically-calls-component-in-ticketscontainer-1)
30
- - [Waiting List](#waiting-list)
31
- - [**Note that package automatically calls component in `TicketsContainer`**](#note-that-package-automatically-calls-component-in-ticketscontainer-2)
32
- - [Pixel Usage](#pixel-usage)
33
- - [Components](#components)
34
- - [`TicketsContainer`](#ticketscontainer)
35
- - [`AddOnsContainer`](#addonscontainer)
36
- - [`BillingInfoContainer`](#billinginfocontainer)
37
- - [`PaymentContainer`](#paymentcontainer)
38
- - [`ConfirmationContainer`](#confirmationcontainer)
39
- - [`MyTicketsContainer`](#myticketscontainer)
40
- - [Orders Container](#orders-container)
41
- - [Order Details Container](#order-details-container)
42
- - [Ticket Resale Container](#ticket-resale-container)
43
- - [Commands](#commands)
44
- - [Rollup](#rollup)
45
- - [Optimizations](#optimizations)
46
- - [TypeScript](#typescript)
47
- - [GitHub Actions](#github-actions)
48
-
49
- </details>
50
-
51
- ## Code style and formatting
52
-
53
- 1. **Install Prettier ESLint extension (v5.1.0)**
54
- - VSCode: <https://marketplace.visualstudio.com/items?itemName=rvest.vs-code-prettier-eslint>
55
- - JetBrains' products: <https://blog.jetbrains.com/webstorm/2016/08/using-external-tools/>
56
- Notes:
57
- - The Prettier extension is not required.
58
- - The ESLint extension is not required. However, it is needed to have lint errors show while editing your file.
59
- 2. **Set Prettier ESLint default formatter**
60
-
61
- - VSCode: Open commands (CMD/Win + Stift + P) -> Format document with -> Configure default formatter
62
- - JetBrains' products: <https://blog.jetbrains.com/webstorm/2016/08/using-external-tools/>
63
-
64
- 3. **Enable format on save**
65
-
66
- - VSCode: Open settings (CMD + ,) -> Search "Format On Save"
67
- - JetBrains' products: <https://blog.jetbrains.com/webstorm/2016/08/using-external-tools/>
68
-
69
- &nbsp;
70
-
71
- # Introduction
72
-
73
- This package includes TicketFairy's checkout functionality, as well as various related functionalities. These functionalities include login/register, order management, resale, referrals, and more.
74
-
75
- This package provides a set of components and functionalities designed to manage various aspects of the TicketFairy event experience. These include:
76
-
77
- - `AccountSettings`: A component for managing user account settings, such as email address and password.
78
- - `AddonsContainter`: A component for displaying a list of available add-ons and allowing the user to purchase them.
79
- - `BillingInfoContainer`: A component for managing billing information, such as addresses and ticket holders. Features enhanced field rendering, improved validation, and better user experience.
80
- - `ConfirmationContainer`: A component for displaying a confirmation page after a purchase is made.
81
- - `IDVerification`: A component for verifying the identity of the user during the checkout process.
82
- - `MyTicketsContainer`: A component for displaying a list of purchased orders.
83
- - `OrderDetailsContainer`: A component for displaying detailed information about a purchase, such as the ticket types, add-ons and pricing.
84
- - `PaymentContainer`: A component for managing payment processing during the checkout process. Includes enhanced Stripe integration, improved payment validation, and better error handling.
85
- - `ResetPasswordContainer`: A component for resetting a user's password.
86
- - `SeatMapContainer`: A component for displaying and selecting seats on a venue map.
87
- - `TicketResaleContainer`: A component for managing the resale of tickets or add-ons by the user.
88
- - `TicketsContainer`: A component for displaying a list of available tickets and allowing the user to purchase them. Features optimized API calls, better state management, and enhanced user interactions.
89
-
90
- Together, these components and functionalities provide a comprehensive set of tools to manage the checkout process and related activities for a TicketFairy-powered event.
91
- &nbsp;
92
- &nbsp;
93
-
94
- # Intergrations
95
-
96
- ## [WebFlow](/webflow/public/INTEGRATION.md)
97
-
98
- &nbsp;
99
-
100
- # Prerequisites
101
-
102
- - node >= v16.19.0
103
- - npm >= 8.19.3
104
-
105
- # Installation
106
-
107
- ```bash
108
- npm i tf-checkout-react
109
- ```
110
-
111
- or
7
+ ## Install
112
8
 
113
9
  ```bash
114
- yarn add tf-checkout-react
10
+ npm install tf-checkout-react @tanstack/react-query react react-dom
115
11
  ```
116
12
 
117
- ## Run Independently
13
+ `@tanstack/react-query`, `react`, and `react-dom` are peer dependencies, so
14
+ there is exactly one copy in your app. Everything else — the SDK core, Stripe.js,
15
+ Xendit, the seat map — ships inside the package.
118
16
 
119
- - Clone this repo: `git clone https://github.com/theticketfairy/tf-checkout-react.git`
120
- - Install dependencies: `npm install`
121
- - Install example app dependencies: `cd example && npm install`
122
- - Run example app from example folder: `npm start`
17
+ Styles load automatically. There is no CSS import to remember.
123
18
 
124
- Project will run under `localhost:3002`. Port can be changed from `package.json`.
19
+ ## Use it
125
20
 
126
- &nbsp;
21
+ ```tsx
22
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
23
+ import { configureCheckout, EmbeddedCheckout } from 'tf-checkout-react'
127
24
 
128
- # Usage
25
+ configureCheckout({ env: 'PROD', clientId: '…', clientSecret: '…' })
129
26
 
130
- ## Set configuration
27
+ const queryClient = new QueryClient()
131
28
 
132
- In order to make this package work properly, you need to set some configurations, otherwise the default configurations will be used.
133
- Currently only configuration which is needed for production, is `BASE_URL`.
134
- Other configurations written below are only for development/test environments.
135
-
136
- Import `setConfigs` function from the package.
137
-
138
- ```js
139
- import { setConfigs } from 'tf-checkout-react'
29
+ export const App = () => (
30
+ <QueryClientProvider client={queryClient}>
31
+ <EmbeddedCheckout eventId="14304" onComplete={(order) => console.log(order)} />
32
+ </QueryClientProvider>
33
+ )
140
34
  ```
141
35
 
142
- Call it in the root and pass neccesary options. Here are available options:
143
-
144
- ### Configurations for production
145
-
146
- - BASE_URL - need for making API calls (default: `https://www.ticketfairy.com`)
147
-
148
- ### Configurations for development/testing
149
-
150
- - BASE_URL - need for making API calls
151
- - EVENT_ID - get and use specific event data
152
- - BRAND_SLUG - slug of the event's parent/owner brand
153
- - X_SOURCE_ORIGIN - need for local environment. This header will be included in every API request.
154
-
155
- &nbsp;
36
+ That is the whole integration. `configureCheckout` runs once at app start and
37
+ defaults token storage to `localStorage` (SSR-safe — it no-ops on the server).
156
38
 
157
- # Single Page Checkout Implementation
39
+ ### Environments
158
40
 
159
- ## Overview
160
-
161
- While the default implementation uses separate pages for each checkout step (`TicketsContainer` → `BillingInfoContainer` → `PaymentContainer` → `ConfirmationContainer`), the package also supports a **single page checkout flow** where all components are rendered on the same page with conditional visibility and state management.
162
-
163
- ## Key Differences from Default Flow
164
-
165
- ### **Default Multi-Page Flow:**
166
-
167
- - Each component handles its own routing and navigation
168
- - State is managed through URL parameters and localStorage
169
- - Components are mounted/unmounted as user navigates
170
- - Each step is a separate page/route
41
+ ```ts
42
+ configureCheckout({ env: 'STAG', clientId, clientSecret })
43
+ ```
44
+
45
+ `PROD` `www.ticketfairy.com`, `STAG` `test.ticketfairy.com`, `DEV` →
46
+ `sandbox.ticketfairy.com`. Pass `baseUrl` instead to point somewhere else;
47
+ `baseUrl: ''` means same-origin, which is what you want behind a dev proxy.
48
+
49
+ ## `<EmbeddedCheckout />`
50
+
51
+ | Prop | Type | Default | Does |
52
+ | ----------------------------------- | ----------------------------------- | ----------- | ----------------------------------------------------------------------- |
53
+ | `eventId` | `string` | — | The event to sell. Required. |
54
+ | `onComplete` | `(order: PlaceOrderResult) => void` | — | Fires once payment settles. |
55
+ | `confirmationMode` | `'inline' \| 'redirect'` | `'inline'` | `redirect` leaves routing to `onComplete`. |
56
+ | `initialView` | `'tickets' \| 'seats'` | `'tickets'` | Opening screen — preserves an existing `/seat-map` route. |
57
+ | `onViewChange` | `(view) => void` | — | Reports the visible view so hosts can coordinate UI. |
58
+ | `autoScroll` | `boolean` | `true` | Smooth-scroll to buyer details once the cart is reserved. |
59
+ | `requireEmailConfirmation` | `boolean` | `true` | Make guests repeat their email. |
60
+ | `collectTicketHolders` | `boolean` | `true` | One named holder per ticket. |
61
+ | `collectHolderContact` | `boolean` | `true` | Also collect holder email/phone. |
62
+ | `skipBillingWhenProfileComplete` | `boolean` | `false` | Skip billing for complete signed-in profiles. Payment is never skipped. |
63
+ | `auth` | `false \| AuthOptions` | built-in | Configure or remove the login modal. |
64
+ | `onLogin` | `(email?: string) => void` | — | Open your own login UI instead of the built-in modal. |
65
+ | `privacyPolicy` | `CheckoutPrivacyPolicy` | — | Your privacy policy link and brand name. |
66
+ | `additionalConditions` | `EventCondition[]` | — | Extra required/optional acknowledgements. |
67
+ | `ttfOptInLabel` / `brandOptInLabel` | `string` | — | Override the marketing opt-in copy. |
68
+ | `initialPromoCode` | `string` | — | Apply a promo code on load. |
69
+ | `referrer` | `string \| number` | — | Attribute the sale. |
70
+ | `readAttributionFromUrl` | `boolean` | — | Read promo/referrer from the query string. |
71
+ | `showTestCardHint` | `boolean` | `false` | Show sandbox card copy. Demos only. |
72
+ | `theme` | `CheckoutTheme` | — | Recolor via design tokens. |
73
+ | `className` | `string` | — | Class on the root element. |
74
+
75
+ ### Resuming a checkout
76
+
77
+ `<ResumedCheckout />` attaches to a cart created elsewhere — an accepted resale
78
+ invitation, or a session restored after a redirect.
79
+
80
+ ## Theming
81
+
82
+ Pass design tokens; the component maps them to CSS variables.
83
+
84
+ ```tsx
85
+ <EmbeddedCheckout
86
+ eventId="14304"
87
+ theme={{
88
+ colorScheme: 'dark',
89
+ accent: '#ff2d55',
90
+ radiusCard: '16px',
91
+ }}
92
+ />
93
+ ```
171
94
 
172
- ### **Single Page Flow:**
95
+ Tokens cover color (`accent`, `accentHover`, `accentContrast`, `surface`,
96
+ `surfaceMuted`, `text`, `muted`, `border`, `error`, `success`), shape
97
+ (`radiusCard`, `radiusControl`), and typography.
173
98
 
174
- - All components are conditionally rendered on the same page
175
- - State management requires careful coordination between components
176
- - Components remain mounted but visibility is controlled
177
- - Navigation is handled through state changes rather than routing
99
+ Everything is scoped under `.tf-checkout` with `tf-checkout-*` BEM classes, so
100
+ plain CSS overrides work too and nothing leaks into your page.
178
101
 
179
- ## Implementation Patterns
102
+ ## Composing your own layout
180
103
 
181
- ### **1. State Management**
104
+ Every section reads the same `useCheckout()` store from the provider, so you can
105
+ arrange them however you like.
182
106
 
183
- ```jsx
184
- import React, { useState } from 'react'
107
+ ```tsx
185
108
  import {
186
- TicketsContainer,
187
- BillingInfoContainer,
188
- PaymentContainer,
189
- ConfirmationContainer
109
+ CheckoutProvider,
110
+ Tickets,
111
+ AddOns,
112
+ BillingInfo,
113
+ Payment,
114
+ OrderSummary,
115
+ useCheckout,
190
116
  } from 'tf-checkout-react'
191
117
 
192
- const SinglePageCheckout = () => {
193
- const [currentStep, setCurrentStep] = useState('tickets')
194
- const [checkoutData, setCheckoutData] = useState({})
195
- const [cartData, setCartData] = useState(null)
196
-
197
- const handleTicketsSuccess = (data) => {
198
- setCartData(data)
199
- setCurrentStep('billing')
200
- }
201
-
202
- const handleBillingSuccess = (data) => {
203
- setCheckoutData(prev => ({ ...prev, billing: data }))
204
- setCurrentStep('payment')
205
- }
206
-
207
- const handlePaymentSuccess = (data) => {
208
- setCheckoutData(prev => ({ ...prev, payment: data }))
209
- setCurrentStep('confirmation')
210
- }
211
-
212
- return (
213
- <div className="single-page-checkout">
214
- {currentStep === 'tickets' && (
215
- <TicketsContainer
216
- eventId={eventId}
217
- onAddToCartSuccess={handleTicketsSuccess}
218
- // Disable auto-navigation
219
- enableBillingInfoAutoCreate={false}
220
- />
221
- )}
222
-
223
- {currentStep === 'billing' && (
224
- <BillingInfoContainer
225
- handleSubmit={handleBillingSuccess}
226
- // Skip automatic payment redirect
227
- skipPage={false}
228
- />
229
- )}
230
-
231
- {currentStep === 'payment' && (
232
- <PaymentContainer
233
- checkoutData={checkoutData}
234
- handlePayment={handlePaymentSuccess}
235
- />
236
- )}
237
-
238
- {currentStep === 'confirmation' && (
239
- <ConfirmationContainer
240
- orderHash={checkoutData.payment?.orderHash}
241
- />
242
- )}
243
- </div>
244
- )
245
- }
246
- ```
247
-
248
- ### **2. Progressive Enhancement Pattern**
249
-
250
- ```jsx
251
- const ProgressiveCheckout = () => {
252
- const [completedSteps, setCompletedSteps] = useState(new Set())
253
- const [activeStep, setActiveStep] = useState('tickets')
254
-
255
- const markStepComplete = (step) => {
256
- setCompletedSteps(prev => new Set([...prev, step]))
257
- }
258
-
259
- const isStepAccessible = (step) => {
260
- const stepOrder = ['tickets', 'billing', 'payment', 'confirmation']
261
- const stepIndex = stepOrder.indexOf(step)
262
- const prevStep = stepOrder[stepIndex - 1]
263
- return stepIndex === 0 || completedSteps.has(prevStep)
264
- }
265
-
266
- return (
267
- <div className="progressive-checkout">
268
- {/* Step Navigation */}
269
- <div className="checkout-steps">
270
- {['tickets', 'billing', 'payment', 'confirmation'].map(step => (
271
- <button
272
- key={step}
273
- disabled={!isStepAccessible(step)}
274
- className={`step ${activeStep === step ? 'active' : ''} ${completedSteps.has(step) ? 'completed' : ''}`}
275
- onClick={() => setActiveStep(step)}
276
- >
277
- {step.charAt(0).toUpperCase() + step.slice(1)}
278
- </button>
279
- ))}
280
- </div>
281
-
282
- {/* Component Rendering */}
283
- <div className="checkout-content">
284
- {activeStep === 'tickets' && (
285
- <TicketsContainer
286
- onAddToCartSuccess={(data) => {
287
- markStepComplete('tickets')
288
- setActiveStep('billing')
289
- }}
290
- />
291
- )}
292
- {/* ... other components */}
293
- </div>
294
- </div>
295
- )
296
- }
297
- ```
298
-
299
- ### **3. Accordion/Collapsible Pattern**
300
-
301
- ```jsx
302
- const AccordionCheckout = () => {
303
- const [openSections, setOpenSections] = useState(new Set(['tickets']))
304
- const [completedSections, setCompletedSections] = useState(new Set())
305
-
306
- const toggleSection = (section) => {
307
- setOpenSections(prev => {
308
- const newSet = new Set(prev)
309
- if (newSet.has(section)) {
310
- newSet.delete(section)
311
- } else {
312
- newSet.add(section)
313
- }
314
- return newSet
315
- })
316
- }
118
+ const MyCheckout = () => {
119
+ const checkout = useCheckout({ eventId: '14304' })
317
120
 
318
121
  return (
319
- <div className="accordion-checkout">
320
- <div className="checkout-section">
321
- <div
322
- className="section-header"
323
- onClick={() => toggleSection('tickets')}
324
- >
325
- <h3>Select Tickets</h3>
326
- {completedSections.has('tickets') && <span>✓</span>}
327
- </div>
328
- {openSections.has('tickets') && (
329
- <TicketsContainer
330
- onAddToCartSuccess={(data) => {
331
- setCompletedSections(prev => new Set([...prev, 'tickets']))
332
- setOpenSections(new Set(['billing']))
333
- }}
334
- />
335
- )}
122
+ <CheckoutProvider theme={{ colorScheme: 'dark' }}>
123
+ <Tickets />
124
+ <AddOns />
125
+ <div className="my-two-column">
126
+ <BillingInfo />
127
+ <OrderSummary />
336
128
  </div>
337
-
338
- <div className="checkout-section">
339
- <div
340
- className="section-header"
341
- onClick={() => toggleSection('billing')}
342
- >
343
- <h3>Billing Information</h3>
344
- {completedSections.has('billing') && <span>✓</span>}
345
- </div>
346
- {openSections.has('billing') && (
347
- <BillingInfoContainer
348
- handleSubmit={(values, helpers, eventId, res) => {
349
- setCompletedSections(prev => new Set([...prev, 'billing']))
350
- setOpenSections(new Set(['payment']))
351
- }}
352
- />
353
- )}
354
- </div>
355
-
356
- {/* ... other sections */}
357
- </div>
129
+ <Payment />
130
+ </CheckoutProvider>
358
131
  )
359
132
  }
360
133
  ```
361
134
 
362
- ## Important Considerations
363
-
364
- ### **Component Props Modifications**
135
+ **Sections** `Tickets`, `SeatMap`, `AddOns`, `BillingInfo`, `Payment`,
136
+ `OrderSummary`, `IDVerification`, `Confirmation`, `OrderConfirmation`,
137
+ `OrderIDVerification`.
365
138
 
366
- - **`enableBillingInfoAutoCreate: false`** - Prevents automatic navigation to billing page
367
- - **`skipPage: false`** - Controls whether billing page can be skipped
368
- - **Custom callback handlers** - Override default navigation behavior
139
+ **UI primitives** `Card`, `SectionHeader`, `Pill`, `Button`, `Field`,
140
+ `FieldRow`, `Input`, `Textarea`, `Select`, `Checkbox`, `PaymentMethods`,
141
+ `QuantitySelect`, `PriceLine`, `Stepper`, `Timer`, `TimerBanner`, `Loader`.
369
142
 
370
- ### **State Persistence**
143
+ **Auth** — `AuthModal`, `LoginForm`, `RegisterForm`, `ForgotPasswordForm`,
144
+ `ResetPasswordForm`.
371
145
 
372
- ```jsx
373
- // Save state to localStorage for page refreshes
374
- useEffect(() => {
375
- localStorage.setItem('checkoutState', JSON.stringify({
376
- currentStep,
377
- checkoutData,
378
- cartData
379
- }))
380
- }, [currentStep, checkoutData, cartData])
381
-
382
- // Restore state on component mount
383
- useEffect(() => {
384
- const savedState = localStorage.getItem('checkoutState')
385
- if (savedState) {
386
- const { currentStep, checkoutData, cartData } = JSON.parse(savedState)
387
- setCurrentStep(currentStep)
388
- setCheckoutData(checkoutData)
389
- setCartData(cartData)
390
- }
391
- }, [])
392
- ```
146
+ ## Headless
393
147
 
394
- ### **Error Handling**
148
+ `useCheckout()` gives you the whole flow with no UI at all.
395
149
 
396
- ```jsx
397
- const [errors, setErrors] = useState({})
150
+ ```tsx
151
+ const checkout = useCheckout({ eventId: '14304' })
398
152
 
399
- const handleStepError = (step, error) => {
400
- setErrors(prev => ({ ...prev, [step]: error }))
401
- // Optionally navigate back to error step
402
- setCurrentStep(step)
403
- }
404
-
405
- // Pass error handlers to each component
406
- <BillingInfoContainer
407
- onSubmitError={(error) => handleStepError('billing', error)}
408
- handleSubmit={handleBillingSuccess}
409
- />
153
+ await checkout.setTickets('14304', [{ ticketTypeId: '1', quantity: 2 }])
154
+ checkout.setBilling({ firstName, lastName, email, phone })
155
+ checkout.setHolders(holders)
156
+ checkout.setConsent({ ttfOptIn: true, brandOptIn: false })
157
+ const order = await checkout.placeOrder('card')
410
158
  ```
411
159
 
412
- ### **Timer Coordination**
413
-
414
- When using timers across multiple components in single page flow:
415
-
416
- ```jsx
417
- const [globalTimer, setGlobalTimer] = useState(null)
418
-
419
- // Share timer state across components
420
- <TicketsContainer enableTimer={false} />
421
- <BillingInfoContainer enableTimer={false} />
422
- <PaymentContainer enableTimer={true} onCountdownFinish={handleTimeout} />
423
-
424
- // Or implement global timer
425
- <TimerWidget
426
- onCountdownFinish={handleGlobalTimeout}
427
- className="global-timer"
428
- />
429
- ```
430
-
431
- &nbsp;
432
-
433
- # Functionalities
434
-
435
- ## Login
436
-
437
- The `LoginModal` component is designed to be used inside package to authenticate users. <br /> To use the `LoginModal`, simply include it in your React component and pass in the required **onLogin** and **onClose** callbacks as props.
438
-
439
- You can authenticate users from the Billing page too, here you can either provide **onLogin** callback as a prop to the [`BillingInfoContainer`](#billinginfocontainer) component so that you can open your custom component for authentication or
440
- you can ommit it and the package inside provided `LoginModal` component will be called and opened.
441
-
442
- Package can detect whether a user is logged in or not by checking for the presence of the **X-TF-ECOMMERCE** cookie, which is automatically set by the system when the user successfully logs in.
443
- If the **X-TF-ECOMMERCE** cookie is present, the package assumes that the user is logged in and displays the appropriate content.
444
-
445
- The `LoginModal` component also is used in [`MyTicketsContainer`](#myticketscontainer) and [`TicketsContainer`](#ticketscontainer).
446
-
447
- To detect whether a user is logged in or not, you can use the **useCookieListener** hook provided by the package.
448
- Here's an example of how to use the **useCookieListener** hook to automatically detect whether the user is logged in:
449
-
450
- ```jsx
451
- import { useEffect, useRef, useState } from 'react'
452
- import { useCookieListener } from 'tf-checkout-react'
453
-
454
- const MyComponent = () => {
455
- const [isLogged, setIsLogged] = useState(false)
456
-
457
- // Listen for changes to the __X-TF-ECOMMERCE__ cookie
458
- useCookieListener('X_TF_ECOMMERCE', value => setIsLogged(Boolean(value)))
459
-
460
- // ... rest of component logic
461
- }
462
- ```
463
-
464
- <br />
465
-
466
- <details open>
467
- <summary><b>Login Modal Props Interface:</b></summary>
468
-
469
- | Property | Type | Required | Default Value | Description |
470
- | ------------------------ | ------------------- | -------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
471
- | onLogin | () => void | yes | N/A | Called after the user successfully authorizes. |
472
- | onClose | () => void | yes | N/A | Called on modal close. |
473
- | onGetProfileDataSuccess | (data) => void | no | value => value | A callback function that is called when the profile data is successfully retrieved. |
474
- | onGetProfileDataError | (error) => void | no | value => value | A callback function that is called when retrieving the profile data fails. |
475
- | onForgotPassword | () => void | no | value => value | Called on “Forgot Password” button click. |
476
- | onSignup | () => void | no | value => value | Called on “Sign Up” button click. |
477
- | modalClassname | string | no | " " | Login modal main container class. |
478
- | logo | string / URL / path | no | TheTicketFairy black logo (URL) | Login modal top section’s logo. |
479
- | showForgotPasswordButton | boolean | no | false | Display “Forgot Password” button. |
480
- | showSignUpButton | boolean | no | false | Display “Sign Up” button. |
481
- | alreadyHasUser | boolean | no | false | Whether or not to show the "email is already attached to an account" message block. |
482
- | userExpired | boolean | no | false | Whether or not to show the "session expired" message block. |
483
- | showPoweredByImage | boolean | no | false | Whether or not to show the <a href="https://cdn-checkout.s3.us-east-2.amazonaws.com/IconTicketFairy.svg">Powered image</a>. |
484
-
485
- </details>
486
-
487
- &nbsp;
488
-
489
- ## Register
490
-
491
- The `RegisterModal` component is designed to be used inside package to allows users to register for an account. <br />
492
-
493
- When the user submits the form, the component calls the register API function to create the user's account.
494
- If account creation is successful, the component then retrieves the user's profile data. The **onGetProfileDataSuccess** and **onGetProfileDataError** callbacks are then called depending on whether the profile data retrieval succeeds or fails.
495
- If profile data retrieval succeeds, the component maps the profile data to a format used by the application and saves the resulting data to the browser's localStorage.
496
- Finally, the **onClose** callback is called to close the modal.
497
-
498
- <details open>
499
- <summary><b>Register Modal Props Interface:</b></summary>
500
-
501
- | Property | Type | Required | Default Value | Description |
502
- | ----------------------- | --------------- | -------- | -------------- | --------------------------------------------------------------------------------------------------------------------------- |
503
- | onRegister (deprecated) | () => void | no | N/A | - |
504
- | onClose | () => void | yes | N/A | Called on modal close, after register request's success. |
505
- | onGetProfileDataSuccess | (data) => void | no | value => value | A callback function that is called when the profile data is successfully retrieved. |
506
- | onGetProfileDataError | (error) => void | no | value => value | A callback function that is called when retrieving the profile data fails. |
507
- | showPoweredByImage | boolean | no | false | Whether or not to show the <a href="https://cdn-checkout.s3.us-east-2.amazonaws.com/IconTicketFairy.svg">Powered image</a>. |
508
-
509
- </details>
510
-
511
- &nbsp;
512
-
513
- ## Forgot Password
514
-
515
- The `ForgotPasswordModal` component is a modal dialog for users to reset their passwords.
516
- To use it, simply import the component, manage its open state, and provide callback functions for closing the modal, navigating back to the login page or component, handling successful password reset requests, and handling errors in password reset requests.
517
- Optionally, you can also display a "Powered By" image within the modal by setting the **showPoweredByImage** prop to true.
518
-
519
- <details open>
520
- <summary><b>Forgot Password Modal Props Interface:</b></summary>
521
-
522
- | Property | Type | Required | Default Value | Description |
523
- | ----------------------- | --------------- | -------- | -------------- | --------------------------------------------------------------------------------------------------------------------------- |
524
- | onLogin | () => void | yes | N/A | Called on "Back to Log In" button click. |
525
- | onClose | () => void | yes | N/A | Called on modal close, after register request's success. |
526
- | onForgotPasswordSuccess | (data) => void | no | value => value | A callback function that is called when the user successfully resets their password. |
527
- | onForgotPasswordError | (error) => void | no | value => value | A callback function that is called when there is an error resetting the password. |
528
- | showPoweredByImage | boolean | no | false | Whether or not to show the <a href="https://cdn-checkout.s3.us-east-2.amazonaws.com/IconTicketFairy.svg">Powered image</a>. |
529
-
530
- </details>
531
- &nbsp;
532
-
533
- ## Promo Code
534
-
535
- The `PromoCodeSection` is a React component for handling promo code input, validation, and displaying success or error messages.
536
- It accepts various props to control its appearance and behavior, such as the promo code value, validation status, input visibility, and callback functions for updating the state which you can see in the below provided table.
537
-
538
- To use this component, simply import it and include it in your JSX with the required props, managing the component's state and callback functions in the parent component as needed.
539
-
540
- ### **Note that package automatically calls component in [`TicketsContainer`](#ticketscontainer)**
541
-
542
- <br />
543
-
544
- <details open>
545
- <summary><b>Promo Code Props Interface:</b></summary>
546
-
547
- | Property | Type | Required | Default Value | Description |
548
- | ----------------- | -------------------------------------- | -------- | ------------- | --------------------------------------------------------------------- |
549
- | code | string | yes | ' ' | The promo code. |
550
- | codeIsApplied | boolean | yes | false | Whether or not the promo code is currently applied. |
551
- | showPromoInput | boolean | yes | false | Whether or not to show the promo code input field. |
552
- | codeIsInvalid | boolean | yes | false | Whether or not the promo code is invalid. |
553
- | showAlertIcons | boolean | no | false | Whether or not to show the alert icons. |
554
- | promoText | string | no | false | Button label, which click displays promo code input. |
555
- | - | - | - | - | - |
556
- | setCode | (value: string) => void | yes | - | A function to set the promo code. |
557
- | setCodeIsApplied | (value: boolean) => void | yes | - | A function to set whether or not the promo code is currently applied. |
558
- | setCodeIsInvalid | (value: boolean) => void | yes | - | A function to set whether or not the promo code is invalid. |
559
- | setShowPromoInput | (value: boolean) => void | yes | - | A function to set whether or not to show the promo code input field. |
560
- | updateTickets | (value: boolean, type: string) => void | yes | - | A function to update the tickets based on the promo code. |
561
-
562
- </details>
563
- &nbsp;
564
-
565
- ## Access Code
566
-
567
- The `AccessCodeSection` is a React component designed for handling access code input and submission.
568
- It allows users to enter an access code and triggers an update to the ticket information based on the submitted access code.
569
- The component accepts a set of props to manage the access code value and provide callback functions for updating the state which you can see in below table.
570
-
571
- To integrate the `AccessCodeSection` component, import it into your JSX and provide the required props, such as the access code value, and callback functions for updating the state.
572
- Make sure to manage the component's state and callback functions within the parent component as needed. <br />
573
-
574
- ### **Note that package automatically calls component in [`TicketsContainer`](#ticketscontainer)**
575
-
576
- <br />
577
-
578
- <details open>
579
- <summary><b>Access Code Props Interface:</b></summary>
580
-
581
- | Property | Type | Required | Default Value | Description |
582
- | ------------- | ------------------------ | -------- | ------------- | ---------------------------------------------------------- |
583
- | code | string | yes | ' ' | The access code. |
584
- | - | - | - | - | - |
585
- | setCode | (value: string) => void | yes | - | A function to set the access code. |
586
- | updateTickets | (value: boolean) => void | yes | - | A function to update the tickets based on the access code. |
587
-
588
- </details>
589
- &nbsp;
590
-
591
- ## Waiting List
592
-
593
- The `WaitingList` component is a React component designed to handle user registration for a waiting list.
594
- It displays a form that allows users to input their information, including first name, last name, email, ticket type, and quantity.
595
- Upon submission, the component adds the user to the waiting list and displays a success message.
596
-
597
- ### **Note that package automatically calls component in [`TicketsContainer`](#ticketscontainer)**
598
-
599
- <br />
600
-
601
- <details open>
602
- <summary><b>Waiting List Props Interface:</b></summary>
603
-
604
- | Property | Type | Required | Default Value | Description |
605
- | ------------------ | --------------- | -------- | ------------- | ------------------------------------------------------------- |
606
- | tickets | Object | yes | ' ' | The list of tickets to be displayed. |
607
- | eventId | string / number | yes | N/A | The ID of the event for which the tickets are displayed. |
608
- | defaultMaxQuantity | number | yes | 10 | The default maximum quantity of tickets that can be selected. |
160
+ It exposes the live snapshot (status, cart, pricing, errors), `isBusy`,
161
+ `secondsLeft` for the reservation countdown, `buyerFields` (the extra fields
162
+ this event gates render them from data), `missingRequiredAddonNames`, and
163
+ `isLoggedIn`.
609
164
 
610
- </details>
165
+ `placeOrder` is retry-safe: one order, one charge, however many times the button
166
+ is pressed.
611
167
 
612
- <br />
168
+ For direct API access, the full SDK is re-exported from this package — `ttf`,
169
+ `api`, `hooks`, `dtos`, `logic`, and the engine. See the
170
+ [SDK reference](../tf-checkout-shared/README.md).
613
171
 
614
- ## Pixel Usage
172
+ ## Card fields
615
173
 
616
- The `usePixel` hook is a utility function used to load a pixel script for tracking events on the page. It is commonly used in multiple components throughout the application to track various user actions, such as the completion of a checkout or a purchase. <br />
174
+ `<CardInput />` renders Stripe Elements. `<XenditCardInput />` renders the
175
+ Xendit card form for gateways that use it — both are wired into `<Payment />`
176
+ automatically based on the event's gateway, so you only reach for them directly
177
+ when building a custom payment step.
617
178
 
618
- The purpose of the `usePixel` hook is to enable event tracking and analytics for various user actions within the application.
179
+ ## Development
619
180
 
620
- Here is the list of pages where the `usePixel` function is automatically used:
621
-
622
- - Billing Info Container
623
- - Confirmation Container
624
- - Payment Container
625
- - Tickets Container
626
-
627
- &nbsp;
628
-
629
- # Components
630
-
631
- ## `TicketsContainer`
632
-
633
- Tickets component will retrieve and show a list of tickets corresponding to selected event,
634
- which allows the user to select the desired ticket type and quantity.
635
-
636
- The **"Get Tickets"** button which name is also customizable, allows the user to add the selected tickets to their cart and proceed to the checkout process.<br />
637
- Other buttons can be displayed to handle various actions, such as viewing the user's orders or logging out.
638
-
639
- Tickets component provides a section for entering an [Access Code](#access-code) or [Promo Code](#promo-code) that applies a discount to the ticket price or hide/unhide some tickets via [Access Code](#access-code).<br />
640
- It also contains `WaitingList` that manages and displays waiting list functionality for the event.<br />
641
- Props interface partially extends [Promo Code Props Interface](#promo-code), [Access Code Props Interface](#access-code), [Waiting List Props Interface](#waiting-list).
642
-
643
- Tickets component displays a list of the top influencers who have promoted the event.
644
-
645
- **Recent Improvements:**
646
-
647
- - Fixed duplicate API calls issue by optimizing useEffect dependencies
648
- - Enhanced error handling and loading states
649
- - Improved time slot management for events
650
- - Better integration with promo codes and access codes
651
- - Optimized component re-rendering patterns
652
-
653
- Tickets component is flexible and customizable, allowing for different layouts and behaviors depending on the event's requirements.
654
-
655
- **_Example of usage_**:
656
-
657
- ```jsx
658
- import { TicketsContainer } from 'tf-checkout-react'
659
-
660
- <TicketsContainer
661
- theme="light"
662
- eventId={event?.id}
663
- handleNotInvitedModalClose={() => {}}
664
- handleInvalidLinkModalClose={() => {}}
665
- onAddToCartSuccess={() => {}}
666
- isPromotionsEnabled={event?.is_promotions_enabled}
667
- isAccessCodeEnabled={event?.is_access_code}
668
- onLogoutSuccess={() => {}}
669
- hideSessionButtons={true}
670
- enableAddOns={false}
671
- showGroupNameBlock={true}
672
- tableTicketsHeaderComponent={
673
- <div className="tickets-container-header">RESERVE TABLES</div>
674
- }
675
- onPendingVerification={() => {}}
676
- />
677
- ```
678
-
679
- <details open>
680
- <summary><b>Tickets Container Props Interface</b></summary>
681
-
682
- | Property | Type | Required | Default value | Description |
683
- | ---------------------------------------- | ---------------- | -------- | -------------- | ---------------------------------------------------------------------------------------------- |
684
- | eventId | string / number | yes | N/A | The unique identifier for the event that the tickets belong to. |
685
- | getTicketsLabel | string | no | “Get Tickets" | The label for the "Get Tickets" button. |
686
- | contentStyle | CSSProperties | no | {} | An object containing styles to apply to the tickets list container. |
687
- | theme | ‘light’, ‘dark' | no | ‘light' | The theme to use for the tickets list container. Sets as `className`. |
688
- | themeOptions | MUI ThemeOptions | no | N/A | MUI Theme Provider’s theme options. |
689
- | queryPromoCode (deprecated) | - | - | - | - |
690
- | isButtonScrollable (deprecated) | - | - | - | - |
691
- | disableCountdownLeadingZero (deprecated) | - | - | - | - |
692
- | isLoggedIn (deprecated) | - | - | - | - |
693
- | isPromotionsEnabled | boolean | no | false | Whether or not promotions are enabled for the tickets list. |
694
- | isAccessCodeEnabled | boolean | no | false | Whether or not access codes are enabled for the tickets list. |
695
- | hideTicketsHeader | boolean | no | false | Whether to hide the tickets header. |
696
- | hideSessionButtons | boolean | no | false | Whether to hide “My Tickets” and “Log Out” buttons. |
697
- | hideWaitingList | boolean | no | false | Whether to hide the waiting list. |
698
- | enableBillingInfoAutoCreate | boolean | no | true | Whether to enable auto-creation of billing information, instead of manually creation by user. |
699
- | enableInfluencersSection | boolean | no | true | Whether to display the influencers section. |
700
- | enableAddOns | boolean | no | true | Whether to enable add-ons. |
701
- | sortBySoldOut | boolean | no | false | Whether to sort tickets by sold-out status. By default tickets will be sorted by sort order. |
702
- | hideTableTicketsHeader | boolean | no | false | Whether to hide table type tickets section header. |
703
- | showPoweredByImage | boolean | no | false | Whether to show the "Powered by TheTicketFairy" image. |
704
- | showGroupNameBlock | boolean | no | false | Whether to show the ticket group name block. |
705
- | actionsSectionComponent | ReactNode | no | N/A | Custom component instead of “Get Tickets” button. |
706
- | ticketsHeaderComponent | ReactNode | no | N/A | A React component to render the tickets section header. |
707
- | tableTicketsHeaderComponent | ReactNode | no | N/A | A React component to render the table type tickets section header. |
708
- | ordersPath | string | no | '/orders' | The URL path to the orders page. |
709
- | currencySybmol | string | no | ' ' | The currency symbol to use. |
710
- | - | - | - | - | - |
711
- | onAddToCartSuccess | (data) => void | no | value => value | A callback function to be called when a ticket is successfully added to the cart. |
712
- | onAddToCartError | (error) => void | no | value => value | A callback function to be called when there is an error adding a ticket to the cart. |
713
- | onGetTicketsSuccess | (data) => void | no | value => value | A callback function to be called when the tickets are successfully retrieved. |
714
- | onGetTicketsError | (error) => void | no | value => value | A callback function to be called when there is an error retrieving the tickets. |
715
- | onLogoutSuccess | () => void | no | value => value | A callback function to be called when the user successfully logs out. |
716
- | onLogoutError | (error) => void | no | value => value | A callback function to be called when there is an error logging out. |
717
- | onLoginSuccess | () => void | no | value => value | A callback function to be called when the user successfully logs in. |
718
- | handleNotInvitedModalClose | () => void | no | value => value | A callback function to be called when the "Not Invited" modal is closed. |
719
- | handleInvalidLinkModalClose | () => void | no | value => value | A callback function to be called when the "Invalid Link" modal is closed. |
720
- | onReserveButtonClick | () => void | no | value => value | A callback function to be called when the 'Select on map' button is clicked. |
721
- | onPendingVerification | () => void | no | value => value | A callback function to be called when the verification process is passed and pending response. |
722
-
723
- </details>
724
-
725
- &nbsp;
726
-
727
- ## `AddOnsContainer`
728
-
729
- Add-Ons component will retrieve and show a list of add-ons corresponding to selected event.
730
-
731
- <details open>
732
- <summary><b>Add-Ons Container Props Interface</b></summary>
733
-
734
- | Property | Type | Required | Default value | Description |
735
- | --------------------------- | --------------- | -------- | -------------- | ---------------------------------------------------------------------------------------------------- |
736
- | classNamePrefix | string | no | 'add_on' | Prefix to use for the CSS class names of the component. |
737
- | enableBillingInfoAutoCreate | boolean | no | true | Whether to enable auto-creation of billing information, instead of manually creation by user. |
738
- | enableTimer | boolean | no | true | Whether to show a timer for the user. |
739
- | - | - | - | - | - |
740
- | onGetAddonsPageInfoSuccess | (data) => void | no | value => value | A callback function to be called when the add-ons page information is successfully fetched. |
741
- | onGetAddonsPageInfoError | (error) => void | no | value => value | A callback function to be called when there is an error while fetching the add-ons page information. |
742
- | onPostCheckoutSuccess | (data) => void | no | value => value | A callback function to be called when the add-ons are successfully added to the cart. |
743
- | onPostCheckoutError | (error) => void | no | value => value | A callback function to be called when there is an error while adding add-ons to the cart. |
744
- | onConfirmSelectionSuccess | (data) => void | no | value => value | A callback function to be called when the add-ons selection is successfully confirmed. |
745
- | onConfirmSelectionError | (error) => void | no | value => value | A callback function to be called when there is an error while confirming the add-ons selection. |
746
- | onCountdownFinish | () => void | no | value => value | A callback function that is called when the countdown timer finishes. |
747
- | onPendingVerification | () => void | no | value => value | A callback function to be called when the verification process is passed and pending response. |
748
-
749
- </details>
750
-
751
- &nbsp;
752
-
753
- ## `BillingInfoContainer`
754
-
755
- The component is responsible for managing the billing information during the checkout process. It provides a form that allows users to enter their billing information, including addresses and ticket holders' information.
756
-
757
- Component includes phone field validation functionality provided by Twilio, which adds an additional layer of verification and security during the ticket purchase process.
758
-
759
- **Recent Improvements:**
760
-
761
- - Enhanced architecture with better separation of concerns
762
- - Improved form validation and error handling
763
- - Better TypeScript typing throughout the component
764
- - Optimized API call patterns to prevent duplicate requests
765
- - Enhanced field rendering system for better customization
766
-
767
- Props interface extends [Login Modal Interface](#login), [Register Modal Interface](#register), [Forgot Password Modal Interface](#forgot-password).
768
-
769
- <details open>
770
-
771
- | Property | Type | Required | Default Value | Description |
772
- | --------------------------------- | -------------------------------------------- | -------- | ----------------------- | --------------------------------------------------------------------------------------------------- |
773
- | data | IBillingInfoData[] | no | [] | Form fields list to be rendered to collect billing info data. |
774
- | ticketHoldersFields | IBillingInfoData[] | no | [{ id: 1, fields: [] }] | Form fields list to be rendered to collect ticket holders data. |
775
- | initialValues (deprecated) | { [key: string]: any } | no | {} | Form’s initial values. |
776
- | theme | 'light' / 'dark' | no | 'light' | MUI Theme Provider’s theme. |
777
- | isLoggedIn (deprecated) | - | - | - | - |
778
- | onLogin (deprecated) | - | - | - | - |
779
- | brandOptIn (deprecated) | - | - | - | - |
780
- | shouldFetchCountries (deprecated) | - | - | - | - |
781
- | accountInfoTitle | string / JSX.Element | no | “” | Render some text or JSX component above Login section. Do not available if there is logged in user. |
782
- | hideLogo | boolean | no | false | Hide TicketFairy logo under “Login” button. |
783
- | themeOptions | MUI ThemeOptions | no | N/A | MUI Theme Provider’s theme. |
784
- | hideErrorsAlertSection | boolean | no | false | Hide form submit errors rendered by package. |
785
- | skipPage | boolean | no | false | Enable skipping Billing Info page. |
786
- | canSkipHolderNames | boolean | no | false | Allows the user to skip entering ticket holders' names. |
787
- | enableTimer | boolean | no | false | Enables the countdown timer. |
788
- | buttonName | string | no | false | The text to display on the submit button. |
789
- | showPoweredByImage | boolean | no | false | Displays the "Powered by TheTicketFairy" image. |
790
- | isCountryCodeEditable | boolean | no | true | Allows the user to edit the country code. |
791
- | - | - | - | - | - |
792
- | handleSubmit | (values, helpers, eventId, response) => void | no | value => value | A callback function that is called when the form is submitted. |
793
- | onSubmitError | (error) => void | no | value => value | A callback function that is called when form submission fails. |
794
- | onGetCartSuccess | (data) => void | no | value => value | A callback function that is called when the cart data is successfully retrieved. |
795
- | onGetCartError | (error) => void | no | value => value | A callback function that is called when retrieving the cart data fails. |
796
- | onErrorClose | () => void | no | value => value | A callback function that is called when the error message is closed. |
797
- | onSkipBillingPage | (data) => void | no | value => value | A callback function that is called when the billing page skips. |
798
- | onGetCountriesSuccess | (data) => void | no | value => value | A callback function that is called when the list of countries is successfully retrieved. |
799
- | onGetCountriesError | (error) => void | no | value => value | A callback function that is called when retrieving the list of countries fails. |
800
- | onGetStatesSuccess | (data) => void | no | value => value | A callback function that is called when the list of states is successfully retrieved. |
801
- | onGetCountriesError | (error) => void | no | value => value | A callback function that is called when retrieving the list of states fails. |
802
- | onAuthorizeSuccess | (data) => void | no | value => value | A callback function that is called when authorization is successful. |
803
- | onAuthorizeError | (error) => void | no | value => value | A callback function that is called when authorization fails. |
804
- | onCountdownFinish | () => void | no | value => value | A callback function that is called when the countdown timer finishes. |
805
- | onPendingVerification | () => void | no | value => value | A callback function that is called when the verification process is passed and pending response. |
806
-
807
- </details>
808
-
809
- &nbsp;
810
-
811
- ## `PaymentContainer`
812
-
813
- The component provides a form for users to enter their payment information and checkout. It accepts various props to customize the form and handle the checkout process.
814
-
815
- **Recent Improvements:**
816
-
817
- - Enhanced Stripe integration with better error handling
818
- - Improved payment field validation and user feedback
819
- - Better handling of payment method creation and confirmation
820
- - Enhanced payment plan support with improved UI
821
- - Optimized payment flow for better user experience
822
-
823
- <details open>
824
-
825
- | Property | Type | Required | Default Value | Description |
826
- | ----------------------- | ------------------------------- | -------- | -------------------- | ----------------------------------------------------------------------------------- |
827
- | paymentFields | IPaymentField[] | yes | [] | An array of payment fields to render in the form. |
828
- | checkoutData | { hash: string, total: number } | yes | N/A | An object containing checkout data, such as the order total and hash. |
829
- | formTitle | string | no | 'Get Your Tickets' | Text to display above the payment form. |
830
- | errorText | string | no | '' | Text to display if there is an error during the payment process. |
831
- | paymentButtonText | string | no | 'Pay' | Text to display on the payment button. |
832
- | paymentInfoLabel | string | no | 'Order Confirmation' | Text to display above the payment information section. |
833
- | orderInfoLabel | string | no | 'Order Review' | Text to display above the order information section. |
834
- | stripeCardOptions | StripeCardNumberElementOptions | no | {} | Options for the Stripe card input element. |
835
- | elementsOptions | StripeElementsOptions | no | {} | Options for the Stripe Elements instance. |
836
- | themeOptions | ThemeOptions | no | {} | An object containing theme options for the payment form. |
837
- | enableTimer | boolean | no | false | Whether to show a timer for the user. |
838
- | disableZipSection | boolean | no | false | Whether to show the zip code input field. |
839
- | enablePaymentPlan | boolean | no | true | Whether to enable payment plans. |
840
- | - | - | - | - | - |
841
- | handlePayment | (data) => void | yes | value => value | A callback function to handle the payment process. |
842
- | onPaymentError | (error) => void | no | value => value | A callback function that is called when the payment process fails. |
843
- | onErrorClose | () => void | no | value => value | A callback function that is called when the error message is closed. |
844
- | onGetPaymentDataSuccess | (data) => void | no | value => value | A callback function that is called when the payment data is successfully retrieved. |
845
- | onGetPaymentDataError | (error) => void | no | value => value | A callback function that is called when retrieving the payment data fails. |
846
- | onCountdownFinish | () => void | no | value => value | A callback function that is called when the countdown timer finishes. |
847
-
848
- </details>
849
-
850
- &nbsp;
851
-
852
- ## `ConfirmationContainer`
853
-
854
- The component is responsible for displaying the confirmation page after a successful payment.
855
-
856
- <details open>
857
-
858
- | Property | Type | Required | Default Value | Description |
859
- | ---------------------------- | ------------------- | -------- | -------------- | ---------------------------------------------------------------------------------------- |
860
- | isReferralEnabled | boolean | yes | false | Whether referral functionality is enabled. |
861
- | showDefaultShareButtons | boolean | yes | false | Whether to display default share buttons. |
862
- | shareButtons | IShareButton[] | yes | [] | Array of objects representing the share buttons. |
863
- | messengerAppId | string | yes | N/A | Messenger App ID for Facebook share button. |
864
- | orderHash | string | no | N/A | Hash value of the order. |
865
- | clientLabel | string | no | 'Ticket Fairy' | Client's name. |
866
- | confirmationLabels | IConfirmationLabels | no | {} | Object containing labels for the confirmation page. |
867
- | hasCopyIcon | boolean | no | true | Whether to display a copy icon beside the referral link. |
868
- | showReferralsInfoText | boolean | no | false | Whether to display referral information text. |
869
- | showCopyInfoModal | boolean | no | false | Whether to display a copy info modal after the link is copied. |
870
- | showPricingNoteSection | boolean | no | false | Whether to display the pricing note section. |
871
- | - | - | - | - | - |
872
- | onGetConfirmationDataSuccess | (data) => void | yes | value => value | A callback function that is called when the confirmation data is successfully retrieved. |
873
- | onGetConfirmationDataError | (error) => void | yes | value => value | A callback function that is called when retrieving the confirmation data fails. |
874
- | onLinkCopied | () => void | no | value => value | A callback function that is called when the referral link is copied. |
875
-
876
- </details>
877
-
878
- &nbsp;
879
-
880
- ## `MyTicketsContainer`
881
-
882
- The component is responsible for rendering a list of orders with details and some customization options.
883
-
884
- <details open>
885
-
886
- | Property | Type | Required | Default Value | Description |
887
- | ---------------------------- | ------------------- | -------- | -------------- | ---------------------------------------------------------------------------------------- |
888
- | isReferralEnabled | boolean | yes | false | Whether referral functionality is enabled. |
889
- | showDefaultShareButtons | boolean | yes | false | Whether to display default share buttons. |
890
- | shareButtons | IShareButton[] | yes | [] | Array of objects representing the share buttons. |
891
- | messengerAppId | string | yes | N/A | Messenger App ID for Facebook share button. |
892
- | orderHash | string | no | N/A | Hash value of the order. |
893
- | clientLabel | string | no | 'Ticket Fairy' | Client's name. |
894
- | confirmationLabels | IConfirmationLabels | no | {} | Object containing labels for the confirmation page. |
895
- | hasCopyIcon | boolean | no | true | Whether to display a copy icon beside the referral link. |
896
- | showReferralsInfoText | boolean | no | false | Whether to display referral information text. |
897
- | showCopyInfoModal | boolean | no | false | Whether to display a copy info modal after the link is copied. |
898
- | showPricingNoteSection | boolean | no | false | Whether to display the pricing note section. |
899
- | - | - | - | - | - |
900
- | onGetConfirmationDataSuccess | (data) => void | yes | value => value | A callback function that is called when the confirmation data is successfully retrieved. |
901
- | onGetConfirmationDataError | (error) => void | yes | value => value | A callback function that is called when retrieving the confirmation data fails. |
902
- | onLinkCopied | () => void | no | value => value | A callback function that is called when the referral link is copied. |
903
-
904
- </details>
905
-
906
- &nbsp;
907
-
908
- ## Orders Container
909
-
910
- Will show the purchased orders for the logged user.
911
- Orders container interface extends [Login Modal Interface](#login-modal-interface).
912
-
913
- <details open>
914
- <summary><b>Orders Container Props Interface:</b></summary>
915
-
916
- | Property | Type | Required | Default Value | Description |
917
- | ------------------ | ------------------------------ | -------- | -------------- | ---------------------------------------------------- |
918
- | handleDetailsInfo | Function: (id: string) => void | yes | value => value | Called on "Order Details" button click. |
919
- | onGetOrdersSuccess | Function: (data) => void | yes | value => value | Called after fetching orders data request’s success. |
920
- | onGetOrdersError | Function: (error) => void | yes | value => value | Called after fetching orders data request’s failure. |
921
- | theme | 'light' / 'dark' | no | ‘dark' | Main container class. |
922
-
923
- </details>
924
-
925
- &nbsp;
926
-
927
- ## Order Details Container
928
-
929
- Will show the purchased order details. Contains `order PDF download` and `ticket resale` functionalities. Currently both functionalities are enabled by default.
930
-
931
- <details open>
932
- <summary><b>Order Container Props Interface:</b></summary>
933
-
934
- | Property | Type | Required | Default Value | Description |
935
- | ------------------------- | ----------------------------------------- | -------- | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
936
- | columns | [ { label: string } ] | yes | [] | Order details table’s columns’ labels. |
937
- | ticketsTableColumns | ITicketsTableColumns[] <sup>[3](#3)</sup> | no | defaultTicketsTableColumns<sup>[3](#3)</sup> | Order’s tickets table’s columns. |
938
- | displayColumnNameInRow | boolean | no | false | Display column’s names in row, instead of table header. |
939
- | canSellTicket | boolean | no | true | A boolean value indicating whether the user can sell tickets. |
940
- | ordersPath | string | no | | A string representing the URL of the page to which the "Back to Orders" and "Return to Order History" buttons will redirect the user. |
941
- | orderId | string or number | no | | A string or number representing the ID of the order to be displayed. If this prop is not provided, the component will try to get the order ID from the query parameters of the URL. |
942
- | referralTitle | string | no | "" | A string representing the title of the referral section. |
943
- | itemsTitle | string | no | "" | A string representing the title of the items section. |
944
- | ticketsTitle | string | no | "Your Tickets" | A string representing the title of the tickets table section. |
945
- | personalLinkIcon | string | no | “” | Custom icon to display near personal share link. |
946
- | onGetOrdersSuccess | Function: (data) => void | no | value => value | Called after fetching order data request’s success. |
947
- | onGetOrdersError | Function: (error) => void | no | value => value | Called after fetching order data request’s failure. |
948
- | onResaleTicketSuccess | Function: (data) => void | no | value => value | Called after resale ticket request’s success. |
949
- | onResaleTicketError | Function: (error) => void | no | value => value | Called after resale ticket request’s failure. |
950
- | onRemoveFromResaleSuccess | Function: (data) => void | no | value => value | Called after remove from resale ticket request’s success. |
951
- | onRemoveFromResaleError | Function: (error) => void | no | value => value | Called after remove from resale ticket request’s failure. |
952
- | onReturnButtonClick | Function: () => void | no | N/A | Called on “Return” button click. If not passed, button click will redirect to ‘/orders’. |
953
-
954
- </details>
955
-
956
- &nbsp;
957
-
958
- ## Ticket Resale Container
959
-
960
- 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.
961
-
962
- <details open>
963
- <summary><b>Ticket Resale Container Props Interface:</b></summary>
964
-
965
- | Property | Type | Required | Default Value | Description |
966
- | ------------------------------ | ------------------------- | -------- | -------------- | ---------------------------------------------- |
967
- | onProcessTicketSuccess | Function: (data) => void | no | value => value | Called after process ticket request’s success. |
968
- | onGetOrdersError | Function: (error) => void | no | value => value | Called after process ticket request’s failure. |
969
- | onDeclineTicketPurchaseSuccess | Function: (data) => void | no | value => value | Called after decline ticket request’s success. |
970
- | onDeclineTicketPurchaseError | Function: (error) => void | no | value => value | Called after decline ticket request’s failure. |
971
-
972
- </details>
973
-
974
- &nbsp;
975
-
976
- <details open>
977
- <summary><small id="1">1. Share buttons</small></summary>
978
-
979
- ```ts
980
- interface IShareButton {
981
- mainLabel: string;
982
- subLabel: string;
983
- platform: string;
984
- shareData: any;
985
- }
986
- ```
987
-
988
- ```yaml
989
- Default share options if `showDefaultShareButtons` is true, are: "Share on Facebook", "Tweet to your Followers", "Message friends on Facebook" and "Message friends on WhatsApp".
990
- ```
991
-
992
- </details>
993
-
994
- <details open>
995
- <summary><small id="2">2. Confirmation Labels</small></summary>
996
-
997
- ```ts
998
- interface IConfirmationLabels {
999
- confirmationTitle?: string;
1000
- confirmationMain?: string;
1001
- confirmationHelper?: string
1002
- }
1003
- ```
1004
-
1005
- ```js
1006
- const defaultConfirmationLabels = {
1007
- confirmationTitle = "Your Tickets are Confirmed!",
1008
- confirmationMain = "Your tickets are available in My Tickets section",
1009
- confirmationHelper = "Please bring them with you to the event"
1010
- }
1011
- ```
1012
-
1013
- </details>
1014
-
1015
- <details open>
1016
- <summary><small id="3">3. Tickets table columns</small></summary>
1017
-
1018
- ```ts
1019
- interface ITicketsTableColumns {
1020
- id?: string | number;
1021
- key: keyof ITicketTypes & keyof IActionColumns;
1022
- label: string | number | null | undefined;
1023
- }
1024
-
1025
- interface IActionColumns {
1026
- download?: boolean;
1027
- sell_ticket?: boolean;
1028
- }
1029
- ```
1030
-
1031
- ```ts
1032
- const defaultTicketsTableColumns = [
1033
- { key: 'ticket_type', label: 'Ticket Type' },
1034
- { key: 'holder_name', label: 'Ticket Holder' },
1035
- { key: 'status', label: 'Status' },
1036
- { key: 'download', label: '' },
1037
- { key: 'sell_ticket', label: '' }
1038
- ]
1039
- ```
1040
-
1041
- </details>
1042
-
1043
- # Commands
1044
-
1045
- TSDX scaffolds your new library inside `/src`, and also sets up a [Parcel-based](https://parceljs.org) playground for it inside `/example`.
1046
-
1047
- The recommended workflow is to run TSDX in one terminal:
181
+ From the repo root:
1048
182
 
1049
183
  ```bash
1050
- npm start # or yarn start
184
+ pnpm run start:react
1051
185
  ```
1052
186
 
1053
- This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.
1054
-
1055
- Then run the example inside another:
1056
-
1057
- ```bash
1058
- cd example
1059
- npm i # or yarn to install dependencies
1060
- npm start # or yarn start
1061
- ```
1062
-
1063
- The default example imports and live reloads whatever is in `/dist`, so if you are seeing an out of date component, make sure TSDX is running in watch mode like we recommend above. **No symlinking required**, we use [Parcel's aliasing](https://parceljs.org/module_resolution.html#aliases).
1064
-
1065
- To do a one-off build, use `npm run build` or `yarn build`.
1066
-
1067
- &nbsp;
1068
-
1069
- ## Rollup
1070
-
1071
- 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.
1072
-
1073
- &nbsp;
1074
-
1075
- ### TypeScript
1076
-
1077
- `tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs.
1078
-
1079
- ### GitHub Actions
187
+ `pnpm run playground:react` opens the docs-style playground instead, with a
188
+ live preview and source for each panel.
1080
189
 
1081
- Two actions are added by default:
190
+ Set credentials in `example/.env`; see `example/.env.example`.
1082
191
 
1083
- - `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
1084
- - `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit)
192
+ ---
1085
193
 
1086
- ## Optimizations
194
+ Part of the [TicketFairy checkout monorepo](../../README.md).