tf-checkout-react-native 1.0.23 → 1.0.25
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 +609 -61
- package/assets/icons/ic_eye.png +0 -0
- package/assets/icons/ic_eye_off.png +0 -0
- package/lib/api/ApiClient.d.ts +5 -5
- package/lib/api/ApiClient.js +150 -21
- package/lib/api/ApiClient.js.map +1 -1
- package/lib/api/types.d.ts +41 -14
- package/lib/api/types.js +1 -0
- package/lib/api/types.js.map +1 -1
- package/lib/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/components/checkbox/Checkbox.js +8 -6
- package/lib/components/checkbox/Checkbox.js.map +1 -1
- package/lib/components/checkbox/types.d.ts +2 -0
- package/lib/components/enterPassword/EnterPassword.d.ts +4 -0
- package/lib/components/enterPassword/EnterPassword.js +21 -0
- package/lib/components/enterPassword/EnterPassword.js.map +1 -0
- package/lib/components/enterPassword/styles.d.ts +20 -0
- package/lib/components/enterPassword/styles.js +22 -0
- package/lib/components/enterPassword/styles.js.map +1 -0
- package/lib/components/enterPassword/types.d.ts +23 -0
- package/lib/components/enterPassword/types.js +2 -0
- package/lib/components/enterPassword/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 +14 -3
- package/lib/components/input/Input.js.map +1 -1
- package/lib/components/input/styles.d.ts +5 -0
- package/lib/components/input/styles.js +5 -0
- package/lib/components/input/styles.js.map +1 -1
- package/lib/components/input/types.d.ts +7 -1
- package/lib/components/login/Login.js +60 -10
- package/lib/components/login/Login.js.map +1 -1
- package/lib/components/login/LoginView.js +63 -91
- package/lib/components/login/LoginView.js.map +1 -1
- package/lib/components/login/components/LoginForm.d.ts +4 -0
- package/lib/components/login/components/LoginForm.js +28 -0
- package/lib/components/login/components/LoginForm.js.map +1 -0
- package/lib/components/login/components/types.d.ts +18 -0
- package/lib/components/login/components/types.js +3 -0
- package/lib/components/login/components/types.js.map +1 -0
- package/lib/components/login/styles.d.ts +5 -0
- package/lib/components/login/styles.js +5 -0
- package/lib/components/login/styles.js.map +1 -1
- package/lib/components/login/types.d.ts +35 -6
- package/lib/components/restorePassword/RestorePassword.d.ts +4 -0
- package/lib/components/restorePassword/RestorePassword.js +22 -0
- package/lib/components/restorePassword/RestorePassword.js.map +1 -0
- package/lib/components/restorePassword/ResultDialog.d.ts +4 -0
- package/lib/components/restorePassword/ResultDialog.js +11 -0
- package/lib/components/restorePassword/ResultDialog.js.map +1 -0
- package/lib/components/restorePassword/styles.d.ts +33 -0
- package/lib/components/restorePassword/styles.js +36 -0
- package/lib/components/restorePassword/styles.js.map +1 -0
- package/lib/components/restorePassword/types.d.ts +48 -0
- package/lib/components/restorePassword/types.js +3 -0
- package/lib/components/restorePassword/types.js.map +1 -0
- package/lib/components/stripePayment/StripePayment.js +2 -1
- package/lib/components/stripePayment/StripePayment.js.map +1 -1
- package/lib/components/stripePayment/styles.d.ts +6 -0
- package/lib/components/stripePayment/styles.js +7 -0
- package/lib/components/stripePayment/styles.js.map +1 -0
- package/lib/components/waitingList/WaitingList.d.ts +3 -2
- package/lib/components/waitingList/WaitingList.js +23 -3
- package/lib/components/waitingList/WaitingList.js.map +1 -1
- package/lib/containers/billingInfo/Billing.d.ts +3 -2
- package/lib/containers/billingInfo/Billing.js +74 -38
- package/lib/containers/billingInfo/Billing.js.map +1 -1
- package/lib/containers/billingInfo/styles.d.ts +4 -0
- package/lib/containers/billingInfo/styles.js +4 -0
- package/lib/containers/billingInfo/styles.js.map +1 -1
- package/lib/containers/billingInfo/types.d.ts +7 -5
- package/lib/containers/checkout/Checkout.d.ts +3 -2
- package/lib/containers/checkout/Checkout.js +147 -106
- package/lib/containers/checkout/Checkout.js.map +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.d.ts +3 -2
- package/lib/containers/myOrderDetails/MyOrderDetails.js +34 -9
- package/lib/containers/myOrderDetails/MyOrderDetails.js.map +1 -1
- package/lib/containers/myOrders/MyOrders.d.ts +3 -2
- package/lib/containers/myOrders/MyOrders.js +40 -11
- package/lib/containers/myOrders/MyOrders.js.map +1 -1
- package/lib/containers/purchaseConfirmation/PurchaseConfirmation.d.ts +3 -2
- package/lib/containers/purchaseConfirmation/PurchaseConfirmation.js +54 -18
- package/lib/containers/purchaseConfirmation/PurchaseConfirmation.js.map +1 -1
- package/lib/containers/resaleTickets/ResaleTickets.d.ts +3 -2
- package/lib/containers/resaleTickets/ResaleTickets.js +32 -11
- package/lib/containers/resaleTickets/ResaleTickets.js.map +1 -1
- package/lib/containers/resetPassword/ResetPassword.d.ts +4 -0
- package/lib/containers/resetPassword/ResetPassword.js +63 -0
- package/lib/containers/resetPassword/ResetPassword.js.map +1 -0
- package/lib/containers/resetPassword/ResetPasswordView.d.ts +4 -0
- package/lib/containers/resetPassword/ResetPasswordView.js +24 -0
- package/lib/containers/resetPassword/ResetPasswordView.js.map +1 -0
- package/lib/containers/resetPassword/styles.d.ts +32 -0
- package/lib/containers/resetPassword/styles.js +34 -0
- package/lib/containers/resetPassword/styles.js.map +1 -0
- package/lib/containers/resetPassword/types.d.ts +47 -0
- package/lib/containers/resetPassword/types.js +2 -0
- package/lib/containers/resetPassword/types.js.map +1 -0
- package/lib/containers/tickets/Tickets.d.ts +3 -2
- package/lib/containers/tickets/Tickets.js +140 -26
- package/lib/containers/tickets/Tickets.js.map +1 -1
- package/lib/containers/tickets/TicketsView.d.ts +1 -1
- package/lib/containers/tickets/TicketsView.js +16 -6
- package/lib/containers/tickets/TicketsView.js.map +1 -1
- package/lib/containers/tickets/components/TicketGroupListHeader.d.ts +4 -0
- package/lib/containers/tickets/components/TicketGroupListHeader.js +5 -0
- package/lib/containers/tickets/components/TicketGroupListHeader.js.map +1 -0
- package/lib/containers/tickets/components/types.d.ts +8 -0
- package/lib/containers/tickets/components/types.js +1 -0
- package/lib/containers/tickets/components/types.js.map +1 -1
- package/lib/containers/tickets/types.d.ts +31 -3
- package/lib/core/BillingCore/BillingCore.js +4 -0
- package/lib/core/BillingCore/BillingCore.js.map +1 -1
- package/lib/core/BillingCore/BillingCoreTypes.d.ts +3 -1
- package/lib/core/CheckoutCore/CheckoutCore.js +4 -0
- package/lib/core/CheckoutCore/CheckoutCore.js.map +1 -1
- package/lib/core/CheckoutCore/CheckoutCoreTypes.d.ts +3 -1
- package/lib/core/LoginCore/LoginCore.js +22 -15
- package/lib/core/LoginCore/LoginCore.js.map +1 -1
- package/lib/core/LoginCore/LoginCoreHelper.d.ts +2 -0
- package/lib/core/LoginCore/LoginCoreHelper.js +19 -0
- package/lib/core/LoginCore/LoginCoreHelper.js.map +1 -0
- package/lib/core/LoginCore/LoginCoreTypes.d.ts +5 -2
- package/lib/core/MyOrdersCore/MyOrdersCore.d.ts +3 -1
- package/lib/core/MyOrdersCore/MyOrdersCore.js +4 -0
- package/lib/core/MyOrdersCore/MyOrdersCore.js.map +1 -1
- package/lib/core/MyOrdersCore/MyOrdersCoreTypes.d.ts +3 -1
- package/lib/core/OrderDetailsCore/OrderDetailsCore.d.ts +2 -2
- package/lib/core/OrderDetailsCore/OrderDetailsCore.js +4 -0
- package/lib/core/OrderDetailsCore/OrderDetailsCore.js.map +1 -1
- package/lib/core/OrderDetailsCore/OrderDetailsCoreTypes.d.ts +4 -2
- package/lib/core/PurchaseConfirmationCore/PurchaseConfirmationCore.js +4 -0
- package/lib/core/PurchaseConfirmationCore/PurchaseConfirmationCore.js.map +1 -1
- package/lib/core/PurchaseConfirmationCore/PurchaseConfirmationCoreTypes.d.ts +3 -1
- package/lib/core/ResetPasswordCore/ResetPasswordCore.d.ts +5 -0
- package/lib/core/ResetPasswordCore/ResetPasswordCore.js +12 -0
- package/lib/core/ResetPasswordCore/ResetPasswordCore.js.map +1 -0
- package/lib/core/ResetPasswordCore/ResetPasswordCoreTypes.d.ts +4 -0
- package/lib/core/ResetPasswordCore/ResetPasswordCoreTypes.js +2 -0
- package/lib/core/ResetPasswordCore/ResetPasswordCoreTypes.js.map +1 -0
- package/lib/core/Session/SessionCoreTypes.d.ts +8 -0
- package/lib/core/Session/SessionCoreTypes.js +2 -0
- package/lib/core/Session/SessionCoreTypes.js.map +1 -0
- package/lib/core/Session/SessionHandle.d.ts +5 -0
- package/lib/core/Session/SessionHandle.js +16 -0
- package/lib/core/Session/SessionHandle.js.map +1 -0
- package/lib/core/TicketsCore/TicketsCore.js +87 -3
- package/lib/core/TicketsCore/TicketsCore.js.map +1 -1
- package/lib/core/TicketsCore/TicketsCoreTypes.d.ts +25 -4
- package/lib/core/WaitingListCore/WaitingListCore.js +4 -0
- package/lib/core/WaitingListCore/WaitingListCore.js.map +1 -1
- package/lib/core/WaitingListCore/WaitingListCoreTypes.d.ts +3 -1
- package/lib/core/index.d.ts +5 -1
- package/lib/core/index.js +2 -0
- package/lib/core/index.js.map +1 -1
- package/lib/helpers/Config.d.ts +9 -2
- package/lib/helpers/Config.js +9 -1
- package/lib/helpers/Config.js.map +1 -1
- package/lib/helpers/LocalStorage.d.ts +5 -0
- package/lib/helpers/LocalStorage.js +15 -0
- package/lib/helpers/LocalStorage.js.map +1 -1
- package/lib/helpers/RefreshAccessToken.d.ts +2 -0
- package/lib/helpers/RefreshAccessToken.js +20 -0
- package/lib/helpers/RefreshAccessToken.js.map +1 -0
- package/lib/index.d.ts +10 -4
- package/lib/index.js +4 -3
- package/lib/index.js.map +1 -1
- package/lib/res/icons.d.ts +2 -0
- package/lib/res/icons.js +2 -0
- package/lib/res/icons.js.map +1 -1
- package/lib/res/index.d.ts +2 -0
- package/lib/types/ITicket.d.ts +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
React Native library for Ticket Fairy checkout.
|
|
4
4
|
|
|
5
|
+
For Single Sign-On (SSO) Please be awere that this is the first version of the implementation, we are working to release a V2, that will cover other use cases, in the near future.
|
|
6
|
+
|
|
5
7
|
# Requirements
|
|
6
8
|
|
|
7
9
|
Configure [ReactNative environment](https://reactnative.dev/docs/environment-setup) for desired platforms (iOS, Android or both).
|
|
@@ -11,7 +13,7 @@ Configure [ReactNative environment](https://reactnative.dev/docs/environment-set
|
|
|
11
13
|
- Suggested ReactNative version `0.66.3`
|
|
12
14
|
- Suggested Flipper version `0.99.0`
|
|
13
15
|
- React version `0.17.1`
|
|
14
|
-
|
|
16
|
+
- Node version `16.10.0`
|
|
15
17
|
### Android
|
|
16
18
|
|
|
17
19
|
- Android 5.0 (API level 21) and above
|
|
@@ -99,16 +101,41 @@ Import the function from the library.
|
|
|
99
101
|
import { setConfig } from 'tf-checkout-react-native'
|
|
100
102
|
```
|
|
101
103
|
|
|
102
|
-
Use it in your initial useEffect function
|
|
104
|
+
Use it in your initial useEffect function, please keep in mind this is an `async` function. It is highly recommended that you track when `setConfig` is finished, and pass that control prop to the Tickets component.
|
|
103
105
|
|
|
104
106
|
```ts
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
|
|
108
|
+
const YourComponent: FC () => {
|
|
109
|
+
const [isCheckingCurrentSession, setIsCheckingCurrentSession] = useState(true)
|
|
110
|
+
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
const initConfig = async () => {
|
|
113
|
+
setIsCheckingCurrentSession(true)
|
|
114
|
+
|
|
115
|
+
await setConfig({
|
|
116
|
+
EVENT_ID: '4344',
|
|
117
|
+
CLIENT: 'ttf',
|
|
118
|
+
ENV: 'STAG',
|
|
119
|
+
CLIENT_ID: '3emd9023349dfn',
|
|
120
|
+
CLIENT_SECRET: 'CCEw33o4030e4df',
|
|
121
|
+
AUTH: {
|
|
122
|
+
ACCESS_TOKEN: 'token393939',
|
|
123
|
+
REFRESH_TOKEN: 'dee2030edmd',
|
|
124
|
+
TOKEN_TYPE: 'bearer',
|
|
125
|
+
SCOPE: 'scope',
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
setIsCheckingCurrentSession(false)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
initConfig()
|
|
133
|
+
}, [])
|
|
134
|
+
|
|
135
|
+
return <Tickets
|
|
136
|
+
isCheckingCurrentSession
|
|
137
|
+
/>
|
|
138
|
+
}
|
|
112
139
|
```
|
|
113
140
|
|
|
114
141
|
`setConfig` set your event's configuration, with the following options:
|
|
@@ -123,6 +150,12 @@ useEffect(() => {
|
|
|
123
150
|
TIMEOUT?: number,
|
|
124
151
|
BRAND?: string,
|
|
125
152
|
ARE_SUB_BRANDS_INCLUDED?: boolean
|
|
153
|
+
AUTH?: {
|
|
154
|
+
ACCESS_TOKEN: string
|
|
155
|
+
REFRESH_TOKEN: string
|
|
156
|
+
TOKEN_TYPE: string
|
|
157
|
+
SCOPE: string
|
|
158
|
+
}
|
|
126
159
|
}
|
|
127
160
|
````
|
|
128
161
|
### Props
|
|
@@ -136,6 +169,7 @@ useEffect(() => {
|
|
|
136
169
|
| BRAND | Set your BRAND so users can only see this brand in their orders. |
|
|
137
170
|
| TIMEOUT | Set custom timeout for the APIs requests. |
|
|
138
171
|
| ARE_SUB_BRANDS_INCLUDED | If true will include orders from the `BRAND` sub-brands. Default `false`. |
|
|
172
|
+
| AUTH | Object that receives data for Single Sign On (SSO).|
|
|
139
173
|
|
|
140
174
|
# Run the example app
|
|
141
175
|
|
|
@@ -147,13 +181,13 @@ useEffect(() => {
|
|
|
147
181
|
5. Run `yarn ios` or `npm run ios` to initialize and run in the iPhone simulator.
|
|
148
182
|
6. If running on Android, run `yarn android` or `npm run android` to run it in the Android emulator or connected physical device.
|
|
149
183
|
|
|
150
|
-
# Features
|
|
184
|
+
# Features
|
|
151
185
|
|
|
152
186
|
This library exports the following components:
|
|
153
187
|
|
|
154
188
|
### Login
|
|
155
189
|
|
|
156
|
-
Used to authenticate the user.
|
|
190
|
+
Used to authenticate the user and request password restore.
|
|
157
191
|
|
|
158
192
|
### Tickets
|
|
159
193
|
|
|
@@ -187,6 +221,16 @@ Will show the details for the selected Order, it also allows the user to downloa
|
|
|
187
221
|
|
|
188
222
|
Let the user to resale their tickets. They can choose between selling them to a friend or to any other user.
|
|
189
223
|
|
|
224
|
+
### Reset Password
|
|
225
|
+
|
|
226
|
+
After opening and URL with the corresponding schema, use this component to let the user reset its password.
|
|
227
|
+
|
|
228
|
+
### Exported functions
|
|
229
|
+
|
|
230
|
+
- setConfig: Sets config for the library
|
|
231
|
+
|
|
232
|
+
- refreshAccessToken: Let refresh the expired access token.
|
|
233
|
+
|
|
190
234
|
# Component styling
|
|
191
235
|
### Button
|
|
192
236
|
```ts
|
|
@@ -223,6 +267,69 @@ interface ICheckboxStyles {
|
|
|
223
267
|
}
|
|
224
268
|
```
|
|
225
269
|
|
|
270
|
+
# Exported functions
|
|
271
|
+
## setConfig
|
|
272
|
+
Set the configuration for the library.
|
|
273
|
+
|
|
274
|
+
```ts
|
|
275
|
+
export interface IConfig {
|
|
276
|
+
EVENT_ID: string | number
|
|
277
|
+
CLIENT?: string
|
|
278
|
+
ENV?: EnvType
|
|
279
|
+
CLIENT_ID?: string
|
|
280
|
+
CLIENT_SECRET?: string
|
|
281
|
+
TIMEOUT?: number
|
|
282
|
+
BRAND?: string
|
|
283
|
+
ARE_SUB_BRANDS_INCLUDED?: boolean
|
|
284
|
+
// AUTH is used for single sign on v1.
|
|
285
|
+
// It receives the needed information for the authenticated user.
|
|
286
|
+
AUTH?: {
|
|
287
|
+
ACCESS_TOKEN: string
|
|
288
|
+
REFRESH_TOKEN: string
|
|
289
|
+
TOKEN_TYPE: string
|
|
290
|
+
SCOPE: string
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
## refreshAccessToken
|
|
295
|
+
|
|
296
|
+
Let refresh the expired access token, it can use the internal stored refresh token, passing nothing to it, or you can pass a `string` refresh token.
|
|
297
|
+
|
|
298
|
+
```ts
|
|
299
|
+
const response: IFetchAccessTokenResponse = await refreshAccessToken(refreshToken?: string)
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Returns the new access token data or error.
|
|
303
|
+
|
|
304
|
+
```ts
|
|
305
|
+
accessTokenError?: {
|
|
306
|
+
code?: number
|
|
307
|
+
message: string
|
|
308
|
+
}
|
|
309
|
+
accessTokenData?: {
|
|
310
|
+
accessToken: string
|
|
311
|
+
refreshToken: string
|
|
312
|
+
tokenType: string
|
|
313
|
+
scope: string
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
# Exported handlers
|
|
318
|
+
## SessionCoreHandle
|
|
319
|
+
Exports function to refresh access token.
|
|
320
|
+
|
|
321
|
+
### refreshAccessToken
|
|
322
|
+
Allows to refresh access token inside the component. It will automatically re-fetch the component's data from the server. You will need to create a `ref` object with the corresponding type.
|
|
323
|
+
|
|
324
|
+
Example:
|
|
325
|
+
|
|
326
|
+
In your parent component
|
|
327
|
+
```ts
|
|
328
|
+
const sessionHandleRef = useRef<SessionHandleType>(null)
|
|
329
|
+
|
|
330
|
+
// Call the refreshAccessToken function by using
|
|
331
|
+
await sessionHandleRef.current?.refreshAccessToken()
|
|
332
|
+
```
|
|
226
333
|
|
|
227
334
|
# Exported components
|
|
228
335
|
Depending on your needs, you can use the UI Components or the Core Components.
|
|
@@ -249,6 +356,16 @@ Depending on your needs, you can use the UI Components or the Core Components.
|
|
|
249
356
|
|
|
250
357
|
[Resale](#resale-tickets-ui)
|
|
251
358
|
|
|
359
|
+
[Reset Password](#reset-password-ui)
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
## Session handle
|
|
363
|
+
|
|
364
|
+
In all components with the exception of Login and Reset Password, you can pass a `ref` with type `SessionHandleType` to access two functions:
|
|
365
|
+
|
|
366
|
+
`refreshAccessToken` After a successful access token refresh, it will re-fetch component's data from server when applicable.
|
|
367
|
+
`reloadData` It will re-fetch component's data from server.
|
|
368
|
+
|
|
252
369
|
---
|
|
253
370
|
## Login UI
|
|
254
371
|
|
|
@@ -262,7 +379,10 @@ Then add it to the render function.
|
|
|
262
379
|
|
|
263
380
|
```tsx
|
|
264
381
|
<Login
|
|
265
|
-
onLoginSuccessful: (
|
|
382
|
+
onLoginSuccessful: (
|
|
383
|
+
userProfile: IUserProfile,
|
|
384
|
+
accessTokenData?: IFetchAccessTokenData
|
|
385
|
+
) => void
|
|
266
386
|
onLoginError?: (error: IError) => void
|
|
267
387
|
|
|
268
388
|
onFetchUserProfileError?: (error: IError) => void
|
|
@@ -301,9 +421,43 @@ Then add it to the render function.
|
|
|
301
421
|
}
|
|
302
422
|
styles?: ILoginViewStyles
|
|
303
423
|
texts?: ILoginViewTexts
|
|
424
|
+
|
|
425
|
+
isShowPasswordButtonVisible?: boolean
|
|
426
|
+
|
|
427
|
+
//Restore password
|
|
428
|
+
onRestorePasswordError?: (error: IError) => void
|
|
429
|
+
onRestorePasswordSuccess?: () => void
|
|
304
430
|
/>
|
|
305
431
|
```
|
|
306
432
|
|
|
433
|
+
### Data Types
|
|
434
|
+
#### IUserProfile
|
|
435
|
+
```ts
|
|
436
|
+
{
|
|
437
|
+
customerId: string
|
|
438
|
+
firstName: string
|
|
439
|
+
lastName: string
|
|
440
|
+
email: string
|
|
441
|
+
phone: string
|
|
442
|
+
streetAddress: string
|
|
443
|
+
zipCode: string
|
|
444
|
+
countryId: string
|
|
445
|
+
company?: string
|
|
446
|
+
state: string
|
|
447
|
+
stateId: string
|
|
448
|
+
city: string
|
|
449
|
+
}
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
#### IFetchAccessTokenData
|
|
453
|
+
```ts
|
|
454
|
+
{
|
|
455
|
+
accessToken: string
|
|
456
|
+
refreshToken: string
|
|
457
|
+
tokenType: string
|
|
458
|
+
scope: string
|
|
459
|
+
}
|
|
460
|
+
```
|
|
307
461
|
### Props
|
|
308
462
|
| Property | Description |
|
|
309
463
|
|----------|-------------|
|
|
@@ -320,6 +474,8 @@ Then add it to the render function.
|
|
|
320
474
|
|texts?: ILoginViewTexts | Use this to change some texts that appear in this component. |
|
|
321
475
|
|userFirstName?: string | Once authenticated send the received firstName data to this prop, so the component can render the Logged in view. |
|
|
322
476
|
|brandImages?: ILoginBrandImages | Receives up to 2 images with their styles and the container style for the images. |
|
|
477
|
+
| onRestorePasswordError?: (error: string) | When restore password fails will return the error received. |
|
|
478
|
+
| onRestorePasswordSuccess? | Called when restore password request was successful |
|
|
323
479
|
|
|
324
480
|
### styles
|
|
325
481
|
|
|
@@ -347,6 +503,33 @@ interface ILoginViewStyles {
|
|
|
347
503
|
button?: IButtonStyles
|
|
348
504
|
message?: StyleProp<TextStyle>
|
|
349
505
|
}
|
|
506
|
+
restorePassword?: {
|
|
507
|
+
rootContainer?: StyleProp<ViewStyle>
|
|
508
|
+
restorePasswordButton?: {
|
|
509
|
+
container?: StyleProp<ViewStyle>
|
|
510
|
+
button?: StyleProp<ViewStyle>
|
|
511
|
+
text?: StyleProp<TextStyle>
|
|
512
|
+
}
|
|
513
|
+
cancelRestorePasswordButton?: {
|
|
514
|
+
container?: StyleProp<ViewStyle>
|
|
515
|
+
button?: StyleProp<ViewStyle>
|
|
516
|
+
text?: StyleProp<TextStyle>
|
|
517
|
+
}
|
|
518
|
+
input?: IInputStyles
|
|
519
|
+
title?: StyleProp<TextStyle>
|
|
520
|
+
message?: StyleProp<TextStyle>
|
|
521
|
+
apiError?: StyleProp<TextStyle>
|
|
522
|
+
}
|
|
523
|
+
restorePasswordSuccess?: {
|
|
524
|
+
rootContainer?: StyleProp<ViewStyle>
|
|
525
|
+
title?: StyleProp<TextStyle>
|
|
526
|
+
message?: StyleProp<TextStyle>
|
|
527
|
+
button?: {
|
|
528
|
+
container?: StyleProp<ViewStyle>
|
|
529
|
+
button?: StyleProp<ViewStyle>
|
|
530
|
+
text?: StyleProp<TextStyle>
|
|
531
|
+
}
|
|
532
|
+
}
|
|
350
533
|
}
|
|
351
534
|
```
|
|
352
535
|
|
|
@@ -375,12 +558,30 @@ interface ILoginViewStyles {
|
|
|
375
558
|
loggedAs?: string
|
|
376
559
|
notYou?: string
|
|
377
560
|
}
|
|
378
|
-
|
|
561
|
+
restorePassword?: {
|
|
562
|
+
restorePasswordButton?: string
|
|
563
|
+
cancelButton?: string
|
|
564
|
+
message?: string
|
|
565
|
+
inputLabel?: string
|
|
566
|
+
title?: string
|
|
567
|
+
}
|
|
568
|
+
restorePasswordSuccess?: {
|
|
569
|
+
title?: string
|
|
570
|
+
message?: string
|
|
571
|
+
button?: string
|
|
572
|
+
}
|
|
573
|
+
}
|
|
379
574
|
```
|
|
380
575
|
---
|
|
381
576
|
## Tickets UI
|
|
382
577
|
|
|
383
|
-
|
|
578
|
+
This component will first fetch for the Event's data, if data is ok, then will fetch the tickets for this event.
|
|
579
|
+
|
|
580
|
+
### Password protected event
|
|
581
|
+
|
|
582
|
+
If the Event's response returns a `401` error, then it means it's password protected and need to authenticate with a password. Then the `EnterPassword` component will be shown for the user to enter the password.
|
|
583
|
+
|
|
584
|
+
Import the component from the library.
|
|
384
585
|
|
|
385
586
|
```js
|
|
386
587
|
import { Tickets } from 'tf-checkout-react-native'
|
|
@@ -389,15 +590,19 @@ import { Tickets } from 'tf-checkout-react-native'
|
|
|
389
590
|
Then add it to the render function.
|
|
390
591
|
|
|
391
592
|
```js
|
|
392
|
-
|
|
593
|
+
const sessionHandleRef = useRef<SessionHandleType>(null)
|
|
594
|
+
|
|
595
|
+
<Tickets
|
|
596
|
+
ref={sessionHandleRef}
|
|
597
|
+
eventId={EVENT_ID}
|
|
598
|
+
onAddToCartSuccess={handleOnAddToCartSuccess} />
|
|
393
599
|
```
|
|
394
600
|
|
|
395
601
|
### Props
|
|
396
602
|
|
|
397
603
|
```js
|
|
398
604
|
{
|
|
399
|
-
|
|
400
|
-
|
|
605
|
+
ref?: SessionHandleType
|
|
401
606
|
// Callbacks for when user taps on GET Tickets button
|
|
402
607
|
onAddToCartSuccess: (data: {
|
|
403
608
|
isBillingRequired: boolean
|
|
@@ -452,12 +657,28 @@ Then add it to the render function.
|
|
|
452
657
|
onPressMyOrders: () => void
|
|
453
658
|
onPressLogout?: () => void
|
|
454
659
|
|
|
455
|
-
|
|
456
|
-
onLoadingChange?: (isLoading: boolean) => void
|
|
457
|
-
areAlertsEnabled?: boolean
|
|
458
|
-
areLoadingIndicatorsEnabled?: boolean
|
|
459
|
-
|
|
660
|
+
onLoadingChange?: (isLoading: boolean) => void
|
|
460
661
|
promoCodeCloseIcon?: ImageSourcePropType
|
|
662
|
+
|
|
663
|
+
// Event password protected
|
|
664
|
+
onPressSubmitEventPassword?: (password: string) => void
|
|
665
|
+
passwordProtectedEventData?: {
|
|
666
|
+
isPasswordProtected?: boolean
|
|
667
|
+
message?: string
|
|
668
|
+
apiError?: string
|
|
669
|
+
isLoading?: boolean
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// Configure the Component behavior
|
|
673
|
+
config: {
|
|
674
|
+
areActivityIndicatorsEnabled?: boolean
|
|
675
|
+
areAlertsEnabled?: boolean
|
|
676
|
+
areTicketsSortedBySoldOut?: boolean
|
|
677
|
+
areTicketsGrouped?: boolean
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
// For SSO
|
|
681
|
+
isCheckingCurrentSession?: boolean
|
|
461
682
|
}
|
|
462
683
|
```
|
|
463
684
|
|
|
@@ -474,6 +695,21 @@ Then add it to the render function.
|
|
|
474
695
|
}
|
|
475
696
|
```
|
|
476
697
|
|
|
698
|
+
### config prop
|
|
699
|
+
Configure the component's behavior
|
|
700
|
+
```ts
|
|
701
|
+
config: {
|
|
702
|
+
// Whether or not show the loading indicators.
|
|
703
|
+
areActivityIndicatorsEnabled?: boolean
|
|
704
|
+
// Whether or not show the alerts.
|
|
705
|
+
areAlertsEnabled?: boolean
|
|
706
|
+
// Whether or not the Ticket should be sorted by Sold Out.
|
|
707
|
+
areTicketsSortedBySoldOut?: boolean
|
|
708
|
+
// Whether or not the tickets should be grouped, they need to be configured as groups in the Tickets admin.
|
|
709
|
+
areTicketsGrouped?: boolean
|
|
710
|
+
}
|
|
711
|
+
```
|
|
712
|
+
|
|
477
713
|
You can then call the `BillingInfo` component and pass them as props in the `cartProps` prop.
|
|
478
714
|
|
|
479
715
|
`onFetchTicketsSuccess` When tickets fetching was successful, will return fetched data, including `promoCodeResponse`.
|
|
@@ -487,8 +723,8 @@ You can then call the `BillingInfo` component and pass them as props in the `car
|
|
|
487
723
|
getTicketsButtonDisabled?: IButtonStyles
|
|
488
724
|
getTicketsButtonActive?: IButtonStyles
|
|
489
725
|
promoCode?: {
|
|
490
|
-
rootContainer?:
|
|
491
|
-
contentWrapper?:
|
|
726
|
+
rootContainer?: ViewStyle
|
|
727
|
+
contentWrapper?: ViewStyle
|
|
492
728
|
content?: StyleProp<ViewStyle>
|
|
493
729
|
input?: TextInputProps['style']
|
|
494
730
|
inputPlaceholderColor?: string
|
|
@@ -504,6 +740,10 @@ You can then call the `BillingInfo` component and pass them as props in the `car
|
|
|
504
740
|
cancelIcon?: StyleProp<ImageStyle>
|
|
505
741
|
}
|
|
506
742
|
ticketList?: {
|
|
743
|
+
sectionHeader?: {
|
|
744
|
+
container?: StyleProp<ViewStyle>
|
|
745
|
+
title?: StyleProp<TextStyle>
|
|
746
|
+
}
|
|
507
747
|
listContainer?: ViewStyle
|
|
508
748
|
item?: {
|
|
509
749
|
container?: ViewStyle
|
|
@@ -542,6 +782,14 @@ You can then call the `BillingInfo` component and pass them as props in the `car
|
|
|
542
782
|
myOrdersButton?: IButtonStyles
|
|
543
783
|
logOutButton?: IButtonStyles
|
|
544
784
|
}
|
|
785
|
+
enterPassword?: {
|
|
786
|
+
input?: IInputStyles
|
|
787
|
+
title?: StyleProp<TextStyle>
|
|
788
|
+
error?: StyleProp<TextStyle>
|
|
789
|
+
button?: IButtonStyles
|
|
790
|
+
rootContainer?: StyleProp<ViewStyle>
|
|
791
|
+
contentContainer?: StyleProp<ViewStyle>
|
|
792
|
+
}
|
|
545
793
|
}
|
|
546
794
|
```
|
|
547
795
|
|
|
@@ -586,6 +834,11 @@ You can then call the `BillingInfo` component and pass them as props in the `car
|
|
|
586
834
|
free?: string
|
|
587
835
|
ticket?: string
|
|
588
836
|
}
|
|
837
|
+
enterPassword?: {
|
|
838
|
+
inputLabel?: string
|
|
839
|
+
title?: string
|
|
840
|
+
buttonText?: string
|
|
841
|
+
}
|
|
589
842
|
}
|
|
590
843
|
```
|
|
591
844
|
---
|
|
@@ -600,7 +853,11 @@ import { BillingInfo } from 'tf-checkout-react-native'
|
|
|
600
853
|
Add it to the render function.
|
|
601
854
|
|
|
602
855
|
```js
|
|
856
|
+
const sessionHandleRef = useRef<SessionHandleType>(null)
|
|
857
|
+
|
|
858
|
+
|
|
603
859
|
<BillingInfo
|
|
860
|
+
ref={sessionHandleRef}
|
|
604
861
|
cartProps: {
|
|
605
862
|
isBillingRequired: boolean
|
|
606
863
|
isNameRequired: boolean
|
|
@@ -609,8 +866,24 @@ Add it to the render function.
|
|
|
609
866
|
minimumAge: number
|
|
610
867
|
}
|
|
611
868
|
// registerNewUser
|
|
612
|
-
onRegisterSuccess?: (
|
|
613
|
-
|
|
869
|
+
onRegisterSuccess?: (data: {
|
|
870
|
+
accessTokenData: {
|
|
871
|
+
accessToken: string
|
|
872
|
+
refreshToken: string
|
|
873
|
+
tokenType: string
|
|
874
|
+
scope: string
|
|
875
|
+
}
|
|
876
|
+
userProfile: {
|
|
877
|
+
firstName: string
|
|
878
|
+
lastName: string
|
|
879
|
+
email: string
|
|
880
|
+
}
|
|
881
|
+
}) => void
|
|
882
|
+
onRegisterError?: (error: {
|
|
883
|
+
isAlreadyRegistered?: boolean
|
|
884
|
+
message?: string
|
|
885
|
+
raw?: any
|
|
886
|
+
}) => void
|
|
614
887
|
|
|
615
888
|
onCheckoutSuccess: (data: {
|
|
616
889
|
id: string
|
|
@@ -620,7 +893,8 @@ Add it to the render function.
|
|
|
620
893
|
}) => void
|
|
621
894
|
onCheckoutError?: (error: IError) => void
|
|
622
895
|
|
|
623
|
-
|
|
896
|
+
// See ILoginSuccessData data type below.
|
|
897
|
+
onLoginSuccess: (data: ILoginSuccessData) => void
|
|
624
898
|
onLoginError?: (error: IError) => void
|
|
625
899
|
|
|
626
900
|
onFetchUserProfileSuccess?: (data: any) => void
|
|
@@ -674,6 +948,34 @@ Add it to the render function.
|
|
|
674
948
|
/>
|
|
675
949
|
```
|
|
676
950
|
|
|
951
|
+
### DataTypes
|
|
952
|
+
ILoginSuccessData
|
|
953
|
+
|
|
954
|
+
```ts
|
|
955
|
+
interface ILoginSuccessData {
|
|
956
|
+
userProfile: {
|
|
957
|
+
customerId: string
|
|
958
|
+
firstName: string
|
|
959
|
+
lastName: string
|
|
960
|
+
email: string
|
|
961
|
+
phone: string
|
|
962
|
+
streetAddress: string
|
|
963
|
+
zipCode: string
|
|
964
|
+
countryId: string
|
|
965
|
+
company?: string
|
|
966
|
+
state: string
|
|
967
|
+
stateId: string
|
|
968
|
+
city: string
|
|
969
|
+
}
|
|
970
|
+
accessTokenData?: {
|
|
971
|
+
accessToken: string
|
|
972
|
+
refreshToken: string
|
|
973
|
+
tokenType: string
|
|
974
|
+
scope: string
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
```
|
|
978
|
+
|
|
677
979
|
### Props
|
|
678
980
|
| Property | Description |
|
|
679
981
|
|----------|-------------|
|
|
@@ -718,9 +1020,10 @@ interface IBillingInfoViewTexts {
|
|
|
718
1020
|
label?: string
|
|
719
1021
|
customError?: string
|
|
720
1022
|
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
1023
|
+
ttfPrivacyPolicyRequiredError?: string
|
|
1024
|
+
}
|
|
1025
|
+
cartTimer?: {
|
|
1026
|
+
message?: string
|
|
724
1027
|
}
|
|
725
1028
|
}
|
|
726
1029
|
```
|
|
@@ -753,7 +1056,17 @@ interface IBillingInfoViewStyles {
|
|
|
753
1056
|
}
|
|
754
1057
|
input?: IInputStyles
|
|
755
1058
|
}
|
|
756
|
-
|
|
1059
|
+
|
|
1060
|
+
checkboxStyles?: {
|
|
1061
|
+
container?: StyleProp<ViewStyle>
|
|
1062
|
+
content?: StyleProp<ViewStyle>
|
|
1063
|
+
indicator?: StyleProp<ViewStyle>
|
|
1064
|
+
indicatorDisabled?: StyleProp<ViewStyle>
|
|
1065
|
+
text?: StyleProp<TextStyle>
|
|
1066
|
+
box?: StyleProp<ViewStyle>
|
|
1067
|
+
icon?: StyleProp<ImageStyle>
|
|
1068
|
+
error?: StyleProp<TextStyle>
|
|
1069
|
+
}
|
|
757
1070
|
|
|
758
1071
|
screenTitle?: StyleProp<TextStyle>
|
|
759
1072
|
ticketHoldersTitle?: StyleProp<TextStyle>
|
|
@@ -784,6 +1097,8 @@ interface IBillingInfoViewStyles {
|
|
|
784
1097
|
message?: StyleProp<TextStyle>
|
|
785
1098
|
time?: StyleProp<TextStyle>
|
|
786
1099
|
}
|
|
1100
|
+
|
|
1101
|
+
privacyPolicyLinkStyle?: StyleProp<TextStyle>
|
|
787
1102
|
}
|
|
788
1103
|
```
|
|
789
1104
|
---
|
|
@@ -799,7 +1114,10 @@ import { Checkout } from 'tf-checkout-react-native'
|
|
|
799
1114
|
Add it to the render function.
|
|
800
1115
|
|
|
801
1116
|
```js
|
|
1117
|
+
const sessionHandleRef = useRef<SessionHandleType>(null)
|
|
1118
|
+
|
|
802
1119
|
<Checkout
|
|
1120
|
+
ref={sessionHandleRef}
|
|
803
1121
|
eventId={EVENT_ID}
|
|
804
1122
|
hash={hash}
|
|
805
1123
|
total={total}
|
|
@@ -815,6 +1133,7 @@ Add it to the render function.
|
|
|
815
1133
|
|
|
816
1134
|
```js
|
|
817
1135
|
{
|
|
1136
|
+
ref?: SessionHandleType
|
|
818
1137
|
eventId: number
|
|
819
1138
|
hash: string
|
|
820
1139
|
total: string
|
|
@@ -926,13 +1245,16 @@ Additionally, if you are encountering problems with building your project, pleas
|
|
|
926
1245
|
Import the component from the library
|
|
927
1246
|
|
|
928
1247
|
```js
|
|
929
|
-
import { PurchaseConfirmation } from 'tf-checkout-react-native'
|
|
1248
|
+
import { PurchaseConfirmation, SessionHandleType } from 'tf-checkout-react-native'
|
|
930
1249
|
```
|
|
931
1250
|
|
|
932
1251
|
Add it to the render function.
|
|
933
1252
|
|
|
934
1253
|
```js
|
|
1254
|
+
const sessionHandleRef = useRef<SessionHandleType>(null)
|
|
1255
|
+
|
|
935
1256
|
<PurchaseConfirmation
|
|
1257
|
+
ref={sessionHandleRef}
|
|
936
1258
|
orderHash={checkoutProps!.hash}
|
|
937
1259
|
onComplete={handleOnComplete}
|
|
938
1260
|
|
|
@@ -978,14 +1300,15 @@ If there is a valid session, there will appear a button to access `MyOrders` in
|
|
|
978
1300
|
Import the component from the library.
|
|
979
1301
|
|
|
980
1302
|
```js
|
|
981
|
-
import { MyOrders } from 'tf-checkout-react-native'
|
|
1303
|
+
import { MyOrders, SessionHandleType } from 'tf-checkout-react-native'
|
|
982
1304
|
```
|
|
983
1305
|
|
|
984
1306
|
|
|
985
1307
|
### Props
|
|
986
1308
|
|
|
987
|
-
```
|
|
1309
|
+
```tsx
|
|
988
1310
|
{
|
|
1311
|
+
ref={SessionHandleType}
|
|
989
1312
|
onSelectOrder: (order: {
|
|
990
1313
|
order: {
|
|
991
1314
|
header: {
|
|
@@ -1102,13 +1425,14 @@ When user selects an order from the `MyOrders` component, will show it details.
|
|
|
1102
1425
|
Import the component from the library.
|
|
1103
1426
|
|
|
1104
1427
|
```js
|
|
1105
|
-
import { MyOrderDetails } from 'tf-checkout-react-native'
|
|
1428
|
+
import { MyOrderDetails, SessionHandleType } from 'tf-checkout-react-native'
|
|
1106
1429
|
```
|
|
1107
1430
|
|
|
1108
1431
|
### Props
|
|
1109
1432
|
|
|
1110
1433
|
```tsx
|
|
1111
1434
|
{
|
|
1435
|
+
ref={SessionHandleType}
|
|
1112
1436
|
data: IMyOrderDetailsData
|
|
1113
1437
|
|
|
1114
1438
|
// Used to navigate to the Resale Tickets screen
|
|
@@ -1270,13 +1594,14 @@ Allows the user to resale the tickets they bought. They can decide wether sell i
|
|
|
1270
1594
|
Import the component from the library.
|
|
1271
1595
|
|
|
1272
1596
|
```js
|
|
1273
|
-
import { ResaleTickets } from 'tf-checkout-react-native'
|
|
1597
|
+
import { ResaleTickets, SessionHandleType } from 'tf-checkout-react-native'
|
|
1274
1598
|
```
|
|
1275
1599
|
|
|
1276
1600
|
### Props
|
|
1277
1601
|
|
|
1278
1602
|
```ts
|
|
1279
1603
|
{
|
|
1604
|
+
ref={SessionHandleType}
|
|
1280
1605
|
ticket: {
|
|
1281
1606
|
currency: string
|
|
1282
1607
|
description: string
|
|
@@ -1369,7 +1694,64 @@ import { ResaleTickets } from 'tf-checkout-react-native'
|
|
|
1369
1694
|
}
|
|
1370
1695
|
```
|
|
1371
1696
|
|
|
1697
|
+
## Reset Password UI
|
|
1698
|
+
|
|
1699
|
+
After opening and URL with the corresponding schema and token, use this component to let the user reset its password.
|
|
1700
|
+
|
|
1701
|
+
### Usage
|
|
1702
|
+
Import the component from the library.
|
|
1703
|
+
```ts
|
|
1704
|
+
import { ResetPassword } from 'tf-checkout-react-native'
|
|
1705
|
+
```
|
|
1706
|
+
|
|
1707
|
+
Then add it to the render function.
|
|
1372
1708
|
|
|
1709
|
+
```xml
|
|
1710
|
+
<ResetPassword
|
|
1711
|
+
styles={myStyles}
|
|
1712
|
+
token={resetToken}
|
|
1713
|
+
onPressResetButton={handleOnPressResetButton}
|
|
1714
|
+
onPressCancelButton={handleOnPressCancelButton}
|
|
1715
|
+
onResetPasswordSuccess={handleOnResetPasswordSuccess}
|
|
1716
|
+
onResetPasswordError={handleOnResetPasswordError}
|
|
1717
|
+
/>
|
|
1718
|
+
```
|
|
1719
|
+
|
|
1720
|
+
### Props
|
|
1721
|
+
|
|
1722
|
+
```ts
|
|
1723
|
+
{
|
|
1724
|
+
token: string
|
|
1725
|
+
styles?: {
|
|
1726
|
+
rootContainer?: StyleProp<ViewStyle>
|
|
1727
|
+
contentContainer?: StyleProp<ViewStyle>
|
|
1728
|
+
title?: StyleProp<TextStyle>
|
|
1729
|
+
resetButton?: IButtonStyles
|
|
1730
|
+
cancelButton?: IButtonStyles
|
|
1731
|
+
input?: IInputStyles
|
|
1732
|
+
apiError?: StyleProp<TextStyle>
|
|
1733
|
+
apiSuccess?: StyleProp<TextStyle>
|
|
1734
|
+
}
|
|
1735
|
+
texts?: {
|
|
1736
|
+
title?: string
|
|
1737
|
+
resetButton?: string
|
|
1738
|
+
cancelButton?: string
|
|
1739
|
+
newPasswordLabel?: string
|
|
1740
|
+
confirmNewPasswordLabel?: string
|
|
1741
|
+
}
|
|
1742
|
+
onResetPasswordSuccess?: (data: {
|
|
1743
|
+
message: string
|
|
1744
|
+
status?: number
|
|
1745
|
+
}) => void
|
|
1746
|
+
onResetPasswordError?: (error: {
|
|
1747
|
+
code?: number
|
|
1748
|
+
message: string
|
|
1749
|
+
extraData?: any
|
|
1750
|
+
}) => void
|
|
1751
|
+
onPressResetButton?: () => void
|
|
1752
|
+
onPressCancelButton?: () => void
|
|
1753
|
+
}
|
|
1754
|
+
```
|
|
1373
1755
|
|
|
1374
1756
|
|
|
1375
1757
|
# Core Components
|
|
@@ -1393,7 +1775,66 @@ import { ResaleTickets } from 'tf-checkout-react-native'
|
|
|
1393
1775
|
[OrderDetailsCore](#orderdetailscore)
|
|
1394
1776
|
|
|
1395
1777
|
[LoginCore](#logincore)
|
|
1778
|
+
|
|
1779
|
+
[ResetPasswordCore](#resetpasswordcore)
|
|
1396
1780
|
|
|
1781
|
+
---
|
|
1782
|
+
## SessionCoreHandle
|
|
1783
|
+
|
|
1784
|
+
All Core components with the exception of Login and ResetPassword exposes the `refreshAccessToken` function to re-authenticate the user after the access token is expired. This is through the corresponding `CoreHandle` ref.
|
|
1785
|
+
|
|
1786
|
+
It returns the `IFetchAccessTokenResponse` object:
|
|
1787
|
+
|
|
1788
|
+
```ts
|
|
1789
|
+
IFetchAccessTokenResponse {
|
|
1790
|
+
accessTokenError?: {
|
|
1791
|
+
code?: number
|
|
1792
|
+
message: string
|
|
1793
|
+
extraData?: any
|
|
1794
|
+
}
|
|
1795
|
+
accessTokenData?: {
|
|
1796
|
+
accessToken: string
|
|
1797
|
+
refreshToken: string
|
|
1798
|
+
tokenType: string
|
|
1799
|
+
scope: string
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
```
|
|
1803
|
+
|
|
1804
|
+
|
|
1805
|
+
### Example:
|
|
1806
|
+
|
|
1807
|
+
Import the component from the library
|
|
1808
|
+
|
|
1809
|
+
```js
|
|
1810
|
+
import {
|
|
1811
|
+
TicketsCore
|
|
1812
|
+
TicketsCoreHandle // You can import the Handle to use it as type in the useRef hook
|
|
1813
|
+
} from 'tf-checkout-react-native'
|
|
1814
|
+
```
|
|
1815
|
+
|
|
1816
|
+
Declare a reference to pass it to the component.
|
|
1817
|
+
|
|
1818
|
+
```js
|
|
1819
|
+
const ticketsCoreRef = useRef<TicketsCoreHandle>(null)
|
|
1820
|
+
```
|
|
1821
|
+
|
|
1822
|
+
Then add it to the render function and assign the reference to the corresponding component.
|
|
1823
|
+
|
|
1824
|
+
```js
|
|
1825
|
+
<TicketsCore ref={ticketsCoreRef}>
|
|
1826
|
+
<YourComponent />
|
|
1827
|
+
</TicketsCore>
|
|
1828
|
+
```
|
|
1829
|
+
|
|
1830
|
+
Use the reference to access the component methods.
|
|
1831
|
+
|
|
1832
|
+
```js
|
|
1833
|
+
const handleGetTickets = async () => {
|
|
1834
|
+
const res = await ticketsCoreRef.current.refreshAccessToken()
|
|
1835
|
+
}
|
|
1836
|
+
```
|
|
1837
|
+
|
|
1397
1838
|
---
|
|
1398
1839
|
|
|
1399
1840
|
## TicketsCore
|
|
@@ -1409,6 +1850,8 @@ Exposes the following functions:
|
|
|
1409
1850
|
|
|
1410
1851
|
`postReferralVisit` Posts a referral visit to the server.
|
|
1411
1852
|
|
|
1853
|
+
`refreshAccessToken` : Refreshes expired access token.
|
|
1854
|
+
|
|
1412
1855
|
```js
|
|
1413
1856
|
{
|
|
1414
1857
|
// Fetches the tickets from the event set in the config function. It receives a promoCode parameter to apply to the tickets.
|
|
@@ -1562,16 +2005,16 @@ Exposes the following functions:
|
|
|
1562
2005
|
}
|
|
1563
2006
|
|
|
1564
2007
|
postReferralVisit(referralId: string): Promise<
|
|
1565
|
-
|
|
1566
|
-
|
|
2008
|
+
postReferralError?: {
|
|
2009
|
+
code?: number
|
|
2010
|
+
message: string
|
|
2011
|
+
extraData?: any
|
|
2012
|
+
}
|
|
2013
|
+
postReferralData?: {
|
|
1567
2014
|
message: string
|
|
1568
|
-
|
|
1569
|
-
}
|
|
1570
|
-
|
|
1571
|
-
message: string
|
|
1572
|
-
status: number
|
|
1573
|
-
}
|
|
1574
|
-
>
|
|
2015
|
+
status: number
|
|
2016
|
+
}>
|
|
2017
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
1575
2018
|
}>
|
|
1576
2019
|
}
|
|
1577
2020
|
```
|
|
@@ -1582,7 +2025,6 @@ Import the component from the library
|
|
|
1582
2025
|
import {
|
|
1583
2026
|
TicketsCore
|
|
1584
2027
|
TicketsCoreHandle // You can import the Handle to use it as type in the useRef hook
|
|
1585
|
-
|
|
1586
2028
|
} from 'tf-checkout-react-native'
|
|
1587
2029
|
```
|
|
1588
2030
|
|
|
@@ -1606,15 +2048,15 @@ Use the reference to access the component methods.
|
|
|
1606
2048
|
const handleGetTickets = async () => {
|
|
1607
2049
|
const res = await ticketsCoreRef.current.getTickets()
|
|
1608
2050
|
}
|
|
1609
|
-
|
|
1610
2051
|
```
|
|
2052
|
+
---
|
|
1611
2053
|
|
|
1612
2054
|
## WaitingListCore
|
|
1613
2055
|
This component *must* appear after getting the response from **getTickets()** and the property `isInWaitingList` is set to true.
|
|
1614
2056
|
|
|
1615
2057
|
|
|
1616
2058
|
Exposes the following functions:
|
|
1617
|
-
```
|
|
2059
|
+
```tsx
|
|
1618
2060
|
{
|
|
1619
2061
|
addToWaitingList(
|
|
1620
2062
|
params: {
|
|
@@ -1635,6 +2077,7 @@ Exposes the following functions:
|
|
|
1635
2077
|
success: boolean
|
|
1636
2078
|
}
|
|
1637
2079
|
}>
|
|
2080
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
1638
2081
|
}
|
|
1639
2082
|
```
|
|
1640
2083
|
**addToWaitingList** Receives params with the following properties:
|
|
@@ -1692,6 +2135,7 @@ const handleAddToWaitingList = async (params: IAddToWaitingListCoreParams) => {
|
|
|
1692
2135
|
const res = await waitingListCoreRef.current.addToWaitingList(params)
|
|
1693
2136
|
}
|
|
1694
2137
|
```
|
|
2138
|
+
---
|
|
1695
2139
|
|
|
1696
2140
|
## BillingCore
|
|
1697
2141
|
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.
|
|
@@ -1706,7 +2150,7 @@ Exposes the following functions:
|
|
|
1706
2150
|
|
|
1707
2151
|
`getUserProfile` Fetches the user profile information.
|
|
1708
2152
|
|
|
1709
|
-
`registerNewUser` Registers a new user.
|
|
2153
|
+
`registerNewUser` Registers a new user. Returns accessTokens data.
|
|
1710
2154
|
|
|
1711
2155
|
`checkoutOrder` Performs the checkout.
|
|
1712
2156
|
|
|
@@ -1792,24 +2236,31 @@ Exposes the following functions:
|
|
|
1792
2236
|
|
|
1793
2237
|
// Registers a new user.
|
|
1794
2238
|
registerNewUser(data: FormData): Promise<{
|
|
1795
|
-
|
|
2239
|
+
registerNewUserResponseError?: {
|
|
1796
2240
|
isAlreadyRegistered?: boolean
|
|
1797
2241
|
message?: string
|
|
1798
2242
|
raw?: any
|
|
1799
2243
|
}
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
2244
|
+
registerNewUserResponseData?: {
|
|
2245
|
+
accessTokenData: {
|
|
2246
|
+
accessToken: string
|
|
2247
|
+
refreshToken: string
|
|
2248
|
+
tokenType: string
|
|
2249
|
+
scope: string
|
|
2250
|
+
}
|
|
2251
|
+
userProfile: {
|
|
2252
|
+
firstName: string
|
|
2253
|
+
lastName: string
|
|
1806
2254
|
email: string
|
|
1807
2255
|
}
|
|
1808
2256
|
}
|
|
1809
2257
|
}>
|
|
2258
|
+
|
|
2259
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
1810
2260
|
}
|
|
1811
2261
|
|
|
1812
2262
|
```
|
|
2263
|
+
---
|
|
1813
2264
|
|
|
1814
2265
|
## CheckoutCore
|
|
1815
2266
|
Shows the event conditions, purchase details and process the payment and free registration to an event.
|
|
@@ -1833,6 +2284,8 @@ Exposes the following functions:
|
|
|
1833
2284
|
|
|
1834
2285
|
`paymentSuccess` Payment success.
|
|
1835
2286
|
|
|
2287
|
+
`refreshAccessToken` Refreshes access token.
|
|
2288
|
+
|
|
1836
2289
|
|
|
1837
2290
|
```ts
|
|
1838
2291
|
// Get event conditions for the current event.
|
|
@@ -1935,8 +2388,11 @@ freeRegistration(orderHash: string): Promise<{
|
|
|
1935
2388
|
|
|
1936
2389
|
// Payment success.
|
|
1937
2390
|
paymentSuccess(orderHash: string): Promise<any>
|
|
1938
|
-
```
|
|
1939
2391
|
|
|
2392
|
+
// Refresh access token.
|
|
2393
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
2394
|
+
```
|
|
2395
|
+
---
|
|
1940
2396
|
## PurchaseConfirmationCore
|
|
1941
2397
|
Shows the purchase confirmation information.
|
|
1942
2398
|
|
|
@@ -1944,6 +2400,8 @@ It exposes the following functions:
|
|
|
1944
2400
|
|
|
1945
2401
|
`getPurchaseConfirmation` Get purchase confirmation for the current event.
|
|
1946
2402
|
|
|
2403
|
+
`refreshAccesstoken` Refreshes access token.
|
|
2404
|
+
|
|
1947
2405
|
```ts
|
|
1948
2406
|
getPurchaseConfirmation(
|
|
1949
2407
|
orderHash: string
|
|
@@ -1981,8 +2439,9 @@ getPurchaseConfirmation(
|
|
|
1981
2439
|
}[]
|
|
1982
2440
|
}
|
|
1983
2441
|
}>
|
|
2442
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
1984
2443
|
```
|
|
1985
|
-
|
|
2444
|
+
---
|
|
1986
2445
|
## MyOrdersCore
|
|
1987
2446
|
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.
|
|
1988
2447
|
|
|
@@ -1992,8 +2451,12 @@ Exposes the following functions:
|
|
|
1992
2451
|
|
|
1993
2452
|
`getOrderDetails` Get the details from a specific order.
|
|
1994
2453
|
|
|
2454
|
+
`refreshAccessToken` Refreshes access token.
|
|
2455
|
+
|
|
1995
2456
|
|
|
1996
2457
|
```ts
|
|
2458
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
2459
|
+
|
|
1997
2460
|
getMyOrders(page: number, filter: string): Promise<{
|
|
1998
2461
|
myOrdersData?: {
|
|
1999
2462
|
events: {
|
|
@@ -2062,7 +2525,7 @@ getOrderDetails(orderId: string): Promise<{
|
|
|
2062
2525
|
}
|
|
2063
2526
|
}>
|
|
2064
2527
|
```
|
|
2065
|
-
|
|
2528
|
+
---
|
|
2066
2529
|
## OrderDetailsCore
|
|
2067
2530
|
Allows to re-sale the tickets or to remove them from the re-sale system.
|
|
2068
2531
|
|
|
@@ -2130,7 +2593,7 @@ resaleTicket(
|
|
|
2130
2593
|
}
|
|
2131
2594
|
}>
|
|
2132
2595
|
```
|
|
2133
|
-
|
|
2596
|
+
---
|
|
2134
2597
|
## LoginCore
|
|
2135
2598
|
Handles the login and logout process.
|
|
2136
2599
|
|
|
@@ -2151,7 +2614,7 @@ login(fields?: {
|
|
|
2151
2614
|
extraData?: any
|
|
2152
2615
|
}
|
|
2153
2616
|
|
|
2154
|
-
|
|
2617
|
+
userProfile?: {
|
|
2155
2618
|
customerId: string
|
|
2156
2619
|
firstName: string
|
|
2157
2620
|
lastName: string
|
|
@@ -2165,17 +2628,102 @@ login(fields?: {
|
|
|
2165
2628
|
stateId: string
|
|
2166
2629
|
city: string
|
|
2167
2630
|
}
|
|
2631
|
+
|
|
2632
|
+
accessTokenData?: {
|
|
2633
|
+
accessToken: string
|
|
2634
|
+
refreshToken: string
|
|
2635
|
+
tokenType: string
|
|
2636
|
+
scope: string
|
|
2637
|
+
}
|
|
2168
2638
|
}>
|
|
2169
2639
|
|
|
2170
2640
|
logout(): Promise<void>
|
|
2171
2641
|
```
|
|
2642
|
+
---
|
|
2643
|
+
## ResetPasswordCore
|
|
2644
|
+
Will allow the user to reset its password.
|
|
2645
|
+
|
|
2646
|
+
Exposes the following function:
|
|
2172
2647
|
|
|
2648
|
+
`postResetPassword` Sends the reset token and the new password values.
|
|
2649
|
+
|
|
2650
|
+
postResetPassword parameters:
|
|
2651
|
+
```
|
|
2652
|
+
token: string,
|
|
2653
|
+
password: string,
|
|
2654
|
+
password_confirmation: string,
|
|
2655
|
+
```
|
|
2656
|
+
postResetPassword returning data:
|
|
2657
|
+
|
|
2658
|
+
```ts
|
|
2659
|
+
{
|
|
2660
|
+
data?: {
|
|
2661
|
+
message: string
|
|
2662
|
+
status?: number
|
|
2663
|
+
}
|
|
2664
|
+
error?: {
|
|
2665
|
+
code?: number
|
|
2666
|
+
message: string
|
|
2667
|
+
extraData?: any
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
```
|
|
2671
|
+
|
|
2672
|
+
### Usage
|
|
2673
|
+
Import it from the library.
|
|
2674
|
+
|
|
2675
|
+
```ts
|
|
2676
|
+
import { ResetPasswordCore, ResetPasswordCoreHandle } from 'tf-checkout-react-native'
|
|
2677
|
+
```
|
|
2678
|
+
Wrap your component with the Core component.
|
|
2679
|
+
|
|
2680
|
+
```xml
|
|
2681
|
+
<ResetPasswordCore ref={resetPasswordCoreRef}>
|
|
2682
|
+
{yourComponent}
|
|
2683
|
+
</ResetPasswordCore>
|
|
2684
|
+
```
|
|
2173
2685
|
|
|
2174
2686
|
# Utils
|
|
2175
2687
|
|
|
2176
2688
|
`deleteAllData` asynchronously deletes all the data stored in the local storage. Use this with caution, only in an edge case.
|
|
2177
2689
|
|
|
2178
2690
|
# Changelog
|
|
2691
|
+
|
|
2692
|
+
## Version 1.0.25
|
|
2693
|
+
- Exposes `refreshAccessToken` function.
|
|
2694
|
+
- Changed returned `data` prop to `userProfile` in LoginCore response.
|
|
2695
|
+
- In **LoginCore Component**:
|
|
2696
|
+
- Add `accessTokenData` object prop in `onLoginSuccessful` response.
|
|
2697
|
+
- On **BillingUI Component**:
|
|
2698
|
+
- Change `onRegisterSuccess` return data type.
|
|
2699
|
+
- Change `onRegisterError` return data type.
|
|
2700
|
+
- On **LoginCore**:
|
|
2701
|
+
- Change `login` return data type to include `accessTokenData` object.
|
|
2702
|
+
- Exports `SessionHandleType` to use it in the `ref` of the UI components.
|
|
2703
|
+
- All UI and Core components except Login and ResetPassword:
|
|
2704
|
+
- Export function `refreshAccessToken`
|
|
2705
|
+
- Add `reloadData` to re-fetch servers data in UI components.
|
|
2706
|
+
|
|
2707
|
+
## Version 1.0.24
|
|
2708
|
+
- Add **SingleSignOn** feature.
|
|
2709
|
+
- Add show Tickets in groups and the option to sort them by sold out.
|
|
2710
|
+
- Add config prop to Tickets component:
|
|
2711
|
+
|
|
2712
|
+
```ts
|
|
2713
|
+
config: {
|
|
2714
|
+
// Indicates if loading component should be visible.
|
|
2715
|
+
areActivityIndicatorsEnabled?: boolean
|
|
2716
|
+
areAlertsEnabled?: boolean
|
|
2717
|
+
areTicketsSortedBySoldOut?: boolean
|
|
2718
|
+
areTicketsGrouped?: boolean
|
|
2719
|
+
}
|
|
2720
|
+
```
|
|
2721
|
+
- Updated Tickets styles prop to include Ticket Section Header.
|
|
2722
|
+
- Moved `areActivityIndicatorsEnabled` and `areAlertsEnabled` to the `config` prop.
|
|
2723
|
+
- Made TTF Privacy Policy mandatory.
|
|
2724
|
+
- Added `styles` and `texts` props for TTF Privacy Policy checkbox.
|
|
2725
|
+
- Added **Password Protected** event feature.
|
|
2726
|
+
|
|
2179
2727
|
## Version 1.0.23
|
|
2180
2728
|
- Fix Checkout not allowing free registrations
|
|
2181
2729
|
|