tf-checkout-react-native 1.0.13 → 1.0.14
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 +346 -166
- package/android/build.gradle +3 -3
- package/lib/api/ApiClient.d.ts +13 -21
- package/lib/api/ApiClient.js +122 -51
- package/lib/api/ApiClient.js.map +1 -1
- package/lib/api/types.d.ts +21 -11
- package/lib/components/login/Login.d.ts +1 -1
- package/lib/components/login/Login.js +21 -9
- package/lib/components/login/Login.js.map +1 -1
- package/lib/components/login/types.d.ts +7 -7
- package/lib/components/waitingList/WaitingList.d.ts +1 -1
- package/lib/components/waitingList/WaitingList.js +20 -3
- package/lib/components/waitingList/WaitingList.js.map +1 -1
- package/lib/components/waitingList/WaitingListView.js +19 -7
- package/lib/components/waitingList/WaitingListView.js.map +1 -1
- package/lib/components/waitingList/types.d.ts +10 -0
- package/lib/containers/billingInfo/Billing.d.ts +2 -1
- package/lib/containers/billingInfo/Billing.js +92 -52
- package/lib/containers/billingInfo/Billing.js.map +1 -1
- package/lib/containers/billingInfo/types.d.ts +21 -10
- package/lib/containers/checkout/Checkout.d.ts +1 -1
- package/lib/containers/checkout/Checkout.js +83 -48
- package/lib/containers/checkout/Checkout.js.map +1 -1
- package/lib/containers/checkout/styles.d.ts +2 -0
- package/lib/containers/checkout/styles.js +3 -1
- package/lib/containers/checkout/styles.js.map +1 -1
- package/lib/containers/checkout/types.d.ts +26 -7
- package/lib/containers/myOrderDetails/MyOrderDetails.js +21 -3
- package/lib/containers/myOrderDetails/MyOrderDetails.js.map +1 -1
- package/lib/containers/myOrderDetails/MyOrderDetailsView.js +10 -7
- package/lib/containers/myOrderDetails/MyOrderDetailsView.js.map +1 -1
- package/lib/containers/myOrderDetails/components/Notification.d.ts +10 -2
- package/lib/containers/myOrderDetails/components/Notification.js +5 -7
- package/lib/containers/myOrderDetails/components/Notification.js.map +1 -1
- package/lib/containers/myOrderDetails/types.d.ts +18 -0
- package/lib/containers/myOrders/MyOrders.js +36 -8
- package/lib/containers/myOrders/MyOrders.js.map +1 -1
- package/lib/containers/myOrders/MyOrdersView.d.ts +1 -1
- package/lib/containers/myOrders/MyOrdersView.js +3 -3
- package/lib/containers/myOrders/MyOrdersView.js.map +1 -1
- package/lib/containers/myOrders/types.d.ts +13 -1
- package/lib/containers/purchaseConfirmation/PurchaseConfirmation.d.ts +1 -1
- package/lib/containers/purchaseConfirmation/PurchaseConfirmation.js +21 -5
- package/lib/containers/purchaseConfirmation/PurchaseConfirmation.js.map +1 -1
- package/lib/containers/purchaseConfirmation/PurchaseConfirmationView.d.ts +1 -1
- package/lib/containers/purchaseConfirmation/PurchaseConfirmationView.js +4 -3
- package/lib/containers/purchaseConfirmation/PurchaseConfirmationView.js.map +1 -1
- package/lib/containers/purchaseConfirmation/types.d.ts +8 -0
- package/lib/containers/tickets/Tickets.d.ts +1 -1
- package/lib/containers/tickets/Tickets.js +37 -9
- package/lib/containers/tickets/Tickets.js.map +1 -1
- package/lib/containers/tickets/TicketsView.d.ts +1 -1
- package/lib/containers/tickets/TicketsView.js +5 -4
- package/lib/containers/tickets/TicketsView.js.map +1 -1
- package/lib/containers/tickets/components/TicketListItem.js +14 -7
- package/lib/containers/tickets/components/TicketListItem.js.map +1 -1
- package/lib/containers/tickets/components/types.d.ts +6 -0
- package/lib/containers/tickets/types.d.ts +18 -11
- package/lib/helpers/LocalStorage.d.ts +1 -1
- package/lib/helpers/LocalStorage.js +1 -3
- package/lib/helpers/LocalStorage.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/res/colors.d.ts +2 -2
- package/lib/res/colors.js +2 -18
- package/lib/res/colors.js.map +1 -1
- package/lib/types/IError.d.ts +5 -0
- package/lib/types/IError.js +2 -0
- package/lib/types/IError.js.map +1 -0
- package/lib/types/ITicket.d.ts +12 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -4,7 +4,7 @@ import { authorize, fetchAccessToken, fetchUserProfile, setAccessTokenHandler, }
|
|
|
4
4
|
import { Config } from '../../helpers/Config';
|
|
5
5
|
import { deleteAllData, LocalStorageKeys, storeData, } from '../../helpers/LocalStorage';
|
|
6
6
|
import LoginView from './LoginView';
|
|
7
|
-
const Login = ({ onLoginSuccessful, isLoginDialogVisible, showLoginDialog, hideLoginDialog, userFirstName, onLogoutSuccess, texts, styles,
|
|
7
|
+
const Login = ({ onLoginSuccessful, isLoginDialogVisible, showLoginDialog, hideLoginDialog, userFirstName, onLogoutSuccess, texts, styles, onLoginError, onFetchAccessTokenError, onFetchUserProfileError, refs, brandImages, onFetchAccessTokenSuccess, onFetchUserProfileSuccess, }) => {
|
|
8
8
|
const [isLoading, setIsLoading] = useState(false);
|
|
9
9
|
const [loginError, setLoginError] = useState('');
|
|
10
10
|
const [userProfileData, setUserProfileData] = useState();
|
|
@@ -19,9 +19,9 @@ const Login = ({ onLoginSuccessful, isLoginDialogVisible, showLoginDialog, hideL
|
|
|
19
19
|
const { code, error } = await authorize(bodyFormData);
|
|
20
20
|
if (error || !code) {
|
|
21
21
|
setIsLoading(false);
|
|
22
|
-
if (
|
|
23
|
-
setLoginError(error || 'Auth error');
|
|
24
|
-
return
|
|
22
|
+
if (onLoginError) {
|
|
23
|
+
setLoginError((error === null || error === void 0 ? void 0 : error.message) || 'Auth error');
|
|
24
|
+
return onLoginError(error);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
const bodyFormDataToken = new FormData();
|
|
@@ -33,17 +33,29 @@ const Login = ({ onLoginSuccessful, isLoginDialogVisible, showLoginDialog, hideL
|
|
|
33
33
|
const { error: tokenError, accessToken } = await fetchAccessToken(bodyFormDataToken);
|
|
34
34
|
if (tokenError) {
|
|
35
35
|
setIsLoading(false);
|
|
36
|
-
if (
|
|
37
|
-
return
|
|
36
|
+
if (onFetchAccessTokenError) {
|
|
37
|
+
return onFetchAccessTokenError(tokenError);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
if (onFetchAccessTokenError) {
|
|
41
|
+
setAccessTokenHandler(accessToken);
|
|
42
|
+
}
|
|
43
|
+
if (onFetchAccessTokenSuccess) {
|
|
44
|
+
onFetchAccessTokenSuccess();
|
|
45
|
+
}
|
|
41
46
|
const { error: userProfileError, userProfile } = await fetchUserProfile(accessToken);
|
|
42
47
|
if (userProfileError || !userProfile) {
|
|
43
48
|
setIsLoading(false);
|
|
44
|
-
if (
|
|
45
|
-
return
|
|
49
|
+
if (onFetchUserProfileError) {
|
|
50
|
+
return onFetchUserProfileError(userProfileError);
|
|
46
51
|
}
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (onFetchUserProfileSuccess) {
|
|
55
|
+
onFetchUserProfileSuccess({
|
|
56
|
+
firstName: userProfile.firstName,
|
|
57
|
+
lastName: userProfile.lastName,
|
|
58
|
+
});
|
|
47
59
|
}
|
|
48
60
|
const storedUserData = {
|
|
49
61
|
id: userProfile.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Login.js","sourceRoot":"","sources":["../../../src/components/login/Login.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EACL,aAAa,EAEb,gBAAgB,EAChB,SAAS,GACV,MAAM,4BAA4B,CAAA;AAEnC,OAAO,SAAS,MAAM,aAAa,CAAA;AAGnC,MAAM,KAAK,GAAG,CAAC,EACb,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,aAAa,EACb,eAAe,EACf,KAAK,EACL,MAAM,EACN,
|
|
1
|
+
{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AC5B,aAAa,EAAE,mBAAmB,EAClC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,GACxB,CACH,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ImageSourcePropType, ImageStyle } from 'react-native';
|
|
2
2
|
import { TextStyle } from 'react-native';
|
|
3
3
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
-
import { IUserProfile } from '../../types';
|
|
4
|
+
import { IError, IUserProfile } from '../../types';
|
|
5
5
|
import { IButtonStyles } from '../button/types';
|
|
6
6
|
import { IFormField } from '../formField/types';
|
|
7
7
|
import { IInputStyles } from '../input/types';
|
|
@@ -27,14 +27,16 @@ export interface ILoginBrandImages {
|
|
|
27
27
|
}
|
|
28
28
|
export interface ILoginProps {
|
|
29
29
|
onLoginSuccessful: (userProfile: IUserProfile, accessToken: string) => void;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
onLoginError?: (error: IError) => void;
|
|
31
|
+
onFetchUserProfileError?: (error: IError) => void;
|
|
32
|
+
onFetchUserProfileSuccess?: (data: any) => void;
|
|
33
|
+
onFetchAccessTokenError?: (error: IError) => void;
|
|
34
|
+
onFetchAccessTokenSuccess?: () => void;
|
|
33
35
|
isLoginDialogVisible: boolean;
|
|
34
36
|
showLoginDialog: () => void;
|
|
35
37
|
hideLoginDialog: () => void;
|
|
36
38
|
onLogoutSuccess?: () => void;
|
|
37
|
-
|
|
39
|
+
onLogoutError?: () => void;
|
|
38
40
|
styles?: ILoginViewStyles;
|
|
39
41
|
texts?: ILoginViewTexts;
|
|
40
42
|
userFirstName?: string;
|
|
@@ -92,8 +94,6 @@ export interface ILoginViewProps {
|
|
|
92
94
|
isLoading: boolean;
|
|
93
95
|
userProfile?: IUserProfile;
|
|
94
96
|
onPressLogout: () => void;
|
|
95
|
-
onLogoutSuccess?: () => void;
|
|
96
|
-
onLogoutFail?: () => void;
|
|
97
97
|
styles?: ILoginViewStyles;
|
|
98
98
|
texts?: ILoginViewTexts;
|
|
99
99
|
loginError?: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IWaitingListProps } from './types';
|
|
2
|
-
declare const WaitingList: ({ styles, texts, eventId }: IWaitingListProps) => JSX.Element;
|
|
2
|
+
declare const WaitingList: ({ styles, texts, eventId, onAddToWaitingListError, onAddToWaitingListSuccess, onLoadingChange, areAlertsEnabled, }: IWaitingListProps) => JSX.Element;
|
|
3
3
|
export default WaitingList;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { Alert } from 'react-native';
|
|
3
3
|
import { addToWaitingList } from '../../api/ApiClient';
|
|
4
4
|
import { useDebounced } from '../../helpers/Debounced';
|
|
5
5
|
import { validateEmail, validateEmpty } from '../../helpers/Validators';
|
|
6
6
|
import WaitingListView from './WaitingListView';
|
|
7
|
-
const WaitingList = ({ styles, texts, eventId }) => {
|
|
7
|
+
const WaitingList = ({ styles, texts, eventId, onAddToWaitingListError, onAddToWaitingListSuccess, onLoadingChange, areAlertsEnabled, }) => {
|
|
8
8
|
const [isSuccess, setIsSuccess] = useState(undefined);
|
|
9
9
|
const [isLoading, setIsLoading] = useState(false);
|
|
10
10
|
const [firstName, setFirstName] = useState('');
|
|
@@ -29,12 +29,29 @@ const WaitingList = ({ styles, texts, eventId }) => {
|
|
|
29
29
|
setIsLoading(false);
|
|
30
30
|
if (addToWaitingListError) {
|
|
31
31
|
setIsSuccess(false);
|
|
32
|
-
|
|
32
|
+
if (areAlertsEnabled) {
|
|
33
|
+
Alert.alert('', addToWaitingListError.message);
|
|
34
|
+
}
|
|
35
|
+
if (onAddToWaitingListError) {
|
|
36
|
+
onAddToWaitingListError(addToWaitingListError);
|
|
37
|
+
}
|
|
38
|
+
return;
|
|
33
39
|
}
|
|
34
40
|
if (addToWaitingListData) {
|
|
41
|
+
if (onAddToWaitingListSuccess) {
|
|
42
|
+
onAddToWaitingListSuccess();
|
|
43
|
+
}
|
|
35
44
|
setIsSuccess(true);
|
|
36
45
|
}
|
|
37
46
|
};
|
|
47
|
+
const onLoadingChangeCallback = useCallback((loading) => {
|
|
48
|
+
if (onLoadingChange) {
|
|
49
|
+
onLoadingChange(loading);
|
|
50
|
+
}
|
|
51
|
+
}, [onLoadingChange]);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
onLoadingChangeCallback(isLoading);
|
|
54
|
+
}, [isLoading, onLoadingChangeCallback]);
|
|
38
55
|
return (React.createElement(WaitingListView, { data: {
|
|
39
56
|
firstName: firstName,
|
|
40
57
|
lastName: lastName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WaitingList.js","sourceRoot":"","sources":["../../../src/components/waitingList/WaitingList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"WaitingList.js","sourceRoot":"","sources":["../../../src/components/waitingList/WaitingList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAEvE,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAE/C,MAAM,WAAW,GAAG,CAAC,EACnB,MAAM,EACN,KAAK,EACL,OAAO,EACP,uBAAuB,EACvB,yBAAyB,EACz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
|
|
@@ -5,15 +5,27 @@ import s from './styles';
|
|
|
5
5
|
const WaitingListView = ({ styles, texts, onPressButton, data, isSuccess, isLoading, }) => {
|
|
6
6
|
var _a, _b, _c;
|
|
7
7
|
const { firstName, lastName, email, emailError, lastNameError, firstNameError, onChangeEmail, onChangeFirstName, onChangeLastName, } = data;
|
|
8
|
-
const
|
|
8
|
+
const getIsDataValid = () => firstName.length > 0 &&
|
|
9
|
+
lastName.length > 0 &&
|
|
10
|
+
email.length > 0 &&
|
|
11
|
+
!emailError &&
|
|
12
|
+
!lastNameError &&
|
|
13
|
+
!firstNameError;
|
|
14
|
+
const isDataValid = getIsDataValid();
|
|
15
|
+
const buttonStyle = isDataValid
|
|
16
|
+
? styles === null || styles === void 0 ? void 0 : styles.button
|
|
17
|
+
: (styles === null || styles === void 0 ? void 0 : styles.buttonDisabled)
|
|
18
|
+
? styles === null || styles === void 0 ? void 0 : styles.buttonDisabled
|
|
19
|
+
: styles === null || styles === void 0 ? void 0 : styles.button;
|
|
9
20
|
return (React.createElement(View, { style: styles === null || styles === void 0 ? void 0 : styles.rootContainer }, isSuccess ? (React.createElement(View, { style: (_a = styles === null || styles === void 0 ? void 0 : styles.success) === null || _a === void 0 ? void 0 : _a.container },
|
|
10
|
-
React.createElement(Text, { style: (_b = styles === null || styles === void 0 ? void 0 : styles.success) === null || _b === void 0 ? void 0 : _b.title },
|
|
11
|
-
React.createElement(Text, { style: (_c = styles === null || styles === void 0 ? void 0 : styles.success) === null || _c === void 0 ? void 0 : _c.message },
|
|
21
|
+
React.createElement(Text, { style: (_b = styles === null || styles === void 0 ? void 0 : styles.success) === null || _b === void 0 ? void 0 : _b.title }, (texts === null || texts === void 0 ? void 0 : texts.successTitle) || `You've been added to the waiting list!`),
|
|
22
|
+
React.createElement(Text, { style: (_c = styles === null || styles === void 0 ? void 0 : styles.success) === null || _c === void 0 ? void 0 : _c.message }, (texts === null || texts === void 0 ? void 0 : texts.successMessage) ||
|
|
23
|
+
`You'll be notified if tickets become available.`))) : (React.createElement(React.Fragment, null,
|
|
12
24
|
React.createElement(Text, { style: [s.title, styles === null || styles === void 0 ? void 0 : styles.title] }, (texts === null || texts === void 0 ? void 0 : texts.title) || 'Waiting list'),
|
|
13
|
-
React.createElement(Input, { label: (texts === null || texts === void 0 ? void 0 : texts.firstName) || 'First name', value: firstName, onChangeText: onChangeFirstName, error: firstNameError }),
|
|
14
|
-
React.createElement(Input, { label: (texts === null || texts === void 0 ? void 0 : texts.lastName) || 'Last name', value: lastName, onChangeText: onChangeLastName, error: lastNameError }),
|
|
15
|
-
React.createElement(Input, { label: (texts === null || texts === void 0 ? void 0 : texts.email) || 'Email', keyboardType: 'email-address', autoCapitalize: 'none', value: email, onChangeText: onChangeEmail, error: emailError }),
|
|
16
|
-
React.createElement(Button, { onPress: onPressButton, text: (texts === null || texts === void 0 ? void 0 : texts.button) || 'ADD TO WAITING LIST', styles:
|
|
25
|
+
React.createElement(Input, { label: (texts === null || texts === void 0 ? void 0 : texts.firstName) || 'First name', value: firstName, onChangeText: onChangeFirstName, error: firstNameError, styles: styles === null || styles === void 0 ? void 0 : styles.input }),
|
|
26
|
+
React.createElement(Input, { label: (texts === null || texts === void 0 ? void 0 : texts.lastName) || 'Last name', value: lastName, onChangeText: onChangeLastName, error: lastNameError, styles: styles === null || styles === void 0 ? void 0 : styles.input }),
|
|
27
|
+
React.createElement(Input, { label: (texts === null || texts === void 0 ? void 0 : texts.email) || 'Email', keyboardType: 'email-address', autoCapitalize: 'none', value: email, onChangeText: onChangeEmail, error: emailError, styles: styles === null || styles === void 0 ? void 0 : styles.input }),
|
|
28
|
+
React.createElement(Button, { onPress: onPressButton, text: (texts === null || texts === void 0 ? void 0 : texts.button) || 'ADD TO WAITING LIST', styles: buttonStyle, isDisabled: !isDataValid, isLoading: isLoading })))));
|
|
17
29
|
};
|
|
18
30
|
export default WaitingListView;
|
|
19
31
|
//# sourceMappingURL=WaitingListView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WaitingListView.js","sourceRoot":"","sources":["../../../src/components/waitingList/WaitingListView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,CAAA;AAClC,OAAO,CAAC,MAAM,UAAU,CAAA;AAGxB,MAAM,eAAe,GAAG,CAAC,EACvB,MAAM,EACN,KAAK,EACL,aAAa,EACb,IAAI,EACJ,SAAS,EACT,SAAS,GACa,EAAE,EAAE;;IAC1B,MAAM,EACJ,SAAS,EACT,QAAQ,EACR,KAAK,EACL,UAAU,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,gBAAgB,GACjB,GAAG,IAAI,CAAA;IAER,MAAM,
|
|
1
|
+
{"version":3,"file":"WaitingListView.js","sourceRoot":"","sources":["../../../src/components/waitingList/WaitingListView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,CAAA;AAClC,OAAO,CAAC,MAAM,UAAU,CAAA;AAGxB,MAAM,eAAe,GAAG,CAAC,EACvB,MAAM,EACN,KAAK,EACL,aAAa,EACb,IAAI,EACJ,SAAS,EACT,SAAS,GACa,EAAE,EAAE;;IAC1B,MAAM,EACJ,SAAS,EACT,QAAQ,EACR,KAAK,EACL,UAAU,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,gBAAgB,GACjB,GAAG,IAAI,CAAA;IAER,MAAM,cAAc,GAAG,GAAG,EAAE,CAC1B,SAAS,CAAC,MAAM,GAAG,CAAC;QACpB,QAAQ,CAAC,MAAM,GAAG,CAAC;QACnB,KAAK,CAAC,MAAM,GAAG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AAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,KAAI,YAAY,EACvC,KAAK,EAAE,SAAS,EAChB,YAAY,EAAE,iBAAiB,EAC/B,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,GACrB;QACF,oBAAC,KAAK,IACJ,KAAK,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,KAAI,WAAW,EACrC,KAAK,EAAE,QAAQ,EACf,YAAY,EAAE,gBAAgB,EAC9B,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,GACrB;QACF,oBAAC,KAAK,IACJ,KAAK,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,KAAI,OAAO,EAC9B,YAAY,EAAC,eAAe,EAC5B,cAAc,EAAC,MAAM,EACrB,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,aAAa,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"}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
2
|
+
import { IError } from '../../types';
|
|
2
3
|
import { IButtonStyles } from '../button/types';
|
|
4
|
+
import { IInputStyles } from '../input/types';
|
|
3
5
|
export interface IWaitingListTexts {
|
|
4
6
|
title?: string;
|
|
5
7
|
firstName?: string;
|
|
6
8
|
lastName?: string;
|
|
7
9
|
email?: string;
|
|
8
10
|
button?: string;
|
|
11
|
+
successTitle?: string;
|
|
12
|
+
successMessage?: string;
|
|
9
13
|
}
|
|
10
14
|
export interface IWaitingListStyles {
|
|
11
15
|
rootContainer?: StyleProp<ViewStyle>;
|
|
12
16
|
title?: StyleProp<TextStyle>;
|
|
13
17
|
button?: IButtonStyles;
|
|
18
|
+
buttonDisabled?: IButtonStyles;
|
|
19
|
+
input?: IInputStyles;
|
|
14
20
|
success?: {
|
|
15
21
|
container?: StyleProp<ViewStyle>;
|
|
16
22
|
title?: StyleProp<ViewStyle>;
|
|
@@ -39,6 +45,10 @@ export interface IWaitingListProps {
|
|
|
39
45
|
eventId: number;
|
|
40
46
|
styles?: IWaitingListStyles;
|
|
41
47
|
texts?: IWaitingListTexts;
|
|
48
|
+
onAddToWaitingListSuccess?: () => void;
|
|
49
|
+
onAddToWaitingListError?: (error: IError) => void;
|
|
50
|
+
onLoadingChange?: (isLoading: boolean) => void;
|
|
51
|
+
areAlertsEnabled?: boolean;
|
|
42
52
|
}
|
|
43
53
|
export interface IWaitingListFields {
|
|
44
54
|
ticketTypeId: string;
|
|
@@ -2,7 +2,7 @@ import _every from 'lodash/every';
|
|
|
2
2
|
import _find from 'lodash/find';
|
|
3
3
|
import _forEach from 'lodash/forEach';
|
|
4
4
|
import _map from 'lodash/map';
|
|
5
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
6
6
|
import { ActivityIndicator, Alert, Image, Linking, Text, View, } from 'react-native';
|
|
7
7
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
8
8
|
import { checkoutOrder, fetchCart, fetchCountries, fetchStates, fetchUserProfile, registerNewUser, } from '../../api/ApiClient';
|
|
@@ -14,9 +14,8 @@ import { getData, LocalStorageKeys } from '../../helpers/LocalStorage';
|
|
|
14
14
|
import { validateAge, validateEmail, validateEmpty, validatePasswords, } from '../../helpers/Validators';
|
|
15
15
|
import R from '../../res';
|
|
16
16
|
import s from './styles';
|
|
17
|
-
const Billing = (
|
|
18
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
19
|
-
const { styles, texts, cartProps: { isAgeRequired, isNameRequired, isPhoneRequired, minimumAge, isBillingRequired, }, loginBrandImages, skipBillingConfig, } = props;
|
|
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, onFetchAccessTokenError, onFetchAccessTokenSuccess, }) => {
|
|
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;
|
|
20
19
|
//#region Labels
|
|
21
20
|
const countryLabel = ((_a = texts === null || texts === void 0 ? void 0 : texts.form) === null || _a === void 0 ? void 0 : _a.country) || 'Country';
|
|
22
21
|
const stateLabel = ((_b = texts === null || texts === void 0 ? void 0 : texts.form) === null || _b === void 0 ? void 0 : _b.country) || 'State/County';
|
|
@@ -111,6 +110,16 @@ const Billing = (props) => {
|
|
|
111
110
|
const storedProfileData = useRef({});
|
|
112
111
|
//#endregion
|
|
113
112
|
//#region Handlers
|
|
113
|
+
const handleOnLoadingChange = useCallback((loading) => {
|
|
114
|
+
if (onLoadingChange) {
|
|
115
|
+
onLoadingChange(loading);
|
|
116
|
+
}
|
|
117
|
+
}, [onLoadingChange]);
|
|
118
|
+
const showAlert = (text) => {
|
|
119
|
+
if (areAlertsEnabled) {
|
|
120
|
+
Alert.alert('', text);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
114
123
|
const showLoginDialog = () => setIsLoginDialogVisible(true);
|
|
115
124
|
const hideLoginDialog = () => setIsLoginDialogVisible(false);
|
|
116
125
|
const handleIsSubToBrandToggle = () => {
|
|
@@ -152,8 +161,8 @@ const Billing = (props) => {
|
|
|
152
161
|
}
|
|
153
162
|
};
|
|
154
163
|
const handleOnLoginSuccess = async (userProfile, accessToken) => {
|
|
155
|
-
if (
|
|
156
|
-
|
|
164
|
+
if (onLoginSuccess) {
|
|
165
|
+
onLoginSuccess({
|
|
157
166
|
accessToken: accessToken,
|
|
158
167
|
userData: userProfile,
|
|
159
168
|
});
|
|
@@ -168,8 +177,8 @@ const Billing = (props) => {
|
|
|
168
177
|
handleSetFormDataFromUserProfile(userProfile, accessToken);
|
|
169
178
|
};
|
|
170
179
|
const handleOnLoginFail = (error) => {
|
|
171
|
-
if (
|
|
172
|
-
|
|
180
|
+
if (onLoginError) {
|
|
181
|
+
onLoginError(error);
|
|
173
182
|
}
|
|
174
183
|
};
|
|
175
184
|
const handleOnLogoutSuccess = () => {
|
|
@@ -226,6 +235,8 @@ const Billing = (props) => {
|
|
|
226
235
|
}
|
|
227
236
|
return true;
|
|
228
237
|
};
|
|
238
|
+
const fillAllRequiredFieldsAlert = ((_d = texts === null || texts === void 0 ? void 0 : texts.form) === null || _d === void 0 ? void 0 : _d.fillAllRequiredFieldsAlert) ||
|
|
239
|
+
'You must fill all Ticket Holder required fields';
|
|
229
240
|
const checkExtraDataValid = () => {
|
|
230
241
|
if (isAgeRequired) {
|
|
231
242
|
const ageValidationMessage = validateAge(dateOfBirth, minimumAge);
|
|
@@ -239,13 +250,13 @@ const Billing = (props) => {
|
|
|
239
250
|
}
|
|
240
251
|
return _every(_map(ticketHoldersData, (th) => validateEmpty(th.firstName) || validateEmpty(th.lastName)), (itm) => itm === '')
|
|
241
252
|
? ''
|
|
242
|
-
:
|
|
253
|
+
: fillAllRequiredFieldsAlert;
|
|
243
254
|
};
|
|
244
255
|
//#endregion
|
|
245
256
|
//#region Submit form
|
|
246
257
|
const handleOnRegisterFail = (rawError) => {
|
|
247
|
-
if (
|
|
248
|
-
|
|
258
|
+
if (onRegisterError) {
|
|
259
|
+
onRegisterError(rawError);
|
|
249
260
|
}
|
|
250
261
|
};
|
|
251
262
|
const performCheckout = async (checkoutBody, pToken) => {
|
|
@@ -254,11 +265,11 @@ const Billing = (props) => {
|
|
|
254
265
|
const { error: checkoutError, data: checkoutData } = await checkoutOrder(checkoutBody, pToken);
|
|
255
266
|
setIsSubmittingData(false);
|
|
256
267
|
if (checkoutError) {
|
|
257
|
-
if (
|
|
258
|
-
|
|
268
|
+
if (onCheckoutError) {
|
|
269
|
+
onCheckoutError(checkoutError);
|
|
259
270
|
}
|
|
260
271
|
setSkippingStatus('false');
|
|
261
|
-
return
|
|
272
|
+
return showAlert(checkoutError.message);
|
|
262
273
|
}
|
|
263
274
|
const checkoutResponseData = {
|
|
264
275
|
id: checkoutData.data.data.attributes.id,
|
|
@@ -267,13 +278,15 @@ const Billing = (props) => {
|
|
|
267
278
|
status: checkoutData.data.data.attributes.status,
|
|
268
279
|
};
|
|
269
280
|
setSkippingStatus('success');
|
|
270
|
-
|
|
281
|
+
onCheckoutSuccess(checkoutResponseData);
|
|
271
282
|
}
|
|
272
283
|
catch (err) {
|
|
273
284
|
setIsSubmittingData(false);
|
|
274
285
|
setSkippingStatus('false');
|
|
275
|
-
if (
|
|
276
|
-
|
|
286
|
+
if (onCheckoutError) {
|
|
287
|
+
onCheckoutError({
|
|
288
|
+
message: 'Error while performing checkout',
|
|
289
|
+
});
|
|
277
290
|
}
|
|
278
291
|
}
|
|
279
292
|
};
|
|
@@ -299,20 +312,20 @@ const Billing = (props) => {
|
|
|
299
312
|
return handleOnRegisterFail(registerResponseError.raw);
|
|
300
313
|
}
|
|
301
314
|
handleOnRegisterFail(registerResponseError.raw);
|
|
302
|
-
return
|
|
315
|
+
return showAlert(registerResponseError.message);
|
|
303
316
|
}
|
|
304
317
|
if (!registerResponseData) {
|
|
305
318
|
setIsSubmittingData(false);
|
|
306
319
|
handleOnRegisterFail('Register returned no data');
|
|
307
|
-
return
|
|
320
|
+
return showAlert('Register returned no data');
|
|
308
321
|
}
|
|
309
322
|
const tokens = {
|
|
310
323
|
accessToken: registerResponseData.access_token,
|
|
311
324
|
refreshToken: registerResponseData.refresh_token,
|
|
312
325
|
};
|
|
313
326
|
storedToken.current = tokens.accessToken;
|
|
314
|
-
if (
|
|
315
|
-
|
|
327
|
+
if (onRegisterSuccess) {
|
|
328
|
+
onRegisterSuccess(tokens);
|
|
316
329
|
}
|
|
317
330
|
await performCheckout(checkoutBody, tokens.accessToken);
|
|
318
331
|
};
|
|
@@ -397,7 +410,7 @@ const Billing = (props) => {
|
|
|
397
410
|
const onSubmit = async () => {
|
|
398
411
|
const isExtraDataValid = checkExtraDataValid();
|
|
399
412
|
if (isExtraDataValid) {
|
|
400
|
-
return
|
|
413
|
+
return showAlert(isExtraDataValid);
|
|
401
414
|
}
|
|
402
415
|
const checkoutBody = getCheckoutBody();
|
|
403
416
|
if (loggedUserFirstName && storedToken.current) {
|
|
@@ -415,7 +428,13 @@ const Billing = (props) => {
|
|
|
415
428
|
const { data: countriesData, error: countriesError } = await fetchCountries();
|
|
416
429
|
if (countriesError) {
|
|
417
430
|
setIsLoading(false);
|
|
418
|
-
|
|
431
|
+
if (onFetchCountriesError) {
|
|
432
|
+
onFetchCountriesError(countriesError);
|
|
433
|
+
}
|
|
434
|
+
return showAlert(countriesError.message || 'Error fetching countries');
|
|
435
|
+
}
|
|
436
|
+
if (onFetchCountriesSuccess) {
|
|
437
|
+
onFetchCountriesSuccess();
|
|
419
438
|
}
|
|
420
439
|
const parsedCountries = _map(countriesData, (item, index) => {
|
|
421
440
|
return { label: item, value: index };
|
|
@@ -425,7 +444,16 @@ const Billing = (props) => {
|
|
|
425
444
|
const { error: userProfileError, userProfile: userProfileResponse } = await fetchUserProfile(usrTkn);
|
|
426
445
|
if (userProfileError || !userProfileResponse) {
|
|
427
446
|
setIsLoading(false);
|
|
428
|
-
|
|
447
|
+
if (onFetchUserProfileError) {
|
|
448
|
+
onFetchUserProfileError(userProfileError);
|
|
449
|
+
}
|
|
450
|
+
return showAlert((userProfileError === null || userProfileError === void 0 ? void 0 : userProfileError.message) || 'Error fetching user profile');
|
|
451
|
+
}
|
|
452
|
+
if (onFetchUserProfileSuccess) {
|
|
453
|
+
onFetchUserProfileSuccess({
|
|
454
|
+
firstName: userProfileResponse.firstName,
|
|
455
|
+
lastName: userProfileResponse.lastName,
|
|
456
|
+
});
|
|
429
457
|
}
|
|
430
458
|
usrPrfl = userProfileResponse;
|
|
431
459
|
}
|
|
@@ -436,11 +464,13 @@ const Billing = (props) => {
|
|
|
436
464
|
const { cartData, cartError } = await fetchCart();
|
|
437
465
|
if (cartError) {
|
|
438
466
|
setIsLoading(false);
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
props.onFetchCartError(cartError);
|
|
467
|
+
if (onFetchCartError) {
|
|
468
|
+
onFetchCartError(cartError);
|
|
442
469
|
}
|
|
443
|
-
return;
|
|
470
|
+
return showAlert(cartError.message);
|
|
471
|
+
}
|
|
472
|
+
if (onFetchCartSuccess) {
|
|
473
|
+
onFetchCartSuccess();
|
|
444
474
|
}
|
|
445
475
|
setNumberOfTicketHolders(cartData.quantity);
|
|
446
476
|
setIsSubToBrand(cartData.isMarketingOptedIn);
|
|
@@ -475,6 +505,9 @@ const Billing = (props) => {
|
|
|
475
505
|
setIsLoading(false);
|
|
476
506
|
};
|
|
477
507
|
//#region Effects
|
|
508
|
+
useCallback(() => {
|
|
509
|
+
handleOnLoadingChange(isLoading);
|
|
510
|
+
}, [isLoading, handleOnLoadingChange]);
|
|
478
511
|
useEffect(() => {
|
|
479
512
|
if (countries.length > 1 && countryId) {
|
|
480
513
|
const selectedCountryItem = _find(countries, (item) => item.value === countryId);
|
|
@@ -484,17 +517,24 @@ const Billing = (props) => {
|
|
|
484
517
|
useEffect(() => {
|
|
485
518
|
const getStates = async () => {
|
|
486
519
|
const { data: statesData, error: statesError } = await fetchStates(selectedCountry.value);
|
|
487
|
-
if (statesError
|
|
488
|
-
|
|
520
|
+
if (statesError) {
|
|
521
|
+
if (onFetchStatesError) {
|
|
522
|
+
onFetchStatesError(statesError);
|
|
523
|
+
}
|
|
524
|
+
return showAlert((statesError === null || statesError === void 0 ? void 0 : statesError.message) || 'Error fetching states');
|
|
489
525
|
}
|
|
490
526
|
const parsedStates = _map(statesData, (item, index) => {
|
|
491
527
|
return { label: item, value: index };
|
|
492
528
|
});
|
|
529
|
+
if (onFetchStatesSuccess) {
|
|
530
|
+
onFetchStatesSuccess();
|
|
531
|
+
}
|
|
493
532
|
setStates(parsedStates);
|
|
494
533
|
};
|
|
495
534
|
if (selectedCountry && selectedCountry.value !== '-1') {
|
|
496
535
|
getStates();
|
|
497
536
|
}
|
|
537
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
498
538
|
}, [selectedCountry]);
|
|
499
539
|
useEffect(() => {
|
|
500
540
|
if (states.length > 1 && stateId) {
|
|
@@ -575,34 +615,34 @@ const Billing = (props) => {
|
|
|
575
615
|
const isDataValid = checkBasicDataValid();
|
|
576
616
|
return skipping === 'skipping' ? (renderCheckingOut()) : (React.createElement(KeyboardAwareScrollView, { extraScrollHeight: 32 },
|
|
577
617
|
React.createElement(View, { style: styles === null || styles === void 0 ? void 0 : styles.rootContainer },
|
|
578
|
-
React.createElement(Login, { onLoginSuccessful: handleOnLoginSuccess, onLogoutSuccess: handleOnLogoutSuccess, isLoginDialogVisible: isLoginDialogVisible, showLoginDialog: showLoginDialog, hideLoginDialog: hideLoginDialog, userFirstName: loggedUserFirstName,
|
|
579
|
-
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.screenTitle }, ((
|
|
580
|
-
React.createElement(Input, { label: ((
|
|
581
|
-
React.createElement(Input, { label: ((
|
|
582
|
-
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.texts }, ((
|
|
618
|
+
React.createElement(Login, { onLoginSuccessful: handleOnLoginSuccess, onLogoutSuccess: handleOnLogoutSuccess, isLoginDialogVisible: isLoginDialogVisible, showLoginDialog: showLoginDialog, hideLoginDialog: hideLoginDialog, userFirstName: loggedUserFirstName, onLoginError: handleOnLoginFail, texts: texts === null || texts === void 0 ? void 0 : texts.loginTexts, styles: styles === null || styles === void 0 ? void 0 : styles.loginStyles, brandImages: loginBrandImages, onFetchAccessTokenError: onFetchAccessTokenError, onFetchAccessTokenSuccess: onFetchAccessTokenSuccess, onFetchUserProfileError: onFetchUserProfileError, onFetchUserProfileSuccess: onFetchUserProfileSuccess }),
|
|
619
|
+
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.screenTitle }, ((_e = texts === null || texts === void 0 ? void 0 : texts.form) === null || _e === void 0 ? void 0 : _e.getYourTicketsTitle) || 'Get Your Tickets'),
|
|
620
|
+
React.createElement(Input, { label: ((_f = texts === null || texts === void 0 ? void 0 : texts.form) === null || _f === void 0 ? void 0 : _f.firstName) || 'First name', value: firstName, onChangeText: setFirstName, error: firstNameError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles }),
|
|
621
|
+
React.createElement(Input, { label: ((_g = texts === null || texts === void 0 ? void 0 : texts.form) === null || _g === void 0 ? void 0 : _g.lastName) || 'Last name', value: lastName, onChangeText: setLastName, error: lastNameError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles }),
|
|
622
|
+
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.texts }, ((_h = texts === null || texts === void 0 ? void 0 : texts.form) === null || _h === void 0 ? void 0 : _h.emailsAdvice) ||
|
|
583
623
|
`IMPORTANT: Please double check that your email address is correct.\nIt's where we send your confirmation and e-tickets to!`),
|
|
584
|
-
React.createElement(Input, { label: ((
|
|
585
|
-
React.createElement(Input, { label: ((
|
|
586
|
-
isAgeRequired && (React.createElement(DatePicker, { text: ((
|
|
624
|
+
React.createElement(Input, { label: ((_j = texts === null || texts === void 0 ? void 0 : texts.form) === null || _j === void 0 ? void 0 : _j.email) || 'Email', value: email, onChangeText: setEmail, keyboardType: 'email-address', error: emailError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles, autoCapitalize: 'none' }),
|
|
625
|
+
React.createElement(Input, { label: ((_k = texts === null || texts === void 0 ? void 0 : texts.form) === null || _k === void 0 ? void 0 : _k.confirmEmail) || 'Confirm email', value: emailConfirmation, onChangeText: setEmailConfirmation, keyboardType: 'email-address', error: confirmEmailError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles, autoCapitalize: 'none' }),
|
|
626
|
+
isAgeRequired && (React.createElement(DatePicker, { text: ((_l = texts === null || texts === void 0 ? void 0 : texts.form) === null || _l === void 0 ? void 0 : _l.dateOfBirth) || 'Date of Birth', onSelectDate: handleOnSelectDate, selectedDate: dateOfBirth, styles: styles === null || styles === void 0 ? void 0 : styles.datePicker, error: dateOfBirthError })),
|
|
587
627
|
!loggedUserFirstName && (React.createElement(React.Fragment, null,
|
|
588
|
-
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.passwordTitle }, ((
|
|
628
|
+
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.passwordTitle }, ((_m = texts === null || texts === void 0 ? void 0 : texts.form) === null || _m === void 0 ? void 0 : _m.choosePassword) ||
|
|
589
629
|
'Choose a password for your new TICKETFAIRY account'),
|
|
590
|
-
React.createElement(Input, { label: ((
|
|
591
|
-
React.createElement(Input, { label: ((
|
|
630
|
+
React.createElement(Input, { label: ((_o = texts === null || texts === void 0 ? void 0 : texts.form) === null || _o === void 0 ? void 0 : _o.password) || 'Password', isSecure: true, onChangeText: setPassword, error: passwordError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles, autoCapitalize: 'none', secureTextEntry: true }),
|
|
631
|
+
React.createElement(Input, { label: ((_p = texts === null || texts === void 0 ? void 0 : texts.form) === null || _p === void 0 ? void 0 : _p.confirmPassword) || 'Confirm password', isSecure: true, onChangeText: setPasswordConfirmation, error: confirmPasswordError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles, autoCapitalize: 'none', secureTextEntry: true }))),
|
|
592
632
|
React.createElement(Input, { label: phoneLabel, value: phone, onChangeText: setPhone, keyboardType: 'phone-pad', error: phoneError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles }),
|
|
593
633
|
React.createElement(Input, { label: addressLabel, value: street, onChangeText: setStreet, error: streetError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles }),
|
|
594
|
-
React.createElement(Input, { label: ((
|
|
634
|
+
React.createElement(Input, { label: ((_q = texts === null || texts === void 0 ? void 0 : texts.form) === null || _q === void 0 ? void 0 : _q.city) || 'City', value: city, onChangeText: setCity, error: cityError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles }),
|
|
595
635
|
React.createElement(Dropdown, { items: countries, onSelectItem: setSelectedCountry, selectedOption: selectedCountry, styles: styles === null || styles === void 0 ? void 0 : styles.dropdownStyles }),
|
|
596
|
-
React.createElement(Input, { label: ((
|
|
636
|
+
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 }),
|
|
597
637
|
React.createElement(Dropdown, { items: states, onSelectItem: setSelectedState, selectedOption: selectedState, styles: styles === null || styles === void 0 ? void 0 : styles.dropdownStyles }),
|
|
598
638
|
React.createElement(Checkbox, { onPress: handleIsSubToBrandToggle, text: brandCheckBoxText, isActive: isSubToBrand, styles: styles === null || styles === void 0 ? void 0 : styles.checkboxStyles }),
|
|
599
|
-
!isTtfCheckboxHidden && (React.createElement(Checkbox, { onPress: handleIsSubToTicketFairyToggle, isActive: isSubToTicketFairy, customTextComp: React.createElement(Text, { style: (
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
React.createElement(Text, { style:
|
|
639
|
+
!isTtfCheckboxHidden && (React.createElement(Checkbox, { onPress: handleIsSubToTicketFairyToggle, isActive: isSubToTicketFairy, customTextComp: React.createElement(Text, { style: (_s = styles === null || styles === void 0 ? void 0 : styles.customCheckbox) === null || _s === void 0 ? void 0 : _s.text },
|
|
640
|
+
((_t = texts === null || texts === void 0 ? void 0 : texts.form) === null || _t === void 0 ? void 0 : _t.isSubToTicketFairy) ||
|
|
641
|
+
`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 `,
|
|
642
|
+
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.privacyPolicyLinkStyle, onPress: handleOpenPrivacyLink }, ((_u = texts === null || texts === void 0 ? void 0 : texts.form) === null || _u === void 0 ? void 0 : _u.privacyPolicy) || 'Privacy Policy'),
|
|
603
643
|
"."), styles: styles === null || styles === void 0 ? void 0 : styles.checkboxStyles })),
|
|
604
644
|
ticketHoldersData.length > 0 && (React.createElement(React.Fragment, null,
|
|
605
|
-
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.ticketHoldersTitle }, ((
|
|
645
|
+
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.ticketHoldersTitle }, ((_v = texts === null || texts === void 0 ? void 0 : texts.form) === null || _v === void 0 ? void 0 : _v.ticketHoldersTitle) || 'Ticket Holders'),
|
|
606
646
|
renderTicketHolders())),
|
|
607
647
|
React.createElement(Button, { onPress: onSubmit, text: (texts === null || texts === void 0 ? void 0 : texts.checkoutButton) || 'CHECKOUT', isDisabled: !isDataValid, isLoading: isSubmittingData, styles: !isDataValid
|
|
608
648
|
? {
|
|
@@ -612,12 +652,12 @@ const Billing = (props) => {
|
|
|
612
652
|
: {
|
|
613
653
|
container: [
|
|
614
654
|
s.submitButton,
|
|
615
|
-
(
|
|
655
|
+
(_w = styles === null || styles === void 0 ? void 0 : styles.checkoutButton) === null || _w === void 0 ? void 0 : _w.container,
|
|
616
656
|
],
|
|
617
|
-
text: (
|
|
618
|
-
button: (
|
|
657
|
+
text: (_x = styles === null || styles === void 0 ? void 0 : styles.checkoutButton) === null || _x === void 0 ? void 0 : _x.text,
|
|
658
|
+
button: (_y = styles === null || styles === void 0 ? void 0 : styles.checkoutButton) === null || _y === void 0 ? void 0 : _y.button,
|
|
619
659
|
} })),
|
|
620
|
-
isLoading && React.createElement(Loading, null)));
|
|
660
|
+
areLoadingIndicatorsEnabled && isLoading && React.createElement(Loading, null)));
|
|
621
661
|
//#endregion
|
|
622
662
|
};
|
|
623
663
|
export default Billing;
|