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.
- 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/xendit.ts
ADDED
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web (xendit.js) binding for Xendit CARD tokenization — the inline,
|
|
3
|
+
* natively-styled equivalent of the React Native WebView sheet. It loads
|
|
4
|
+
* xendit.js into the page, tokenizes the card the consumer rendered via
|
|
5
|
+
* `<XenditCardInput/>`, and runs the 3DS challenge in a full-screen overlay.
|
|
6
|
+
* The engine charges the returned token server-side.
|
|
7
|
+
*
|
|
8
|
+
* The consumer's app must allow `https://js.xendit.co` in its CSP.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const XENDIT_JS = 'https://js.xendit.co/v1/xendit.min.js'
|
|
12
|
+
|
|
13
|
+
/** How long to wait for xendit.js to call our callback even ONCE before giving
|
|
14
|
+
* up. The SDK can stall after its `payer/init` + `fingerprint/scans` warmup
|
|
15
|
+
* without ever POSTing `/v2/credit_card_tokens`; without this the promise
|
|
16
|
+
* never settles and the buyer stares at a blank 3DS overlay forever. */
|
|
17
|
+
const FIRST_RESPONSE_TIMEOUT_MS = 45_000
|
|
18
|
+
|
|
19
|
+
interface XenditToken {
|
|
20
|
+
status: 'VERIFIED' | 'IN_REVIEW' | 'FAILED' | string
|
|
21
|
+
payer_authentication_url?: string
|
|
22
|
+
[k: string]: unknown
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface XenditGlobal {
|
|
26
|
+
setPublishableKey(key: string): void
|
|
27
|
+
card: {
|
|
28
|
+
createToken(
|
|
29
|
+
data: Record<string, unknown>,
|
|
30
|
+
cb: (err: XenditError | null, token: XenditToken) => void
|
|
31
|
+
): void
|
|
32
|
+
/** xendit.js ships its own validators — use them so the rules match exactly
|
|
33
|
+
* what `createToken` will accept, instead of re-deriving them here. */
|
|
34
|
+
validateCardNumber(number: string): boolean
|
|
35
|
+
validateExpiry(month: string, year: string): boolean
|
|
36
|
+
validateCvn(cvn: string): boolean
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Luhn — the fallback used only before xendit.js has finished loading. */
|
|
41
|
+
const luhn = (digits: string): boolean => {
|
|
42
|
+
let sum = 0
|
|
43
|
+
let double = false
|
|
44
|
+
for (let i = digits.length - 1; i >= 0; i -= 1) {
|
|
45
|
+
let d = digits.charCodeAt(i) - 48
|
|
46
|
+
if (d < 0 || d > 9) return false
|
|
47
|
+
if (double) {
|
|
48
|
+
d *= 2
|
|
49
|
+
if (d > 9) d -= 9
|
|
50
|
+
}
|
|
51
|
+
sum += d
|
|
52
|
+
double = !double
|
|
53
|
+
}
|
|
54
|
+
return sum % 10 === 0
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const xenditGlobal = (): XenditGlobal | undefined =>
|
|
58
|
+
typeof window === 'undefined'
|
|
59
|
+
? undefined
|
|
60
|
+
: (window as unknown as { Xendit?: XenditGlobal }).Xendit
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Field-level card checks, matching what `createToken` enforces. Prefers
|
|
64
|
+
* xendit.js's own validators and falls back to equivalent local rules while the
|
|
65
|
+
* script is still loading, so a form can validate on blur from the first
|
|
66
|
+
* keystroke. `expYear` accepts "YY" or "YYYY".
|
|
67
|
+
*/
|
|
68
|
+
export const xenditCardChecks = {
|
|
69
|
+
number: (value: string): boolean => {
|
|
70
|
+
const digits = value.replace(/\D/g, '')
|
|
71
|
+
if (digits.length < 12) return false
|
|
72
|
+
const X = xenditGlobal()
|
|
73
|
+
return X?.card?.validateCardNumber
|
|
74
|
+
? X.card.validateCardNumber(digits)
|
|
75
|
+
: digits.length <= 19 && luhn(digits)
|
|
76
|
+
},
|
|
77
|
+
expiry: (month: string, year: string): boolean => {
|
|
78
|
+
const mm = month.trim()
|
|
79
|
+
const yyyy = year.trim().length === 2 ? `20${year.trim()}` : year.trim()
|
|
80
|
+
if (!/^\d{1,2}$/.test(mm) || !/^\d{4}$/.test(yyyy)) return false
|
|
81
|
+
const X = xenditGlobal()
|
|
82
|
+
if (X?.card?.validateExpiry) return X.card.validateExpiry(mm, yyyy)
|
|
83
|
+
const m = Number(mm)
|
|
84
|
+
const y = Number(yyyy)
|
|
85
|
+
if (m < 1 || m > 12) return false
|
|
86
|
+
const now = new Date()
|
|
87
|
+
return y > now.getFullYear() || (y === now.getFullYear() && m >= now.getMonth() + 1)
|
|
88
|
+
},
|
|
89
|
+
cvn: (value: string): boolean => {
|
|
90
|
+
const digits = value.replace(/\D/g, '')
|
|
91
|
+
const X = xenditGlobal()
|
|
92
|
+
return X?.card?.validateCvn
|
|
93
|
+
? X.card.validateCvn(digits)
|
|
94
|
+
: digits.length >= 3 && digits.length <= 4
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Human copy for Xendit's `failure_reason` codes — the same map the hosted PHP
|
|
100
|
+
* checkout shows (`XenditHelper::FAILURE_REASONS`). Without it a decline
|
|
101
|
+
* surfaces as a bare code like `INVALID_CVV`, which means nothing to a buyer.
|
|
102
|
+
*/
|
|
103
|
+
export const XENDIT_FAILURE_REASONS: Record<string, string> = {
|
|
104
|
+
EXPIRED_CARD: 'This card has expired. Please use a different card.',
|
|
105
|
+
ISSUER_SUSPECT_FRAUD:
|
|
106
|
+
'Your bank declined this card as a suspected fraud risk. Please use a different card.',
|
|
107
|
+
DECLINED_BY_PROCESSOR:
|
|
108
|
+
'This card was declined by the payment processor. Please use a different card.',
|
|
109
|
+
INSUFFICIENT_BALANCE: 'This card does not have enough balance to complete the payment.',
|
|
110
|
+
STOLEN_CARD: 'This card has been reported lost or stolen.',
|
|
111
|
+
INACTIVE_OR_UNAUTHORIZED_CARD:
|
|
112
|
+
'This card is inactive, or not authorised for this type of payment.',
|
|
113
|
+
PROCESSOR_ERROR:
|
|
114
|
+
'The payment could not be processed by your bank. Please try again shortly.',
|
|
115
|
+
INVALID_CVV: 'The security code (CVC) does not match this card.',
|
|
116
|
+
DECLINED_BY_ISSUER: 'Your bank declined this payment. Please use a different card.',
|
|
117
|
+
AUTHENTICATION_FAILED:
|
|
118
|
+
'Card authentication failed. Please try again or use a different card.',
|
|
119
|
+
ENROLLMENT_STATUS_UNAVAILABLE:
|
|
120
|
+
'Your bank could not verify this card right now. Please try again or use a different card.',
|
|
121
|
+
DEFAULT: 'Your payment was not accepted. Please try again or use a different card.',
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Xendit accepts only ASCII + Latin-1 in `card_holder_*` names, and requires a
|
|
126
|
+
* letter first:
|
|
127
|
+
* /^[A-Za-z][\x20-\x7EÀ-ÖØ-öø-ÿ]*$/
|
|
128
|
+
* A name with an emoji or non-Latin script ("Babken 🇦🇲", "Բաբկեն") is rejected
|
|
129
|
+
* with API_VALIDATION_ERROR and the whole payment fails. Strip what Xendit
|
|
130
|
+
* can't take and keep the rest; the group is optional, so a name that reduces
|
|
131
|
+
* to nothing is dropped instead of blocking the buyer.
|
|
132
|
+
*/
|
|
133
|
+
const XENDIT_NAME_BODY = /[^\x20-\x7EÀ-ÖØ-öø-ÿ]/g
|
|
134
|
+
|
|
135
|
+
export const sanitizeXenditHolderName = (value: string): string => {
|
|
136
|
+
const stripped = (value ?? '').replace(XENDIT_NAME_BODY, '').trim()
|
|
137
|
+
// Must begin with a plain A–Z letter — trim any leading punctuation/digits.
|
|
138
|
+
const fromFirstLetter = stripped.replace(/^[^A-Za-z]+/, '')
|
|
139
|
+
return fromFirstLetter.trim()
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** The error shape xendit.js hands back, including per-field validation rows. */
|
|
143
|
+
interface XenditError {
|
|
144
|
+
message?: string
|
|
145
|
+
error_code?: string
|
|
146
|
+
errors?: Array<{
|
|
147
|
+
message?: string
|
|
148
|
+
path?: string[]
|
|
149
|
+
context?: { key?: string }
|
|
150
|
+
}>
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Field key → buyer-facing sentence, for API_VALIDATION_ERROR responses. */
|
|
154
|
+
const VALIDATION_FIELD_COPY: Record<string, string> = {
|
|
155
|
+
card_number: 'Card number is invalid',
|
|
156
|
+
card_exp_month: 'Card expiry date is invalid',
|
|
157
|
+
card_exp_year: 'Card expiry date is invalid',
|
|
158
|
+
card_cvn: 'Card security code is invalid',
|
|
159
|
+
card_holder_first_name: 'Please check the first name on the card.',
|
|
160
|
+
card_holder_last_name: 'Please check the last name on the card.',
|
|
161
|
+
card_holder_email: 'Please check the email address.',
|
|
162
|
+
card_holder_phone_number: 'Please check the phone number.',
|
|
163
|
+
amount: 'This order could not be charged. Please refresh and try again.',
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Turn a raw xendit.js error into something a buyer can act on. Xendit's own
|
|
168
|
+
* `message` for a rejected field is "There was an error with the format
|
|
169
|
+
* submitted to the server", which says nothing — the useful detail is in
|
|
170
|
+
* `errors[].context.key`.
|
|
171
|
+
*/
|
|
172
|
+
export const describeXenditError = (err: XenditError): string => {
|
|
173
|
+
const first = Array.isArray(err.errors) ? err.errors[0] : undefined
|
|
174
|
+
const key = first?.context?.key ?? first?.path?.[first.path.length - 1]
|
|
175
|
+
if (key && VALIDATION_FIELD_COPY[key]) return VALIDATION_FIELD_COPY[key]
|
|
176
|
+
if (err.error_code && XENDIT_FAILURE_REASONS[err.error_code]) {
|
|
177
|
+
return XENDIT_FAILURE_REASONS[err.error_code]
|
|
178
|
+
}
|
|
179
|
+
// Xendit's generic format message is noise — prefer our own wording.
|
|
180
|
+
if (!err.message || /format submitted to the server/i.test(err.message)) {
|
|
181
|
+
return XENDIT_FAILURE_REASONS.DEFAULT
|
|
182
|
+
}
|
|
183
|
+
return err.message
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Raw card field values, read at tokenize time (never held in JS state). */
|
|
187
|
+
export interface XenditCardFields {
|
|
188
|
+
number: string
|
|
189
|
+
/** "MM" */
|
|
190
|
+
expMonth: string
|
|
191
|
+
/** "YY" or "YYYY" — 2-digit is expanded to 20YY. */
|
|
192
|
+
expYear: string
|
|
193
|
+
cvn: string
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface WebXenditTokenizer {
|
|
197
|
+
/** `<XenditCardInput/>` registers a getter for its live field values (or
|
|
198
|
+
* null on unmount). */
|
|
199
|
+
registerFields(getFields: (() => XenditCardFields) | null): void
|
|
200
|
+
/** Tokenizes the registered card (running inline 3DS when the bank asks) and
|
|
201
|
+
* resolves with the token the engine charges. Rejects on validation error,
|
|
202
|
+
* decline, or a failed 3DS challenge. */
|
|
203
|
+
tokenize(params: {
|
|
204
|
+
publishableKey: string
|
|
205
|
+
amount: string | number
|
|
206
|
+
billing: { firstName: string; lastName: string; email: string; phone?: string }
|
|
207
|
+
onBehalfOf?: string | null
|
|
208
|
+
}): Promise<Record<string, unknown>>
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
let scriptPromise: Promise<XenditGlobal> | null = null
|
|
212
|
+
|
|
213
|
+
const loadXendit = (): Promise<XenditGlobal> => {
|
|
214
|
+
if (scriptPromise) return scriptPromise
|
|
215
|
+
scriptPromise = new Promise<XenditGlobal>((resolve, reject) => {
|
|
216
|
+
const w = window as unknown as { Xendit?: XenditGlobal }
|
|
217
|
+
if (w.Xendit) {
|
|
218
|
+
return resolve(w.Xendit)
|
|
219
|
+
}
|
|
220
|
+
const script = document.createElement('script')
|
|
221
|
+
script.src = XENDIT_JS
|
|
222
|
+
script.async = true
|
|
223
|
+
script.onload = () => {
|
|
224
|
+
if (w.Xendit) {
|
|
225
|
+
resolve(w.Xendit)
|
|
226
|
+
} else {
|
|
227
|
+
reject(new Error('The payment service could not be loaded.'))
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
script.onerror = () => {
|
|
231
|
+
reject(new Error('The payment service could not be loaded.'))
|
|
232
|
+
}
|
|
233
|
+
document.head.appendChild(script)
|
|
234
|
+
})
|
|
235
|
+
return scriptPromise
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** Warm xendit.js so field validation uses Xendit's own rules immediately. */
|
|
239
|
+
export const preloadXendit = (): void => {
|
|
240
|
+
void loadXendit().catch(() => {
|
|
241
|
+
// Pre-warming is best-effort; tokenize() surfaces a real load failure.
|
|
242
|
+
})
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export const createWebXenditTokenizer = (): WebXenditTokenizer => {
|
|
246
|
+
let getFields: (() => XenditCardFields) | null = null
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Full-screen overlay hosting the 3DS challenge iframe. Returns a disposer.
|
|
250
|
+
*
|
|
251
|
+
* The iframe is layered OVER a status strip rather than shown bare: an
|
|
252
|
+
* issuer page that is slow, blank (frictionless auth), or blocked would
|
|
253
|
+
* otherwise leave the buyer staring at a plain white rectangle with no way
|
|
254
|
+
* out — indistinguishable from a crash. `onCancel` gives them that way out.
|
|
255
|
+
*/
|
|
256
|
+
const showThreeDs = (url: string, onCancel: () => void): (() => void) => {
|
|
257
|
+
const overlay = document.createElement('div')
|
|
258
|
+
overlay.setAttribute(
|
|
259
|
+
'style',
|
|
260
|
+
'position:fixed;inset:0;z-index:2147483647;background:#fff;display:flex;flex-direction:column'
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
const bar = document.createElement('div')
|
|
264
|
+
bar.setAttribute(
|
|
265
|
+
'style',
|
|
266
|
+
'display:flex;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid #e7e7f0;font:14px system-ui,sans-serif;color:#16162e;flex:none'
|
|
267
|
+
)
|
|
268
|
+
const status = document.createElement('span')
|
|
269
|
+
status.textContent = 'Verifying with your bank…'
|
|
270
|
+
const cancel = document.createElement('button')
|
|
271
|
+
cancel.type = 'button'
|
|
272
|
+
cancel.textContent = 'Cancel'
|
|
273
|
+
cancel.setAttribute(
|
|
274
|
+
'style',
|
|
275
|
+
'margin-left:auto;padding:6px 14px;border:1px solid #e7e7f0;border-radius:8px;background:#fff;font:inherit;cursor:pointer'
|
|
276
|
+
)
|
|
277
|
+
cancel.onclick = () => {
|
|
278
|
+
onCancel()
|
|
279
|
+
}
|
|
280
|
+
bar.append(status, cancel)
|
|
281
|
+
|
|
282
|
+
const frame = document.createElement('iframe')
|
|
283
|
+
frame.setAttribute('style', 'width:100%;flex:1;border:0')
|
|
284
|
+
// Assigning src is what starts the challenge — it must run unconditionally.
|
|
285
|
+
frame.src = url
|
|
286
|
+
|
|
287
|
+
overlay.append(bar, frame)
|
|
288
|
+
document.body.appendChild(overlay)
|
|
289
|
+
return () => overlay.remove()
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return {
|
|
293
|
+
registerFields: (fn) => {
|
|
294
|
+
getFields = fn
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
tokenize: async ({ publishableKey, amount, billing, onBehalfOf }) => {
|
|
298
|
+
if (!getFields) {
|
|
299
|
+
throw new Error('Render <XenditCardInput/> before paying with a Xendit card.')
|
|
300
|
+
}
|
|
301
|
+
const f = getFields()
|
|
302
|
+
const number = f.number.replace(/\s+/g, '')
|
|
303
|
+
const expMonth = f.expMonth.trim()
|
|
304
|
+
let expYear = f.expYear.trim()
|
|
305
|
+
if (expYear.length === 2) expYear = '20' + expYear
|
|
306
|
+
const cvn = f.cvn.trim()
|
|
307
|
+
if (!number || !expMonth || !expYear || !cvn) {
|
|
308
|
+
throw new Error('Please fill in your card details.')
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const Xendit = await loadXendit()
|
|
312
|
+
Xendit.setPublishableKey(publishableKey)
|
|
313
|
+
|
|
314
|
+
// Check the fields with Xendit's own validators before spending a network
|
|
315
|
+
// round trip, so the buyer is told WHICH field is wrong rather than
|
|
316
|
+
// getting a generic decline back from the API.
|
|
317
|
+
if (!xenditCardChecks.number(number)) {
|
|
318
|
+
throw new Error('Card number is invalid')
|
|
319
|
+
}
|
|
320
|
+
if (!xenditCardChecks.expiry(expMonth, expYear)) {
|
|
321
|
+
throw new Error('Card expiry date is invalid')
|
|
322
|
+
}
|
|
323
|
+
if (!xenditCardChecks.cvn(cvn)) {
|
|
324
|
+
throw new Error('Card security code is invalid')
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
return new Promise<Record<string, unknown>>((resolve, reject) => {
|
|
328
|
+
let dismissThreeDs: (() => void) | null = null
|
|
329
|
+
let settled = false
|
|
330
|
+
let answered = false
|
|
331
|
+
const finish = (fn: () => void) => {
|
|
332
|
+
if (settled) return
|
|
333
|
+
settled = true
|
|
334
|
+
clearTimeout(watchdog)
|
|
335
|
+
dismissThreeDs?.()
|
|
336
|
+
fn()
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// xendit.js can complete its `payer/init` + `fingerprint/scans` warmup
|
|
340
|
+
// and then never POST /v2/credit_card_tokens — no callback, no error.
|
|
341
|
+
// Fail loudly instead of hanging on a blank overlay forever.
|
|
342
|
+
const watchdog = setTimeout(() => {
|
|
343
|
+
if (answered) return
|
|
344
|
+
finish(() =>
|
|
345
|
+
reject(
|
|
346
|
+
new Error(
|
|
347
|
+
'The payment service did not respond. Please try again — if it keeps happening, try a different card or browser.'
|
|
348
|
+
)
|
|
349
|
+
)
|
|
350
|
+
)
|
|
351
|
+
}, FIRST_RESPONSE_TIMEOUT_MS)
|
|
352
|
+
|
|
353
|
+
// The Xendit SDK re-invokes this handler after the 3DS challenge, so
|
|
354
|
+
// IN_REVIEW then VERIFIED/FAILED all flow through here.
|
|
355
|
+
const handler = (err: XenditError | null, token: XenditToken) => {
|
|
356
|
+
answered = true
|
|
357
|
+
if (err) {
|
|
358
|
+
finish(() => reject(new Error(describeXenditError(err))))
|
|
359
|
+
return
|
|
360
|
+
}
|
|
361
|
+
// A callback with neither an error nor a token would throw on
|
|
362
|
+
// `token.status` INSIDE xendit.js, where the try/catch below can't
|
|
363
|
+
// reach it — leaving the promise permanently unsettled.
|
|
364
|
+
if (!token || typeof token !== 'object') {
|
|
365
|
+
finish(() =>
|
|
366
|
+
reject(new Error('The payment service returned an unexpected response.'))
|
|
367
|
+
)
|
|
368
|
+
return
|
|
369
|
+
}
|
|
370
|
+
if (token.status === 'VERIFIED') {
|
|
371
|
+
finish(() => resolve(token as Record<string, unknown>))
|
|
372
|
+
return
|
|
373
|
+
}
|
|
374
|
+
if (token.status === 'IN_REVIEW' && token.payer_authentication_url) {
|
|
375
|
+
// The buyer now drives the bank's challenge — no fixed deadline.
|
|
376
|
+
clearTimeout(watchdog)
|
|
377
|
+
dismissThreeDs?.()
|
|
378
|
+
dismissThreeDs = showThreeDs(token.payer_authentication_url, () =>
|
|
379
|
+
finish(() => reject(new Error('Payment was cancelled')))
|
|
380
|
+
)
|
|
381
|
+
return
|
|
382
|
+
}
|
|
383
|
+
// Translate Xendit's failure_reason the way the hosted checkout does
|
|
384
|
+
// — a bare code like INVALID_CVV tells the buyer nothing.
|
|
385
|
+
const code =
|
|
386
|
+
typeof token.failure_reason === 'string' ? token.failure_reason : ''
|
|
387
|
+
finish(() =>
|
|
388
|
+
reject(
|
|
389
|
+
new Error(XENDIT_FAILURE_REASONS[code] ?? XENDIT_FAILURE_REASONS.DEFAULT)
|
|
390
|
+
)
|
|
391
|
+
)
|
|
392
|
+
}
|
|
393
|
+
try {
|
|
394
|
+
// card_holder_* fields are ALL-OR-NOTHING peers in Xendit's
|
|
395
|
+
// validation ("card_holder_first_name missing required peer
|
|
396
|
+
// card_holder_phone_number" — observed live): send the group only
|
|
397
|
+
// when every field is present, else omit it entirely (it's optional
|
|
398
|
+
// as a whole).
|
|
399
|
+
// …and the names must additionally satisfy Xendit's Latin-only
|
|
400
|
+
// pattern, so strip anything it rejects (emoji, non-Latin scripts).
|
|
401
|
+
const holderFirst = sanitizeXenditHolderName(billing.firstName)
|
|
402
|
+
const holderLast = sanitizeXenditHolderName(billing.lastName)
|
|
403
|
+
const holder =
|
|
404
|
+
holderFirst && holderLast && billing.email && billing.phone
|
|
405
|
+
? {
|
|
406
|
+
card_holder_first_name: holderFirst,
|
|
407
|
+
card_holder_last_name: holderLast,
|
|
408
|
+
card_holder_email: billing.email,
|
|
409
|
+
card_holder_phone_number: billing.phone,
|
|
410
|
+
}
|
|
411
|
+
: {}
|
|
412
|
+
Xendit.card.createToken(
|
|
413
|
+
{
|
|
414
|
+
amount: String(amount),
|
|
415
|
+
card_number: number,
|
|
416
|
+
card_exp_month: expMonth,
|
|
417
|
+
card_exp_year: expYear,
|
|
418
|
+
card_cvn: cvn,
|
|
419
|
+
is_multiple_use: false,
|
|
420
|
+
should_authenticate: true,
|
|
421
|
+
...holder,
|
|
422
|
+
...(onBehalfOf ? { on_behalf_of: onBehalfOf } : {}),
|
|
423
|
+
},
|
|
424
|
+
handler
|
|
425
|
+
)
|
|
426
|
+
} catch (e) {
|
|
427
|
+
finish(() =>
|
|
428
|
+
reject(
|
|
429
|
+
e instanceof Error
|
|
430
|
+
? e
|
|
431
|
+
: new Error('Something went wrong. Please try again.')
|
|
432
|
+
)
|
|
433
|
+
)
|
|
434
|
+
}
|
|
435
|
+
})
|
|
436
|
+
},
|
|
437
|
+
}
|
|
438
|
+
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IGroupItem } from '../types';
|
|
2
|
-
export declare const optionsAdapter: (options: any) => {
|
|
3
|
-
id: any;
|
|
4
|
-
label: any;
|
|
5
|
-
value: any;
|
|
6
|
-
}[];
|
|
7
|
-
export declare const fieldDataAdapter: (field: IGroupItem) => IGroupItem;
|
|
8
|
-
export declare const customFieldsDataAdapter: (data: any) => {
|
|
9
|
-
ticketsFields: IGroupItem[];
|
|
10
|
-
orderFields: IGroupItem[];
|
|
11
|
-
addOnFields: IGroupItem[];
|
|
12
|
-
};
|
package/dist/adapters/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { customFieldsDataAdapter } from './customFields';
|
package/dist/api/auth.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export declare const authorize: (data: IAuthorizeRequestData) => Promise<IProfileResponse>;
|
|
2
|
-
export declare const signUp: (data: ISignupRequestData) => Promise<IProfileResponse>;
|
|
3
|
-
export declare const register: (data: FormData) => Promise<IProfileResponse>;
|
|
4
|
-
export declare const getProfileData: () => Promise<IProfileResponse>;
|
|
5
|
-
export declare const logout: () => Promise<IAxiosResponseData>;
|
|
6
|
-
/**
|
|
7
|
-
* Checks whether a given email address already exists via the `/ajax/contact-email` endpoint.
|
|
8
|
-
*
|
|
9
|
-
* The underlying API is expected to return a JSON object containing:
|
|
10
|
-
* - `exists`: `1` if the email exists, `0` otherwise
|
|
11
|
-
* - `error`: `1` if an error occurred, `0` otherwise
|
|
12
|
-
* - `message`: an optional error message when `error === 1`
|
|
13
|
-
*
|
|
14
|
-
* This function normalizes that response to an object with:
|
|
15
|
-
* - `exists`: a boolean indicating whether the email exists
|
|
16
|
-
* - `error`: an optional string containing an error message, if any
|
|
17
|
-
*
|
|
18
|
-
* On network or unexpected errors, it returns `{ exists: false, error: 'Failed to check email' }`.
|
|
19
|
-
*
|
|
20
|
-
* @param {string} email - The email address to check for existence.
|
|
21
|
-
* @returns {Promise<{ exists: boolean; error?: string }>} A promise that resolves to the normalized
|
|
22
|
-
* result of the email existence check.
|
|
23
|
-
*/
|
|
24
|
-
export declare const checkEmailExists: (email: string) => Promise<{
|
|
25
|
-
exists: boolean;
|
|
26
|
-
error?: string;
|
|
27
|
-
}>;
|
package/dist/api/cart.d.ts
DELETED
package/dist/api/checkout.d.ts
DELETED
package/dist/api/common.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const getEvent: (id: string | number, pk?: string | undefined) => Promise<IEventResponse>;
|
|
2
|
-
export declare const getTickets: (eventId: string | number, promoCode: string, pk?: string | undefined) => Promise<ITicketsAdaptedResponse>;
|
|
3
|
-
export declare const getTimeSlotsByDate: (eventId: string | number, date: string, promoCode?: string | undefined, pk?: string | undefined) => Promise<ITimeslotsAdaptedResponse>;
|
|
4
|
-
export declare const getCountries: () => Promise<ICountriesResponse>;
|
|
5
|
-
export declare const getStates: (countryId: string | number) => Promise<IStatesResponse>;
|
|
6
|
-
export declare const sendRSVPInfo: (eventId: number, data: {
|
|
7
|
-
data: IRSVPRequestData;
|
|
8
|
-
}) => Promise<IRSVPResponse>;
|
|
9
|
-
export declare const addToWaitingList: (id: number, data: IWaitingListRequestData) => Promise<IWaitingListResponse>;
|
|
10
|
-
export declare const postReferralVisits: (eventId: string, referralId: string) => Promise<IAxiosResponseData>;
|
|
11
|
-
export declare const validatePhoneNumber: (phone: string) => Promise<IAxiosResponseData>;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export declare const getCustomerExistsData: (accessHash: string) => Promise<ICheckCustomerExistsData>;
|
|
2
|
-
interface IDelegationTicketType {
|
|
3
|
-
delegationMaxQuantity: number | string;
|
|
4
|
-
}
|
|
5
|
-
interface IIssueTicketResponseData {
|
|
6
|
-
delegationName: string;
|
|
7
|
-
eventImage: string;
|
|
8
|
-
eventName: string;
|
|
9
|
-
ticketTypes: {
|
|
10
|
-
[key: number]: IDelegationTicketType;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
interface IIssueTicketResponse {
|
|
14
|
-
data: {
|
|
15
|
-
attributes: IIssueTicketResponseData;
|
|
16
|
-
relationships: Array<any>;
|
|
17
|
-
type: string;
|
|
18
|
-
message: string;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export interface IDelegationsTicketType {
|
|
22
|
-
[key: number]: {
|
|
23
|
-
delegationMaxQuantity: string | number;
|
|
24
|
-
delegationQuantityIssued: string | number;
|
|
25
|
-
matrixRecordId: string | number;
|
|
26
|
-
optionValue: string | number;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export interface IDelegationsData {
|
|
30
|
-
delegationName: string;
|
|
31
|
-
eventImage: string;
|
|
32
|
-
eventName: string;
|
|
33
|
-
ticketTypes: IDelegationsTicketType;
|
|
34
|
-
tickets: Array<any>;
|
|
35
|
-
}
|
|
36
|
-
interface IDelegationsResponse {
|
|
37
|
-
data: {
|
|
38
|
-
data: {
|
|
39
|
-
attributes: IDelegationsData;
|
|
40
|
-
relationships: Array<any>;
|
|
41
|
-
type: string;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export declare const getDelegationTickets: (accessHash: string) => Promise<IDelegationsResponse>;
|
|
46
|
-
export declare const issueTicket: (accessHash: string, data: ITicketIssueData) => Promise<IIssueTicketResponse>;
|
|
47
|
-
export {};
|
package/dist/api/index.d.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import './interceptors';
|
|
2
|
-
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
3
|
-
import { GetNetverifyUrlResponseData, UpdateVerificationStatusResponseData, VerificationStatusResponseData } from '../types/verification';
|
|
4
|
-
export { authorize, getProfileData, signUp, register, logout, checkEmailExists } from './auth';
|
|
5
|
-
export { setAxiosHeader, setBaseUrl } from './publicRequest';
|
|
6
|
-
export { getOrders, getOrderDetails } from './orders';
|
|
7
|
-
export { addToCart, getCart } from './cart';
|
|
8
|
-
export { postOnCheckout } from './checkout';
|
|
9
|
-
export { getEvent, getTickets, getCountries, getStates, addToWaitingList, sendRSVPInfo, postReferralVisits, validatePhoneNumber, } from './common';
|
|
10
|
-
export { getPaymentData, getConditions, handlePaymentSuccess, handleFreeSuccess, getConfirmationData, } from './payment';
|
|
11
|
-
export { resaleTicket, removeFromResale, processTicket, declineInvitation, } from './resale';
|
|
12
|
-
export { issueTicket, getDelegationTickets } from './guestTicketDelegation';
|
|
13
|
-
export declare const setCustomHeader: (response: any) => void;
|
|
14
|
-
export declare const handlePaymentData: (orderHash: string, data: any) => Promise<AxiosResponse<any, any>>;
|
|
15
|
-
export declare const createPaymentPlan: (orderHash: string, stripePaymentMethodId: string) => Promise<AxiosResponse<any, any>>;
|
|
16
|
-
export declare const forgotPassword: (email: string) => Promise<AxiosResponse<any, any>>;
|
|
17
|
-
interface IResetPasswordData {
|
|
18
|
-
token: string;
|
|
19
|
-
password: string;
|
|
20
|
-
confirmPassword: string;
|
|
21
|
-
}
|
|
22
|
-
export declare const resetPassword: (data: IResetPasswordData) => Promise<AxiosResponse<any, any>>;
|
|
23
|
-
export declare const getAddons: (eventId: string) => Promise<any>;
|
|
24
|
-
export declare const selectAddons: (data: any) => void;
|
|
25
|
-
export interface AttributesConfig {
|
|
26
|
-
has_add_on: boolean;
|
|
27
|
-
names_required: boolean;
|
|
28
|
-
phone_required: boolean;
|
|
29
|
-
minimum_age?: any;
|
|
30
|
-
age_required: boolean;
|
|
31
|
-
hide_phone_field: boolean;
|
|
32
|
-
event_id: string;
|
|
33
|
-
free_ticket: boolean;
|
|
34
|
-
collect_mandatory_wallet_address: boolean;
|
|
35
|
-
collect_optional_wallet_address: boolean;
|
|
36
|
-
collect_mandatory_company: boolean;
|
|
37
|
-
collect_optional_company: boolean;
|
|
38
|
-
collect_mandatory_job_title: boolean;
|
|
39
|
-
collect_optional_job_title: boolean;
|
|
40
|
-
collect_mandatory_business_category: boolean;
|
|
41
|
-
collect_optional_business_category: boolean;
|
|
42
|
-
collect_mandatory_instagram: boolean;
|
|
43
|
-
collect_optional_instagram: boolean;
|
|
44
|
-
skip_billing_page: boolean;
|
|
45
|
-
addon_max_quantity_groups: number | null;
|
|
46
|
-
cart: ICart[];
|
|
47
|
-
}
|
|
48
|
-
export interface ConfigsData {
|
|
49
|
-
attributes: AttributesConfig;
|
|
50
|
-
relationships: any[];
|
|
51
|
-
type: string;
|
|
52
|
-
}
|
|
53
|
-
export interface ResponseConfigs {
|
|
54
|
-
data: ConfigsData;
|
|
55
|
-
success: boolean;
|
|
56
|
-
error: boolean;
|
|
57
|
-
message: string;
|
|
58
|
-
status: number;
|
|
59
|
-
}
|
|
60
|
-
export declare const getCheckoutPageConfigs: () => Promise<ResponseConfigs>;
|
|
61
|
-
export declare const getCustomFields: (eventId: string) => Promise<{
|
|
62
|
-
ticketsFields: import("../types").IGroupItem[];
|
|
63
|
-
orderFields: import("../types").IGroupItem[];
|
|
64
|
-
addOnFields: import("../types").IGroupItem[];
|
|
65
|
-
}>;
|
|
66
|
-
export declare const updateOrderCustomFields: (eventId: string, orderId: string, customFieldsData: Record<string, any>) => Promise<AxiosResponse<any, any>>;
|
|
67
|
-
export declare const updateTicketHoldersCustomFields: (eventId: string, customFieldsData: Record<string, any>, ticketHash: string) => Promise<AxiosResponse<any, any>>;
|
|
68
|
-
export declare const confirmPreRegistration: (eventId: string | number, data: IConfirmPreRegistrationRequestData) => Promise<any>;
|
|
69
|
-
export declare const getSeatMapData: (eventId: string | number) => Promise<SeatMapDataResponse>;
|
|
70
|
-
export declare const getSeatMapStatuses: (eventId: string | number) => Promise<SeatMapStatusesResponse>;
|
|
71
|
-
export declare const reserveSeat: (eventId: string | number, tierId: string, seatId: string) => Promise<any>;
|
|
72
|
-
export declare const removeSeatReserve: (eventId: string | number, tierId: string, seatIds: string[]) => Promise<any>;
|
|
73
|
-
export declare function getPixelScript(id: string | number, pageOptions: any): Promise<AxiosResponse<any, any>>;
|
|
74
|
-
export declare const getNetverifyUrl: () => Promise<GetNetverifyUrlResponseData>;
|
|
75
|
-
export declare const checkVerificationStatus: () => Promise<{
|
|
76
|
-
data: VerificationStatusResponseData;
|
|
77
|
-
}>;
|
|
78
|
-
export declare const updateVerificationStatus: () => Promise<{
|
|
79
|
-
data: UpdateVerificationStatusResponseData;
|
|
80
|
-
}>;
|
|
81
|
-
export declare const checkCustomerOrder: (orderHash: string) => Promise<any>;
|
|
82
|
-
export declare const refreshSeatReservation: (eventId: string, orderId: string) => Promise<AxiosResponse<any, AxiosRequestConfig<any>>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/api/orders.d.ts
DELETED
package/dist/api/payment.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const getPaymentData: (hash: string) => Promise<IPaymentDataResponse>;
|
|
2
|
-
export declare const handlePaymentSuccess: (orderHash: string) => Promise<IPaymentSuccessDataResponse>;
|
|
3
|
-
export declare const handleFreeSuccess: (orderHash: string) => Promise<IFreeRegistrationDataResponse>;
|
|
4
|
-
export declare const getConfirmationData: (orderHash: string) => Promise<ICheckoutCompleteDataResponse>;
|
|
5
|
-
export declare const getConditions: (eventId: string) => Promise<IConditionsAdaptedDataResponse>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const getPreRegistrationInfluencers: (data: IInfluancersRequestData) => Promise<IInfluancersResponseData>;
|
|
2
|
-
export declare const getPreRegistrationShareOptions: (data: IShareOptionsRequestData) => Promise<IShareOptionsResponseData>;
|
|
3
|
-
export declare const submitShareAction: (data: ISubmitShareActionRequestData) => Promise<ISubmitShareActionResponseData>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
|
-
export declare const setAxiosHeader: (key: string, value: string | number) => void;
|
|
3
|
-
interface IPublicRequest extends AxiosInstance {
|
|
4
|
-
setBaseUrl: (baseUrl: string) => void;
|
|
5
|
-
setGuestToken: (guestToken: string) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare const publicRequest: IPublicRequest;
|
|
8
|
-
export declare const setBaseUrl: (baseUrl: string) => void;
|
|
9
|
-
export {};
|
package/dist/api/resale.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { AxiosResponse } from 'axios';
|
|
2
|
-
export declare const resaleTicket: (data: FormData, hash: string) => Promise<IResaleTicketResponse>;
|
|
3
|
-
export declare const removeFromResale: (hash: string) => Promise<IRemoveFromResaleResponse>;
|
|
4
|
-
export declare const processTicket: (hash: string) => Promise<AxiosResponse<any, any>>;
|
|
5
|
-
export declare const declineInvitation: (hash: string) => Promise<AxiosResponse<any, any>>;
|