tf-checkout-react 1.7.31 → 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.
- package/LICENSE +1 -1
- package/README.md +141 -1033
- package/dist/checkout.css +17 -0
- package/dist/index.d.mts +3930 -0
- package/dist/index.d.ts +3930 -30
- package/dist/index.esm.js +9123 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +9277 -6
- package/dist/index.js.map +1 -0
- package/dist/styles/addons.css +75 -0
- package/dist/styles/auth.css +294 -0
- package/dist/styles/billing.css +98 -0
- package/dist/styles/confirmation.css +51 -0
- package/dist/styles/foundation.css +146 -0
- package/dist/styles/payment.css +179 -0
- package/dist/styles/primitives.css +356 -0
- package/dist/styles/seat-map.css +46 -0
- package/dist/styles/tickets.css +285 -0
- package/dist/styles/verification-confirmation.css +258 -0
- package/package.json +93 -78
- package/src/.d.ts +1 -1
- package/src/CardInput.tsx +374 -0
- package/src/EmbeddedCheckout.tsx +400 -0
- package/src/ResumedCheckout.tsx +132 -0
- package/src/auth/AuthModal.tsx +231 -0
- package/src/auth/ForgotPasswordForm.tsx +93 -0
- package/src/auth/LoginForm.tsx +104 -0
- package/src/auth/PasswordInput.tsx +33 -0
- package/src/auth/RegisterForm.tsx +333 -0
- package/src/auth/ResetPasswordForm.tsx +112 -0
- package/src/auth/index.ts +5 -0
- package/src/checkout.css +17 -0
- package/src/configure.ts +29 -0
- package/src/confirmer.ts +439 -0
- package/src/index.ts +41 -30
- package/src/instance.ts +21 -0
- package/src/sections/AddOns.tsx +241 -0
- package/src/sections/BillingInfo.tsx +743 -0
- package/src/sections/Confirmation.tsx +146 -0
- package/src/sections/IDVerification.tsx +76 -0
- package/src/sections/OrderConfirmation.tsx +277 -0
- package/src/sections/OrderIDVerification.tsx +117 -0
- package/src/sections/OrderSummary.tsx +84 -0
- package/src/sections/Payment.tsx +541 -0
- package/src/sections/SeatMap.tsx +512 -0
- package/src/sections/Tickets.tsx +573 -0
- package/src/sections/billing/BillingAddressFields.tsx +138 -0
- package/src/sections/billing/BuyerField.tsx +75 -0
- package/src/sections/billing/TicketHoldersCard.tsx +119 -0
- package/src/sections/billing/types.ts +10 -0
- package/src/sections/index.ts +15 -0
- package/src/sections/seatMap.utils.ts +105 -0
- package/src/styles/addons.css +75 -0
- package/src/styles/auth.css +294 -0
- package/src/styles/billing.css +98 -0
- package/src/styles/confirmation.css +51 -0
- package/src/styles/foundation.css +146 -0
- package/src/styles/payment.css +179 -0
- package/src/styles/primitives.css +356 -0
- package/src/styles/seat-map.css +46 -0
- package/src/styles/tickets.css +285 -0
- package/src/styles/verification-confirmation.css +258 -0
- package/src/typings.d.ts +2 -2
- package/src/ui/Button.tsx +38 -0
- package/src/ui/Card.tsx +54 -0
- package/src/ui/CheckoutProvider.tsx +172 -0
- package/src/ui/CustomFields.tsx +195 -0
- package/src/ui/Field.tsx +114 -0
- package/src/ui/I18nProvider.tsx +36 -0
- package/src/ui/InstallmentPicker.tsx +69 -0
- package/src/ui/Loader.tsx +12 -0
- package/src/ui/PaymentMethods.tsx +133 -0
- package/src/ui/PriceLine.tsx +24 -0
- package/src/ui/QuantitySelect.tsx +50 -0
- package/src/ui/Stepper.tsx +36 -0
- package/src/ui/Timer.tsx +34 -0
- package/src/ui/TimerBanner.tsx +55 -0
- package/src/ui/cx.ts +3 -0
- package/src/ui/index.ts +54 -0
- package/src/ui/theme.ts +83 -0
- package/src/useCheckout.ts +35 -0
- package/src/xendit.ts +438 -0
- package/dist/adapters/customFields.d.ts +0 -12
- package/dist/adapters/index.d.ts +0 -1
- package/dist/api/auth.d.ts +0 -27
- package/dist/api/cart.d.ts +0 -2
- package/dist/api/checkout.d.ts +0 -3
- package/dist/api/common.d.ts +0 -11
- package/dist/api/guestTicketDelegation.d.ts +0 -47
- package/dist/api/index.d.ts +0 -82
- package/dist/api/interceptors.d.ts +0 -1
- package/dist/api/orders.d.ts +0 -2
- package/dist/api/payment.d.ts +0 -5
- package/dist/api/preRegistrationComplete.d.ts +0 -3
- package/dist/api/publicRequest.d.ts +0 -9
- package/dist/api/resale.d.ts +0 -5
- package/dist/components/account-settings/index.d.ts +0 -3
- package/dist/components/addonsContainer/AddonComponent.d.ts +0 -18
- package/dist/components/addonsContainer/SimpleAddonsContainer.d.ts +0 -20
- package/dist/components/addonsContainer/adapters/index.d.ts +0 -12
- package/dist/components/addonsContainer/index.d.ts +0 -22
- package/dist/components/addonsContainer/normalizers/index.d.ts +0 -1
- package/dist/components/addonsContainer/useAddons.d.ts +0 -23
- package/dist/components/addonsContainer/utils/index.d.ts +0 -16
- package/dist/components/billing-info-container/hooks/index.d.ts +0 -3
- package/dist/components/billing-info-container/hooks/usePaymentContext.d.ts +0 -5
- package/dist/components/billing-info-container/hooks/usePaymentRedirect.d.ts +0 -14
- package/dist/components/billing-info-container/hooks/useStripePayment.d.ts +0 -18
- package/dist/components/billing-info-container/index.d.ts +0 -69
- package/dist/components/billing-info-container/utils.d.ts +0 -59
- package/dist/components/common/Checkbox.d.ts +0 -11
- package/dist/components/common/CheckboxField/index.d.ts +0 -9
- package/dist/components/common/CopyField.d.ts +0 -12
- package/dist/components/common/CopyMessageModal.d.ts +0 -7
- package/dist/components/common/CustomField.d.ts +0 -26
- package/dist/components/common/DatePickerField.d.ts +0 -20
- package/dist/components/common/FieldSection/index.d.ts +0 -19
- package/dist/components/common/FieldSection/utils/index.d.ts +0 -8
- package/dist/components/common/FormikPhoneNumberField.d.ts +0 -11
- package/dist/components/common/Loader.d.ts +0 -2
- package/dist/components/common/ModalComponent/index.d.ts +0 -16
- package/dist/components/common/NativeSelectFeild/index.d.ts +0 -21
- package/dist/components/common/PhoneNumberField.d.ts +0 -14
- package/dist/components/common/PoweredBy.d.ts +0 -2
- package/dist/components/common/RadioField.d.ts +0 -11
- package/dist/components/common/RadioGroupField/index.d.ts +0 -17
- package/dist/components/common/RedirectModal.d.ts +0 -7
- package/dist/components/common/SelectField/index.d.ts +0 -19
- package/dist/components/common/SnackbarAlert.d.ts +0 -13
- package/dist/components/common/index.d.ts +0 -11
- package/dist/components/common/socials.d.ts +0 -10
- package/dist/components/confirmModal/index.d.ts +0 -10
- package/dist/components/confirmationContainer/config.d.ts +0 -1
- package/dist/components/confirmationContainer/index.d.ts +0 -46
- package/dist/components/confirmationContainer/social-buttons.d.ts +0 -16
- package/dist/components/countdown/index.d.ts +0 -14
- package/dist/components/delegationsContainer/IssueComponent.d.ts +0 -10
- package/dist/components/delegationsContainer/IssueTicketForm.d.ts +0 -9
- package/dist/components/delegationsContainer/TicketsAssignedTable.d.ts +0 -11
- package/dist/components/delegationsContainer/TicketsAvailableTable.d.ts +0 -11
- package/dist/components/delegationsContainer/index.d.ts +0 -10
- package/dist/components/forgotPasswordModal/index.d.ts +0 -12
- package/dist/components/idVerificationContainer/VerificationPendingModal.d.ts +0 -10
- package/dist/components/idVerificationContainer/constants.d.ts +0 -21
- package/dist/components/idVerificationContainer/index.d.ts +0 -16
- package/dist/components/index.d.ts +0 -12
- package/dist/components/loginForm/index.d.ts +0 -31
- package/dist/components/loginModal/SignUpForm.d.ts +0 -10
- package/dist/components/loginModal/constants.d.ts +0 -39
- package/dist/components/loginModal/index.d.ts +0 -22
- package/dist/components/myTicketsContainer/index.d.ts +0 -16
- package/dist/components/myTicketsContainer/row.d.ts +0 -3
- package/dist/components/myTicketsContainer/tableConfig.d.ts +0 -5
- package/dist/components/orderDetailsContainer/CustomFieldsForm.d.ts +0 -12
- package/dist/components/orderDetailsContainer/TicketHolderCustomFields.d.ts +0 -10
- package/dist/components/orderDetailsContainer/index.d.ts +0 -66
- package/dist/components/orderDetailsContainer/ticketsTable.d.ts +0 -46
- package/dist/components/orderDetailsContainer/utils/index.d.ts +0 -6
- package/dist/components/paymentContainer/OrderDetails.d.ts +0 -9
- package/dist/components/paymentContainer/PaymentPlanSection.d.ts +0 -10
- package/dist/components/paymentContainer/handlePayment.d.ts +0 -15
- package/dist/components/paymentContainer/index.d.ts +0 -39
- package/dist/components/preRegistration/FieldsSection.d.ts +0 -19
- package/dist/components/preRegistration/Influancers.d.ts +0 -2
- package/dist/components/preRegistration/PreRegistrationComplete.d.ts +0 -13
- package/dist/components/preRegistration/PreRegistrationInformations.d.ts +0 -2
- package/dist/components/preRegistration/Prewards.d.ts +0 -2
- package/dist/components/preRegistration/ShareOptions.d.ts +0 -2
- package/dist/components/preRegistration/constants.d.ts +0 -2
- package/dist/components/preRegistration/index.d.ts +0 -23
- package/dist/components/preRegistration/utils.d.ts +0 -12
- package/dist/components/registerForm/adapters/index.d.ts +0 -4
- package/dist/components/registerForm/constants.d.ts +0 -1
- package/dist/components/registerForm/index.d.ts +0 -16
- package/dist/components/registerModal/index.d.ts +0 -12
- package/dist/components/resetPasswordContainer/index.d.ts +0 -10
- package/dist/components/rsvpContainer/index.d.ts +0 -7
- package/dist/components/seatMapContainer/SeatMapComponent.d.ts +0 -8
- package/dist/components/seatMapContainer/TicketsSection.d.ts +0 -9
- package/dist/components/seatMapContainer/addToCart.d.ts +0 -14
- package/dist/components/seatMapContainer/index.d.ts +0 -2
- package/dist/components/seatMapContainer/utils.d.ts +0 -6
- package/dist/components/signupModal/index.d.ts +0 -12
- package/dist/components/ticketResale/index.d.ts +0 -12
- package/dist/components/ticketResaleModal/index.d.ts +0 -19
- package/dist/components/ticketsContainer/AccessCodeSection.d.ts +0 -7
- package/dist/components/ticketsContainer/InfoIcon.d.ts +0 -5
- package/dist/components/ticketsContainer/PromoCodeSection.d.ts +0 -15
- package/dist/components/ticketsContainer/ReferralLogic.d.ts +0 -5
- package/dist/components/ticketsContainer/TicketRow.d.ts +0 -13
- package/dist/components/ticketsContainer/TicketsSection.d.ts +0 -20
- package/dist/components/ticketsContainer/TimeSlotTicketRow.d.ts +0 -19
- package/dist/components/ticketsContainer/TimeSlotsSection.d.ts +0 -25
- package/dist/components/ticketsContainer/index.d.ts +0 -93
- package/dist/components/ticketsContainer/utils.d.ts +0 -13
- package/dist/components/timerWidget/index.d.ts +0 -16
- package/dist/components/waitingList/index.d.ts +0 -9
- package/dist/constants/index.d.ts +0 -7
- package/dist/env.d.ts +0 -16
- package/dist/hoc/CustomFields/index.d.ts +0 -3
- package/dist/hoc/index.d.ts +0 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/useCookieListener.d.ts +0 -1
- package/dist/hooks/useEventListener.d.ts +0 -1
- package/dist/hooks/useLocalStorageListener.d.ts +0 -1
- package/dist/hooks/useOnline.d.ts +0 -1
- package/dist/hooks/usePixel.d.ts +0 -6
- package/dist/images/Polygon.png +0 -0
- package/dist/images/cross.svg +0 -44
- package/dist/images/done.svg +0 -3
- package/dist/images/edit.svg +0 -10
- package/dist/images/email.svg +0 -1
- package/dist/images/instagram.svg +0 -5
- package/dist/images/logo-ttf.png +0 -0
- package/dist/images/spotify.svg +0 -6
- package/dist/images/user.svg +0 -1
- package/dist/images/xmark.svg +0 -92
- package/dist/normalizers/index.d.ts +0 -4
- package/dist/tf-checkout-react.cjs.development.js +0 -16149
- package/dist/tf-checkout-react.cjs.development.js.map +0 -1
- package/dist/tf-checkout-react.cjs.production.min.js +0 -2
- package/dist/tf-checkout-react.cjs.production.min.js.map +0 -1
- package/dist/tf-checkout-react.esm.js +0 -16116
- package/dist/tf-checkout-react.esm.js.map +0 -1
- package/dist/tf-checkout-styles.css +0 -1
- package/dist/types/add_on.d.ts +0 -8
- package/dist/types/billing-info-data.d.ts +0 -27
- package/dist/types/checkoutPageConfigs.d.ts +0 -13
- package/dist/types/index.d.ts +0 -6
- package/dist/types/order-data.d.ts +0 -15
- package/dist/types/payment-field.d.ts +0 -6
- package/dist/types/payment-plan-configuration.d.ts +0 -18
- package/dist/types/referral-promotion.d.ts +0 -6
- package/dist/types/verification.d.ts +0 -12
- package/dist/utils/adaptStripeErrors.d.ts +0 -8
- package/dist/utils/auth.d.ts +0 -21
- package/dist/utils/cookies.d.ts +0 -3
- package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +0 -23
- package/dist/utils/createMarkup.d.ts +0 -3
- package/dist/utils/customFields.d.ts +0 -35
- package/dist/utils/downloadPDF.d.ts +0 -1
- package/dist/utils/form.d.ts +0 -3
- package/dist/utils/formikErrorFocus.d.ts +0 -2
- package/dist/utils/getDomain.d.ts +0 -1
- package/dist/utils/getImage.d.ts +0 -1
- package/dist/utils/getQueryVariable.d.ts +0 -1
- package/dist/utils/htmlNodeFromString.d.ts +0 -1
- package/dist/utils/index.d.ts +0 -15
- package/dist/utils/isBrowser.d.ts +0 -1
- package/dist/utils/isValidNumber.d.ts +0 -1
- package/dist/utils/jsonUtils.d.ts +0 -1
- package/dist/utils/replaceVarInString.d.ts +0 -1
- package/dist/utils/setConfigs.d.ts +0 -11
- package/dist/utils/showZero.d.ts +0 -1
- package/dist/validators/index.d.ts +0 -8
- package/src/adapters/customFields.ts +0 -85
- package/src/adapters/index.ts +0 -1
- package/src/api/auth.ts +0 -88
- package/src/api/cart.ts +0 -28
- package/src/api/checkout.ts +0 -28
- package/src/api/common.ts +0 -190
- package/src/api/guestTicketDelegation.ts +0 -79
- package/src/api/index.ts +0 -346
- package/src/api/interceptors.ts +0 -77
- package/src/api/orders.ts +0 -30
- package/src/api/payment.ts +0 -77
- package/src/api/preRegistrationComplete.ts +0 -37
- package/src/api/publicRequest.ts +0 -47
- package/src/api/resale.ts +0 -28
- package/src/assets/images/Polygon.png +0 -0
- package/src/assets/images/cross.svg +0 -44
- package/src/assets/images/done.svg +0 -3
- package/src/assets/images/edit.svg +0 -10
- package/src/assets/images/email.svg +0 -1
- package/src/assets/images/instagram.svg +0 -5
- package/src/assets/images/logo-ttf.png +0 -0
- package/src/assets/images/spotify.svg +0 -6
- package/src/assets/images/user.svg +0 -1
- package/src/assets/images/xmark.svg +0 -92
- package/src/components/account-settings/index.tsx +0 -161
- package/src/components/account-settings/style.css +0 -200
- package/src/components/addonsContainer/AddonComponent.tsx +0 -204
- package/src/components/addonsContainer/SimpleAddonsContainer.tsx +0 -459
- package/src/components/addonsContainer/adapters/index.tsx +0 -62
- package/src/components/addonsContainer/index.tsx +0 -353
- package/src/components/addonsContainer/normalizers/index.ts +0 -5
- package/src/components/addonsContainer/useAddons.ts +0 -248
- package/src/components/addonsContainer/utils/index.tsx +0 -231
- package/src/components/billing-info-container/hooks/index.ts +0 -3
- package/src/components/billing-info-container/hooks/usePaymentContext.ts +0 -22
- package/src/components/billing-info-container/hooks/usePaymentRedirect.ts +0 -145
- package/src/components/billing-info-container/hooks/useStripePayment.ts +0 -119
- package/src/components/billing-info-container/index.tsx +0 -1695
- package/src/components/billing-info-container/style.css +0 -150
- package/src/components/billing-info-container/utils.tsx +0 -413
- package/src/components/common/Checkbox.tsx +0 -51
- package/src/components/common/CheckboxField/index.tsx +0 -41
- package/src/components/common/CopyField.tsx +0 -53
- package/src/components/common/CopyMessageModal.tsx +0 -34
- package/src/components/common/CustomField.tsx +0 -168
- package/src/components/common/DatePickerField.tsx +0 -126
- package/src/components/common/FieldSection/index.tsx +0 -141
- package/src/components/common/FieldSection/utils/index.tsx +0 -92
- package/src/components/common/FormikPhoneNumberField.tsx +0 -51
- package/src/components/common/Loader.tsx +0 -8
- package/src/components/common/ModalComponent/index.tsx +0 -68
- package/src/components/common/NativeSelectFeild/index.tsx +0 -86
- package/src/components/common/PhoneNumberField.tsx +0 -117
- package/src/components/common/PoweredBy.tsx +0 -15
- package/src/components/common/RadioField.tsx +0 -36
- package/src/components/common/RadioGroupField/index.tsx +0 -76
- package/src/components/common/RedirectModal.tsx +0 -43
- package/src/components/common/SelectField/index.tsx +0 -104
- package/src/components/common/SnackbarAlert.tsx +0 -52
- package/src/components/common/index.tsx +0 -11
- package/src/components/common/socials.tsx +0 -33
- package/src/components/confirmModal/index.tsx +0 -60
- package/src/components/confirmationContainer/config.ts +0 -79
- package/src/components/confirmationContainer/index.tsx +0 -349
- package/src/components/confirmationContainer/social-buttons.tsx +0 -149
- package/src/components/confirmationContainer/style.css +0 -206
- package/src/components/countdown/index.tsx +0 -100
- package/src/components/countdown/style.css +0 -10
- package/src/components/delegationsContainer/IssueComponent.tsx +0 -156
- package/src/components/delegationsContainer/IssueTicketForm.tsx +0 -109
- package/src/components/delegationsContainer/TicketsAssignedTable.tsx +0 -55
- package/src/components/delegationsContainer/TicketsAvailableTable.tsx +0 -54
- package/src/components/delegationsContainer/index.tsx +0 -83
- package/src/components/forgotPasswordModal/index.tsx +0 -138
- package/src/components/forgotPasswordModal/style.css +0 -47
- package/src/components/idVerificationContainer/VerificationPendingModal.tsx +0 -47
- package/src/components/idVerificationContainer/constants.ts +0 -27
- package/src/components/idVerificationContainer/index.tsx +0 -323
- package/src/components/index.ts +0 -12
- package/src/components/loginForm/index.tsx +0 -202
- package/src/components/loginModal/SignUpForm.tsx +0 -329
- package/src/components/loginModal/constants.ts +0 -46
- package/src/components/loginModal/index.tsx +0 -263
- package/src/components/loginModal/style.css +0 -116
- package/src/components/myTicketsContainer/index.tsx +0 -228
- package/src/components/myTicketsContainer/row.tsx +0 -46
- package/src/components/myTicketsContainer/style.css +0 -40
- package/src/components/myTicketsContainer/tableConfig.tsx +0 -80
- package/src/components/myTicketsContainer/types.d.ts +0 -41
- package/src/components/orderDetailsContainer/CustomFieldsForm.tsx +0 -75
- package/src/components/orderDetailsContainer/TicketHolderCustomFields.tsx +0 -100
- package/src/components/orderDetailsContainer/index.tsx +0 -586
- package/src/components/orderDetailsContainer/style.css +0 -77
- package/src/components/orderDetailsContainer/ticketsTable.tsx +0 -246
- package/src/components/orderDetailsContainer/utils/index.tsx +0 -55
- package/src/components/paymentContainer/OrderDetails.tsx +0 -277
- package/src/components/paymentContainer/PaymentPlanSection.tsx +0 -169
- package/src/components/paymentContainer/handlePayment.ts +0 -86
- package/src/components/paymentContainer/index.tsx +0 -643
- package/src/components/paymentContainer/style.css +0 -196
- package/src/components/preRegistration/FieldsSection.tsx +0 -150
- package/src/components/preRegistration/Influancers.tsx +0 -34
- package/src/components/preRegistration/PreRegistrationComplete.tsx +0 -186
- package/src/components/preRegistration/PreRegistrationInformations.tsx +0 -60
- package/src/components/preRegistration/Prewards.tsx +0 -41
- package/src/components/preRegistration/ShareOptions.tsx +0 -77
- package/src/components/preRegistration/constants.tsx +0 -169
- package/src/components/preRegistration/index.tsx +0 -330
- package/src/components/preRegistration/style.css +0 -3
- package/src/components/preRegistration/utils.ts +0 -163
- package/src/components/registerForm/adapters/index.tsx +0 -10
- package/src/components/registerForm/constants.tsx +0 -98
- package/src/components/registerForm/index.tsx +0 -188
- package/src/components/registerModal/index.tsx +0 -154
- package/src/components/registerModal/style.css +0 -18
- package/src/components/resetPasswordContainer/index.tsx +0 -102
- package/src/components/resetPasswordContainer/style.css +0 -36
- package/src/components/rsvpContainer/index.tsx +0 -126
- package/src/components/seatMapContainer/SeatMapComponent.tsx +0 -77
- package/src/components/seatMapContainer/TicketsSection.tsx +0 -286
- package/src/components/seatMapContainer/addToCart.ts +0 -66
- package/src/components/seatMapContainer/index.tsx +0 -443
- package/src/components/seatMapContainer/utils.ts +0 -133
- package/src/components/signupModal/index.tsx +0 -178
- package/src/components/signupModal/style.css +0 -58
- package/src/components/ticketResale/index.tsx +0 -86
- package/src/components/ticketResaleModal/index.tsx +0 -224
- package/src/components/ticketResaleModal/style.css +0 -28
- package/src/components/ticketsContainer/AccessCodeSection.tsx +0 -50
- package/src/components/ticketsContainer/InfoIcon.tsx +0 -35
- package/src/components/ticketsContainer/PromoCodeSection.tsx +0 -116
- package/src/components/ticketsContainer/ReferralLogic.tsx +0 -33
- package/src/components/ticketsContainer/TicketRow.tsx +0 -107
- package/src/components/ticketsContainer/TicketsSection.tsx +0 -350
- package/src/components/ticketsContainer/TimeSlotTicketRow.tsx +0 -243
- package/src/components/ticketsContainer/TimeSlotsSection.tsx +0 -194
- package/src/components/ticketsContainer/index.tsx +0 -986
- package/src/components/ticketsContainer/style.css +0 -178
- package/src/components/ticketsContainer/utils.ts +0 -35
- package/src/components/timerWidget/index.tsx +0 -97
- package/src/components/timerWidget/style.css +0 -35
- package/src/components/waitingList/index.tsx +0 -190
- package/src/components/waitingList/style.css +0 -27
- package/src/constants/index.ts +0 -3
- package/src/env.ts +0 -29
- package/src/hoc/CustomFields/index.tsx +0 -85
- package/src/hoc/index.ts +0 -1
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useCookieListener.ts +0 -32
- package/src/hooks/useEventListener.ts +0 -32
- package/src/hooks/useLocalStorageListener.ts +0 -32
- package/src/hooks/useOnline.ts +0 -21
- package/src/hooks/usePixel.ts +0 -88
- package/src/normalizers/index.ts +0 -49
- package/src/types/add_on.ts +0 -8
- package/src/types/api/auth.d.ts +0 -63
- package/src/types/api/axiosResponse.d.ts +0 -6
- package/src/types/api/cart.d.ts +0 -73
- package/src/types/api/checkout.d.ts +0 -92
- package/src/types/api/common.d.ts +0 -153
- package/src/types/api/guestTicketDelegation.d.ts +0 -18
- package/src/types/api/orders.d.ts +0 -116
- package/src/types/api/payment.d.ts +0 -180
- package/src/types/api/preRegistration.d.ts +0 -11
- package/src/types/api/preRegistrationComplete.d.ts +0 -95
- package/src/types/api/ticketResale.d.ts +0 -13
- package/src/types/billing-info-data.ts +0 -37
- package/src/types/checkoutPageConfigs.ts +0 -13
- package/src/types/formFields.d.ts +0 -29
- package/src/types/index.ts +0 -6
- package/src/types/order-data.ts +0 -16
- package/src/types/payment-field.ts +0 -7
- package/src/types/payment-plan-configuration.ts +0 -19
- package/src/types/pre-registration-complete.d.ts +0 -47
- package/src/types/referral-promotion.ts +0 -7
- package/src/types/seatMap.d.ts +0 -159
- package/src/types/verification.ts +0 -12
- package/src/utils/adaptStripeErrors.ts +0 -26
- package/src/utils/auth.ts +0 -45
- package/src/utils/cookies.ts +0 -73
- package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +0 -81
- package/src/utils/createMarkup.ts +0 -1
- package/src/utils/customFields.ts +0 -80
- package/src/utils/downloadPDF.tsx +0 -42
- package/src/utils/form.ts +0 -34
- package/src/utils/formikErrorFocus.ts +0 -24
- package/src/utils/getDomain.ts +0 -21
- package/src/utils/getImage.ts +0 -14
- package/src/utils/getQueryVariable.ts +0 -13
- package/src/utils/htmlNodeFromString.ts +0 -6
- package/src/utils/index.ts +0 -15
- package/src/utils/isBrowser.ts +0 -2
- package/src/utils/isValidNumber.ts +0 -8
- package/src/utils/jsonUtils.ts +0 -8
- package/src/utils/replaceVarInString.ts +0 -9
- package/src/utils/setConfigs.ts +0 -24
- package/src/utils/showZero.tsx +0 -10
- package/src/validators/index.ts +0 -61
package/src/confirmer.ts
ADDED
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web (stripe-js) adapter of the SDK's PaymentConfirmer port — the proof that
|
|
3
|
+
* the engine in `tf-checkout-shared` is genuinely platform-free. Bind it via
|
|
4
|
+
* `useCheckout({ ports: { confirmer: webConfirmer, ...webPorts } })` to run the
|
|
5
|
+
* exact same cart → order → charge → finalize sequence React Native runs (same
|
|
6
|
+
* retry-safety invariants, same duplicate-charge guards, same tests).
|
|
7
|
+
*
|
|
8
|
+
* Card payments on the web confirm against a Stripe Element the consumer
|
|
9
|
+
* renders: register it via `confirmer.registerCardElement(element)` before
|
|
10
|
+
* placing the order. Apple Pay is not bound on web yet (the web equivalent is
|
|
11
|
+
* the Payment Request button, a different integration) — `confirmApplePay`
|
|
12
|
+
* throws with a clear message.
|
|
13
|
+
*/
|
|
14
|
+
import {
|
|
15
|
+
loadStripe,
|
|
16
|
+
type Stripe,
|
|
17
|
+
type StripeCardElement,
|
|
18
|
+
type StripeElements,
|
|
19
|
+
} from '@stripe/stripe-js'
|
|
20
|
+
import type {
|
|
21
|
+
CheckoutBilling,
|
|
22
|
+
CheckoutPorts,
|
|
23
|
+
PaymentConfirmer,
|
|
24
|
+
} from 'tf-checkout-shared'
|
|
25
|
+
|
|
26
|
+
import type { WebXenditTokenizer } from './xendit'
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* stripe-js reports PaymentIntent statuses in snake_case; the port's
|
|
30
|
+
* vocabulary is the RN SDK's PascalCase. Normalize so
|
|
31
|
+
* CONFIRMED_INTENT_STATUSES matches on both platforms.
|
|
32
|
+
*/
|
|
33
|
+
const normalizeStatus = (status?: string): string | undefined => {
|
|
34
|
+
if (!status) return undefined
|
|
35
|
+
const map: Record<string, string> = {
|
|
36
|
+
succeeded: 'Succeeded',
|
|
37
|
+
requires_capture: 'RequiresCapture',
|
|
38
|
+
processing: 'Processing',
|
|
39
|
+
requires_payment_method: 'RequiresPaymentMethod',
|
|
40
|
+
requires_confirmation: 'RequiresConfirmation',
|
|
41
|
+
requires_action: 'RequiresAction',
|
|
42
|
+
canceled: 'Canceled',
|
|
43
|
+
}
|
|
44
|
+
return map[status] ?? status
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface WebStripeConfirmer extends PaymentConfirmer {
|
|
48
|
+
/** The card Element the consumer rendered — required before confirmCard. */
|
|
49
|
+
registerCardElement(element: StripeCardElement | null): void
|
|
50
|
+
/** The currently registered card Element (null before registration) —
|
|
51
|
+
* the MSI port creates its PaymentMethod from it. */
|
|
52
|
+
getCardElement(): StripeCardElement | null
|
|
53
|
+
/**
|
|
54
|
+
* The Elements GROUP backing a `<StripePaymentElement/>` (deferred mode).
|
|
55
|
+
* This is how the old checkout did wallets: when a Payment Element is
|
|
56
|
+
* registered, `confirmCard` confirms card + Apple Pay + Google Pay through it
|
|
57
|
+
* (`elements.submit()` + `stripe.confirmPayment`), exactly as the old
|
|
58
|
+
* `useStripePayment.processPayment` did. Null when only a bare card is rendered.
|
|
59
|
+
*/
|
|
60
|
+
registerPaymentElement(elements: StripeElements | null): void
|
|
61
|
+
getPaymentElement(): StripeElements | null
|
|
62
|
+
/**
|
|
63
|
+
* The live Stripe instance (null before the flow calls init). Elements MUST
|
|
64
|
+
* be created from this instance — stripe-js rejects confirming with an
|
|
65
|
+
* Element born from a different one:
|
|
66
|
+
* `confirmer.getStripe()!.elements().create('card')`.
|
|
67
|
+
*/
|
|
68
|
+
getStripe(): Stripe | null
|
|
69
|
+
/** Resolves with the Stripe instance as soon as init() has run — mount UI
|
|
70
|
+
* against this instead of polling getStripe(). */
|
|
71
|
+
whenReady(): Promise<Stripe>
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const createWebStripeConfirmer = (): WebStripeConfirmer => {
|
|
75
|
+
let stripe: Stripe | null = null
|
|
76
|
+
let initKey: string | null = null
|
|
77
|
+
let cardElement: StripeCardElement | null = null
|
|
78
|
+
let paymentElements: StripeElements | null = null
|
|
79
|
+
let readyResolve: (s: Stripe) => void
|
|
80
|
+
let ready = new Promise<Stripe>((r) => (readyResolve = r))
|
|
81
|
+
|
|
82
|
+
const requireStripe = (): Stripe => {
|
|
83
|
+
if (!stripe) {
|
|
84
|
+
throw new Error(
|
|
85
|
+
'Stripe is not initialized — the flow calls confirmer.init() first.'
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
return stripe
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
registerCardElement: (element) => {
|
|
93
|
+
cardElement = element
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
getCardElement: () => cardElement,
|
|
97
|
+
|
|
98
|
+
registerPaymentElement: (elements) => {
|
|
99
|
+
paymentElements = elements
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
getPaymentElement: () => paymentElements,
|
|
103
|
+
|
|
104
|
+
getStripe: () => stripe,
|
|
105
|
+
|
|
106
|
+
whenReady: () => ready,
|
|
107
|
+
|
|
108
|
+
init: async ({ publishableKey, accountId }) => {
|
|
109
|
+
// Re-init only when the key/account pair changes (events on connected
|
|
110
|
+
// accounts each need their own instance).
|
|
111
|
+
const key = `${publishableKey}:${accountId ?? ''}`
|
|
112
|
+
if (stripe && initKey === key) return
|
|
113
|
+
stripe = await loadStripe(
|
|
114
|
+
publishableKey,
|
|
115
|
+
accountId ? { stripeAccount: accountId } : undefined
|
|
116
|
+
)
|
|
117
|
+
if (!stripe) throw new Error('Failed to load Stripe.js.')
|
|
118
|
+
initKey = key
|
|
119
|
+
readyResolve(stripe)
|
|
120
|
+
// subsequent inits (new key) refresh the promise for late mounts
|
|
121
|
+
ready = Promise.resolve(stripe)
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
getIntentStatus: async (clientSecret) => {
|
|
125
|
+
const { paymentIntent } = await requireStripe().retrievePaymentIntent(clientSecret)
|
|
126
|
+
return normalizeStatus(paymentIntent?.status)
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
confirmCard: async (clientSecret, billing: CheckoutBilling) => {
|
|
130
|
+
// Wallet-capable path — the way the OLD checkout confirmed. When a
|
|
131
|
+
// `<StripePaymentElement/>` is mounted, the buyer may have picked card OR
|
|
132
|
+
// Apple/Google Pay INSIDE the widget; a single `elements.submit()` +
|
|
133
|
+
// `stripe.confirmPayment({ elements, clientSecret })` settles whichever it
|
|
134
|
+
// is (`useStripePayment.processPayment`). Billing is left to the element —
|
|
135
|
+
// matching old, and avoiding Stripe's "collected in both places" error.
|
|
136
|
+
if (paymentElements) {
|
|
137
|
+
const { error: submitError } = await paymentElements.submit()
|
|
138
|
+
if (submitError) throw new Error(submitError.message || 'Payment failed.')
|
|
139
|
+
const returnUrl =
|
|
140
|
+
window.location.href +
|
|
141
|
+
(window.location.href.includes('?') ? '&' : '?') +
|
|
142
|
+
'payment_return=true'
|
|
143
|
+
const { error, paymentIntent } = await requireStripe().confirmPayment({
|
|
144
|
+
clientSecret,
|
|
145
|
+
elements: paymentElements,
|
|
146
|
+
confirmParams: { return_url: returnUrl },
|
|
147
|
+
// Card + wallets settle in place; only a redirect method navigates away.
|
|
148
|
+
redirect: 'if_required',
|
|
149
|
+
})
|
|
150
|
+
if (error) throw new Error(error.message || 'Payment failed.')
|
|
151
|
+
return normalizeStatus(paymentIntent?.status)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Bare-card fallback (no wallets / MSI events): the current CardElement path.
|
|
155
|
+
if (!cardElement) {
|
|
156
|
+
throw new Error(
|
|
157
|
+
'No card element registered — call confirmer.registerCardElement(element) with the CardElement you rendered.'
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
const { error, paymentIntent } = await requireStripe().confirmCardPayment(
|
|
161
|
+
clientSecret,
|
|
162
|
+
{
|
|
163
|
+
payment_method: {
|
|
164
|
+
card: cardElement,
|
|
165
|
+
billing_details: {
|
|
166
|
+
email: billing.email,
|
|
167
|
+
name: `${billing.firstName} ${billing.lastName}`.trim(),
|
|
168
|
+
phone: billing.phone || undefined,
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
if (error) throw new Error(error.message || 'Payment failed.')
|
|
174
|
+
return normalizeStatus(paymentIntent?.status)
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
confirmApplePay: async () => {
|
|
178
|
+
throw new Error(
|
|
179
|
+
'Apple Pay is not bound on web yet — use the card flow, or bind a Payment Request confirmer.'
|
|
180
|
+
)
|
|
181
|
+
},
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// ---------------------------------------------------------------------------
|
|
186
|
+
// Web bindings of the engine's alternative-rail ports
|
|
187
|
+
// ---------------------------------------------------------------------------
|
|
188
|
+
|
|
189
|
+
const stripeBillingDetails = (billing: CheckoutBilling) => ({
|
|
190
|
+
email: billing.email,
|
|
191
|
+
name: `${billing.firstName} ${billing.lastName}`.trim(),
|
|
192
|
+
phone: billing.phone || undefined,
|
|
193
|
+
address: {
|
|
194
|
+
line1: billing.streetAddress || undefined,
|
|
195
|
+
city: billing.city || undefined,
|
|
196
|
+
postal_code: billing.zip || undefined,
|
|
197
|
+
// Stripe wants ISO-2 — CheckoutBilling.countryCode/stateCode carry it when
|
|
198
|
+
// the consumer resolved them (backend countryId/stateId are numeric);
|
|
199
|
+
// providers that require it still collect it on their own page otherwise.
|
|
200
|
+
country: billing.countryCode || undefined,
|
|
201
|
+
state: billing.stateCode || undefined,
|
|
202
|
+
},
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* The web half of the engine's `CheckoutPorts`:
|
|
207
|
+
*
|
|
208
|
+
* - `providerPage` runs the provider in a POPUP and resolves when navigation
|
|
209
|
+
* lands back on `returnUrlPrefix` (same-origin, so the URL is readable);
|
|
210
|
+
* a closed popup resolves as 'dismiss'. Call `placeOrder` from a click
|
|
211
|
+
* handler, or the browser's popup blocker will refuse the window.
|
|
212
|
+
* - `confirmOxxo` / `createCardPaymentMethod` / `createRedirectPaymentMethod`
|
|
213
|
+
* / `handleNextAction` bind the same Stripe legs the RN ports bind.
|
|
214
|
+
*
|
|
215
|
+
* MSI's `onInstallmentOffers` picker stays consumer-supplied (pass it via
|
|
216
|
+
* `placeOrder(request, ports)`).
|
|
217
|
+
*/
|
|
218
|
+
export const createWebPorts = (
|
|
219
|
+
confirmer: WebStripeConfirmer,
|
|
220
|
+
/** The Xendit card tokenizer `<XenditCardInput/>` binds to. When given, the
|
|
221
|
+
* engine tokenizes Xendit cards inline instead of in a popup. */
|
|
222
|
+
xenditTokenizer?: WebXenditTokenizer
|
|
223
|
+
): Omit<CheckoutPorts, 'confirmer'> => {
|
|
224
|
+
const requireStripe = (): Stripe => {
|
|
225
|
+
const stripe = confirmer.getStripe()
|
|
226
|
+
if (!stripe) {
|
|
227
|
+
throw new Error(
|
|
228
|
+
'Stripe is not initialized — the flow calls confirmer.init() first.'
|
|
229
|
+
)
|
|
230
|
+
}
|
|
231
|
+
return stripe
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return {
|
|
235
|
+
...(xenditTokenizer
|
|
236
|
+
? {
|
|
237
|
+
tokenizeXenditCard: (params) =>
|
|
238
|
+
xenditTokenizer.tokenize({
|
|
239
|
+
publishableKey: params.publishableKey,
|
|
240
|
+
amount: params.amount,
|
|
241
|
+
billing: {
|
|
242
|
+
firstName: params.billing.firstName,
|
|
243
|
+
lastName: params.billing.lastName,
|
|
244
|
+
email: params.billing.email,
|
|
245
|
+
phone: params.billing.phone,
|
|
246
|
+
},
|
|
247
|
+
onBehalfOf: params.onBehalfOf,
|
|
248
|
+
}),
|
|
249
|
+
}
|
|
250
|
+
: {}),
|
|
251
|
+
|
|
252
|
+
openUrl: (url: string) => {
|
|
253
|
+
window.open(url, '_blank', 'noopener')
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
providerPage: ({ uri, html, returnUrlPrefix }) =>
|
|
257
|
+
new Promise((resolve) => {
|
|
258
|
+
const popup = window.open(
|
|
259
|
+
uri ?? '',
|
|
260
|
+
'tf-checkout-gateway',
|
|
261
|
+
'width=480,height=720'
|
|
262
|
+
)
|
|
263
|
+
if (!popup) {
|
|
264
|
+
resolve({
|
|
265
|
+
event: 'failed',
|
|
266
|
+
description: 'Please allow pop-ups to continue this payment.',
|
|
267
|
+
})
|
|
268
|
+
return
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
let settled = false
|
|
272
|
+
let timer = 0
|
|
273
|
+
const settle = (outcome: {
|
|
274
|
+
event: 'success' | 'dismiss' | 'failed'
|
|
275
|
+
returnUrl?: string
|
|
276
|
+
data?: Record<string, unknown>
|
|
277
|
+
description?: string
|
|
278
|
+
}) => {
|
|
279
|
+
if (settled) return
|
|
280
|
+
settled = true
|
|
281
|
+
window.clearInterval(timer)
|
|
282
|
+
window.removeEventListener('message', onMessage)
|
|
283
|
+
if (!popup.closed) popup.close()
|
|
284
|
+
resolve(outcome)
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// Data-driven sheets (Razorpay, Xendit card) post lifecycle JSON via
|
|
288
|
+
// ReactNativeWebView.postMessage — the shim below forwards it to this
|
|
289
|
+
// window, same protocol as checkout-v2's WebView onMessage.
|
|
290
|
+
const onMessage = (e: MessageEvent) => {
|
|
291
|
+
if (e.source !== popup) return
|
|
292
|
+
const raw = (e.data as { __tfGatewaySheet?: string } | null)?.__tfGatewaySheet
|
|
293
|
+
if (typeof raw !== 'string') return
|
|
294
|
+
let parsed: {
|
|
295
|
+
event?: string
|
|
296
|
+
razorpay_payment_id?: string
|
|
297
|
+
token?: Record<string, unknown>
|
|
298
|
+
description?: string
|
|
299
|
+
} | null = null
|
|
300
|
+
try {
|
|
301
|
+
parsed = JSON.parse(raw)
|
|
302
|
+
} catch {
|
|
303
|
+
return
|
|
304
|
+
}
|
|
305
|
+
if (!parsed || typeof parsed.event !== 'string') return
|
|
306
|
+
if (parsed.event === 'success') {
|
|
307
|
+
settle({
|
|
308
|
+
event: 'success',
|
|
309
|
+
data: {
|
|
310
|
+
...(parsed.razorpay_payment_id
|
|
311
|
+
? { razorpay_payment_id: parsed.razorpay_payment_id }
|
|
312
|
+
: {}),
|
|
313
|
+
...(parsed.token ? { token: parsed.token } : {}),
|
|
314
|
+
},
|
|
315
|
+
})
|
|
316
|
+
} else if (parsed.event === 'dismiss') {
|
|
317
|
+
settle({ event: 'dismiss' })
|
|
318
|
+
} else if (parsed.event === 'failed') {
|
|
319
|
+
settle({ event: 'failed', description: parsed.description })
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
window.addEventListener('message', onMessage)
|
|
323
|
+
|
|
324
|
+
if (!uri && html) {
|
|
325
|
+
const shim =
|
|
326
|
+
'<script>window.ReactNativeWebView={postMessage:function(m){' +
|
|
327
|
+
"window.opener&&window.opener.postMessage({__tfGatewaySheet:m},'*')}}</script>"
|
|
328
|
+
popup.document.open()
|
|
329
|
+
popup.document.write(shim + html)
|
|
330
|
+
popup.document.close()
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
timer = window.setInterval(() => {
|
|
334
|
+
if (popup.closed) {
|
|
335
|
+
settle({ event: 'dismiss' })
|
|
336
|
+
return
|
|
337
|
+
}
|
|
338
|
+
try {
|
|
339
|
+
const href = popup.location.href
|
|
340
|
+
if (href && href.startsWith(returnUrlPrefix)) {
|
|
341
|
+
settle({ event: 'success', returnUrl: href })
|
|
342
|
+
}
|
|
343
|
+
} catch {
|
|
344
|
+
// Cross-origin while on the provider's page — keep polling.
|
|
345
|
+
}
|
|
346
|
+
}, 500)
|
|
347
|
+
}),
|
|
348
|
+
|
|
349
|
+
createCardPaymentMethod: async (billing: CheckoutBilling) => {
|
|
350
|
+
const card = confirmer.getCardElement()
|
|
351
|
+
if (!card) {
|
|
352
|
+
throw new Error(
|
|
353
|
+
'No card element registered — render <CardInput/> before placing the order.'
|
|
354
|
+
)
|
|
355
|
+
}
|
|
356
|
+
const { paymentMethod, error } = await requireStripe().createPaymentMethod({
|
|
357
|
+
type: 'card',
|
|
358
|
+
card,
|
|
359
|
+
billing_details: stripeBillingDetails(billing),
|
|
360
|
+
})
|
|
361
|
+
if (error || !paymentMethod?.id) {
|
|
362
|
+
throw new Error(error?.message || 'Payment failed')
|
|
363
|
+
}
|
|
364
|
+
return paymentMethod.id
|
|
365
|
+
},
|
|
366
|
+
|
|
367
|
+
createRedirectPaymentMethod: async (methodType: string, billing: CheckoutBilling) => {
|
|
368
|
+
const { paymentMethod, error } = await requireStripe().createPaymentMethod({
|
|
369
|
+
type: methodType,
|
|
370
|
+
billing_details: stripeBillingDetails(billing),
|
|
371
|
+
} as unknown as Parameters<Stripe['createPaymentMethod']>[0])
|
|
372
|
+
// An unknown/unsupported type is the platform saying "can't express
|
|
373
|
+
// this" — the engine turns null into a typed UNSUPPORTED_GATEWAY.
|
|
374
|
+
if (error) return null
|
|
375
|
+
return paymentMethod?.id ?? null
|
|
376
|
+
},
|
|
377
|
+
|
|
378
|
+
handleNextAction: async (clientSecret: string) => {
|
|
379
|
+
const stripe = requireStripe() as Stripe & {
|
|
380
|
+
handleNextAction?: (options: {
|
|
381
|
+
clientSecret: string
|
|
382
|
+
}) => Promise<{ error?: { message?: string } }>
|
|
383
|
+
}
|
|
384
|
+
if (!stripe.handleNextAction) {
|
|
385
|
+
throw new Error('This Stripe.js version cannot run the payment’s next step.')
|
|
386
|
+
}
|
|
387
|
+
const { error } = await stripe.handleNextAction({ clientSecret })
|
|
388
|
+
if (error) throw new Error(error.message || 'Payment failed')
|
|
389
|
+
},
|
|
390
|
+
|
|
391
|
+
confirmOxxo: async (clientSecret: string, billing: CheckoutBilling) => {
|
|
392
|
+
const { error, paymentIntent } = await requireStripe().confirmOxxoPayment(
|
|
393
|
+
clientSecret,
|
|
394
|
+
{ payment_method: { billing_details: stripeBillingDetails(billing) } }
|
|
395
|
+
)
|
|
396
|
+
return {
|
|
397
|
+
error: error?.message,
|
|
398
|
+
// stripe-js reports snake_case next_action — exactly the shape the
|
|
399
|
+
// shared logic's oxxoVoucherFromNextAction parses.
|
|
400
|
+
nextAction: paymentIntent?.next_action as unknown,
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
|
|
404
|
+
// Payment plan (new card): confirm the SetupIntent against the registered
|
|
405
|
+
// CardElement to SAVE the card (nothing charged), returning its
|
|
406
|
+
// PaymentMethod id for the server-side plan.
|
|
407
|
+
confirmPaymentPlanSetup: async (clientSecret: string, billing: CheckoutBilling) => {
|
|
408
|
+
const card = confirmer.getCardElement()
|
|
409
|
+
if (!card) {
|
|
410
|
+
throw new Error(
|
|
411
|
+
'No card element registered — render <CardInput/> before placing the order.'
|
|
412
|
+
)
|
|
413
|
+
}
|
|
414
|
+
const { setupIntent, error } = await requireStripe().confirmCardSetup(
|
|
415
|
+
clientSecret,
|
|
416
|
+
{
|
|
417
|
+
payment_method: { card, billing_details: stripeBillingDetails(billing) },
|
|
418
|
+
}
|
|
419
|
+
)
|
|
420
|
+
// payment_method is a string id (or an expanded object on some responses).
|
|
421
|
+
const pm = setupIntent?.payment_method
|
|
422
|
+
const paymentMethodId =
|
|
423
|
+
typeof pm === 'string' ? pm : (pm as { id?: string } | null)?.id
|
|
424
|
+
if (error || !paymentMethodId) {
|
|
425
|
+
throw new Error(error?.message || 'Card setup failed')
|
|
426
|
+
}
|
|
427
|
+
return paymentMethodId
|
|
428
|
+
},
|
|
429
|
+
|
|
430
|
+
// Payment plan (saved-card 3DS): confirm the pending charge against the
|
|
431
|
+
// existing PaymentMethod when the plan comes back requires_action.
|
|
432
|
+
confirmSavedCardPayment: async (clientSecret: string, paymentMethodId: string) => {
|
|
433
|
+
const { error } = await requireStripe().confirmCardPayment(clientSecret, {
|
|
434
|
+
payment_method: paymentMethodId,
|
|
435
|
+
})
|
|
436
|
+
if (error) throw new Error(error.message || 'Payment failed')
|
|
437
|
+
},
|
|
438
|
+
}
|
|
439
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,33 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export { TicketResaleContainer } from './components'
|
|
11
|
-
export { RedirectModal } from './components/common/RedirectModal'
|
|
12
|
-
export { RsvpContainer } from './components/rsvpContainer'
|
|
13
|
-
export { ResetPasswordContainer } from './components/resetPasswordContainer'
|
|
14
|
-
export { ForgotPasswordModal } from './components/forgotPasswordModal'
|
|
15
|
-
export { AddonsContainter } from './components/addonsContainer'
|
|
16
|
-
export { useAddons } from './components/addonsContainer/useAddons'
|
|
17
|
-
export { default as TimerWidget } from './components/timerWidget'
|
|
18
|
-
export { VerificationPendingModal } from './components/idVerificationContainer/VerificationPendingModal'
|
|
19
|
-
export { PreRegistration } from './components/preRegistration'
|
|
20
|
-
export { PreRegistrationComplete } from './components/preRegistration/PreRegistrationComplete'
|
|
21
|
-
export { PreRegistrationInformations } from './components/preRegistration/PreRegistrationInformations'
|
|
1
|
+
/**
|
|
2
|
+
* tf-checkout-react — the web checkout, built on `tf-checkout-shared`.
|
|
3
|
+
*
|
|
4
|
+
* One import gives you the whole SDK (ttf, ENDPOINTS, dtos, logic, the engine)
|
|
5
|
+
* PLUS the web platform layer: a `useCheckout` with Stripe + popup + inline
|
|
6
|
+
* Xendit pre-wired, `<CardInput/>` / `<XenditCardInput/>`, and `configureCheckout`.
|
|
7
|
+
*
|
|
8
|
+
* import { configureCheckout, useCheckout, CardInput, ttf } from 'tf-checkout-react'
|
|
9
|
+
*/
|
|
22
10
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export { SeatMapContainer } from './components/seatMapContainer'
|
|
27
|
-
export { IDVerification } from './components/idVerificationContainer'
|
|
28
|
-
export { VERIFICATION_STATUSES } from './components/idVerificationContainer/constants'
|
|
11
|
+
// Load the SDK styles once. Consumers do not need a separate CSS import.
|
|
12
|
+
import 'react-international-phone/style.css'
|
|
13
|
+
import './checkout.css'
|
|
29
14
|
|
|
30
|
-
|
|
31
|
-
export
|
|
15
|
+
// The entire shared SDK (the web `useCheckout` below overrides the SDK's).
|
|
16
|
+
export * from 'tf-checkout-shared'
|
|
32
17
|
|
|
33
|
-
|
|
18
|
+
// Web platform layer
|
|
19
|
+
export { useCheckout, type UseCheckoutOptions } from './useCheckout'
|
|
20
|
+
export { configureCheckout, localStorageAdapter } from './configure'
|
|
21
|
+
export { CardInput, StripePaymentElement, XenditCardInput } from './CardInput'
|
|
22
|
+
|
|
23
|
+
// Component library: the themeable provider + primitives + section components.
|
|
24
|
+
export * from './ui'
|
|
25
|
+
export * from './auth'
|
|
26
|
+
export * from './sections'
|
|
27
|
+
export {
|
|
28
|
+
EmbeddedCheckout,
|
|
29
|
+
type EmbeddedCheckoutProps,
|
|
30
|
+
type EmbeddedCheckoutAuthOptions,
|
|
31
|
+
} from './EmbeddedCheckout'
|
|
32
|
+
export { ResumedCheckout, type ResumedCheckoutProps } from './ResumedCheckout'
|
|
33
|
+
|
|
34
|
+
export { webConfirmer, webPorts, webXenditTokenizer } from './instance'
|
|
35
|
+
export {
|
|
36
|
+
createWebStripeConfirmer,
|
|
37
|
+
createWebPorts,
|
|
38
|
+
type WebStripeConfirmer,
|
|
39
|
+
} from './confirmer'
|
|
40
|
+
export {
|
|
41
|
+
createWebXenditTokenizer,
|
|
42
|
+
type WebXenditTokenizer,
|
|
43
|
+
type XenditCardFields,
|
|
44
|
+
} from './xendit'
|
package/src/instance.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The package-level web platform instances. Created once at module load
|
|
3
|
+
* (SSR-safe — nothing touches the DOM until `init()` / `tokenize()` run), so the
|
|
4
|
+
* hook and the UI components all bind to the SAME confirmer/tokenizer.
|
|
5
|
+
*/
|
|
6
|
+
import {
|
|
7
|
+
createWebPorts,
|
|
8
|
+
createWebStripeConfirmer,
|
|
9
|
+
type WebStripeConfirmer,
|
|
10
|
+
} from './confirmer'
|
|
11
|
+
import { createWebXenditTokenizer, type WebXenditTokenizer } from './xendit'
|
|
12
|
+
|
|
13
|
+
/** The confirmer every `useCheckout`/`<CardInput/>` binds to. */
|
|
14
|
+
export const webConfirmer: WebStripeConfirmer = createWebStripeConfirmer()
|
|
15
|
+
|
|
16
|
+
/** The Xendit card tokenizer `<XenditCardInput/>` binds to. */
|
|
17
|
+
export const webXenditTokenizer: WebXenditTokenizer = createWebXenditTokenizer()
|
|
18
|
+
|
|
19
|
+
/** The web ports the alternative rails run on: the popup provider page, OXXO /
|
|
20
|
+
* MSI Stripe legs, and inline Xendit tokenization. */
|
|
21
|
+
export const webPorts = createWebPorts(webConfirmer, webXenditTokenizer)
|