ordering-ui-react-native 0.15.86 → 0.15.89

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.15.86",
3
+ "version": "0.15.89",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -135,9 +135,18 @@ const CheckoutUI = (props: any) => {
135
135
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
136
136
 
137
137
  const placeSpotTypes = [3, 4]
138
- const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
138
+ const businessConfigs = businessDetails?.business?.configs ?? []
139
+ const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
140
+ const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
141
+ const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled)
142
+
139
143
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
140
- const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash || cart?.subtotal < cart?.minimum || (placeSpotTypes.includes(options?.type) && !cart?.place)
144
+ const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) || placing || errorCash ||
145
+ cart?.subtotal < cart?.minimum || (placeSpotTypes.includes(options?.type) && !cart?.place) ||
146
+ (options.type === 1 &&
147
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
148
+ validationFields?.fields?.checkout?.driver_tip?.required &&
149
+ (Number(cart?.driver_tip) <= 0))
141
150
 
142
151
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
143
152
  ? JSON.parse(configs?.driver_tip_options?.value) || []
@@ -623,7 +632,7 @@ const CheckoutUI = (props: any) => {
623
632
 
624
633
  {!cartState.loading && cart && (
625
634
  <View>
626
- <ChErrors style={{ marginBottom: 0 }}>
635
+ <ChErrors style={{ marginBottom: 10 }}>
627
636
  {!cart?.valid_address && cart?.status !== 2 && (
628
637
  <OText
629
638
  color={theme.colors.error}
@@ -658,6 +667,17 @@ const CheckoutUI = (props: any) => {
658
667
  {t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')}
659
668
  </OText>
660
669
  )}
670
+ {options.type === 1 &&
671
+ validationFields?.fields?.checkout?.driver_tip?.enabled &&
672
+ validationFields?.fields?.checkout?.driver_tip?.required &&
673
+ (Number(cart?.driver_tip) <= 0) && (
674
+ <OText
675
+ color={theme.colors.error}
676
+ size={12}
677
+ >
678
+ {t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
679
+ </OText>
680
+ )}
661
681
  </ChErrors>
662
682
  </View>
663
683
  )}
@@ -25,7 +25,8 @@ const ForgotPasswordUI = (props: any) => {
25
25
  formState,
26
26
  handleButtonForgotPasswordClick,
27
27
  handleReCaptcha,
28
- enableReCaptcha
28
+ enableReCaptcha,
29
+ reCaptchaValue
29
30
  } = props;
30
31
  const [, t] = useLanguage();
31
32
  const [, { showToast }] = useToast();
@@ -58,9 +59,12 @@ const ForgotPasswordUI = (props: any) => {
58
59
  onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''))
59
60
  }
60
61
 
61
- const handleOpenRecaptcha = () => {
62
+ const handleOpenRecaptcha = () => {
62
63
  setRecaptchaVerified(false)
63
- if (!recaptchaConfig?.siteKey) {
64
+ handleReCaptcha(null)
65
+ if (reCaptchaValue) return
66
+
67
+ if (!recaptchaConfig?.siteKey) {
64
68
  showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
65
69
  return
66
70
  }
@@ -76,6 +80,11 @@ const ForgotPasswordUI = (props: any) => {
76
80
  handleReCaptcha(token)
77
81
  }
78
82
 
83
+ const handleRecaptchaExpire = () => {
84
+ setRecaptchaVerified(false)
85
+ handleReCaptcha(null)
86
+ }
87
+
79
88
  useEffect(() => {
80
89
  if (!formState.loading && emailSent) {
81
90
  if (formState.result?.error) {
@@ -192,7 +201,7 @@ const ForgotPasswordUI = (props: any) => {
192
201
  siteKey={recaptchaConfig?.siteKey}
193
202
  baseUrl={recaptchaConfig?.baseUrl}
194
203
  onVerify={onRecaptchaVerify}
195
- onExpire={() => setRecaptchaVerified(false)}
204
+ onExpire={handleRecaptchaExpire}
196
205
  />
197
206
  </>
198
207
  )}
@@ -109,7 +109,7 @@ const ProfileListUI = (props: ProfileParams) => {
109
109
 
110
110
  const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
111
111
 
112
- const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
112
+ const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (configs?.wallet_cash_enabled?.value === '1' || configs?.wallet_credit_point_enabled?.value === '1')
113
113
  const IsPromotionsEnabled = configs?.advanced_offers_module?.value === '1' || configs?.advanced_offers_module?.value === true
114
114
  const onRedirect = (route: string, params?: any) => {
115
115
  navigation.navigate(route, params)
@@ -61,7 +61,7 @@ const WalletsUI = (props: any) => {
61
61
 
62
62
  const [tabSelected, setTabSelected] = useState(isWalletCashEnabled ? 'cash' : 'credit_point')
63
63
 
64
- const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
64
+ const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
65
65
 
66
66
  const currentWalletSelected = (walletList.wallets?.length > 0 && walletList.wallets?.find((w: any) => w.type === tabSelected)) ?? null
67
67