tf-checkout-react-native 1.0.11 → 1.0.14

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.
Files changed (82) hide show
  1. package/README.md +595 -294
  2. package/android/build.gradle +3 -3
  3. package/lib/api/ApiClient.d.ts +13 -21
  4. package/lib/api/ApiClient.js +122 -51
  5. package/lib/api/ApiClient.js.map +1 -1
  6. package/lib/api/types.d.ts +21 -11
  7. package/lib/components/login/Login.d.ts +1 -1
  8. package/lib/components/login/Login.js +22 -10
  9. package/lib/components/login/Login.js.map +1 -1
  10. package/lib/components/login/LoginView.d.ts +1 -1
  11. package/lib/components/login/LoginView.js +16 -13
  12. package/lib/components/login/LoginView.js.map +1 -1
  13. package/lib/components/login/styles.d.ts +2 -1
  14. package/lib/components/login/styles.js +2 -1
  15. package/lib/components/login/styles.js.map +1 -1
  16. package/lib/components/login/types.d.ts +19 -9
  17. package/lib/components/waitingList/WaitingList.d.ts +1 -1
  18. package/lib/components/waitingList/WaitingList.js +20 -3
  19. package/lib/components/waitingList/WaitingList.js.map +1 -1
  20. package/lib/components/waitingList/WaitingListView.js +19 -7
  21. package/lib/components/waitingList/WaitingListView.js.map +1 -1
  22. package/lib/components/waitingList/types.d.ts +10 -0
  23. package/lib/containers/billingInfo/Billing.d.ts +2 -1
  24. package/lib/containers/billingInfo/Billing.js +100 -66
  25. package/lib/containers/billingInfo/Billing.js.map +1 -1
  26. package/lib/containers/billingInfo/types.d.ts +42 -93
  27. package/lib/containers/checkout/Checkout.d.ts +1 -1
  28. package/lib/containers/checkout/Checkout.js +146 -50
  29. package/lib/containers/checkout/Checkout.js.map +1 -1
  30. package/lib/containers/checkout/styles.d.ts +2 -0
  31. package/lib/containers/checkout/styles.js +4 -2
  32. package/lib/containers/checkout/styles.js.map +1 -1
  33. package/lib/containers/checkout/types.d.ts +32 -8
  34. package/lib/containers/myOrderDetails/MyOrderDetails.js +21 -3
  35. package/lib/containers/myOrderDetails/MyOrderDetails.js.map +1 -1
  36. package/lib/containers/myOrderDetails/MyOrderDetailsView.js +10 -7
  37. package/lib/containers/myOrderDetails/MyOrderDetailsView.js.map +1 -1
  38. package/lib/containers/myOrderDetails/components/Notification.d.ts +10 -2
  39. package/lib/containers/myOrderDetails/components/Notification.js +5 -7
  40. package/lib/containers/myOrderDetails/components/Notification.js.map +1 -1
  41. package/lib/containers/myOrderDetails/types.d.ts +18 -0
  42. package/lib/containers/myOrders/MyOrders.js +37 -9
  43. package/lib/containers/myOrders/MyOrders.js.map +1 -1
  44. package/lib/containers/myOrders/MyOrdersView.d.ts +1 -1
  45. package/lib/containers/myOrders/MyOrdersView.js +3 -3
  46. package/lib/containers/myOrders/MyOrdersView.js.map +1 -1
  47. package/lib/containers/myOrders/types.d.ts +13 -1
  48. package/lib/containers/purchaseConfirmation/PurchaseConfirmation.d.ts +1 -1
  49. package/lib/containers/purchaseConfirmation/PurchaseConfirmation.js +21 -5
  50. package/lib/containers/purchaseConfirmation/PurchaseConfirmation.js.map +1 -1
  51. package/lib/containers/purchaseConfirmation/PurchaseConfirmationView.d.ts +2 -2
  52. package/lib/containers/purchaseConfirmation/PurchaseConfirmationView.js +4 -3
  53. package/lib/containers/purchaseConfirmation/PurchaseConfirmationView.js.map +1 -1
  54. package/lib/containers/purchaseConfirmation/types.d.ts +12 -1
  55. package/lib/containers/tickets/Tickets.d.ts +1 -1
  56. package/lib/containers/tickets/Tickets.js +59 -9
  57. package/lib/containers/tickets/Tickets.js.map +1 -1
  58. package/lib/containers/tickets/TicketsView.d.ts +1 -1
  59. package/lib/containers/tickets/TicketsView.js +5 -4
  60. package/lib/containers/tickets/TicketsView.js.map +1 -1
  61. package/lib/containers/tickets/components/TicketListItem.js +14 -7
  62. package/lib/containers/tickets/components/TicketListItem.js.map +1 -1
  63. package/lib/containers/tickets/components/types.d.ts +6 -0
  64. package/lib/containers/tickets/types.d.ts +28 -11
  65. package/lib/helpers/LocalStorage.d.ts +1 -1
  66. package/lib/helpers/LocalStorage.js +1 -3
  67. package/lib/helpers/LocalStorage.js.map +1 -1
  68. package/lib/index.d.ts +3 -3
  69. package/lib/res/colors.d.ts +2 -2
  70. package/lib/res/colors.js +2 -18
  71. package/lib/res/colors.js.map +1 -1
  72. package/lib/types/IError.d.ts +5 -0
  73. package/lib/types/IError.js +2 -0
  74. package/lib/types/IError.js.map +1 -0
  75. package/lib/types/ITicket.d.ts +12 -0
  76. package/lib/types/index.d.ts +1 -0
  77. package/lib/types/index.js +1 -0
  78. package/lib/types/index.js.map +1 -1
  79. package/package.json +3 -3
  80. package/lib/containers/checkout/CheckoutView.d.ts +0 -3
  81. package/lib/containers/checkout/CheckoutView.js +0 -48
  82. package/lib/containers/checkout/CheckoutView.js.map +0 -1
package/README.md CHANGED
@@ -6,50 +6,58 @@ React Native library for Ticket Fairy checkout.
6
6
 
7
7
  Configure [ReactNative environment](https://reactnative.dev/docs/environment-setup) for desired platforms (iOS, Android or both).
8
8
 
9
- ## Android
9
+ ### React Native
10
+
11
+ - Suggested ReactNative version `0.66.3`
12
+ - Suggested Flipper version `0.66`
13
+ - React version `0.17.1`
14
+
15
+ ### Android
10
16
 
11
17
  - Android 5.0 (API level 21) and above
12
- - Minimum Gradle plugin version `4.2.2`
13
- - Minimum Gradle version `6.7.1`
14
- - Compile Sdk Version and Target Sdk Version `31`
15
- - Build Tools Version `30.0.3`
18
+ - Gradle plugin version `4.2.2`
19
+ - Gradle version `6.7.1`
20
+ - Compile Sdk Version and Target Sdk Version `30`
21
+ - Build Tools Version `30.0.2`
22
+ - Java version `1.8`
23
+ - Kotlin version `1.5.31`
16
24
 
17
25
  Add the following to your Android Manifest as activity property.
18
26
 
19
- ```
20
- android:exported="true"
21
- ```
22
-
23
27
  To download the PDFs, add the `WRITE_EXTERNAL_STORAGE` permission to the Android's Manifest file.
24
28
 
25
29
  ```xml
26
30
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
27
31
  ```
28
32
 
29
- ## iOS
33
+ ### iOS
30
34
 
31
35
  - Compatible with apps targeting iOS 11 or above.
36
+ - Pods version `1.10.1`
37
+ - Command Line Tools version `13.0`
32
38
 
33
39
  To download the PDFs, add the following flags to `Info.plist` file:
34
40
 
41
+ ```
35
42
  - UIFileSharingEnabled: Application supports iTunes file sharing
36
43
  - LSSupportsOpeningDocumentsInPlace: Supports opening documents in place
44
+ ```
37
45
 
38
46
  # Installation
39
47
 
40
- ```node
48
+ ```sh
41
49
  yarn add tf-checkout-react-native
42
50
  ```
43
51
 
44
52
  or
45
53
 
46
- ```node
54
+ ```sh
47
55
  npm install tf-checkout-react-native
48
56
  ```
49
57
 
50
58
  Make sure to install all the required dependencies in your project.
51
59
 
52
- # Required for Android
60
+ ### Required for Android
53
61
 
54
62
  Add below dependency to your `app/build.gradle` file with specified version (in our example we are using `1.4.0`).
55
63
 
@@ -61,7 +69,7 @@ Set appropriate style in your styles.xml file.
61
69
 
62
70
  ```xml
63
71
  <style name="Theme.MyApp" parent="Theme.MaterialComponents.DayNight.NoActionBar">
64
- <!-- ... -->
72
+ <!-- ... -->
65
73
  </style>
66
74
  ```
67
75
 
@@ -79,7 +87,6 @@ Use it in your initial useEffect function:
79
87
  useEffect(() => {
80
88
  setConfig({
81
89
  DOMAIN: 'https://yourdomain.mx',
82
- IS_BILLING_STREET_NAME_REQUIRED: false,
83
90
  })
84
91
  }, [])
85
92
  ```
@@ -97,27 +104,23 @@ useEffect(() => {
97
104
  ARE_SUB_BRANDS_INCLUDED?: boolean
98
105
  }
99
106
  ```
100
-
101
- `DOMAIN` Specify your domains name example: `https://google.com` this is important to maintain cart session active and prevent it from expiring when user login in the BillingInfo component.
102
-
103
- `BASE_URL` If our dev team gives you a custom BASE_URL.
104
-
105
- `CLIENT_ID` Set your CLIENT_ID.
106
-
107
- `CLIENT_SECRET` Set your CLIENT_SECRET.
108
-
109
- `BRAND`: Set your BRAND so users can only see this brand in their orders.
110
-
111
- `TIMEOUT` Set custom timeout for the APIs requests.
112
-
113
- `ARE_SUB_BRANDS_INCLUDED` If true will include orders from the `BRAND` sub-brands.
107
+ ### Props
108
+ | Property | Description |
109
+ | -------- | ----------- |
110
+ | DOMAIN | Specify your domains name example: `https://google.com` this is important to maintain cart session active and prevent it from expiring when user login in the BillingInfo component. |
111
+ | BASE_URL | If our dev team gives you a custom BASE_URL.|
112
+ | CLIENT_ID | Set your CLIENT_ID. |
113
+ | CLIENT_SECRET | Set your CLIENT_SECRET. |
114
+ | BRAND | Set your BRAND so users can only see this brand in their orders. |
115
+ | TIMEOUT | Set custom timeout for the APIs requests. |
116
+ | ARE_SUB_BRANDS_INCLUDED | If true will include orders from the `BRAND` sub-brands. Default `false`. |
114
117
 
115
118
  # Run the example app
116
119
 
117
120
  1. Clone this repo.
118
121
  2. In the App.tsx file, update the `EVENT_ID` const with the assigned ID to be able to retrieve data from the server.
119
- 3. cd into the project folder and `yarn` or `npm install`.
120
- 4. cd into the example folder and `yarn` or `npm install`.
122
+ 3. cd into the _root project_ folder and `yarn` or `npm install`.
123
+ 4. cd into the _example_ folder and `yarn` or `npm install`.
121
124
  - If running on iOS, cd into ios folder and `pod install && cd ..`.
122
125
  5. Run `yarn ios` or `npm run ios` to initialize and run in the iPhone simulator.
123
126
  6. If running on Android, run `yarn android` or `npm run android` to run it in the Android emulator or connected physical device.
@@ -126,41 +129,61 @@ useEffect(() => {
126
129
 
127
130
  This library exports the following components:
128
131
 
129
- ## Login
132
+ ### Login
130
133
 
131
134
  Used to authenticate the user.
132
135
 
133
- ## Tickets
136
+ ### Tickets
134
137
 
135
138
  Will retrieve and show a list of tickets corresponding to `eventId`. It also includes a PromoCode component that validates it and updates the tickets list.
136
139
 
137
140
  User can select what ticket type wants to buy and the quantity of tickets.
138
141
 
139
- ## Billing information
142
+ ### Billing information
140
143
 
141
144
  User will need to enter its data into a form to create a Ticket Fairy account. Also, depending on the number of tickets selected, will need to fill the information of each one of them.
142
145
 
143
- ## Checkout
146
+ ### Checkout
144
147
 
145
148
  Will show the order details and a card form that the user will need to fill with its card details.
146
149
 
147
150
  TicketFairy doesn't store any card related data, we use [Stripe](https://stripe.com/) as payments solution.
148
151
 
149
- ## Purchase confirmation
152
+ ### Purchase confirmation
150
153
 
151
154
  This is shown once the payment is successfully completed, could show components to share the purchase in social media or refer it with friends to get discounts on the purchase.
152
155
 
153
- ## My Orders
156
+ ### My Orders
154
157
 
155
158
  Will show the purchased orders for the logged user.
156
159
 
157
- ## My Order details
160
+ ### My Order details
158
161
 
159
162
  Will show the details for the selected Order, it also allows the user to download the Ticket PDF.
160
163
 
161
- # Usage [🚧 WIP 🚧]
162
-
163
- # Login
164
+ # Component styling
165
+ ### Button
166
+ ```js
167
+ interface IButtonStyles {
168
+ container?: StyleProp<ViewStyle>
169
+ button?: StyleProp<ViewStyle>
170
+ text?: StyleProp<TextStyle>
171
+ }
172
+ ```
173
+ ### Input
174
+ ```js
175
+ interface IInputStyles {
176
+ color?: ColorValue
177
+ container?: StyleProp<ViewStyle>
178
+ input?: StyleProp<TextStyle>
179
+ lineWidth?: number
180
+ activeLineWidth?: number
181
+ baseColor?: ColorValue
182
+ errorColor?: ColorValue
183
+ }
184
+ ```
185
+ # Exported components
186
+ ## Login
164
187
 
165
188
  Import the component from the library
166
189
 
@@ -172,10 +195,23 @@ Then add it to the render function.
172
195
 
173
196
  ```js
174
197
  <Login
175
- onLoginSuccessful={handleOnLoginDialogSuccess}
176
- isLoginDialogVisible={isLoginDialogVisible}
177
- showLoginDialog={() => setIsLoginDialogVisible(true)}
178
- hideLoginDialog={() => setIsLoginDialogVisible(false)}
198
+ onLoginSuccessful: (userProfile: IUserProfile, accessToken: string) => void
199
+ onLoginError?: (error: IError) => void
200
+
201
+ onFetchUserProfileError?: (error: IError) => void
202
+ onFetchUserProfileSuccess?: (data: any) => void
203
+
204
+ onFetchAccessTokenError?: (error: IError) => void
205
+ onFetchAccessTokenSuccess?: () => void
206
+
207
+ isLoginDialogVisible: boolean
208
+ showLoginDialog: () => void
209
+ hideLoginDialog: () => void
210
+
211
+ //Logout
212
+ onLogoutSuccess?: () => void
213
+ onLogoutError?: () => void
214
+
179
215
  userFirstName={loggedUserName}
180
216
  refs={{
181
217
  inputs?: {
@@ -189,48 +225,36 @@ Then add it to the render function.
189
225
  activityIndicator?: any
190
226
  loadingText?: any
191
227
  }}
228
+ brandImages={
229
+ containerStyle?: StyleProp<ViewStyle>
230
+ image1?: ImageSourcePropType
231
+ image1Style?: StyleProp<ImageStyle>
232
+ image2?: ImageSourcePropType
233
+ image2Style?: StyleProp<ImageStyle>
234
+ }
235
+ styles?: ILoginViewStyles
236
+ texts?: ILoginViewTexts
192
237
  />
193
238
  ```
194
239
 
195
- ## Props
196
-
197
- `onLoginSuccessful: (userProfile: IUserProfile, accessToken: string)`
198
- When login was successful, return userProfile data and the access token to use if for future API requests.
199
-
200
- `onLoginFailure?: (error: string)`
201
- When login fails will return the error received.
202
-
203
- `onFetchUserProfileFailure?: (error: string)`
204
- This is used if the authentication worked but the fetch of the userProfile failed.
205
-
206
- `onFetchAccessTokenFailure?: (error: string)`
207
- When the fetch of the access token failed.
208
-
209
- `isLoginDialogVisible: boolean`
210
- Flag to show or hide the login dialog.
211
-
212
- `showLoginDialog: () => void`
213
- Callback to show the Login dialog.
214
-
215
- `hideLoginDialog: () => void`
216
- Callback to hide the login dialog.
217
-
218
- `onLogoutSuccess?: () => void`
219
- Use it to logout the authenticated user. It will delete all the stored data, including access token. Please make sure to update the `userFirstName` prop so the component will show the logged out view.
220
-
221
- `onLogoutFail?: () => void`
222
- Will be called if something went wrong while deleting the local data.
223
-
224
- `styles?: ILoginViewStyles`
225
- Use this to style your components.
226
-
227
- `texts?: ILoginViewTexts`
228
- Use this to change some texts that appear in this component.
229
-
230
- `userFirstName?: string`
231
- Once authenticated send the received firstName data to this prop, so the component can render the Logged in view.
240
+ ### Props
241
+ | Property | Description |
242
+ |----------|-------------|
243
+ | onLoginSuccessful: (userProfile: IUserProfile, accessToken: string)` |When login was successful, return userProfile data and the access token to use if for future API requests.
244
+ | onLoginFailure?: (error: string) | When login fails will return the error received. |
245
+ | onFetchUserProfileFailure?: (error: string) | This is used if the authentication worked but the fetch of the userProfile failed. |
246
+ | onFetchAccessTokenFailure?: (error: string) | When the fetch of the access token failed. |
247
+ | isLoginDialogVisible: boolean | Flag to show or hide the login dialog. |
248
+ | showLoginDialog: () => void | Callback to show the Login dialog. |
249
+ | hideLoginDialog: () => void | Callback to hide the Login dialog. |
250
+ | onLogoutSuccess?: () => void | Use it to logout the authenticated user. It will delete all the stored data, including access token. Please make sure to update the `userFirstName` prop so the component will show the logged out view. |
251
+ |onLogoutFail?: () => void | Will be called if something went wrong while deleting the local data. |
252
+ |styles?: ILoginViewStyles | Use this to style your components. |
253
+ |texts?: ILoginViewTexts | Use this to change some texts that appear in this component. |
254
+ |userFirstName?: string | Once authenticated send the received firstName data to this prop, so the component can render the Logged in view. |
255
+ |brandImages?: ILoginBrandImages | Receives up to 2 images with their styles and the container style for the images. |
232
256
 
233
- ## styles
257
+ ### styles
234
258
 
235
259
  ```js
236
260
  interface ILoginViewStyles {
@@ -248,7 +272,6 @@ interface ILoginViewStyles {
248
272
  input?: IInputStyles
249
273
  title?: StyleProp<TextStyle>
250
274
  message?: StyleProp<TextStyle>
251
- logo?: StyleProp<ImageStyle>
252
275
  }
253
276
  loggedIn?: {
254
277
  container?: StyleProp<ViewStyle>
@@ -258,16 +281,32 @@ interface ILoginViewStyles {
258
281
  message?: StyleProp<TextStyle>
259
282
  }
260
283
  }
261
-
262
284
  ```
263
285
 
264
- <img width="899" alt="image" src="https://user-images.githubusercontent.com/66479719/154158723-864cdabd-2a0b-4a84-95ad-3176c67f7e8b.png">
286
+ \*Note: Logos images styles are passed from the `brandImages` prop.
265
287
 
288
+ ### texts
289
+ ```js
290
+ {
291
+ loginButton?: string
292
+ logoutButton?: string
293
+ line1?: string
294
+ line2?: string
295
+ message?: string
296
+ dialog?: {
297
+ loginButton?: string
298
+ message?: string
299
+ }
300
+ logoutDialog?: {
301
+ title?: string
302
+ message?: string
303
+ confirm?: string
304
+ cancel?: string
305
+ }
306
+ ```
266
307
  ---
267
308
 
268
- # Tickets
269
-
270
- ![image](https://user-images.githubusercontent.com/66479719/151049068-450a52d9-dfc8-40bf-b12a-f2555a832c8d.png)
309
+ ## Tickets
271
310
 
272
311
  Import the component from the library
273
312
 
@@ -281,7 +320,72 @@ Then add it to the render function.
281
320
  <Tickets eventId={EVENT_ID} onAddToCartSuccess={handleOnAddToCartSuccess} />
282
321
  ```
283
322
 
284
- ## Props
323
+ ### Props
324
+
325
+ ```js
326
+ {
327
+ eventId: number
328
+
329
+ // Callbacks for when user taps on GET Tickets button
330
+ onAddToCartSuccess: (data: {
331
+ isBillingRequired: boolean
332
+ isPhoneRequired?: boolean
333
+ isAgeRequired?: boolean
334
+ minimumAge?: number
335
+ isNameRequired?: boolean
336
+ }) => void
337
+ onAddToCartError?: (error: {
338
+ code: number
339
+ message: string
340
+ extraData?: any
341
+ }) => void
342
+
343
+ // Callbacks for fetching the tickets
344
+ onFetchTicketsError?: (error: {
345
+ code: number
346
+ message: string
347
+ extraData?: any
348
+ }) => void
349
+
350
+ // Callbacks for fetching the Event base on the eventId prop
351
+ onFetchTicketsSuccess?: (data: {
352
+ tickets: ITicket[]
353
+ promoCodeResponse: {
354
+ success?: boolean
355
+ message?: string
356
+ }
357
+ isInWaitingList: boolean
358
+ isAccessCodeRequired: boolean
359
+ }) => void
360
+ onFetchEventError?: (error: {
361
+ code: number
362
+ message: string
363
+ extraData?: any
364
+ }) => void
365
+
366
+ // Callbacks for Waiting list
367
+ onAddToWaitingListSuccess?: (data: any) => void
368
+ onAddToWaitingListError?: (error: {
369
+ code: number
370
+ message: string
371
+ extraData?: any
372
+ }) => void
373
+
374
+ styles?: ITicketsViewStyles
375
+ texts?: ITicketsViewTexts
376
+
377
+ isPromoEnabled?: boolean
378
+ isAccessCodeEnabled?: boolean
379
+
380
+ onPressMyOrders: () => void
381
+ onPressLogout?: () => void
382
+
383
+ // With the following 3 props you can control the visibility of the stock loading indicators and alerts, so you can use your own.
384
+ onLoadingChange?: (isLoading: boolean) => void
385
+ areAlertsEnabled?: boolean
386
+ areLoadingIndicatorsEnabled?: boolean
387
+ }
388
+ ```
285
389
 
286
390
  `eventId` is required in order to fetch the tickets from this event.
287
391
  `onAddToCartSuccess` is called after the Add to Cart was completed successfully, it will return the following data:
@@ -289,17 +393,18 @@ Then add it to the render function.
289
393
  ```js
290
394
  {
291
395
  isBillingRequired: boolean
292
- isNameRequired: boolean
293
- isAgeRequired: boolean
396
+ isPhoneRequired?: boolean
397
+ isAgeRequired?: boolean
398
+ minimumAge?: number
399
+ isNameRequired?: boolean
294
400
  }
295
401
  ```
296
402
 
297
403
  You can then call the `BillingInfo` component and pass them as props in the `cartProps` prop.
298
404
 
299
- ## styles
300
-
301
- Receives several props to style its sub-components.
405
+ `onFetchTicketsSuccess` When tickets fetching was successful, will return fetched data, including `promoCodeResponse`.
302
406
 
407
+ ### styles
303
408
  ```js
304
409
  {
305
410
  rootContainer?: ViewStyle
@@ -307,23 +412,109 @@ Receives several props to style its sub-components.
307
412
  title?: TextStyle
308
413
  getTicketsButtonDisabled?: IButtonStyles
309
414
  getTicketsButtonActive?: IButtonStyles
310
- promoCode?: IPromoCodeStyles
311
- ticketList?: ITicketListStyles
312
- loading?: ILoadingStyles
313
- waitingList?: IWaitingListStyles
314
- loggedIn?: ILoggedInStyles
315
- }
316
- ```
317
-
318
- <img width="790" alt="props" src="https://user-images.githubusercontent.com/66479719/153976200-4bd6b254-6e80-49d6-bacc-076c59873434.png">
415
+ promoCode?: {
416
+ rootContainer?: StyleProp<ViewStyle>
417
+ contentWrapper?: StyleProp<ViewStyle>
418
+ content?: StyleProp<ViewStyle>
419
+ input?: TextInputProps['style']
420
+ inputPlaceholderColor?: string
421
+ title?: StyleProp<TextStyle>
319
422
 
320
- <img width="675" alt="Screen Shot 2022-02-14 at 19 37 40" src="https://user-images.githubusercontent.com/66479719/153976314-9b4431bd-ea2f-49db-87ab-fb7d68b02a0c.png">
423
+ mainButton?: IButtonStyles
424
+ cancelButton?: IButtonStyles
425
+ applyButton?: IButtonStyles
426
+ applyDisabledButton?: IButtonStyles
321
427
 
322
- <img width="682" alt="image" src="https://user-images.githubusercontent.com/66479719/154126406-101af4ca-7586-4686-9a93-88ef0375968e.png">
428
+ messageContainer?: StyleProp<ViewStyle>
429
+ message?: StyleProp<TextStyle>
430
+ }
431
+ ticketList?: {
432
+ listContainer?: ViewStyle
433
+ item?: {
434
+ container?: ViewStyle
435
+ ticketName?: TextStyle
436
+ price?: TextStyle
437
+ oldPrice?: TextStyle
438
+ fees?: TextStyle
439
+ soldOutText?: TextStyle
440
+ soldOutContainer?: ViewStyle
441
+ dropdown?: IDropdownStyles
442
+ pricesContainer?: StyleProp<ViewStyle>
443
+ }
444
+ }
445
+ loading?: {
446
+ animation?: {
447
+ color?: ActivityIndicatorProps['color']
448
+ size?: ActivityIndicatorProps['size']
449
+ }
450
+ content?: ViewStyle
451
+ text?: TextStyle
452
+ }
453
+ waitingList?: {
454
+ rootContainer?: StyleProp<ViewStyle>
455
+ title?: StyleProp<TextStyle>
456
+ button?: IButtonStyles
457
+ input?: IInputStyles
458
+ buttonDisabled?: IButtonStyles
459
+ success?: {
460
+ container?: StyleProp<ViewStyle>
461
+ title?: StyleProp<ViewStyle>
462
+ message?: StyleProp<ViewStyle>
463
+ }
464
+ }
465
+ loggedIn?: {
466
+ rootContainer?: StyleProp<ViewStyle>
467
+ myOrdersButton?: IButtonStyles
468
+ logOutButton?: IButtonStyles
469
+ }
470
+ }
471
+ ```
323
472
 
473
+ ### texts
474
+ ```js
475
+ {
476
+ promoCode?: {
477
+ promoCodeButton?: string
478
+ inputPlaceHolder?: string
479
+ apply?: string
480
+ cancel?: string
481
+ mainButton?: string
482
+ title?: string
483
+ }
484
+ getTicketsButton?: string
485
+ title?: string
486
+ waitingList?: {
487
+ title?: string
488
+ firstName?: string
489
+ lastName?: string
490
+ email?: string
491
+ button?: string
492
+ successTitle?: string
493
+ successMessage?: string
494
+ }
495
+ loggedInTexts?: {
496
+ logoutDialog?: {
497
+ title?: string
498
+ message?: string
499
+ confirmButton?: string
500
+ cancelButton?: string
501
+ }
502
+ myOrderButtonText?: string
503
+ logOutButtonText?: string
504
+ }
505
+ listItem?: {
506
+ soldOut?: string
507
+ salesNotStarted?: string
508
+ salesEnded?: string
509
+ inclFees?: string
510
+ exclFees?: string
511
+ free?: string
512
+ ticket?: string
513
+ }
514
+ }
515
+ ```
324
516
  ---
325
-
326
- # BillingInfo
517
+ ## BillingInfo
327
518
 
328
519
  Import the component from the library
329
520
 
@@ -335,73 +526,89 @@ Add it to the render function.
335
526
 
336
527
  ```js
337
528
  <BillingInfo
338
- cartProps: IAddToCartSuccess
529
+ cartProps: {
530
+ isBillingRequired: boolean
531
+ isNameRequired: boolean
532
+ isAgeRequired: boolean
533
+ isPhoneRequired: boolean
534
+ minimumAge: number
535
+ }
536
+ // registerNewUser
339
537
  onRegisterSuccess?: (tokens: ITokens) => void
340
- onRegisterFail?: (error: string) => void
538
+ onRegisterError?: (error: string) => void
341
539
 
342
- onCheckoutSuccess: (data: IOnCheckoutSuccess) => void
343
- onCheckoutFail?: (error: string) => void
540
+ onCheckoutSuccess: (data: {
541
+ id: string
542
+ hash: string
543
+ total: string
544
+ status: string
545
+ }) => void
546
+ onCheckoutError?: (error: IError) => void
344
547
 
345
548
  onLoginSuccess: (data: any) => void
346
- onLoginFail?: (error: string) => void
549
+ onLoginError?: (error: IError) => void
550
+
347
551
 
348
552
  onFetchUserProfileSuccess?: (data: any) => void
349
- onFetchUserProfileFail?: (error: any) => void
553
+ onFetchUserProfileError?: (error: IError) => void
350
554
 
351
- onFetchCartError?: (error: string) => void
555
+ //fetchCart
556
+ onFetchCartError?: (error: IError) => void
557
+ onFetchCartSuccess?: () => void
352
558
 
353
- styles?: IBillingInfoViewStyles
354
- texts?: IBillingInfoViewTexts
559
+ // fetchCountries
560
+ onFetchCountriesError?: (error: IError) => void
561
+ onFetchCountriesSuccess?: () => void
355
562
 
356
- privacyPolicyLinkStyle?: StyleProp<TextStyle>
563
+ // fetchState
564
+ onFetchStatesError?: (error: IError) => void
565
+ onFetchStatesSuccess?: () => void
357
566
 
358
- onFetchUserProfileFailure?: (error: string) => void
359
- onFetchAccessTokenFailure?: (error: string) => void
567
+ // fetch Token
568
+ onFetchAccessTokenError?: (error: IError) => void
569
+ onFetchAccessTokenSuccess?: () => void
360
570
 
361
571
  styles?: IBillingInfoViewStyles
362
572
  texts?: IBillingInfoViewTexts
363
- />
364
- ```
365
-
366
- ## Props
367
-
368
- ### cartProps
369
-
370
- will receive
371
-
372
- ```js
373
- {
374
- isBillingRequired: boolean
375
- isNameRequired: boolean
376
- isAgeRequired: boolean
377
- }
378
- ```
379
573
 
380
- ### onCheckoutSuccess
574
+ styles?: IBillingInfoViewStyles
575
+ texts?: IBillingInfoViewTexts
381
576
 
382
- Will be called when the user completes all the data required in the form and taps on the button. Will return the following data:
577
+ // Configure the skipping component visible, when isBillingRequired is false
578
+ skipBillingConfig?: {
579
+ styles?: {
580
+ rootContainer?: StyleProp<ViewStyle>
581
+ dialogContainer?: StyleProp<ViewStyle>
582
+ brandImage?: StyleProp<ImageStyle>
583
+ text?: StyleProp<TextStyle>
584
+ activityIndicator?: {
585
+ color?: ColorValue
586
+ size?: 'large' | 'small'
587
+ }
588
+ }
589
+ brandImage?: ImageSourcePropType
590
+ isActivityIndicatorVisible?: boolean
591
+ }
383
592
 
384
- ```js
385
- {
386
- id: string
387
- hash: string
388
- total: string
389
- status: string
390
- }
593
+ loginBrandImages?: {
594
+ containerStyle?: StyleProp<ViewStyle>
595
+ image1?: ImageSourcePropType
596
+ image1Style?: StyleProp<ImageStyle>
597
+ image2?: ImageSourcePropType
598
+ image2Style?: StyleProp<ImageStyle>
599
+ }
600
+ />
391
601
  ```
392
602
 
393
- `hash` and `total` will be used in the `Checkout` component.
394
-
395
- ### skipBilling
396
-
397
- Will auto-populate the checkout form with the logged user data, perform the order `Checkout` and call the callback `onCheckoutSuccess` so you can call the next component.
398
-
399
- ### canSkipHolderNames
400
-
401
- Will skip the need of holder names information and will be automatically filled with the logged user data.
603
+ ### Props
604
+ | Property | Description |
605
+ |----------|-------------|
606
+ | cartProps | Received from the Tickets component |
607
+ | onCheckoutSuccess | Will return Order data from the Checkout action |
608
+ | loginBrandImages | Receives styles and images sources to show in the `Login` component |
609
+ | skipBillingConfig | Configure the skipping component, visible when `isBillingRequired` is set to false |
402
610
 
403
611
  ### texts
404
-
405
612
  ```js
406
613
  interface IBillingInfoViewTexts {
407
614
  loginTexts?: ILoginViewTexts
@@ -451,28 +658,22 @@ interface IBillingInfoViewStyles {
451
658
  dropdownStyles?: IDropdownStyles
452
659
  checkboxStyles?: ICheckboxStyles
453
660
 
454
- titles?: StyleProp<TextStyle>
455
- headers?: StyleProp<TextStyle>
661
+ screenTitle?: StyleProp<TextStyle>
662
+ ticketHoldersTitle?: StyleProp<TextStyle>
663
+ ticketHolderItemHeader?: StyleProp<TextStyle>
664
+
456
665
  texts?: StyleProp<TextStyle>
457
666
  customCheckbox?: ICheckboxStyles
458
667
 
459
668
  datePicker?: IDatePickerStyles
460
- skippingDialog?: {
461
- rootContainer?: StyleProp<ViewStyle>
462
- dialogContainer?: StyleProp<ViewStyle>
463
- brandImage?: StyleProp<ImageStyle>
464
- message?: StyleProp<TextStyle>
465
- spinner?: {
466
- color: ColorValue
467
- size: 'large' | 'small'
468
- }
469
- }
669
+
670
+ privacyPolicyLinkStyle?: StyleProp<TextStyle>
470
671
  }
471
672
  ```
472
673
 
473
674
  ---
474
675
 
475
- # Checkout
676
+ ## Checkout
476
677
 
477
678
  Import the component from the library
478
679
 
@@ -485,23 +686,68 @@ Add it to the render function.
485
686
  ```js
486
687
  <Checkout
487
688
  eventId={EVENT_ID}
488
- hash={checkoutProps!.hash}
489
- total={checkoutProps!.total}
689
+ hash={hash}
690
+ total={total}
490
691
  onPaymentSuccess={handleOnPaymentSuccess}
692
+ onPressExit={handleStripeError}
693
+ areLoadingIndicatorsEnabled={false}
694
+ styles={styles}
695
+ {...props}
491
696
  />
492
697
  ```
493
698
 
494
- `eventId` Same as used in the `Tickets` component.
699
+ ### Props
700
+
701
+ ```js
702
+ {
703
+ eventId: number
704
+ hash: string
705
+ total: string
706
+
707
+ onFetchOrderReviewError?: (error: IError) => void
708
+ onFetchOrderReviewSuccess?: (data: any) => void
709
+
710
+ onFetchEventConditionsError?: (error: IError) => void
711
+ onFetchEventConditionsSuccess?: (data: any) => void
712
+
713
+ onCheckoutCompletedSuccess?: (data: any) => void
714
+ onCheckoutCompletedError?: (error: IError) => void
715
+
716
+ onPaymentSuccess: (data: any) => void
717
+ onPaymentError?: (error: IError) => void
718
+
719
+ onStripeInitializeError?: (error: string) => void
495
720
 
496
- `hash` retrieved from the `onCheckoutSuccess` callback in the `BillingInfo`component.
721
+ onPressExit: () => void
497
722
 
498
- `total` retrieved from the `onCheckoutSuccess` callback in the `BillingInfo` component.
723
+ texts?: {
724
+ title?: string
725
+ subTitle?: string
726
+ missingStripeConfigMessage?: string
727
+ exitButton?: string
728
+ payButton?: string
729
+ freeRegistrationButton?: string
730
+ }
499
731
 
500
- `onPaymentSuccess` will handle the success in the payment process. Will return the `hash`.
732
+ styles?: ICheckoutStyles
733
+
734
+ onLoadingChange?: (isLoading: boolean) => void
735
+ areAlertsEnabled?: boolean
736
+ areLoadingIndicatorsEnabled?: boolean
737
+ }
738
+ ```
739
+ | Property | Description |
740
+ |----------|-------------|
741
+ | eventId | Same as used in the `Tickets` component. |
742
+ | hash | retrieved from the `onCheckoutSuccess` callback in the `BillingInfo`component. |
743
+ | total | retrieved from the `onCheckoutSuccess` callback in the `BillingInfo` component. |
744
+ | onPaymentSuccess | will handle the success in the payment process. Will return the `hash`. |
745
+ | areLoadingIndicatorsEnabled | whether or not show the Loading Indicator, `default: true`. |
746
+ | areAlertsEnabled | whether or not show the Error Alerts, `default: true`. |
501
747
 
502
- If the you need to modify the card container, use the `styles.payment.cardContainer` prop. Useful if the card is to short and the zip code is not visible.
748
+ *Note: If the you need to modify the card container, use the `styles.payment.cardContainer` prop. Useful if the card is to short and the zip code is not visible.*
503
749
 
504
- `styles`
750
+ ### styles
505
751
 
506
752
  ```js
507
753
  {
@@ -525,9 +771,17 @@ If the you need to modify the card container, use the `styles.payment.cardContai
525
771
  }
526
772
  ```
527
773
 
528
- ---
774
+ ### Stripe
775
+
776
+ Currently, Stripe card is not customizable. Please see the open issues in their Github.
529
777
 
530
- # PurchaseConfirmation
778
+ - [563](https://github.com/stripe/stripe-react-native/issues/563)
779
+ - [285](https://github.com/stripe/stripe-react-native/issues/285)
780
+
781
+ Additionally, if you are encountering problems with building your project, please take a look at the [Stripe troubleshooting](https://github.com/stripe/stripe-react-native#troubleshooting).
782
+
783
+ ---
784
+ ## Purchase Confirmation
531
785
 
532
786
  Import the component from the library
533
787
 
@@ -541,19 +795,44 @@ Add it to the render function.
541
795
  <PurchaseConfirmation
542
796
  orderHash={checkoutProps!.hash}
543
797
  onComplete={handleOnComplete}
544
- />
545
- ```
546
-
547
- `orderHash` the `hash` returned in the `BillingInfo` component.
548
798
 
549
- `onComplete` to handle the completion of the flow. Here you can handle the unmount of the component or navigate to another screen.
799
+ styles?: {
800
+ rootContainer?: StyleProp<ViewStyle>
801
+ title?: StyleProp<TextStyle>
550
802
 
551
- ---
803
+ message?: {
804
+ container?: StyleProp<ViewStyle>
805
+ line1?: StyleProp<TextStyle>
806
+ line2?: StyleProp<TextStyle>
807
+ }
808
+ exitButton?: {
809
+ container?: StyleProp<ViewStyle>
810
+ button?: StyleProp<ViewStyle>
811
+ text?: StyleProp<TextStyle>
812
+ }
813
+ }
552
814
 
553
- ## MyOrders
815
+ texts?: {
816
+ title?: string
817
+ message?: {
818
+ line1?: string
819
+ line2?: string
820
+ }
821
+ exitButton?: string
822
+ }
823
+ />
824
+ ```
825
+ ### Props
826
+ | Property | Description |
827
+ |----------|-------------|
828
+ | orderHash | The `hash` returned in the `BillingInfo` component |
829
+ | onComplete | To handle the completion of the flow. Here you can handle the unmount of the component or navigate to another screen |
830
+ | styles | Styles for the component |
831
+ | texts | Texts for the component |
554
832
 
555
- ![image](https://user-images.githubusercontent.com/66479719/151049211-5faebe6b-df3b-4785-ac0d-3adb7a3d6699.png)
556
833
 
834
+ ---
835
+ ## My Orders
557
836
  If there is a valid session, there will appear a button to access `MyOrders` in the `Tickets` component.
558
837
 
559
838
  Import the component from the library.
@@ -562,80 +841,116 @@ Import the component from the library.
562
841
  import { MyOrders } from 'tf-checkout-react-native'
563
842
  ```
564
843
 
565
- There is no need to pass any data prop to it.
566
844
 
567
845
  ### Props
568
846
 
569
- `config` has properties to hide components.
847
+ ```js
848
+ {
849
+ onSelectOrder: (order: {
850
+ order: {
851
+ header: {
852
+ isReferralDisabled: boolean
853
+ shareLink: string
854
+ total: string
855
+ salesReferred: string
856
+ },
857
+ items: [
858
+ {
859
+ name: string
860
+ currency: string
861
+ price: string
862
+ discount: string
863
+ quantity: string
864
+ total: string
865
+ },
866
+ {...}
867
+ ],
868
+ tickets: [
869
+ {
870
+ hash: string
871
+ ticketType: string
872
+ holderName: string
873
+ status: string
874
+ pdfLink: string
875
+ },
876
+ {...}
877
+ ]
878
+ }
879
+ }) => void
570
880
 
571
- `isEventsDropdownHidden` if the Events dropdown should be hidden.
881
+ onFetchMyOrdersSuccess?: () => void
882
+ onFetchMyOrdersError?: (error: IError) => void
572
883
 
573
- ```js
574
- config={{
575
- isEventsDropdownHidden: true,
576
- }}
577
- ```
884
+ onFetchOrderDetailsSuccess?: () => void
885
+ onFetchOrderDetailsError?: (error: IError) => void
578
886
 
579
- `onSelectOrder` handler to know which order the user has selected. Will return an object with following structure:
887
+ onLoadingChange?: (isLoading: boolean) => void
580
888
 
581
- ```js
582
- order: {
583
- header: {
584
- isReferralDisabled: boolean
585
- shareLink: string
586
- total: string
587
- salesReferred: string
588
- },
589
- items: [
590
- {
591
- name: string
592
- currency: string
593
- price: string
594
- discount: string
595
- quantity: string
596
- total: string
597
- },
598
- {...}
599
- ],
600
- tickets: [
601
- {
602
- hash: string
603
- ticketType: string
604
- holderName: string
605
- status: string
606
- pdfLink: string
607
- },
608
- {...}
609
- ]
889
+ styles?: IMyOrdersStyles
890
+ config?: {
891
+ isEventsDropdownHidden?: boolean
892
+ areActivityIndicatorsEnabled?: boolean
893
+ areAlertsEnabled?: boolean
894
+ }
895
+ texts?: {
896
+ selectEventPlaceholder?: string
897
+ }
610
898
  }
611
899
  ```
612
900
 
613
- `styles` to customize the component look & feel.
614
-
901
+ ### styles
615
902
  ```js
616
- export interface IMyOrdersStyles {
617
- orderListItem?: IOrderListItemStyles
903
+ {
904
+ orderListItem?: {
905
+ rootContainer?: StyleProp<ViewStyle>
906
+ contentContainer?: StyleProp<ViewStyle>
907
+ infoContainer?: StyleProp<ViewStyle>
908
+ infoTopContainer?: StyleProp<ViewStyle>
909
+ infoBottomContainer?: StyleProp<ViewStyle>
910
+ imageContainer?: StyleProp<ViewStyle>
911
+ image?: StyleProp<ImageStyle>
912
+ infoRootContainer?: StyleProp<ViewStyle>
913
+ iconNextContainer?: StyleProp<ViewStyle>
914
+ iconNext?: StyleProp<ImageStyle>
915
+ orderId?: StyleProp<TextStyle>
916
+ orderDate?: StyleProp<TextStyle>
917
+ eventName?: StyleProp<TextStyle>
918
+ priceContainer?: StyleProp<ViewStyle>
919
+ price?: StyleProp<TextStyle>
920
+ currency?: StyleProp<TextStyle>
921
+ }
618
922
  safeArea?: StyleProp<ViewStyle>
619
923
  listContainer?: StyleProp<ViewStyle>
620
924
  eventsContainer?: StyleProp<ViewStyle>
621
925
  eventsTitle?: StyleProp<TextStyle>
622
926
  refreshControlColor?: ColorValue
623
- eventsDropdown?: IDropdownStyles
927
+ eventsDropdown?: {
928
+ container?: StyleProp<ViewStyle>
929
+ button?: StyleProp<ViewStyle>
930
+ icon?: StyleProp<ImageStyle>
931
+ label?: StyleProp<TextStyle>
932
+ dialog?: StyleProp<ViewStyle>
933
+ flatListContainer?: StyleProp<ViewStyle>
934
+ listItem?: {
935
+ container?: StyleProp<ViewStyle>
936
+ button?: StyleProp<ViewStyle>
937
+ buttonSelected?: StyleProp<ViewStyle>
938
+ text?: StyleProp<TextStyle>
939
+ textSelected?: StyleProp<TextStyle>
940
+ }
941
+
942
+ }
624
943
  rootContainer?: StyleProp<ViewStyle>
625
944
  eventsSelectionContainer?: StyleProp<ViewStyle>
626
945
  clearEventSelectionIcon?: StyleProp<ImageStyle>
627
946
  }
628
947
  ```
629
948
 
630
- `onFetchOrderDetailsFail` if the fetching fails, you can use this to know what happened.
631
-
632
949
  ---
633
950
 
634
- # MyOrderDetails
951
+ ## MyOrderDetails
635
952
 
636
- ![image](https://user-images.githubusercontent.com/66479719/151049265-ebaabb75-58b1-4b22-bf99-83b1375b1a70.png)
637
-
638
- When user selects an order from the `MyOrders`component, will show it details.
953
+ When user selects an order from the `MyOrders` component, will show it details.
639
954
 
640
955
  Import the component from the library.
641
956
 
@@ -645,44 +960,25 @@ import { MyOrderDetails } from 'tf-checkout-react-native'
645
960
 
646
961
  ### Props
647
962
 
648
- `data` receives same data as the one of the object received from the `onSelectOrder` handler in `MyOrders`component:
649
-
650
963
  ```js
651
- order: {
652
- header: {
653
- isReferralDisabled: boolean
654
- shareLink: string
655
- total: string
656
- salesReferred: string
657
- },
658
- items: [
659
- {
660
- name: string
661
- currency: string
662
- price: string
663
- discount: string
664
- quantity: string
665
- total: string
666
- },
667
- {...}
668
- ],
669
- tickets: [
670
- {
671
- hash: string
672
- ticketType: string
673
- holderName: string
674
- status: string
675
- pdfLink: string
676
- },
677
- {...}
678
- ]
679
- }
680
- ```
681
-
682
- `styles` optional, to customize the component look & feel.
683
-
684
- ```
685
- styles?: {
964
+ {
965
+ data: IMyOrderDetailsResponse
966
+ config?: {
967
+ areActivityIndicatorsEnabled?: boolean
968
+ areAlertsEnabled?: boolean
969
+ }
970
+ onDownloadStatusChange?: (status?:
971
+ 'downloading' |
972
+ 'downloaded' |
973
+ 'failed'
974
+ ) => void
975
+ downloadStatusIcons?: {
976
+ success?: ImageSourcePropType
977
+ error?: ImageSourcePropType
978
+ }
979
+ onAndroidWritePermission?: (permission?: boolean) => void
980
+ onLinkCopied?: (copied?: boolean) => void
981
+ styles?: {
686
982
  rootContainer?: StyleProp<ViewStyle>
687
983
  header?: {
688
984
  container?: StyleProp<ViewStyle>
@@ -726,29 +1022,34 @@ styles?: {
726
1022
  }
727
1023
  downloadButton?: IButtonStyles
728
1024
  }
729
- ```
730
-
731
- `texts` optional, to customize the texts that shows on the labels.
732
-
733
- ```js
734
- texts?: {
735
- title?: string
736
- subTitle?: string
737
- referralLink?: string
738
- listItem?: {
739
- title?: string
740
- ticketType?: string
741
- price?: string
742
- quantity?: string
743
- total?: string
744
- }
745
- ticketItem?: {
1025
+ texts?: {
746
1026
  title?: string
747
- ticketId?: string
748
- ticketType?: string
749
- ticketHolder?: string
750
- status?: string
751
- download?: string
1027
+ subTitle?: string
1028
+ referralLink?: string
1029
+ listItem?: {
1030
+ title?: string
1031
+ ticketType?: string
1032
+ price?: string
1033
+ quantity?: string
1034
+ total?: string
1035
+ }
1036
+ ticketItem?: {
1037
+ title?: string
1038
+ ticketId?: string
1039
+ ticketType?: string
1040
+ ticketHolder?: string
1041
+ status?: string
1042
+ download?: string
1043
+ }
1044
+ downloadNotification?: {
1045
+ successMessage?: string
1046
+ errorMessage?: string
1047
+ }
1048
+ copyText?: {
1049
+ copy?: string
1050
+ copied?: string
1051
+ }
752
1052
  }
753
1053
  }
754
1054
  ```
1055
+