ordering-ui-react-native 0.14.34 → 0.14.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.14.34",
3
+ "version": "0.14.37",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -46,7 +46,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
46
46
  const [menu, setMenu] = useState({})
47
47
  const [timeList, setTimeList] = useState<any>([])
48
48
  const [selectDate, setSelectedDate] = useState<any>(null)
49
- const [datesWhitelist, setDateWhitelist] = useState<any>([{start: null, end: null}])
49
+ const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
50
50
 
51
51
  const styles = StyleSheet.create({
52
52
  container: {
@@ -54,19 +54,19 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
54
54
  paddingVertical: 30,
55
55
  paddingHorizontal: 40
56
56
  },
57
- businessLogo: {
58
- backgroundColor: 'white',
59
- width: 60,
60
- height: 60,
61
- borderRadius: 7.6,
62
- justifyContent: 'center',
63
- alignItems: 'center',
64
- shadowColor: '#000000',
65
- shadowOffset: { width: 0, height: 1 },
66
- shadowOpacity: 0.1,
67
- shadowRadius: 1,
68
- elevation: 2
69
- },
57
+ businessLogo: {
58
+ backgroundColor: 'white',
59
+ width: 60,
60
+ height: 60,
61
+ borderRadius: 7.6,
62
+ justifyContent: 'center',
63
+ alignItems: 'center',
64
+ shadowColor: '#000000',
65
+ shadowOffset: { width: 0, height: 1 },
66
+ shadowOpacity: 0.1,
67
+ shadowRadius: 1,
68
+ elevation: 2
69
+ },
70
70
  selectOption: {
71
71
  backgroundColor: theme.colors.backgroundGray100,
72
72
  borderRadius: 7.6,
@@ -82,7 +82,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
82
82
  paddingBottom: 15,
83
83
  borderBottomWidth: 1,
84
84
  borderColor: theme.colors.backgroundGray200,
85
- height: 100
85
+ height: 100,
86
86
  },
87
87
  calendarHeaderContainer: {
88
88
  flex: 1,
@@ -101,35 +101,36 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
101
101
  dateNumber: {
102
102
  color: '#B1BCCC',
103
103
  fontSize: 16,
104
- fontWeight: '500'
104
+ fontWeight: '500',
105
105
  },
106
106
  dateName: {
107
107
  color: '#B1BCCC',
108
108
  fontSize: 12,
109
- textTransform: 'capitalize'
109
+ textTransform: 'capitalize',
110
110
  },
111
111
  highlightDateName: {
112
112
  color: '#344050',
113
113
  fontSize: 12,
114
- textTransform: 'capitalize'
114
+ textTransform: 'capitalize',
115
115
  },
116
116
  highlightDateNumber: {
117
117
  color: '#344050',
118
118
  fontSize: 16,
119
- textTransform: 'capitalize'
119
+ textTransform: 'capitalize',
120
120
  },
121
121
  disabledDateName: {
122
122
  color: '#B1BCCC',
123
123
  fontSize: 10,
124
124
  textTransform: 'capitalize',
125
- opacity: 1
125
+ opacity: 1,
126
126
  },
127
127
  disabledDateNumber: {
128
128
  color: '#B1BCCC',
129
129
  fontSize: 14,
130
- fontWeight: '500'
130
+ fontWeight: '500',
131
+
131
132
  }
132
- })
133
+ })
133
134
 
134
135
  const preorderTypeList = [
135
136
  { key: 'business_hours', name: t('BUSINESS_HOURS', 'Business hours') },
@@ -191,7 +192,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
191
192
 
192
193
  const LeftSelector = () => {
193
194
  return (
194
- <View style={{height: '100%', justifyContent: 'flex-end'}}>
195
+ <View style={{ height: '100%', justifyContent: 'flex-end' }}>
195
196
  <IconAntDesign
196
197
  name='caretleft'
197
198
  color={theme.colors.textNormal}
@@ -203,7 +204,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
203
204
 
204
205
  const RightSelector = () => {
205
206
  return (
206
- <View style={{height: '100%', justifyContent: 'flex-end'}}>
207
+ <View style={{ height: '100%', justifyContent: 'flex-end' }}>
207
208
  <IconAntDesign
208
209
  name='caretright'
209
210
  color={theme.colors.textNormal}
@@ -280,7 +281,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
280
281
  name='close'
281
282
  color={theme.colors.textThird}
282
283
  size={24}
283
- style={{ marginLeft: -4}}
284
+ style={{ marginLeft: -4 }}
284
285
  />
285
286
  </TouchableOpacity>
286
287
  <BusinessInfoWrapper>
@@ -294,8 +295,8 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
294
295
  <FastImage
295
296
  style={{ width: 59, height: 59 }}
296
297
  source={{
297
- uri: optimizeImage(business?.logo, 'h_60,c_limit'),
298
- priority: FastImage.priority.normal,
298
+ uri: optimizeImage(business?.logo, 'h_60,c_limit'),
299
+ priority: FastImage.priority.normal,
299
300
  }}
300
301
  resizeMode={FastImage.resizeMode.cover}
301
302
  />
@@ -372,7 +373,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
372
373
  setMenu={setMenu}
373
374
  menu={menu}
374
375
  />
375
- </MenuWrapper>
376
+ </MenuWrapper>
376
377
  )}
377
378
  <OrderTimeWrapper>
378
379
  <OText
@@ -393,14 +394,15 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
393
394
  calendarHeaderStyle={styles.calendarHeader}
394
395
  dateNumberStyle={styles.dateNumber}
395
396
  dateNameStyle={styles.dateName}
396
- iconContainer={{flex: 0.1}}
397
+ iconContainer={{ flex: 0.1 }}
397
398
  highlightDateNameStyle={styles.highlightDateName}
398
399
  highlightDateNumberStyle={styles.highlightDateNumber}
400
+ dayContainerStyle={{ height: '100%' }}
401
+ highlightDateContainerStyle={{ height: '100%' }}
399
402
  calendarHeaderFormat='MMMM, YYYY'
400
- iconStyle={{borderWidth: 1}}
403
+ iconStyle={{ borderWidth: 1 }}
401
404
  selectedDate={selectDate}
402
405
  datesWhitelist={datesWhitelist}
403
- dayContainerStyle={{height: 40}}
404
406
  disabledDateNameStyle={styles.disabledDateName}
405
407
  disabledDateNumberStyle={styles.disabledDateNumber}
406
408
  disabledDateOpacity={0.6}
@@ -417,7 +419,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
417
419
  <TimeItem active={timeSelected === time.value}>
418
420
  <OText
419
421
  size={14}
420
- color={timeSelected === time.value ? theme.colors.primary: theme.colors.textNormal}
422
+ color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
421
423
  style={{
422
424
  lineHeight: 24
423
425
  }}
@@ -426,15 +428,15 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
426
428
  </TouchableOpacity>
427
429
  ))}
428
430
  {timeList.length % 3 === 2 && (
429
- <TimeItem style={{backgroundColor: 'transparent'}}/>
431
+ <TimeItem style={{ backgroundColor: 'transparent' }} />
430
432
  )}
431
433
  </TimeContentWrapper>
432
434
  </TimeListWrapper>
433
435
  </OrderTimeWrapper>
434
436
  <OButton
435
437
  text={t('GO_TO_MENU', 'Go to menu')}
436
- textStyle={{color: 'white'}}
437
- style={{borderRadius: 7.6, marginBottom: 20, marginTop: 30}}
438
+ textStyle={{ color: 'white' }}
439
+ style={{ borderRadius: 7.6, marginBottom: 20, marginTop: 30 }}
438
440
  onClick={() => handleClickBusiness()}
439
441
  />
440
442
  </PreOrderContainer>
@@ -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
@@ -611,7 +611,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
611
611
  <OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
612
612
  {t('DELIVERY_PREFERENCE', 'Delivery Preference')}
613
613
  </OText>
614
- <OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>{order?.delivery_option?.name ?? t('EITHER_WAY', 'Either way')}</OText>
614
+ <OText size={12} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
615
+ {order?.delivery_option?.name ? t(order?.delivery_option?.name.toUpperCase().replace(/\s/g, '_')) : t('EITHER_WAY', 'Either way')}
616
+ </OText>
615
617
  </View>
616
618
  )}
617
619
  {order?.comment && (