ordering-ui-react-native 0.14.54 → 0.14.57

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 (25) hide show
  1. package/package.json +1 -1
  2. package/src/components/BusinessesListing/index.tsx +1 -1
  3. package/src/components/StripeElementsForm/index.tsx +28 -13
  4. package/src/components/TaxInformation/index.tsx +1 -1
  5. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  6. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  7. package/themes/original/index.tsx +2 -0
  8. package/themes/original/src/components/BusinessController/index.tsx +3 -3
  9. package/themes/original/src/components/BusinessFeaturedController/index.tsx +2 -2
  10. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -2
  11. package/themes/original/src/components/BusinessProductsListing/index.tsx +8 -4
  12. package/themes/original/src/components/BusinessesListing/index.tsx +5 -5
  13. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -0
  14. package/themes/original/src/components/LogoutButton/index.tsx +2 -2
  15. package/themes/original/src/components/MomentOption/index.tsx +209 -196
  16. package/themes/original/src/components/MomentOption/styles.tsx +18 -42
  17. package/themes/original/src/components/ProductForm/index.tsx +6 -3
  18. package/themes/original/src/components/ProductOptionSubOption/index.tsx +51 -49
  19. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +8 -1
  20. package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
  21. package/themes/original/src/components/StripeElementsForm/index.tsx +28 -13
  22. package/themes/original/src/components/TaxInformation/index.tsx +1 -1
  23. package/themes/original/src/components/VerifyEmail/index.tsx +303 -0
  24. package/themes/original/src/components/VerifyEmail/styles.tsx +77 -0
  25. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.14.54",
3
+ "version": "0.14.57",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -191,7 +191,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
191
191
  {isFarAway && (
192
192
  <FarAwayMessage style={styles.farAwayMsg}>
193
193
  <Ionicons name='md-warning-outline' style={styles.iconStyle} />
194
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
194
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
195
195
  </FarAwayMessage>
196
196
  )}
197
197
  </OrderControlContainer>
@@ -33,19 +33,33 @@ const StripeElementsFormUI = (props: any) => {
33
33
  const { confirmSetupIntent, loading: confirmSetupLoading } = useConfirmSetupIntent();
34
34
  const [createPmLoading, setCreatePmLoading] = useState(false);
35
35
 
36
- const billingDetails = {
37
- name: `${user.name} ${user.lastname}`,
38
- email: user.email,
39
- address: user.address
40
- };
36
+ let billingDetails: any = {}
37
+
38
+ if (user?.name || user?.lastname) {
39
+ if (user?.name) {
40
+ billingDetails.name = user?.name
41
+ }
42
+ if (user?.lastname) {
43
+ billingDetails.name = `${billingDetails?.name} ${user?.lastname}`
44
+ }
45
+ }
46
+
47
+ if (user?.email) {
48
+ billingDetails.email = user?.email
49
+ }
50
+
51
+ if (user?.address) {
52
+ billingDetails.addressLine1 = user?.address
53
+ }
41
54
 
42
55
  const createPayMethod = async () => {
56
+ const params: any = { type: 'Card' }
57
+ if (Object.keys(billingDetails).length > 0) {
58
+ params.billingDetails = billingDetails
59
+ }
43
60
  try {
44
61
  setCreatePmLoading(true)
45
- const { paymentMethod } = await createPaymentMethod({
46
- type: 'Card',
47
- billingDetails,
48
- });
62
+ const { paymentMethod } = await createPaymentMethod(params);
49
63
 
50
64
  setCreatePmLoading(false)
51
65
  handleSource && handleSource({
@@ -68,11 +82,12 @@ const StripeElementsFormUI = (props: any) => {
68
82
  createPayMethod();
69
83
  return
70
84
  }
85
+ const params: any = { type: 'Card' }
86
+ if (Object.keys(billingDetails).length > 0) {
87
+ params.billingDetails = billingDetails
88
+ }
71
89
  try {
72
- const { setupIntent, error } = await confirmSetupIntent(requirements, {
73
- type: 'Card',
74
- billingDetails,
75
- });
90
+ const { setupIntent, error } = await confirmSetupIntent(requirements, params);
76
91
 
77
92
  if (setupIntent?.status === 'Succeeded') {
78
93
  stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId);
@@ -36,7 +36,7 @@ export const TaxInformation = (props: taxInformationParams) => {
36
36
  ? (product.tax?.id ? product.tax?.id === data?.id : product.tax?.id === null && data?.id === null)
37
37
  : type === 'fee'
38
38
  ? (product.fee?.id ? product.fee?.id === data?.id : (product.fee?.id === null && data?.id === null))
39
- : Object.keys(data?.discounts ?? {}).map(code => code.includes(product?.code))
39
+ : Object.keys(data?.discounts ?? {}).map(code => code.includes(product?.code)) && product?.offers?.find(offer => offer?.name === data?.name)
40
40
  )
41
41
  }
42
42
 
@@ -197,7 +197,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
197
197
  {isFarAway && (
198
198
  <FarAwayMessage style={styles.farAwayMsg}>
199
199
  <Ionicons name='md-warning-outline' style={styles.iconStyle} />
200
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
200
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
201
201
  </FarAwayMessage>
202
202
  )}
203
203
  {!auth && (
@@ -155,7 +155,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
155
155
  {isFarAway && (
156
156
  <FarAwayMessage style={styles.farAwayMsg}>
157
157
  <Ionicons name='md-warning-outline' style={styles.iconStyle} />
158
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
158
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
159
159
  </FarAwayMessage>
160
160
  )}
161
161
  <View style={styles.wrapperOrderOptions}>
@@ -32,6 +32,7 @@ import { Wallets } from './src/components/Wallets';
32
32
  import { PaymentOptionWallet } from './src/components/PaymentOptionWallet';
33
33
  import { ProductForm } from './src/components/ProductForm';
34
34
  import { UpsellingProducts } from './src/components/UpsellingProducts';
35
+ import { VerifyEmail } from './src/components/VerifyEmail';
35
36
 
36
37
  import { Toast } from './src/components/shared/OToast';
37
38
  import {
@@ -94,6 +95,7 @@ export {
94
95
  PaymentOptionWallet,
95
96
  ProductForm,
96
97
  UpsellingProducts,
98
+ VerifyEmail,
97
99
 
98
100
  // OComponents
99
101
  Toast,
@@ -25,7 +25,7 @@ import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome5';
25
25
  import FastImage from 'react-native-fast-image'
26
26
 
27
27
  export const BusinessControllerUI = (props: BusinessControllerParams) => {
28
- const { business, handleClick, navigation } = props;
28
+ const { business, handleClick, navigation, isBusinessOpen } = props;
29
29
  const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] =
30
30
  useUtils();
31
31
  const [orderState] = useOrder();
@@ -122,7 +122,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
122
122
  </View>
123
123
  )}
124
124
  <BusinessState>
125
- {!business?.open && (
125
+ {!isBusinessOpen && (
126
126
  <View style={styles.businessStateView}>
127
127
  <OText
128
128
  color={theme.colors.textThird}
@@ -168,7 +168,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
168
168
  <OText>{getBusinessType()}</OText>
169
169
  </BusinessCategory> */}
170
170
  <Metadata>
171
- {!business?.open ? (
171
+ {!isBusinessOpen ? (
172
172
  <View style={styles.closed}>
173
173
  <OText size={10} color={theme.colors.red}>
174
174
  {t('CLOSED', 'Closed')}
@@ -23,7 +23,7 @@ import {
23
23
  } from './styles';
24
24
 
25
25
  export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
26
- const { business, handleClick } = props;
26
+ const { business, handleClick, isBusinessOpen } = props;
27
27
  const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] =
28
28
  useUtils();
29
29
  const [orderState] = useOrder();
@@ -128,7 +128,7 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
128
128
  <OText>{getBusinessType()}</OText>
129
129
  </BusinessCategory> */}
130
130
  <Metadata>
131
- {!business?.open ? (
131
+ {!isBusinessOpen ? (
132
132
  <View style={styles.closed}>
133
133
  <OText size={10} color={theme.colors.red}>
134
134
  {t('CLOSED', 'Closed')}
@@ -130,8 +130,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
130
130
  disabledDateNumber: {
131
131
  color: '#B1BCCC',
132
132
  fontSize: 14,
133
- fontWeight: '500',
134
-
133
+ fontWeight: '500'
135
134
  }
136
135
  })
137
136
 
@@ -155,6 +155,10 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
155
155
  const handleTouchDrag = useCallback(() => {
156
156
  setCategoryClicked(false);
157
157
  }, []);
158
+
159
+ const handleBackNavigation = () => {
160
+ navigation?.canGoBack() ? navigation.goBack() : navigation.navigate('BottomTab')
161
+ }
158
162
 
159
163
  return (
160
164
  <SafeAreaView
@@ -169,7 +173,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
169
173
  imgLeftSrc={theme.images.general.arrow_left}
170
174
  imgRightSrc={null}
171
175
  style={styles.btnBackArrow}
172
- onClick={() => navigation?.canGoBack() && navigation.goBack()}
176
+ onClick={() => handleBackNavigation()}
173
177
  imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 16 }}
174
178
  />
175
179
  </View>
@@ -231,7 +235,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
231
235
  selectedCategoryId={selectedCategoryId}
232
236
  lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
233
237
  setSelectedCategoryId={setSelectedCategoryId}
234
- setCategoryClicked={setCategoryClicked}
238
+ setCategoryClicked={setCategoryClicked}
235
239
  />
236
240
  )}
237
241
  </>
@@ -309,13 +313,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
309
313
  business={currentCart?.business}
310
314
  cartProducts={currentCart?.products}
311
315
  cart={currentCart}
312
- setOpenUpselling={setOpenUpselling}
316
+ setOpenUpselling={setOpenUpselling}
313
317
  handleUpsellingPage={handleUpsellingPage}
314
318
  handleCloseUpsellingPage={handleCloseUpsellingPage}
315
319
  openUpselling={openUpselling}
316
320
  canOpenUpselling={canOpenUpselling}
317
321
  setCanOpenUpselling={setCanOpenUpselling}
318
- onRedirect={onRedirect}
322
+ onRedirect={onRedirect}
319
323
  />
320
324
  )}
321
325
  </SafeAreaView>
@@ -177,11 +177,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
177
177
  // }, [])
178
178
 
179
179
  const handleOnRefresh = () => {
180
- const hasMore = !(
181
- paginationProps.totalPages === paginationProps.currentPage
182
- );
183
- if (!businessesList.loading && hasMore) {
184
- getBusinesses();
180
+ if (!businessesList.loading) {
181
+ getBusinesses(true);
185
182
  }
186
183
  }
187
184
 
@@ -315,6 +312,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
315
312
  <BusinessFeaturedController
316
313
  key={bAry[0].id}
317
314
  business={bAry[0]}
315
+ isBusinessOpen={bAry[0]?.open}
318
316
  handleCustomClick={handleBusinessClick}
319
317
  orderType={orderState?.options?.type}
320
318
  />
@@ -322,6 +320,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
322
320
  <BusinessFeaturedController
323
321
  key={bAry[1].id}
324
322
  business={bAry[1]}
323
+ isBusinessOpen={bAry[1]?.open}
325
324
  handleCustomClick={handleBusinessClick}
326
325
  orderType={orderState?.options?.type}
327
326
  />
@@ -361,6 +360,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
361
360
  <BusinessController
362
361
  key={business.id}
363
362
  business={business}
363
+ isBusinessOpen={business.open}
364
364
  handleCustomClick={handleBusinessClick}
365
365
  orderType={orderState?.options?.type}
366
366
  navigation={navigation}
@@ -103,6 +103,7 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
103
103
  >
104
104
  <BusinessController
105
105
  business={business}
106
+ isBusinessOpen={business?.open}
106
107
  handleCustomClick={onBusinessClick}
107
108
  orderType={orderState?.options?.type}
108
109
  navigation={navigation}
@@ -5,7 +5,7 @@ import { useTheme } from 'styled-components/native';
5
5
  import { OIcon, OText } from '../shared';
6
6
 
7
7
  const LogoutButtonUI = (props: any) => {
8
- const { handleLogoutClick, text, color } = props
8
+ const { handleLogoutClick, text, color, iconSize } = props
9
9
  const theme = useTheme();
10
10
 
11
11
  return (
@@ -15,7 +15,7 @@ const LogoutButtonUI = (props: any) => {
15
15
  >
16
16
  <OIcon
17
17
  src={theme.images.general.logout}
18
- width={17}
18
+ width={iconSize ?? 17}
19
19
  color={color ? color : theme.colors.textNormal}
20
20
  style={{ marginEnd: 14 }}
21
21
  />