tf-checkout-react-native 1.0.1 → 1.0.6

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 (163) hide show
  1. package/README.md +235 -7
  2. package/assets/icons/ic_check.png +0 -0
  3. package/assets/icons/ic_copy.png +0 -0
  4. package/assets/icons/ic_dropdown.png +0 -0
  5. package/assets/icons/ic_error.png +0 -0
  6. package/assets/icons/ic_next.png +0 -0
  7. package/assets/images/brand.png +0 -0
  8. package/lib/api/ApiClient.d.ts +7 -4
  9. package/lib/api/ApiClient.js +119 -98
  10. package/lib/api/ApiClient.js.map +1 -1
  11. package/lib/api/Constants.d.ts +1 -0
  12. package/lib/api/Constants.js +1 -0
  13. package/lib/api/Constants.js.map +1 -1
  14. package/lib/api/types.d.ts +23 -3
  15. package/lib/api/types.js +0 -1
  16. package/lib/api/types.js.map +1 -1
  17. package/lib/components/button/Button.js +4 -4
  18. package/lib/components/button/Button.js.map +1 -1
  19. package/lib/components/checkbox/types.d.ts +1 -1
  20. package/lib/components/datePicker/DatePicker.d.ts +1 -1
  21. package/lib/components/datePicker/DatePicker.js +10 -7
  22. package/lib/components/datePicker/DatePicker.js.map +1 -1
  23. package/lib/components/datePicker/styles.d.ts +0 -1
  24. package/lib/components/datePicker/styles.js +0 -1
  25. package/lib/components/datePicker/styles.js.map +1 -1
  26. package/lib/components/datePicker/types.d.ts +12 -4
  27. package/lib/components/dropdown/Dropdown.d.ts +1 -1
  28. package/lib/components/dropdown/Dropdown.js +26 -14
  29. package/lib/components/dropdown/Dropdown.js.map +1 -1
  30. package/lib/components/dropdown/DropdownListItem.d.ts +1 -1
  31. package/lib/components/dropdown/DropdownListItem.js +7 -5
  32. package/lib/components/dropdown/DropdownListItem.js.map +1 -1
  33. package/lib/components/dropdown/styles.d.ts +15 -3
  34. package/lib/components/dropdown/styles.js +22 -4
  35. package/lib/components/dropdown/styles.js.map +1 -1
  36. package/lib/components/dropdown/types.d.ts +16 -7
  37. package/lib/components/formField/FormField.js +10 -7
  38. package/lib/components/formField/FormField.js.map +1 -1
  39. package/lib/components/formField/types.d.ts +5 -3
  40. package/lib/components/index.d.ts +1 -0
  41. package/lib/components/index.js +1 -0
  42. package/lib/components/index.js.map +1 -1
  43. package/lib/components/input/Input.js +4 -2
  44. package/lib/components/input/Input.js.map +1 -1
  45. package/lib/components/input/types.d.ts +2 -0
  46. package/lib/components/loggedIn/LoggedIn.js +21 -7
  47. package/lib/components/loggedIn/LoggedIn.js.map +1 -1
  48. package/lib/components/loggedIn/types.d.ts +17 -5
  49. package/lib/components/login/Login.d.ts +1 -1
  50. package/lib/components/login/Login.js +21 -17
  51. package/lib/components/login/Login.js.map +1 -1
  52. package/lib/components/login/LoginView.d.ts +1 -1
  53. package/lib/components/login/LoginView.js +38 -19
  54. package/lib/components/login/LoginView.js.map +1 -1
  55. package/lib/components/login/styles.d.ts +5 -0
  56. package/lib/components/login/styles.js +5 -0
  57. package/lib/components/login/styles.js.map +1 -1
  58. package/lib/components/login/types.d.ts +24 -5
  59. package/lib/components/promoCode/PromoCode.js +9 -1
  60. package/lib/components/promoCode/PromoCode.js.map +1 -1
  61. package/lib/components/wrapper/Wrapper.d.ts +8 -0
  62. package/lib/components/wrapper/Wrapper.js +29 -0
  63. package/lib/components/wrapper/Wrapper.js.map +1 -0
  64. package/lib/containers/billingInfo/Billing.d.ts +3 -0
  65. package/lib/containers/billingInfo/Billing.js +583 -0
  66. package/lib/containers/billingInfo/Billing.js.map +1 -0
  67. package/lib/containers/billingInfo/styles.d.ts +36 -0
  68. package/lib/containers/billingInfo/styles.js +37 -0
  69. package/lib/containers/billingInfo/styles.js.map +1 -1
  70. package/lib/containers/billingInfo/types.d.ts +47 -4
  71. package/lib/containers/checkout/Checkout.d.ts +1 -1
  72. package/lib/containers/checkout/Checkout.js +54 -32
  73. package/lib/containers/checkout/Checkout.js.map +1 -1
  74. package/lib/containers/checkout/CheckoutData.js +9 -9
  75. package/lib/containers/checkout/CheckoutData.js.map +1 -1
  76. package/lib/containers/checkout/CheckoutView.d.ts +1 -1
  77. package/lib/containers/checkout/CheckoutView.js +24 -10
  78. package/lib/containers/checkout/CheckoutView.js.map +1 -1
  79. package/lib/containers/checkout/components/OrderReview.d.ts +1 -1
  80. package/lib/containers/checkout/components/OrderReview.js +4 -4
  81. package/lib/containers/checkout/components/OrderReview.js.map +1 -1
  82. package/lib/containers/checkout/styles.d.ts +17 -2
  83. package/lib/containers/checkout/styles.js +17 -2
  84. package/lib/containers/checkout/styles.js.map +1 -1
  85. package/lib/containers/checkout/types.d.ts +50 -5
  86. package/lib/containers/index.d.ts +1 -1
  87. package/lib/containers/index.js +1 -1
  88. package/lib/containers/index.js.map +1 -1
  89. package/lib/containers/myOrderDetails/MyOrderDetails.js +61 -6
  90. package/lib/containers/myOrderDetails/MyOrderDetails.js.map +1 -1
  91. package/lib/containers/myOrderDetails/MyOrderDetailsView.js +140 -36
  92. package/lib/containers/myOrderDetails/MyOrderDetailsView.js.map +1 -1
  93. package/lib/containers/myOrderDetails/components/Notification.d.ts +6 -0
  94. package/lib/containers/myOrderDetails/components/Notification.js +16 -0
  95. package/lib/containers/myOrderDetails/components/Notification.js.map +1 -0
  96. package/lib/containers/myOrderDetails/components/styles.d.ts +38 -0
  97. package/lib/containers/myOrderDetails/components/styles.js +41 -0
  98. package/lib/containers/myOrderDetails/components/styles.js.map +1 -0
  99. package/lib/containers/myOrderDetails/styles.d.ts +54 -0
  100. package/lib/containers/myOrderDetails/styles.js +54 -1
  101. package/lib/containers/myOrderDetails/styles.js.map +1 -1
  102. package/lib/containers/myOrderDetails/types.d.ts +70 -6
  103. package/lib/containers/myOrders/MyOrders.d.ts +1 -6
  104. package/lib/containers/myOrders/MyOrders.js +18 -15
  105. package/lib/containers/myOrders/MyOrders.js.map +1 -1
  106. package/lib/containers/myOrders/MyOrdersView.d.ts +1 -1
  107. package/lib/containers/myOrders/MyOrdersView.js +36 -14
  108. package/lib/containers/myOrders/MyOrdersView.js.map +1 -1
  109. package/lib/containers/myOrders/components/OrderListItem.js +1 -1
  110. package/lib/containers/myOrders/components/OrderListItem.js.map +1 -1
  111. package/lib/containers/myOrders/components/styles.d.ts +4 -0
  112. package/lib/containers/myOrders/components/styles.js +4 -0
  113. package/lib/containers/myOrders/components/styles.js.map +1 -1
  114. package/lib/containers/myOrders/styles.d.ts +19 -2
  115. package/lib/containers/myOrders/styles.js +20 -2
  116. package/lib/containers/myOrders/styles.js.map +1 -1
  117. package/lib/containers/myOrders/types.d.ts +20 -15
  118. package/lib/containers/purchaseConfirmation/PurchaseConfirmation.d.ts +1 -1
  119. package/lib/containers/purchaseConfirmation/PurchaseConfirmation.js +2 -2
  120. package/lib/containers/purchaseConfirmation/PurchaseConfirmation.js.map +1 -1
  121. package/lib/containers/purchaseConfirmation/PurchaseConfirmationView.js +4 -4
  122. package/lib/containers/purchaseConfirmation/PurchaseConfirmationView.js.map +1 -1
  123. package/lib/containers/purchaseConfirmation/types.d.ts +4 -0
  124. package/lib/containers/tickets/Tickets.d.ts +1 -1
  125. package/lib/containers/tickets/Tickets.js +22 -17
  126. package/lib/containers/tickets/Tickets.js.map +1 -1
  127. package/lib/containers/tickets/TicketsView.d.ts +1 -1
  128. package/lib/containers/tickets/TicketsView.js +7 -9
  129. package/lib/containers/tickets/TicketsView.js.map +1 -1
  130. package/lib/containers/tickets/components/TicketListItem.js +24 -8
  131. package/lib/containers/tickets/components/TicketListItem.js.map +1 -1
  132. package/lib/containers/tickets/types.d.ts +15 -2
  133. package/lib/helpers/Config.d.ts +12 -0
  134. package/lib/helpers/Config.js +32 -0
  135. package/lib/helpers/Config.js.map +1 -0
  136. package/lib/helpers/LocalStorage.d.ts +1 -0
  137. package/lib/helpers/LocalStorage.js +15 -3
  138. package/lib/helpers/LocalStorage.js.map +1 -1
  139. package/lib/helpers/Validators.d.ts +1 -0
  140. package/lib/helpers/Validators.js +5 -0
  141. package/lib/helpers/Validators.js.map +1 -1
  142. package/lib/index.js +2 -0
  143. package/lib/index.js.map +1 -1
  144. package/lib/res/colors.d.ts +2 -0
  145. package/lib/res/colors.js +4 -0
  146. package/lib/res/colors.js.map +1 -1
  147. package/lib/res/icons.d.ts +1 -0
  148. package/lib/res/icons.js +5 -4
  149. package/lib/res/icons.js.map +1 -1
  150. package/lib/res/images.js +1 -1
  151. package/lib/res/images.js.map +1 -1
  152. package/lib/res/index.d.ts +3 -0
  153. package/lib/types/IUserProfile.d.ts +1 -1
  154. package/package.json +10 -2
  155. package/lib/containers/billingInfo/BillingInfo.d.ts +0 -3
  156. package/lib/containers/billingInfo/BillingInfo.js +0 -627
  157. package/lib/containers/billingInfo/BillingInfo.js.map +0 -1
  158. package/lib/containers/billingInfo/BillingInfoData.d.ts +0 -6
  159. package/lib/containers/billingInfo/BillingInfoData.js +0 -79
  160. package/lib/containers/billingInfo/BillingInfoData.js.map +0 -1
  161. package/lib/containers/billingInfo/BillingInfoView.d.ts +0 -3
  162. package/lib/containers/billingInfo/BillingInfoView.js +0 -23
  163. package/lib/containers/billingInfo/BillingInfoView.js.map +0 -1
package/README.md CHANGED
@@ -6,15 +6,53 @@ 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
- # Installation [🚧 WIP 🚧]
9
+ ### Android
10
10
 
11
- These are not the REAL library names.
11
+ - Android 5.0 (API level 21) and above
12
+ - Android gradle plugin 4.x and above
12
13
 
13
- `yarn add theticketfairy/tf-checkout-react-native`
14
+ To download the PDFs, add the `WRITE_EXTERNAL_STORAGE` permission to the Android's Manifest file.
15
+
16
+ ```xml
17
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
18
+ ```
19
+
20
+ ### iOS
21
+
22
+ - Compatible with apps targeting iOS 11 or above.
23
+
24
+ To download the PDFs, add the following flags to `Info.plist` file:
25
+
26
+ - UIFileSharingEnabled: Application supports iTunes file sharing
27
+ - LSSupportsOpeningDocumentsInPlace: Supports opening documents in place
28
+
29
+ # Installation
30
+
31
+ ```node
32
+ yarn add tf-checkout-react-native
33
+ ```
14
34
 
15
35
  or
16
36
 
17
- `npm install theticketfairy/tf-checkout-react-native`
37
+ ```node
38
+ npm install tf-checkout-react-native
39
+ ```
40
+
41
+ ## Required for Android
42
+
43
+ Add below dependency to your `app/build.gradle` file with specified version (in our example we are using `1.4.0`).
44
+
45
+ ```java
46
+ implementation 'com.google.android.material:material:<version>'
47
+ ```
48
+
49
+ Set appropriate style in your styles.xml file.
50
+
51
+ ```xml
52
+ <style name="Theme.MyApp" parent="Theme.MaterialComponents.DayNight.NoActionBar">
53
+ <!-- ... -->
54
+ </style>
55
+ ```
18
56
 
19
57
  # Run the example app
20
58
 
@@ -26,9 +64,9 @@ or
26
64
  5. Run `yarn ios` or `npm run ios` to initialize and run in the iPhone simulator.
27
65
  6. If running on Android, run `yarn android` or `npm run android` to run it in the Android emulator or connected physical device.
28
66
 
29
- # Features
67
+ # Features [🚧 WIP 🚧]
30
68
 
31
- This library exports 4 main components:
69
+ This library exports the following components:
32
70
 
33
71
  ## Tickets
34
72
 
@@ -50,10 +88,20 @@ TicketFairy doesn't store any card related data, we use [Stripe](https://stripe.
50
88
 
51
89
  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.
52
90
 
91
+ ## My Orders
92
+
93
+ Will show the purchased orders for the logged user.
94
+
95
+ ## My Order details
96
+
97
+ Will show the details for the selected Order, it also allows the user to download the Ticket PDF.
98
+
53
99
  # Usage [🚧 WIP 🚧]
54
100
 
55
101
  ## Tickets
56
102
 
103
+ ![image](https://user-images.githubusercontent.com/66479719/151049068-450a52d9-dfc8-40bf-b12a-f2555a832c8d.png)
104
+
57
105
  Import the component from the library
58
106
 
59
107
  ```js
@@ -66,6 +114,8 @@ Then add it to the render function.
66
114
  <Tickets eventId={EVENT_ID} onAddToCartSuccess={handleOnAddToCartSuccess} />
67
115
  ```
68
116
 
117
+ ## Props
118
+
69
119
  `eventId` is required in order to fetch the tickets from this event.
70
120
  `onAddToCartSuccess` is called after the Add to Cart was completed successfully, it will return the following data:
71
121
 
@@ -79,6 +129,36 @@ Then add it to the render function.
79
129
 
80
130
  You can then call the `BillingInfo` component and pass them as props in the `cartProps` prop.
81
131
 
132
+ `config` set your event's configuration, with the following options:
133
+
134
+ ```js
135
+ {
136
+ DOMAIN?: string,
137
+ BASE_URL?: string,
138
+ CLIENT_ID?: string,
139
+ CLIENT_SECRET?: string,
140
+ TIMEOUT?: number,
141
+ BRAND?: string,
142
+ IS_BILLING_STREET_NAME_REQUIRED?: boolean,
143
+ }
144
+ ```
145
+
146
+ `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.
147
+
148
+ `BASE_URL` If our dev team gives you a custom BASE_URL.
149
+
150
+ `CLIENT_ID` Set your CLIENT_ID.
151
+
152
+ `CLIENT_SECRET` Set your CLIENT_SECRET.
153
+
154
+ `BRAND`: Set your BRAND so users can only see this brand in their orders.
155
+
156
+ `TIMEOUT` Set custom timeout for the APIs requests.
157
+
158
+ `IS_BILLING_STREET_NAME_REQUIRED`: Whether or not the Street name is required in the billing component.
159
+
160
+ ---
161
+
82
162
  ## BillingInfo
83
163
 
84
164
  Import the component from the library
@@ -106,7 +186,9 @@ Add it to the render function.
106
186
  }
107
187
  ```
108
188
 
109
- `onCheckoutSuccess` will be called when the user completes all the data required in the form. Will return the following data:
189
+ ### onCheckoutSuccess
190
+
191
+ Will be called when the user completes all the data required in the form and taps on the button. Will return the following data:
110
192
 
111
193
  ```js
112
194
  {
@@ -119,6 +201,16 @@ Add it to the render function.
119
201
 
120
202
  `hash` and `total` will be used in the `Checkout` component.
121
203
 
204
+ ### skipBilling
205
+
206
+ 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.
207
+
208
+ ### canSkipHolderNames
209
+
210
+ Will skip the need of holder names information and will be automatically filled with the logged user data.
211
+
212
+ ---
213
+
122
214
  ## Checkout
123
215
 
124
216
  Import the component from the library
@@ -146,6 +238,10 @@ Add it to the render function.
146
238
 
147
239
  `onPaymentSuccess` will handle the success in the payment process. Will return the `hash`.
148
240
 
241
+ 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.
242
+
243
+ ---
244
+
149
245
  ## PurchaseConfirmation
150
246
 
151
247
  Import the component from the library
@@ -166,3 +262,135 @@ Add it to the render function.
166
262
  `orderHash` the `hash` returned in the `BillingInfo` component.
167
263
 
168
264
  `onComplete` to handle the completion of the flow. Here you can handle the unmount of the component or navigate to another screen.
265
+
266
+ ---
267
+
268
+ ## MyOrders
269
+
270
+ ![image](https://user-images.githubusercontent.com/66479719/151049211-5faebe6b-df3b-4785-ac0d-3adb7a3d6699.png)
271
+
272
+ If there is a valid session, there will appear a button to access `MyOrders` in the `Tickets` component.
273
+
274
+ Import the component from the library.
275
+
276
+ ```js
277
+ import { MyOrders } from 'tf-checkout-react-native'
278
+ ```
279
+
280
+ There is no need to pass any data prop to it.
281
+
282
+ ### Props
283
+
284
+ `onSelectOrder` handler to know which order the user has selected. Will return an object with following structure:
285
+
286
+ ```js
287
+ order: {
288
+ header: {
289
+ isReferralDisabled: boolean
290
+ shareLink: string
291
+ total: string
292
+ salesReferred: string
293
+ },
294
+ items: [
295
+ {
296
+ name: string
297
+ currency: string
298
+ price: string
299
+ discount: string
300
+ quantity: string
301
+ total: string
302
+ },
303
+ {...}
304
+ ],
305
+ tickets: [
306
+ {
307
+ hash: string
308
+ ticketType: string
309
+ holderName: string
310
+ status: string
311
+ pdfLink: string
312
+ },
313
+ {...}
314
+ ]
315
+ }
316
+ ```
317
+
318
+ `styles` to customize the component look & feel.
319
+
320
+ `onFetchOrderDetailsFail` if the fetching fails, you can use this to know what happened.
321
+
322
+ ---
323
+
324
+ ## MyOrderDetails
325
+
326
+ ![image](https://user-images.githubusercontent.com/66479719/151049265-ebaabb75-58b1-4b22-bf99-83b1375b1a70.png)
327
+
328
+ When user selects an order from the `MyOrders`component, will show it details.
329
+
330
+ Import the component from the library.
331
+
332
+ ```js
333
+ import { MyOrderDetails } from 'tf-checkout-react-native'
334
+ ```
335
+
336
+ ### Props
337
+
338
+ `data` receives same data as the one of the object received from the `onSelectOrder` handler in `MyOrders`component:
339
+
340
+ ```js
341
+ order: {
342
+ header: {
343
+ isReferralDisabled: boolean
344
+ shareLink: string
345
+ total: string
346
+ salesReferred: string
347
+ },
348
+ items: [
349
+ {
350
+ name: string
351
+ currency: string
352
+ price: string
353
+ discount: string
354
+ quantity: string
355
+ total: string
356
+ },
357
+ {...}
358
+ ],
359
+ tickets: [
360
+ {
361
+ hash: string
362
+ ticketType: string
363
+ holderName: string
364
+ status: string
365
+ pdfLink: string
366
+ },
367
+ {...}
368
+ ]
369
+ }
370
+ ```
371
+
372
+ `styles` optional, to customize the component look & feel.
373
+ `texts` optional, to customize the texts that shows on the labels.
374
+
375
+ ```js
376
+ texts?: {
377
+ title?: string
378
+ subTitle?: string
379
+ referralLink?: string
380
+ listItem?: {
381
+ title?: string
382
+ ticketType?: string
383
+ price?: string
384
+ quantity?: string
385
+ total?: string
386
+ }
387
+ ticketItem?: {
388
+ title?: string
389
+ ticketId?: string
390
+ ticketType?: string
391
+ ticketHolder?: string
392
+ status?: string
393
+ download?: string
394
+ }
395
+ }
396
+ ```
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,7 +1,7 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { IWaitingListFields } from '../components/waitingList/types';
3
3
  import { IUserProfile } from '../types';
4
- import { IAuthorizeResponse, ICheckoutResponse, IClientRequest, IEventResponse, IFetchTicketsResponse, IMyOrderDetailsResponse, IMyOrdersResponse, IOrderReviewResponse, IRegisterNewUserResponse } from './types';
4
+ import { IAuthorizeResponse, ICartResponse, ICheckoutResponse, IClientRequest, IEventResponse, IFetchTicketsResponse, IFreeRegistrationResponse, IMyOrderDetailsResponse, IMyOrdersResponse, IOrderReviewResponse, IRegisterNewUserResponse } 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>;
@@ -19,7 +19,7 @@ export declare const addToWaitingList: (id: number, values: IWaitingListFields)
19
19
  addToWaitingListError: string;
20
20
  addToWaitingListData: any;
21
21
  }>;
22
- export declare const fetchMyOrders: () => Promise<IMyOrdersResponse>;
22
+ export declare const fetchMyOrders: (filter?: string) => Promise<IMyOrdersResponse>;
23
23
  export declare const fetchOrderDetails: (orderId: string) => Promise<{
24
24
  orderDetailsError: string;
25
25
  orderDetailsData: IMyOrderDetailsResponse | undefined;
@@ -30,6 +30,8 @@ export declare const addToCart: (id: string | number, data: any) => Promise<{
30
30
  isBillingRequired: boolean;
31
31
  isNameRequired: any;
32
32
  isAgeRequired: any;
33
+ isPhoneRequired: any;
34
+ minimumAge: any;
33
35
  } | undefined;
34
36
  error: undefined;
35
37
  }>;
@@ -43,8 +45,8 @@ export declare const fetchStates: (countryId: string) => Promise<{
43
45
  data: any;
44
46
  }>;
45
47
  export declare const fetchCart: () => Promise<{
46
- error: string;
47
- data: any;
48
+ cartError: string;
49
+ cartData: ICartResponse;
48
50
  }>;
49
51
  export declare const checkoutOrder: (data: any, accessToken: string) => Promise<ICheckoutResponse>;
50
52
  export declare const fetchEventConditions: (eventId: string) => Promise<{
@@ -56,6 +58,7 @@ export declare const postOnPaymentSuccess: (orderHash: string) => Promise<{
56
58
  error: string;
57
59
  data: any;
58
60
  }>;
61
+ export declare const postOnFreeRegistration: (orderHash: string) => Promise<IFreeRegistrationResponse>;
59
62
  export declare const fetchPurchaseConfirmation: (orderHash: string) => Promise<{
60
63
  error: undefined;
61
64
  data: void | AxiosResponse<any, any>;