tf-checkout-react-native 1.0.18 → 1.0.21
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 +1000 -21
- package/lib/api/ApiClient.d.ts +16 -36
- package/lib/api/ApiClient.js +140 -40
- 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 +117 -22
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.js +3 -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/radioButton/RadioButton.d.ts +4 -0
- package/lib/components/radioButton/RadioButton.js +9 -0
- package/lib/components/radioButton/RadioButton.js.map +1 -0
- package/lib/components/radioButton/styles.d.ts +24 -0
- package/lib/components/radioButton/styles.js +30 -0
- package/lib/components/radioButton/styles.js.map +1 -0
- package/lib/components/radioButton/types.d.ts +15 -0
- package/lib/components/radioButton/types.js +2 -0
- package/lib/components/radioButton/types.js.map +1 -0
- 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 +67 -69
- package/lib/containers/checkout/Checkout.js.map +1 -1
- package/lib/containers/checkout/types.d.ts +1 -1
- package/lib/containers/index.d.ts +1 -0
- package/lib/containers/index.js +1 -0
- package/lib/containers/index.js.map +1 -1
- package/lib/containers/myOrderDetails/MyOrderDetails.js +50 -4
- package/lib/containers/myOrderDetails/MyOrderDetails.js.map +1 -1
- package/lib/containers/myOrderDetails/MyOrderDetailsView.d.ts +2 -2
- package/lib/containers/myOrderDetails/MyOrderDetailsView.js +69 -47
- package/lib/containers/myOrderDetails/MyOrderDetailsView.js.map +1 -1
- package/lib/containers/myOrderDetails/types.d.ts +101 -77
- 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 +4 -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/resaleTickets/ResaleTickets.d.ts +4 -0
- package/lib/containers/resaleTickets/ResaleTickets.js +149 -0
- package/lib/containers/resaleTickets/ResaleTickets.js.map +1 -0
- package/lib/containers/resaleTickets/ResaleTicketsView.d.ts +4 -0
- package/lib/containers/resaleTickets/ResaleTicketsView.js +182 -0
- package/lib/containers/resaleTickets/ResaleTicketsView.js.map +1 -0
- package/lib/containers/resaleTickets/types.d.ts +128 -0
- package/lib/containers/resaleTickets/types.js +11 -0
- package/lib/containers/resaleTickets/types.js.map +1 -0
- 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/OrderDetailsCore/OrderDetailsCore.d.ts +5 -0
- package/lib/core/OrderDetailsCore/OrderDetailsCore.js +15 -0
- package/lib/core/OrderDetailsCore/OrderDetailsCore.js.map +1 -0
- package/lib/core/OrderDetailsCore/OrderDetailsCoreTypes.d.ts +7 -0
- package/lib/core/OrderDetailsCore/OrderDetailsCoreTypes.js +2 -0
- package/lib/core/OrderDetailsCore/OrderDetailsCoreTypes.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 +16 -0
- package/lib/core/index.js +9 -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 +5 -3
- package/lib/index.js +4 -2
- 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 +13 -6
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Configure [ReactNative environment](https://reactnative.dev/docs/environment-set
|
|
|
9
9
|
### React Native
|
|
10
10
|
|
|
11
11
|
- Suggested ReactNative version `0.66.3`
|
|
12
|
-
- Suggested Flipper version `0.
|
|
12
|
+
- Suggested Flipper version `0.99.0`
|
|
13
13
|
- React version `0.17.1`
|
|
14
14
|
|
|
15
15
|
### Android
|
|
@@ -57,6 +57,24 @@ npm install tf-checkout-react-native
|
|
|
57
57
|
|
|
58
58
|
Make sure to install all the required dependencies in your project.
|
|
59
59
|
|
|
60
|
+
### Metro
|
|
61
|
+
Add the following to your `metro.config.js` in the resolver property:
|
|
62
|
+
|
|
63
|
+
`sourceExts: ['jsx', 'js', 'ts', 'tsx']`
|
|
64
|
+
|
|
65
|
+
Result:
|
|
66
|
+
````js
|
|
67
|
+
module.exports = {
|
|
68
|
+
watchFolders: [moduleRoot],
|
|
69
|
+
resolver: {
|
|
70
|
+
sourceExts: ['jsx', 'js', 'ts', 'tsx'],
|
|
71
|
+
extraNodeModules: {
|
|
72
|
+
react: path.resolve(__dirname,
|
|
73
|
+
}
|
|
74
|
+
....
|
|
75
|
+
````
|
|
76
|
+
|
|
77
|
+
|
|
60
78
|
### Required for Android
|
|
61
79
|
|
|
62
80
|
Add below dependency to your `app/build.gradle` file with specified version (in our example we are using `1.4.0`).
|
|
@@ -77,15 +95,16 @@ Set appropriate style in your styles.xml file.
|
|
|
77
95
|
|
|
78
96
|
Import the function from the library.
|
|
79
97
|
|
|
80
|
-
```
|
|
98
|
+
```ts
|
|
81
99
|
import { setConfig } from 'tf-checkout-react-native'
|
|
82
100
|
```
|
|
83
101
|
|
|
84
102
|
Use it in your initial useEffect function:
|
|
85
103
|
|
|
86
|
-
```
|
|
104
|
+
```ts
|
|
87
105
|
useEffect(() => {
|
|
88
106
|
setConfig({
|
|
107
|
+
EVENT_ID: '4344',
|
|
89
108
|
DOMAIN: 'https://yourdomain.mx',
|
|
90
109
|
})
|
|
91
110
|
}, [])
|
|
@@ -93,20 +112,22 @@ useEffect(() => {
|
|
|
93
112
|
|
|
94
113
|
`setConfig` set your event's configuration, with the following options:
|
|
95
114
|
|
|
96
|
-
|
|
115
|
+
````ts
|
|
97
116
|
{
|
|
117
|
+
EVENT_ID: string,
|
|
98
118
|
DOMAIN?: string,
|
|
99
|
-
ENV?:
|
|
119
|
+
ENV?: 'PROD' | 'DEV' | 'STAG',
|
|
100
120
|
CLIENT_ID?: string,
|
|
101
121
|
CLIENT_SECRET?: string,
|
|
102
122
|
TIMEOUT?: number,
|
|
103
123
|
BRAND?: string,
|
|
104
124
|
ARE_SUB_BRANDS_INCLUDED?: boolean
|
|
105
125
|
}
|
|
106
|
-
|
|
126
|
+
````
|
|
107
127
|
### Props
|
|
108
128
|
| Property | Description |
|
|
109
129
|
| -------- | ----------- |
|
|
130
|
+
| EVENT_ID | Specify the event's ID. |
|
|
110
131
|
| DOMAIN | Specify your domains name example: `https://google.com` this is important to maintain cart session active and prevent it from expiring when user login in the BillingInfo component. |
|
|
111
132
|
| ENV | Sets the environment to any of the following environments: Production, Staging or Development. Receives the following values: `PROD`, `DEV`, `STAG`. Defaults to `PROD`.|
|
|
112
133
|
| CLIENT_ID | Set your CLIENT_ID. |
|
|
@@ -161,9 +182,13 @@ Will show the purchased orders for the logged user.
|
|
|
161
182
|
|
|
162
183
|
Will show the details for the selected Order, it also allows the user to download the Ticket PDF.
|
|
163
184
|
|
|
185
|
+
### Tickets Resale
|
|
186
|
+
|
|
187
|
+
Let the user to resale their tickets. They can choose between selling them to a friend or to any other user.
|
|
188
|
+
|
|
164
189
|
# Component styling
|
|
165
190
|
### Button
|
|
166
|
-
```
|
|
191
|
+
```ts
|
|
167
192
|
interface IButtonStyles {
|
|
168
193
|
container?: StyleProp<ViewStyle>
|
|
169
194
|
button?: StyleProp<ViewStyle>
|
|
@@ -171,7 +196,7 @@ interface IButtonStyles {
|
|
|
171
196
|
}
|
|
172
197
|
```
|
|
173
198
|
### Input
|
|
174
|
-
```
|
|
199
|
+
```ts
|
|
175
200
|
interface IInputStyles {
|
|
176
201
|
color?: ColorValue
|
|
177
202
|
container?: StyleProp<ViewStyle>
|
|
@@ -182,18 +207,59 @@ interface IInputStyles {
|
|
|
182
207
|
errorColor?: ColorValue
|
|
183
208
|
}
|
|
184
209
|
```
|
|
210
|
+
|
|
211
|
+
### Checkbox
|
|
212
|
+
|
|
213
|
+
```ts
|
|
214
|
+
interface ICheckboxStyles {
|
|
215
|
+
container?: StyleProp<ViewStyle>
|
|
216
|
+
content?: StyleProp<ViewStyle>
|
|
217
|
+
indicator?: StyleProp<ViewStyle>
|
|
218
|
+
indicatorDisabled?: StyleProp<ViewStyle>
|
|
219
|
+
text?: StyleProp<TextStyle>
|
|
220
|
+
box?: StyleProp<ViewStyle>
|
|
221
|
+
icon?: StyleProp<ImageStyle>
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
|
|
185
226
|
# Exported components
|
|
186
|
-
|
|
227
|
+
Depending on your needs, you can use the UI Components or the Core Components.
|
|
228
|
+
|
|
229
|
+
[UI Components](#ui-components) use the Core Components at their core but also exposes an UI that you can configure with your own styles. There is no need to create any kind of logic with them, only setConfig and implement the callbacks to get their data.
|
|
230
|
+
|
|
231
|
+
[Core Components](#core-components) are wrappers that don't include any UI neither validation logics, they only act as a Middleware to retrieve and send data from the server and return it to your implementation components. They are useful when your design cannot be achieved by the UI components. You will need to use references to access their exposed functions.
|
|
232
|
+
|
|
233
|
+
# UI Components
|
|
234
|
+
|
|
235
|
+
[Login](#login-ui)
|
|
236
|
+
|
|
237
|
+
[Tickets](#tickets-ui)
|
|
238
|
+
|
|
239
|
+
[BillingInfo](#billinginfo-ui)
|
|
240
|
+
|
|
241
|
+
[Checkout](#checkout-ui)
|
|
242
|
+
|
|
243
|
+
[Purchase Confirmation](#purchase-confirmation-ui)
|
|
244
|
+
|
|
245
|
+
[My Orders](#my-orders-ui)
|
|
246
|
+
|
|
247
|
+
[My Order Details](#myorder-details-ui)
|
|
248
|
+
|
|
249
|
+
[Resale](#resale-tickets-ui)
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
## Login UI
|
|
187
253
|
|
|
188
254
|
Import the component from the library
|
|
189
255
|
|
|
190
|
-
```
|
|
256
|
+
```tsx
|
|
191
257
|
import { Login } from 'tf-checkout-react-native'
|
|
192
258
|
```
|
|
193
259
|
|
|
194
260
|
Then add it to the render function.
|
|
195
261
|
|
|
196
|
-
```
|
|
262
|
+
```tsx
|
|
197
263
|
<Login
|
|
198
264
|
onLoginSuccessful: (userProfile: IUserProfile, accessToken: string) => void
|
|
199
265
|
onLoginError?: (error: IError) => void
|
|
@@ -311,8 +377,7 @@ interface ILoginViewStyles {
|
|
|
311
377
|
|
|
312
378
|
```
|
|
313
379
|
---
|
|
314
|
-
|
|
315
|
-
## Tickets
|
|
380
|
+
## Tickets UI
|
|
316
381
|
|
|
317
382
|
Import the component from the library
|
|
318
383
|
|
|
@@ -523,7 +588,7 @@ You can then call the `BillingInfo` component and pass them as props in the `car
|
|
|
523
588
|
}
|
|
524
589
|
```
|
|
525
590
|
---
|
|
526
|
-
## BillingInfo
|
|
591
|
+
## BillingInfo UI
|
|
527
592
|
|
|
528
593
|
Import the component from the library
|
|
529
594
|
|
|
@@ -557,7 +622,6 @@ Add it to the render function.
|
|
|
557
622
|
onLoginSuccess: (data: any) => void
|
|
558
623
|
onLoginError?: (error: IError) => void
|
|
559
624
|
|
|
560
|
-
|
|
561
625
|
onFetchUserProfileSuccess?: (data: any) => void
|
|
562
626
|
onFetchUserProfileError?: (error: IError) => void
|
|
563
627
|
|
|
@@ -623,6 +687,7 @@ interface IBillingInfoViewTexts {
|
|
|
623
687
|
loginTexts?: ILoginViewTexts
|
|
624
688
|
checkoutButton?: string
|
|
625
689
|
skippingMessage?: string
|
|
690
|
+
invalidPhoneNumberError?: string
|
|
626
691
|
form?: {
|
|
627
692
|
firstName?: string
|
|
628
693
|
lastName?: string
|
|
@@ -648,6 +713,10 @@ interface IBillingInfoViewTexts {
|
|
|
648
713
|
emailsAdvice?: string
|
|
649
714
|
choosePassword?: string
|
|
650
715
|
optional?: string
|
|
716
|
+
phoneInput?: {
|
|
717
|
+
label?: string
|
|
718
|
+
customError?: string
|
|
719
|
+
}
|
|
651
720
|
}
|
|
652
721
|
}
|
|
653
722
|
```
|
|
@@ -692,12 +761,21 @@ interface IBillingInfoViewStyles {
|
|
|
692
761
|
datePicker?: IDatePickerStyles
|
|
693
762
|
|
|
694
763
|
privacyPolicyLinkStyle?: StyleProp<TextStyle>
|
|
764
|
+
|
|
765
|
+
phoneInput?: {
|
|
766
|
+
rootContainer?: StyleProp<ViewStyle>
|
|
767
|
+
errorColor?: ColorValue
|
|
768
|
+
country?: {
|
|
769
|
+
container?: StyleProp<ViewStyle>
|
|
770
|
+
button?: StyleProp<ViewStyle>
|
|
771
|
+
}
|
|
772
|
+
input?: IInputStyles
|
|
773
|
+
}
|
|
695
774
|
}
|
|
696
775
|
```
|
|
697
|
-
|
|
698
776
|
---
|
|
699
777
|
|
|
700
|
-
## Checkout
|
|
778
|
+
## Checkout UI
|
|
701
779
|
|
|
702
780
|
Import the component from the library
|
|
703
781
|
|
|
@@ -819,7 +897,7 @@ Currently, Stripe card is not customizable. Please see the open issues in their
|
|
|
819
897
|
Additionally, if you are encountering problems with building your project, please take a look at the [Stripe troubleshooting](https://github.com/stripe/stripe-react-native#troubleshooting).
|
|
820
898
|
|
|
821
899
|
---
|
|
822
|
-
## Purchase Confirmation
|
|
900
|
+
## Purchase Confirmation UI
|
|
823
901
|
|
|
824
902
|
Import the component from the library
|
|
825
903
|
|
|
@@ -870,7 +948,7 @@ Add it to the render function.
|
|
|
870
948
|
|
|
871
949
|
|
|
872
950
|
---
|
|
873
|
-
## My Orders
|
|
951
|
+
## My Orders UI
|
|
874
952
|
If there is a valid session, there will appear a button to access `MyOrders` in the `Tickets` component.
|
|
875
953
|
|
|
876
954
|
Import the component from the library.
|
|
@@ -993,7 +1071,7 @@ import { MyOrders } from 'tf-checkout-react-native'
|
|
|
993
1071
|
|
|
994
1072
|
---
|
|
995
1073
|
|
|
996
|
-
## MyOrder Details
|
|
1074
|
+
## MyOrder Details UI
|
|
997
1075
|
|
|
998
1076
|
When user selects an order from the `MyOrders` component, will show it details.
|
|
999
1077
|
|
|
@@ -1007,7 +1085,7 @@ import { MyOrderDetails } from 'tf-checkout-react-native'
|
|
|
1007
1085
|
|
|
1008
1086
|
```js
|
|
1009
1087
|
{
|
|
1010
|
-
data:
|
|
1088
|
+
data: IMyOrderDetailsData
|
|
1011
1089
|
config?: {
|
|
1012
1090
|
areActivityIndicatorsEnabled?: boolean
|
|
1013
1091
|
areAlertsEnabled?: boolean
|
|
@@ -1098,7 +1176,908 @@ import { MyOrderDetails } from 'tf-checkout-react-native'
|
|
|
1098
1176
|
copy?: string
|
|
1099
1177
|
copied?: string
|
|
1100
1178
|
}
|
|
1179
|
+
sellTicket?: string
|
|
1180
|
+
removeTicketFromResale?: string
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
```
|
|
1184
|
+
|
|
1185
|
+
## Resale Tickets UI
|
|
1186
|
+
|
|
1187
|
+
Allows the user to resale the tickets they bought. They can decide wether sell it to a friend or to any other user.
|
|
1188
|
+
|
|
1189
|
+
|
|
1190
|
+
Import the component from the library.
|
|
1191
|
+
|
|
1192
|
+
```js
|
|
1193
|
+
import { ResaleTickets } from 'tf-checkout-react-native'
|
|
1194
|
+
```
|
|
1195
|
+
|
|
1196
|
+
### Props
|
|
1197
|
+
|
|
1198
|
+
```ts
|
|
1199
|
+
{
|
|
1200
|
+
ticket: {
|
|
1201
|
+
currency: string
|
|
1202
|
+
description: string
|
|
1203
|
+
descriptionPlain?: string
|
|
1204
|
+
eventName: string
|
|
1205
|
+
hash: string
|
|
1206
|
+
holderEmail?: string
|
|
1207
|
+
holderName: string
|
|
1208
|
+
holderPhone?: string
|
|
1209
|
+
isOnSale: boolean
|
|
1210
|
+
isSellable: boolean
|
|
1211
|
+
pdfLink: string
|
|
1212
|
+
qrData: string
|
|
1213
|
+
resaleFeeAmount: number
|
|
1214
|
+
status: string
|
|
1215
|
+
ticketType: string
|
|
1216
|
+
}
|
|
1217
|
+
styles?: {
|
|
1218
|
+
rootContainer?: StyleProp<ViewStyle>
|
|
1219
|
+
title?: StyleProp<TextStyle>
|
|
1220
|
+
terms?: IResaleTermsStyles
|
|
1221
|
+
resaleTicketsButton?: IButtonStyles
|
|
1222
|
+
resaleTicketsButtonDisabled?: IButtonStyles
|
|
1223
|
+
resaleTicketsButtonLoading?: IButtonStyles
|
|
1224
|
+
ticketOrderDetails?: ITicketOrderDetailsStyles
|
|
1225
|
+
ticketBuyerForm?: ITicketBuyerFormStyles
|
|
1226
|
+
termsCheckbox?: ICheckboxStyles
|
|
1227
|
+
}
|
|
1228
|
+
onResaleTicketsSuccess: (
|
|
1229
|
+
resaleTicketData: {
|
|
1230
|
+
message: string
|
|
1231
|
+
},
|
|
1232
|
+
ticket: {
|
|
1233
|
+
currency: string
|
|
1234
|
+
description: string
|
|
1235
|
+
descriptionPlain?: string
|
|
1236
|
+
eventName: string
|
|
1237
|
+
hash: string
|
|
1238
|
+
holderEmail?: string
|
|
1239
|
+
holderName: string
|
|
1240
|
+
holderPhone?: string
|
|
1241
|
+
isOnSale: boolean
|
|
1242
|
+
isSellable: boolean
|
|
1243
|
+
pdfLink: string
|
|
1244
|
+
qrData: string
|
|
1245
|
+
resaleFeeAmount: number
|
|
1246
|
+
status: string
|
|
1247
|
+
ticketType: string
|
|
1248
|
+
}
|
|
1249
|
+
) => void
|
|
1250
|
+
onResaleTicketsError?: (error: {
|
|
1251
|
+
code?: number
|
|
1252
|
+
message: string
|
|
1253
|
+
extraData?: any
|
|
1254
|
+
}) => void
|
|
1255
|
+
config?: {
|
|
1256
|
+
areAlertsEnabled?: boolean
|
|
1257
|
+
areActivityIndicatorsEnabled?: boolean
|
|
1258
|
+
}
|
|
1259
|
+
texts?: {
|
|
1260
|
+
title?: string
|
|
1261
|
+
orderDetails?: {
|
|
1262
|
+
title?: string
|
|
1263
|
+
eventName?: string
|
|
1264
|
+
orderedBy?: string
|
|
1265
|
+
orderId?: string
|
|
1266
|
+
}
|
|
1267
|
+
sellToWhom?: {
|
|
1268
|
+
title?: string
|
|
1269
|
+
friend?: string
|
|
1270
|
+
anyone?: string
|
|
1271
|
+
}
|
|
1272
|
+
friendForm?: {
|
|
1273
|
+
firstName?: string
|
|
1274
|
+
lastName?: string
|
|
1275
|
+
email?: string
|
|
1276
|
+
emailConfirm?: string
|
|
1277
|
+
}
|
|
1278
|
+
terms?: {
|
|
1279
|
+
title?: string
|
|
1280
|
+
paragraph1?: string
|
|
1281
|
+
paragraph2_1?: string
|
|
1282
|
+
paragraph2_2?: string
|
|
1283
|
+
paragraph3_1?: string
|
|
1284
|
+
paragraph3_2?: string
|
|
1285
|
+
}
|
|
1286
|
+
agree?: string
|
|
1287
|
+
resaleTicketsButton?: string
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
```
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
# Core Components
|
|
1296
|
+
**⚠️ Remember that you first need to set your configuration using the [setConfig](#set-your-configuration)
|
|
1297
|
+
function. ⚠️**
|
|
1298
|
+
|
|
1299
|
+
### Index
|
|
1300
|
+
|
|
1301
|
+
[TicketsCore](#ticketscore)
|
|
1302
|
+
|
|
1303
|
+
[WaitingListCore](#waitinglistcore)
|
|
1304
|
+
|
|
1305
|
+
[BillingCore](#billingcore)
|
|
1306
|
+
|
|
1307
|
+
[CheckoutCore](#checkoutcore)
|
|
1308
|
+
|
|
1309
|
+
[PurchaseConfirmationCore](#purchaseconfirmationcore)
|
|
1310
|
+
|
|
1311
|
+
[MyOrdersCore](#myorderscore)
|
|
1312
|
+
|
|
1313
|
+
[OrderDetailsCore](#orderdetailscore)
|
|
1314
|
+
|
|
1315
|
+
[LoginCore](#logincore)
|
|
1316
|
+
|
|
1317
|
+
---
|
|
1318
|
+
|
|
1319
|
+
## TicketsCore
|
|
1320
|
+
This is the initial component to show. It will retrieve the tickets, event, present My Orders and Logout buttons if the user is logged in, and will add the selected tickets to the cart.
|
|
1321
|
+
|
|
1322
|
+
Exposes the following functions:
|
|
1323
|
+
|
|
1324
|
+
`getTickets` Fetches the tickets from the event set in the config function. It receives a promoCode parameter to apply to the tickets.
|
|
1325
|
+
|
|
1326
|
+
`getEvent` Fetches the event from the eventId set in the config function.
|
|
1327
|
+
|
|
1328
|
+
`addToCart` Adds the selected tickets to the cart.
|
|
1329
|
+
|
|
1330
|
+
```js
|
|
1331
|
+
{
|
|
1332
|
+
// Fetches the tickets from the event set in the config function. It receives a promoCode parameter to apply to the tickets.
|
|
1333
|
+
getTickets(promoCode?: string): Promise<{
|
|
1334
|
+
tickets?: {
|
|
1335
|
+
sortOrder: number
|
|
1336
|
+
displayTicket?: boolean
|
|
1337
|
+
salesEnded: boolean
|
|
1338
|
+
salesStarted: boolean
|
|
1339
|
+
id: string
|
|
1340
|
+
displayName: string
|
|
1341
|
+
optionName: string
|
|
1342
|
+
optionValue: string
|
|
1343
|
+
isTable: string
|
|
1344
|
+
feeIncluded: boolean
|
|
1345
|
+
price: number
|
|
1346
|
+
basePrice: number
|
|
1347
|
+
chosen: number
|
|
1348
|
+
priceCurrency: string
|
|
1349
|
+
priceSymbol: string
|
|
1350
|
+
taxesIncluded: boolean
|
|
1351
|
+
taxName: string
|
|
1352
|
+
minQuantity: number
|
|
1353
|
+
maxQuantity: number
|
|
1354
|
+
multiplier: number
|
|
1355
|
+
tags: []
|
|
1356
|
+
allowMultiplePurchases: number
|
|
1357
|
+
priceReplacementText: string
|
|
1358
|
+
waitingListEnabled: boolean
|
|
1359
|
+
soldOut?: boolean
|
|
1360
|
+
soldOutMessage: string
|
|
1361
|
+
minGuests?: number
|
|
1362
|
+
maxGuests?: number
|
|
1363
|
+
buyButtonText?: string
|
|
1364
|
+
totalStock: number
|
|
1365
|
+
guestPrice?: number
|
|
1366
|
+
alwaysAvailable: string
|
|
1367
|
+
feeText: string
|
|
1368
|
+
x_face_value: number
|
|
1369
|
+
sold_out?: boolean
|
|
1370
|
+
oldPrice?: number
|
|
1371
|
+
oldBasePrice?: number
|
|
1372
|
+
descriptionRich?: string
|
|
1373
|
+
}[]
|
|
1374
|
+
error?: {
|
|
1375
|
+
code?: number
|
|
1376
|
+
message: string
|
|
1377
|
+
extraData?: any
|
|
1378
|
+
}
|
|
1379
|
+
promoCodeResult?: {
|
|
1380
|
+
isValid: boolean | number
|
|
1381
|
+
message: string
|
|
1382
|
+
}
|
|
1383
|
+
isInWaitingList?: boolean
|
|
1384
|
+
isAccessCodeRequired?: boolean
|
|
1385
|
+
}>
|
|
1386
|
+
|
|
1387
|
+
// Fetches the event from the eventId set in the config function.
|
|
1388
|
+
getEvent(): Promise<{
|
|
1389
|
+
eventError?: {
|
|
1390
|
+
code?: number
|
|
1391
|
+
message: string
|
|
1392
|
+
extraData?: any
|
|
1393
|
+
}
|
|
1394
|
+
eventData?: {
|
|
1395
|
+
passwordProtected: boolean
|
|
1396
|
+
passwordAuthenticated: boolean
|
|
1397
|
+
name: string
|
|
1398
|
+
description?: string
|
|
1399
|
+
slug: string
|
|
1400
|
+
redirectUrl?: string
|
|
1401
|
+
facebookEvent?: string
|
|
1402
|
+
title: string
|
|
1403
|
+
relatedProducts: []
|
|
1404
|
+
country: string
|
|
1405
|
+
date: string
|
|
1406
|
+
startDate: string
|
|
1407
|
+
endDate: string
|
|
1408
|
+
timezone: string
|
|
1409
|
+
formattedDate: string
|
|
1410
|
+
venueCountry: string
|
|
1411
|
+
venueCity?: string
|
|
1412
|
+
venueState?: string
|
|
1413
|
+
hideVenueUntil?: string
|
|
1414
|
+
hideVenue?: boolean
|
|
1415
|
+
venueName?: string
|
|
1416
|
+
venueGooglePlaceId?: string
|
|
1417
|
+
venueLatitude?: string
|
|
1418
|
+
venueLongitude?: string
|
|
1419
|
+
venuePostalCode?: string
|
|
1420
|
+
venueStreet?: string
|
|
1421
|
+
venueStreetNumber?: string
|
|
1422
|
+
eventType: any
|
|
1423
|
+
productImage: string
|
|
1424
|
+
imageUrl: string
|
|
1425
|
+
imageUrlHd: string
|
|
1426
|
+
backgroundImage: string
|
|
1427
|
+
backgroundVideo?: string
|
|
1428
|
+
twitterImage?: string
|
|
1429
|
+
ogImage?: string
|
|
1430
|
+
tags: []
|
|
1431
|
+
preregEnabled: boolean
|
|
1432
|
+
presalesStarted: boolean
|
|
1433
|
+
presalesEnded: boolean
|
|
1434
|
+
salesStart?: string
|
|
1435
|
+
salesEnd: string
|
|
1436
|
+
salesStarted: boolean
|
|
1437
|
+
salesEnded: boolean
|
|
1438
|
+
feeMode: string
|
|
1439
|
+
feesIncluded?: any
|
|
1440
|
+
minimumAge?: any
|
|
1441
|
+
enableWaitingList: boolean
|
|
1442
|
+
alwaysShowWaitingList?: any
|
|
1443
|
+
titleReplacementImage?: any
|
|
1444
|
+
titleReplacementHeight?: any
|
|
1445
|
+
titleReplacementImageSvg?: any
|
|
1446
|
+
fullTitleReplacement?: any
|
|
1447
|
+
affirmAllowed: boolean
|
|
1448
|
+
subHeading?: any
|
|
1449
|
+
isTimeSlotEvent: boolean
|
|
1450
|
+
preregistered: []
|
|
1451
|
+
referralsEnabled: boolean
|
|
1452
|
+
referrals: []
|
|
1453
|
+
faq: []
|
|
1454
|
+
l10nLanguages: []
|
|
1455
|
+
imageURLs: any
|
|
1456
|
+
descriptions: any
|
|
1457
|
+
}
|
|
1458
|
+
}>
|
|
1459
|
+
|
|
1460
|
+
// Adds selected tickets to the cart.
|
|
1461
|
+
addToCart(
|
|
1462
|
+
options: {
|
|
1463
|
+
optionName: string
|
|
1464
|
+
ticketId: string
|
|
1465
|
+
quantity: number
|
|
1466
|
+
price: number
|
|
1467
|
+
}
|
|
1468
|
+
): Promise<{
|
|
1469
|
+
error?: {
|
|
1470
|
+
code?: number
|
|
1471
|
+
message: string
|
|
1472
|
+
extraData?: any
|
|
1473
|
+
}
|
|
1474
|
+
data?: {
|
|
1475
|
+
isBillingRequired: boolean
|
|
1476
|
+
isPhoneRequired?: boolean
|
|
1477
|
+
isAgeRequired?: boolean
|
|
1478
|
+
minimumAge?: number
|
|
1479
|
+
isNameRequired?: boolean
|
|
1480
|
+
}
|
|
1481
|
+
}>
|
|
1482
|
+
}
|
|
1483
|
+
```
|
|
1484
|
+
|
|
1485
|
+
Import the component from the library
|
|
1486
|
+
|
|
1487
|
+
```js
|
|
1488
|
+
import {
|
|
1489
|
+
TicketsCore
|
|
1490
|
+
TicketsCoreHandle // You can import the Handle to use it as type in the useRef hook
|
|
1491
|
+
|
|
1492
|
+
} from 'tf-checkout-react-native'
|
|
1493
|
+
```
|
|
1494
|
+
|
|
1495
|
+
Declare a reference to pass it to the component.
|
|
1496
|
+
|
|
1497
|
+
```js
|
|
1498
|
+
const ticketsCoreRef = useRef<TicketsCoreHandle>(null)
|
|
1499
|
+
```
|
|
1500
|
+
|
|
1501
|
+
Then add it to the render function and assign the reference to the corresponding component.
|
|
1502
|
+
|
|
1503
|
+
```js
|
|
1504
|
+
<TicketsCore ref={ticketsCoreRef}>
|
|
1505
|
+
<YourComponent />
|
|
1506
|
+
</TicketsCore>
|
|
1507
|
+
```
|
|
1508
|
+
|
|
1509
|
+
Use the reference to access the component methods.
|
|
1510
|
+
|
|
1511
|
+
```js
|
|
1512
|
+
const handleGetTickets = async () => {
|
|
1513
|
+
const res = await ticketsCoreRef.current.getTickets()
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
```
|
|
1517
|
+
|
|
1518
|
+
## WaitingListCore
|
|
1519
|
+
This component *must* appear after getting the response from **getTickets()** and the property `isInWaitingList` is set to true.
|
|
1520
|
+
|
|
1521
|
+
|
|
1522
|
+
Exposes the following functions:
|
|
1523
|
+
```js
|
|
1524
|
+
{
|
|
1525
|
+
addToWaitingList(
|
|
1526
|
+
params: {
|
|
1527
|
+
firstName: string
|
|
1528
|
+
lastName: string
|
|
1529
|
+
email: string
|
|
1530
|
+
}
|
|
1531
|
+
): Promise<{
|
|
1532
|
+
addToWaitingListError?: {
|
|
1533
|
+
code?: number
|
|
1534
|
+
message: string
|
|
1535
|
+
extraData?: any
|
|
1536
|
+
}
|
|
1537
|
+
addToWaitingListData?: {
|
|
1538
|
+
error: boolean
|
|
1539
|
+
message: string
|
|
1540
|
+
status: number
|
|
1541
|
+
success: boolean
|
|
1542
|
+
}
|
|
1543
|
+
}>
|
|
1544
|
+
}
|
|
1545
|
+
```
|
|
1546
|
+
**addToWaitingList** Receives params with the following properties:
|
|
1547
|
+
```js
|
|
1548
|
+
firstName: string
|
|
1549
|
+
lastName: string
|
|
1550
|
+
email: string
|
|
1551
|
+
```
|
|
1552
|
+
|
|
1553
|
+
And returns a Promise with the following object:
|
|
1554
|
+
|
|
1555
|
+
```js
|
|
1556
|
+
{
|
|
1557
|
+
addToWaitingListError?: {
|
|
1558
|
+
code?: number // If it was a server error, this will be the error code
|
|
1559
|
+
message: string //Error message that you could use it in your UI
|
|
1560
|
+
extraData?: any // If there is a relevant extra data, it will be returned here
|
|
1561
|
+
}
|
|
1562
|
+
addToWaitingListData?: {
|
|
1563
|
+
error: boolean // If there was an error, this will be true
|
|
1564
|
+
message: string // message that you could use it in your UI, could be due an error or a success message
|
|
1565
|
+
status: number // Status code
|
|
1566
|
+
success: boolean // If there was no error, this will be true
|
|
1101
1567
|
}
|
|
1102
1568
|
}
|
|
1103
1569
|
```
|
|
1104
1570
|
|
|
1571
|
+
Import the component from the library
|
|
1572
|
+
|
|
1573
|
+
```js
|
|
1574
|
+
import {
|
|
1575
|
+
WaitingListCore
|
|
1576
|
+
WaitingListCoreHandle // You can import the Handle to use as type it in the useRef hook
|
|
1577
|
+
} from 'tf-checkout-react-native'
|
|
1578
|
+
```
|
|
1579
|
+
|
|
1580
|
+
Declare a reference to pass it to the component.
|
|
1581
|
+
|
|
1582
|
+
```js
|
|
1583
|
+
const waitingListCoreRef = useRef<WaitingListCoreHandle>(null)
|
|
1584
|
+
```
|
|
1585
|
+
|
|
1586
|
+
Then add it to the render function and assign the reference to the corresponding component.
|
|
1587
|
+
|
|
1588
|
+
```js
|
|
1589
|
+
<WaitingListCore ref={waitingListCoreRef}>
|
|
1590
|
+
<YourComponent />
|
|
1591
|
+
</WaitingListCore>
|
|
1592
|
+
```
|
|
1593
|
+
|
|
1594
|
+
Use the reference to access the component methods.
|
|
1595
|
+
|
|
1596
|
+
```js
|
|
1597
|
+
const handleAddToWaitingList = async (params: IAddToWaitingListCoreParams) => {
|
|
1598
|
+
const res = await waitingListCoreRef.current.addToWaitingList(params)
|
|
1599
|
+
}
|
|
1600
|
+
```
|
|
1601
|
+
|
|
1602
|
+
## BillingCore
|
|
1603
|
+
This component collects user's billing information and checks the order out. If the entered user data is already in the system it will perform checkout, other wise it will perform a registration and then the checkout.
|
|
1604
|
+
|
|
1605
|
+
Exposes the following functions:
|
|
1606
|
+
|
|
1607
|
+
`getCart` Fetches the current cart information, needed to know how many ticket holders data is needed.
|
|
1608
|
+
|
|
1609
|
+
`getCountries` Fetches the countries list.
|
|
1610
|
+
|
|
1611
|
+
`getStates` Fetches the states list.
|
|
1612
|
+
|
|
1613
|
+
`getUserProfile` Fetches the user profile information.
|
|
1614
|
+
|
|
1615
|
+
`registerNewUser` Registers a new user.
|
|
1616
|
+
|
|
1617
|
+
`checkoutOrder` Performs the checkout.
|
|
1618
|
+
|
|
1619
|
+
|
|
1620
|
+
```ts
|
|
1621
|
+
{
|
|
1622
|
+
// Fetches the current cart information, needed to know how many ticket holders data is needed.
|
|
1623
|
+
getCart(): Promise<{
|
|
1624
|
+
cartError?: {
|
|
1625
|
+
code?: number
|
|
1626
|
+
message: string
|
|
1627
|
+
extraData?: any
|
|
1628
|
+
}
|
|
1629
|
+
cartData?: {
|
|
1630
|
+
quantity: number
|
|
1631
|
+
isTfOptInHidden?: boolean
|
|
1632
|
+
isTfOptIn: boolean // Ticket fairy
|
|
1633
|
+
isMarketingOptedIn: boolean // Brand
|
|
1634
|
+
}
|
|
1635
|
+
}>
|
|
1636
|
+
|
|
1637
|
+
// Performs the checkout.
|
|
1638
|
+
checkoutOrder(body: ICheckoutBody): Promise<{
|
|
1639
|
+
error?: {
|
|
1640
|
+
code?: number
|
|
1641
|
+
message: string
|
|
1642
|
+
extraData?: any
|
|
1643
|
+
}
|
|
1644
|
+
data?: {
|
|
1645
|
+
id: string
|
|
1646
|
+
hash: string
|
|
1647
|
+
total: string
|
|
1648
|
+
status: string
|
|
1649
|
+
}
|
|
1650
|
+
}>
|
|
1651
|
+
|
|
1652
|
+
// Fetches the country list.
|
|
1653
|
+
getCountries(): Promise<{
|
|
1654
|
+
countriesError?: {
|
|
1655
|
+
code?: number
|
|
1656
|
+
message: string
|
|
1657
|
+
extraData?: any
|
|
1658
|
+
}
|
|
1659
|
+
countriesData?: {
|
|
1660
|
+
[key: number | string]: string
|
|
1661
|
+
}
|
|
1662
|
+
}>
|
|
1663
|
+
|
|
1664
|
+
// Fetches the states list.
|
|
1665
|
+
getStates(countryId: string): Promise<{
|
|
1666
|
+
statesError?: {
|
|
1667
|
+
code?: number
|
|
1668
|
+
message: string
|
|
1669
|
+
extraData?: any
|
|
1670
|
+
}
|
|
1671
|
+
statesData?: {
|
|
1672
|
+
[key: number | string]: string
|
|
1673
|
+
}
|
|
1674
|
+
}>
|
|
1675
|
+
|
|
1676
|
+
// Fetches the user profile information.
|
|
1677
|
+
getUserProfile(): Promise<{
|
|
1678
|
+
userProfileError?: {
|
|
1679
|
+
code?: number
|
|
1680
|
+
message: string
|
|
1681
|
+
extraData?: any
|
|
1682
|
+
}
|
|
1683
|
+
userProfileData?: {
|
|
1684
|
+
customerId: string
|
|
1685
|
+
firstName: string
|
|
1686
|
+
lastName: string
|
|
1687
|
+
email: string
|
|
1688
|
+
phone: string
|
|
1689
|
+
streetAddress: string
|
|
1690
|
+
zipCode: string
|
|
1691
|
+
countryId: string
|
|
1692
|
+
company?: string
|
|
1693
|
+
state: string
|
|
1694
|
+
stateId: string
|
|
1695
|
+
city: string
|
|
1696
|
+
}
|
|
1697
|
+
}>
|
|
1698
|
+
|
|
1699
|
+
// Registers a new user.
|
|
1700
|
+
registerNewUser(data: FormData): Promise<{
|
|
1701
|
+
error?: {
|
|
1702
|
+
isAlreadyRegistered?: boolean
|
|
1703
|
+
message?: string
|
|
1704
|
+
raw?: any
|
|
1705
|
+
}
|
|
1706
|
+
data?: {
|
|
1707
|
+
token_type: string
|
|
1708
|
+
scope: string
|
|
1709
|
+
user_profile: {
|
|
1710
|
+
first_name: string
|
|
1711
|
+
last_name: string
|
|
1712
|
+
email: string
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
}>
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
```
|
|
1719
|
+
|
|
1720
|
+
## CheckoutCore
|
|
1721
|
+
Shows the event conditions, purchase details and process the payment and free registration to an event.
|
|
1722
|
+
|
|
1723
|
+
You will need to install and use the [ReactNative Stripe SDK](https://github.com/stripe/stripe-react-native) (we recommend version 0.2.3). Follow their documentation to implement it. Our backend is already prepared to process the payments.
|
|
1724
|
+
|
|
1725
|
+
Remember that you will need the `publishableKey`.
|
|
1726
|
+
|
|
1727
|
+
After you collect the card information and call the `confirmPayment` function, you will need to call the `paymentSuccess` function to complete the payment.
|
|
1728
|
+
|
|
1729
|
+
|
|
1730
|
+
Exposes the following functions:
|
|
1731
|
+
|
|
1732
|
+
`getEventConditions` Get event conditions for the current event.
|
|
1733
|
+
|
|
1734
|
+
`getPurchaseOrderDetails` Get purchase order details for the current event.
|
|
1735
|
+
|
|
1736
|
+
`getOrderReview` Get order review for the current event.
|
|
1737
|
+
|
|
1738
|
+
`freeRegistration` Free registration to an event.
|
|
1739
|
+
|
|
1740
|
+
`paymentSuccess` Payment success.
|
|
1741
|
+
|
|
1742
|
+
|
|
1743
|
+
```ts
|
|
1744
|
+
// Get event conditions for the current event.
|
|
1745
|
+
getEventConditions(eventId: string): Promise<any>
|
|
1746
|
+
|
|
1747
|
+
// Get purchase order details for the current event.
|
|
1748
|
+
getPurchaseOrderDetails(orderId: string): Promise<{
|
|
1749
|
+
orderDetailsError?: {
|
|
1750
|
+
code?: number
|
|
1751
|
+
message: string
|
|
1752
|
+
extraData?: any
|
|
1753
|
+
}
|
|
1754
|
+
orderDetailsData?: {
|
|
1755
|
+
header: {
|
|
1756
|
+
isReferralDisabled: boolean
|
|
1757
|
+
shareLink: string
|
|
1758
|
+
total: string
|
|
1759
|
+
salesReferred: string
|
|
1760
|
+
}
|
|
1761
|
+
items: {
|
|
1762
|
+
isActive: boolean
|
|
1763
|
+
currency: string
|
|
1764
|
+
discount: string
|
|
1765
|
+
name: string
|
|
1766
|
+
price: string
|
|
1767
|
+
quantity: string
|
|
1768
|
+
total: string
|
|
1769
|
+
}[]
|
|
1770
|
+
tickets: {
|
|
1771
|
+
currency: string
|
|
1772
|
+
description: string
|
|
1773
|
+
descriptionPlain?: string
|
|
1774
|
+
eventName: string
|
|
1775
|
+
hash: string
|
|
1776
|
+
holderEmail?: string
|
|
1777
|
+
holderName: string
|
|
1778
|
+
holderPhone?: string
|
|
1779
|
+
isOnSale: boolean
|
|
1780
|
+
isSellable: true
|
|
1781
|
+
pdfLink: string
|
|
1782
|
+
qrData: string
|
|
1783
|
+
resaleFeeAmount: number
|
|
1784
|
+
status: string
|
|
1785
|
+
ticketType: string
|
|
1786
|
+
}[]
|
|
1787
|
+
}
|
|
1788
|
+
}>
|
|
1789
|
+
|
|
1790
|
+
// Get order review for the current event.
|
|
1791
|
+
getOrderReview(orderHash: string): Promise<{
|
|
1792
|
+
orderReviewError?: {
|
|
1793
|
+
code?: number
|
|
1794
|
+
message: string
|
|
1795
|
+
extraData?: any
|
|
1796
|
+
}
|
|
1797
|
+
orderReviewData?: {
|
|
1798
|
+
reviewData: {
|
|
1799
|
+
event: string
|
|
1800
|
+
price: string
|
|
1801
|
+
ticketType: string
|
|
1802
|
+
total: string
|
|
1803
|
+
numberOfTickets: string
|
|
1804
|
+
currency: string
|
|
1805
|
+
}
|
|
1806
|
+
paymentData: {
|
|
1807
|
+
id: string
|
|
1808
|
+
name: string
|
|
1809
|
+
stripeClientSecret?: string
|
|
1810
|
+
stripeConnectedAccount?: string
|
|
1811
|
+
stripePublishableKey?: string
|
|
1812
|
+
}
|
|
1813
|
+
addressData: {
|
|
1814
|
+
city: string
|
|
1815
|
+
line1: string
|
|
1816
|
+
state: string
|
|
1817
|
+
postalCode: string
|
|
1818
|
+
}
|
|
1819
|
+
billingData: {
|
|
1820
|
+
firstName: string
|
|
1821
|
+
lastName: string
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
}>
|
|
1825
|
+
|
|
1826
|
+
// Free registration to an event.
|
|
1827
|
+
freeRegistration(orderHash: string): Promise<{
|
|
1828
|
+
freeRegistrationError?: {
|
|
1829
|
+
code?: number
|
|
1830
|
+
message: string
|
|
1831
|
+
extraData?: any
|
|
1832
|
+
}
|
|
1833
|
+
freeRegistrationData?: {
|
|
1834
|
+
id: string
|
|
1835
|
+
customerId: string
|
|
1836
|
+
total: string
|
|
1837
|
+
currency: string
|
|
1838
|
+
orderHash: string
|
|
1839
|
+
}
|
|
1840
|
+
}>
|
|
1841
|
+
|
|
1842
|
+
// Payment success.
|
|
1843
|
+
paymentSuccess(orderHash: string): Promise<any>
|
|
1844
|
+
```
|
|
1845
|
+
|
|
1846
|
+
## PurchaseConfirmationCore
|
|
1847
|
+
Shows the purchase confirmation information.
|
|
1848
|
+
|
|
1849
|
+
It exposes the following functions:
|
|
1850
|
+
|
|
1851
|
+
`getPurchaseConfirmation` Get purchase confirmation for the current event.
|
|
1852
|
+
|
|
1853
|
+
```ts
|
|
1854
|
+
getPurchaseConfirmation(
|
|
1855
|
+
orderHash: string
|
|
1856
|
+
): Promise<{
|
|
1857
|
+
purchaseConfirmationError?: {
|
|
1858
|
+
code?: number
|
|
1859
|
+
message: string
|
|
1860
|
+
extraData?: any
|
|
1861
|
+
}
|
|
1862
|
+
purchaseConfirmationData?: {
|
|
1863
|
+
conversionPixels?: any
|
|
1864
|
+
currency: {
|
|
1865
|
+
currency: string;
|
|
1866
|
+
decimalPlaces: number;
|
|
1867
|
+
symbol: string
|
|
1868
|
+
}
|
|
1869
|
+
customConfirmationPageText?: string
|
|
1870
|
+
customerId: string
|
|
1871
|
+
isReferralDisabled: boolean
|
|
1872
|
+
eventDate: string
|
|
1873
|
+
eventDescription: string
|
|
1874
|
+
eventType: string
|
|
1875
|
+
message: string
|
|
1876
|
+
orderTotal: number
|
|
1877
|
+
personalShareLink: string
|
|
1878
|
+
productId: string
|
|
1879
|
+
productImage: string
|
|
1880
|
+
productName: string
|
|
1881
|
+
productPrice: number
|
|
1882
|
+
productUrl: string
|
|
1883
|
+
twitterHashtag?: string
|
|
1884
|
+
personalShareSales: {
|
|
1885
|
+
price: number
|
|
1886
|
+
sales: number
|
|
1887
|
+
}[]
|
|
1888
|
+
}
|
|
1889
|
+
}>
|
|
1890
|
+
```
|
|
1891
|
+
|
|
1892
|
+
## MyOrdersCore
|
|
1893
|
+
Shows the purchased orders from the user. It can also show the sub-brands if the `ARE_SUB_BRANDS_INCLUDED` was set to true and the `BRAND` was set to an existing brand.
|
|
1894
|
+
|
|
1895
|
+
Exposes the following functions:
|
|
1896
|
+
|
|
1897
|
+
`getMyOrders` Get the orders purchased from the current user.
|
|
1898
|
+
|
|
1899
|
+
`getOrderDetails` Get the details from a specific order.
|
|
1900
|
+
|
|
1901
|
+
|
|
1902
|
+
```ts
|
|
1903
|
+
getMyOrders(page: number, filter: string): Promise<{
|
|
1904
|
+
myOrdersData?: {
|
|
1905
|
+
events: {
|
|
1906
|
+
url_name: string
|
|
1907
|
+
event_name: string
|
|
1908
|
+
}[]
|
|
1909
|
+
|
|
1910
|
+
orders: {
|
|
1911
|
+
id: string
|
|
1912
|
+
date: string
|
|
1913
|
+
currency: string
|
|
1914
|
+
amount: string
|
|
1915
|
+
eventName: string
|
|
1916
|
+
eventUrl: string
|
|
1917
|
+
image: string
|
|
1918
|
+
}[]
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
myOrdersError?: {
|
|
1922
|
+
code?: number
|
|
1923
|
+
message: string
|
|
1924
|
+
extraData?: any
|
|
1925
|
+
}
|
|
1926
|
+
}>
|
|
1927
|
+
|
|
1928
|
+
|
|
1929
|
+
getOrderDetails(orderId: string): Promise<{
|
|
1930
|
+
orderDetailsError?: {
|
|
1931
|
+
code?: number
|
|
1932
|
+
message: string
|
|
1933
|
+
extraData?: any
|
|
1934
|
+
}
|
|
1935
|
+
orderDetailsData?: {
|
|
1936
|
+
header: {
|
|
1937
|
+
isReferralDisabled: boolean
|
|
1938
|
+
shareLink: string
|
|
1939
|
+
total: string
|
|
1940
|
+
salesReferred: string
|
|
1941
|
+
}
|
|
1942
|
+
items: {
|
|
1943
|
+
isActive: boolean
|
|
1944
|
+
currency: string
|
|
1945
|
+
discount: string
|
|
1946
|
+
name: string
|
|
1947
|
+
price: string
|
|
1948
|
+
quantity: string
|
|
1949
|
+
total: string
|
|
1950
|
+
}[]
|
|
1951
|
+
tickets: {
|
|
1952
|
+
currency: string
|
|
1953
|
+
description: string
|
|
1954
|
+
descriptionPlain?: string
|
|
1955
|
+
eventName: string
|
|
1956
|
+
hash: string
|
|
1957
|
+
holderEmail?: string
|
|
1958
|
+
holderName: string
|
|
1959
|
+
holderPhone?: string
|
|
1960
|
+
isOnSale: boolean
|
|
1961
|
+
isSellable: true
|
|
1962
|
+
pdfLink: string
|
|
1963
|
+
qrData: string
|
|
1964
|
+
resaleFeeAmount: number
|
|
1965
|
+
status: string
|
|
1966
|
+
ticketType: string
|
|
1967
|
+
}[]
|
|
1968
|
+
}
|
|
1969
|
+
}>
|
|
1970
|
+
```
|
|
1971
|
+
|
|
1972
|
+
## OrderDetailsCore
|
|
1973
|
+
Allows to re-sale the tickets or to remove them from the re-sale system.
|
|
1974
|
+
|
|
1975
|
+
Import it from the library.
|
|
1976
|
+
```ts
|
|
1977
|
+
import { OrderDetailsCore, OrderDetailsCoreHandle } from 'tf-checkout-react-native';
|
|
1978
|
+
```
|
|
1979
|
+
|
|
1980
|
+
Create a ref
|
|
1981
|
+
|
|
1982
|
+
```ts
|
|
1983
|
+
const myOrderDetailsCoreRef = useRef<OrderDetailsCoreHandle>(null)
|
|
1984
|
+
```
|
|
1985
|
+
|
|
1986
|
+
Assign the ref to the wrapper component.
|
|
1987
|
+
|
|
1988
|
+
```tsx
|
|
1989
|
+
<OrderDetailsCore ref={myOrderDetailsCoreRef}>
|
|
1990
|
+
```
|
|
1991
|
+
|
|
1992
|
+
Access the exposed function through the current value.
|
|
1993
|
+
```ts
|
|
1994
|
+
await myOrderDetailsCoreRef.current.removeTicketFromResale(ticket.hash)
|
|
1995
|
+
```
|
|
1996
|
+
|
|
1997
|
+
|
|
1998
|
+
```ts
|
|
1999
|
+
resaleTicket(
|
|
2000
|
+
/*
|
|
2001
|
+
formData.append('to', toWhom)
|
|
2002
|
+
formData.append('first_name', firstName)
|
|
2003
|
+
formData.append('last_name', lastName)
|
|
2004
|
+
formData.append('email', email)
|
|
2005
|
+
formData.append('confirm_email', emailConfirm)
|
|
2006
|
+
formData.append('confirm', String(isTermsAgreed))
|
|
2007
|
+
*/
|
|
2008
|
+
|
|
2009
|
+
data: FormData,
|
|
2010
|
+
orderHash: string
|
|
2011
|
+
): Promise<{
|
|
2012
|
+
{
|
|
2013
|
+
resaleTicketError?: {
|
|
2014
|
+
code?: number
|
|
2015
|
+
message: string
|
|
2016
|
+
extraData?: any
|
|
2017
|
+
}
|
|
2018
|
+
resaleTicketData?: {
|
|
2019
|
+
message: string
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
}>
|
|
2023
|
+
```
|
|
2024
|
+
|
|
2025
|
+
```ts
|
|
2026
|
+
removeTicketFromResale(
|
|
2027
|
+
orderHash: string
|
|
2028
|
+
): Promise<{
|
|
2029
|
+
removeTicketFromResaleError?: {
|
|
2030
|
+
code?: number
|
|
2031
|
+
message: string
|
|
2032
|
+
extraData?: any
|
|
2033
|
+
}
|
|
2034
|
+
removeTicketFromResaleData?: {
|
|
2035
|
+
message: string
|
|
2036
|
+
}
|
|
2037
|
+
}>
|
|
2038
|
+
```
|
|
2039
|
+
|
|
2040
|
+
## LoginCore
|
|
2041
|
+
Handles the login and logout process.
|
|
2042
|
+
|
|
2043
|
+
Exposes the following functions:
|
|
2044
|
+
|
|
2045
|
+
`login` Logs in the user.
|
|
2046
|
+
|
|
2047
|
+
`logout` Logs out the user.
|
|
2048
|
+
|
|
2049
|
+
```ts
|
|
2050
|
+
login(fields?: {
|
|
2051
|
+
email: string
|
|
2052
|
+
password: string
|
|
2053
|
+
}): Promise<{
|
|
2054
|
+
error?: {
|
|
2055
|
+
code?: number
|
|
2056
|
+
message: string
|
|
2057
|
+
extraData?: any
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
data?: {
|
|
2061
|
+
customerId: string
|
|
2062
|
+
firstName: string
|
|
2063
|
+
lastName: string
|
|
2064
|
+
email: string
|
|
2065
|
+
phone: string
|
|
2066
|
+
streetAddress: string
|
|
2067
|
+
zipCode: string
|
|
2068
|
+
countryId: string
|
|
2069
|
+
company?: string
|
|
2070
|
+
state: string
|
|
2071
|
+
stateId: string
|
|
2072
|
+
city: string
|
|
2073
|
+
}
|
|
2074
|
+
}>
|
|
2075
|
+
|
|
2076
|
+
logout(): Promise<void>
|
|
2077
|
+
```
|
|
2078
|
+
|
|
2079
|
+
|
|
2080
|
+
# Utils
|
|
2081
|
+
|
|
2082
|
+
`deleteAllData` asynchronously deletes all the data stored in the local storage. Use this with caution, only in an edge case.
|
|
2083
|
+
|