ordering-ui-react-native 0.14.23 → 0.14.25-release

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 (29) hide show
  1. package/package.json +2 -2
  2. package/src/components/Messages/index.tsx +6 -1
  3. package/src/components/ProductForm/index.tsx +40 -34
  4. package/src/components/VerifyPhone/styles.tsx +1 -2
  5. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  6. package/themes/doordash/src/components/ProductForm/index.tsx +14 -16
  7. package/themes/instacart/src/components/ProductForm/index.tsx +13 -15
  8. package/themes/kiosk/src/components/ProductForm/index.tsx +13 -15
  9. package/themes/original/index.tsx +0 -4
  10. package/themes/original/src/components/BusinessesListing/index.tsx +19 -25
  11. package/themes/original/src/components/Checkout/index.tsx +4 -15
  12. package/themes/original/src/components/Checkout/styles.tsx +1 -5
  13. package/themes/original/src/components/FacebookLogin/index.tsx +20 -5
  14. package/themes/original/src/components/Help/index.tsx +2 -2
  15. package/themes/original/src/components/Messages/index.tsx +39 -59
  16. package/themes/original/src/components/OrderDetails/index.tsx +2 -54
  17. package/themes/original/src/components/OrderProgress/index.tsx +2 -2
  18. package/themes/original/src/components/OrderSummary/index.tsx +2 -58
  19. package/themes/original/src/components/ProductForm/index.tsx +43 -28
  20. package/themes/original/src/components/UserProfile/index.tsx +0 -5
  21. package/themes/original/src/types/index.tsx +2 -4
  22. package/themes/single-business/src/components/ProductForm/index.tsx +28 -29
  23. package/themes/uber-eats/src/components/ProductForm/index.tsx +13 -15
  24. package/themes/original/src/components/PaymentOptionWallet/index.tsx +0 -163
  25. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +0 -38
  26. package/themes/original/src/components/WalletTransactionItem/index.tsx +0 -68
  27. package/themes/original/src/components/WalletTransactionItem/styles.tsx +0 -37
  28. package/themes/original/src/components/Wallets/index.tsx +0 -204
  29. package/themes/original/src/components/Wallets/styles.tsx +0 -43
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.14.23",
3
+ "version": "0.14.25-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -55,7 +55,7 @@
55
55
  "@types/styled-components": "^5.1.3",
56
56
  "axios": "^0.21.0",
57
57
  "moment": "^2.29.1",
58
- "ordering-components": "github:Ordering-Inc/ordering-components#development",
58
+ "ordering-components": "github:Ordering-Inc/ordering-components#release",
59
59
  "patch-package": "^6.4.7",
60
60
  "postinstall-postinstall": "^2.1.0",
61
61
  "prop-types": "^15.7.2",
@@ -45,6 +45,7 @@ const imgOptions = {
45
45
  includeBase64: true,
46
46
  selectionLimit: 0
47
47
  }
48
+ const filterSpecialStatus = ['prepared_in', 'delivered_in']
48
49
 
49
50
  const MessagesUI = (props: MessagesParams) => {
50
51
  const {
@@ -118,7 +119,11 @@ const MessagesUI = (props: MessagesParams) => {
118
119
  const messageConsole = (message: any) => {
119
120
  return message.change?.attribute !== 'driver_id'
120
121
  ?
121
- `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
122
+ `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${
123
+ filterSpecialStatus.includes(message.change.attribute) ?
124
+ `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}` :
125
+ `${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
126
+ }`
122
127
  : message.change.new
123
128
  ?
124
129
  `${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
@@ -132,7 +132,18 @@ export const ProductOptionsUI = (props: any) => {
132
132
  ) : (
133
133
  <>
134
134
  <View style={{ flexDirection: 'column', width: '100%' }}>
135
- <OText size={20} style={{ flex: I18nManager.isRTL ? 0 : 1, marginBottom: 10 }}>{product?.name || productCart.name}</OText>
135
+ <View style={{ flexDirection: 'row', marginTop: 15 }}>
136
+ <OText size={20} style={{ flex: I18nManager.isRTL ? 0 : 1, marginBottom: 10 }}>{product?.name || productCart.name}{' '}</OText>
137
+ {product?.calories && (
138
+ <OText size={16} style={styles.caloriesStyle}>{product?.calories} cal</OText>
139
+ )}
140
+ </View>
141
+ <View style={{ flexDirection: 'row', marginBottom: 10 }}>
142
+ <OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
143
+ {product?.offer_price && (
144
+ <OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
145
+ )}
146
+ </View>
136
147
  {(product?.estimated_person || (product?.sku && product?.sku !== '-1' && product?.sku !== '1')) && (
137
148
  <OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0, marginBottom: 10 }} color={'#909BA9'}>
138
149
  {
@@ -147,12 +158,6 @@ export const ProductOptionsUI = (props: any) => {
147
158
  }
148
159
  </OText>
149
160
  )}
150
- <View style={{ flexDirection: 'row', marginBottom: 10}}>
151
- <OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
152
- {product?.offer_price && (
153
- <OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
154
- )}
155
- </View>
156
161
  </View>
157
162
  </>
158
163
  )}
@@ -162,17 +167,17 @@ export const ProductOptionsUI = (props: any) => {
162
167
  </ProductDescription>
163
168
  {loading && !product ? (
164
169
  <>
165
- {[...Array(2)].map((item,i) => (
166
- <Placeholder key={i} style={{marginBottom: 20}} Animation={Fade}>
167
- <PlaceholderLine height={40} style={{ flex: 1, marginTop: 10 }} />
168
- {[...Array(3)].map((item,i) => (
169
- <View key={i} style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
170
- <PlaceholderLine height={30} width={10} style={{marginBottom: 20}} />
171
- <PlaceholderLine height={30} width={50} style={{marginBottom: 20}} />
172
- <PlaceholderLine height={30} width={30} style={{marginBottom: 20}} />
173
- </View>
174
- ))}
175
- </Placeholder>
170
+ {[...Array(2)].map((item, i) => (
171
+ <Placeholder key={i} style={{ marginBottom: 20 }} Animation={Fade}>
172
+ <PlaceholderLine height={40} style={{ flex: 1, marginTop: 10 }} />
173
+ {[...Array(3)].map((item, i) => (
174
+ <View key={i} style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
175
+ <PlaceholderLine height={30} width={10} style={{ marginBottom: 20 }} />
176
+ <PlaceholderLine height={30} width={50} style={{ marginBottom: 20 }} />
177
+ <PlaceholderLine height={30} width={30} style={{ marginBottom: 20 }} />
178
+ </View>
179
+ ))}
180
+ </Placeholder>
176
181
  ))}
177
182
  </>
178
183
  ) : (
@@ -221,7 +226,7 @@ export const ProductOptionsUI = (props: any) => {
221
226
  state={currentState}
222
227
  disabled={isSoldOut || maxProductQuantity <= 0}
223
228
  />
224
- ): null
229
+ ) : null
225
230
  })
226
231
  }
227
232
  </WrapperSubOption>
@@ -232,21 +237,19 @@ export const ProductOptionsUI = (props: any) => {
232
237
  </React.Fragment>
233
238
  )
234
239
  }))}
235
- {!product?.hide_special_instructions && (
236
- <ProductComment>
237
- <SectionTitle>
238
- <OText size={16}>{t('SPECIAL_COMMENT', 'Special comment')}</OText>
239
- </SectionTitle>
240
- <OInput
241
- multiline
242
- placeholder={t('SPECIAL_COMMENT', 'Special comment')}
243
- value={productCart.comment}
244
- onChange={(val: string) => handleChangeCommentState({ target: { value: val } })}
245
- isDisabled={!(productCart && !isSoldOut && maxProductQuantity)}
246
- style={styles.comment}
247
- />
248
- </ProductComment>
249
- )}
240
+ <ProductComment>
241
+ <SectionTitle>
242
+ <OText size={16}>{t('SPECIAL_COMMENT', 'Special comment')}</OText>
243
+ </SectionTitle>
244
+ <OInput
245
+ multiline
246
+ placeholder={t('SPECIAL_COMMENT', 'Special comment')}
247
+ value={productCart.comment}
248
+ onChange={(val: string) => handleChangeCommentState({ target: { value: val } })}
249
+ isDisabled={!(productCart && !isSoldOut && maxProductQuantity)}
250
+ style={styles.comment}
251
+ />
252
+ </ProductComment>
250
253
  </ProductEditions>
251
254
  )}
252
255
  </WrapContent>
@@ -383,6 +386,9 @@ const styles = StyleSheet.create({
383
386
  textDecorationLine: 'line-through',
384
387
  marginLeft: 7,
385
388
  marginRight: 7
389
+ },
390
+ caloriesStyle: {
391
+ color: '#808080'
386
392
  }
387
393
  })
388
394
 
@@ -2,7 +2,7 @@ import styled from 'styled-components/native';
2
2
 
3
3
  export const Container = styled.View`
4
4
  width: 100%;
5
- padding: 0 43px;
5
+ padding: 0 30px;
6
6
  `
7
7
 
8
8
  export const CountDownContainer = styled.View`
@@ -20,7 +20,6 @@ export const ResendSection = styled.View`
20
20
  display: flex;
21
21
  flex-direction: row;
22
22
  justify-content: center;
23
- flex-wrap: wrap;
24
23
  `
25
24
 
26
25
  export const WrappCountdown = styled.View`
@@ -410,8 +410,7 @@ const LoginFormUI = (props: LoginParams) => {
410
410
  textInputProps={{
411
411
  returnKeyType: 'next',
412
412
  onSubmitEditing: () => inputRef?.current?.focus?.(),
413
- style: { borderWidth: 0, fontSize: 12 },
414
- maxLength: 10
413
+ style: { borderWidth: 0, fontSize: 12 }
415
414
  }}
416
415
  textWrapStyle={{ borderColor: theme.colors.clear, borderWidth: 0, height: 40, paddingStart: 0 }}
417
416
  />
@@ -287,22 +287,20 @@ export const ProductOptionsUI = (props: any) => {
287
287
  </React.Fragment>
288
288
  )
289
289
  }))}
290
- {!product?.hide_special_instructions && (
291
- <ProductComment onLayout={(e: any) => setCommentY(e.nativeEvent.layout.y + e.nativeEvent.layout.height)}>
292
- <SectionTitle>
293
- <OText style={theme.labels.middle as TextStyle}>{t('SPECIAL_COMMENT', 'Special comment')}</OText>
294
- </SectionTitle>
295
- <OInput
296
- multiline
297
- placeholder={t('SPECIAL_COMMENT', 'Special comment')}
298
- value={productCart.comment}
299
- onChange={(val: string) => handleChangeCommentState({ target: { value: val } })}
300
- isDisabled={!(productCart && !isSoldOut && maxProductQuantity)}
301
- style={styles.comment}
302
- inputStyle={{ fontSize: 12, paddingBottom: 7, paddingTop: 17 }}
303
- />
304
- </ProductComment>
305
- )}
290
+ <ProductComment onLayout={(e: any) => setCommentY(e.nativeEvent.layout.y + e.nativeEvent.layout.height)}>
291
+ <SectionTitle>
292
+ <OText style={theme.labels.middle as TextStyle}>{t('SPECIAL_COMMENT', 'Special comment')}</OText>
293
+ </SectionTitle>
294
+ <OInput
295
+ multiline
296
+ placeholder={t('SPECIAL_COMMENT', 'Special comment')}
297
+ value={productCart.comment}
298
+ onChange={(val: string) => handleChangeCommentState({ target: { value: val } })}
299
+ isDisabled={!(productCart && !isSoldOut && maxProductQuantity)}
300
+ style={styles.comment}
301
+ inputStyle={{ fontSize: 12, paddingBottom: 7, paddingTop: 17 }}
302
+ />
303
+ </ProductComment>
306
304
  {productCart && !isSoldOut && maxProductQuantity > 0 && (
307
305
  <View style={{ paddingVertical: 4, marginBottom: 10 }}>
308
306
  <SectionTitle>
@@ -235,21 +235,19 @@ export const ProductOptionsUI = (props: any) => {
235
235
  </React.Fragment>
236
236
  )
237
237
  }))}
238
- {!product?.hide_special_instructions && (
239
- <ProductComment>
240
- <SectionTitle>
241
- <OText style={theme.labels.middle}>{t('SPECIAL_COMMENT', 'Special comment')}</OText>
242
- </SectionTitle>
243
- <OInput
244
- multiline
245
- placeholder={t('SPECIAL_COMMENT', 'Special comment')}
246
- value={productCart.comment}
247
- onChange={(val: string) => handleChangeCommentState({ target: { value: val } })}
248
- isDisabled={!(productCart && !isSoldOut && maxProductQuantity)}
249
- style={{ ...styles.comment, borderColor: theme.colors.border }}
250
- />
251
- </ProductComment>
252
- )}
238
+ <ProductComment>
239
+ <SectionTitle>
240
+ <OText style={theme.labels.middle}>{t('SPECIAL_COMMENT', 'Special comment')}</OText>
241
+ </SectionTitle>
242
+ <OInput
243
+ multiline
244
+ placeholder={t('SPECIAL_COMMENT', 'Special comment')}
245
+ value={productCart.comment}
246
+ onChange={(val: string) => handleChangeCommentState({ target: { value: val } })}
247
+ isDisabled={!(productCart && !isSoldOut && maxProductQuantity)}
248
+ style={{ ...styles.comment, borderColor: theme.colors.border }}
249
+ />
250
+ </ProductComment>
253
251
  </ProductEditions>
254
252
  )}
255
253
  </WrapContent>
@@ -438,21 +438,19 @@ export const ProductOptionsUI = (props: any) => {
438
438
  </React.Fragment>
439
439
  )
440
440
  }))}
441
- {!product?.hide_special_instructions && (
442
- <ProductComment>
443
- <SectionTitle>
444
- <OText size={28} weight="bold">{t('SPECIAL_COMMENT', 'Special comment')}</OText>
445
- </SectionTitle>
446
- <OInput
447
- multiline
448
- placeholder={t('SPECIAL_COMMENT', 'Special comment')}
449
- value={productCart.comment}
450
- onChange={(val: string) => handleChangeCommentState({ target: { value: val } })}
451
- isDisabled={!(productCart && !isSoldOut && maxProductQuantity)}
452
- style={styles.comment}
453
- />
454
- </ProductComment>
455
- )}
441
+ <ProductComment>
442
+ <SectionTitle>
443
+ <OText size={28} weight="bold">{t('SPECIAL_COMMENT', 'Special comment')}</OText>
444
+ </SectionTitle>
445
+ <OInput
446
+ multiline
447
+ placeholder={t('SPECIAL_COMMENT', 'Special comment')}
448
+ value={productCart.comment}
449
+ onChange={(val: string) => handleChangeCommentState({ target: { value: val } })}
450
+ isDisabled={!(productCart && !isSoldOut && maxProductQuantity)}
451
+ style={styles.comment}
452
+ />
453
+ </ProductComment>
456
454
  </ProductEditions>
457
455
  </WrapContent>
458
456
  </View>
@@ -28,8 +28,6 @@ import { HelpGuide } from './src/components/HelpGuide';
28
28
  import { HelpOrder } from './src/components/HelpOrder';
29
29
  import { NotFoundSource } from './src/components/NotFoundSource';
30
30
  import { OrderTypeSelector } from './src/components/OrderTypeSelector';
31
- import { Wallets } from './src/components/Wallets';
32
- import { PaymentOptionWallet } from './src/components/PaymentOptionWallet';
33
31
 
34
32
  import { Toast } from './src/components/shared/OToast';
35
33
  import {
@@ -88,8 +86,6 @@ export {
88
86
  HelpOrder,
89
87
  NotFoundSource,
90
88
  OrderTypeSelector,
91
- Wallets,
92
- PaymentOptionWallet,
93
89
 
94
90
  // OComponents
95
91
  Toast,
@@ -57,7 +57,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
57
57
  handleBusinessClick,
58
58
  paginationProps,
59
59
  handleChangeSearch,
60
- businessId
61
60
  } = props;
62
61
 
63
62
  const theme = useTheme();
@@ -257,20 +256,17 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
257
256
  />
258
257
  </WrapMomentOption>
259
258
 
260
- {!businessId && (
261
- <SearchBar
262
- onSearch={handleChangeSearch}
263
- searchValue={searchValue}
264
- lazyLoad
265
- isCancelXButtonShow={!!searchValue}
266
- borderStyle={styles.borderStyle}
267
- onCancel={() => handleChangeSearch('')}
268
- placeholder={t('SEARCH', 'Search')}
269
- height={26}
270
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
271
- />
272
- )}
273
-
259
+ <SearchBar
260
+ onSearch={handleChangeSearch}
261
+ searchValue={searchValue}
262
+ lazyLoad
263
+ isCancelXButtonShow={!!searchValue}
264
+ borderStyle={styles.borderStyle}
265
+ onCancel={() => handleChangeSearch('')}
266
+ placeholder={t('SEARCH', 'Search')}
267
+ height={26}
268
+ inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
269
+ />
274
270
  </View>
275
271
  </OrderControlContainer>
276
272
  </HeaderWrapper>
@@ -281,7 +277,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
281
277
  />
282
278
  </OrderProgressWrapper>
283
279
  )}
284
- {!businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
280
+ {!props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
285
281
  <FeaturedWrapper>
286
282
  <OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('FEATURED_BUSINESS', 'Featured business')}</OText>
287
283
  <ScrollView
@@ -310,19 +306,17 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
310
306
  </FeaturedWrapper>
311
307
  )}
312
308
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
313
- {!businessId && !props.franchiseId && (
309
+ {!props.franchiseId && (
314
310
  <HighestRatedBusinesses onBusinessClick={handleBusinessClick} navigation={navigation} />
315
311
  )}
316
312
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
317
313
  <ListWrapper>
318
- {!businessId && (
319
- <BusinessTypeFilter
320
- images={props.images}
321
- businessTypes={props.businessTypes}
322
- defaultBusinessType={props.defaultBusinessType}
323
- handleChangeBusinessType={handleChangeBusinessType}
324
- />
325
- )}
314
+ <BusinessTypeFilter
315
+ images={props.images}
316
+ businessTypes={props.businessTypes}
317
+ defaultBusinessType={props.defaultBusinessType}
318
+ handleChangeBusinessType={handleChangeBusinessType}
319
+ />
326
320
  {!businessesList.loading && businessesList.businesses.length === 0 && (
327
321
  <NotFoundSource
328
322
  content={t(
@@ -23,7 +23,6 @@ import { PaymentOptions } from '../PaymentOptions';
23
23
  import { DriverTips } from '../DriverTips';
24
24
  import { NotFoundSource } from '../NotFoundSource';
25
25
  import { UserDetails } from '../UserDetails';
26
- import { PaymentOptionWallet } from '../PaymentOptionWallet';
27
26
 
28
27
  import {
29
28
  ChContainer,
@@ -38,8 +37,7 @@ import {
38
37
  ChUserDetails,
39
38
  ChCart,
40
39
  DeliveryOptionsContainer,
41
- DeliveryOptionItem,
42
- WalletPaymentOptionContainer
40
+ DeliveryOptionItem
43
41
  } from './styles';
44
42
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
45
43
 
@@ -506,15 +504,6 @@ const CheckoutUI = (props: any) => {
506
504
  </ChSection>
507
505
  )}
508
506
 
509
- {!cartState.loading && cart && (
510
- <WalletPaymentOptionContainer>
511
- <PaymentOptionWallet
512
- cart={cart}
513
- />
514
- </WalletPaymentOptionContainer>
515
- )}
516
-
517
-
518
507
  {!cartState.loading && cart && (
519
508
  <ChSection>
520
509
  <ChCart>
@@ -554,8 +543,8 @@ const CheckoutUI = (props: any) => {
554
543
  )}
555
544
 
556
545
  {!cartState.loading && cart && (
557
- <View>
558
- <ChErrors style={{ marginBottom: 0 }}>
546
+ <ChSection style={{ paddingTop: 0, paddingBottom: 20, paddingHorizontal: 20 }}>
547
+ <ChErrors>
559
548
  {!cart?.valid_address && cart?.status !== 2 && (
560
549
  <OText
561
550
  color={theme.colors.error}
@@ -583,7 +572,7 @@ const CheckoutUI = (props: any) => {
583
572
  </OText>
584
573
  )}
585
574
  </ChErrors>
586
- </View>
575
+ </ChSection>
587
576
  )}
588
577
  <OModal
589
578
  open={openChangeStore && props.isFranchiseApp}
@@ -74,10 +74,6 @@ export const ChDriverTips = styled(ChPaymethods)``
74
74
 
75
75
  export const ChCart = styled(ChPaymethods)``
76
76
 
77
- export const WalletPaymentOptionContainer = styled(ChPaymethods)`
78
- padding-bottom: 0;
79
- `
80
-
81
77
  export const ChPlaceOrderBtn = styled.View`
82
78
  width: 100%;
83
79
  display: flex;
@@ -103,4 +99,4 @@ export const DeliveryOptionItem = styled.View`
103
99
  align-items: center;
104
100
  flex-direction: row;
105
101
  background-color: ${(props : any) => props?.backgroundColor ?? '#fff'};
106
- `;
102
+ `;
@@ -11,7 +11,8 @@ export const FacebookLogin = (props: any) => {
11
11
  const {
12
12
  handleErrors,
13
13
  handleLoading,
14
- handleSuccessFacebookLogin
14
+ handleSuccessFacebookLogin,
15
+ notificationState
15
16
  } = props
16
17
 
17
18
  const [, t] = useLanguage()
@@ -30,7 +31,14 @@ export const FacebookLogin = (props: any) => {
30
31
 
31
32
  const handleLoginClick = async (accessToken: string) => {
32
33
  try {
33
- const response = await ordering.users().authFacebook({ access_token: accessToken })
34
+ const body: any = {
35
+ access_token: accessToken
36
+ }
37
+ if (notificationState?.notification_token) {
38
+ body.notification_token = notificationState.notification_token
39
+ body.notification_app = notificationState.notification_app
40
+ }
41
+ const response = await ordering.users().authFacebook(body)
34
42
  if (!response.content.error) {
35
43
  if (handleSuccessFacebookLogin) {
36
44
  handleSuccessFacebookLogin(response.content.result)
@@ -38,9 +46,10 @@ export const FacebookLogin = (props: any) => {
38
46
  }
39
47
  } else {
40
48
  handleLoading && handleLoading(false)
49
+ handleErrors && handleErrors(response.content.result)
41
50
  logoutWithFacebook()
42
51
  }
43
- } catch (err) {
52
+ } catch (err: any) {
44
53
  handleLoading && handleLoading(false)
45
54
  handleErrors && handleErrors(err.message)
46
55
  }
@@ -48,7 +57,7 @@ export const FacebookLogin = (props: any) => {
48
57
 
49
58
  const loginWithFacebook = () => {
50
59
  handleLoading && handleLoading(true)
51
- LoginManager && LoginManager.logInWithPermissions(['public_profile']).then(
60
+ LoginManager && LoginManager.logInWithPermissions(['public_profile', 'email']).then(
52
61
  (login: any) => {
53
62
  if (login.isCancelled) {
54
63
  const err = t('LOGIN_WITH_FACEBOOK_CANCELLED', 'Login cancelled')
@@ -58,6 +67,9 @@ export const FacebookLogin = (props: any) => {
58
67
  AccessToken.getCurrentAccessToken().then((data: any) => {
59
68
  const accessToken = data.accessToken.toString();
60
69
  handleLoginClick(accessToken)
70
+ }).catch((err : any) => {
71
+ handleErrors && handleErrors(err.message)
72
+ handleLoading && handleLoading(false)
61
73
  });
62
74
  }
63
75
  },
@@ -68,7 +80,10 @@ export const FacebookLogin = (props: any) => {
68
80
  handleLoading && handleLoading(false)
69
81
  handleErrors && handleErrors(err)
70
82
  },
71
- );
83
+ ).catch((err : any) => {
84
+ handleErrors && handleErrors(err.message)
85
+ handleLoading && handleLoading(false)
86
+ });
72
87
  };
73
88
 
74
89
  const onPressButton = auth
@@ -48,8 +48,8 @@ export const Help = (props: HelpParams) => {
48
48
 
49
49
  <LastOrdersContainer>
50
50
  <OText size={18} weight={600}>{t('LAST_ORDERS', 'Last Orders')}</OText>
51
- <LastOrders businessId={props.businessId} onRedirect={onRedirect} />
51
+ <LastOrders onRedirect={onRedirect} />
52
52
  </LastOrdersContainer>
53
53
  </>
54
54
  )
55
- }
55
+ }