tf-checkout-react-native 1.0.24 → 1.0.26
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 +340 -32
- package/lib/api/ApiClient.d.ts +2 -5
- package/lib/api/ApiClient.js +70 -23
- package/lib/api/ApiClient.js.map +1 -1
- package/lib/api/types.d.ts +38 -26
- package/lib/api/types.js +1 -0
- package/lib/api/types.js.map +1 -1
- package/lib/components/login/Login.js +7 -4
- package/lib/components/login/Login.js.map +1 -1
- package/lib/components/login/types.d.ts +6 -1
- 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 +238 -118
- package/lib/containers/billingInfo/Billing.js.map +1 -1
- package/lib/containers/billingInfo/types.d.ts +6 -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/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/tickets/Tickets.d.ts +3 -2
- package/lib/containers/tickets/Tickets.js +41 -11
- package/lib/containers/tickets/Tickets.js.map +1 -1
- package/lib/containers/tickets/TicketsView.js +0 -1
- package/lib/containers/tickets/TicketsView.js.map +1 -1
- 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 +10 -18
- 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 +3 -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/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 +4 -0
- package/lib/core/TicketsCore/TicketsCore.js.map +1 -1
- package/lib/core/TicketsCore/TicketsCoreTypes.d.ts +3 -1
- 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 +3 -1
- package/lib/core/index.js +1 -0
- package/lib/core/index.js.map +1 -1
- package/lib/helpers/LocalStorage.d.ts +2 -0
- package/lib/helpers/LocalStorage.js +6 -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/helpers/StringsHelper.d.ts +1 -0
- package/lib/helpers/StringsHelper.js +1 -0
- package/lib/helpers/StringsHelper.js.map +1 -1
- package/lib/helpers/Validators.js.map +1 -1
- package/lib/index.d.ts +9 -3
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/types/IEvent.d.ts +5 -0
- package/lib/types/ITicket.d.ts +2 -0
- package/package.json +1 -1
- package/android/.gradle/7.4.2/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4.2/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/7.4.2/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/7.4.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.4.2/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.4.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.4.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/ios/TFCheckoutRNModule.xcodeproj/project.xcworkspace/xcuserdata/jorgegutierrez.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/TFCheckoutRNModule.xcodeproj/xcshareddata/xcschemes/TFCheckoutRNModule.xcscheme +0 -67
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).
|
|
@@ -223,6 +225,12 @@ Let the user to resale their tickets. They can choose between selling them to a
|
|
|
223
225
|
|
|
224
226
|
After opening and URL with the corresponding schema, use this component to let the user reset its password.
|
|
225
227
|
|
|
228
|
+
### Exported functions
|
|
229
|
+
|
|
230
|
+
- setConfig: Sets config for the library
|
|
231
|
+
|
|
232
|
+
- refreshAccessToken: Let refresh the expired access token.
|
|
233
|
+
|
|
226
234
|
# Component styling
|
|
227
235
|
### Button
|
|
228
236
|
```ts
|
|
@@ -259,6 +267,69 @@ interface ICheckboxStyles {
|
|
|
259
267
|
}
|
|
260
268
|
```
|
|
261
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
|
+
```
|
|
262
333
|
|
|
263
334
|
# Exported components
|
|
264
335
|
Depending on your needs, you can use the UI Components or the Core Components.
|
|
@@ -287,6 +358,14 @@ Depending on your needs, you can use the UI Components or the Core Components.
|
|
|
287
358
|
|
|
288
359
|
[Reset Password](#reset-password-ui)
|
|
289
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
|
+
|
|
290
369
|
---
|
|
291
370
|
## Login UI
|
|
292
371
|
|
|
@@ -300,7 +379,10 @@ Then add it to the render function.
|
|
|
300
379
|
|
|
301
380
|
```tsx
|
|
302
381
|
<Login
|
|
303
|
-
onLoginSuccessful: (
|
|
382
|
+
onLoginSuccessful: (
|
|
383
|
+
userProfile: IUserProfile,
|
|
384
|
+
accessTokenData?: IFetchAccessTokenData
|
|
385
|
+
) => void
|
|
304
386
|
onLoginError?: (error: IError) => void
|
|
305
387
|
|
|
306
388
|
onFetchUserProfileError?: (error: IError) => void
|
|
@@ -348,6 +430,34 @@ Then add it to the render function.
|
|
|
348
430
|
/>
|
|
349
431
|
```
|
|
350
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
|
+
```
|
|
351
461
|
### Props
|
|
352
462
|
| Property | Description |
|
|
353
463
|
|----------|-------------|
|
|
@@ -480,13 +590,19 @@ import { Tickets } from 'tf-checkout-react-native'
|
|
|
480
590
|
Then add it to the render function.
|
|
481
591
|
|
|
482
592
|
```js
|
|
483
|
-
|
|
593
|
+
const sessionHandleRef = useRef<SessionHandleType>(null)
|
|
594
|
+
|
|
595
|
+
<Tickets
|
|
596
|
+
ref={sessionHandleRef}
|
|
597
|
+
eventId={EVENT_ID}
|
|
598
|
+
onAddToCartSuccess={handleOnAddToCartSuccess} />
|
|
484
599
|
```
|
|
485
600
|
|
|
486
601
|
### Props
|
|
487
602
|
|
|
488
603
|
```js
|
|
489
604
|
{
|
|
605
|
+
ref?: SessionHandleType
|
|
490
606
|
// Callbacks for when user taps on GET Tickets button
|
|
491
607
|
onAddToCartSuccess: (data: {
|
|
492
608
|
isBillingRequired: boolean
|
|
@@ -494,6 +610,8 @@ Then add it to the render function.
|
|
|
494
610
|
isAgeRequired?: boolean
|
|
495
611
|
minimumAge?: number
|
|
496
612
|
isNameRequired?: boolean
|
|
613
|
+
isTicketFree?: boolean
|
|
614
|
+
isPhoneHidden?: boolean
|
|
497
615
|
}) => void
|
|
498
616
|
onAddToCartError?: (error: {
|
|
499
617
|
code: number
|
|
@@ -553,6 +671,7 @@ Then add it to the render function.
|
|
|
553
671
|
isLoading?: boolean
|
|
554
672
|
}
|
|
555
673
|
|
|
674
|
+
// Configure the Component behavior
|
|
556
675
|
config: {
|
|
557
676
|
areActivityIndicatorsEnabled?: boolean
|
|
558
677
|
areAlertsEnabled?: boolean
|
|
@@ -578,6 +697,21 @@ Then add it to the render function.
|
|
|
578
697
|
}
|
|
579
698
|
```
|
|
580
699
|
|
|
700
|
+
### config prop
|
|
701
|
+
Configure the component's behavior
|
|
702
|
+
```ts
|
|
703
|
+
config: {
|
|
704
|
+
// Whether or not show the loading indicators.
|
|
705
|
+
areActivityIndicatorsEnabled?: boolean
|
|
706
|
+
// Whether or not show the alerts.
|
|
707
|
+
areAlertsEnabled?: boolean
|
|
708
|
+
// Whether or not the Ticket should be sorted by Sold Out.
|
|
709
|
+
areTicketsSortedBySoldOut?: boolean
|
|
710
|
+
// Whether or not the tickets should be grouped, they need to be configured as groups in the Tickets admin.
|
|
711
|
+
areTicketsGrouped?: boolean
|
|
712
|
+
}
|
|
713
|
+
```
|
|
714
|
+
|
|
581
715
|
You can then call the `BillingInfo` component and pass them as props in the `cartProps` prop.
|
|
582
716
|
|
|
583
717
|
`onFetchTicketsSuccess` When tickets fetching was successful, will return fetched data, including `promoCodeResponse`.
|
|
@@ -721,7 +855,11 @@ import { BillingInfo } from 'tf-checkout-react-native'
|
|
|
721
855
|
Add it to the render function.
|
|
722
856
|
|
|
723
857
|
```js
|
|
858
|
+
const sessionHandleRef = useRef<SessionHandleType>(null)
|
|
859
|
+
|
|
860
|
+
|
|
724
861
|
<BillingInfo
|
|
862
|
+
ref={sessionHandleRef}
|
|
725
863
|
cartProps: {
|
|
726
864
|
isBillingRequired: boolean
|
|
727
865
|
isNameRequired: boolean
|
|
@@ -730,8 +868,24 @@ Add it to the render function.
|
|
|
730
868
|
minimumAge: number
|
|
731
869
|
}
|
|
732
870
|
// registerNewUser
|
|
733
|
-
onRegisterSuccess?: (
|
|
734
|
-
|
|
871
|
+
onRegisterSuccess?: (data: {
|
|
872
|
+
accessTokenData: {
|
|
873
|
+
accessToken: string
|
|
874
|
+
refreshToken: string
|
|
875
|
+
tokenType: string
|
|
876
|
+
scope: string
|
|
877
|
+
}
|
|
878
|
+
userProfile: {
|
|
879
|
+
firstName: string
|
|
880
|
+
lastName: string
|
|
881
|
+
email: string
|
|
882
|
+
}
|
|
883
|
+
}) => void
|
|
884
|
+
onRegisterError?: (error: {
|
|
885
|
+
isAlreadyRegistered?: boolean
|
|
886
|
+
message?: string
|
|
887
|
+
raw?: any
|
|
888
|
+
}) => void
|
|
735
889
|
|
|
736
890
|
onCheckoutSuccess: (data: {
|
|
737
891
|
id: string
|
|
@@ -741,7 +895,8 @@ Add it to the render function.
|
|
|
741
895
|
}) => void
|
|
742
896
|
onCheckoutError?: (error: IError) => void
|
|
743
897
|
|
|
744
|
-
|
|
898
|
+
// See ILoginSuccessData data type below.
|
|
899
|
+
onLoginSuccess: (data: ILoginSuccessData) => void
|
|
745
900
|
onLoginError?: (error: IError) => void
|
|
746
901
|
|
|
747
902
|
onFetchUserProfileSuccess?: (data: any) => void
|
|
@@ -795,6 +950,34 @@ Add it to the render function.
|
|
|
795
950
|
/>
|
|
796
951
|
```
|
|
797
952
|
|
|
953
|
+
### DataTypes
|
|
954
|
+
ILoginSuccessData
|
|
955
|
+
|
|
956
|
+
```ts
|
|
957
|
+
interface ILoginSuccessData {
|
|
958
|
+
userProfile: {
|
|
959
|
+
customerId: string
|
|
960
|
+
firstName: string
|
|
961
|
+
lastName: string
|
|
962
|
+
email: string
|
|
963
|
+
phone: string
|
|
964
|
+
streetAddress: string
|
|
965
|
+
zipCode: string
|
|
966
|
+
countryId: string
|
|
967
|
+
company?: string
|
|
968
|
+
state: string
|
|
969
|
+
stateId: string
|
|
970
|
+
city: string
|
|
971
|
+
}
|
|
972
|
+
accessTokenData?: {
|
|
973
|
+
accessToken: string
|
|
974
|
+
refreshToken: string
|
|
975
|
+
tokenType: string
|
|
976
|
+
scope: string
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
```
|
|
980
|
+
|
|
798
981
|
### Props
|
|
799
982
|
| Property | Description |
|
|
800
983
|
|----------|-------------|
|
|
@@ -933,7 +1116,10 @@ import { Checkout } from 'tf-checkout-react-native'
|
|
|
933
1116
|
Add it to the render function.
|
|
934
1117
|
|
|
935
1118
|
```js
|
|
1119
|
+
const sessionHandleRef = useRef<SessionHandleType>(null)
|
|
1120
|
+
|
|
936
1121
|
<Checkout
|
|
1122
|
+
ref={sessionHandleRef}
|
|
937
1123
|
eventId={EVENT_ID}
|
|
938
1124
|
hash={hash}
|
|
939
1125
|
total={total}
|
|
@@ -949,6 +1135,7 @@ Add it to the render function.
|
|
|
949
1135
|
|
|
950
1136
|
```js
|
|
951
1137
|
{
|
|
1138
|
+
ref?: SessionHandleType
|
|
952
1139
|
eventId: number
|
|
953
1140
|
hash: string
|
|
954
1141
|
total: string
|
|
@@ -1060,13 +1247,16 @@ Additionally, if you are encountering problems with building your project, pleas
|
|
|
1060
1247
|
Import the component from the library
|
|
1061
1248
|
|
|
1062
1249
|
```js
|
|
1063
|
-
import { PurchaseConfirmation } from 'tf-checkout-react-native'
|
|
1250
|
+
import { PurchaseConfirmation, SessionHandleType } from 'tf-checkout-react-native'
|
|
1064
1251
|
```
|
|
1065
1252
|
|
|
1066
1253
|
Add it to the render function.
|
|
1067
1254
|
|
|
1068
1255
|
```js
|
|
1256
|
+
const sessionHandleRef = useRef<SessionHandleType>(null)
|
|
1257
|
+
|
|
1069
1258
|
<PurchaseConfirmation
|
|
1259
|
+
ref={sessionHandleRef}
|
|
1070
1260
|
orderHash={checkoutProps!.hash}
|
|
1071
1261
|
onComplete={handleOnComplete}
|
|
1072
1262
|
|
|
@@ -1112,14 +1302,15 @@ If there is a valid session, there will appear a button to access `MyOrders` in
|
|
|
1112
1302
|
Import the component from the library.
|
|
1113
1303
|
|
|
1114
1304
|
```js
|
|
1115
|
-
import { MyOrders } from 'tf-checkout-react-native'
|
|
1305
|
+
import { MyOrders, SessionHandleType } from 'tf-checkout-react-native'
|
|
1116
1306
|
```
|
|
1117
1307
|
|
|
1118
1308
|
|
|
1119
1309
|
### Props
|
|
1120
1310
|
|
|
1121
|
-
```
|
|
1311
|
+
```tsx
|
|
1122
1312
|
{
|
|
1313
|
+
ref={SessionHandleType}
|
|
1123
1314
|
onSelectOrder: (order: {
|
|
1124
1315
|
order: {
|
|
1125
1316
|
header: {
|
|
@@ -1236,13 +1427,14 @@ When user selects an order from the `MyOrders` component, will show it details.
|
|
|
1236
1427
|
Import the component from the library.
|
|
1237
1428
|
|
|
1238
1429
|
```js
|
|
1239
|
-
import { MyOrderDetails } from 'tf-checkout-react-native'
|
|
1430
|
+
import { MyOrderDetails, SessionHandleType } from 'tf-checkout-react-native'
|
|
1240
1431
|
```
|
|
1241
1432
|
|
|
1242
1433
|
### Props
|
|
1243
1434
|
|
|
1244
1435
|
```tsx
|
|
1245
1436
|
{
|
|
1437
|
+
ref={SessionHandleType}
|
|
1246
1438
|
data: IMyOrderDetailsData
|
|
1247
1439
|
|
|
1248
1440
|
// Used to navigate to the Resale Tickets screen
|
|
@@ -1404,13 +1596,14 @@ Allows the user to resale the tickets they bought. They can decide wether sell i
|
|
|
1404
1596
|
Import the component from the library.
|
|
1405
1597
|
|
|
1406
1598
|
```js
|
|
1407
|
-
import { ResaleTickets } from 'tf-checkout-react-native'
|
|
1599
|
+
import { ResaleTickets, SessionHandleType } from 'tf-checkout-react-native'
|
|
1408
1600
|
```
|
|
1409
1601
|
|
|
1410
1602
|
### Props
|
|
1411
1603
|
|
|
1412
1604
|
```ts
|
|
1413
1605
|
{
|
|
1606
|
+
ref={SessionHandleType}
|
|
1414
1607
|
ticket: {
|
|
1415
1608
|
currency: string
|
|
1416
1609
|
description: string
|
|
@@ -1587,6 +1780,63 @@ Then add it to the render function.
|
|
|
1587
1780
|
|
|
1588
1781
|
[ResetPasswordCore](#resetpasswordcore)
|
|
1589
1782
|
|
|
1783
|
+
---
|
|
1784
|
+
## SessionCoreHandle
|
|
1785
|
+
|
|
1786
|
+
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.
|
|
1787
|
+
|
|
1788
|
+
It returns the `IFetchAccessTokenResponse` object:
|
|
1789
|
+
|
|
1790
|
+
```ts
|
|
1791
|
+
IFetchAccessTokenResponse {
|
|
1792
|
+
accessTokenError?: {
|
|
1793
|
+
code?: number
|
|
1794
|
+
message: string
|
|
1795
|
+
extraData?: any
|
|
1796
|
+
}
|
|
1797
|
+
accessTokenData?: {
|
|
1798
|
+
accessToken: string
|
|
1799
|
+
refreshToken: string
|
|
1800
|
+
tokenType: string
|
|
1801
|
+
scope: string
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
```
|
|
1805
|
+
|
|
1806
|
+
|
|
1807
|
+
### Example:
|
|
1808
|
+
|
|
1809
|
+
Import the component from the library
|
|
1810
|
+
|
|
1811
|
+
```js
|
|
1812
|
+
import {
|
|
1813
|
+
TicketsCore
|
|
1814
|
+
TicketsCoreHandle // You can import the Handle to use it as type in the useRef hook
|
|
1815
|
+
} from 'tf-checkout-react-native'
|
|
1816
|
+
```
|
|
1817
|
+
|
|
1818
|
+
Declare a reference to pass it to the component.
|
|
1819
|
+
|
|
1820
|
+
```js
|
|
1821
|
+
const ticketsCoreRef = useRef<TicketsCoreHandle>(null)
|
|
1822
|
+
```
|
|
1823
|
+
|
|
1824
|
+
Then add it to the render function and assign the reference to the corresponding component.
|
|
1825
|
+
|
|
1826
|
+
```js
|
|
1827
|
+
<TicketsCore ref={ticketsCoreRef}>
|
|
1828
|
+
<YourComponent />
|
|
1829
|
+
</TicketsCore>
|
|
1830
|
+
```
|
|
1831
|
+
|
|
1832
|
+
Use the reference to access the component methods.
|
|
1833
|
+
|
|
1834
|
+
```js
|
|
1835
|
+
const handleGetTickets = async () => {
|
|
1836
|
+
const res = await ticketsCoreRef.current.refreshAccessToken()
|
|
1837
|
+
}
|
|
1838
|
+
```
|
|
1839
|
+
|
|
1590
1840
|
---
|
|
1591
1841
|
|
|
1592
1842
|
## TicketsCore
|
|
@@ -1602,6 +1852,8 @@ Exposes the following functions:
|
|
|
1602
1852
|
|
|
1603
1853
|
`postReferralVisit` Posts a referral visit to the server.
|
|
1604
1854
|
|
|
1855
|
+
`refreshAccessToken` : Refreshes expired access token.
|
|
1856
|
+
|
|
1605
1857
|
```js
|
|
1606
1858
|
{
|
|
1607
1859
|
// Fetches the tickets from the event set in the config function. It receives a promoCode parameter to apply to the tickets.
|
|
@@ -1752,19 +2004,21 @@ Exposes the following functions:
|
|
|
1752
2004
|
isAgeRequired?: boolean
|
|
1753
2005
|
minimumAge?: number
|
|
1754
2006
|
isNameRequired?: boolean
|
|
2007
|
+
isTicketFree?: boolean
|
|
2008
|
+
isPhoneHidden?: boolean
|
|
1755
2009
|
}
|
|
1756
2010
|
|
|
1757
2011
|
postReferralVisit(referralId: string): Promise<
|
|
1758
|
-
|
|
1759
|
-
|
|
2012
|
+
postReferralError?: {
|
|
2013
|
+
code?: number
|
|
2014
|
+
message: string
|
|
2015
|
+
extraData?: any
|
|
2016
|
+
}
|
|
2017
|
+
postReferralData?: {
|
|
1760
2018
|
message: string
|
|
1761
|
-
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1764
|
-
message: string
|
|
1765
|
-
status: number
|
|
1766
|
-
}
|
|
1767
|
-
>
|
|
2019
|
+
status: number
|
|
2020
|
+
}>
|
|
2021
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
1768
2022
|
}>
|
|
1769
2023
|
}
|
|
1770
2024
|
```
|
|
@@ -1775,7 +2029,6 @@ Import the component from the library
|
|
|
1775
2029
|
import {
|
|
1776
2030
|
TicketsCore
|
|
1777
2031
|
TicketsCoreHandle // You can import the Handle to use it as type in the useRef hook
|
|
1778
|
-
|
|
1779
2032
|
} from 'tf-checkout-react-native'
|
|
1780
2033
|
```
|
|
1781
2034
|
|
|
@@ -1799,7 +2052,6 @@ Use the reference to access the component methods.
|
|
|
1799
2052
|
const handleGetTickets = async () => {
|
|
1800
2053
|
const res = await ticketsCoreRef.current.getTickets()
|
|
1801
2054
|
}
|
|
1802
|
-
|
|
1803
2055
|
```
|
|
1804
2056
|
---
|
|
1805
2057
|
|
|
@@ -1808,7 +2060,7 @@ This component *must* appear after getting the response from **getTickets()** an
|
|
|
1808
2060
|
|
|
1809
2061
|
|
|
1810
2062
|
Exposes the following functions:
|
|
1811
|
-
```
|
|
2063
|
+
```tsx
|
|
1812
2064
|
{
|
|
1813
2065
|
addToWaitingList(
|
|
1814
2066
|
params: {
|
|
@@ -1829,6 +2081,7 @@ Exposes the following functions:
|
|
|
1829
2081
|
success: boolean
|
|
1830
2082
|
}
|
|
1831
2083
|
}>
|
|
2084
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
1832
2085
|
}
|
|
1833
2086
|
```
|
|
1834
2087
|
**addToWaitingList** Receives params with the following properties:
|
|
@@ -1901,7 +2154,7 @@ Exposes the following functions:
|
|
|
1901
2154
|
|
|
1902
2155
|
`getUserProfile` Fetches the user profile information.
|
|
1903
2156
|
|
|
1904
|
-
`registerNewUser` Registers a new user.
|
|
2157
|
+
`registerNewUser` Registers a new user. Returns accessTokens data.
|
|
1905
2158
|
|
|
1906
2159
|
`checkoutOrder` Performs the checkout.
|
|
1907
2160
|
|
|
@@ -1987,21 +2240,27 @@ Exposes the following functions:
|
|
|
1987
2240
|
|
|
1988
2241
|
// Registers a new user.
|
|
1989
2242
|
registerNewUser(data: FormData): Promise<{
|
|
1990
|
-
|
|
2243
|
+
registerNewUserResponseError?: {
|
|
1991
2244
|
isAlreadyRegistered?: boolean
|
|
1992
2245
|
message?: string
|
|
1993
2246
|
raw?: any
|
|
1994
2247
|
}
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2248
|
+
registerNewUserResponseData?: {
|
|
2249
|
+
accessTokenData: {
|
|
2250
|
+
accessToken: string
|
|
2251
|
+
refreshToken: string
|
|
2252
|
+
tokenType: string
|
|
2253
|
+
scope: string
|
|
2254
|
+
}
|
|
2255
|
+
userProfile: {
|
|
2256
|
+
firstName: string
|
|
2257
|
+
lastName: string
|
|
2001
2258
|
email: string
|
|
2002
2259
|
}
|
|
2003
2260
|
}
|
|
2004
2261
|
}>
|
|
2262
|
+
|
|
2263
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
2005
2264
|
}
|
|
2006
2265
|
|
|
2007
2266
|
```
|
|
@@ -2029,6 +2288,8 @@ Exposes the following functions:
|
|
|
2029
2288
|
|
|
2030
2289
|
`paymentSuccess` Payment success.
|
|
2031
2290
|
|
|
2291
|
+
`refreshAccessToken` Refreshes access token.
|
|
2292
|
+
|
|
2032
2293
|
|
|
2033
2294
|
```ts
|
|
2034
2295
|
// Get event conditions for the current event.
|
|
@@ -2131,6 +2392,9 @@ freeRegistration(orderHash: string): Promise<{
|
|
|
2131
2392
|
|
|
2132
2393
|
// Payment success.
|
|
2133
2394
|
paymentSuccess(orderHash: string): Promise<any>
|
|
2395
|
+
|
|
2396
|
+
// Refresh access token.
|
|
2397
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
2134
2398
|
```
|
|
2135
2399
|
---
|
|
2136
2400
|
## PurchaseConfirmationCore
|
|
@@ -2140,6 +2404,8 @@ It exposes the following functions:
|
|
|
2140
2404
|
|
|
2141
2405
|
`getPurchaseConfirmation` Get purchase confirmation for the current event.
|
|
2142
2406
|
|
|
2407
|
+
`refreshAccesstoken` Refreshes access token.
|
|
2408
|
+
|
|
2143
2409
|
```ts
|
|
2144
2410
|
getPurchaseConfirmation(
|
|
2145
2411
|
orderHash: string
|
|
@@ -2177,6 +2443,7 @@ getPurchaseConfirmation(
|
|
|
2177
2443
|
}[]
|
|
2178
2444
|
}
|
|
2179
2445
|
}>
|
|
2446
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
2180
2447
|
```
|
|
2181
2448
|
---
|
|
2182
2449
|
## MyOrdersCore
|
|
@@ -2188,8 +2455,12 @@ Exposes the following functions:
|
|
|
2188
2455
|
|
|
2189
2456
|
`getOrderDetails` Get the details from a specific order.
|
|
2190
2457
|
|
|
2458
|
+
`refreshAccessToken` Refreshes access token.
|
|
2459
|
+
|
|
2191
2460
|
|
|
2192
2461
|
```ts
|
|
2462
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
2463
|
+
|
|
2193
2464
|
getMyOrders(page: number, filter: string): Promise<{
|
|
2194
2465
|
myOrdersData?: {
|
|
2195
2466
|
events: {
|
|
@@ -2347,7 +2618,7 @@ login(fields?: {
|
|
|
2347
2618
|
extraData?: any
|
|
2348
2619
|
}
|
|
2349
2620
|
|
|
2350
|
-
|
|
2621
|
+
userProfile?: {
|
|
2351
2622
|
customerId: string
|
|
2352
2623
|
firstName: string
|
|
2353
2624
|
lastName: string
|
|
@@ -2361,6 +2632,13 @@ login(fields?: {
|
|
|
2361
2632
|
stateId: string
|
|
2362
2633
|
city: string
|
|
2363
2634
|
}
|
|
2635
|
+
|
|
2636
|
+
accessTokenData?: {
|
|
2637
|
+
accessToken: string
|
|
2638
|
+
refreshToken: string
|
|
2639
|
+
tokenType: string
|
|
2640
|
+
scope: string
|
|
2641
|
+
}
|
|
2364
2642
|
}>
|
|
2365
2643
|
|
|
2366
2644
|
logout(): Promise<void>
|
|
@@ -2415,13 +2693,43 @@ Wrap your component with the Core component.
|
|
|
2415
2693
|
|
|
2416
2694
|
# Changelog
|
|
2417
2695
|
|
|
2696
|
+
## Version 1.0.26
|
|
2697
|
+
- Add the possibility to remove all of the following Billing/Street Address fields from free tickets:
|
|
2698
|
+
- Billing Street Address
|
|
2699
|
+
- City
|
|
2700
|
+
- State/County
|
|
2701
|
+
- Post Code/Zip
|
|
2702
|
+
- Country
|
|
2703
|
+
|
|
2704
|
+
- Update `addToCart` success response to include:
|
|
2705
|
+
```
|
|
2706
|
+
isTicketFree?: boolean
|
|
2707
|
+
isPhoneHidden?: boolean
|
|
2708
|
+
```
|
|
2709
|
+
|
|
2710
|
+
## Version 1.0.25
|
|
2711
|
+
- Exposes `refreshAccessToken` function.
|
|
2712
|
+
- Changed returned `data` prop to `userProfile` in LoginCore response.
|
|
2713
|
+
- In **LoginCore Component**:
|
|
2714
|
+
- Add `accessTokenData` object prop in `onLoginSuccessful` response.
|
|
2715
|
+
- On **BillingUI Component**:
|
|
2716
|
+
- Change `onRegisterSuccess` return data type.
|
|
2717
|
+
- Change `onRegisterError` return data type.
|
|
2718
|
+
- On **LoginCore**:
|
|
2719
|
+
- Change `login` return data type to include `accessTokenData` object.
|
|
2720
|
+
- Exports `SessionHandleType` to use it in the `ref` of the UI components.
|
|
2721
|
+
- All UI and Core components except Login and ResetPassword:
|
|
2722
|
+
- Export function `refreshAccessToken`
|
|
2723
|
+
- Add `reloadData` to re-fetch servers data in UI components.
|
|
2724
|
+
|
|
2418
2725
|
## Version 1.0.24
|
|
2419
2726
|
- Add **SingleSignOn** feature.
|
|
2420
2727
|
- Add show Tickets in groups and the option to sort them by sold out.
|
|
2421
2728
|
- Add config prop to Tickets component:
|
|
2422
2729
|
|
|
2423
|
-
```
|
|
2730
|
+
```ts
|
|
2424
2731
|
config: {
|
|
2732
|
+
// Indicates if loading component should be visible.
|
|
2425
2733
|
areActivityIndicatorsEnabled?: boolean
|
|
2426
2734
|
areAlertsEnabled?: boolean
|
|
2427
2735
|
areTicketsSortedBySoldOut?: boolean
|
package/lib/api/ApiClient.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { IWaitingListFields } from '../components/waitingList/types';
|
|
2
2
|
import { IError } from '../types';
|
|
3
3
|
import { IAddToCartResponse } from '../types/ITicket';
|
|
4
|
-
import { IAddToCartParams, IAddToWaitingListResponse, IAuthorizeResponse, ICartResponse, ICheckoutBody, ICheckoutResponse, IClientRequest, ICloseSessionResponse, ICountriesResponse, IEventResponse, IFetchTicketsResponse, IFreeRegistrationResponse, IMyOrderDetailsResponse, IMyOrdersResponse, IOrderReviewResponse, IPostReferralResponse, IPurchaseConfirmationResponse, IRegisterNewUserResponse, IRemoveTicketFromResaleResponse, IResaleTicketResponse, IResetPasswordRequestData, IResetPasswordResponse, IRestorePasswordResponse, IStatesResponse, IUserProfileResponse } from './types';
|
|
4
|
+
import { IAddToCartParams, IAddToWaitingListResponse, IAuthorizeResponse, ICartResponse, ICheckoutBody, ICheckoutResponse, IClientRequest, ICloseSessionResponse, ICountriesResponse, IEventResponse, IFetchAccessTokenResponse, IFetchTicketsResponse, IFreeRegistrationResponse, IMyOrderDetailsResponse, IMyOrdersResponse, IOrderReviewResponse, IPostReferralResponse, IPurchaseConfirmationResponse, IRegisterNewUserResponse, IRemoveTicketFromResaleResponse, IResaleTicketResponse, IResetPasswordRequestData, IResetPasswordResponse, IRestorePasswordResponse, IStatesResponse, IUserProfileResponse } from './types';
|
|
5
5
|
export declare const Client: IClientRequest;
|
|
6
6
|
export declare const setCustomHeader: (response: any) => void;
|
|
7
7
|
export declare const setAccessTokenHandler: (accessToken: string) => Promise<void>;
|
|
8
8
|
export declare const authorize: (data: FormData) => Promise<IAuthorizeResponse>;
|
|
9
|
-
export declare const fetchAccessToken: (data: FormData) => Promise<
|
|
10
|
-
error: IError | undefined;
|
|
11
|
-
accessToken: any;
|
|
12
|
-
}>;
|
|
9
|
+
export declare const fetchAccessToken: (data: FormData) => Promise<IFetchAccessTokenResponse>;
|
|
13
10
|
export declare const fetchUserProfile: () => Promise<IUserProfileResponse>;
|
|
14
11
|
export declare const registerNewUser: (data: FormData) => Promise<IRegisterNewUserResponse>;
|
|
15
12
|
export declare const addToWaitingList: (values: IWaitingListFields) => Promise<IAddToWaitingListResponse>;
|