tf-checkout-react-native 1.0.24 → 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 +322 -32
- package/lib/api/ApiClient.d.ts +2 -5
- package/lib/api/ApiClient.js +62 -15
- package/lib/api/ApiClient.js.map +1 -1
- package/lib/api/types.d.ts +26 -14
- 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 +66 -35
- 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/index.d.ts +9 -3
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- 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
|
|
@@ -553,6 +669,7 @@ Then add it to the render function.
|
|
|
553
669
|
isLoading?: boolean
|
|
554
670
|
}
|
|
555
671
|
|
|
672
|
+
// Configure the Component behavior
|
|
556
673
|
config: {
|
|
557
674
|
areActivityIndicatorsEnabled?: boolean
|
|
558
675
|
areAlertsEnabled?: boolean
|
|
@@ -578,6 +695,21 @@ Then add it to the render function.
|
|
|
578
695
|
}
|
|
579
696
|
```
|
|
580
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
|
+
|
|
581
713
|
You can then call the `BillingInfo` component and pass them as props in the `cartProps` prop.
|
|
582
714
|
|
|
583
715
|
`onFetchTicketsSuccess` When tickets fetching was successful, will return fetched data, including `promoCodeResponse`.
|
|
@@ -721,7 +853,11 @@ import { BillingInfo } from 'tf-checkout-react-native'
|
|
|
721
853
|
Add it to the render function.
|
|
722
854
|
|
|
723
855
|
```js
|
|
856
|
+
const sessionHandleRef = useRef<SessionHandleType>(null)
|
|
857
|
+
|
|
858
|
+
|
|
724
859
|
<BillingInfo
|
|
860
|
+
ref={sessionHandleRef}
|
|
725
861
|
cartProps: {
|
|
726
862
|
isBillingRequired: boolean
|
|
727
863
|
isNameRequired: boolean
|
|
@@ -730,8 +866,24 @@ Add it to the render function.
|
|
|
730
866
|
minimumAge: number
|
|
731
867
|
}
|
|
732
868
|
// registerNewUser
|
|
733
|
-
onRegisterSuccess?: (
|
|
734
|
-
|
|
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
|
|
735
887
|
|
|
736
888
|
onCheckoutSuccess: (data: {
|
|
737
889
|
id: string
|
|
@@ -741,7 +893,8 @@ Add it to the render function.
|
|
|
741
893
|
}) => void
|
|
742
894
|
onCheckoutError?: (error: IError) => void
|
|
743
895
|
|
|
744
|
-
|
|
896
|
+
// See ILoginSuccessData data type below.
|
|
897
|
+
onLoginSuccess: (data: ILoginSuccessData) => void
|
|
745
898
|
onLoginError?: (error: IError) => void
|
|
746
899
|
|
|
747
900
|
onFetchUserProfileSuccess?: (data: any) => void
|
|
@@ -795,6 +948,34 @@ Add it to the render function.
|
|
|
795
948
|
/>
|
|
796
949
|
```
|
|
797
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
|
+
|
|
798
979
|
### Props
|
|
799
980
|
| Property | Description |
|
|
800
981
|
|----------|-------------|
|
|
@@ -933,7 +1114,10 @@ import { Checkout } from 'tf-checkout-react-native'
|
|
|
933
1114
|
Add it to the render function.
|
|
934
1115
|
|
|
935
1116
|
```js
|
|
1117
|
+
const sessionHandleRef = useRef<SessionHandleType>(null)
|
|
1118
|
+
|
|
936
1119
|
<Checkout
|
|
1120
|
+
ref={sessionHandleRef}
|
|
937
1121
|
eventId={EVENT_ID}
|
|
938
1122
|
hash={hash}
|
|
939
1123
|
total={total}
|
|
@@ -949,6 +1133,7 @@ Add it to the render function.
|
|
|
949
1133
|
|
|
950
1134
|
```js
|
|
951
1135
|
{
|
|
1136
|
+
ref?: SessionHandleType
|
|
952
1137
|
eventId: number
|
|
953
1138
|
hash: string
|
|
954
1139
|
total: string
|
|
@@ -1060,13 +1245,16 @@ Additionally, if you are encountering problems with building your project, pleas
|
|
|
1060
1245
|
Import the component from the library
|
|
1061
1246
|
|
|
1062
1247
|
```js
|
|
1063
|
-
import { PurchaseConfirmation } from 'tf-checkout-react-native'
|
|
1248
|
+
import { PurchaseConfirmation, SessionHandleType } from 'tf-checkout-react-native'
|
|
1064
1249
|
```
|
|
1065
1250
|
|
|
1066
1251
|
Add it to the render function.
|
|
1067
1252
|
|
|
1068
1253
|
```js
|
|
1254
|
+
const sessionHandleRef = useRef<SessionHandleType>(null)
|
|
1255
|
+
|
|
1069
1256
|
<PurchaseConfirmation
|
|
1257
|
+
ref={sessionHandleRef}
|
|
1070
1258
|
orderHash={checkoutProps!.hash}
|
|
1071
1259
|
onComplete={handleOnComplete}
|
|
1072
1260
|
|
|
@@ -1112,14 +1300,15 @@ If there is a valid session, there will appear a button to access `MyOrders` in
|
|
|
1112
1300
|
Import the component from the library.
|
|
1113
1301
|
|
|
1114
1302
|
```js
|
|
1115
|
-
import { MyOrders } from 'tf-checkout-react-native'
|
|
1303
|
+
import { MyOrders, SessionHandleType } from 'tf-checkout-react-native'
|
|
1116
1304
|
```
|
|
1117
1305
|
|
|
1118
1306
|
|
|
1119
1307
|
### Props
|
|
1120
1308
|
|
|
1121
|
-
```
|
|
1309
|
+
```tsx
|
|
1122
1310
|
{
|
|
1311
|
+
ref={SessionHandleType}
|
|
1123
1312
|
onSelectOrder: (order: {
|
|
1124
1313
|
order: {
|
|
1125
1314
|
header: {
|
|
@@ -1236,13 +1425,14 @@ When user selects an order from the `MyOrders` component, will show it details.
|
|
|
1236
1425
|
Import the component from the library.
|
|
1237
1426
|
|
|
1238
1427
|
```js
|
|
1239
|
-
import { MyOrderDetails } from 'tf-checkout-react-native'
|
|
1428
|
+
import { MyOrderDetails, SessionHandleType } from 'tf-checkout-react-native'
|
|
1240
1429
|
```
|
|
1241
1430
|
|
|
1242
1431
|
### Props
|
|
1243
1432
|
|
|
1244
1433
|
```tsx
|
|
1245
1434
|
{
|
|
1435
|
+
ref={SessionHandleType}
|
|
1246
1436
|
data: IMyOrderDetailsData
|
|
1247
1437
|
|
|
1248
1438
|
// Used to navigate to the Resale Tickets screen
|
|
@@ -1404,13 +1594,14 @@ Allows the user to resale the tickets they bought. They can decide wether sell i
|
|
|
1404
1594
|
Import the component from the library.
|
|
1405
1595
|
|
|
1406
1596
|
```js
|
|
1407
|
-
import { ResaleTickets } from 'tf-checkout-react-native'
|
|
1597
|
+
import { ResaleTickets, SessionHandleType } from 'tf-checkout-react-native'
|
|
1408
1598
|
```
|
|
1409
1599
|
|
|
1410
1600
|
### Props
|
|
1411
1601
|
|
|
1412
1602
|
```ts
|
|
1413
1603
|
{
|
|
1604
|
+
ref={SessionHandleType}
|
|
1414
1605
|
ticket: {
|
|
1415
1606
|
currency: string
|
|
1416
1607
|
description: string
|
|
@@ -1587,6 +1778,63 @@ Then add it to the render function.
|
|
|
1587
1778
|
|
|
1588
1779
|
[ResetPasswordCore](#resetpasswordcore)
|
|
1589
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
|
+
|
|
1590
1838
|
---
|
|
1591
1839
|
|
|
1592
1840
|
## TicketsCore
|
|
@@ -1602,6 +1850,8 @@ Exposes the following functions:
|
|
|
1602
1850
|
|
|
1603
1851
|
`postReferralVisit` Posts a referral visit to the server.
|
|
1604
1852
|
|
|
1853
|
+
`refreshAccessToken` : Refreshes expired access token.
|
|
1854
|
+
|
|
1605
1855
|
```js
|
|
1606
1856
|
{
|
|
1607
1857
|
// Fetches the tickets from the event set in the config function. It receives a promoCode parameter to apply to the tickets.
|
|
@@ -1755,16 +2005,16 @@ Exposes the following functions:
|
|
|
1755
2005
|
}
|
|
1756
2006
|
|
|
1757
2007
|
postReferralVisit(referralId: string): Promise<
|
|
1758
|
-
|
|
1759
|
-
|
|
2008
|
+
postReferralError?: {
|
|
2009
|
+
code?: number
|
|
2010
|
+
message: string
|
|
2011
|
+
extraData?: any
|
|
2012
|
+
}
|
|
2013
|
+
postReferralData?: {
|
|
1760
2014
|
message: string
|
|
1761
|
-
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1764
|
-
message: string
|
|
1765
|
-
status: number
|
|
1766
|
-
}
|
|
1767
|
-
>
|
|
2015
|
+
status: number
|
|
2016
|
+
}>
|
|
2017
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
1768
2018
|
}>
|
|
1769
2019
|
}
|
|
1770
2020
|
```
|
|
@@ -1775,7 +2025,6 @@ Import the component from the library
|
|
|
1775
2025
|
import {
|
|
1776
2026
|
TicketsCore
|
|
1777
2027
|
TicketsCoreHandle // You can import the Handle to use it as type in the useRef hook
|
|
1778
|
-
|
|
1779
2028
|
} from 'tf-checkout-react-native'
|
|
1780
2029
|
```
|
|
1781
2030
|
|
|
@@ -1799,7 +2048,6 @@ Use the reference to access the component methods.
|
|
|
1799
2048
|
const handleGetTickets = async () => {
|
|
1800
2049
|
const res = await ticketsCoreRef.current.getTickets()
|
|
1801
2050
|
}
|
|
1802
|
-
|
|
1803
2051
|
```
|
|
1804
2052
|
---
|
|
1805
2053
|
|
|
@@ -1808,7 +2056,7 @@ This component *must* appear after getting the response from **getTickets()** an
|
|
|
1808
2056
|
|
|
1809
2057
|
|
|
1810
2058
|
Exposes the following functions:
|
|
1811
|
-
```
|
|
2059
|
+
```tsx
|
|
1812
2060
|
{
|
|
1813
2061
|
addToWaitingList(
|
|
1814
2062
|
params: {
|
|
@@ -1829,6 +2077,7 @@ Exposes the following functions:
|
|
|
1829
2077
|
success: boolean
|
|
1830
2078
|
}
|
|
1831
2079
|
}>
|
|
2080
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
1832
2081
|
}
|
|
1833
2082
|
```
|
|
1834
2083
|
**addToWaitingList** Receives params with the following properties:
|
|
@@ -1901,7 +2150,7 @@ Exposes the following functions:
|
|
|
1901
2150
|
|
|
1902
2151
|
`getUserProfile` Fetches the user profile information.
|
|
1903
2152
|
|
|
1904
|
-
`registerNewUser` Registers a new user.
|
|
2153
|
+
`registerNewUser` Registers a new user. Returns accessTokens data.
|
|
1905
2154
|
|
|
1906
2155
|
`checkoutOrder` Performs the checkout.
|
|
1907
2156
|
|
|
@@ -1987,21 +2236,27 @@ Exposes the following functions:
|
|
|
1987
2236
|
|
|
1988
2237
|
// Registers a new user.
|
|
1989
2238
|
registerNewUser(data: FormData): Promise<{
|
|
1990
|
-
|
|
2239
|
+
registerNewUserResponseError?: {
|
|
1991
2240
|
isAlreadyRegistered?: boolean
|
|
1992
2241
|
message?: string
|
|
1993
2242
|
raw?: any
|
|
1994
2243
|
}
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
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
|
|
2001
2254
|
email: string
|
|
2002
2255
|
}
|
|
2003
2256
|
}
|
|
2004
2257
|
}>
|
|
2258
|
+
|
|
2259
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
2005
2260
|
}
|
|
2006
2261
|
|
|
2007
2262
|
```
|
|
@@ -2029,6 +2284,8 @@ Exposes the following functions:
|
|
|
2029
2284
|
|
|
2030
2285
|
`paymentSuccess` Payment success.
|
|
2031
2286
|
|
|
2287
|
+
`refreshAccessToken` Refreshes access token.
|
|
2288
|
+
|
|
2032
2289
|
|
|
2033
2290
|
```ts
|
|
2034
2291
|
// Get event conditions for the current event.
|
|
@@ -2131,6 +2388,9 @@ freeRegistration(orderHash: string): Promise<{
|
|
|
2131
2388
|
|
|
2132
2389
|
// Payment success.
|
|
2133
2390
|
paymentSuccess(orderHash: string): Promise<any>
|
|
2391
|
+
|
|
2392
|
+
// Refresh access token.
|
|
2393
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
2134
2394
|
```
|
|
2135
2395
|
---
|
|
2136
2396
|
## PurchaseConfirmationCore
|
|
@@ -2140,6 +2400,8 @@ It exposes the following functions:
|
|
|
2140
2400
|
|
|
2141
2401
|
`getPurchaseConfirmation` Get purchase confirmation for the current event.
|
|
2142
2402
|
|
|
2403
|
+
`refreshAccesstoken` Refreshes access token.
|
|
2404
|
+
|
|
2143
2405
|
```ts
|
|
2144
2406
|
getPurchaseConfirmation(
|
|
2145
2407
|
orderHash: string
|
|
@@ -2177,6 +2439,7 @@ getPurchaseConfirmation(
|
|
|
2177
2439
|
}[]
|
|
2178
2440
|
}
|
|
2179
2441
|
}>
|
|
2442
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
2180
2443
|
```
|
|
2181
2444
|
---
|
|
2182
2445
|
## MyOrdersCore
|
|
@@ -2188,8 +2451,12 @@ Exposes the following functions:
|
|
|
2188
2451
|
|
|
2189
2452
|
`getOrderDetails` Get the details from a specific order.
|
|
2190
2453
|
|
|
2454
|
+
`refreshAccessToken` Refreshes access token.
|
|
2455
|
+
|
|
2191
2456
|
|
|
2192
2457
|
```ts
|
|
2458
|
+
refreshAccessToken(refreshToken?: string): Promise<IFetchAccessTokenResponse>
|
|
2459
|
+
|
|
2193
2460
|
getMyOrders(page: number, filter: string): Promise<{
|
|
2194
2461
|
myOrdersData?: {
|
|
2195
2462
|
events: {
|
|
@@ -2347,7 +2614,7 @@ login(fields?: {
|
|
|
2347
2614
|
extraData?: any
|
|
2348
2615
|
}
|
|
2349
2616
|
|
|
2350
|
-
|
|
2617
|
+
userProfile?: {
|
|
2351
2618
|
customerId: string
|
|
2352
2619
|
firstName: string
|
|
2353
2620
|
lastName: string
|
|
@@ -2361,6 +2628,13 @@ login(fields?: {
|
|
|
2361
2628
|
stateId: string
|
|
2362
2629
|
city: string
|
|
2363
2630
|
}
|
|
2631
|
+
|
|
2632
|
+
accessTokenData?: {
|
|
2633
|
+
accessToken: string
|
|
2634
|
+
refreshToken: string
|
|
2635
|
+
tokenType: string
|
|
2636
|
+
scope: string
|
|
2637
|
+
}
|
|
2364
2638
|
}>
|
|
2365
2639
|
|
|
2366
2640
|
logout(): Promise<void>
|
|
@@ -2415,13 +2689,29 @@ Wrap your component with the Core component.
|
|
|
2415
2689
|
|
|
2416
2690
|
# Changelog
|
|
2417
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
|
+
|
|
2418
2707
|
## Version 1.0.24
|
|
2419
2708
|
- Add **SingleSignOn** feature.
|
|
2420
2709
|
- Add show Tickets in groups and the option to sort them by sold out.
|
|
2421
2710
|
- Add config prop to Tickets component:
|
|
2422
2711
|
|
|
2423
|
-
```
|
|
2712
|
+
```ts
|
|
2424
2713
|
config: {
|
|
2714
|
+
// Indicates if loading component should be visible.
|
|
2425
2715
|
areActivityIndicatorsEnabled?: boolean
|
|
2426
2716
|
areAlertsEnabled?: boolean
|
|
2427
2717
|
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>;
|