tf-checkout-react-native 1.0.18 → 1.0.19
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/README.md +767 -8
- package/lib/api/ApiClient.d.ts +14 -36
- package/lib/api/ApiClient.js +85 -30
- package/lib/api/ApiClient.js.map +1 -1
- package/lib/api/Constants.js +3 -3
- package/lib/api/Constants.js.map +1 -1
- package/lib/api/types.d.ts +100 -21
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/index.js.map +1 -1
- package/lib/components/login/Login.d.ts +2 -1
- package/lib/components/login/Login.js +25 -63
- package/lib/components/login/Login.js.map +1 -1
- package/lib/components/login/LoginView.d.ts +2 -1
- package/lib/components/login/LoginView.js +4 -1
- package/lib/components/login/LoginView.js.map +1 -1
- package/lib/components/login/types.d.ts +9 -9
- package/lib/components/phoneInput/PhoneInput.d.ts +4 -0
- package/lib/components/phoneInput/PhoneInput.js +33 -0
- package/lib/components/phoneInput/PhoneInput.js.map +1 -0
- package/lib/components/phoneInput/styles.d.ts +28 -0
- package/lib/components/phoneInput/styles.js +30 -0
- package/lib/components/phoneInput/styles.js.map +1 -0
- package/lib/components/phoneInput/types.d.ts +30 -0
- package/lib/components/phoneInput/types.js +2 -0
- package/lib/components/phoneInput/types.js.map +1 -0
- package/lib/components/promoCode/PromoCode.d.ts +2 -1
- package/lib/components/promoCode/PromoCode.js.map +1 -1
- package/lib/components/promoCode/types.d.ts +1 -1
- package/lib/components/stripePayment/StripePayment.d.ts +4 -0
- package/lib/components/stripePayment/StripePayment.js +23 -0
- package/lib/components/stripePayment/StripePayment.js.map +1 -0
- package/lib/components/stripePayment/types.d.ts +12 -0
- package/lib/components/stripePayment/types.js +2 -0
- package/lib/components/stripePayment/types.js.map +1 -0
- package/lib/components/waitingList/WaitingList.d.ts +2 -1
- package/lib/components/waitingList/WaitingList.js +32 -29
- package/lib/components/waitingList/WaitingList.js.map +1 -1
- package/lib/components/waitingList/WaitingListView.d.ts +2 -1
- package/lib/components/waitingList/WaitingListView.js.map +1 -1
- package/lib/components/waitingList/types.d.ts +0 -1
- package/lib/containers/billingInfo/Billing.js +209 -123
- package/lib/containers/billingInfo/Billing.js.map +1 -1
- package/lib/containers/billingInfo/types.d.ts +10 -6
- package/lib/containers/checkout/Checkout.d.ts +2 -1
- package/lib/containers/checkout/Checkout.js +58 -65
- package/lib/containers/checkout/Checkout.js.map +1 -1
- package/lib/containers/checkout/types.d.ts +1 -1
- package/lib/containers/myOrderDetails/MyOrderDetailsView.js +4 -3
- package/lib/containers/myOrderDetails/MyOrderDetailsView.js.map +1 -1
- package/lib/containers/myOrderDetails/types.d.ts +10 -2
- package/lib/containers/myOrders/MyOrders.js +26 -4
- package/lib/containers/myOrders/MyOrders.js.map +1 -1
- package/lib/containers/myOrders/MyOrdersView.d.ts +2 -1
- package/lib/containers/myOrders/MyOrdersView.js.map +1 -1
- package/lib/containers/myOrders/types.d.ts +2 -2
- package/lib/containers/purchaseConfirmation/PurchaseConfirmation.d.ts +2 -1
- package/lib/containers/purchaseConfirmation/PurchaseConfirmation.js +23 -8
- package/lib/containers/purchaseConfirmation/PurchaseConfirmation.js.map +1 -1
- package/lib/containers/purchaseConfirmation/PurchaseConfirmationView.d.ts +2 -1
- package/lib/containers/purchaseConfirmation/PurchaseConfirmationView.js.map +1 -1
- package/lib/containers/tickets/Tickets.d.ts +2 -1
- package/lib/containers/tickets/Tickets.js +73 -84
- package/lib/containers/tickets/Tickets.js.map +1 -1
- package/lib/containers/tickets/TicketsView.d.ts +1 -1
- package/lib/containers/tickets/TicketsView.js +2 -2
- package/lib/containers/tickets/TicketsView.js.map +1 -1
- package/lib/containers/tickets/types.d.ts +3 -14
- package/lib/core/BillingCore/BillingCore.d.ts +5 -0
- package/lib/core/BillingCore/BillingCore.js +28 -0
- package/lib/core/BillingCore/BillingCore.js.map +1 -0
- package/lib/core/BillingCore/BillingCoreTypes.d.ts +16 -0
- package/lib/core/BillingCore/BillingCoreTypes.js +2 -0
- package/lib/core/BillingCore/BillingCoreTypes.js.map +1 -0
- package/lib/core/CheckoutCore/CheckoutCore.d.ts +5 -0
- package/lib/core/CheckoutCore/CheckoutCore.js +25 -0
- package/lib/core/CheckoutCore/CheckoutCore.js.map +1 -0
- package/lib/core/CheckoutCore/CheckoutCoreTypes.d.ts +8 -0
- package/lib/core/CheckoutCore/CheckoutCoreTypes.js +2 -0
- package/lib/core/CheckoutCore/CheckoutCoreTypes.js.map +1 -0
- package/lib/core/CoreProps.d.ts +4 -0
- package/lib/core/CoreProps.js +2 -0
- package/lib/core/CoreProps.js.map +1 -0
- package/lib/core/LoginCore/LoginCore.d.ts +5 -0
- package/lib/core/LoginCore/LoginCore.js +100 -0
- package/lib/core/LoginCore/LoginCore.js.map +1 -0
- package/lib/core/LoginCore/LoginCoreTypes.d.ts +10 -0
- package/lib/core/LoginCore/LoginCoreTypes.js +2 -0
- package/lib/core/LoginCore/LoginCoreTypes.js.map +1 -0
- package/lib/core/MyOrdersCore/MyOrdersCore.d.ts +3 -0
- package/lib/core/MyOrdersCore/MyOrdersCore.js +16 -0
- package/lib/core/MyOrdersCore/MyOrdersCore.js.map +1 -0
- package/lib/core/MyOrdersCore/MyOrdersCoreTypes.d.ts +5 -0
- package/lib/core/MyOrdersCore/MyOrdersCoreTypes.js +2 -0
- package/lib/core/MyOrdersCore/MyOrdersCoreTypes.js.map +1 -0
- package/lib/core/PurchaseConfirmationCore/PurchaseConfirmationCore.d.ts +5 -0
- package/lib/core/PurchaseConfirmationCore/PurchaseConfirmationCore.js +12 -0
- package/lib/core/PurchaseConfirmationCore/PurchaseConfirmationCore.js.map +1 -0
- package/lib/core/PurchaseConfirmationCore/PurchaseConfirmationCoreTypes.d.ts +4 -0
- package/lib/core/PurchaseConfirmationCore/PurchaseConfirmationCoreTypes.js +2 -0
- package/lib/core/PurchaseConfirmationCore/PurchaseConfirmationCoreTypes.js.map +1 -0
- package/lib/core/TicketsCore/TicketsCore.d.ts +5 -0
- package/lib/core/TicketsCore/TicketsCore.js +59 -0
- package/lib/core/TicketsCore/TicketsCore.js.map +1 -0
- package/lib/core/TicketsCore/TicketsCoreTypes.d.ts +15 -0
- package/lib/core/TicketsCore/TicketsCoreTypes.js +2 -0
- package/lib/core/TicketsCore/TicketsCoreTypes.js.map +1 -0
- package/lib/core/WaitingListCore/WaitingListCore.d.ts +5 -0
- package/lib/core/WaitingListCore/WaitingListCore.js +17 -0
- package/lib/core/WaitingListCore/WaitingListCore.js.map +1 -0
- package/lib/core/WaitingListCore/WaitingListCoreTypes.d.ts +9 -0
- package/lib/core/WaitingListCore/WaitingListCoreTypes.js +2 -0
- package/lib/core/WaitingListCore/WaitingListCoreTypes.js.map +1 -0
- package/lib/core/index.d.ts +14 -0
- package/lib/core/index.js +8 -0
- package/lib/core/index.js.map +1 -0
- package/lib/helpers/Config.d.ts +1 -0
- package/lib/helpers/Config.js.map +1 -1
- package/lib/helpers/CountryCodes.d.ts +15 -0
- package/lib/helpers/CountryCodes.js +3382 -0
- package/lib/helpers/CountryCodes.js.map +1 -0
- package/lib/helpers/LocalStorage.d.ts +1 -0
- package/lib/helpers/LocalStorage.js +4 -1
- package/lib/helpers/LocalStorage.js.map +1 -1
- package/lib/helpers/Validators.d.ts +6 -0
- package/lib/helpers/Validators.js +10 -0
- package/lib/helpers/Validators.js.map +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/types/IEvent.d.ts +6 -0
- package/lib/types/ITicket.d.ts +10 -1
- package/lib/types/IUserProfile.d.ts +15 -11
- package/package.json +14 -7
- package/src/index.tsx +78 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WaitingList.js","sourceRoot":"","sources":["../../../src/components/waitingList/WaitingList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"WaitingList.js","sourceRoot":"","sources":["../../../src/components/waitingList/WaitingList.ts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CAAA;IAED,MAAM,uBAAuB,GAAG,WAAW,CACzC,CAAC,OAAgB,EAAE,EAAE;QACnB,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAG,OAAO,CAAC,CAAA;IAC5B,CAAC,EACD,CAAC,eAAe,CAAC,CAClB,CAAA;IAED,SAAS,CAAC,GAAG,EAAE;QACb,uBAAuB,CAAC,SAAS,CAAC,CAAA;IACpC,CAAC,EAAE,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC,CAAA;IAExC,OAAO,CACL,oBAAC,eAAe,IAAC,GAAG,EAAE,kBAAkB;QACtC,oBAAC,eAAe,IACd,IAAI,EAAE;gBACJ,SAAS,EAAE,SAAS;gBACpB,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE,KAAK;gBACZ,cAAc,EAAE,cAAc;gBAC9B,aAAa,EAAE,aAAa;gBAC5B,UAAU,EAAE,UAAU;gBACtB,aAAa,EAAE,cAAc;gBAC7B,iBAAiB,EAAE,kBAAkB;gBACrC,gBAAgB,EAAE,iBAAiB;aACpC,EACD,aAAa,EAAE,mBAAmB,EAClC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,GACpB,CACc,CACnB,CAAA;AACH,CAAC,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
1
2
|
import { IWaitingListViewProps } from './types';
|
|
2
|
-
declare const WaitingListView:
|
|
3
|
+
declare const WaitingListView: FC<IWaitingListViewProps>;
|
|
3
4
|
export default WaitingListView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WaitingListView.js","sourceRoot":"","sources":["../../../src/components/waitingList/WaitingListView.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"WaitingListView.js","sourceRoot":"","sources":["../../../src/components/waitingList/WaitingListView.tsx"],"names":[],"mappings":"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EAC3B,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,GACrB;QACF,oBAAC,MAAM,IACL,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,KAAI,qBAAqB,EAC5C,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,CAAC,WAAW,EACxB,SAAS,EAAE,SAAS,GACpB,CACD,CACJ,CACI,CACR,CAAA;AACH,CAAC,CAAA;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -4,18 +4,20 @@ import _forEach from 'lodash/forEach';
|
|
|
4
4
|
import _map from 'lodash/map';
|
|
5
5
|
import React, { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
6
6
|
import { ActivityIndicator, Alert, Image, Linking, Text, View, } from 'react-native';
|
|
7
|
+
import DeviceCountry, { TYPE_ANY } from 'react-native-device-country';
|
|
7
8
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
8
|
-
import { checkoutOrder, fetchCart, fetchCountries, fetchStates, fetchUserProfile, registerNewUser, } from '../../api/ApiClient';
|
|
9
9
|
import Constants from '../../api/Constants';
|
|
10
|
-
import { Button, Checkbox, DatePicker, DropdownMaterial, Input, Loading, Login, } from '../../components';
|
|
10
|
+
import { Button, Checkbox, DatePicker, DropdownMaterial, Input, Loading, Login, PhoneInput, } from '../../components';
|
|
11
|
+
import { BillingCore } from '../../core';
|
|
11
12
|
import { Config } from '../../helpers/Config';
|
|
13
|
+
import { getCountryDialCode } from '../../helpers/CountryCodes';
|
|
12
14
|
import { useDebounced } from '../../helpers/Debounced';
|
|
13
15
|
import { getData, LocalStorageKeys } from '../../helpers/LocalStorage';
|
|
14
|
-
import { validateAge, validateEmail, validateEmpty, validatePasswords, } from '../../helpers/Validators';
|
|
16
|
+
import { validateAge, validateEmail, validateEmpty, validatePasswords, validatePhoneNumber, } from '../../helpers/Validators';
|
|
15
17
|
import R from '../../res';
|
|
16
18
|
import s from './styles';
|
|
17
|
-
const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, isPhoneRequired, minimumAge, isBillingRequired, }, loginBrandImages, skipBillingConfig, areAlertsEnabled = true, areLoadingIndicatorsEnabled = true, onLoadingChange, onLoginError, onLoginSuccess, onRegisterError, onRegisterSuccess, onCheckoutSuccess, onCheckoutError, onFetchUserProfileSuccess, onFetchUserProfileError, onFetchCartError, onFetchCartSuccess, onFetchCountriesError, onFetchCountriesSuccess, onFetchStatesError, onFetchStatesSuccess,
|
|
18
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
19
|
+
const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, isPhoneRequired, minimumAge, isBillingRequired, }, loginBrandImages, skipBillingConfig, areAlertsEnabled = true, areLoadingIndicatorsEnabled = true, onLoadingChange, onLoginError, onLoginSuccess, onRegisterError, onRegisterSuccess, onCheckoutSuccess, onCheckoutError, onFetchUserProfileSuccess, onFetchUserProfileError, onFetchCartError, onFetchCartSuccess, onFetchCountriesError, onFetchCountriesSuccess, onFetchStatesError, onFetchStatesSuccess, onSkippingStatusChange, onLogoutSuccess, onLogoutError, }) => {
|
|
20
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
19
21
|
//#region Labels
|
|
20
22
|
const holderLabels = useMemo(() => {
|
|
21
23
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -92,7 +94,7 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
92
94
|
const confirmEmailError = useDebounced(emailConfirmation, () => validateEmail(emailConfirmation, email));
|
|
93
95
|
const passwordError = useDebounced(password, () => validatePasswords(password, passwordConfirmation));
|
|
94
96
|
const confirmPasswordError = useDebounced(passwordConfirmation, () => validatePasswords(passwordConfirmation, password));
|
|
95
|
-
const phoneError =
|
|
97
|
+
const [phoneError, setPhoneError] = useState('');
|
|
96
98
|
const streetError = useDebounced(street, validateEmpty);
|
|
97
99
|
const cityError = useDebounced(city, validateEmpty);
|
|
98
100
|
const postalCodeError = useDebounced(postalCode, validateEmpty);
|
|
@@ -113,8 +115,24 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
113
115
|
//#region Refs
|
|
114
116
|
const storedToken = useRef('');
|
|
115
117
|
const storedProfileData = useRef({});
|
|
118
|
+
const phoneErrorCounter = useRef(0);
|
|
119
|
+
const billingCoreRef = useRef(null);
|
|
116
120
|
//#endregion
|
|
117
121
|
//#region Handlers
|
|
122
|
+
const handleSetPhoneError = useCallback((error) => {
|
|
123
|
+
if (isPhoneRequired && phone.length > 0) {
|
|
124
|
+
setPhoneError(error);
|
|
125
|
+
}
|
|
126
|
+
}, [isPhoneRequired, phone.length]);
|
|
127
|
+
const handleOnChangePhoneNumber = (payload) => {
|
|
128
|
+
var _a, _b;
|
|
129
|
+
setPhone(payload.input);
|
|
130
|
+
if (!payload.isValid && phoneErrorCounter.current > 0) {
|
|
131
|
+
return handleSetPhoneError(((_b = (_a = texts === null || texts === void 0 ? void 0 : texts.form) === null || _a === void 0 ? void 0 : _a.phoneInput) === null || _b === void 0 ? void 0 : _b.customError) || 'Invalid phone number');
|
|
132
|
+
}
|
|
133
|
+
phoneErrorCounter.current = phoneErrorCounter.current + 1;
|
|
134
|
+
setPhoneError('');
|
|
135
|
+
};
|
|
118
136
|
const handleOnLoadingChange = useCallback((loading) => {
|
|
119
137
|
if (onLoadingChange) {
|
|
120
138
|
onLoadingChange(loading);
|
|
@@ -168,21 +186,40 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
168
186
|
storedToken.current = accessToken;
|
|
169
187
|
}
|
|
170
188
|
};
|
|
171
|
-
const handleOnLoginSuccess = async (userProfile
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
189
|
+
const handleOnLoginSuccess = async (userProfile) => {
|
|
190
|
+
var _a, _b;
|
|
191
|
+
let phoneCountry = 'US';
|
|
192
|
+
const accessToken = await getData(LocalStorageKeys.ACCESS_TOKEN);
|
|
193
|
+
const usrProfile = { ...userProfile };
|
|
194
|
+
onLoginSuccess === null || onLoginSuccess === void 0 ? void 0 : onLoginSuccess(usrProfile);
|
|
195
|
+
try {
|
|
196
|
+
const deviceCountry = await DeviceCountry.getCountryCode(TYPE_ANY);
|
|
197
|
+
phoneCountry = deviceCountry.code.toUpperCase();
|
|
198
|
+
}
|
|
199
|
+
catch (err) {
|
|
200
|
+
phoneCountry = 'US';
|
|
201
|
+
}
|
|
202
|
+
if (!usrProfile.phone.includes('+')) {
|
|
203
|
+
usrProfile.phone = `${getCountryDialCode(phoneCountry)}${usrProfile.phone}`;
|
|
204
|
+
}
|
|
176
205
|
if (!isBillingRequired && skipping === 'fail') {
|
|
177
206
|
setSkippingStatus('skipping');
|
|
207
|
+
const phoneValidError = validatePhoneNumber({
|
|
208
|
+
phoneNumber: userProfile.phone,
|
|
209
|
+
customError: (_b = (_a = texts === null || texts === void 0 ? void 0 : texts.form) === null || _a === void 0 ? void 0 : _a.phoneInput) === null || _b === void 0 ? void 0 : _b.customError,
|
|
210
|
+
});
|
|
211
|
+
if (phoneValidError) {
|
|
212
|
+
showAlert((texts === null || texts === void 0 ? void 0 : texts.invalidPhoneNumberError) || 'Please enter a valid phone number');
|
|
213
|
+
return handleSetPhoneError((texts === null || texts === void 0 ? void 0 : texts.invalidPhoneNumberError) || 'Please enter a valid phone number');
|
|
214
|
+
}
|
|
178
215
|
await performCheckout(getCheckoutBodyWhenSkipping({
|
|
179
|
-
userProfile:
|
|
216
|
+
userProfile: usrProfile,
|
|
180
217
|
ticketsQuantity: numberOfTicketHolders || 1,
|
|
181
|
-
})
|
|
218
|
+
}));
|
|
182
219
|
}
|
|
183
|
-
handleSetFormDataFromUserProfile(
|
|
220
|
+
handleSetFormDataFromUserProfile(usrProfile, accessToken);
|
|
184
221
|
};
|
|
185
|
-
const
|
|
222
|
+
const handleOnLoginError = (error) => {
|
|
186
223
|
onLoginError === null || onLoginError === void 0 ? void 0 : onLoginError(error);
|
|
187
224
|
};
|
|
188
225
|
const handleOnLogoutSuccess = () => {
|
|
@@ -221,6 +258,7 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
221
258
|
th.phone = '';
|
|
222
259
|
});
|
|
223
260
|
setTicketHoldersData(thData);
|
|
261
|
+
onLogoutSuccess === null || onLogoutSuccess === void 0 ? void 0 : onLogoutSuccess();
|
|
224
262
|
};
|
|
225
263
|
const handleOnSelectDate = (newDate) => {
|
|
226
264
|
const ageError = validateAge(newDate, minimumAge);
|
|
@@ -229,7 +267,15 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
229
267
|
};
|
|
230
268
|
//#endregion
|
|
231
269
|
//#region Form validation
|
|
270
|
+
const checkIsStoredPhoneNumberFormat = (storedPhoneNumber) => {
|
|
271
|
+
if (!storedPhoneNumber.includes('+')) {
|
|
272
|
+
handleSetPhoneError((texts === null || texts === void 0 ? void 0 : texts.invalidPhoneNumberError) || 'Please enter a valid phone number');
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
return true;
|
|
276
|
+
};
|
|
232
277
|
const checkBasicDataValid = () => {
|
|
278
|
+
var _a, _b;
|
|
233
279
|
if (!firstName ||
|
|
234
280
|
!lastName ||
|
|
235
281
|
!email ||
|
|
@@ -240,7 +286,11 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
240
286
|
(selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.value) === '-1') {
|
|
241
287
|
return false;
|
|
242
288
|
}
|
|
243
|
-
if (isPhoneRequired &&
|
|
289
|
+
if (isPhoneRequired &&
|
|
290
|
+
validatePhoneNumber({
|
|
291
|
+
phoneNumber: phone,
|
|
292
|
+
customError: (_b = (_a = texts === null || texts === void 0 ? void 0 : texts.form) === null || _a === void 0 ? void 0 : _a.phoneInput) === null || _b === void 0 ? void 0 : _b.customError,
|
|
293
|
+
})) {
|
|
244
294
|
return false;
|
|
245
295
|
}
|
|
246
296
|
if (Config.IS_BILLING_STREET_NAME_REQUIRED && !street) {
|
|
@@ -270,32 +320,25 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
270
320
|
const handleOnRegisterFail = (rawError) => {
|
|
271
321
|
onRegisterError === null || onRegisterError === void 0 ? void 0 : onRegisterError(rawError);
|
|
272
322
|
};
|
|
273
|
-
const performCheckout = async (checkoutBody
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
const { error: checkoutError, data: checkoutData } = await checkoutOrder(checkoutBody, pToken);
|
|
277
|
-
setIsSubmittingData(false);
|
|
278
|
-
if (checkoutError) {
|
|
279
|
-
onCheckoutError === null || onCheckoutError === void 0 ? void 0 : onCheckoutError(checkoutError);
|
|
280
|
-
setSkippingStatus('false');
|
|
281
|
-
return showAlert(checkoutError.message);
|
|
282
|
-
}
|
|
283
|
-
const checkoutResponseData = {
|
|
284
|
-
id: checkoutData.data.data.attributes.id,
|
|
285
|
-
hash: checkoutData.data.data.attributes.hash,
|
|
286
|
-
total: checkoutData.data.data.attributes.total,
|
|
287
|
-
status: checkoutData.data.data.attributes.status,
|
|
288
|
-
};
|
|
289
|
-
setSkippingStatus('success');
|
|
290
|
-
onCheckoutSuccess(checkoutResponseData);
|
|
323
|
+
const performCheckout = async (checkoutBody) => {
|
|
324
|
+
if (!billingCoreRef.current) {
|
|
325
|
+
return onCheckoutError === null || onCheckoutError === void 0 ? void 0 : onCheckoutError({ message: 'BillingCore is not ready' });
|
|
291
326
|
}
|
|
292
|
-
|
|
293
|
-
|
|
327
|
+
setIsSubmittingData(true);
|
|
328
|
+
const { error: checkoutError, data: checkoutData } = await billingCoreRef.current.checkoutOrder(checkoutBody);
|
|
329
|
+
setIsSubmittingData(false);
|
|
330
|
+
if (checkoutError) {
|
|
331
|
+
onCheckoutError === null || onCheckoutError === void 0 ? void 0 : onCheckoutError(checkoutError);
|
|
294
332
|
setSkippingStatus('false');
|
|
295
|
-
|
|
296
|
-
message: 'Error while performing checkout',
|
|
297
|
-
});
|
|
333
|
+
return showAlert(checkoutError.message);
|
|
298
334
|
}
|
|
335
|
+
if (!checkoutData) {
|
|
336
|
+
onCheckoutError === null || onCheckoutError === void 0 ? void 0 : onCheckoutError({ message: 'Checkout returned not data' });
|
|
337
|
+
setSkippingStatus('false');
|
|
338
|
+
return showAlert('Checkout returned not data');
|
|
339
|
+
}
|
|
340
|
+
setSkippingStatus('success');
|
|
341
|
+
onCheckoutSuccess(checkoutData);
|
|
299
342
|
};
|
|
300
343
|
const getRegisterFormData = (checkoutBody) => {
|
|
301
344
|
const bodyFormData = new FormData();
|
|
@@ -308,9 +351,13 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
308
351
|
return bodyFormData;
|
|
309
352
|
};
|
|
310
353
|
const performNewUserRegister = async (checkoutBody) => {
|
|
311
|
-
|
|
354
|
+
if (!billingCoreRef.current) {
|
|
355
|
+
showAlert('BillingCore is not ready');
|
|
356
|
+
return onRegisterError === null || onRegisterError === void 0 ? void 0 : onRegisterError({ message: 'BillingCore is not initialized' });
|
|
357
|
+
}
|
|
312
358
|
setIsSubmittingData(true);
|
|
313
|
-
const
|
|
359
|
+
const registerForm = getRegisterFormData(checkoutBody);
|
|
360
|
+
const { data: registerResponseData, error: registerResponseError } = await billingCoreRef.current.registerNewUser(registerForm);
|
|
314
361
|
if (registerResponseError) {
|
|
315
362
|
setIsSubmittingData(false);
|
|
316
363
|
if (registerResponseError.isAlreadyRegistered) {
|
|
@@ -326,13 +373,15 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
326
373
|
handleOnRegisterFail('Register returned no data');
|
|
327
374
|
return showAlert('Register returned no data');
|
|
328
375
|
}
|
|
376
|
+
const accessToken = await getData(LocalStorageKeys.ACCESS_TOKEN);
|
|
377
|
+
const refreshToken = await getData(LocalStorageKeys.REFRESH_TOKEN);
|
|
329
378
|
const tokens = {
|
|
330
|
-
accessToken:
|
|
331
|
-
refreshToken:
|
|
379
|
+
accessToken: accessToken,
|
|
380
|
+
refreshToken: refreshToken,
|
|
332
381
|
};
|
|
333
382
|
storedToken.current = tokens.accessToken;
|
|
334
|
-
onRegisterSuccess === null || onRegisterSuccess === void 0 ? void 0 : onRegisterSuccess(
|
|
335
|
-
await performCheckout(checkoutBody
|
|
383
|
+
onRegisterSuccess === null || onRegisterSuccess === void 0 ? void 0 : onRegisterSuccess();
|
|
384
|
+
await performCheckout(checkoutBody);
|
|
336
385
|
};
|
|
337
386
|
const getCheckoutBody = () => {
|
|
338
387
|
let parsedTicketHolders = [];
|
|
@@ -419,7 +468,7 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
419
468
|
}
|
|
420
469
|
const checkoutBody = getCheckoutBody();
|
|
421
470
|
if (loggedUserFirstName && storedToken.current) {
|
|
422
|
-
await performCheckout(checkoutBody
|
|
471
|
+
await performCheckout(checkoutBody);
|
|
423
472
|
}
|
|
424
473
|
else {
|
|
425
474
|
await performNewUserRegister(checkoutBody);
|
|
@@ -428,11 +477,25 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
428
477
|
//#endregion
|
|
429
478
|
const fetchData = async () => {
|
|
430
479
|
var _a, _b;
|
|
480
|
+
if (!billingCoreRef.current) {
|
|
481
|
+
onFetchCartError === null || onFetchCartError === void 0 ? void 0 : onFetchCartError({ message: 'BillingCoreRef not initialized' });
|
|
482
|
+
return showAlert('BillingCoreRef not initialized');
|
|
483
|
+
}
|
|
431
484
|
setIsLoading(true);
|
|
485
|
+
let phoneCountry = 'US';
|
|
486
|
+
let phoneCountryDialCode = '+1';
|
|
432
487
|
let usrPrfl;
|
|
488
|
+
try {
|
|
489
|
+
const deviceCountry = await DeviceCountry.getCountryCode(TYPE_ANY);
|
|
490
|
+
phoneCountry = deviceCountry.code.toUpperCase();
|
|
491
|
+
phoneCountryDialCode = getCountryDialCode(phoneCountry);
|
|
492
|
+
}
|
|
493
|
+
catch (err) {
|
|
494
|
+
phoneCountry = 'US';
|
|
495
|
+
}
|
|
433
496
|
const usrTkn = await getData(LocalStorageKeys.ACCESS_TOKEN);
|
|
434
497
|
let skippingStatus;
|
|
435
|
-
const {
|
|
498
|
+
const { countriesData, countriesError } = await billingCoreRef.current.getCountries();
|
|
436
499
|
if (countriesError) {
|
|
437
500
|
setSkippingStatus('fail');
|
|
438
501
|
setIsLoading(false);
|
|
@@ -445,18 +508,18 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
445
508
|
});
|
|
446
509
|
if (usrTkn) {
|
|
447
510
|
storedToken.current = usrTkn;
|
|
448
|
-
const {
|
|
449
|
-
if (userProfileError || !
|
|
511
|
+
const { userProfileError, userProfileData } = await billingCoreRef.current.getUserProfile();
|
|
512
|
+
if (userProfileError || !userProfileData) {
|
|
450
513
|
setSkippingStatus('fail');
|
|
451
514
|
setIsLoading(false);
|
|
452
515
|
onFetchUserProfileError === null || onFetchUserProfileError === void 0 ? void 0 : onFetchUserProfileError(userProfileError);
|
|
453
516
|
return showAlert((userProfileError === null || userProfileError === void 0 ? void 0 : userProfileError.message) || 'Error fetching user profile');
|
|
454
517
|
}
|
|
455
518
|
onFetchUserProfileSuccess === null || onFetchUserProfileSuccess === void 0 ? void 0 : onFetchUserProfileSuccess({
|
|
456
|
-
firstName:
|
|
457
|
-
lastName:
|
|
519
|
+
firstName: userProfileData.firstName,
|
|
520
|
+
lastName: userProfileData.lastName,
|
|
458
521
|
});
|
|
459
|
-
usrPrfl =
|
|
522
|
+
usrPrfl = userProfileData;
|
|
460
523
|
}
|
|
461
524
|
else {
|
|
462
525
|
skippingStatus = 'fail';
|
|
@@ -469,12 +532,12 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
469
532
|
label: ((_b = texts === null || texts === void 0 ? void 0 : texts.form) === null || _b === void 0 ? void 0 : _b.country) || 'Country',
|
|
470
533
|
});
|
|
471
534
|
}
|
|
472
|
-
const { cartData, cartError } = await
|
|
473
|
-
if (cartError) {
|
|
535
|
+
const { cartData, cartError } = await billingCoreRef.current.getCart();
|
|
536
|
+
if (cartError || !cartData) {
|
|
474
537
|
setSkippingStatus('fail');
|
|
475
538
|
setIsLoading(false);
|
|
476
|
-
onFetchCartError === null || onFetchCartError === void 0 ? void 0 : onFetchCartError(cartError);
|
|
477
|
-
return showAlert(cartError.message);
|
|
539
|
+
onFetchCartError === null || onFetchCartError === void 0 ? void 0 : onFetchCartError(cartError || { message: 'Error fetching cart' });
|
|
540
|
+
return showAlert((cartError === null || cartError === void 0 ? void 0 : cartError.message) || 'Error fetching cart');
|
|
478
541
|
}
|
|
479
542
|
onFetchCartSuccess === null || onFetchCartSuccess === void 0 ? void 0 : onFetchCartSuccess();
|
|
480
543
|
if (skippingStatus === 'fail') {
|
|
@@ -496,20 +559,36 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
496
559
|
phone: i === 0 && usrPrfl ? usrPrfl.phone : '',
|
|
497
560
|
});
|
|
498
561
|
}
|
|
499
|
-
if (
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
});
|
|
504
|
-
await performCheckout(checkoutBody, usrTkn);
|
|
505
|
-
}
|
|
506
|
-
else {
|
|
507
|
-
if (skipping === 'skipping') {
|
|
562
|
+
if (usrPrfl) {
|
|
563
|
+
if (!checkIsStoredPhoneNumberFormat(usrPrfl.phone)) {
|
|
564
|
+
showAlert((texts === null || texts === void 0 ? void 0 : texts.invalidPhoneNumberError) || 'Please enter a valid phone number');
|
|
565
|
+
skippingStatus = 'fail';
|
|
508
566
|
setSkippingStatus('fail');
|
|
567
|
+
setIsLoading(false);
|
|
509
568
|
}
|
|
569
|
+
else {
|
|
570
|
+
// We can perfom Checkout process since phone is valid
|
|
571
|
+
if (!isBillingRequired && usrTkn && cartData) {
|
|
572
|
+
const checkoutBody = getCheckoutBodyWhenSkipping({
|
|
573
|
+
userProfile: usrPrfl,
|
|
574
|
+
ticketsQuantity: cartData.quantity,
|
|
575
|
+
});
|
|
576
|
+
return await performCheckout(checkoutBody);
|
|
577
|
+
}
|
|
578
|
+
else {
|
|
579
|
+
if (skipping === 'skipping') {
|
|
580
|
+
setSkippingStatus('fail');
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
handleSetFormDataFromUserProfile({
|
|
585
|
+
...usrPrfl,
|
|
586
|
+
phone: `${phoneCountryDialCode}${usrPrfl.phone}`,
|
|
587
|
+
});
|
|
510
588
|
}
|
|
511
|
-
|
|
512
|
-
|
|
589
|
+
else {
|
|
590
|
+
// There is no user profile data
|
|
591
|
+
setPhone(phoneCountryDialCode);
|
|
513
592
|
}
|
|
514
593
|
setCountries(parsedCountries);
|
|
515
594
|
setTicketHoldersData(tHolders);
|
|
@@ -530,19 +609,22 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
530
609
|
}, [countries, countryId]);
|
|
531
610
|
useEffect(() => {
|
|
532
611
|
const getStates = async () => {
|
|
533
|
-
|
|
612
|
+
if (!selectedCountry) {
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
if (!billingCoreRef.current) {
|
|
616
|
+
onFetchCartError === null || onFetchCartError === void 0 ? void 0 : onFetchCartError({ message: 'BillingCoreRef not initialized' });
|
|
617
|
+
return showAlert('BillingCoreRef not initialized');
|
|
618
|
+
}
|
|
619
|
+
const { statesData, statesError } = await billingCoreRef.current.getStates(selectedCountry.value.toString());
|
|
534
620
|
if (statesError) {
|
|
535
|
-
|
|
536
|
-
onFetchStatesError(statesError);
|
|
537
|
-
}
|
|
621
|
+
onFetchStatesError === null || onFetchStatesError === void 0 ? void 0 : onFetchStatesError(statesError);
|
|
538
622
|
return showAlert((statesError === null || statesError === void 0 ? void 0 : statesError.message) || 'Error fetching states');
|
|
539
623
|
}
|
|
540
624
|
const parsedStates = _map(statesData, (item, index) => {
|
|
541
625
|
return { label: item, value: index };
|
|
542
626
|
});
|
|
543
|
-
|
|
544
|
-
onFetchStatesSuccess();
|
|
545
|
-
}
|
|
627
|
+
onFetchStatesSuccess === null || onFetchStatesSuccess === void 0 ? void 0 : onFetchStatesSuccess();
|
|
546
628
|
setStates(parsedStates);
|
|
547
629
|
};
|
|
548
630
|
if (selectedCountry && selectedCountry.value !== '-1') {
|
|
@@ -647,55 +729,59 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
647
729
|
!!(skipBillingConfig === null || skipBillingConfig === void 0 ? void 0 : skipBillingConfig.isActivityIndicatorVisible) && (React.createElement(ActivityIndicator, { color: ((_a = skippingStyles === null || skippingStyles === void 0 ? void 0 : skippingStyles.activityIndicator) === null || _a === void 0 ? void 0 : _a.color) || R.colors.black, size: ((_b = skippingStyles === null || skippingStyles === void 0 ? void 0 : skippingStyles.activityIndicator) === null || _b === void 0 ? void 0 : _b.size) || 'large' })))));
|
|
648
730
|
};
|
|
649
731
|
const isDataValid = checkBasicDataValid();
|
|
650
|
-
return skipping === 'skipping' && areLoadingIndicatorsEnabled ? (renderCheckingOut()) : (React.createElement(
|
|
651
|
-
React.createElement(
|
|
652
|
-
React.createElement(
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
React.createElement(
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
732
|
+
return skipping === 'skipping' && areLoadingIndicatorsEnabled ? (renderCheckingOut()) : (React.createElement(BillingCore, { ref: billingCoreRef },
|
|
733
|
+
React.createElement(KeyboardAwareScrollView, { extraScrollHeight: 32 },
|
|
734
|
+
React.createElement(View, { style: styles === null || styles === void 0 ? void 0 : styles.rootContainer },
|
|
735
|
+
React.createElement(Login, { onLoginSuccessful: handleOnLoginSuccess, onLoginError: handleOnLoginError, onLogoutSuccess: handleOnLogoutSuccess, onLogoutError: onLogoutError, isLoginDialogVisible: isLoginDialogVisible, showLoginDialog: showLoginDialog, hideLoginDialog: hideLoginDialog, userFirstName: loggedUserFirstName, texts: { ...texts === null || texts === void 0 ? void 0 : texts.loginTexts, message: loginMessage }, styles: styles === null || styles === void 0 ? void 0 : styles.loginStyles, brandImages: loginBrandImages }),
|
|
736
|
+
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.screenTitle }, ((_c = texts === null || texts === void 0 ? void 0 : texts.form) === null || _c === void 0 ? void 0 : _c.getYourTicketsTitle) || 'Get Your Tickets'),
|
|
737
|
+
React.createElement(Input, { label: ((_d = texts === null || texts === void 0 ? void 0 : texts.form) === null || _d === void 0 ? void 0 : _d.firstName) || 'First name', value: firstName, onChangeText: setFirstName, error: firstNameError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles }),
|
|
738
|
+
React.createElement(Input, { label: ((_e = texts === null || texts === void 0 ? void 0 : texts.form) === null || _e === void 0 ? void 0 : _e.lastName) || 'Last name', value: lastName, onChangeText: setLastName, error: lastNameError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles }),
|
|
739
|
+
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.texts }, ((_f = texts === null || texts === void 0 ? void 0 : texts.form) === null || _f === void 0 ? void 0 : _f.emailsAdvice) ||
|
|
740
|
+
`IMPORTANT: Please double check that your email address is correct.\nIt's where we send your confirmation and e-tickets to!`),
|
|
741
|
+
React.createElement(Input, { label: ((_g = texts === null || texts === void 0 ? void 0 : texts.form) === null || _g === void 0 ? void 0 : _g.email) || 'Email', value: email, onChangeText: setEmail, keyboardType: 'email-address', error: emailError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles, autoCapitalize: 'none' }),
|
|
742
|
+
React.createElement(Input, { label: ((_h = texts === null || texts === void 0 ? void 0 : texts.form) === null || _h === void 0 ? void 0 : _h.confirmEmail) || 'Confirm email', value: emailConfirmation, onChangeText: setEmailConfirmation, keyboardType: 'email-address', error: confirmEmailError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles, autoCapitalize: 'none' }),
|
|
743
|
+
isAgeRequired && (React.createElement(DatePicker, { text: ((_j = texts === null || texts === void 0 ? void 0 : texts.form) === null || _j === void 0 ? void 0 : _j.dateOfBirth) || 'Date of Birth', onSelectDate: handleOnSelectDate, selectedDate: dateOfBirth, styles: styles === null || styles === void 0 ? void 0 : styles.datePicker, error: dateOfBirthError })),
|
|
744
|
+
!loggedUserFirstName && (React.createElement(React.Fragment, null,
|
|
745
|
+
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.passwordTitle }, ((_k = texts === null || texts === void 0 ? void 0 : texts.form) === null || _k === void 0 ? void 0 : _k.choosePassword) ||
|
|
746
|
+
'Choose a password for your new TICKETFAIRY account'),
|
|
747
|
+
React.createElement(Input, { label: ((_l = texts === null || texts === void 0 ? void 0 : texts.form) === null || _l === void 0 ? void 0 : _l.password) || 'Password', isSecure: true, onChangeText: setPassword, error: passwordError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles, autoCapitalize: 'none', secureTextEntry: true, textContentType: 'oneTimeCode' }),
|
|
748
|
+
React.createElement(Input, { label: ((_m = texts === null || texts === void 0 ? void 0 : texts.form) === null || _m === void 0 ? void 0 : _m.confirmPassword) || 'Confirm password', isSecure: true, onChangeText: setPasswordConfirmation, error: confirmPasswordError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles, autoCapitalize: 'none', secureTextEntry: true, textContentType: 'oneTimeCode' }))),
|
|
749
|
+
React.createElement(PhoneInput, { phoneNumber: phone, onChangePhoneNumber: handleOnChangePhoneNumber, styles: styles === null || styles === void 0 ? void 0 : styles.phoneInput, error: phoneError, texts: {
|
|
750
|
+
label: phoneLabel,
|
|
751
|
+
...(_o = texts === null || texts === void 0 ? void 0 : texts.form) === null || _o === void 0 ? void 0 : _o.phoneInput,
|
|
752
|
+
} }),
|
|
753
|
+
React.createElement(Input, { label: addressLabel, value: street, onChangeText: setStreet, error: streetError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles }),
|
|
754
|
+
React.createElement(Input, { label: ((_p = texts === null || texts === void 0 ? void 0 : texts.form) === null || _p === void 0 ? void 0 : _p.city) || 'City', value: city, onChangeText: setCity, error: cityError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles }),
|
|
755
|
+
React.createElement(DropdownMaterial, { items: countries, onSelectItem: setSelectedCountry, selectedOption: selectedCountry, styles: styles === null || styles === void 0 ? void 0 : styles.dropdownMaterialStyles, materialInputProps: {
|
|
756
|
+
label: ((_q = texts === null || texts === void 0 ? void 0 : texts.form) === null || _q === void 0 ? void 0 : _q.country) || 'Country',
|
|
757
|
+
} }),
|
|
758
|
+
React.createElement(Input, { label: ((_r = texts === null || texts === void 0 ? void 0 : texts.form) === null || _r === void 0 ? void 0 : _r.zipCode) || 'Postal Code / Zip Code', value: postalCode, onChangeText: setPostalCode, error: postalCodeError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles }),
|
|
759
|
+
React.createElement(DropdownMaterial, { items: states, onSelectItem: setSelectedState, selectedOption: selectedState, styles: styles === null || styles === void 0 ? void 0 : styles.dropdownMaterialStyles, materialInputProps: {
|
|
760
|
+
label: ((_s = texts === null || texts === void 0 ? void 0 : texts.form) === null || _s === void 0 ? void 0 : _s.state) || 'State',
|
|
761
|
+
} }),
|
|
762
|
+
React.createElement(Checkbox, { onPress: handleIsSubToBrandToggle, text: brandCheckBoxText, isActive: isSubToBrand, styles: styles === null || styles === void 0 ? void 0 : styles.checkboxStyles }),
|
|
763
|
+
!isTtfCheckboxHidden && (React.createElement(Checkbox, { onPress: handleIsSubToTicketFairyToggle, isActive: isSubToTicketFairy, customTextComp: React.createElement(Text, { style: (_t = styles === null || styles === void 0 ? void 0 : styles.customCheckbox) === null || _t === void 0 ? void 0 : _t.text },
|
|
764
|
+
((_u = texts === null || texts === void 0 ? void 0 : texts.form) === null || _u === void 0 ? void 0 : _u.isSubToTicketFairy) ||
|
|
765
|
+
`I agree that The Ticket Fairy may use the personal data that have provided for marketing purposes, such as recommending events that I might be interested in, in accordance with its `,
|
|
766
|
+
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.privacyPolicyLinkStyle, onPress: handleOpenPrivacyLink }, ((_v = texts === null || texts === void 0 ? void 0 : texts.form) === null || _v === void 0 ? void 0 : _v.privacyPolicy) || 'Privacy Policy'),
|
|
767
|
+
"."), styles: styles === null || styles === void 0 ? void 0 : styles.checkboxStyles })),
|
|
768
|
+
ticketHoldersData.length > 0 && (React.createElement(React.Fragment, null,
|
|
769
|
+
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.ticketHoldersTitle }, ((_w = texts === null || texts === void 0 ? void 0 : texts.form) === null || _w === void 0 ? void 0 : _w.ticketHoldersTitle) || 'Ticket Holders'),
|
|
770
|
+
renderTicketHolders())),
|
|
771
|
+
React.createElement(Button, { onPress: onSubmit, text: (texts === null || texts === void 0 ? void 0 : texts.checkoutButton) || 'CHECKOUT', isDisabled: !isDataValid, isLoading: isSubmittingData, styles: !isDataValid
|
|
772
|
+
? {
|
|
773
|
+
button: s.submitButtonDisabled,
|
|
774
|
+
...styles === null || styles === void 0 ? void 0 : styles.checkoutButtonDisabled,
|
|
775
|
+
}
|
|
776
|
+
: {
|
|
777
|
+
container: [
|
|
778
|
+
s.submitButton,
|
|
779
|
+
(_x = styles === null || styles === void 0 ? void 0 : styles.checkoutButton) === null || _x === void 0 ? void 0 : _x.container,
|
|
780
|
+
],
|
|
781
|
+
text: (_y = styles === null || styles === void 0 ? void 0 : styles.checkoutButton) === null || _y === void 0 ? void 0 : _y.text,
|
|
782
|
+
button: (_z = styles === null || styles === void 0 ? void 0 : styles.checkoutButton) === null || _z === void 0 ? void 0 : _z.button,
|
|
783
|
+
} })),
|
|
784
|
+
areLoadingIndicatorsEnabled && isLoading && React.createElement(Loading, null))));
|
|
699
785
|
//#endregion
|
|
700
786
|
};
|
|
701
787
|
export default Billing;
|