ordering-ui-react-native 0.12.57 → 0.12.58

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 (175) hide show
  1. package/package.json +1 -1
  2. package/themes/single-business/src/components/Cart/index.tsx +91 -15
  3. package/themes/single-business/src/components/Cart/styles.tsx +39 -0
  4. package/themes/single-business/src/components/CartContent/index.tsx +56 -52
  5. package/themes/single-business/src/components/CartContent/styles.tsx +2 -16
  6. package/themes/franchises/index.tsx +0 -111
  7. package/themes/franchises/src/components/ActiveOrders/index.tsx +0 -134
  8. package/themes/franchises/src/components/ActiveOrders/styles.tsx +0 -44
  9. package/themes/franchises/src/components/AddressDetails/index.tsx +0 -77
  10. package/themes/franchises/src/components/AddressDetails/styles.tsx +0 -21
  11. package/themes/franchises/src/components/AddressForm/index.tsx +0 -837
  12. package/themes/franchises/src/components/AddressForm/styles.tsx +0 -27
  13. package/themes/franchises/src/components/AddressList/index.tsx +0 -338
  14. package/themes/franchises/src/components/AddressList/styles.tsx +0 -20
  15. package/themes/franchises/src/components/AppleLogin/index.tsx +0 -149
  16. package/themes/franchises/src/components/AppleLogin/styles.tsx +0 -21
  17. package/themes/franchises/src/components/BottomWrapper/index.tsx +0 -29
  18. package/themes/franchises/src/components/BusinessBasicInformation/index.tsx +0 -310
  19. package/themes/franchises/src/components/BusinessBasicInformation/styles.tsx +0 -66
  20. package/themes/franchises/src/components/BusinessController/index.tsx +0 -184
  21. package/themes/franchises/src/components/BusinessController/styles.tsx +0 -64
  22. package/themes/franchises/src/components/BusinessFeaturedController/index.tsx +0 -189
  23. package/themes/franchises/src/components/BusinessFeaturedController/styles.tsx +0 -50
  24. package/themes/franchises/src/components/BusinessInformation/index.tsx +0 -202
  25. package/themes/franchises/src/components/BusinessInformation/styles.tsx +0 -39
  26. package/themes/franchises/src/components/BusinessItemAccordion/index.tsx +0 -125
  27. package/themes/franchises/src/components/BusinessItemAccordion/styles.tsx +0 -54
  28. package/themes/franchises/src/components/BusinessProductsCategories/index.tsx +0 -87
  29. package/themes/franchises/src/components/BusinessProductsCategories/styles.tsx +0 -8
  30. package/themes/franchises/src/components/BusinessProductsList/index.tsx +0 -199
  31. package/themes/franchises/src/components/BusinessProductsList/styles.tsx +0 -14
  32. package/themes/franchises/src/components/BusinessProductsListing/index.tsx +0 -292
  33. package/themes/franchises/src/components/BusinessProductsListing/styles.tsx +0 -30
  34. package/themes/franchises/src/components/BusinessReviews/index.tsx +0 -249
  35. package/themes/franchises/src/components/BusinessReviews/styles.tsx +0 -59
  36. package/themes/franchises/src/components/BusinessTypeFilter/index.tsx +0 -127
  37. package/themes/franchises/src/components/BusinessTypeFilter/styles.tsx +0 -40
  38. package/themes/franchises/src/components/BusinessesListing/index.tsx +0 -339
  39. package/themes/franchises/src/components/BusinessesListing/styles.tsx +0 -92
  40. package/themes/franchises/src/components/Cart/index.tsx +0 -332
  41. package/themes/franchises/src/components/Cart/styles.tsx +0 -28
  42. package/themes/franchises/src/components/CartContent/index.tsx +0 -60
  43. package/themes/franchises/src/components/CartContent/styles.tsx +0 -19
  44. package/themes/franchises/src/components/Checkout/index.tsx +0 -664
  45. package/themes/franchises/src/components/Checkout/styles.tsx +0 -89
  46. package/themes/franchises/src/components/CouponControl/index.tsx +0 -119
  47. package/themes/franchises/src/components/CouponControl/styles.tsx +0 -22
  48. package/themes/franchises/src/components/DriverTips/index.tsx +0 -167
  49. package/themes/franchises/src/components/DriverTips/styles.tsx +0 -63
  50. package/themes/franchises/src/components/FacebookLogin/index.tsx +0 -107
  51. package/themes/franchises/src/components/FacebookLogin/styles.tsx +0 -21
  52. package/themes/franchises/src/components/FloatingButton/index.tsx +0 -100
  53. package/themes/franchises/src/components/FloatingButton/styles.tsx +0 -26
  54. package/themes/franchises/src/components/ForgotPasswordForm/index.tsx +0 -156
  55. package/themes/franchises/src/components/ForgotPasswordForm/styles.tsx +0 -11
  56. package/themes/franchises/src/components/GPSButton/index.tsx +0 -84
  57. package/themes/franchises/src/components/GPSButton/styles.ts +0 -6
  58. package/themes/franchises/src/components/GoogleLogin/index.tsx +0 -122
  59. package/themes/franchises/src/components/GoogleLogin/styles.tsx +0 -23
  60. package/themes/franchises/src/components/GoogleMap/index.tsx +0 -229
  61. package/themes/franchises/src/components/Help/index.tsx +0 -56
  62. package/themes/franchises/src/components/Help/styles.tsx +0 -11
  63. package/themes/franchises/src/components/HelpAccountAndPayment/index.tsx +0 -68
  64. package/themes/franchises/src/components/HelpAccountAndPayment/styles.tsx +0 -6
  65. package/themes/franchises/src/components/HelpGuide/index.tsx +0 -67
  66. package/themes/franchises/src/components/HelpGuide/styles.tsx +0 -6
  67. package/themes/franchises/src/components/HelpOrder/index.tsx +0 -79
  68. package/themes/franchises/src/components/HelpOrder/styles.tsx +0 -6
  69. package/themes/franchises/src/components/Home/index.tsx +0 -102
  70. package/themes/franchises/src/components/Home/styles.tsx +0 -18
  71. package/themes/franchises/src/components/LanguageSelector/index.tsx +0 -98
  72. package/themes/franchises/src/components/LanguageSelector/styles.tsx +0 -7
  73. package/themes/franchises/src/components/LastOrder/index.tsx +0 -168
  74. package/themes/franchises/src/components/LastOrder/styles.tsx +0 -16
  75. package/themes/franchises/src/components/LastOrders/index.tsx +0 -104
  76. package/themes/franchises/src/components/LastOrders/styles.tsx +0 -17
  77. package/themes/franchises/src/components/LoginForm/index.tsx +0 -512
  78. package/themes/franchises/src/components/LoginForm/styles.tsx +0 -77
  79. package/themes/franchises/src/components/LogoutButton/index.tsx +0 -36
  80. package/themes/franchises/src/components/Messages/index.tsx +0 -359
  81. package/themes/franchises/src/components/Messages/styles.tsx +0 -20
  82. package/themes/franchises/src/components/MomentOption/index.tsx +0 -321
  83. package/themes/franchises/src/components/MomentOption/styles.tsx +0 -66
  84. package/themes/franchises/src/components/NavBar/index.tsx +0 -129
  85. package/themes/franchises/src/components/NotFoundSource/index.tsx +0 -50
  86. package/themes/franchises/src/components/NotFoundSource/styles.tsx +0 -16
  87. package/themes/franchises/src/components/Notifications/index.tsx +0 -120
  88. package/themes/franchises/src/components/Notifications/styles.ts +0 -21
  89. package/themes/franchises/src/components/OrderDetails/index.tsx +0 -828
  90. package/themes/franchises/src/components/OrderDetails/styles.tsx +0 -120
  91. package/themes/franchises/src/components/OrderSummary/index.tsx +0 -266
  92. package/themes/franchises/src/components/OrderSummary/styles.tsx +0 -41
  93. package/themes/franchises/src/components/OrderTypeSelector/index.tsx +0 -92
  94. package/themes/franchises/src/components/OrderTypeSelector/styles.tsx +0 -27
  95. package/themes/franchises/src/components/OrdersOption/index.tsx +0 -243
  96. package/themes/franchises/src/components/OrdersOption/styles.tsx +0 -5
  97. package/themes/franchises/src/components/PaymentOptionCash/index.tsx +0 -102
  98. package/themes/franchises/src/components/PaymentOptionCash/styles.tsx +0 -18
  99. package/themes/franchises/src/components/PaymentOptionStripe/index.tsx +0 -234
  100. package/themes/franchises/src/components/PaymentOptionStripe/styles.tsx +0 -71
  101. package/themes/franchises/src/components/PaymentOptions/index.tsx +0 -430
  102. package/themes/franchises/src/components/PaymentOptions/styles.tsx +0 -77
  103. package/themes/franchises/src/components/PhoneInputNumber/index.tsx +0 -127
  104. package/themes/franchises/src/components/PhoneInputNumber/styles.tsx +0 -3
  105. package/themes/franchises/src/components/PreviousOrders/index.tsx +0 -188
  106. package/themes/franchises/src/components/PreviousOrders/styles.tsx +0 -33
  107. package/themes/franchises/src/components/ProductForm/index.tsx +0 -695
  108. package/themes/franchises/src/components/ProductForm/styles.tsx +0 -78
  109. package/themes/franchises/src/components/ProductIngredient/index.tsx +0 -43
  110. package/themes/franchises/src/components/ProductIngredient/styles.tsx +0 -7
  111. package/themes/franchises/src/components/ProductItemAccordion/index.tsx +0 -276
  112. package/themes/franchises/src/components/ProductItemAccordion/styles.tsx +0 -57
  113. package/themes/franchises/src/components/ProductOption/index.tsx +0 -50
  114. package/themes/franchises/src/components/ProductOption/styles.tsx +0 -11
  115. package/themes/franchises/src/components/ProductOptionSubOption/index.tsx +0 -146
  116. package/themes/franchises/src/components/ProductOptionSubOption/styles.tsx +0 -32
  117. package/themes/franchises/src/components/ReviewDriver/index.tsx +0 -221
  118. package/themes/franchises/src/components/ReviewDriver/styles.tsx +0 -46
  119. package/themes/franchises/src/components/ReviewOrder/index.tsx +0 -325
  120. package/themes/franchises/src/components/ReviewOrder/styles.tsx +0 -46
  121. package/themes/franchises/src/components/ReviewProduct/index.tsx +0 -275
  122. package/themes/franchises/src/components/ReviewProduct/styles.tsx +0 -53
  123. package/themes/franchises/src/components/SearchBar/index.tsx +0 -139
  124. package/themes/franchises/src/components/SignupForm/index.tsx +0 -643
  125. package/themes/franchises/src/components/SignupForm/styles.tsx +0 -27
  126. package/themes/franchises/src/components/SingleProductCard/index.tsx +0 -124
  127. package/themes/franchises/src/components/SingleProductCard/styles.tsx +0 -23
  128. package/themes/franchises/src/components/StripeCardForm/index.tsx +0 -97
  129. package/themes/franchises/src/components/StripeCardForm/naked.tsx +0 -128
  130. package/themes/franchises/src/components/StripeCardForm/styles.tsx +0 -32
  131. package/themes/franchises/src/components/StripeCardsList/index.tsx +0 -182
  132. package/themes/franchises/src/components/StripeElementsForm/index.tsx +0 -204
  133. package/themes/franchises/src/components/StripeElementsForm/naked.tsx +0 -90
  134. package/themes/franchises/src/components/StripeElementsForm/styles.tsx +0 -13
  135. package/themes/franchises/src/components/StripeRedirectForm/index.tsx +0 -159
  136. package/themes/franchises/src/components/StripeRedirectForm/styles.tsx +0 -23
  137. package/themes/franchises/src/components/TagSelector/index.tsx +0 -94
  138. package/themes/franchises/src/components/TagSelector/styles.ts +0 -0
  139. package/themes/franchises/src/components/TaxInformation/index.tsx +0 -51
  140. package/themes/franchises/src/components/TaxInformation/styles.tsx +0 -9
  141. package/themes/franchises/src/components/UpsellingProducts/index.tsx +0 -222
  142. package/themes/franchises/src/components/UpsellingProducts/styles.tsx +0 -50
  143. package/themes/franchises/src/components/UserDetails/index.tsx +0 -134
  144. package/themes/franchises/src/components/UserDetails/styles.tsx +0 -26
  145. package/themes/franchises/src/components/UserFormDetails/index.tsx +0 -351
  146. package/themes/franchises/src/components/UserFormDetails/styles.tsx +0 -35
  147. package/themes/franchises/src/components/UserProfile/index.tsx +0 -179
  148. package/themes/franchises/src/components/UserProfile/styles.ts +0 -42
  149. package/themes/franchises/src/components/UserProfileForm/index.tsx +0 -253
  150. package/themes/franchises/src/components/UserProfileForm/styles.tsx +0 -29
  151. package/themes/franchises/src/components/VerifyPhone/index.tsx +0 -188
  152. package/themes/franchises/src/components/VerifyPhone/styles.tsx +0 -43
  153. package/themes/franchises/src/components/shared/OAlert.tsx +0 -55
  154. package/themes/franchises/src/components/shared/OBottomPopup.tsx +0 -73
  155. package/themes/franchises/src/components/shared/OBottomStickBar.tsx +0 -62
  156. package/themes/franchises/src/components/shared/OButton.tsx +0 -132
  157. package/themes/franchises/src/components/shared/ODropDown.tsx +0 -169
  158. package/themes/franchises/src/components/shared/OIcon.tsx +0 -53
  159. package/themes/franchises/src/components/shared/OIconButton.tsx +0 -127
  160. package/themes/franchises/src/components/shared/OIconText.tsx +0 -54
  161. package/themes/franchises/src/components/shared/OInput.tsx +0 -113
  162. package/themes/franchises/src/components/shared/OKeyButton.tsx +0 -35
  163. package/themes/franchises/src/components/shared/OModal.tsx +0 -172
  164. package/themes/franchises/src/components/shared/OText.tsx +0 -52
  165. package/themes/franchises/src/components/shared/OTextarea.tsx +0 -36
  166. package/themes/franchises/src/components/shared/OToast.tsx +0 -93
  167. package/themes/franchises/src/components/shared/OToggle.tsx +0 -158
  168. package/themes/franchises/src/components/shared/index.tsx +0 -29
  169. package/themes/franchises/src/config/constants.tsx +0 -57
  170. package/themes/franchises/src/layouts/Container.tsx +0 -23
  171. package/themes/franchises/src/layouts/SafeAreaContainer.tsx +0 -6
  172. package/themes/franchises/src/providers/AlertProvider.tsx +0 -43
  173. package/themes/franchises/src/providers/StoreUtil.tsx +0 -50
  174. package/themes/franchises/src/types/index.tsx +0 -445
  175. package/themes/franchises/src/utils/index.tsx +0 -222
@@ -1,87 +0,0 @@
1
- import React from 'react';
2
- import { BusinessProductsCategories as ProductsCategories } from 'ordering-components/native';
3
- import { useTheme } from 'styled-components/native';
4
- import { ScrollView, StyleSheet, View } from 'react-native';
5
- import { Tab } from './styles';
6
- import { OText } from '../shared';
7
- import { BusinessProductsCategoriesParams } from '../../types';
8
- import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
9
-
10
- const BusinessProductsCategoriesUI = (props: any) => {
11
- const {
12
- featured,
13
- categories,
14
- handlerClickCategory,
15
- categorySelected,
16
- loading,
17
- } = props;
18
-
19
- const theme = useTheme();
20
- const styles = StyleSheet.create({
21
- container: {
22
- paddingVertical: 14,
23
- borderColor: theme.colors.clear,
24
- },
25
- featuredStyle: {
26
- display: 'none',
27
- },
28
- });
29
-
30
- return (
31
- <ScrollView
32
- horizontal
33
- style={{ ...styles.container, borderBottomWidth: loading ? 0 : 1 }}
34
- contentContainerStyle={{ paddingHorizontal: 40 }}
35
- showsHorizontalScrollIndicator={false}>
36
- {loading && (
37
- <Placeholder Animation={Fade}>
38
- <View style={{ flexDirection: 'row' }}>
39
- {[...Array(4)].map((item, i) => (
40
- <PlaceholderLine key={i} width={10} style={{ marginRight: 5 }} />
41
- ))}
42
- </View>
43
- </Placeholder>
44
- )}
45
- {!loading &&
46
- categories &&
47
- categories.length &&
48
- categories.map((category: any) => (
49
- <Tab
50
- key={category.name}
51
- onPress={() => handlerClickCategory(category)}
52
- style={[
53
- category.id === 'featured' && !featured && styles.featuredStyle,
54
- {
55
- borderColor:
56
- categorySelected?.id === category.id
57
- ? theme.colors.textNormal
58
- : theme.colors.border,
59
- },
60
- ]}>
61
- <OText
62
- size={categorySelected?.id === category.id ? 14 : 12}
63
- weight={categorySelected?.id === category.id ? '600' : '400'}
64
- color={
65
- categorySelected?.id === category.id
66
- ? theme.colors.textNormal
67
- : theme.colors.textSecondary
68
- }
69
- style={{ alignSelf: 'center' }}>
70
- {category.name}
71
- </OText>
72
- </Tab>
73
- ))}
74
- </ScrollView>
75
- );
76
- };
77
-
78
- export const BusinessProductsCategories = (
79
- props: BusinessProductsCategoriesParams,
80
- ) => {
81
- const businessProductsCategoriesProps = {
82
- ...props,
83
- UIComponent: BusinessProductsCategoriesUI,
84
- };
85
-
86
- return <ProductsCategories {...businessProductsCategoriesProps} />;
87
- };
@@ -1,8 +0,0 @@
1
- import styled from 'styled-components/native'
2
-
3
- export const Tab = styled.TouchableOpacity`
4
- padding-horizontal: 10px;
5
- padding-vertical: 10px;
6
- justify-content: center;
7
- border-bottom-width: 1px;
8
- `
@@ -1,199 +0,0 @@
1
- import React from 'react';
2
- import { ProductsList, useLanguage, useUtils } from 'ordering-components/native';
3
- import { SingleProductCard } from '../SingleProductCard';
4
- import { NotFoundSource } from '../NotFoundSource';
5
- import { BusinessProductsListParams } from '../../types';
6
- import { OIcon, OText } from '../shared';
7
- import { ProductsContainer, ErrorMessage, WrapperNotFound } from './styles';
8
- import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
9
- import { View } from 'react-native';
10
- import { StyleSheet } from 'react-native';
11
-
12
- const BusinessProductsListUI = (props: BusinessProductsListParams) => {
13
- const {
14
- errors,
15
- businessId,
16
- category,
17
- categories,
18
- categoryState,
19
- onProductClick,
20
- featured,
21
- searchValue,
22
- isBusinessLoading,
23
- handleSearchRedirect,
24
- handleClearSearch,
25
- errorQuantityProducts,
26
- handleCancelSearch,
27
- } = props;
28
-
29
- const [, t] = useLanguage();
30
- const [{ optimizeImage }] = useUtils()
31
-
32
- return (
33
- <ProductsContainer>
34
- {category.id &&
35
- categoryState.products?.map((product: any) => (
36
- <SingleProductCard
37
- key={'prod_' + product.id}
38
- isSoldOut={product.inventoried && !product.quantity}
39
- product={product}
40
- businessId={businessId}
41
- onProductClick={() => onProductClick(product)}
42
- />
43
- ))}
44
-
45
- {!category.id &&
46
- featured &&
47
- categoryState?.products?.find((product: any) => product.featured) && (
48
- <>
49
- <OText size={16} weight={'600'} mBottom={15}>
50
- {t('FEATURED', 'Featured')}
51
- </OText>
52
- <>
53
- {categoryState.products?.map(
54
- (product: any) =>
55
- product.featured && (
56
- <SingleProductCard
57
- key={product.id}
58
- isSoldOut={product.inventoried && !product.quantity}
59
- product={product}
60
- businessId={businessId}
61
- onProductClick={onProductClick}
62
- />
63
- ),
64
- )}
65
- </>
66
- </>
67
- )}
68
-
69
- {!category.id &&
70
- categories &&
71
- categories
72
- .filter((category) => category.id !== null)
73
- .map((category, i, _categories) => {
74
- const products =
75
- categoryState.products?.filter(
76
- (product: any) => product.category_id === category.id,
77
- ) || [];
78
- return (
79
- <React.Fragment key={'cat_' + category.id}>
80
- {products.length > 0 && (
81
- <>
82
- <View style={bpStyles.catWrap}>
83
- <View style={bpStyles.catIcon}>
84
- <OIcon
85
- url={optimizeImage(category.image, 'h_100,c_limit')}
86
- width={41}
87
- height={41}
88
- style={{ borderRadius: 7.6 }}
89
- />
90
- </View>
91
- <OText size={16} weight="600">
92
- {category.name}
93
- </OText>
94
- </View>
95
- <>
96
- {products.map((product: any) => (
97
- <SingleProductCard
98
- key={product.id}
99
- isSoldOut={product.inventoried && !product.quantity}
100
- businessId={businessId}
101
- product={product}
102
- onProductClick={onProductClick}
103
- />
104
- ))}
105
- </>
106
- </>
107
- )}
108
- </React.Fragment>
109
- );
110
- })}
111
-
112
- {(categoryState.loading || isBusinessLoading) && (
113
- <>
114
- {[...Array(categoryState?.pagination?.nextPageItems).keys()].map(
115
- (item, i) => (
116
- <Placeholder key={i} style={{ padding: 5 }} Animation={Fade}>
117
- <View style={{ flexDirection: 'row' }}>
118
- <PlaceholderLine
119
- width={24}
120
- height={70}
121
- style={{ marginRight: 10, marginBottom: 10 }}
122
- />
123
- <Placeholder style={{ paddingVertical: 10 }}>
124
- <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
125
- <PlaceholderLine width={20} />
126
- </Placeholder>
127
- </View>
128
- </Placeholder>
129
- ),
130
- )}
131
- </>
132
- )}
133
- {!categoryState.loading &&
134
- !isBusinessLoading &&
135
- categoryState.products.length === 0 &&
136
- !errors &&
137
- !(
138
- (searchValue && errorQuantityProducts) ||
139
- (!searchValue && !errorQuantityProducts)
140
- ) && (
141
- <WrapperNotFound>
142
- <NotFoundSource
143
- content={
144
- !searchValue
145
- ? t(
146
- 'ERROR_NOT_FOUND_PRODUCTS_TIME',
147
- 'No products found at this time',
148
- )
149
- : t(
150
- 'ERROR_NOT_FOUND_PRODUCTS',
151
- 'No products found, please change filters.',
152
- )
153
- }
154
- btnTitle={
155
- !searchValue
156
- ? t('SEARCH_REDIRECT', 'Go to Businesses')
157
- : t('CLEAR_FILTERS', 'Clear filters')
158
- }
159
- onClickButton={() =>
160
- !searchValue
161
- ? handleSearchRedirect && handleSearchRedirect()
162
- : handleCancelSearch && handleCancelSearch()
163
- }
164
- />
165
- </WrapperNotFound>
166
- )}
167
-
168
- {errors &&
169
- errors.length > 0 &&
170
- errors.map((e: any, i: number) => (
171
- <ErrorMessage key={i}>
172
- <OText space>ERROR:</OText>
173
- <OText>{e}</OText>
174
- </ErrorMessage>
175
- ))}
176
- </ProductsContainer>
177
- );
178
- };
179
-
180
- const bpStyles = StyleSheet.create({
181
- catWrap: { flexDirection: 'row', alignItems: 'center', height: 41, marginBottom: 19 },
182
- catIcon: {
183
- borderRadius: 7.6,
184
- shadowColor: '#000000',
185
- shadowOpacity: 0.1,
186
- shadowOffset: { width: 0, height: 0 },
187
- shadowRadius: 1,
188
- marginEnd: 13,
189
- },
190
- });
191
-
192
- export const BusinessProductsList = (props: BusinessProductsListParams) => {
193
- const businessProductsListProps = {
194
- ...props,
195
- UIComponent: BusinessProductsListUI,
196
- };
197
-
198
- return <ProductsList {...businessProductsListProps} />;
199
- };
@@ -1,14 +0,0 @@
1
- import styled from 'styled-components/native'
2
-
3
- export const ProductsContainer = styled.View`
4
- `
5
- export const ErrorMessage = styled.View`
6
- padding: 20px;
7
- width: 100%;
8
- background-color: #CCCCCC;
9
- font-weight: bold;
10
- `
11
-
12
- export const WrapperNotFound = styled.View`
13
- height: 500px;
14
- `
@@ -1,292 +0,0 @@
1
- import React, { useEffect, useState } from 'react'
2
- import { View, TouchableOpacity, StyleSheet } from 'react-native'
3
- import { useTheme } from 'styled-components/native';
4
- import {
5
- BusinessAndProductList,
6
- useLanguage,
7
- useOrder,
8
- useSession,
9
- useUtils,
10
- } from 'ordering-components/native'
11
- import { OButton, OIcon, OModal, OText } from '../shared'
12
- import { BusinessBasicInformation } from '../BusinessBasicInformation'
13
- import { SearchBar } from '../SearchBar'
14
- import { BusinessProductsCategories } from '../BusinessProductsCategories'
15
- import { BusinessProductsList } from '../BusinessProductsList'
16
- import { BusinessProductsListingParams } from '../../types'
17
- import {
18
- WrapHeader,
19
- TopHeader,
20
- WrapSearchBar,
21
- WrapContent,
22
- BusinessProductsListingContainer
23
- } from './styles'
24
- import { FloatingButton } from '../FloatingButton'
25
- import { ProductForm } from '../ProductForm'
26
- import { UpsellingProducts } from '../UpsellingProducts'
27
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
28
- import { _setStoreData } from '../../providers/StoreUtil';
29
-
30
- const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
31
- const {
32
- navigation,
33
- errors,
34
- businessState,
35
- categoryState,
36
- handleChangeSearch,
37
- categorySelected,
38
- searchValue,
39
- handleChangeCategory,
40
- handleSearchRedirect,
41
- featuredProducts,
42
- errorQuantityProducts,
43
- header,
44
- logo
45
- } = props
46
-
47
- const theme = useTheme();
48
- const [, t] = useLanguage()
49
- const [{ auth }] = useSession()
50
- const [orderState] = useOrder()
51
- const [{ parsePrice }] = useUtils()
52
- const { top, bottom } = useSafeAreaInsets()
53
-
54
- const styles = StyleSheet.create({
55
- mainContainer: {
56
- flex: 1,
57
- },
58
- BackIcon: {
59
- paddingRight: 20,
60
- },
61
- headerItem: {
62
- flexDirection: 'row',
63
- alignItems: 'center',
64
- marginVertical: 2,
65
- marginHorizontal: 20,
66
- },
67
- btnBackArrow: {
68
- borderWidth: 0,
69
- backgroundColor: theme.colors.clear,
70
- shadowColor: theme.colors.clear,
71
- paddingLeft: 40,
72
- paddingRight: 40
73
- },
74
- searchIcon: {
75
- borderWidth: 0,
76
- paddingEnd: 40,
77
- shadowColor: theme.colors.clear,
78
- backgroundColor: theme.colors.clear,
79
- }
80
- })
81
-
82
- const { business, loading, error } = businessState
83
- const [openBusinessInformation, setOpenBusinessInformation] = useState(false)
84
- const [curProduct, setCurProduct] = useState(null)
85
- const [openUpselling, setOpenUpselling] = useState(false)
86
- const [canOpenUpselling, setCanOpenUpselling] = useState(false)
87
- const [showSearch, setShowSearch] = useState(false);
88
-
89
- const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
90
-
91
- const onRedirect = (route: string, params?: any) => {
92
- navigation.navigate(route, params)
93
- }
94
-
95
- const onProductClick = (product: any) => {
96
- setCurProduct(product)
97
- }
98
-
99
- const handleCancel = () => {
100
- handleChangeSearch('')
101
- }
102
-
103
- const handleCloseProductModal = () => {
104
- setCurProduct(null)
105
- }
106
-
107
- const handlerProductAction = () => {
108
- handleCloseProductModal()
109
- }
110
-
111
- const handleUpsellingPage = () => {
112
- onRedirect('CheckoutNavigator', {
113
- screen: 'CheckoutPage',
114
- cartUuid: currentCart?.uuid,
115
- businessLogo: logo,
116
- businessName: business?.name,
117
- cartTotal: currentCart?.total
118
- })
119
- setOpenUpselling(false)
120
- }
121
-
122
- const handleCloseUpsellingPage = () => {
123
- setOpenUpselling(false)
124
- }
125
-
126
- useEffect(() => {
127
- if (!orderState.loading) {
128
- handleCloseProductModal()
129
- }
130
- }, [orderState.loading])
131
-
132
- useEffect(() => {
133
- if (businessState?.business?.logo) {
134
- _setStoreData('b_logo', {businessLogo: businessState.business?.logo});
135
- } else {
136
- console.log('logo undefined!!')
137
- }
138
- }, [businessState])
139
-
140
- return (
141
- <>
142
- <BusinessProductsListingContainer style={styles.mainContainer} isActiveFloatingButtom={currentCart?.products?.length > 0 && categoryState.products.length !== 0}>
143
- <WrapHeader>
144
- <TopHeader style={{top: top}}>
145
- <OButton
146
- imgLeftSrc={theme.images.general.arrow_left}
147
- imgRightSrc={null}
148
- style={styles.btnBackArrow}
149
- onClick={() => navigation?.canGoBack() && navigation.goBack()}
150
- imgLeftStyle={{ tintColor: theme.colors.textSecondary, width: 20 }}
151
- />
152
- <OButton
153
- imgLeftSrc={theme.images.general.search}
154
- imgRightSrc={null}
155
- style={styles.searchIcon}
156
- onClick={() => setShowSearch(!showSearch)}
157
- imgLeftStyle={{ tintColor: theme.colors.textSecondary, width: 18 }}
158
- />
159
- </TopHeader>
160
- <BusinessBasicInformation
161
- navigation={navigation}
162
- businessState={businessState}
163
- openBusinessInformation={openBusinessInformation}
164
- logo={logo}
165
- isMini
166
- />
167
- </WrapHeader>
168
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
169
- {!loading && business?.id && (
170
- <>
171
- {showSearch &&
172
- <WrapSearchBar>
173
- <SearchBar
174
- onSearch={handleChangeSearch}
175
- isCancelXButtonShow
176
- noBorderShow
177
- placeholder={t('SEARCH', 'Search')}
178
- lazyLoad={businessState?.business?.lazy_load_products_recommended}
179
- />
180
- </WrapSearchBar>
181
- }
182
- {!(business?.categories?.length === 0) && (
183
- <BusinessProductsCategories
184
- categories={[{ id: null, name: t('ALL', 'All') }, { id: 'featured', name: t('FEATURED', 'Featured') }, ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)]}
185
- categorySelected={categorySelected}
186
- onClickCategory={handleChangeCategory}
187
- featured={featuredProducts}
188
- openBusinessInformation={openBusinessInformation}
189
- />
190
- )}
191
- <WrapContent>
192
- <BusinessProductsList
193
- categories={[
194
- { id: null, name: t('ALL', 'All') },
195
- { id: 'featured', name: t('FEATURED', 'Featured') },
196
- ...business?.categories.sort((a: any, b: any) => a.rank - b.rank)
197
- ]}
198
- category={categorySelected}
199
- categoryState={categoryState}
200
- businessId={business.id}
201
- errors={errors}
202
- onProductClick={onProductClick}
203
- handleSearchRedirect={handleSearchRedirect}
204
- featured={featuredProducts}
205
- searchValue={searchValue}
206
- handleClearSearch={handleChangeSearch}
207
- errorQuantityProducts={errorQuantityProducts}
208
- handleCancelSearch={handleCancel}
209
- />
210
- </WrapContent>
211
- </>
212
- )}
213
- {loading && !error && (
214
- <>
215
- <BusinessProductsCategories
216
- categories={[]}
217
- categorySelected={categorySelected}
218
- onClickCategory={handleChangeCategory}
219
- featured={featuredProducts}
220
- openBusinessInformation={openBusinessInformation}
221
- loading={loading}
222
- />
223
- <WrapContent>
224
- <BusinessProductsList
225
- categories={[]}
226
- category={categorySelected}
227
- categoryState={categoryState}
228
- isBusinessLoading={loading}
229
- errorQuantityProducts={errorQuantityProducts}
230
- />
231
- </WrapContent>
232
- </>
233
- )}
234
- </BusinessProductsListingContainer>
235
- {!loading && auth && !openUpselling && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
236
- <FloatingButton
237
- btnText={
238
- currentCart?.subtotal >= currentCart?.minimum
239
- ? !openUpselling ? t('VIEW_CART', 'View Cart') : t('LOADING', 'Loading')
240
- : `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(currentCart?.minimum)}`
241
- }
242
- isSecondaryBtn={currentCart?.subtotal < currentCart?.minimum}
243
- btnLeftValueShow={currentCart?.subtotal >= currentCart?.minimum && !openUpselling && currentCart?.products?.length > 0}
244
- btnRightValueShow={currentCart?.subtotal >= currentCart?.minimum && !openUpselling && currentCart?.products?.length > 0}
245
- btnLeftValue={currentCart?.products?.length}
246
- btnRightValue={parsePrice(currentCart?.total)}
247
- disabled={openUpselling || currentCart?.subtotal < currentCart?.minimum}
248
- handleClick={() => setOpenUpselling(true)}
249
- hasBottom
250
- />
251
- )}
252
- <OModal
253
- open={!!curProduct}
254
- onClose={handleCloseProductModal}
255
- entireModal
256
- customClose
257
- >
258
- <ProductForm
259
- product={curProduct}
260
- businessSlug={business.slug}
261
- businessId={business.id}
262
- onClose={handleCloseProductModal}
263
- navigation={navigation}
264
- onSave={handlerProductAction}
265
- />
266
- </OModal>
267
- {openUpselling && (
268
- <UpsellingProducts
269
- businessId={currentCart?.business_id}
270
- business={currentCart?.business}
271
- cartProducts={currentCart?.products}
272
- cart={currentCart}
273
- handleUpsellingPage={handleUpsellingPage}
274
- handleCloseUpsellingPage={handleCloseUpsellingPage}
275
- openUpselling={openUpselling}
276
- canOpenUpselling={canOpenUpselling}
277
- setCanOpenUpselling={setCanOpenUpselling}
278
- />
279
- )}
280
- </>
281
- )
282
- }
283
-
284
- export const BusinessProductsListing = (props: BusinessProductsListingParams) => {
285
- const businessProductslistingProps = {
286
- ...props,
287
- UIComponent: BusinessProductsListingUI
288
- }
289
- return (
290
- <BusinessAndProductList {...businessProductslistingProps} />
291
- )
292
- }
@@ -1,30 +0,0 @@
1
- import styled, { css } from 'styled-components/native'
2
-
3
- export const WrapHeader = styled.View`
4
- position: relative;
5
- padding-bottom: 35px;
6
- `
7
- export const TopHeader = styled.View`
8
- flex-direction: row;
9
- align-items: center;
10
- justify-content: space-between;
11
- z-index: 1;
12
- height: 60px;
13
- min-height: 60px;
14
- width: 100%;
15
- `
16
- export const WrapSearchBar = styled.View`
17
- padding: 8px 30px;
18
- background-color: ${(props: any) => props.theme.colors.white};
19
- flex: 1;
20
- `
21
- export const WrapContent = styled.View`
22
- padding: 10px 40px;
23
- `
24
-
25
- export const BusinessProductsListingContainer = styled.ScrollView`
26
- flex: 1;
27
- ${({ isActiveFloatingButtom }: { isActiveFloatingButtom: boolean }) => isActiveFloatingButtom && css`
28
- margin-bottom: 50px;
29
- `}
30
- `