ordering-ui-react-native 0.21.83 → 0.21.84-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 (168) hide show
  1. package/package.json +6 -7
  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 +9 -6
  10. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
  11. package/themes/business/src/components/BusinessController/index.tsx +8 -3
  12. package/themes/business/src/components/BusinessProductList/index.tsx +2 -1
  13. package/themes/business/src/components/Chat/index.tsx +3 -1
  14. package/themes/business/src/components/DriverMap/index.tsx +44 -27
  15. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  16. package/themes/business/src/components/Home/index.tsx +5 -1
  17. package/themes/business/src/components/LanguageSelector/index.tsx +2 -3
  18. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  19. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  20. package/themes/business/src/components/MapView/index.tsx +36 -17
  21. package/themes/business/src/components/NewOrderNotification/index.tsx +64 -28
  22. package/themes/business/src/components/OrderDetails/Business.tsx +65 -7
  23. package/themes/business/src/components/OrderDetails/Delivery.tsx +35 -20
  24. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +110 -40
  25. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +50 -24
  26. package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
  27. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +221 -0
  28. package/themes/business/src/components/OrderSummary/index.tsx +223 -73
  29. package/themes/business/src/components/OrdersListManager/index.tsx +9 -1
  30. package/themes/business/src/components/OrdersOption/index.tsx +247 -159
  31. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  32. package/themes/business/src/components/PreviousMessages/index.tsx +20 -3
  33. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +27 -16
  34. package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
  35. package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
  36. package/themes/business/src/components/PrinterEdition/index.tsx +431 -0
  37. package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
  38. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  39. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  40. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  41. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  42. package/themes/business/src/components/Sessions/index.tsx +187 -0
  43. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  44. package/themes/business/src/components/StoresList/index.tsx +2 -2
  45. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  46. package/themes/business/src/components/UserProfileForm/index.tsx +63 -30
  47. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  48. package/themes/business/src/components/shared/OInput.tsx +2 -0
  49. package/themes/business/src/components/shared/OTextarea.tsx +8 -9
  50. package/themes/business/src/hooks/useLocation.tsx +5 -4
  51. package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
  52. package/themes/business/src/types/index.tsx +23 -5
  53. package/themes/business/src/utils/index.tsx +19 -1
  54. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  55. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  56. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  57. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  58. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  59. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  60. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  61. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  62. package/themes/original/index.tsx +13 -1
  63. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  64. package/themes/original/src/components/AddressForm/index.tsx +32 -17
  65. package/themes/original/src/components/AddressList/index.tsx +8 -7
  66. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  67. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  68. package/themes/original/src/components/BusinessBasicInformation/index.tsx +5 -8
  69. package/themes/original/src/components/BusinessController/index.tsx +12 -7
  70. package/themes/original/src/components/BusinessItemAccordion/index.tsx +13 -5
  71. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +2 -3
  72. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +1 -3
  73. package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
  74. package/themes/original/src/components/BusinessPreorder/index.tsx +20 -15
  75. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +5 -5
  76. package/themes/original/src/components/BusinessProductsList/index.tsx +2 -2
  77. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  78. package/themes/original/src/components/BusinessProductsListing/index.tsx +18 -6
  79. package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
  80. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  81. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
  82. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  83. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  84. package/themes/original/src/components/Cart/index.tsx +43 -15
  85. package/themes/original/src/components/CartContent/index.tsx +21 -8
  86. package/themes/original/src/components/Checkout/index.tsx +108 -60
  87. package/themes/original/src/components/CitiesControl/index.tsx +0 -3
  88. package/themes/original/src/components/CouponControl/index.tsx +1 -3
  89. package/themes/original/src/components/DriverTips/index.tsx +1 -3
  90. package/themes/original/src/components/Favorite/index.tsx +1 -5
  91. package/themes/original/src/components/FavoriteList/index.tsx +0 -1
  92. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
  93. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  94. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  95. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
  96. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
  97. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
  98. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
  99. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  100. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  101. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +82 -0
  102. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  103. package/themes/original/src/components/GoogleMap/index.tsx +39 -18
  104. package/themes/original/src/components/Help/index.tsx +2 -0
  105. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  106. package/themes/original/src/components/Home/index.tsx +2 -10
  107. package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
  108. package/themes/original/src/components/LoginForm/index.tsx +4 -7
  109. package/themes/original/src/components/MessageListing/index.tsx +1 -0
  110. package/themes/original/src/components/Messages/index.tsx +8 -7
  111. package/themes/original/src/components/MomentOption/index.tsx +13 -2
  112. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
  113. package/themes/original/src/components/MultiCheckout/index.tsx +139 -87
  114. package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -1
  115. package/themes/original/src/components/MyOrders/index.tsx +21 -26
  116. package/themes/original/src/components/NavBar/index.tsx +4 -2
  117. package/themes/original/src/components/NetworkError/index.tsx +0 -5
  118. package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
  119. package/themes/original/src/components/OrderDetails/OrderEta.tsx +1 -1
  120. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +9 -9
  121. package/themes/original/src/components/OrderDetails/index.tsx +32 -13
  122. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  123. package/themes/original/src/components/OrderProgress/index.tsx +22 -3
  124. package/themes/original/src/components/OrderSummary/index.tsx +28 -9
  125. package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
  126. package/themes/original/src/components/OrdersOption/index.tsx +2 -4
  127. package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
  128. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  129. package/themes/original/src/components/PaymentOptions/index.tsx +17 -9
  130. package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
  131. package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
  132. package/themes/original/src/components/ProductForm/ActionButton.tsx +17 -20
  133. package/themes/original/src/components/ProductForm/index.tsx +107 -102
  134. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
  135. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  136. package/themes/original/src/components/ProductOptionSubOption/index.tsx +16 -8
  137. package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
  138. package/themes/original/src/components/Promotions/index.tsx +6 -9
  139. package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
  140. package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
  141. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  142. package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
  143. package/themes/original/src/components/ServiceForm/index.tsx +52 -54
  144. package/themes/original/src/components/Sessions/index.tsx +3 -3
  145. package/themes/original/src/components/SignupForm/index.tsx +86 -78
  146. package/themes/original/src/components/SingleOrderCard/index.tsx +7 -5
  147. package/themes/original/src/components/SingleProductCard/index.tsx +3 -4
  148. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  149. package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
  150. package/themes/original/src/components/StripeCardsList/index.tsx +10 -3
  151. package/themes/original/src/components/StripeElementsForm/index.tsx +77 -60
  152. package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
  153. package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
  154. package/themes/original/src/components/TaxInformation/index.tsx +3 -2
  155. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
  156. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
  157. package/themes/original/src/components/UserDetails/index.tsx +3 -2
  158. package/themes/original/src/components/UserFormDetails/index.tsx +155 -131
  159. package/themes/original/src/components/UserProfile/index.tsx +11 -2
  160. package/themes/original/src/components/Wallets/index.tsx +6 -3
  161. package/themes/original/src/components/WebsocketStatus/index.tsx +169 -0
  162. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  163. package/themes/original/src/components/shared/OAlert.tsx +2 -1
  164. package/themes/original/src/components/shared/OButton.tsx +5 -4
  165. package/themes/original/src/components/shared/OInput.tsx +4 -8
  166. package/themes/original/src/types/index.tsx +5 -1
  167. package/themes/original/src/utils/index.tsx +12 -1
  168. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -14,8 +14,7 @@ import {
14
14
 
15
15
  export const Favorite = (props: any) => {
16
16
  const {
17
- navigation,
18
- franchiseId
17
+ navigation
19
18
  } = props
20
19
  const [, t] = useLanguage()
21
20
  const theme = useTheme()
@@ -72,7 +71,6 @@ export const Favorite = (props: any) => {
72
71
  originalURL='business'
73
72
  location={`${orderState.options?.address?.location?.lat},${orderState.options?.address?.location?.lng}`}
74
73
  propsToFetch={['id', 'name', 'header', 'logo', 'location', 'address', 'ribbon', 'timezone', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug']}
75
- franchiseId={franchiseId}
76
74
  />
77
75
  )}
78
76
  {tabSelected === 'products' && (
@@ -81,7 +79,6 @@ export const Favorite = (props: any) => {
81
79
  originalURL='products'
82
80
  onNavigationRedirect={onRedirect}
83
81
  isProduct
84
- franchiseId={franchiseId}
85
82
  />
86
83
  )}
87
84
  {tabSelected === 'orders' && (
@@ -90,7 +87,6 @@ export const Favorite = (props: any) => {
90
87
  favoriteURL='favorite_orders'
91
88
  originalURL='orders'
92
89
  isOrder
93
- franchiseId={franchiseId}
94
90
  />
95
91
  )}
96
92
  </Container>
@@ -270,7 +270,6 @@ const FavoriteListUI = (props: FavoriteParams) => {
270
270
  onClick={() => getFavoriteList(pagination?.currentPage + 1)}
271
271
  text={t('LOAD_MORE_ITEMS', 'Load more items')}
272
272
  imgRightSrc={null}
273
- textStyle={{ color: theme.colors.white }}
274
273
  style={{ borderRadius: 7.6, shadowOpacity: 0, marginTop: 20 }}
275
274
  />
276
275
  </WrappButton>
@@ -64,7 +64,7 @@ const ForgotPasswordUI = (props: any) => {
64
64
  handleReCaptcha(null)
65
65
  if (reCaptchaValue) return
66
66
 
67
- if (!recaptchaConfig?.siteKey) {
67
+ if (!recaptchaConfig?.siteKey) {
68
68
  showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
69
69
  return
70
70
  }
@@ -73,7 +73,7 @@ const ForgotPasswordUI = (props: any) => {
73
73
  return
74
74
  }
75
75
  recaptchaRef.current.open()
76
- }
76
+ }
77
77
 
78
78
  const onRecaptchaVerify = (token: any) => {
79
79
  setRecaptchaVerified(true)
@@ -92,8 +92,8 @@ const ForgotPasswordUI = (props: any) => {
92
92
  formState.result?.result && showToast(
93
93
  ToastType.Error,
94
94
  typeof formState.result?.result === 'string'
95
- ? formState.result?.result
96
- : formState.result?.result[0]
95
+ ? formState.result?.result
96
+ : formState.result?.result[0]
97
97
  )
98
98
  return
99
99
  }
@@ -208,9 +208,7 @@ const ForgotPasswordUI = (props: any) => {
208
208
 
209
209
  <OButton
210
210
  text={emailSent && !formState.result?.error ? t('LINK_SEND_FORGOT_PASSWORD', 'Link Sent') : t('FRONT_RECOVER_PASSWORD', 'Recover Password')}
211
- textStyle={{ color: 'white' }}
212
- bgColor={emailSent && !formState.result?.error ? theme.colors.disabled : theme.colors.primary}
213
- borderColor={emailSent && !formState.result?.error ? theme.colors.disabled : theme.colors.primary}
211
+ isDisabled={formState.loading || emailSent && !formState.result?.error}
214
212
  isLoading={formState.loading}
215
213
  imgRightSrc={null}
216
214
  onClick={emailSent && !formState.result?.error ? () => { } : handleSubmit(onSubmit)}
@@ -0,0 +1,64 @@
1
+ import React, { useState } from 'react';
2
+ import { useLanguage } from 'ordering-components/native';
3
+ import { useTheme } from 'styled-components/native';
4
+ import { View } from 'react-native';
5
+ import { OText } from '../../shared'
6
+ import { VerticalGiftCardOrdersLayout } from '../VerticalGiftCardOrdersLayout'
7
+
8
+ import {
9
+ Container,
10
+ NoOrdersWrapper
11
+ } from './styles'
12
+
13
+ export const GiftCardOrdersList = (props: any) => {
14
+ const {
15
+ onNavigationRedirect
16
+ } = props;
17
+
18
+ const theme = useTheme();
19
+ const [, t] = useLanguage();
20
+ const [isEmptyPending, setIsEmptyPending] = useState(false);
21
+ const [isEmptySent, setIsEmptySent] = useState(false);
22
+ const [isEmptyRedeemed, setIsEmptyRedeemed] = useState(false);
23
+
24
+ return (
25
+ <Container>
26
+ <VerticalGiftCardOrdersLayout
27
+ title={t('PENDING', 'Pending')}
28
+ defaultStatus='pending'
29
+ setIsEmpty={setIsEmptyPending}
30
+ onNavigationRedirect={onNavigationRedirect}
31
+ />
32
+
33
+ {!isEmptyPending && (
34
+ <View
35
+ style={{
36
+ height: 8,
37
+ backgroundColor: theme.colors.backgroundGray100,
38
+ marginHorizontal: -40,
39
+ }}
40
+ />
41
+ )}
42
+
43
+ <VerticalGiftCardOrdersLayout
44
+ title={t('SENT', 'Sent')}
45
+ defaultStatus='sent'
46
+ setIsEmpty={setIsEmptySent}
47
+ onNavigationRedirect={onNavigationRedirect}
48
+ />
49
+
50
+ <VerticalGiftCardOrdersLayout
51
+ title={t('REDEEMED', 'Redeemed')}
52
+ defaultStatus='activated'
53
+ setIsEmpty={setIsEmptyRedeemed}
54
+ onNavigationRedirect={onNavigationRedirect}
55
+ />
56
+
57
+ {isEmptyPending && isEmptySent && isEmptyRedeemed && (
58
+ <NoOrdersWrapper>
59
+ <OText size={16} color={theme.colors.textNormal}>{t('YOU_DONT_HAVE_CARDS', 'You don\'t have cards')}</OText>
60
+ </NoOrdersWrapper>
61
+ )}
62
+ </Container>
63
+ )
64
+ }
@@ -0,0 +1,8 @@
1
+ import styled from 'styled-components/native';
2
+
3
+ export const Container = styled.View`
4
+ `
5
+
6
+ export const NoOrdersWrapper = styled.View`
7
+ margin-vertical: 20px;
8
+ `
@@ -12,7 +12,7 @@ import {
12
12
  Container
13
13
  } from './styles'
14
14
 
15
- export const GiftCardUI = React.memo((props: any) => {
15
+ export const GiftCardUI = React.memo((props: any) => {
16
16
  const {
17
17
  navigation
18
18
  } = props
@@ -57,9 +57,7 @@ export const GiftCardUI = React.memo((props: any) => {
57
57
  <OButton
58
58
  onClick={() => setOpenModal('purchase')}
59
59
  text={t('PURCHASE', 'Purchase')}
60
- bgColor={theme.colors.primary}
61
- borderColor={theme.colors.primary}
62
- textStyle={{ color: 'white', fontSize: 13 }}
60
+ textStyle={{ fontSize: 13 }}
63
61
  imgRightSrc={null}
64
62
  style={{ ...style.btnStyle, marginRight: 14 }}
65
63
  />
@@ -76,26 +74,26 @@ export const GiftCardUI = React.memo((props: any) => {
76
74
  </View>
77
75
 
78
76
  <OModal
79
- open={openModal === 'purchase'}
80
- onClose={() => setOpenModal(null)}
81
- entireModal
77
+ open={openModal === 'purchase'}
78
+ onClose={() => setOpenModal(null)}
79
+ entireModal
82
80
  customClose
83
- >
84
- <PurchaseGiftCard
81
+ >
82
+ <PurchaseGiftCard
85
83
  handleCustomGoToCheckout={handleCustomGoToCheckout}
86
84
  onClose={() => setOpenModal(null)}
87
85
  />
88
- </OModal>
86
+ </OModal>
89
87
  <OModal
90
- open={openModal === 'redeem'}
91
- onClose={() => setOpenModal(null)}
92
- entireModal
88
+ open={openModal === 'redeem'}
89
+ onClose={() => setOpenModal(null)}
90
+ entireModal
93
91
  customClose
94
- >
95
- <RedeemGiftCard
92
+ >
93
+ <RedeemGiftCard
96
94
  onClose={() => setOpenModal(null)}
97
95
  />
98
- </OModal>
96
+ </OModal>
99
97
  </Container>
100
98
  )
101
- })
99
+ })
@@ -58,12 +58,10 @@ const PurchaseGiftCardUI = (props: any) => {
58
58
  borderWidth: 0,
59
59
  width: 26,
60
60
  height: 26,
61
- backgroundColor: '#FFF',
62
- borderColor: '#FFF',
63
- shadowColor: '#FFF',
64
61
  paddingLeft: 0,
65
62
  paddingRight: 0,
66
63
  }}
64
+ useArrow
67
65
  onClick={onClose}
68
66
  icon={AntDesignIcon}
69
67
  iconProps={{
@@ -113,9 +111,7 @@ const PurchaseGiftCardUI = (props: any) => {
113
111
  <OButton
114
112
  onClick={() => handleAccept()}
115
113
  text={t('ACCEPT', 'Accept')}
116
- bgColor={theme.colors.primary}
117
- borderColor={theme.colors.primary}
118
- textStyle={{ color: 'white', fontSize: 13 }}
114
+ textStyle={{ fontSize: 13 }}
119
115
  imgRightSrc={null}
120
116
  style={style.btnStyle}
121
117
  isDisabled={!selectedProduct}
@@ -130,4 +126,4 @@ export const PurchaseGiftCard = (props: any) => {
130
126
  UIComponent: PurchaseGiftCardUI
131
127
  }
132
128
  return <PurchaseGiftCardController {...purchaseGiftCardProps} />
133
- }
129
+ }
@@ -36,10 +36,10 @@ const RedeemGiftCardUI = (props: any) => {
36
36
  marginTop: 20
37
37
  },
38
38
  inputStyle: {
39
- borderWidth: 1,
40
- borderColor: theme.colors.border,
41
- borderRadius: 7.6,
42
- },
39
+ borderWidth: 1,
40
+ borderColor: theme.colors.border,
41
+ borderRadius: 7.6,
42
+ },
43
43
  })
44
44
 
45
45
  const onSubmit = (values) => {
@@ -65,7 +65,7 @@ const RedeemGiftCardUI = (props: any) => {
65
65
  t('ERROR', 'Error'),
66
66
  stringError,
67
67
  [
68
- { text: t('OK', 'oK'), onPress: () => {} }
68
+ { text: t('OK', 'oK'), onPress: () => { } }
69
69
  ]
70
70
  )
71
71
  }
@@ -85,7 +85,7 @@ const RedeemGiftCardUI = (props: any) => {
85
85
  t('ERROR', 'Error'),
86
86
  stringError,
87
87
  [
88
- { text: t('OK', 'oK'), onPress: () => {} }
88
+ { text: t('OK', 'oK'), onPress: () => { } }
89
89
  ]
90
90
  )
91
91
  }, [actionState.error])
@@ -108,12 +108,10 @@ const RedeemGiftCardUI = (props: any) => {
108
108
  borderWidth: 0,
109
109
  width: 26,
110
110
  height: 26,
111
- backgroundColor: '#FFF',
112
- borderColor: '#FFF',
113
- shadowColor: '#FFF',
114
111
  paddingLeft: 0,
115
112
  paddingRight: 0,
116
113
  }}
114
+ useArrow
117
115
  onClick={onClose}
118
116
  icon={AntDesignIcon}
119
117
  iconProps={{
@@ -124,25 +122,25 @@ const RedeemGiftCardUI = (props: any) => {
124
122
  }
125
123
  }}
126
124
  />
127
- <OText color={theme.colors.textNormal} weight='bold' size={20} mLeft={10}>{t('REDEEM_GIFT_CARD', 'Redeem a gift card')}</OText>
125
+ <OText color={theme.colors.textNormal} weight='bold' size={20} mLeft={10}>{t('REDEEM_GIFT_CARD', 'Redeem a gift card')}</OText>
128
126
  </View>
129
127
  <FormController>
130
128
  <OText color={theme.colors.textNormal} size={14} mBottom={10}>{t('GIFT_CARD_CODE', 'Gift card code')}</OText>
131
129
  <Controller
132
130
  control={control}
133
131
  render={({ onChange, value }: any) => (
134
- <OInput
135
- placeholder='XXXX-XXXX-XXXX-XXXX'
136
- value={codeValue}
137
- onChange={(val: any) => {
138
- onChange(val)
139
- handleChangeCode(val)
140
- }}
141
- autoCapitalize='characters'
142
- autoCorrect={false}
143
- blurOnSubmit={false}
144
- style={style.inputStyle}
145
- />
132
+ <OInput
133
+ placeholder='XXXX-XXXX-XXXX-XXXX'
134
+ value={codeValue}
135
+ onChange={(val: any) => {
136
+ onChange(val)
137
+ handleChangeCode(val)
138
+ }}
139
+ autoCapitalize='characters'
140
+ autoCorrect={false}
141
+ blurOnSubmit={false}
142
+ style={style.inputStyle}
143
+ />
146
144
  )}
147
145
  name='code'
148
146
  rules={{
@@ -178,9 +176,7 @@ const RedeemGiftCardUI = (props: any) => {
178
176
  <OButton
179
177
  onClick={handleSubmit(onSubmit)}
180
178
  text={actionState?.loading ? t('LOADING', 'Loading') : t('APPLY_TO_YOUR_BALANCE', 'Apply to your balance')}
181
- bgColor={theme.colors.primary}
182
- borderColor={theme.colors.primary}
183
- textStyle={{ color: 'white', fontSize: 13 }}
179
+ textStyle={{ fontSize: 13 }}
184
180
  imgRightSrc={null}
185
181
  style={style.btnStyle}
186
182
  isDisabled={actionState.loading}
@@ -202,12 +198,10 @@ const RedeemGiftCardUI = (props: any) => {
202
198
  borderWidth: 0,
203
199
  width: 26,
204
200
  height: 26,
205
- backgroundColor: '#FFF',
206
- borderColor: '#FFF',
207
- shadowColor: '#FFF',
208
201
  paddingLeft: 0,
209
202
  paddingRight: 0,
210
203
  }}
204
+ useArrow
211
205
  onClick={onClose}
212
206
  icon={AntDesignIcon}
213
207
  iconProps={{
@@ -218,7 +212,7 @@ const RedeemGiftCardUI = (props: any) => {
218
212
  }
219
213
  }}
220
214
  />
221
- <OText color={theme.colors.textNormal} weight='bold' size={20} mLeft={10}>{t('GIFT_CARD', 'Gift card')}</OText>
215
+ <OText color={theme.colors.textNormal} weight='bold' size={20} mLeft={10}>{t('GIFT_CARD', 'Gift card')}</OText>
222
216
  </View>
223
217
  <View>
224
218
  <OText color={theme.colors.textNormal} size={14} mBottom={6}>{t('TYPE', 'Type')}: {redeemedGiftCard?.type}</OText>
@@ -232,9 +226,7 @@ const RedeemGiftCardUI = (props: any) => {
232
226
  onClose()
233
227
  }}
234
228
  text={t('OK', 'Ok')}
235
- bgColor={theme.colors.primary}
236
- borderColor={theme.colors.primary}
237
- textStyle={{ color: 'white', fontSize: 13 }}
229
+ textStyle={{ fontSize: 13 }}
238
230
  imgRightSrc={null}
239
231
  style={style.btnStyle}
240
232
  />
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect } from 'react'
2
2
  import { StyleSheet, Platform, Alert } from 'react-native';
3
- import { useLanguage, SendGiftCard as SendGiftCardController } from 'ordering-components/native';
3
+ import { useLanguage, SendGiftCard as SendGiftCardController } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import { OText, OButton, OInput } from '../../shared';
6
6
  import { useForm, Controller } from 'react-hook-form'
@@ -29,10 +29,10 @@ const SendGiftCardUI = (props: any) => {
29
29
  marginTop: 20
30
30
  },
31
31
  inputStyle: {
32
- borderWidth: 1,
33
- borderColor: theme.colors.border,
34
- borderRadius: 7.6,
35
- },
32
+ borderWidth: 1,
33
+ borderColor: theme.colors.border,
34
+ borderRadius: 7.6,
35
+ },
36
36
  })
37
37
 
38
38
  const onSubmit = (values) => {
@@ -50,7 +50,7 @@ const SendGiftCardUI = (props: any) => {
50
50
  t('ERROR', 'Error'),
51
51
  stringError,
52
52
  [
53
- { text: t('OK', 'oK'), onPress: () => {} }
53
+ { text: t('OK', 'oK'), onPress: () => { } }
54
54
  ]
55
55
  )
56
56
  }
@@ -144,9 +144,7 @@ const SendGiftCardUI = (props: any) => {
144
144
  <OButton
145
145
  onClick={handleSubmit(onSubmit)}
146
146
  text={actionState?.loading ? t('LOADING', 'Loading') : t('SEND_GIFT_CARD', 'Send gift card')}
147
- bgColor={theme.colors.primary}
148
- borderColor={theme.colors.primary}
149
- textStyle={{ color: 'white', fontSize: 13 }}
147
+ textStyle={{ fontSize: 13 }}
150
148
  imgRightSrc={null}
151
149
  style={style.btnStyle}
152
150
  isDisabled={actionState.loading}
@@ -0,0 +1,101 @@
1
+ import React from 'react';
2
+ import { useLanguage, useUtils, useEvent } from 'ordering-components/native';
3
+ import { useTheme } from 'styled-components/native';
4
+ import { View, StyleSheet } from 'react-native';
5
+ import {
6
+ Placeholder,
7
+ PlaceholderLine,
8
+ Fade
9
+ } from 'rn-placeholder';
10
+ import FastImage from 'react-native-fast-image';
11
+ import { OText } from '../../shared'
12
+
13
+ import {
14
+ CardContainer
15
+ } from './styles'
16
+
17
+ export const SingleGiftCard = (props: any) => {
18
+ const {
19
+ card,
20
+ isSkeleton,
21
+ onNavigationRedirect
22
+ } = props
23
+
24
+ const theme = useTheme()
25
+ const [, t] = useLanguage()
26
+ const [events] = useEvent()
27
+ const [{ parsePrice, optimizeImage, parseDate }] = useUtils()
28
+
29
+ const styles = StyleSheet.create({
30
+ logo: {
31
+ borderRadius: 8,
32
+ width: 64,
33
+ height: 64
34
+ },
35
+ innerContainer: {
36
+ flexDirection: 'row',
37
+ marginBottom: 24
38
+ }
39
+ });
40
+
41
+ const getGiftCardStatus = (status: string) => {
42
+ switch (status) {
43
+ case 'pending':
44
+ return t('PENDING', 'Pending')
45
+ case 'activated':
46
+ return t('REDEEMED', 'Redeemed')
47
+ default:
48
+ return status
49
+ }
50
+ }
51
+
52
+ const handleClickGiftCardOrder = (card: any) => {
53
+ onNavigationRedirect?.('OrderDetails', { orderId: card.order_product?.order_id });
54
+ }
55
+
56
+ return (
57
+ <CardContainer
58
+ activeOpacity={0.8}
59
+ onPress={() => handleClickGiftCardOrder(card)}
60
+ >
61
+ {isSkeleton ? (
62
+ <Placeholder style={{ marginBottom: 10 }} Animation={Fade}>
63
+ <View style={{ flexDirection: 'row' }}>
64
+ <View style={{ width: 64, marginRight: 14 }}>
65
+ <PlaceholderLine
66
+ width={100}
67
+ height={64}
68
+ style={{ marginRight: 10, marginBottom: 10 }}
69
+ />
70
+ </View>
71
+ <Placeholder style={{ paddingTop: 5 }}>
72
+ <PlaceholderLine width={60} style={{ marginBottom: 6}} />
73
+ <PlaceholderLine width={40} style={{ marginBottom: 6 }} />
74
+ <PlaceholderLine width={20} style={{ marginBottom: 0 }} />
75
+ </Placeholder>
76
+ </View>
77
+ </Placeholder>
78
+ ) : (
79
+ <View style={styles.innerContainer}>
80
+ <View>
81
+ <FastImage
82
+ style={styles.logo}
83
+ source={card?.order_product?.images ? {
84
+ uri: optimizeImage(card?.order_product?.images, 'h_86,c_limit')
85
+ } : theme?.images?.dummies?.businessLogo}
86
+ resizeMode={FastImage.resizeMode.cover}
87
+ />
88
+ </View>
89
+ <View style={{ flex: 1, marginLeft: 14 }}>
90
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
91
+ <OText size={12} lineHeight={18}>{card?.order_product?.name}</OText>
92
+ <OText size={12} lineHeight={18}>{parsePrice(card?.order_product?.price)}</OText>
93
+ </View>
94
+ <OText size={10} color={theme.colors.textSecondary} lineHeight={15}>{parseDate(card?.created_at)}</OText>
95
+ <OText size={10} color={theme.colors.primary}>{getGiftCardStatus(card?.status)}</OText>
96
+ </View>
97
+ </View>
98
+ )}
99
+ </CardContainer>
100
+ )
101
+ }
@@ -0,0 +1,4 @@
1
+ import styled from 'styled-components/native';
2
+
3
+ export const CardContainer = styled.TouchableOpacity`
4
+ `
@@ -0,0 +1,82 @@
1
+ import React, { useEffect } from 'react';
2
+ import { useLanguage, GiftCardOrdersList as GiftCardOrdersListController } from 'ordering-components/native';
3
+ import { useTheme } from 'styled-components/native';
4
+ import {
5
+ Placeholder,
6
+ PlaceholderLine,
7
+ Fade
8
+ } from 'rn-placeholder';
9
+ import { SingleGiftCard } from '../SingleGiftCard';
10
+ import { OButton, OText } from '../../shared';
11
+ import {
12
+ ProductsListContainer,
13
+ SingleGiftCardWrapper,
14
+ WrappButton
15
+ } from './styles'
16
+
17
+ const VerticalGiftCardOrdersLayoutUI = (props: any) => {
18
+ const {
19
+ giftCards,
20
+ paginationProps,
21
+ loadMoreOrders,
22
+ title,
23
+ setIsEmpty,
24
+ onNavigationRedirect
25
+ } = props
26
+
27
+ const theme = useTheme();
28
+ const [, t] = useLanguage()
29
+
30
+ useEffect(() => {
31
+ if (giftCards.loading) return
32
+ if (giftCards.list?.length === 0) setIsEmpty(true)
33
+ }, [giftCards])
34
+
35
+ return (
36
+ <ProductsListContainer>
37
+ {
38
+ giftCards.loading ? (
39
+ <Placeholder Animation={Fade} style={{ marginVertical: 16 }}>
40
+ <PlaceholderLine width={30} height={16} />
41
+ </Placeholder>
42
+ ) : giftCards.list?.length > 0 && (
43
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={24} style={{ marginTop: 24 }}>{title}</OText>
44
+ )}
45
+ {giftCards.list.map(card => (
46
+ <SingleGiftCardWrapper key={card.id}>
47
+ <SingleGiftCard
48
+ card={card}
49
+ onNavigationRedirect={onNavigationRedirect}
50
+ />
51
+ </SingleGiftCardWrapper>
52
+ ))}
53
+ {giftCards.loading && (
54
+ [...Array(10).keys()].map(i => (
55
+ <SingleGiftCardWrapper key={i}>
56
+ <SingleGiftCard
57
+ isSkeleton
58
+ />
59
+ </SingleGiftCardWrapper>
60
+ ))
61
+ )}
62
+ {paginationProps.totalPages && paginationProps.currentPage < paginationProps.totalPages && (
63
+ <WrappButton>
64
+ <OButton
65
+ onClick={loadMoreOrders}
66
+ text={t('LOAD_MORE_ORDERS', 'Load more orders')}
67
+ imgRightSrc={null}
68
+ style={{ borderRadius: 7.6, shadowOpacity: 0 }}
69
+ />
70
+ </WrappButton>
71
+ )}
72
+ </ProductsListContainer>
73
+ )
74
+ }
75
+
76
+ export const VerticalGiftCardOrdersLayout = (props: any) => {
77
+ const giftCardsProps = {
78
+ ...props,
79
+ UIComponent: VerticalGiftCardOrdersLayoutUI
80
+ }
81
+ return <GiftCardOrdersListController {...giftCardsProps} />
82
+ }
@@ -0,0 +1,9 @@
1
+ import styled from 'styled-components/native';
2
+
3
+ export const ProductsListContainer = styled.View`
4
+ `
5
+ export const WrappButton = styled.View`
6
+ margin-bottom: 24px;
7
+ `
8
+ export const SingleGiftCardWrapper = styled.View`
9
+ `