ordering-ui-react-native 0.21.59 → 0.21.61

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.21.59",
3
+ "version": "0.21.61",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -111,6 +111,7 @@ export const OrderContentComponent = (props: OrderContent) => {
111
111
  }
112
112
 
113
113
  const containsOnlyNumbers = (str: string) => {
114
+ str = str?.replace('+', '');
114
115
  return /^\d+$/.test(str);
115
116
  }
116
117
 
@@ -183,7 +184,7 @@ export const OrderContentComponent = (props: OrderContent) => {
183
184
  <OLink
184
185
  PressStyle={styles.linkWithIcons}
185
186
  url={`tel:${containsOnlyNumbers(order?.business?.cellphone) ? order?.business?.cellphone : 'invalid'}`}
186
- shorcut={`${order?.business?.cellphone}`}
187
+ shorcut={`${(!!order?.business?.country_phone_code && !order?.business?.cellphone?.includes('+')) ? '+' + order?.business?.country_phone_code : ''}${order?.business?.cellphone}`}
187
188
  TextStyle={styles.textLink}
188
189
  />
189
190
  </View>
@@ -193,8 +194,8 @@ export const OrderContentComponent = (props: OrderContent) => {
193
194
  <View style={styles.linkWithIcons}>
194
195
  <OLink
195
196
  PressStyle={styles.linkWithIcons}
196
- url={`tel:${containsOnlyNumbers(order?.business?.cellphone) ? order?.business?.phone : 'invalid'}`}
197
- shorcut={order?.business?.phone}
197
+ url={`tel:${containsOnlyNumbers(order?.business?.phone) ? order?.business?.phone : 'invalid'}`}
198
+ shorcut={`${(!!order?.business?.country_phone_code && !order?.business?.phone?.includes('+')) ? '+' + order?.business?.country_phone_code : ''}${order?.business?.phone}`}
198
199
  TextStyle={styles.textLink}
199
200
  />
200
201
  </View>
@@ -325,7 +326,7 @@ export const OrderContentComponent = (props: OrderContent) => {
325
326
  <OLink
326
327
  PressStyle={styles.linkWithIcons}
327
328
  url={`tel:${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${containsOnlyNumbers(order?.customer?.cellphone) ? order?.customer?.cellphone : 'invalid'}`}
328
- shorcut={`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
329
+ shorcut={`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''}${order?.customer?.cellphone}`}
329
330
  TextStyle={styles.textLink}
330
331
  />
331
332
  </View>
@@ -335,8 +336,8 @@ export const OrderContentComponent = (props: OrderContent) => {
335
336
  <View style={styles.linkWithIcons}>
336
337
  <OLink
337
338
  PressStyle={styles.linkWithIcons}
338
- url={`tel:${containsOnlyNumbers(order?.customer?.phone) ? order?.customer?.phone : 'invalid'}`}
339
- shorcut={order?.customer?.phone}
339
+ url={`tel:${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${containsOnlyNumbers(order?.customer?.phone) ? order?.customer?.phone : 'invalid'}`}
340
+ shorcut={`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''}${order?.customer?.phone}`}
340
341
  TextStyle={styles.textLink}
341
342
  />
342
343
  </View>
@@ -357,7 +357,7 @@ const CheckoutUI = (props: any) => {
357
357
 
358
358
  useEffect(() => {
359
359
  if (cart?.products?.length === 0) {
360
- if (cart?.business?.slug) {
360
+ if (cart?.business_id !== null) {
361
361
  onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null, fromMulti: props.fromMulti })
362
362
  } else {
363
363
  onNavigationRedirect('Wallets')