ordering-ui-react-native 0.17.17 → 0.17.19

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.17.17",
3
+ "version": "0.17.19",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -51,6 +51,7 @@ import { LastOrders } from './src/components/LastOrders';
51
51
  import { MultiCheckout } from './src/components/MultiCheckout'
52
52
  import { MultiOrdersDetails } from './src/components/MultiOrdersDetails'
53
53
  import NavBar from './src/components/NavBar';
54
+ import { NotificationsList } from './src/components/Notifications'
54
55
  import { BusinessTypeFilter } from './src/components/BusinessTypeFilter';
55
56
  import { BusinessController } from './src/components/BusinessController';
56
57
  import { BusinessFeaturedController } from './src/components/BusinessFeaturedController';
@@ -183,6 +184,7 @@ export {
183
184
  OrderDetails,
184
185
  OrderProgress,
185
186
  BusinessPreorder,
187
+ NotificationsList,
186
188
  UserProfileForm,
187
189
  ReviewOrder,
188
190
  ReviewProducts,
@@ -140,7 +140,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
140
140
  }
141
141
 
142
142
  const onProductClick = (product: any) => {
143
- const productAddedToCartLength = currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)
143
+ const productAddedToCartLength = currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0) || 0
144
144
  if (product?.type === 'service' && business?.professionals?.length > 0) {
145
145
  setCurrentProduct(product)
146
146
  setOpenService(true)
@@ -251,7 +251,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
251
251
  <Animated.View style={{ position: 'relative' }}>
252
252
  <TopHeader
253
253
  style={{
254
- marginTop: Platform.OS === 'ios' ? insets.top : '40px'
254
+ marginTop: Platform.OS === 'ios' ? insets.top : 40
255
255
  }}
256
256
  >
257
257
  {!isOpenSearchBar && (
@@ -0,0 +1,148 @@
1
+ import React, { useEffect } from 'react'
2
+ import {
3
+ UserFormDetails as NotificationsController,
4
+ useLanguage,
5
+ useSession,
6
+ useOrderingTheme,
7
+ useToast,
8
+ ToastType,
9
+ } from 'ordering-components/native'
10
+ import { NotificationsGroupSwitchWrapper, SwitchWrapper } from './styles'
11
+ import { Platform, StyleSheet, View } from 'react-native'
12
+ import { useState } from 'react'
13
+ import { useTheme } from 'styled-components/native';
14
+ import Spinner from 'react-native-loading-spinner-overlay';
15
+ import ToggleSwitch from 'toggle-switch-react-native'
16
+ import { Container } from '../../layouts/Container'
17
+ import NavBar from '../NavBar'
18
+ import { OText } from '../shared'
19
+
20
+ const NotificationsUI = (props: any) => {
21
+ const {
22
+ navigation,
23
+ singleNotifications,
24
+ handleChangePromotions,
25
+ userData
26
+ } = props
27
+
28
+ const theme = useTheme();
29
+ const [{ user: userSession }] = useSession()
30
+ const [, t] = useLanguage();
31
+ const [, { showToast }] = useToast();
32
+ const [orderingTheme] = useOrderingTheme()
33
+
34
+ const user = userData || userSession
35
+
36
+ const [notificationsList, setNotificationsList] = useState({
37
+ email: singleNotifications?.result?.result
38
+ ? !!singleNotifications?.result?.result?.settings?.email?.newsletter
39
+ : !!(singleNotifications?.changes?.settings?.email?.newsletter ?? (user && user?.settings?.email?.newsletter)),
40
+ sms: singleNotifications?.result?.result
41
+ ? !!singleNotifications?.result?.result?.settings?.sms?.newsletter
42
+ : !!(singleNotifications?.changes?.settings?.sms?.newsletter ?? (user && user?.settings?.sms?.newsletter)),
43
+ notification: singleNotifications?.result?.result
44
+ ? !!singleNotifications?.result?.result?.settings?.notification?.newsletter
45
+ : !!(singleNotifications?.changes?.settings?.notification?.newsletter ?? (user && user?.settings?.notification?.newsletter))
46
+ })
47
+
48
+ const goToBack = () => navigation?.canGoBack() && navigation.goBack()
49
+ const showCustomerPromotions = !orderingTheme?.theme?.profile?.components?.promotions?.hidden
50
+ const showNotifications = !orderingTheme?.theme?.profile?.components?.notification_settings?.hidden
51
+
52
+ const handleEditNotifications = (key: any, value: any) => {
53
+ setNotificationsList({
54
+ ...notificationsList,
55
+ [key]: value
56
+ })
57
+ }
58
+
59
+ useEffect(() => {
60
+ if (singleNotifications.result.result && !singleNotifications.loading) {
61
+ if (!singleNotifications.result?.error) {
62
+ showToast(ToastType.Success, t('UPDATE_SUCCESSFULLY', 'Update successfully'));
63
+ }
64
+ }
65
+ }, [singleNotifications.result])
66
+
67
+ useEffect(() => {
68
+ const isSingle = true
69
+ handleChangePromotions(notificationsList, isSingle)
70
+ }, [notificationsList])
71
+
72
+ return (
73
+ <Container noPadding>
74
+ <NavBar
75
+ title={t('NOTIFICATIONS', 'Notifications')}
76
+ titleAlign={'center'}
77
+ onActionLeft={goToBack}
78
+ showCall={false}
79
+ style={{ paddingHorizontal: 40, paddingVertical: Platform.OS === 'ios' ? 0 : 20, marginTop: Platform.OS === 'ios' ? 0 : 30 }}
80
+ />
81
+ {showCustomerPromotions && showNotifications && (
82
+ <>
83
+ <Spinner visible={singleNotifications?.loading} />
84
+ <View style={{ ...styles.pagePadding }}>
85
+ <NotificationsGroupSwitchWrapper>
86
+ <OText style={{ ...styles.title }}>{t('MARKETING_NOTIFICATIONS', 'Marketing Notifications')}</OText>
87
+ <SwitchWrapper>
88
+ <OText>{t('EMAILS', 'Emails')}</OText>
89
+ <ToggleSwitch
90
+ isOn={notificationsList?.email}
91
+ onColor={theme.colors.primary}
92
+ size="small"
93
+ disabled={singleNotifications?.loading}
94
+ offColor={theme.colors.disabled}
95
+ animationSpeed={400}
96
+ onToggle={() => handleEditNotifications('email', !notificationsList?.email)}
97
+ />
98
+ </SwitchWrapper>
99
+ <SwitchWrapper>
100
+ <OText>{t('SMS', 'Sms')}</OText>
101
+ <ToggleSwitch
102
+ isOn={notificationsList?.sms}
103
+ onColor={theme.colors.primary}
104
+ size="small"
105
+ disabled={singleNotifications?.loading}
106
+ offColor={theme.colors.disabled}
107
+ animationSpeed={400}
108
+ onToggle={() => handleEditNotifications('sms', !notificationsList?.sms)}
109
+ />
110
+ </SwitchWrapper>
111
+ <SwitchWrapper>
112
+ <OText>{t('PUSH_NOTIFICATIONS', 'Push Notifications')}</OText>
113
+ <ToggleSwitch
114
+ isOn={notificationsList?.notification}
115
+ onColor={theme.colors.primary}
116
+ size="small"
117
+ disabled={singleNotifications?.loading}
118
+ offColor={theme.colors.disabled}
119
+ animationSpeed={400}
120
+ onToggle={() => handleEditNotifications('notification', !notificationsList?.notification)}
121
+ />
122
+ </SwitchWrapper>
123
+ </NotificationsGroupSwitchWrapper>
124
+ </View>
125
+ </>
126
+ )}
127
+ </Container>
128
+ )
129
+ }
130
+
131
+ const styles = StyleSheet.create({
132
+ title: {
133
+ marginBottom: 24,
134
+ fontWeight: 'bold',
135
+ },
136
+ pagePadding: {
137
+ paddingLeft: 40,
138
+ paddingRight: 40
139
+ }
140
+ });
141
+
142
+ export const NotificationsList = (props: any) => {
143
+ const notificationsListProps = {
144
+ ...props,
145
+ UIComponent: NotificationsUI
146
+ }
147
+ return <NotificationsController {...notificationsListProps} />
148
+ }
@@ -0,0 +1,17 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const ContainerButtons = styled.View`
4
+ margin-vertical: 50px
5
+ `
6
+
7
+ export const NotificationsGroupSwitchWrapper = styled.View`
8
+ flex-grow: 1;
9
+ justify-content: space-between;
10
+ `
11
+
12
+ export const SwitchWrapper = styled.View`
13
+ flex-direction: row;
14
+ justify-content: space-between;
15
+ align-items: center;
16
+ margin-bottom: 12px;
17
+ `
@@ -28,46 +28,48 @@ export const OrderItAgain = (props: OrderItAgainParams) => {
28
28
  const { width } = Dimensions.get('window');
29
29
  const productsFilterd = productList?.length > 0 && productList?.sort((a: any, b:any) => moment(b?.last_ordered_date).valueOf() - moment(a?.last_ordered_date).valueOf()).filter((product : any) => product?.name?.toLowerCase()?.includes(searchValue?.toLowerCase()))
30
30
  return (
31
- <Container hide={productsFilterd?.length === 0}>
32
- <OText
33
- size={16}
34
- lineHeight={24}
35
- color={theme.colors.textNormal}
36
- style={{
37
- fontWeight: '600',
38
- marginBottom: 6
39
- }}
40
- >
41
- {t('ORDER_IT_AGAIN', 'Order it again')}
42
- </OText>
43
- <OText
44
- size={12}
45
- lineHeight={18}
46
- color={theme.colors.disabled}
47
- >
48
- {t('ORDER_IT_AGAIN_DESC', 'Quickly add items from your past orders.')}
49
- </OText>
50
- <ScrollView
51
- horizontal
52
- showsVerticalScrollIndicator={false}
53
- showsHorizontalScrollIndicator={false}
54
- >
55
- {productsFilterd.map((product: any, i: number) => (
56
- <ProductWrapper key={'prod_' + product.id + `_${i}`} style={{ width: width - 120, }}>
57
- <SingleProductCard
58
- isSoldOut={product.inventoried && !product.quantity}
59
- product={product}
60
- businessId={businessId}
61
- categoryState={categoryState}
62
- onProductClick={() => onProductClick(product)}
63
- productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
64
- handleUpdateProducts={handleUpdateProducts}
65
- navigation={navigation}
66
- isPreviously
67
- />
68
- </ProductWrapper>
69
- ))}
70
- </ScrollView>
71
- </Container>
31
+ productsFilterd?.length > 0 ? (
32
+ <Container>
33
+ <OText
34
+ size={16}
35
+ lineHeight={24}
36
+ color={theme.colors.textNormal}
37
+ style={{
38
+ fontWeight: '600',
39
+ marginBottom: 6
40
+ }}
41
+ >
42
+ {t('ORDER_IT_AGAIN', 'Order it again')}
43
+ </OText>
44
+ <OText
45
+ size={12}
46
+ lineHeight={18}
47
+ color={theme.colors.disabled}
48
+ >
49
+ {t('ORDER_IT_AGAIN_DESC', 'Quickly add items from your past orders.')}
50
+ </OText>
51
+ <ScrollView
52
+ horizontal
53
+ showsVerticalScrollIndicator={false}
54
+ showsHorizontalScrollIndicator={false}
55
+ >
56
+ {productsFilterd.map((product: any, i: number) => (
57
+ <ProductWrapper key={'prod_' + product.id + `_${i}`} style={{ width: width - 120, }}>
58
+ <SingleProductCard
59
+ isSoldOut={product.inventoried && !product.quantity}
60
+ product={product}
61
+ businessId={businessId}
62
+ categoryState={categoryState}
63
+ onProductClick={() => onProductClick(product)}
64
+ productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
65
+ handleUpdateProducts={handleUpdateProducts}
66
+ navigation={navigation}
67
+ isPreviously
68
+ />
69
+ </ProductWrapper>
70
+ ))}
71
+ </ScrollView>
72
+ </Container>
73
+ ) : null
72
74
  )
73
75
  }
@@ -1110,7 +1110,7 @@ export const ProductOptionsUI = (props: any) => {
1110
1110
  export const ProductForm = (props: any) => {
1111
1111
  const productOptionsProps = {
1112
1112
  ...props,
1113
- productCart: { quantity: props?.product?.maximum_per_order || props?.product?.minimum_per_order || 1 },
1113
+ productCart: { quantity: props?.product?.minimum_per_order || 1 },
1114
1114
  UIComponent: ProductOptionsUI,
1115
1115
  };
1116
1116
 
@@ -72,9 +72,15 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
72
72
  },
73
73
  btnBackArrow: {
74
74
  borderWidth: 0,
75
+ width: 26,
76
+ height: 26,
75
77
  backgroundColor: theme.colors.clear,
78
+ borderColor: theme.colors.clear,
76
79
  shadowColor: theme.colors.clear,
77
- padding: 40,
80
+ paddingLeft: 0,
81
+ paddingRight: 0,
82
+ marginLeft: 20,
83
+ marginBottom: 10
78
84
  },
79
85
  })
80
86
 
@@ -10,7 +10,6 @@ import { OText, OButton, OInput } from '../shared';
10
10
 
11
11
  import { PhoneInputNumber } from '../PhoneInputNumber';
12
12
  import { sortInputFields } from '../../utils';
13
- import CheckBox from '@react-native-community/checkbox';
14
13
 
15
14
  export const UserFormDetailsUI = (props: any) => {
16
15
  const {
@@ -18,7 +17,6 @@ export const UserFormDetailsUI = (props: any) => {
18
17
  formState,
19
18
  showField,
20
19
  requiredFields,
21
- onClose,
22
20
  setIsSubmit,
23
21
  cleanFormState,
24
22
  onCloseProfile,
@@ -29,12 +27,10 @@ export const UserFormDetailsUI = (props: any) => {
29
27
  phoneUpdate,
30
28
  hideUpdateButton,
31
29
  setWillVerifyOtpState,
32
- handleChangePromotions,
33
30
  } = props;
34
31
 
35
32
  const theme = useTheme();
36
33
 
37
-
38
34
  const styles = StyleSheet.create({
39
35
  btnOutline: {
40
36
  backgroundColor: '#FFF',
@@ -64,10 +60,6 @@ export const UserFormDetailsUI = (props: any) => {
64
60
  paddingStart: 0,
65
61
  paddingBottom: 0,
66
62
  marginBottom: -0,
67
- },
68
- checkBoxStyle: {
69
- width: 25,
70
- height: 25,
71
63
  }
72
64
  });
73
65
 
@@ -79,7 +71,7 @@ export const UserFormDetailsUI = (props: any) => {
79
71
  const [{ user }] = useSession();
80
72
  const [userPhoneNumber, setUserPhoneNumber] = useState<any>(null);
81
73
  const [isValid, setIsValid] = useState(false)
82
- const [isChanged, setIsChanged] = useState(false)
74
+ const [isChanged, setIsChanged] = useState(false)
83
75
  const [phoneInputData, setPhoneInputData] = useState({
84
76
  error: '',
85
77
  phone: {
@@ -243,10 +235,10 @@ export const UserFormDetailsUI = (props: any) => {
243
235
 
244
236
  useEffect(() => {
245
237
  if (!requiredFields || formState?.changes?.length === 0) return
246
- const _isValid = requiredFields.every((key: any) => formState?.changes[key])
247
- setIsValid(_isValid)
248
- }, [formState?.changes, requiredFields])
249
-
238
+ const _isValid = requiredFields.every((key: any) => formState?.changes[key])
239
+ setIsValid(_isValid)
240
+ }, [formState?.changes, requiredFields])
241
+
250
242
  return (
251
243
  <>
252
244
  <UDForm>
@@ -333,7 +325,7 @@ export const UserFormDetailsUI = (props: any) => {
333
325
  ),
334
326
  )}
335
327
 
336
- {!!showInputPhoneNumber &&((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
328
+ {!!showInputPhoneNumber && ((requiredFields && requiredFields.includes('cellphone')) || !requiredFields) && (
337
329
  <WrapperPhone>
338
330
  <OText size={14} lineHeight={21} weight={'500'} color={theme.colors.textNormal}>{t('PHONE', 'Phone')}</OText>
339
331
  <PhoneInputNumber
@@ -395,39 +387,6 @@ export const UserFormDetailsUI = (props: any) => {
395
387
  defaultValue=''
396
388
  />
397
389
  )}
398
- {!requiredFields && (
399
- <Controller
400
- control={control}
401
- render={({ onChange, value }: any) => (
402
- <TouchableOpacity
403
- style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20, width: '100%' }}
404
- onPress={() => {
405
- onChange(!value)
406
- handleChangePromotions(!value)
407
- }}
408
- >
409
- <CheckBox
410
- value={value}
411
- boxType={'square'}
412
- tintColors={{
413
- true: theme.colors.primary,
414
- false: theme.colors.disabled
415
- }}
416
- tintColor={theme.colors.disabled}
417
- onCheckColor={theme.colors.primary}
418
- onTintColor={theme.colors.primary}
419
- style={Platform.OS === 'ios' && styles.checkBoxStyle}
420
- />
421
- <OText style={{ fontSize: 14, paddingHorizontal: 5, paddingLeft: 10 }}>{t('RECEIVE_NEWS_EXCLUSIVE_PROMOTIONS', 'Receive newsletters and exclusive promotions')}</OText>
422
- </TouchableOpacity>
423
- )}
424
- name='promotions'
425
- defaultValue={formState?.result?.result
426
- ? !!formState?.result?.result?.settings?.notification?.newsletter
427
- : !!(formState?.changes?.settings?.notification?.newsletter ?? (user && user?.settings?.notification?.newsletter))}
428
- />
429
- )}
430
-
431
390
  </UDWrapper>
432
391
  )}
433
392
  {validationFields?.loading && (
@@ -29,22 +29,26 @@ import {
29
29
  CenterView,
30
30
  Actions,
31
31
  ListWrap,
32
- ListItem
32
+ ListItem,
33
+ NotificationsWrapper,
34
+ NotificationBadge
33
35
  } from './styles';
34
36
  import { useWindowDimensions } from 'react-native';
35
37
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
38
+ import styled from 'styled-components';
39
+ import ToggleSwitch from 'toggle-switch-react-native';
36
40
 
37
41
  const ProfileListUI = (props: ProfileParams) => {
38
42
  const {
39
43
  navigation,
40
- formState,
44
+ notificationsGroup,
41
45
  handleRemoveAccount,
42
- removeAccountState
46
+ removeAccountState,
47
+ handleChangePromotions,
43
48
  } = props;
44
49
 
45
50
  const theme = useTheme();
46
51
 
47
-
48
52
  const langPickerStyle = StyleSheet.create({
49
53
  inputAndroid: {
50
54
  color: theme.colors.textNormal,
@@ -108,8 +112,7 @@ const ProfileListUI = (props: ProfileParams) => {
108
112
  const { top, bottom } = useSafeAreaInsets();
109
113
 
110
114
  const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
111
-
112
- const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
115
+ const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
113
116
  const IsPromotionsEnabled = configs?.advanced_offers_module?.value === '1' || configs?.advanced_offers_module?.value === true
114
117
  const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
115
118
  const onRedirect = (route: string, params?: any) => {
@@ -117,14 +120,12 @@ const ProfileListUI = (props: ProfileParams) => {
117
120
  }
118
121
 
119
122
  useEffect(() => {
120
- if (formState.result.result && !formState.loading) {
121
- if (formState.result?.error) {
122
- showToast(ToastType.Error, formState.result.result);
123
- } else {
123
+ if (notificationsGroup.result.result && !notificationsGroup.loading) {
124
+ if (!notificationsGroup.result?.error) {
124
125
  showToast(ToastType.Success, t('UPDATE_SUCCESSFULLY', 'Update successfully'));
125
126
  }
126
127
  }
127
- }, [formState.result])
128
+ }, [notificationsGroup.result])
128
129
 
129
130
  useEffect(() => {
130
131
  if (Object.keys(errors).length > 0) {
@@ -140,21 +141,20 @@ const ProfileListUI = (props: ProfileParams) => {
140
141
  }, [errors]);
141
142
 
142
143
  const detailProps = {
143
-
144
144
  goToBack: () => props.navigation?.canGoBack() && props.navigation.goBack(),
145
145
  onNavigationRedirect: (route: string, params: any) => props.navigation.navigate(route, params)
146
146
  }
147
147
 
148
148
  const onRemoveAccount = () => {
149
149
  setConfirm({
150
- open: true,
151
- content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
152
- title: t('ACCOUNT_ALERT', 'Account alert'),
153
- handleOnAccept: () => {
154
- setConfirm({ ...confirm, open: false })
155
- handleRemoveAccount && handleRemoveAccount(user?.id)
156
- }
157
- })
150
+ open: true,
151
+ content: [t('QUESTION_REMOVE_ACCOUNT', 'Are you sure that you want to remove your account?')],
152
+ title: t('ACCOUNT_ALERT', 'Account alert'),
153
+ handleOnAccept: () => {
154
+ setConfirm({ ...confirm, open: false })
155
+ handleRemoveAccount && handleRemoveAccount(user?.id)
156
+ }
157
+ })
158
158
  }
159
159
 
160
160
  useEffect(() => {
@@ -189,7 +189,7 @@ const ProfileListUI = (props: ProfileParams) => {
189
189
  </View>
190
190
  </CenterView>
191
191
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginVertical: 32 }} />
192
- <Spinner visible={formState?.loading} />
192
+ <Spinner visible={notificationsGroup?.loading} />
193
193
  <ListWrap style={{ ...styles.pagePadding }}>
194
194
  <Actions>
195
195
  <ListItem onPress={() => onRedirect('AddressList', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
@@ -222,6 +222,27 @@ const ProfileListUI = (props: ProfileParams) => {
222
222
  <OIcon src={theme.images.general.ic_help} width={16} color={theme.colors.textNormal} style={{ marginEnd: 14 }} />
223
223
  <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('HELP', 'Help')}</OText>
224
224
  </ListItem>
225
+ <ListItem onPress={() => navigation.navigate('Notifications', { isFromProfile: true, isGoBack: true })} activeOpacity={0.7}>
226
+ <NotificationBadge style={{ borderRadius: 100 / 2 }} />
227
+ <Ionicons name='notifications-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
228
+ <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('NOTIFICATIONS', 'Notifications')}
229
+ </OText>
230
+ <NotificationsWrapper>
231
+ <ToggleSwitch
232
+ isOn={user && (!!user?.settings?.notification?.newsletter ||
233
+ !!user?.settings?.sms?.newsletter ||
234
+ !!user?.settings?.email?.newsletter)}
235
+ onColor={theme.colors.primary}
236
+ size="small"
237
+ disabled={notificationsGroup?.loading}
238
+ offColor={theme.colors.disabled}
239
+ animationSpeed={400}
240
+ onToggle={() => handleChangePromotions(!(user && (!!user?.settings?.notification?.newsletter ||
241
+ !!user?.settings?.sms?.newsletter ||
242
+ !!user?.settings?.email?.newsletter)))}
243
+ />
244
+ </NotificationsWrapper>
245
+ </ListItem>
225
246
  <ListItem onPress={() => navigation.navigate('Sessions')} activeOpacity={0.7}>
226
247
  <Ionicons name='md-list-outline' style={styles.messageIconStyle} color={theme.colors.textNormal} />
227
248
  <OText size={14} lineHeight={24} weight={'400'} color={theme.colors.textNormal}>{t('SESSIONS', 'Sessions')}</OText>
@@ -244,13 +265,13 @@ const ProfileListUI = (props: ProfileParams) => {
244
265
  </Actions>
245
266
  </ListWrap>
246
267
  <OAlert
247
- open={confirm.open}
248
- title={confirm.title}
249
- content={confirm.content}
250
- onAccept={confirm.handleOnAccept}
251
- onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
252
- onClose={() => setConfirm({ ...confirm, open: false, title: null })}
253
- />
268
+ open={confirm.open}
269
+ title={confirm.title}
270
+ content={confirm.content}
271
+ onAccept={confirm.handleOnAccept}
272
+ onCancel={() => setConfirm({ ...confirm, open: false, title: null })}
273
+ onClose={() => setConfirm({ ...confirm, open: false, title: null })}
274
+ />
254
275
  </View>
255
276
  );
256
277
  };
@@ -1,5 +1,8 @@
1
+ import { useTheme } from 'styled-components';
1
2
  import styled from 'styled-components/native'
2
3
 
4
+ const theme = useTheme();
5
+
3
6
  export const CenterView = styled.View`
4
7
  flex-direction: row;
5
8
  justify-content: flex-start;
@@ -40,3 +43,17 @@ export const ListItem = styled.TouchableOpacity`
40
43
  margin-bottom: 24px;
41
44
  `
42
45
 
46
+ export const NotificationsWrapper = styled.View`
47
+ position: absolute;
48
+ right: 0;
49
+ `
50
+
51
+ export const NotificationBadge = styled.View`
52
+ width: 10px;
53
+ height: 10px;
54
+ z-index: 2000;
55
+ background-color: ${theme.colors.red};
56
+ position: absolute;
57
+ left: -2px;
58
+ top: 3px;
59
+ `;
@@ -47,6 +47,8 @@ export interface ProfileParams {
47
47
  isVerifiedPhone?: any;
48
48
  handleRemoveAccount?: any;
49
49
  removeAccountState?: any;
50
+ handleChangePromotions?: any;
51
+ notificationsGroup?: any;
50
52
  }
51
53
 
52
54
  export interface AddressListParams {
@@ -655,10 +657,10 @@ export interface PlaceSpotParams {
655
657
  spotNumberDefault?: any,
656
658
  vehicleDefault?: any,
657
659
  spotNumber?: any,
658
- setSpotNumber?: any,
660
+ setSpotNumber?: any,
659
661
  orderTypes?: any,
660
662
  placesState?: any,
661
- handleChangePlace? : any,
663
+ handleChangePlace?: any,
662
664
  spotState?: any,
663
665
  vehicle?: any,
664
666
  setVehicle?: any,