ordering-ui-react-native 0.12.54 → 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 (205) hide show
  1. package/package.json +1 -1
  2. package/src/components/Cart/index.tsx +50 -16
  3. package/src/components/OrderDetails/index.tsx +8 -0
  4. package/src/components/OrderSummary/index.tsx +38 -3
  5. package/src/layouts/Container.tsx +1 -1
  6. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +8 -0
  7. package/themes/business/src/components/OrderDetails/styles.tsx +1 -0
  8. package/themes/business/src/layouts/Container.tsx +3 -1
  9. package/themes/doordash/src/components/Cart/index.tsx +36 -2
  10. package/themes/doordash/src/components/OrderDetails/index.tsx +8 -0
  11. package/themes/doordash/src/components/OrderSummary/index.tsx +36 -3
  12. package/themes/doordash/src/layouts/Container.tsx +1 -1
  13. package/themes/instacart/src/components/Cart/index.tsx +37 -3
  14. package/themes/instacart/src/components/OrderDetails/index.tsx +8 -0
  15. package/themes/instacart/src/components/OrderSummary/index.tsx +37 -4
  16. package/themes/instacart/src/layouts/Container.tsx +1 -1
  17. package/themes/kiosk/src/layouts/Container.tsx +2 -1
  18. package/themes/original/src/components/Cart/index.tsx +268 -234
  19. package/themes/original/src/components/OrderDetails/index.tsx +723 -715
  20. package/themes/original/src/components/OrderSummary/index.tsx +37 -3
  21. package/themes/original/src/layouts/Container.tsx +1 -1
  22. package/themes/single-business/src/components/Cart/index.tsx +92 -16
  23. package/themes/single-business/src/components/Cart/styles.tsx +39 -0
  24. package/themes/single-business/src/components/CartContent/index.tsx +56 -52
  25. package/themes/single-business/src/components/CartContent/styles.tsx +2 -16
  26. package/themes/single-business/src/components/PhoneInputNumber/index.tsx +103 -112
  27. package/themes/single-business/src/components/UserDetails/index.tsx +107 -111
  28. package/themes/single-business/src/components/UserDetails/styles.tsx +3 -8
  29. package/themes/single-business/src/components/UserFormDetails/index.tsx +279 -326
  30. package/themes/single-business/src/components/UserFormDetails/styles.tsx +7 -5
  31. package/themes/single-business/src/layouts/Container.tsx +1 -1
  32. package/themes/uber-eats/src/components/Cart/index.tsx +37 -3
  33. package/themes/uber-eats/src/components/OrderDetails/index.tsx +8 -0
  34. package/themes/uber-eats/src/components/OrderSummary/index.tsx +40 -6
  35. package/themes/uber-eats/src/layouts/Container.tsx +1 -1
  36. package/themes/franchises/index.tsx +0 -111
  37. package/themes/franchises/src/components/ActiveOrders/index.tsx +0 -134
  38. package/themes/franchises/src/components/ActiveOrders/styles.tsx +0 -44
  39. package/themes/franchises/src/components/AddressDetails/index.tsx +0 -77
  40. package/themes/franchises/src/components/AddressDetails/styles.tsx +0 -21
  41. package/themes/franchises/src/components/AddressForm/index.tsx +0 -837
  42. package/themes/franchises/src/components/AddressForm/styles.tsx +0 -27
  43. package/themes/franchises/src/components/AddressList/index.tsx +0 -338
  44. package/themes/franchises/src/components/AddressList/styles.tsx +0 -20
  45. package/themes/franchises/src/components/AppleLogin/index.tsx +0 -149
  46. package/themes/franchises/src/components/AppleLogin/styles.tsx +0 -21
  47. package/themes/franchises/src/components/BottomWrapper/index.tsx +0 -29
  48. package/themes/franchises/src/components/BusinessBasicInformation/index.tsx +0 -310
  49. package/themes/franchises/src/components/BusinessBasicInformation/styles.tsx +0 -66
  50. package/themes/franchises/src/components/BusinessController/index.tsx +0 -184
  51. package/themes/franchises/src/components/BusinessController/styles.tsx +0 -64
  52. package/themes/franchises/src/components/BusinessFeaturedController/index.tsx +0 -189
  53. package/themes/franchises/src/components/BusinessFeaturedController/styles.tsx +0 -50
  54. package/themes/franchises/src/components/BusinessInformation/index.tsx +0 -202
  55. package/themes/franchises/src/components/BusinessInformation/styles.tsx +0 -39
  56. package/themes/franchises/src/components/BusinessItemAccordion/index.tsx +0 -125
  57. package/themes/franchises/src/components/BusinessItemAccordion/styles.tsx +0 -54
  58. package/themes/franchises/src/components/BusinessProductsCategories/index.tsx +0 -87
  59. package/themes/franchises/src/components/BusinessProductsCategories/styles.tsx +0 -8
  60. package/themes/franchises/src/components/BusinessProductsList/index.tsx +0 -199
  61. package/themes/franchises/src/components/BusinessProductsList/styles.tsx +0 -14
  62. package/themes/franchises/src/components/BusinessProductsListing/index.tsx +0 -292
  63. package/themes/franchises/src/components/BusinessProductsListing/styles.tsx +0 -30
  64. package/themes/franchises/src/components/BusinessReviews/index.tsx +0 -249
  65. package/themes/franchises/src/components/BusinessReviews/styles.tsx +0 -59
  66. package/themes/franchises/src/components/BusinessTypeFilter/index.tsx +0 -127
  67. package/themes/franchises/src/components/BusinessTypeFilter/styles.tsx +0 -40
  68. package/themes/franchises/src/components/BusinessesListing/index.tsx +0 -339
  69. package/themes/franchises/src/components/BusinessesListing/styles.tsx +0 -92
  70. package/themes/franchises/src/components/Cart/index.tsx +0 -298
  71. package/themes/franchises/src/components/Cart/styles.tsx +0 -28
  72. package/themes/franchises/src/components/CartContent/index.tsx +0 -60
  73. package/themes/franchises/src/components/CartContent/styles.tsx +0 -19
  74. package/themes/franchises/src/components/Checkout/index.tsx +0 -664
  75. package/themes/franchises/src/components/Checkout/styles.tsx +0 -89
  76. package/themes/franchises/src/components/CouponControl/index.tsx +0 -119
  77. package/themes/franchises/src/components/CouponControl/styles.tsx +0 -22
  78. package/themes/franchises/src/components/DriverTips/index.tsx +0 -167
  79. package/themes/franchises/src/components/DriverTips/styles.tsx +0 -63
  80. package/themes/franchises/src/components/FacebookLogin/index.tsx +0 -107
  81. package/themes/franchises/src/components/FacebookLogin/styles.tsx +0 -21
  82. package/themes/franchises/src/components/FloatingButton/index.tsx +0 -100
  83. package/themes/franchises/src/components/FloatingButton/styles.tsx +0 -26
  84. package/themes/franchises/src/components/ForgotPasswordForm/index.tsx +0 -156
  85. package/themes/franchises/src/components/ForgotPasswordForm/styles.tsx +0 -11
  86. package/themes/franchises/src/components/GPSButton/index.tsx +0 -84
  87. package/themes/franchises/src/components/GPSButton/styles.ts +0 -6
  88. package/themes/franchises/src/components/GoogleLogin/index.tsx +0 -122
  89. package/themes/franchises/src/components/GoogleLogin/styles.tsx +0 -23
  90. package/themes/franchises/src/components/GoogleMap/index.tsx +0 -229
  91. package/themes/franchises/src/components/Help/index.tsx +0 -56
  92. package/themes/franchises/src/components/Help/styles.tsx +0 -11
  93. package/themes/franchises/src/components/HelpAccountAndPayment/index.tsx +0 -68
  94. package/themes/franchises/src/components/HelpAccountAndPayment/styles.tsx +0 -6
  95. package/themes/franchises/src/components/HelpGuide/index.tsx +0 -67
  96. package/themes/franchises/src/components/HelpGuide/styles.tsx +0 -6
  97. package/themes/franchises/src/components/HelpOrder/index.tsx +0 -79
  98. package/themes/franchises/src/components/HelpOrder/styles.tsx +0 -6
  99. package/themes/franchises/src/components/Home/index.tsx +0 -102
  100. package/themes/franchises/src/components/Home/styles.tsx +0 -18
  101. package/themes/franchises/src/components/LanguageSelector/index.tsx +0 -98
  102. package/themes/franchises/src/components/LanguageSelector/styles.tsx +0 -7
  103. package/themes/franchises/src/components/LastOrder/index.tsx +0 -168
  104. package/themes/franchises/src/components/LastOrder/styles.tsx +0 -16
  105. package/themes/franchises/src/components/LastOrders/index.tsx +0 -104
  106. package/themes/franchises/src/components/LastOrders/styles.tsx +0 -17
  107. package/themes/franchises/src/components/LoginForm/index.tsx +0 -512
  108. package/themes/franchises/src/components/LoginForm/styles.tsx +0 -77
  109. package/themes/franchises/src/components/LogoutButton/index.tsx +0 -36
  110. package/themes/franchises/src/components/Messages/index.tsx +0 -359
  111. package/themes/franchises/src/components/Messages/styles.tsx +0 -20
  112. package/themes/franchises/src/components/MomentOption/index.tsx +0 -321
  113. package/themes/franchises/src/components/MomentOption/styles.tsx +0 -66
  114. package/themes/franchises/src/components/NavBar/index.tsx +0 -129
  115. package/themes/franchises/src/components/NotFoundSource/index.tsx +0 -50
  116. package/themes/franchises/src/components/NotFoundSource/styles.tsx +0 -16
  117. package/themes/franchises/src/components/Notifications/index.tsx +0 -120
  118. package/themes/franchises/src/components/Notifications/styles.ts +0 -21
  119. package/themes/franchises/src/components/OrderDetails/index.tsx +0 -820
  120. package/themes/franchises/src/components/OrderDetails/styles.tsx +0 -120
  121. package/themes/franchises/src/components/OrderSummary/index.tsx +0 -232
  122. package/themes/franchises/src/components/OrderSummary/styles.tsx +0 -41
  123. package/themes/franchises/src/components/OrderTypeSelector/index.tsx +0 -92
  124. package/themes/franchises/src/components/OrderTypeSelector/styles.tsx +0 -27
  125. package/themes/franchises/src/components/OrdersOption/index.tsx +0 -243
  126. package/themes/franchises/src/components/OrdersOption/styles.tsx +0 -5
  127. package/themes/franchises/src/components/PaymentOptionCash/index.tsx +0 -102
  128. package/themes/franchises/src/components/PaymentOptionCash/styles.tsx +0 -18
  129. package/themes/franchises/src/components/PaymentOptionStripe/index.tsx +0 -234
  130. package/themes/franchises/src/components/PaymentOptionStripe/styles.tsx +0 -71
  131. package/themes/franchises/src/components/PaymentOptions/index.tsx +0 -430
  132. package/themes/franchises/src/components/PaymentOptions/styles.tsx +0 -77
  133. package/themes/franchises/src/components/PhoneInputNumber/index.tsx +0 -127
  134. package/themes/franchises/src/components/PhoneInputNumber/styles.tsx +0 -3
  135. package/themes/franchises/src/components/PreviousOrders/index.tsx +0 -188
  136. package/themes/franchises/src/components/PreviousOrders/styles.tsx +0 -33
  137. package/themes/franchises/src/components/ProductForm/index.tsx +0 -695
  138. package/themes/franchises/src/components/ProductForm/styles.tsx +0 -78
  139. package/themes/franchises/src/components/ProductIngredient/index.tsx +0 -43
  140. package/themes/franchises/src/components/ProductIngredient/styles.tsx +0 -7
  141. package/themes/franchises/src/components/ProductItemAccordion/index.tsx +0 -276
  142. package/themes/franchises/src/components/ProductItemAccordion/styles.tsx +0 -57
  143. package/themes/franchises/src/components/ProductOption/index.tsx +0 -50
  144. package/themes/franchises/src/components/ProductOption/styles.tsx +0 -11
  145. package/themes/franchises/src/components/ProductOptionSubOption/index.tsx +0 -146
  146. package/themes/franchises/src/components/ProductOptionSubOption/styles.tsx +0 -32
  147. package/themes/franchises/src/components/ReviewDriver/index.tsx +0 -221
  148. package/themes/franchises/src/components/ReviewDriver/styles.tsx +0 -46
  149. package/themes/franchises/src/components/ReviewOrder/index.tsx +0 -325
  150. package/themes/franchises/src/components/ReviewOrder/styles.tsx +0 -46
  151. package/themes/franchises/src/components/ReviewProduct/index.tsx +0 -275
  152. package/themes/franchises/src/components/ReviewProduct/styles.tsx +0 -53
  153. package/themes/franchises/src/components/SearchBar/index.tsx +0 -139
  154. package/themes/franchises/src/components/SignupForm/index.tsx +0 -643
  155. package/themes/franchises/src/components/SignupForm/styles.tsx +0 -27
  156. package/themes/franchises/src/components/SingleProductCard/index.tsx +0 -124
  157. package/themes/franchises/src/components/SingleProductCard/styles.tsx +0 -23
  158. package/themes/franchises/src/components/StripeCardForm/index.tsx +0 -97
  159. package/themes/franchises/src/components/StripeCardForm/naked.tsx +0 -128
  160. package/themes/franchises/src/components/StripeCardForm/styles.tsx +0 -32
  161. package/themes/franchises/src/components/StripeCardsList/index.tsx +0 -182
  162. package/themes/franchises/src/components/StripeElementsForm/index.tsx +0 -204
  163. package/themes/franchises/src/components/StripeElementsForm/naked.tsx +0 -90
  164. package/themes/franchises/src/components/StripeElementsForm/styles.tsx +0 -13
  165. package/themes/franchises/src/components/StripeRedirectForm/index.tsx +0 -159
  166. package/themes/franchises/src/components/StripeRedirectForm/styles.tsx +0 -23
  167. package/themes/franchises/src/components/TagSelector/index.tsx +0 -94
  168. package/themes/franchises/src/components/TagSelector/styles.ts +0 -0
  169. package/themes/franchises/src/components/TaxInformation/index.tsx +0 -51
  170. package/themes/franchises/src/components/TaxInformation/styles.tsx +0 -9
  171. package/themes/franchises/src/components/UpsellingProducts/index.tsx +0 -222
  172. package/themes/franchises/src/components/UpsellingProducts/styles.tsx +0 -50
  173. package/themes/franchises/src/components/UserDetails/index.tsx +0 -134
  174. package/themes/franchises/src/components/UserDetails/styles.tsx +0 -26
  175. package/themes/franchises/src/components/UserFormDetails/index.tsx +0 -351
  176. package/themes/franchises/src/components/UserFormDetails/styles.tsx +0 -35
  177. package/themes/franchises/src/components/UserProfile/index.tsx +0 -179
  178. package/themes/franchises/src/components/UserProfile/styles.ts +0 -42
  179. package/themes/franchises/src/components/UserProfileForm/index.tsx +0 -253
  180. package/themes/franchises/src/components/UserProfileForm/styles.tsx +0 -29
  181. package/themes/franchises/src/components/VerifyPhone/index.tsx +0 -188
  182. package/themes/franchises/src/components/VerifyPhone/styles.tsx +0 -43
  183. package/themes/franchises/src/components/shared/OAlert.tsx +0 -55
  184. package/themes/franchises/src/components/shared/OBottomPopup.tsx +0 -73
  185. package/themes/franchises/src/components/shared/OBottomStickBar.tsx +0 -62
  186. package/themes/franchises/src/components/shared/OButton.tsx +0 -132
  187. package/themes/franchises/src/components/shared/ODropDown.tsx +0 -169
  188. package/themes/franchises/src/components/shared/OIcon.tsx +0 -53
  189. package/themes/franchises/src/components/shared/OIconButton.tsx +0 -127
  190. package/themes/franchises/src/components/shared/OIconText.tsx +0 -54
  191. package/themes/franchises/src/components/shared/OInput.tsx +0 -113
  192. package/themes/franchises/src/components/shared/OKeyButton.tsx +0 -35
  193. package/themes/franchises/src/components/shared/OModal.tsx +0 -172
  194. package/themes/franchises/src/components/shared/OText.tsx +0 -52
  195. package/themes/franchises/src/components/shared/OTextarea.tsx +0 -36
  196. package/themes/franchises/src/components/shared/OToast.tsx +0 -93
  197. package/themes/franchises/src/components/shared/OToggle.tsx +0 -158
  198. package/themes/franchises/src/components/shared/index.tsx +0 -29
  199. package/themes/franchises/src/config/constants.tsx +0 -57
  200. package/themes/franchises/src/layouts/Container.tsx +0 -23
  201. package/themes/franchises/src/layouts/SafeAreaContainer.tsx +0 -6
  202. package/themes/franchises/src/providers/AlertProvider.tsx +0 -43
  203. package/themes/franchises/src/providers/StoreUtil.tsx +0 -50
  204. package/themes/franchises/src/types/index.tsx +0 -445
  205. package/themes/franchises/src/utils/index.tsx +0 -222
@@ -1,189 +0,0 @@
1
- import React from 'react';
2
- import {
3
- BusinessController as BusinessSingleCard,
4
- useUtils,
5
- useOrder,
6
- useLanguage,
7
- } from 'ordering-components/native';
8
- import { useTheme } from 'styled-components/native';
9
- import { OIcon, OText } from '../shared';
10
- import { StyleSheet, useWindowDimensions, View } from 'react-native';
11
- import { BusinessControllerParams } from '../../types';
12
- import { convertHoursToMinutes } from '../../utils';
13
- import {
14
- Card,
15
- BusinessHero,
16
- BusinessContent,
17
- BusinessCategory,
18
- BusinessInfo,
19
- Metadata,
20
- BusinessState,
21
- BusinessLogo,
22
- Reviews,
23
- } from './styles';
24
-
25
- export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
26
- const { business, handleClick } = props;
27
- const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] =
28
- useUtils();
29
- const [orderState] = useOrder();
30
- const [, t] = useLanguage();
31
-
32
- const theme = useTheme();
33
-
34
-
35
- const styles = StyleSheet.create({
36
- headerStyle: {
37
- borderTopLeftRadius: 25,
38
- borderTopRightRadius: 25,
39
- },
40
- businessLogo: {
41
- alignSelf: 'center',
42
- },
43
- businessStateView: {
44
- backgroundColor: '#6C6C6C',
45
- borderRadius: 10,
46
- },
47
- businessStateText: {
48
- color: theme.colors.white,
49
- textAlign: 'center',
50
- padding: 8,
51
- },
52
- metadata: {
53
- marginRight: 20,
54
- marginLeft: 5,
55
- },
56
- metaField: {
57
- paddingEnd: 3,
58
- marginEnd: 2,
59
- },
60
- starIcon: {
61
- marginTop: 1.5,
62
- marginHorizontal: 5,
63
- },
64
- featured: {
65
- position: 'absolute',
66
- padding: 8,
67
- backgroundColor: theme.colors.backgroundDark,
68
- opacity: 0.8,
69
- borderRadius: 10,
70
- left: 20,
71
- top: 10,
72
- },
73
- closed: {
74
-
75
- },
76
- bullet: {
77
- flexDirection: 'row',
78
- justifyContent: 'flex-start',
79
- width: '100%',
80
- },
81
- });
82
-
83
- const types = ['food', 'laundry', 'alcohol', 'groceries'];
84
-
85
- const { width } = useWindowDimensions();
86
-
87
- const getBusinessType = () => {
88
- if (Object.keys(business).length <= 0) return t('GENERAL', 'General');
89
- const _types: any = [];
90
- types.forEach((type) => {
91
- if (business[type]) {
92
- _types.push(t(type.toUpperCase(), type));
93
- }
94
- });
95
- return _types.join(', ');
96
- };
97
-
98
- return (
99
- <Card activeOpacity={1} onPress={() => handleClick(business)}>
100
- <BusinessHero>
101
- <BusinessLogo>
102
- <OIcon
103
- url={optimizeImage(business?.logo, 'h_100,c_limit')}
104
- width={40}
105
- height={40}
106
- />
107
- </BusinessLogo>
108
- <BusinessContent style={{ width: width * 0.6 }}>
109
- <BusinessInfo>
110
- <OText size={12} ellipsizeMode={'tail'} numberOfLines={2}>
111
- {business?.name}
112
- </OText>
113
- {/* {business?.reviews?.total > 0 && (
114
- <Reviews>
115
- <IconAntDesign
116
- name="star"
117
- color={theme.colors.primary}
118
- size={16}
119
- style={styles.starIcon}
120
- />
121
- <OText>
122
- {parseNumber(business?.reviews?.total, { separator: '.' })}
123
- </OText>
124
- </Reviews>
125
- )} */}
126
- </BusinessInfo>
127
- {/* <BusinessCategory>
128
- <OText>{getBusinessType()}</OText>
129
- </BusinessCategory> */}
130
- <Metadata>
131
- {!business?.open ? (
132
- <View style={styles.closed}>
133
- <OText size={10} color={theme.colors.red}>
134
- {t('CLOSED', 'Closed')}
135
- </OText>
136
- </View>
137
- ) : (
138
- <View style={styles.bullet}>
139
- {/* <MaterialComIcon name="alarm" size={16} /> */}
140
- <OText size={10} color={theme.colors.textSecondary}>
141
- {t('DELIVERY_FEE', 'Delivery Fee')}
142
- </OText>
143
- <OText
144
- size={10}
145
- color={theme.colors.textSecondary}
146
- style={styles.metaField}>
147
- {parsePrice(business?.delivery_price) + ' \u2022'}
148
- </OText>
149
-
150
- <OText
151
- size={10}
152
- color={theme.colors.textSecondary}
153
- style={styles.metaField}>
154
- {convertHoursToMinutes(
155
- orderState?.options?.type === 1
156
- ? business?.delivery_time
157
- : business?.pickup_time,
158
- ) + ' \u2022'}
159
- </OText>
160
-
161
- <OText size={10} color={theme.colors.textSecondary}>
162
- {parseDistance(business?.distance)}
163
- </OText>
164
- </View>
165
- )}
166
- </Metadata>
167
- </BusinessContent>
168
- {/* <BusinessState>
169
- {!business?.open && (
170
- <View style={styles.businessStateView}>
171
- <OText color={theme.colors.white} size={20} style={styles.businessStateText}>
172
- {t('PREORDER', 'PREORDER')}
173
- </OText>
174
- </View>
175
- )}
176
- </BusinessState> */}
177
- </BusinessHero>
178
- </Card>
179
- );
180
- };
181
-
182
- export const BusinessFeaturedController = (props: BusinessControllerParams) => {
183
- const BusinessControllerProps = {
184
- ...props,
185
- UIComponent: BusinessFeaturedCtrlUI,
186
- };
187
-
188
- return <BusinessSingleCard {...BusinessControllerProps} />;
189
- };
@@ -1,50 +0,0 @@
1
- import styled, { css } from 'styled-components/native';
2
-
3
- export const Card = styled.TouchableOpacity`
4
- margin-vertical: 4px;
5
- height: 60px;
6
- overflow: hidden;
7
- `;
8
-
9
- export const BusinessHero = styled.View`
10
- height: 68px;
11
- flex-direction: row;
12
- position: relative;
13
- align-items: center;
14
- `;
15
-
16
- export const BusinessContent = styled.View`
17
- padding-horizontal: 10px;
18
- padding-vertical: 8px;
19
- `;
20
-
21
- export const BusinessInfo = styled.View`
22
- flex-direction: row;
23
- justify-content: space-between;
24
- align-items: center;
25
- `;
26
-
27
- export const BusinessCategory = styled.View`
28
- `;
29
-
30
- export const Metadata = styled.View`
31
- flex-direction: row;
32
- `;
33
-
34
- export const BusinessState = styled.View`
35
- margin-right: 20px;
36
- margin-top: 20px;
37
- `
38
-
39
- export const BusinessLogo = styled.View`
40
- width: 48px;
41
- height: 48px;
42
- border-radius: 7.6px;
43
- border: 1px solid ${(props: any) => props.theme.colors.border};
44
- align-items: center;
45
- justify-content: center;
46
- `
47
-
48
- export const Reviews = styled.View`
49
- flex-direction: row;
50
- `
@@ -1,202 +0,0 @@
1
- import React from 'react';
2
- import {
3
- BusinessInformation as BusinessInformationController,
4
- useLanguage, useUtils
5
- } from 'ordering-components/native';
6
- import { useTheme } from 'styled-components/native';
7
- import { OIcon, OText } from '../shared';
8
- import {
9
- BusinessInformationContainer,
10
- WrapMainContent,
11
- GrayBackground,
12
- WrapScheduleBlock,
13
- ScheduleBlock,
14
- WrapBusinessMap,
15
- InnerContent,
16
- DivideView,
17
- MediaWrapper,
18
- } from './styles';
19
- import { StyleSheet, View } from 'react-native';
20
- import { BusinessInformationParams } from '../../types';
21
- import { GoogleMap } from '../GoogleMap';
22
- import { WebView } from 'react-native-webview';
23
-
24
- const BusinessInformationUI = (props: BusinessInformationParams) => {
25
- const { businessState, businessSchedule, businessLocation } = props;
26
-
27
- const theme = useTheme();
28
- const [, t] = useLanguage();
29
- const [{ optimizeImage }] = useUtils();
30
- const daysOfWeek = [
31
- t('SUNDAY_ABBREVIATION', 'Sun'),
32
- t('MONDAY_ABBREVIATION', 'Mon'),
33
- t('TUESDAY_ABBREVIATION', 'Tues'),
34
- t('WEDNESDAY_ABBREVIATION', 'Wed'),
35
- t('THURSDAY_ABBREVIATION', 'Thur'),
36
- t('FRIDAY_ABBREVIATION', 'Fri'),
37
- t('SATURDAY_ABBREVIATION', 'Sat'),
38
- ];
39
- const scheduleFormatted = ({
40
- hour,
41
- minute,
42
- }: {
43
- hour: number | string;
44
- minute: number | string;
45
- }) => {
46
- const checkTime = (val: number | string) => (val < 10 ? `0${val}` : val);
47
- const zz = hour > 12 ? 'PM' : 'AM';
48
- const h = parseInt(`${hour}`);
49
- return `${h > 12 ? h - 12 : h}:${checkTime(minute)} ${zz}`;
50
- };
51
- const businessCoordinate = {
52
- lat: businessState?.business?.location?.lat,
53
- lng: businessState?.business?.location?.lng,
54
- };
55
- const businessImage = {
56
- uri: businessState?.business?.logo,
57
- };
58
- const businessMarker = {
59
- latlng: businessCoordinate,
60
- image: businessImage,
61
- };
62
-
63
- const bVideos = () => {
64
- const len = businessState?.business?.gallery?.length | 0;
65
- if (len == 0) return [];
66
- const vAry = businessState?.business?.gallery.filter(
67
- ({ type, file }: any) => type == 2 && file == null,
68
- );
69
- return vAry;
70
- };
71
- //{uri: 'https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4?_=1'}
72
- const bImages: any = () => {
73
- const len = businessState?.business?.gallery?.length | 0;
74
- if (len == 0) return [];
75
- const iAry = businessState?.business?.gallery.filter(
76
- ({ type, video }: any) => type == 1 && video == null,
77
- );
78
- return iAry;
79
- };
80
-
81
- return (
82
- <BusinessInformationContainer>
83
- <WrapMainContent contentContainerStyle={{}}>
84
- <InnerContent>
85
- <OText size={24} weight={'600'}>
86
- {businessState?.business?.name}
87
- </OText>
88
- <GrayBackground>
89
- <OText size={16} weight="500">
90
- {t('BUSINESS_LOCATION', 'Business Location')}
91
- </OText>
92
- </GrayBackground>
93
- {businessLocation.location && (
94
- <WrapBusinessMap style={styles.wrapMapStyle}>
95
- <GoogleMap
96
- readOnly
97
- location={businessLocation.location}
98
- markerTitle={businessState?.business?.name}
99
- />
100
- </WrapBusinessMap>
101
- )}
102
- <OText size={12} mBottom={20}>
103
- {businessState?.business?.address}
104
- </OText>
105
- <DivideView />
106
- <GrayBackground>
107
- <OText size={16} weight="500">
108
- {t('OPENING_TIME', 'Opening Time')}
109
- </OText>
110
- </GrayBackground>
111
- {businessSchedule && businessSchedule?.length > 0 && (
112
- <WrapScheduleBlock>
113
- {businessSchedule.map((schedule: any, i: number) => (
114
- <ScheduleBlock key={i}>
115
- <OText
116
- lineHeight={21}
117
- mBottom={16}
118
- size={14}
119
- weight={'600'}
120
- style={{ flexBasis: '20%' }}>
121
- {daysOfWeek[i].toUpperCase()}
122
- </OText>
123
- {schedule.enabled ? (
124
- <OText mBottom={16}>
125
- {scheduleFormatted(schedule.lapses[0].open) +
126
- ' - ' +
127
- scheduleFormatted(schedule.lapses[0].close)}
128
- </OText>
129
- ) : (
130
- <OText color={theme.colors.red} mBottom={16}>
131
- {t('CLOSED', 'Closed')}
132
- </OText>
133
- )}
134
- </ScheduleBlock>
135
- ))}
136
- </WrapScheduleBlock>
137
- )}
138
- {/* {businessState?.business?.gallery?.length > 0 && ( */}
139
- <>
140
- {bVideos().length > 0 && (
141
- <>
142
- <DivideView />
143
- <GrayBackground>
144
- <OText size={16} weight="500">
145
- {t('VIDEOS', 'Videos')}
146
- </OText>
147
- </GrayBackground>
148
- <MediaWrapper horizontal>
149
- {bVideos().map((v: any) => (
150
- <WebView
151
- key={`vid_id_${v.id}`}
152
- style={{ width: 210, height: 127, borderRadius: 7.6 }}
153
- javaScriptEnabled={true}
154
- domStorageEnabled={true}
155
- source={{ uri: v.video }}
156
- />
157
- ))}
158
- </MediaWrapper>
159
- </>
160
- )}
161
- {bImages().length > 0 && (
162
- <>
163
- <DivideView />
164
- <GrayBackground>
165
- <OText size={16} weight="500">
166
- {t('IMAGES', 'Images')}
167
- </OText>
168
- </GrayBackground>
169
- <MediaWrapper horizontal>
170
- {bImages().map((i: any) => (
171
- i.file != null &&
172
- <View key={i.id} style={{ width: 210, height: 127, borderRadius: 7.6, marginEnd: 20, overflow: 'hidden' }}>
173
- <OIcon cover url={optimizeImage(i?.file, 'h_150,c_limit')} width={210} height={127} />
174
- {/* <OText size={12} color={colors.red} style={{position: 'absolute'}}>{i.file}</OText> */}
175
- </View>
176
- ))}
177
- </MediaWrapper>
178
- </>
179
- )}
180
- </>
181
- {/* )} */}
182
- </InnerContent>
183
- </WrapMainContent>
184
- </BusinessInformationContainer>
185
- );
186
- };
187
-
188
- const styles = StyleSheet.create({
189
- wrapMapStyle: {
190
- overflow: 'hidden',
191
- marginTop: 15,
192
- marginBottom: 10,
193
- },
194
- });
195
-
196
- export const BusinessInformation = (props: BusinessInformationParams) => {
197
- const BusinessInformationProps = {
198
- ...props,
199
- UIComponent: BusinessInformationUI,
200
- };
201
- return <BusinessInformationController {...BusinessInformationProps} />;
202
- };
@@ -1,39 +0,0 @@
1
- import styled from 'styled-components/native'
2
-
3
- export const BusinessInformationContainer = styled.View`
4
- width: 100%;
5
- height: 100%;
6
- `
7
- export const GrayBackground = styled.View`
8
- margin-top: 27px;
9
- `
10
- export const WrapMainContent = styled.ScrollView`
11
- margin-top: 40px;
12
- `
13
- export const MediaWrapper = styled.ScrollView`
14
- margin-top: 16px;
15
- margin-bottom: 30px;
16
- min-height: 127px;
17
- height: 127px;
18
- `
19
- export const InnerContent = styled.View`
20
- padding: 20px 40px;
21
- `
22
- export const WrapScheduleBlock = styled.View`
23
- margin: 20px 0;
24
- `
25
- export const ScheduleBlock = styled.View`
26
- flex-direction: row;
27
- align-items: center;
28
- `
29
- export const WrapBusinessMap = styled.View`
30
- max-height: 200px;
31
- height: 200px;
32
- flex: 1;
33
- margin-horizontal: -40px;
34
- `
35
- export const DivideView = styled.View`
36
- height: 8px;
37
- background-color: ${(props: any) => props.theme.colors.backgroundGray100};
38
- margin-horizontal: -40px;
39
- `;
@@ -1,125 +0,0 @@
1
- import React, { useState, useRef, useEffect } from 'react';
2
- import { TouchableOpacity, View } from 'react-native';
3
- import { useOrder, useLanguage, useUtils } from 'ordering-components/native';
4
- import { useTheme } from 'styled-components/native';
5
- import {
6
- BIContainer,
7
- BIHeader,
8
- BIContent,
9
- BIInfo,
10
- BIContentInfo,
11
- BITotal,
12
- BIActions
13
- } from './styles';
14
- import { OAlert, OIcon, OText } from '../shared';
15
-
16
- export const BusinessItemAccordion = (props: any) => {
17
- const {
18
- cart,
19
- moment,
20
- handleClearProducts
21
- } = props
22
-
23
- const [orderState] = useOrder();
24
- const [, t] = useLanguage();
25
- const [{ parsePrice }] = useUtils();
26
- const theme = useTheme();
27
-
28
- const isCartPending = cart?.status === 2
29
- const isClosed = !cart?.valid_schedule
30
- const isProducts = cart?.products?.length
31
-
32
- const [isActive, setActiveState] = useState(false)
33
-
34
- useEffect(() => {
35
- const cartsArray = Object.values(orderState?.carts)
36
- const cartsLength = cartsArray.filter((cart: any) => cart.products.length > 0).length ?? 0
37
- if ((cartsLength === 1) && !isClosed) {
38
- setActiveState(true)
39
- }
40
- }, [orderState?.carts])
41
-
42
- return (
43
- <BIContainer isClosed={isClosed}>
44
- <BIHeader
45
- isClosed={isClosed}
46
- onPress={() => !isClosed ? setActiveState(!isActive) : isClosed}
47
- activeOpacity={1}
48
- >
49
- <BIInfo>
50
- <BIContentInfo>
51
- <OText size={16} lineHeight={24} weight={'600'}>{cart?.business?.name}</OText>
52
- {/* {orderState?.options?.type === 1 ? (
53
- <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
54
- <MaterialCommunityIcon
55
- name='clock-outline'
56
- size={24}
57
- />
58
- <OText>{convertHoursToMinutes(cart?.business?.delivery_time)}</OText>
59
- </View>
60
- ) : (
61
- <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
62
- <MaterialCommunityIcon
63
- name='clock-outline'
64
- size={24}
65
- />
66
- <OText>{convertHoursToMinutes(cart?.business?.pickup_time)}</OText>
67
- </View>
68
- )} */}
69
- <View style={{ flexDirection: 'row' }}>
70
- {props.onNavigationRedirect && !isClosed && (
71
- <>
72
- <TouchableOpacity onPress={() => props.onNavigationRedirect('Business', { store: cart?.business?.slug })}>
73
- <OText color={theme.colors.primary} size={12} lineHeight={18} style={{ textDecorationLine: 'underline' }}>{t('GO_TO_STORE', 'Go to store')}</OText>
74
- </TouchableOpacity>
75
- <OText color={theme.colors.textSecondary}>{' \u2022 '}</OText>
76
- </>
77
- )}
78
- {!isCartPending && !isClosed && (
79
- <OAlert
80
- title={t('DELETE_CART', 'Delete Cart')}
81
- message={t('QUESTION_DELETE_CART', 'Are you sure to you wants delete the selected cart')}
82
- onAccept={() => handleClearProducts()}
83
- >
84
- <OText size={12} lineHeight={18} color={theme.colors.red} style={{ textDecorationLine: 'underline' }}>{t('CLEAR_CART', 'Clear cart')}</OText>
85
- </OAlert>
86
- )}
87
- </View>
88
- </BIContentInfo>
89
- </BIInfo>
90
-
91
- {/* {!isClosed && !!isProducts && cart?.valid_products && cart?.total > 0 && (
92
- <BITotal>
93
- <OText color='#000'>{parsePrice(cart?.total)}</OText>
94
- <OText>{t('CART_TOTAL', 'Total')}</OText>
95
- </BITotal>
96
- )} */}
97
-
98
- {isClosed && (
99
- <BITotal>
100
- <OText color={theme.colors.red} size={12}>{t('CLOSED', 'Closed')} {moment}</OText>
101
- </BITotal>
102
- )}
103
-
104
- {!isClosed && !isProducts && (
105
- <BITotal>
106
- <OText>{t('NO_PRODUCTS', 'No products')}</OText>
107
- </BITotal>
108
- )}
109
-
110
- <BIActions>
111
-
112
- {!isClosed && !!isProducts && (
113
- <>
114
- <OIcon src={!isActive ? theme.images.general.drop_down : theme.images.general.drop_up} width={12} />
115
- </>
116
- )}
117
- </BIActions>
118
- </BIHeader>
119
-
120
- <BIContent style={{ display: isActive ? 'flex' : 'none' }}>
121
- {props.children}
122
- </BIContent>
123
- </BIContainer>
124
- )
125
- }
@@ -1,54 +0,0 @@
1
- import styled, { css } from 'styled-components/native';
2
-
3
- export const BIContainer = styled.View`
4
- display: flex;
5
- flex-direction: column;
6
- width: 100%;
7
- opacity: 1;
8
- border-radius: 7.6px;
9
- overflow: hidden;
10
-
11
- ${(props: any) => props.isClosed && css`
12
- opacity: 0.5;
13
- `}
14
- `
15
-
16
- export const BIHeader = styled.TouchableOpacity`
17
- display: flex;
18
- flex-direction: row;
19
- align-items: center;
20
- justify-content: space-between;
21
- position: relative;
22
- padding: 10px 0;
23
- background-color: ${(props: any) => props.theme.colors.white};
24
- `
25
-
26
- export const BIInfo = styled.View`
27
- display: flex;
28
- flex-direction: row;
29
- align-items: center;
30
- width: 55%;
31
- `
32
-
33
- export const BIContent = styled.View`
34
- `
35
-
36
- export const BIContentInfo = styled.View`
37
- justify-content: center;
38
- text-transform: capitalize;
39
- `
40
-
41
- export const BITotal = styled.View`
42
- width: 25%;
43
- display: flex;
44
- flex-direction: column;
45
- align-items: center;
46
- `
47
-
48
- export const BIActions = styled.View`
49
- max-width: 30%;
50
- display: flex;
51
- flex-direction: row;
52
- align-items: center;
53
- justify-content: flex-end;
54
- `