ordering-ui-react-native 0.21.50 → 0.21.51-release

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 (198) hide show
  1. package/package.json +8 -8
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/PaymentOptionsWebView/index.tsx +1 -0
  5. package/src/components/StripeMethodForm/index.tsx +6 -4
  6. package/src/components/VerifyPhone/styles.tsx +1 -2
  7. package/src/types/index.tsx +3 -1
  8. package/themes/business/index.tsx +4 -0
  9. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +4 -3
  10. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  11. package/themes/business/src/components/BusinessProductList/ProductList.tsx +72 -27
  12. package/themes/business/src/components/BusinessProductList/index.tsx +57 -25
  13. package/themes/business/src/components/DriverMap/index.tsx +36 -23
  14. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  15. package/themes/business/src/components/Home/index.tsx +5 -1
  16. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  17. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  18. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  19. package/themes/business/src/components/MapView/index.tsx +30 -15
  20. package/themes/business/src/components/NewOrderNotification/index.tsx +66 -26
  21. package/themes/business/src/components/OrderDetails/Business.tsx +52 -2
  22. package/themes/business/src/components/OrderDetails/Delivery.tsx +42 -23
  23. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +68 -61
  24. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +40 -20
  25. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  26. package/themes/business/src/components/OrderSummary/index.tsx +240 -76
  27. package/themes/business/src/components/OrdersOption/index.tsx +263 -135
  28. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  29. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +37 -40
  30. package/themes/business/src/components/PreviousOrders/OrderList.tsx +1 -1
  31. package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
  32. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  33. package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
  34. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  35. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  36. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  37. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  38. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  39. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  40. package/themes/business/src/components/Sessions/index.tsx +187 -0
  41. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  42. package/themes/business/src/components/StoresList/index.tsx +5 -3
  43. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  44. package/themes/business/src/components/UserProfileForm/index.tsx +106 -54
  45. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  46. package/themes/business/src/components/shared/OInput.tsx +2 -0
  47. package/themes/business/src/components/shared/OTextarea.tsx +8 -9
  48. package/themes/business/src/hooks/useLocation.tsx +5 -4
  49. package/themes/business/src/types/index.tsx +23 -5
  50. package/themes/business/src/utils/index.tsx +5 -0
  51. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  52. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  53. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  55. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  56. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  58. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  59. package/themes/original/index.tsx +6 -2
  60. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  61. package/themes/original/src/components/AddressForm/index.tsx +41 -15
  62. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  63. package/themes/original/src/components/AddressList/index.tsx +18 -4
  64. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  65. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  66. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  67. package/themes/original/src/components/BusinessBasicInformation/index.tsx +7 -10
  68. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  69. package/themes/original/src/components/BusinessController/index.tsx +18 -10
  70. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  71. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  72. package/themes/original/src/components/BusinessItemAccordion/index.tsx +4 -3
  73. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  74. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  75. package/themes/original/src/components/BusinessListingSearch/index.tsx +47 -358
  76. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  77. package/themes/original/src/components/BusinessPreorder/index.tsx +4 -3
  78. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  79. package/themes/original/src/components/BusinessProductsList/index.tsx +1 -1
  80. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  81. package/themes/original/src/components/BusinessProductsListing/index.tsx +30 -18
  82. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  83. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  84. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  85. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  86. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +1 -1
  87. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +7 -7
  88. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +2 -2
  89. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  90. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  91. package/themes/original/src/components/Cart/index.tsx +30 -9
  92. package/themes/original/src/components/CartContent/index.tsx +96 -58
  93. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  94. package/themes/original/src/components/Checkout/index.tsx +144 -62
  95. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  96. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  97. package/themes/original/src/components/DatePicker/index.tsx +18 -2
  98. package/themes/original/src/components/Favorite/index.tsx +9 -9
  99. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  100. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  101. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -0
  102. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  103. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  104. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  105. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  106. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  107. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  108. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  109. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  110. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  111. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  112. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  113. package/themes/original/src/components/GoogleMap/index.tsx +39 -18
  114. package/themes/original/src/components/Help/index.tsx +7 -0
  115. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +5 -0
  116. package/themes/original/src/components/HelpGuide/index.tsx +5 -0
  117. package/themes/original/src/components/HelpOrder/index.tsx +5 -0
  118. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  119. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  120. package/themes/original/src/components/Home/index.tsx +3 -8
  121. package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -16
  122. package/themes/original/src/components/LoginForm/index.tsx +9 -3
  123. package/themes/original/src/components/MessageListing/index.tsx +6 -0
  124. package/themes/original/src/components/Messages/index.tsx +8 -7
  125. package/themes/original/src/components/Messages/styles.tsx +1 -1
  126. package/themes/original/src/components/MomentOption/index.tsx +19 -4
  127. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  128. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
  129. package/themes/original/src/components/MultiCheckout/index.tsx +126 -61
  130. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  131. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
  132. package/themes/original/src/components/MyOrders/index.tsx +28 -28
  133. package/themes/original/src/components/NavBar/index.tsx +5 -0
  134. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  135. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  136. package/themes/original/src/components/Notifications/index.tsx +9 -8
  137. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  138. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +1 -1
  139. package/themes/original/src/components/OrderDetails/index.tsx +701 -662
  140. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  141. package/themes/original/src/components/OrderProgress/index.tsx +22 -3
  142. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  143. package/themes/original/src/components/OrderSummary/index.tsx +3 -1
  144. package/themes/original/src/components/OrderTypeSelector/index.tsx +10 -6
  145. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  146. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  147. package/themes/original/src/components/OrdersOption/index.tsx +3 -5
  148. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  149. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  150. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  151. package/themes/original/src/components/PaymentOptions/index.tsx +47 -4
  152. package/themes/original/src/components/PreviousOrders/index.tsx +2 -0
  153. package/themes/original/src/components/ProductForm/ActionButton.tsx +122 -0
  154. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  155. package/themes/original/src/components/ProductForm/index.tsx +170 -252
  156. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -44
  157. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  158. package/themes/original/src/components/ProductOptionSubOption/index.tsx +112 -91
  159. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  160. package/themes/original/src/components/Promotions/index.tsx +13 -11
  161. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  162. package/themes/original/src/components/ReviewDriver/index.tsx +5 -0
  163. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  164. package/themes/original/src/components/ReviewOrder/index.tsx +5 -0
  165. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  166. package/themes/original/src/components/ReviewProducts/index.tsx +5 -0
  167. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  168. package/themes/original/src/components/ServiceForm/index.tsx +1 -1
  169. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  170. package/themes/original/src/components/Sessions/index.tsx +5 -0
  171. package/themes/original/src/components/SignupForm/index.tsx +67 -59
  172. package/themes/original/src/components/SingleOrderCard/index.tsx +1 -1
  173. package/themes/original/src/components/SingleProductCard/index.tsx +4 -3
  174. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  175. package/themes/original/src/components/StripeCardsList/index.tsx +12 -35
  176. package/themes/original/src/components/StripeElementsForm/index.tsx +79 -59
  177. package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
  178. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  179. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +91 -0
  180. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  181. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  182. package/themes/original/src/components/UserFormDetails/index.tsx +100 -86
  183. package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
  184. package/themes/original/src/components/UserProfile/index.tsx +3 -2
  185. package/themes/original/src/components/UserProfileForm/index.tsx +5 -0
  186. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  187. package/themes/original/src/components/Wallets/index.tsx +7 -4
  188. package/themes/original/src/components/Wallets/styles.tsx +2 -1
  189. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  190. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  191. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  192. package/themes/original/src/components/shared/OButton.tsx +5 -5
  193. package/themes/original/src/components/shared/OInput.tsx +1 -4
  194. package/themes/original/src/components/shared/OModal.tsx +12 -14
  195. package/themes/original/src/layouts/Container.tsx +5 -3
  196. package/themes/original/src/types/index.tsx +6 -1
  197. package/themes/original/src/utils/index.tsx +12 -1
  198. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -0,0 +1,122 @@
1
+ import React from 'react'
2
+ import { useSession, useOrder, useLanguage, useConfig } from 'ordering-components/native'
3
+ import { useTheme } from 'styled-components/native'
4
+ import { TouchableOpacity, View } from 'react-native'
5
+ import { OButton, OText } from '../shared';
6
+ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
7
+
8
+ export const ActionButton = (props: any) => {
9
+ const {
10
+ navigation,
11
+ isHaveWeight,
12
+ isSoldOut,
13
+ maxProductQuantity,
14
+ productCart,
15
+ handleSaveProduct,
16
+ editMode,
17
+ product,
18
+ errors,
19
+ productAddedToCartLength,
20
+ handleRedirectLogin,
21
+ guestCheckoutEnabled,
22
+ orderTypeEnabled,
23
+ handleUpdateGuest,
24
+ actionStatus
25
+ } = props
26
+ const [, t] = useLanguage()
27
+ const [{ auth }] = useSession()
28
+ const [orderState] = useOrder()
29
+ const theme = useTheme()
30
+ const [{ configs }] = useConfig()
31
+ const unaddressedTypes = configs?.unaddressed_order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
32
+ const isAllowUnaddressOrderType = unaddressedTypes.includes(orderState?.options?.type)
33
+ const saveErrors =
34
+ orderState.loading ||
35
+ maxProductQuantity === 0 ||
36
+ Object.keys(errors)?.length > 0;
37
+ const buttonColor = saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order))
38
+
39
+
40
+
41
+ return (
42
+ <View
43
+ style={{
44
+ width: isHaveWeight ? '100%' : ((isSoldOut || maxProductQuantity <= 0) ? '60%' : '40%'),
45
+ }}>
46
+ {((productCart &&
47
+ auth &&
48
+ (orderState.options?.address_id || isAllowUnaddressOrderType)) || (isSoldOut || maxProductQuantity <= 0)) && (
49
+ <OButton
50
+ onClick={() => handleSaveProduct()}
51
+ imgRightSrc=""
52
+ text={`${orderState.loading
53
+ ? t('LOADING', 'Loading')
54
+ : (isSoldOut || maxProductQuantity <= 0)
55
+ ? t('SOLD_OUT', 'Sold out')
56
+ : editMode
57
+ ? t('UPDATE', 'Update')
58
+ : t('ADD', 'Add')
59
+ }`}
60
+ isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order))}
61
+ textStyle={{
62
+ color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
63
+ fontSize: orderState.loading || editMode ? 10 : 14
64
+ }}
65
+ bgColor={buttonColor ? theme.colors.lightGray : theme.colors.primary}
66
+ borderColor={!buttonColor ? theme.colors.white : theme.colors.primary}
67
+ style={{
68
+ opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
69
+ borderRadius: 7.6,
70
+ height: 44,
71
+ shadowOpacity: 0,
72
+ borderWidth: 1,
73
+ marginTop: isHaveWeight ? 10 : 0
74
+ }}
75
+ />
76
+ )}
77
+ {auth &&
78
+ !orderState.options?.address_id && !isAllowUnaddressOrderType &&
79
+ (orderState.loading ? (
80
+ <OButton
81
+ isDisabled
82
+ text={t('LOADING', 'Loading')}
83
+ imgRightSrc=""
84
+ textStyle={{ fontSize: 10 }}
85
+ />
86
+ ) : (
87
+ <OButton onClick={navigation.navigate('AddressList')} />
88
+ ))}
89
+ {!auth && (
90
+ <OButton
91
+ isDisabled={isSoldOut || maxProductQuantity <= 0}
92
+ onClick={() => handleRedirectLogin()}
93
+ text={
94
+ isSoldOut || maxProductQuantity <= 0
95
+ ? t('SOLD_OUT', 'Sold out')
96
+ : t('LOGIN_SIGNUP', 'Login / Sign Up')
97
+ }
98
+ imgRightSrc=""
99
+ textStyle={{ color: theme.colors.primary, fontSize: 13, textAlign: 'center' }}
100
+ style={{
101
+ height: 42,
102
+ borderColor: theme.colors.primary,
103
+ backgroundColor: theme.colors.white,
104
+ paddingLeft: 0,
105
+ paddingRight: 0
106
+ }}
107
+ />
108
+ )}
109
+ {!auth && guestCheckoutEnabled && orderTypeEnabled && (
110
+ <TouchableOpacity style={{ marginTop: 10 }} onPress={handleUpdateGuest}>
111
+ {actionStatus?.loading ? (
112
+ <Placeholder Animation={Fade}>
113
+ <PlaceholderLine height={20} />
114
+ </Placeholder>
115
+ ) : (
116
+ <OText color={theme.colors.primary} size={13} style={{ textAlign: 'center' }}>{t('AS_GUEST_USER', 'As guest user')}</OText>
117
+ )}
118
+ </TouchableOpacity>
119
+ )}
120
+ </View>
121
+ )
122
+ }
@@ -0,0 +1,56 @@
1
+ import React from 'react'
2
+ import { TouchableOpacity } from 'react-native';
3
+ import { useTheme } from 'styled-components/native';
4
+ import { OText } from '../shared';
5
+
6
+ export const ExtraOptions = (props : any) => {
7
+ const {
8
+ options,
9
+ setSelectedOpt,
10
+ scrollViewRef,
11
+ optionLayout,
12
+ editionsLayoutY,
13
+ styles,
14
+ selOpt
15
+ } = props
16
+
17
+ const theme = useTheme()
18
+
19
+ return (
20
+ <>
21
+ {options.map(({ id, name, respect_to, suboptions }: any) => (
22
+ <React.Fragment key={`cont_key_${id}`}>
23
+ {respect_to == null && suboptions?.length > 0 && (
24
+ <TouchableOpacity
25
+ key={`eopt_key_${id}`}
26
+ onPress={() => {
27
+ setSelectedOpt(id)
28
+ scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
29
+ y: optionLayout[`id:${id}`]?.y + editionsLayoutY - 50,
30
+ animated: true
31
+ })
32
+ }}
33
+ style={[
34
+ styles.extraItem,
35
+ {
36
+ borderBottomColor:
37
+ selOpt == id ? theme.colors.textNormal : theme.colors.backgroundPage,
38
+ },
39
+ ]}>
40
+ <OText
41
+ color={
42
+ selOpt == id ? theme.colors.textNormal : theme.colors.textSecondary
43
+ }
44
+ size={12}
45
+ weight={selOpt == id ? '600' : 'normal'}
46
+ style={{ maxWidth: 150 }}
47
+ numberOfLines={1}>
48
+ {name}
49
+ </OText>
50
+ </TouchableOpacity>
51
+ )}
52
+ </React.Fragment>
53
+ ))}
54
+ </>
55
+ )
56
+ }