tf-checkout-react-native 1.0.16 → 1.0.17
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 +12 -4
- package/lib/components/dropdown/styles.js +1 -1
- package/lib/components/dropdownMaterial/DropdownMaterial.d.ts +3 -0
- package/lib/components/dropdownMaterial/DropdownMaterial.js +53 -0
- package/lib/components/dropdownMaterial/DropdownMaterial.js.map +1 -0
- package/lib/components/dropdownMaterial/styles.d.ts +79 -0
- package/lib/components/dropdownMaterial/styles.js +88 -0
- package/lib/components/dropdownMaterial/styles.js.map +1 -0
- package/lib/components/dropdownMaterial/types.d.ts +21 -0
- package/lib/components/dropdownMaterial/types.js +2 -0
- package/lib/components/dropdownMaterial/types.js.map +1 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/index.js.map +1 -1
- package/lib/components/input/Input.js +1 -1
- package/lib/components/input/Input.js.map +1 -1
- package/lib/components/input/types.d.ts +4 -3
- package/lib/components/promoCode/PromoCode.d.ts +1 -1
- package/lib/components/promoCode/PromoCode.js +30 -44
- package/lib/components/promoCode/PromoCode.js.map +1 -1
- package/lib/components/promoCode/styles.d.ts +20 -16
- package/lib/components/promoCode/styles.js +21 -17
- package/lib/components/promoCode/styles.js.map +1 -1
- package/lib/components/promoCode/types.d.ts +8 -6
- package/lib/containers/billingInfo/Billing.js +132 -114
- package/lib/containers/billingInfo/Billing.js.map +1 -1
- package/lib/containers/billingInfo/types.d.ts +2 -0
- package/lib/containers/tickets/Tickets.d.ts +1 -1
- package/lib/containers/tickets/Tickets.js +8 -4
- package/lib/containers/tickets/Tickets.js.map +1 -1
- package/lib/containers/tickets/TicketsView.d.ts +1 -1
- package/lib/containers/tickets/TicketsView.js +3 -4
- package/lib/containers/tickets/TicketsView.js.map +1 -1
- package/lib/containers/tickets/types.d.ts +3 -1
- package/lib/helpers/Config.js +1 -3
- package/lib/helpers/Config.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,24 +3,23 @@ import R from '../../res';
|
|
|
3
3
|
export default StyleSheet.create({
|
|
4
4
|
content: {
|
|
5
5
|
flexDirection: 'row',
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
width: '100%',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
backgroundColor: R.colors.listBackground,
|
|
8
9
|
},
|
|
9
10
|
input: {
|
|
10
|
-
|
|
11
|
-
padding: 8,
|
|
11
|
+
paddingHorizontal: 8,
|
|
12
12
|
minWidth: 100,
|
|
13
|
-
|
|
13
|
+
flex: 0.8,
|
|
14
14
|
borderColor: R.colors.black,
|
|
15
15
|
color: R.colors.black,
|
|
16
|
+
height: 45,
|
|
17
|
+
fontSize: 16,
|
|
16
18
|
},
|
|
17
19
|
applyButton: {
|
|
18
20
|
backgroundColor: R.colors.primary,
|
|
19
21
|
paddingHorizontal: 8,
|
|
20
|
-
|
|
21
|
-
applyButtonDisabled: {
|
|
22
|
-
backgroundColor: R.colors.disabled,
|
|
23
|
-
paddingHorizontal: 8,
|
|
22
|
+
flex: 0.4,
|
|
24
23
|
},
|
|
25
24
|
applyText: {
|
|
26
25
|
fontWeight: '400',
|
|
@@ -28,16 +27,22 @@ export default StyleSheet.create({
|
|
|
28
27
|
color: R.colors.white,
|
|
29
28
|
},
|
|
30
29
|
cancelButton: {
|
|
31
|
-
|
|
30
|
+
padding: 4,
|
|
31
|
+
flex: 0.2,
|
|
32
|
+
marginLeft: 4,
|
|
32
33
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
cancelIcon: {
|
|
35
|
+
width: 20,
|
|
36
|
+
height: 20,
|
|
37
|
+
tintColor: R.colors.white,
|
|
37
38
|
},
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
errorMessage: {
|
|
40
|
+
color: R.colors.danger,
|
|
41
|
+
},
|
|
42
|
+
validMessage: {
|
|
43
|
+
color: R.colors.validGreen,
|
|
40
44
|
},
|
|
45
|
+
mainButtonContainer: {},
|
|
41
46
|
mainButtonText: {
|
|
42
47
|
fontWeight: '400',
|
|
43
48
|
fontSize: 14,
|
|
@@ -53,6 +58,5 @@ export default StyleSheet.create({
|
|
|
53
58
|
marginVertical: 16,
|
|
54
59
|
fontWeight: '600',
|
|
55
60
|
},
|
|
56
|
-
contentWrapper: {},
|
|
57
61
|
});
|
|
58
62
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/promoCode/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,CAAC,MAAM,WAAW,CAAA;AAEzB,eAAe,UAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE;QACP,aAAa,EAAE,KAAK;QACpB,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/promoCode/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,CAAC,MAAM,WAAW,CAAA;AAEzB,eAAe,UAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE;QACP,aAAa,EAAE,KAAK;QACpB,KAAK,EAAE,MAAM;QACb,UAAU,EAAE,QAAQ;QACpB,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc;KACzC;IACD,KAAK,EAAE;QACL,iBAAiB,EAAE,CAAC;QACpB,QAAQ,EAAE,GAAG;QACb,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;QAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;QACrB,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,EAAE;KACb;IACD,WAAW,EAAE;QACX,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO;QACjC,iBAAiB,EAAE,CAAC;QACpB,IAAI,EAAE,GAAG;KACV;IACD,SAAS,EAAE;QACT,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;KACtB;IACD,YAAY,EAAE;QACZ,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,GAAG;QACT,UAAU,EAAE,CAAC;KACd;IACD,UAAU,EAAE;QACV,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;KAC1B;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM;KACvB;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU;KAC3B;IACD,mBAAmB,EAAE,EAAE;IACvB,cAAc,EAAE;QACd,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;QACnB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK;KACtB;IACD,gBAAgB,EAAE;QAChB,OAAO,EAAE,CAAC;QACV,eAAe,EAAE,WAAW;QAC5B,UAAU,EAAE,QAAQ;KACrB;IACD,KAAK,EAAE;QACL,cAAc,EAAE,EAAE;QAClB,UAAU,EAAE,KAAK;KAClB;CACF,CAAC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StyleProp, TextStyle } from 'react-native';
|
|
1
|
+
import { ImageSourcePropType, ImageStyle, StyleProp, TextStyle } from 'react-native';
|
|
2
2
|
import { TextInputProps, ViewStyle } from 'react-native';
|
|
3
3
|
import { IButtonStyles } from '../button/types';
|
|
4
4
|
export interface IPromoCodeStyles {
|
|
@@ -7,13 +7,13 @@ export interface IPromoCodeStyles {
|
|
|
7
7
|
content?: StyleProp<ViewStyle>;
|
|
8
8
|
input?: TextInputProps['style'];
|
|
9
9
|
inputPlaceholderColor?: string;
|
|
10
|
-
title?: StyleProp<TextStyle>;
|
|
11
10
|
mainButton?: IButtonStyles;
|
|
12
|
-
cancelButton?: IButtonStyles;
|
|
13
11
|
applyButton?: IButtonStyles;
|
|
14
12
|
applyDisabledButton?: IButtonStyles;
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
errorMessage?: StyleProp<TextStyle>;
|
|
14
|
+
validMessage?: StyleProp<TextStyle>;
|
|
15
|
+
cancelButton?: StyleProp<ViewStyle>;
|
|
16
|
+
cancelIcon?: StyleProp<ImageStyle>;
|
|
17
17
|
}
|
|
18
18
|
export interface IPromoCodeTexts {
|
|
19
19
|
promoCodeButton?: string;
|
|
@@ -21,7 +21,8 @@ export interface IPromoCodeTexts {
|
|
|
21
21
|
apply?: string;
|
|
22
22
|
cancel?: string;
|
|
23
23
|
mainButton?: string;
|
|
24
|
-
|
|
24
|
+
errorMessage?: string;
|
|
25
|
+
validMessage?: string;
|
|
25
26
|
}
|
|
26
27
|
export interface IPromoCodeProps {
|
|
27
28
|
onPressApply: (promoCode: string) => void;
|
|
@@ -30,4 +31,5 @@ export interface IPromoCodeProps {
|
|
|
30
31
|
styles?: IPromoCodeStyles;
|
|
31
32
|
texts?: IPromoCodeTexts;
|
|
32
33
|
isAccessCodeEnabled?: boolean;
|
|
34
|
+
closeButtonIcon?: ImageSourcePropType;
|
|
33
35
|
}
|
|
@@ -7,7 +7,7 @@ import { ActivityIndicator, Alert, Image, Linking, Text, View, } from 'react-nat
|
|
|
7
7
|
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
8
8
|
import { checkoutOrder, fetchCart, fetchCountries, fetchStates, fetchUserProfile, registerNewUser, } from '../../api/ApiClient';
|
|
9
9
|
import Constants from '../../api/Constants';
|
|
10
|
-
import { Button, Checkbox, DatePicker,
|
|
10
|
+
import { Button, Checkbox, DatePicker, DropdownMaterial, Input, Loading, Login, } from '../../components';
|
|
11
11
|
import { Config } from '../../helpers/Config';
|
|
12
12
|
import { useDebounced } from '../../helpers/Debounced';
|
|
13
13
|
import { getData, LocalStorageKeys } from '../../helpers/LocalStorage';
|
|
@@ -15,56 +15,46 @@ import { validateAge, validateEmail, validateEmpty, validatePasswords, } from '.
|
|
|
15
15
|
import R from '../../res';
|
|
16
16
|
import s from './styles';
|
|
17
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, onSkippingStatusChange, }) => {
|
|
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
|
|
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
19
|
//#region Labels
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
const holderLabels = useMemo(() => {
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
22
|
+
const optional = isNameRequired ? '' : ((_a = texts === null || texts === void 0 ? void 0 : texts.form) === null || _a === void 0 ? void 0 : _a.optional) || '(optional)';
|
|
23
|
+
return {
|
|
24
|
+
firstName: ((_b = texts === null || texts === void 0 ? void 0 : texts.form) === null || _b === void 0 ? void 0 : _b.holderFirstName)
|
|
25
|
+
? `${texts.form.holderFirstName} ${optional}`
|
|
26
|
+
: `First Name ${optional}`,
|
|
27
|
+
lastName: ((_c = texts === null || texts === void 0 ? void 0 : texts.form) === null || _c === void 0 ? void 0 : _c.holderLastName)
|
|
28
|
+
? `${texts.form.holderLastName} ${optional}`
|
|
29
|
+
: `Last Name ${optional}`,
|
|
30
|
+
email: ((_d = texts === null || texts === void 0 ? void 0 : texts.form) === null || _d === void 0 ? void 0 : _d.holderEmail)
|
|
31
|
+
? `${texts.form.holderEmail} ${((_e = texts === null || texts === void 0 ? void 0 : texts.form) === null || _e === void 0 ? void 0 : _e.optional) || '(optional)'}`
|
|
32
|
+
: `Email ${optional}`,
|
|
33
|
+
phone: ((_f = texts === null || texts === void 0 ? void 0 : texts.form) === null || _f === void 0 ? void 0 : _f.holderPhone)
|
|
34
|
+
? `${texts.form.holderPhone} ${((_g = texts === null || texts === void 0 ? void 0 : texts.form) === null || _g === void 0 ? void 0 : _g.optional) || '(optional)'}`
|
|
35
|
+
: `Phone ${optional}`,
|
|
36
|
+
};
|
|
37
|
+
}, [isNameRequired, texts]);
|
|
38
|
+
const brandCheckBoxText = ((_a = texts === null || texts === void 0 ? void 0 : texts.form) === null || _a === void 0 ? void 0 : _a.isSubToBrand) ||
|
|
39
|
+
'I would like to be updated on news, events and offers.';
|
|
31
40
|
const phoneLabel = useMemo(() => {
|
|
32
|
-
var _a, _b;
|
|
33
|
-
const optionalPhone = isPhoneRequired
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
var _a, _b, _c;
|
|
42
|
+
const optionalPhone = isPhoneRequired
|
|
43
|
+
? ''
|
|
44
|
+
: ((_a = texts === null || texts === void 0 ? void 0 : texts.form) === null || _a === void 0 ? void 0 : _a.optional) || ' (optional)';
|
|
45
|
+
return ((_b = texts === null || texts === void 0 ? void 0 : texts.form) === null || _b === void 0 ? void 0 : _b.phone)
|
|
46
|
+
? `${(_c = texts === null || texts === void 0 ? void 0 : texts.form) === null || _c === void 0 ? void 0 : _c.phone} ${optionalPhone}`
|
|
36
47
|
: `Phone ${optionalPhone}`;
|
|
37
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
38
48
|
}, [isPhoneRequired, texts]);
|
|
39
49
|
const addressLabel = useMemo(() => {
|
|
40
|
-
var _a;
|
|
50
|
+
var _a, _b;
|
|
41
51
|
const optionalAddress = Config.IS_BILLING_STREET_NAME_REQUIRED
|
|
42
52
|
? ''
|
|
43
|
-
:
|
|
44
|
-
return ((
|
|
53
|
+
: ((_a = texts === null || texts === void 0 ? void 0 : texts.form) === null || _a === void 0 ? void 0 : _a.optional) || ' (optional)';
|
|
54
|
+
return ((_b = texts === null || texts === void 0 ? void 0 : texts.form) === null || _b === void 0 ? void 0 : _b.street)
|
|
45
55
|
? `${texts.form.street} ${optionalAddress}`
|
|
46
56
|
: `Street ${optionalAddress}`;
|
|
47
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
57
|
}, [texts]);
|
|
49
|
-
const holderLabels = useMemo(() => {
|
|
50
|
-
var _a, _b, _c, _d;
|
|
51
|
-
const optional = isNameRequired ? '' : optionalText;
|
|
52
|
-
return {
|
|
53
|
-
firstName: ((_a = texts === null || texts === void 0 ? void 0 : texts.form) === null || _a === void 0 ? void 0 : _a.holderFirstName)
|
|
54
|
-
? `${texts.form.holderFirstName} ${optional}`
|
|
55
|
-
: `First Name ${optional}`,
|
|
56
|
-
lastName: ((_b = texts === null || texts === void 0 ? void 0 : texts.form) === null || _b === void 0 ? void 0 : _b.holderLastName)
|
|
57
|
-
? `${texts.form.holderLastName} ${optional}`
|
|
58
|
-
: `Last Name ${optional}`,
|
|
59
|
-
email: ((_c = texts === null || texts === void 0 ? void 0 : texts.form) === null || _c === void 0 ? void 0 : _c.holderEmail)
|
|
60
|
-
? `${texts.form.holderEmail} ${optionalText}`
|
|
61
|
-
: `Email ${optionalText}`,
|
|
62
|
-
phone: ((_d = texts === null || texts === void 0 ? void 0 : texts.form) === null || _d === void 0 ? void 0 : _d.holderPhone)
|
|
63
|
-
? `${texts.form.holderPhone} ${optionalText}`
|
|
64
|
-
: `Phone ${optionalText}`,
|
|
65
|
-
};
|
|
66
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
|
-
}, [isNameRequired, texts]);
|
|
68
58
|
//#endregion
|
|
69
59
|
//#region State
|
|
70
60
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -90,8 +80,8 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
90
80
|
const [selectedState, setSelectedState] = useState(undefined);
|
|
91
81
|
const [ticketHoldersData, setTicketHoldersData] = useState([]);
|
|
92
82
|
const [numberOfTicketHolders, setNumberOfTicketHolders] = useState();
|
|
93
|
-
const [
|
|
94
|
-
const [
|
|
83
|
+
const [states, setStates] = useState([]);
|
|
84
|
+
const [countries, setCountries] = useState([]);
|
|
95
85
|
const [isLoginDialogVisible, setIsLoginDialogVisible] = useState(false);
|
|
96
86
|
const [skipping, setSkippingStatus] = useState(undefined);
|
|
97
87
|
const [isTtfCheckboxHidden, setIsTtfCheckboxHidden] = useState(false);
|
|
@@ -110,7 +100,7 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
110
100
|
// End of errors state
|
|
111
101
|
//#endregion
|
|
112
102
|
const getSkippingStatus = (numOfTickets) => {
|
|
113
|
-
if (isBillingRequired) {
|
|
103
|
+
if (isBillingRequired || skipping === 'fail') {
|
|
114
104
|
return 'false';
|
|
115
105
|
}
|
|
116
106
|
if (numOfTickets > 1 || isAgeRequired) {
|
|
@@ -179,12 +169,10 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
179
169
|
}
|
|
180
170
|
};
|
|
181
171
|
const handleOnLoginSuccess = async (userProfile, accessToken) => {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
});
|
|
187
|
-
}
|
|
172
|
+
onLoginSuccess === null || onLoginSuccess === void 0 ? void 0 : onLoginSuccess({
|
|
173
|
+
accessToken: accessToken,
|
|
174
|
+
userData: userProfile,
|
|
175
|
+
});
|
|
188
176
|
if (!isBillingRequired && skipping === 'fail') {
|
|
189
177
|
setSkippingStatus('skipping');
|
|
190
178
|
await performCheckout(getCheckoutBodyWhenSkipping({
|
|
@@ -195,11 +183,10 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
195
183
|
handleSetFormDataFromUserProfile(userProfile, accessToken);
|
|
196
184
|
};
|
|
197
185
|
const handleOnLoginFail = (error) => {
|
|
198
|
-
|
|
199
|
-
onLoginError(error);
|
|
200
|
-
}
|
|
186
|
+
onLoginError === null || onLoginError === void 0 ? void 0 : onLoginError(error);
|
|
201
187
|
};
|
|
202
188
|
const handleOnLogoutSuccess = () => {
|
|
189
|
+
var _a, _b;
|
|
203
190
|
setFirstName('');
|
|
204
191
|
setLastName('');
|
|
205
192
|
setEmail('');
|
|
@@ -212,8 +199,16 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
212
199
|
setPasswordConfirmation('');
|
|
213
200
|
setCountryId('');
|
|
214
201
|
setStateId('');
|
|
215
|
-
setSelectedCountry(
|
|
216
|
-
|
|
202
|
+
setSelectedCountry({
|
|
203
|
+
value: '-1',
|
|
204
|
+
label: ((_a = texts === null || texts === void 0 ? void 0 : texts.form) === null || _a === void 0 ? void 0 : _a.country) || 'Country',
|
|
205
|
+
});
|
|
206
|
+
setStates([
|
|
207
|
+
{
|
|
208
|
+
value: '-1',
|
|
209
|
+
label: ((_b = texts === null || texts === void 0 ? void 0 : texts.form) === null || _b === void 0 ? void 0 : _b.state) || 'State/County',
|
|
210
|
+
},
|
|
211
|
+
]);
|
|
217
212
|
setIsSubToTicketFairy(false);
|
|
218
213
|
setIsSubToBrand(false);
|
|
219
214
|
storedToken.current = '';
|
|
@@ -253,7 +248,7 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
253
248
|
}
|
|
254
249
|
return true;
|
|
255
250
|
};
|
|
256
|
-
const fillAllRequiredFieldsAlert = ((
|
|
251
|
+
const fillAllRequiredFieldsAlert = ((_b = texts === null || texts === void 0 ? void 0 : texts.form) === null || _b === void 0 ? void 0 : _b.fillAllRequiredFieldsAlert) ||
|
|
257
252
|
'You must fill all Ticket Holder required fields';
|
|
258
253
|
const checkExtraDataValid = () => {
|
|
259
254
|
if (isAgeRequired) {
|
|
@@ -273,9 +268,7 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
273
268
|
//#endregion
|
|
274
269
|
//#region Submit form
|
|
275
270
|
const handleOnRegisterFail = (rawError) => {
|
|
276
|
-
|
|
277
|
-
onRegisterError(rawError);
|
|
278
|
-
}
|
|
271
|
+
onRegisterError === null || onRegisterError === void 0 ? void 0 : onRegisterError(rawError);
|
|
279
272
|
};
|
|
280
273
|
const performCheckout = async (checkoutBody, pToken) => {
|
|
281
274
|
try {
|
|
@@ -299,11 +292,9 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
299
292
|
catch (err) {
|
|
300
293
|
setIsSubmittingData(false);
|
|
301
294
|
setSkippingStatus('false');
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
});
|
|
306
|
-
}
|
|
295
|
+
onCheckoutError === null || onCheckoutError === void 0 ? void 0 : onCheckoutError({
|
|
296
|
+
message: 'Error while performing checkout',
|
|
297
|
+
});
|
|
307
298
|
}
|
|
308
299
|
};
|
|
309
300
|
const getRegisterFormData = (checkoutBody) => {
|
|
@@ -340,9 +331,7 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
340
331
|
refreshToken: registerResponseData.refresh_token,
|
|
341
332
|
};
|
|
342
333
|
storedToken.current = tokens.accessToken;
|
|
343
|
-
|
|
344
|
-
onRegisterSuccess(tokens);
|
|
345
|
-
}
|
|
334
|
+
onRegisterSuccess === null || onRegisterSuccess === void 0 ? void 0 : onRegisterSuccess(tokens);
|
|
346
335
|
await performCheckout(checkoutBody, tokens.accessToken);
|
|
347
336
|
};
|
|
348
337
|
const getCheckoutBody = () => {
|
|
@@ -438,20 +427,19 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
438
427
|
};
|
|
439
428
|
//#endregion
|
|
440
429
|
const fetchData = async () => {
|
|
430
|
+
var _a, _b;
|
|
441
431
|
setIsLoading(true);
|
|
442
432
|
let usrPrfl;
|
|
443
433
|
const usrTkn = await getData(LocalStorageKeys.ACCESS_TOKEN);
|
|
434
|
+
let skippingStatus;
|
|
444
435
|
const { data: countriesData, error: countriesError } = await fetchCountries();
|
|
445
436
|
if (countriesError) {
|
|
437
|
+
setSkippingStatus('fail');
|
|
446
438
|
setIsLoading(false);
|
|
447
|
-
|
|
448
|
-
onFetchCountriesError(countriesError);
|
|
449
|
-
}
|
|
439
|
+
onFetchCountriesError === null || onFetchCountriesError === void 0 ? void 0 : onFetchCountriesError(countriesError);
|
|
450
440
|
return showAlert(countriesError.message || 'Error fetching countries');
|
|
451
441
|
}
|
|
452
|
-
|
|
453
|
-
onFetchCountriesSuccess();
|
|
454
|
-
}
|
|
442
|
+
onFetchCountriesSuccess === null || onFetchCountriesSuccess === void 0 ? void 0 : onFetchCountriesSuccess();
|
|
455
443
|
const parsedCountries = _map(countriesData, (item, index) => {
|
|
456
444
|
return { label: item, value: index };
|
|
457
445
|
});
|
|
@@ -459,36 +447,42 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
459
447
|
storedToken.current = usrTkn;
|
|
460
448
|
const { error: userProfileError, userProfile: userProfileResponse } = await fetchUserProfile(usrTkn);
|
|
461
449
|
if (userProfileError || !userProfileResponse) {
|
|
450
|
+
setSkippingStatus('fail');
|
|
462
451
|
setIsLoading(false);
|
|
463
|
-
|
|
464
|
-
onFetchUserProfileError(userProfileError);
|
|
465
|
-
}
|
|
452
|
+
onFetchUserProfileError === null || onFetchUserProfileError === void 0 ? void 0 : onFetchUserProfileError(userProfileError);
|
|
466
453
|
return showAlert((userProfileError === null || userProfileError === void 0 ? void 0 : userProfileError.message) || 'Error fetching user profile');
|
|
467
454
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
});
|
|
473
|
-
}
|
|
455
|
+
onFetchUserProfileSuccess === null || onFetchUserProfileSuccess === void 0 ? void 0 : onFetchUserProfileSuccess({
|
|
456
|
+
firstName: userProfileResponse.firstName,
|
|
457
|
+
lastName: userProfileResponse.lastName,
|
|
458
|
+
});
|
|
474
459
|
usrPrfl = userProfileResponse;
|
|
475
460
|
}
|
|
476
461
|
else {
|
|
477
|
-
|
|
478
|
-
|
|
462
|
+
skippingStatus = 'fail';
|
|
463
|
+
parsedCountries.unshift({
|
|
464
|
+
value: '-1',
|
|
465
|
+
label: ((_a = texts === null || texts === void 0 ? void 0 : texts.form) === null || _a === void 0 ? void 0 : _a.country) || 'Country',
|
|
466
|
+
});
|
|
467
|
+
setSelectedCountry({
|
|
468
|
+
value: '-1',
|
|
469
|
+
label: ((_b = texts === null || texts === void 0 ? void 0 : texts.form) === null || _b === void 0 ? void 0 : _b.country) || 'Country',
|
|
470
|
+
});
|
|
479
471
|
}
|
|
480
472
|
const { cartData, cartError } = await fetchCart();
|
|
481
473
|
if (cartError) {
|
|
474
|
+
setSkippingStatus('fail');
|
|
482
475
|
setIsLoading(false);
|
|
483
|
-
|
|
484
|
-
onFetchCartError(cartError);
|
|
485
|
-
}
|
|
476
|
+
onFetchCartError === null || onFetchCartError === void 0 ? void 0 : onFetchCartError(cartError);
|
|
486
477
|
return showAlert(cartError.message);
|
|
487
478
|
}
|
|
488
|
-
|
|
489
|
-
|
|
479
|
+
onFetchCartSuccess === null || onFetchCartSuccess === void 0 ? void 0 : onFetchCartSuccess();
|
|
480
|
+
if (skippingStatus === 'fail') {
|
|
481
|
+
setSkippingStatus('fail');
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
setSkippingStatus(getSkippingStatus(cartData.quantity));
|
|
490
485
|
}
|
|
491
|
-
setSkippingStatus(getSkippingStatus(cartData.quantity));
|
|
492
486
|
setNumberOfTicketHolders(cartData.quantity);
|
|
493
487
|
setIsSubToBrand(cartData.isMarketingOptedIn);
|
|
494
488
|
setIsSubToTicketFairy(cartData.isTfOptIn);
|
|
@@ -557,15 +551,22 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
557
551
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
558
552
|
}, [selectedCountry]);
|
|
559
553
|
useEffect(() => {
|
|
554
|
+
var _a, _b;
|
|
560
555
|
if (states.length > 1 && stateId) {
|
|
561
556
|
const selectedStateItem = _find(states, (item) => item.value === stateId);
|
|
562
557
|
if (!selectedStateItem) {
|
|
563
|
-
return setSelectedState(
|
|
558
|
+
return setSelectedState({
|
|
559
|
+
value: '-1',
|
|
560
|
+
label: ((_a = texts === null || texts === void 0 ? void 0 : texts.form) === null || _a === void 0 ? void 0 : _a.state) || 'State/County',
|
|
561
|
+
});
|
|
564
562
|
}
|
|
565
563
|
setSelectedState(selectedStateItem);
|
|
566
564
|
}
|
|
567
565
|
else {
|
|
568
|
-
setSelectedState(
|
|
566
|
+
setSelectedState({
|
|
567
|
+
value: '-1',
|
|
568
|
+
label: ((_b = texts === null || texts === void 0 ? void 0 : texts.form) === null || _b === void 0 ? void 0 : _b.state) || 'State/County',
|
|
569
|
+
});
|
|
569
570
|
}
|
|
570
571
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
571
572
|
}, [stateId, states]);
|
|
@@ -582,6 +583,19 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
582
583
|
}, [ticketHoldersData]);
|
|
583
584
|
initTicketHoldersErrors();
|
|
584
585
|
useEffect(() => {
|
|
586
|
+
var _a, _b;
|
|
587
|
+
setCountries([
|
|
588
|
+
{
|
|
589
|
+
value: '-1',
|
|
590
|
+
label: ((_a = texts === null || texts === void 0 ? void 0 : texts.form) === null || _a === void 0 ? void 0 : _a.country) || 'Country',
|
|
591
|
+
},
|
|
592
|
+
]);
|
|
593
|
+
setStates([
|
|
594
|
+
{
|
|
595
|
+
value: '-1',
|
|
596
|
+
label: ((_b = texts === null || texts === void 0 ? void 0 : texts.form) === null || _b === void 0 ? void 0 : _b.state) || 'State/County',
|
|
597
|
+
},
|
|
598
|
+
]);
|
|
585
599
|
fetchData();
|
|
586
600
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
587
601
|
}, []);
|
|
@@ -636,33 +650,37 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
636
650
|
return skipping === 'skipping' && areLoadingIndicatorsEnabled ? (renderCheckingOut()) : (React.createElement(KeyboardAwareScrollView, { extraScrollHeight: 32 },
|
|
637
651
|
React.createElement(View, { style: styles === null || styles === void 0 ? void 0 : styles.rootContainer },
|
|
638
652
|
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 }),
|
|
639
|
-
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.screenTitle }, ((
|
|
640
|
-
React.createElement(Input, { label: ((
|
|
641
|
-
React.createElement(Input, { label: ((
|
|
642
|
-
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.texts }, ((
|
|
653
|
+
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'),
|
|
654
|
+
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 }),
|
|
655
|
+
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 }),
|
|
656
|
+
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) ||
|
|
643
657
|
`IMPORTANT: Please double check that your email address is correct.\nIt's where we send your confirmation and e-tickets to!`),
|
|
644
|
-
React.createElement(Input, { label: ((
|
|
645
|
-
React.createElement(Input, { label: ((
|
|
646
|
-
isAgeRequired && (React.createElement(DatePicker, { text: ((
|
|
658
|
+
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' }),
|
|
659
|
+
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' }),
|
|
660
|
+
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 })),
|
|
647
661
|
!loggedUserFirstName && (React.createElement(React.Fragment, null,
|
|
648
|
-
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.passwordTitle }, ((
|
|
662
|
+
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) ||
|
|
649
663
|
'Choose a password for your new TICKETFAIRY account'),
|
|
650
|
-
React.createElement(Input, { label: ((
|
|
651
|
-
React.createElement(Input, { label: ((
|
|
652
|
-
React.createElement(Input, { label: phoneLabel, value: phone, onChangeText: setPhone, keyboardType: 'phone-pad', error: phoneError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles }),
|
|
664
|
+
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' }),
|
|
665
|
+
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' }))),
|
|
666
|
+
React.createElement(Input, { label: phoneLabel, value: phone, onChangeText: setPhone, keyboardType: 'phone-pad', error: isPhoneRequired ? phoneError : '', styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles }),
|
|
653
667
|
React.createElement(Input, { label: addressLabel, value: street, onChangeText: setStreet, error: streetError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles }),
|
|
654
|
-
React.createElement(Input, { label: ((
|
|
655
|
-
React.createElement(
|
|
656
|
-
|
|
657
|
-
|
|
668
|
+
React.createElement(Input, { label: ((_o = texts === null || texts === void 0 ? void 0 : texts.form) === null || _o === void 0 ? void 0 : _o.city) || 'City', value: city, onChangeText: setCity, error: cityError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles }),
|
|
669
|
+
React.createElement(DropdownMaterial, { items: countries, onSelectItem: setSelectedCountry, selectedOption: selectedCountry, styles: styles === null || styles === void 0 ? void 0 : styles.dropdownMaterialStyles, materialInputProps: {
|
|
670
|
+
label: ((_p = texts === null || texts === void 0 ? void 0 : texts.form) === null || _p === void 0 ? void 0 : _p.country) || 'Country',
|
|
671
|
+
} }),
|
|
672
|
+
React.createElement(Input, { label: ((_q = texts === null || texts === void 0 ? void 0 : texts.form) === null || _q === void 0 ? void 0 : _q.zipCode) || 'Postal Code / Zip Code', value: postalCode, onChangeText: setPostalCode, error: postalCodeError, styles: styles === null || styles === void 0 ? void 0 : styles.inputStyles }),
|
|
673
|
+
React.createElement(DropdownMaterial, { items: states, onSelectItem: setSelectedState, selectedOption: selectedState, styles: styles === null || styles === void 0 ? void 0 : styles.dropdownMaterialStyles, materialInputProps: {
|
|
674
|
+
label: ((_r = texts === null || texts === void 0 ? void 0 : texts.form) === null || _r === void 0 ? void 0 : _r.state) || 'State',
|
|
675
|
+
} }),
|
|
658
676
|
React.createElement(Checkbox, { onPress: handleIsSubToBrandToggle, text: brandCheckBoxText, isActive: isSubToBrand, styles: styles === null || styles === void 0 ? void 0 : styles.checkboxStyles }),
|
|
659
|
-
!isTtfCheckboxHidden && (React.createElement(Checkbox, { onPress: handleIsSubToTicketFairyToggle, isActive: isSubToTicketFairy, customTextComp: React.createElement(Text, { style: (
|
|
660
|
-
((
|
|
677
|
+
!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 },
|
|
678
|
+
((_t = texts === null || texts === void 0 ? void 0 : texts.form) === null || _t === void 0 ? void 0 : _t.isSubToTicketFairy) ||
|
|
661
679
|
`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 `,
|
|
662
|
-
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.privacyPolicyLinkStyle, onPress: handleOpenPrivacyLink }, ((
|
|
680
|
+
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'),
|
|
663
681
|
"."), styles: styles === null || styles === void 0 ? void 0 : styles.checkboxStyles })),
|
|
664
682
|
ticketHoldersData.length > 0 && (React.createElement(React.Fragment, null,
|
|
665
|
-
React.createElement(Text, { style: styles === null || styles === void 0 ? void 0 : styles.ticketHoldersTitle }, ((
|
|
683
|
+
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'),
|
|
666
684
|
renderTicketHolders())),
|
|
667
685
|
React.createElement(Button, { onPress: onSubmit, text: (texts === null || texts === void 0 ? void 0 : texts.checkoutButton) || 'CHECKOUT', isDisabled: !isDataValid, isLoading: isSubmittingData, styles: !isDataValid
|
|
668
686
|
? {
|
|
@@ -672,10 +690,10 @@ const Billing = ({ styles, texts, cartProps: { isAgeRequired, isNameRequired, is
|
|
|
672
690
|
: {
|
|
673
691
|
container: [
|
|
674
692
|
s.submitButton,
|
|
675
|
-
(
|
|
693
|
+
(_w = styles === null || styles === void 0 ? void 0 : styles.checkoutButton) === null || _w === void 0 ? void 0 : _w.container,
|
|
676
694
|
],
|
|
677
|
-
text: (
|
|
678
|
-
button: (
|
|
695
|
+
text: (_x = styles === null || styles === void 0 ? void 0 : styles.checkoutButton) === null || _x === void 0 ? void 0 : _x.text,
|
|
696
|
+
button: (_y = styles === null || styles === void 0 ? void 0 : styles.checkoutButton) === null || _y === void 0 ? void 0 : _y.button,
|
|
679
697
|
} })),
|
|
680
698
|
areLoadingIndicatorsEnabled && isLoading && React.createElement(Loading, null)));
|
|
681
699
|
//#endregion
|