@kiosinc/commons-rn 0.15.7 → 0.16.0

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 (87) hide show
  1. package/README.md +20 -0
  2. package/lib/commonjs/constants/index.js +1 -1
  3. package/lib/commonjs/constants/index.js.map +1 -1
  4. package/lib/commonjs/hooks/index.js +0 -7
  5. package/lib/commonjs/hooks/index.js.map +1 -1
  6. package/lib/commonjs/hooks/useCustomer.js +0 -86
  7. package/lib/commonjs/hooks/useCustomer.js.map +1 -1
  8. package/lib/commonjs/providers/customer/CustomerProvider.js +214 -0
  9. package/lib/commonjs/providers/customer/CustomerProvider.js.map +1 -0
  10. package/lib/commonjs/providers/customer/README.md +122 -0
  11. package/lib/commonjs/providers/customer/classifyLoyaltyError.js +19 -0
  12. package/lib/commonjs/providers/customer/classifyLoyaltyError.js.map +1 -0
  13. package/lib/commonjs/providers/customer/index.js +27 -0
  14. package/lib/commonjs/providers/customer/index.js.map +1 -0
  15. package/lib/commonjs/providers/customer/types.js +2 -0
  16. package/lib/commonjs/providers/customer/types.js.map +1 -0
  17. package/lib/commonjs/providers/customer/useLoyalty.js +25 -0
  18. package/lib/commonjs/providers/customer/useLoyalty.js.map +1 -0
  19. package/lib/commonjs/providers/customer/useSquareCustomer.js +21 -0
  20. package/lib/commonjs/providers/customer/useSquareCustomer.js.map +1 -0
  21. package/lib/commonjs/providers/index.js +19 -0
  22. package/lib/commonjs/providers/index.js.map +1 -1
  23. package/lib/commonjs/screens/SavedCards/SavedCards.js +9 -4
  24. package/lib/commonjs/screens/SavedCards/SavedCards.js.map +1 -1
  25. package/lib/module/constants/index.js +1 -1
  26. package/lib/module/constants/index.js.map +1 -1
  27. package/lib/module/hooks/index.js +0 -1
  28. package/lib/module/hooks/index.js.map +1 -1
  29. package/lib/module/hooks/useCustomer.js +1 -87
  30. package/lib/module/hooks/useCustomer.js.map +1 -1
  31. package/lib/module/providers/customer/CustomerProvider.js +204 -0
  32. package/lib/module/providers/customer/CustomerProvider.js.map +1 -0
  33. package/lib/module/providers/customer/README.md +122 -0
  34. package/lib/module/providers/customer/classifyLoyaltyError.js +13 -0
  35. package/lib/module/providers/customer/classifyLoyaltyError.js.map +1 -0
  36. package/lib/module/providers/customer/index.js +4 -0
  37. package/lib/module/providers/customer/index.js.map +1 -0
  38. package/lib/module/providers/customer/types.js +2 -0
  39. package/lib/module/providers/customer/types.js.map +1 -0
  40. package/lib/module/providers/customer/useLoyalty.js +18 -0
  41. package/lib/module/providers/customer/useLoyalty.js.map +1 -0
  42. package/lib/module/providers/customer/useSquareCustomer.js +14 -0
  43. package/lib/module/providers/customer/useSquareCustomer.js.map +1 -0
  44. package/lib/module/providers/index.js +1 -0
  45. package/lib/module/providers/index.js.map +1 -1
  46. package/lib/module/screens/SavedCards/SavedCards.js +10 -5
  47. package/lib/module/screens/SavedCards/SavedCards.js.map +1 -1
  48. package/lib/typescript/src/constants/index.d.ts.map +1 -1
  49. package/lib/typescript/src/hooks/index.d.ts +0 -1
  50. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  51. package/lib/typescript/src/hooks/useCustomer.d.ts +0 -13
  52. package/lib/typescript/src/hooks/useCustomer.d.ts.map +1 -1
  53. package/lib/typescript/src/providers/customer/CustomerProvider.d.ts +9 -0
  54. package/lib/typescript/src/providers/customer/CustomerProvider.d.ts.map +1 -0
  55. package/lib/typescript/src/providers/customer/classifyLoyaltyError.d.ts +3 -0
  56. package/lib/typescript/src/providers/customer/classifyLoyaltyError.d.ts.map +1 -0
  57. package/lib/typescript/src/providers/customer/index.d.ts +5 -0
  58. package/lib/typescript/src/providers/customer/index.d.ts.map +1 -0
  59. package/lib/typescript/src/providers/customer/types.d.ts +25 -0
  60. package/lib/typescript/src/providers/customer/types.d.ts.map +1 -0
  61. package/lib/typescript/src/providers/customer/useLoyalty.d.ts +11 -0
  62. package/lib/typescript/src/providers/customer/useLoyalty.d.ts.map +1 -0
  63. package/lib/typescript/src/providers/customer/useSquareCustomer.d.ts +7 -0
  64. package/lib/typescript/src/providers/customer/useSquareCustomer.d.ts.map +1 -0
  65. package/lib/typescript/src/providers/index.d.ts +2 -0
  66. package/lib/typescript/src/providers/index.d.ts.map +1 -1
  67. package/lib/typescript/src/screens/SavedCards/SavedCards.d.ts.map +1 -1
  68. package/package.json +1 -1
  69. package/src/constants/index.ts +1 -1
  70. package/src/hooks/index.ts +0 -1
  71. package/src/hooks/useCustomer.ts +0 -129
  72. package/src/providers/customer/CustomerProvider.tsx +272 -0
  73. package/src/providers/customer/README.md +122 -0
  74. package/src/providers/customer/classifyLoyaltyError.ts +25 -0
  75. package/src/providers/customer/index.ts +4 -0
  76. package/src/providers/customer/types.ts +34 -0
  77. package/src/providers/customer/useLoyalty.ts +27 -0
  78. package/src/providers/customer/useSquareCustomer.ts +19 -0
  79. package/src/providers/index.ts +6 -0
  80. package/src/screens/SavedCards/SavedCards.tsx +10 -3
  81. package/lib/commonjs/hooks/useCheckCustomer.js +0 -57
  82. package/lib/commonjs/hooks/useCheckCustomer.js.map +0 -1
  83. package/lib/module/hooks/useCheckCustomer.js +0 -49
  84. package/lib/module/hooks/useCheckCustomer.js.map +0 -1
  85. package/lib/typescript/src/hooks/useCheckCustomer.d.ts +0 -5
  86. package/lib/typescript/src/hooks/useCheckCustomer.d.ts.map +0 -1
  87. package/src/hooks/useCheckCustomer.ts +0 -49
@@ -0,0 +1,122 @@
1
+ # CustomerProvider
2
+
3
+ Owns the full customer + loyalty lifecycle. Replaces the old scattered hooks (`useCheckCustomer`, `useFetchSquareLoyalty`, `useConnectSquareLoyalty`, `useFetchSquareProgram`, `useConnectSquareCustomer`).
4
+
5
+ ## What it does
6
+
7
+ 1. Subscribes to Firebase auth — starts setup on login, clears state on logout
8
+ 2. Ensures the customer record exists (`getCustomer` / `createCustomer`)
9
+ 3. Ensures the Square customer program doc exists (`connectSquareCustomer`) — guarded by a module-level `Set` so it never fires twice for the same `uid:businessId`, even across remounts
10
+ 4. Fetches loyalty data — on "does not have loyalty":
11
+ - `autoEnroll=true` (kiosk): calls `connectSquareLoyalty` automatically
12
+ - `autoEnroll=false` (Gusteau): sets `not_enrolled`, waits for `enroll()` call
13
+ 5. Classifies all `connectSquareLoyalty` errors so checkout is never blocked
14
+
15
+ ## Setup
16
+
17
+ Wrap your authenticated navigator with the provider:
18
+
19
+ ```tsx
20
+ import { CustomerProvider } from '@kiosinc/commons-rn';
21
+
22
+ // autoEnroll=true for kiosk (auto-enroll on login)
23
+ // autoEnroll=false for Gusteau (manual enroll via button)
24
+ <CustomerProvider
25
+ autoEnroll
26
+ loyaltyEnabled={isSquareLoyaltyEnabled}>
27
+ <YourNavigator />
28
+ </CustomerProvider>
29
+ ```
30
+
31
+ `businessId` is read internally from MMKV (`MMKV_KEYS.BUSINESS_ID`) — no prop needed.
32
+
33
+ ## Consumer hooks
34
+
35
+ ### `useSquareCustomer()` — for checkout
36
+
37
+ ```tsx
38
+ import { useSquareCustomer } from '@kiosinc/commons-rn';
39
+
40
+ const { squareCustomerId, customerStatus, customerError } = useSquareCustomer();
41
+ ```
42
+
43
+ | Field | Type | Description |
44
+ |---|---|---|
45
+ | `squareCustomerId` | `string \| null` | Pass to `useOptimizedCheckout`. Available even if loyalty is broken. |
46
+ | `customerStatus` | `CustomerStatus` | `idle \| loading \| ready \| error` |
47
+ | `customerError` | `string \| null` | Error message if setup failed |
48
+
49
+ ### `useLoyalty()` — for rewards screens
50
+
51
+ ```tsx
52
+ import { useLoyalty } from '@kiosinc/commons-rn';
53
+
54
+ const {
55
+ loyaltyStatus,
56
+ isReady,
57
+ loyalty,
58
+ points,
59
+ loyaltyError,
60
+ enroll,
61
+ refetchLoyalty,
62
+ } = useLoyalty();
63
+ ```
64
+
65
+ | Field | Type | Description |
66
+ |---|---|---|
67
+ | `loyaltyStatus` | `LoyaltyStatus` | See status machine below |
68
+ | `isReady` | `boolean` | `loyaltyStatus === 'ready'` |
69
+ | `loyalty` | `CustomerLoyalty \| null` | Full loyalty object |
70
+ | `points` | `number` | Available points (0 if not ready) |
71
+ | `loyaltyError` | `string \| null` | Show on error/no_loyalty screens |
72
+ | `enroll()` | `() => void` | Gusteau: call from "Join" button. Noop if already enrolling or autoEnroll=true. |
73
+ | `refetchLoyalty()` | `() => void` | Call after payment to refresh points |
74
+
75
+ ## Status machines
76
+
77
+ ### `customerStatus`
78
+ ```
79
+ idle → loading → ready
80
+ → error
81
+ ```
82
+
83
+ ### `loyaltyStatus`
84
+ ```
85
+ idle → loading → ready
86
+ → not_enrolled (autoEnroll=false, no loyalty account)
87
+ → enrolling → ready
88
+ → error
89
+ → no_loyalty (merchant has no loyalty program)
90
+ → error (duplicate customer docs, etc.)
91
+ ```
92
+
93
+ ## Error handling
94
+
95
+ `connectSquareLoyalty` errors are classified automatically:
96
+
97
+ | Error message | Outcome |
98
+ |---|---|
99
+ | contains `already has` / `ALREADY_EXISTS` / `already exists` | Refetch → `ready` |
100
+ | contains `More than one` / `more than one` | `loyaltyStatus = 'error'`, message: "Multiple account records found. Contact support." |
101
+ | contains `Square Loyalty not enabled` / `not enabled` | `loyaltyStatus = 'no_loyalty'` |
102
+ | anything else | `loyaltyStatus = 'error'`, raw message shown |
103
+
104
+ ## Session reset
105
+
106
+ Provider resets automatically on Firebase auth state change (logout). For kiosk sleep/wake cycles that don't sign out Firebase, sign the user out via `firebase().auth().signOut()` to trigger a full reset.
107
+
108
+ ## Gusteau usage
109
+
110
+ ```tsx
111
+ // In your business selector screen:
112
+ <CustomerProvider autoEnroll={false} loyaltyEnabled={true}>
113
+ <AppNavigator />
114
+ </CustomerProvider>
115
+
116
+ // In your loyalty join screen:
117
+ const { loyaltyStatus, enroll } = useLoyalty();
118
+
119
+ if (loyaltyStatus === 'not_enrolled') {
120
+ return <Button onPress={enroll} title="Join Loyalty Program" />;
121
+ }
122
+ ```
@@ -0,0 +1,13 @@
1
+ export function classifyLoyaltyError(message) {
2
+ if (message.includes('already has') || message.includes('ALREADY_EXISTS') || message.toLowerCase().includes('already exists')) {
3
+ return 'refetch';
4
+ }
5
+ if (message.includes('More than one') || message.includes('more than one')) {
6
+ return 'duplicate';
7
+ }
8
+ if (message.includes('Square Loyalty not enabled') || message.toLowerCase().includes('not enabled')) {
9
+ return 'no_loyalty';
10
+ }
11
+ return 'error';
12
+ }
13
+ //# sourceMappingURL=classifyLoyaltyError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["classifyLoyaltyError","message","includes","toLowerCase"],"sourceRoot":"../../../../src","sources":["providers/customer/classifyLoyaltyError.ts"],"mappings":"AAMA,OAAO,SAASA,oBAAoBA,CAACC,OAAe,EAAyB;EAC3E,IACEA,OAAO,CAACC,QAAQ,CAAC,aAAa,CAAC,IAC/BD,OAAO,CAACC,QAAQ,CAAC,gBAAgB,CAAC,IAClCD,OAAO,CAACE,WAAW,CAAC,CAAC,CAACD,QAAQ,CAAC,gBAAgB,CAAC,EAChD;IACA,OAAO,SAAS;EAClB;EACA,IAAID,OAAO,CAACC,QAAQ,CAAC,eAAe,CAAC,IAAID,OAAO,CAACC,QAAQ,CAAC,eAAe,CAAC,EAAE;IAC1E,OAAO,WAAW;EACpB;EACA,IACED,OAAO,CAACC,QAAQ,CAAC,4BAA4B,CAAC,IAC9CD,OAAO,CAACE,WAAW,CAAC,CAAC,CAACD,QAAQ,CAAC,aAAa,CAAC,EAC7C;IACA,OAAO,YAAY;EACrB;EACA,OAAO,OAAO;AAChB"}
@@ -0,0 +1,4 @@
1
+ export { CustomerProvider } from './CustomerProvider';
2
+ export { useSquareCustomer } from './useSquareCustomer';
3
+ export { useLoyalty } from './useLoyalty';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CustomerProvider","useSquareCustomer","useLoyalty"],"sourceRoot":"../../../../src","sources":["providers/customer/index.ts"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,UAAU,QAAQ,cAAc"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["providers/customer/types.ts"],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { useContext } from 'react';
2
+ import { CustomerContext } from './CustomerProvider';
3
+ export const useLoyalty = () => {
4
+ const ctx = useContext(CustomerContext);
5
+ if (!ctx) {
6
+ throw new Error('useLoyalty must be used within CustomerProvider');
7
+ }
8
+ return {
9
+ loyaltyStatus: ctx.loyaltyStatus,
10
+ isReady: ctx.loyaltyStatus === 'ready',
11
+ loyalty: ctx.loyalty,
12
+ points: ctx.points,
13
+ loyaltyError: ctx.loyaltyError,
14
+ enroll: ctx.enroll,
15
+ refetchLoyalty: ctx.refetchLoyalty
16
+ };
17
+ };
18
+ //# sourceMappingURL=useLoyalty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useContext","CustomerContext","useLoyalty","ctx","Error","loyaltyStatus","isReady","loyalty","points","loyaltyError","enroll","refetchLoyalty"],"sourceRoot":"../../../../src","sources":["providers/customer/useLoyalty.ts"],"mappings":"AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,eAAe,QAAQ,oBAAoB;AAGpD,OAAO,MAAMC,UAAU,GAAGA,CAAA,KAQrB;EACH,MAAMC,GAAG,GAAGH,UAAU,CAACC,eAAe,CAAC;EACvC,IAAI,CAACE,GAAG,EAAE;IACR,MAAM,IAAIC,KAAK,CAAC,iDAAiD,CAAC;EACpE;EACA,OAAO;IACLC,aAAa,EAAEF,GAAG,CAACE,aAAa;IAChCC,OAAO,EAAEH,GAAG,CAACE,aAAa,KAAK,OAAO;IACtCE,OAAO,EAAEJ,GAAG,CAACI,OAAO;IACpBC,MAAM,EAAEL,GAAG,CAACK,MAAM;IAClBC,YAAY,EAAEN,GAAG,CAACM,YAAY;IAC9BC,MAAM,EAAEP,GAAG,CAACO,MAAM;IAClBC,cAAc,EAAER,GAAG,CAACQ;EACtB,CAAC;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { useContext } from 'react';
2
+ import { CustomerContext } from './CustomerProvider';
3
+ export const useSquareCustomer = () => {
4
+ const ctx = useContext(CustomerContext);
5
+ if (!ctx) {
6
+ throw new Error('useSquareCustomer must be used within CustomerProvider');
7
+ }
8
+ return {
9
+ customerStatus: ctx.customerStatus,
10
+ squareCustomerId: ctx.squareCustomerId,
11
+ customerError: ctx.customerError
12
+ };
13
+ };
14
+ //# sourceMappingURL=useSquareCustomer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useContext","CustomerContext","useSquareCustomer","ctx","Error","customerStatus","squareCustomerId","customerError"],"sourceRoot":"../../../../src","sources":["providers/customer/useSquareCustomer.ts"],"mappings":"AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,eAAe,QAAQ,oBAAoB;AAGpD,OAAO,MAAMC,iBAAiB,GAAGA,CAAA,KAI5B;EACH,MAAMC,GAAG,GAAGH,UAAU,CAACC,eAAe,CAAC;EACvC,IAAI,CAACE,GAAG,EAAE;IACR,MAAM,IAAIC,KAAK,CAAC,wDAAwD,CAAC;EAC3E;EACA,OAAO;IACLC,cAAc,EAAEF,GAAG,CAACE,cAAc;IAClCC,gBAAgB,EAAEH,GAAG,CAACG,gBAAgB;IACtCC,aAAa,EAAEJ,GAAG,CAACI;EACrB,CAAC;AACH,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { changeUser } from './authentication/actions/authentication.actions';
2
2
  export { useAuthentication, useAuthenticationDispatch, AuthenticationProvider } from './authentication/AuthenticationProvider';
3
+ export { CustomerProvider, useSquareCustomer, useLoyalty } from './customer';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["changeUser","useAuthentication","useAuthenticationDispatch","AuthenticationProvider"],"sourceRoot":"../../../src","sources":["providers/index.ts"],"mappings":"AAAA,SAASA,UAAU,QAAQ,iDAAiD;AAC5E,SACEC,iBAAiB,EACjBC,yBAAyB,EACzBC,sBAAsB,QACjB,yCAAyC"}
1
+ {"version":3,"names":["changeUser","useAuthentication","useAuthenticationDispatch","AuthenticationProvider","CustomerProvider","useSquareCustomer","useLoyalty"],"sourceRoot":"../../../src","sources":["providers/index.ts"],"mappings":"AAAA,SAASA,UAAU,QAAQ,iDAAiD;AAC5E,SACEC,iBAAiB,EACjBC,yBAAyB,EACzBC,sBAAsB,QACjB,yCAAyC;AAChD,SAASC,gBAAgB,EAAEC,iBAAiB,EAAEC,UAAU,QAAQ,YAAY"}
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useContext, useEffect, useState } from 'react';
2
2
  import { Alert, Button, LineLoader, RefreshControl, Text, View } from '../../components';
3
3
  import { ActivityIndicator, useTheme } from 'react-native-paper';
4
4
  import uuid from 'react-native-uuid';
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
6
6
  import { FlatList, Platform } from 'react-native';
7
7
  import { onStartCardEntry } from '../../utils/square';
8
8
  import { useCustomerQueries } from '../../hooks/useCustomer';
9
- import { useCheckCustomer } from '../../hooks/useCheckCustomer';
9
+ import { CustomerContext } from '../../providers/customer/CustomerProvider';
10
10
  import { CardRow } from './CardRow';
11
11
  import { useApplePay } from './useApplePay';
12
12
  export const SavedCards = ({
@@ -18,15 +18,20 @@ export const SavedCards = ({
18
18
  t
19
19
  } = useTranslation();
20
20
  const theme = useTheme();
21
+ const customerCtx = useContext(CustomerContext);
22
+ if (__DEV__ && !customerCtx) {
23
+ console.warn('SavedCards: CustomerProvider not found in tree — customer setup will not run');
24
+ }
21
25
  const {
22
- customer
23
- } = useCheckCustomer();
24
- const {
26
+ useFetchCustomer,
25
27
  useSaveCustomerCard,
26
28
  useFetchSavedCards,
27
29
  useDisableCard,
28
30
  useUpdateCustomer
29
31
  } = useCustomerQueries();
32
+ const {
33
+ data: customer
34
+ } = useFetchCustomer();
30
35
  const {
31
36
  saveCard,
32
37
  saveCardLoading
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","useState","Alert","Button","LineLoader","RefreshControl","Text","View","ActivityIndicator","useTheme","uuid","useTranslation","FlatList","Platform","onStartCardEntry","useCustomerQueries","useCheckCustomer","CardRow","useApplePay","SavedCards","onCheckout","showApplePay","total","t","theme","customer","useSaveCustomerCard","useFetchSavedCards","useDisableCard","useUpdateCustomer","saveCard","saveCardLoading","disableCard","disableCardLoading","selectedPaymentId","setSelectedPaymentId","updateCustomer","updateCustomerLoading","hasApplePay","paymentId","data","cards","isFetching","isLoading","refetch","handleAddCard","cardDetails","sourceId","nonce","idempotentKey","v4","show","title","description","handleUseCard","length","OS","selectedCard","find","card","linkedObjectId","paymentMethods","isApplePay","createElement","flex","px","bg","extraData","refreshControl","refreshing","onRefresh","showsVerticalScrollIndicator","renderItem","item","isDisabled","isSelected","isSelectable","onDelete","id","onSelect","addressId","squareCustomerId","ListHeaderComponent","mb","variant","color","ListFooterComponent","alignItems","pt","loading","onPress","icon","mode","height","padding","justifyContent","flexDirection","width","alignSelf","labelStyle","colors","background"],"sourceRoot":"../../../../src","sources":["screens/SavedCards/SavedCards.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SACEC,KAAK,EACLC,MAAM,EACNC,UAAU,EACVC,cAAc,EACdC,IAAI,EACJC,IAAI,QACC,kBAAkB;AACzB,SAASC,iBAAiB,EAAEC,QAAQ,QAAQ,oBAAoB;AAChE,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,cAAc;AACjD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,gBAAgB,QAAQ,8BAA8B;AAC/D,SAASC,OAAO,QAAQ,WAAW;AAEnC,SAASC,WAAW,QAAQ,eAAe;AAE3C,OAAO,MAAMC,UAAU,GAAGA,CAAC;EACzB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IACLyF,IAAI,EAAC,WAAW;IAChBC,MAAM,EAAE,EAAG;IACXI,KAAK,EAAC,MAAM;IACZC,SAAS,EAAC,QAAQ;IAClBhC,EAAE,EAAC,SAAS;IACZiC,UAAU,EAAE;MAAEd,KAAK,EAAE7D,KAAK,CAAC4E,MAAM,CAACC;IAAW,CAAE;IAC/CX,OAAO,EAAEpC;EAAc,GAEtBb,KAAK,CAACc,MAAM,GAAG,CAAC,IAAIjB,WAAW,GAC5Bf,CAAC,CAAC,0BAA0B,CAAC,GAC7BA,CAAC,CAAC,mBAAmB,CACnB,CACJ,CAEJ,CAAC;AAEX,CAAC"}
1
+ {"version":3,"names":["React","useContext","useEffect","useState","Alert","Button","LineLoader","RefreshControl","Text","View","ActivityIndicator","useTheme","uuid","useTranslation","FlatList","Platform","onStartCardEntry","useCustomerQueries","CustomerContext","CardRow","useApplePay","SavedCards","onCheckout","showApplePay","total","t","theme","customerCtx","__DEV__","console","warn","useFetchCustomer","useSaveCustomerCard","useFetchSavedCards","useDisableCard","useUpdateCustomer","data","customer","saveCard","saveCardLoading","disableCard","disableCardLoading","selectedPaymentId","setSelectedPaymentId","updateCustomer","updateCustomerLoading","hasApplePay","paymentId","cards","isFetching","isLoading","refetch","handleAddCard","cardDetails","sourceId","nonce","idempotentKey","v4","show","title","description","handleUseCard","length","OS","selectedCard","find","card","linkedObjectId","paymentMethods","isApplePay","createElement","flex","px","bg","extraData","refreshControl","refreshing","onRefresh","showsVerticalScrollIndicator","renderItem","item","isDisabled","isSelected","isSelectable","onDelete","id","onSelect","addressId","squareCustomerId","ListHeaderComponent","mb","variant","color","ListFooterComponent","alignItems","pt","loading","onPress","icon","mode","height","padding","justifyContent","flexDirection","width","alignSelf","labelStyle","colors","background"],"sourceRoot":"../../../../src","sources":["screens/SavedCards/SavedCards.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC9D,SACEC,KAAK,EACLC,MA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,EAAC;IAAM,GAEV1E,CAAC,CAAC,iBAAiB,CACd,CACJ;EACP,CACF,CACG,CAAC,EACN,CAAC,CAACH,UAAU,iBACXtB,KAAA,CAAAsE,aAAA,CAAC7D,IAAI;IACHgE,EAAE,EAAC,oBAAoB;IACvB2B,MAAM,EAAE,EAAG;IACXC,OAAO,EAAC,IAAI;IACZC,cAAc,EAAC,eAAe;IAC9BC,aAAa,EAAC,KAAK;IACnBC,KAAK,EAAC;EAAM,gBAEZxG,KAAA,CAAAsE,aAAA,CAAC7D,IAAI,qBACHT,KAAA,CAAAsE,aAAA,CAAC9D,IAAI;IAACmF,OAAO,EAAC,WAAW;IAACC,KAAK,EAAC;EAAW,GACxCnE,CAAC,CAAC,eAAe,CACd,CAAC,eACPzB,KAAA,CAAAsE,aAAA,CAAC9D,IAAI;IAACmF,OAAO,EAAC,YAAY;IAACC,KAAK,EAAC;EAAW,GACzCpE,KACG,CACF,CAAC,eACPxB,KAAA,CAAAsE,aAAA,CAACjE,MAAM;IACL8F,IAAI,EAAC,WAAW;IAChBC,MAAM,EAAE,EAAG;IACXI,KAAK,EAAC,MAAM;IACZC,SAAS,EAAC,QAAQ;IAClBhC,EAAE,EAAC,SAAS;IACZiC,UAAU,EAAE;MAAEd,KAAK,EAAElE,KAAK,CAACiF,MAAM,CAACC;IAAW,CAAE;IAC/CX,OAAO,EAAEpC;EAAc,GAEtBb,KAAK,CAACc,MAAM,GAAG,CAAC,IAAIhB,WAAW,GAC5BrB,CAAC,CAAC,0BAA0B,CAAC,GAC7BA,CAAC,CAAC,mBAAmB,CACnB,CACJ,CAEJ,CAAC;AAEX,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,QACsK,CAAC;AAE/L,eAAO,MAAM,SAAS;;CAErB,CAAC;AAEF,eAAO,MAAM,cAAc,2CAA2C,CAAC;AACvE,eAAO,MAAM,gBAAgB,uCAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,QACoK,CAAC;AAE7L,eAAO,MAAM,SAAS;;CAErB,CAAC;AAEF,eAAO,MAAM,cAAc,2CAA2C,CAAC;AACvE,eAAO,MAAM,gBAAgB,uCAAuC,CAAC"}
@@ -2,7 +2,6 @@ export { useDeactivateAccount } from './useDeactivateAccount';
2
2
  export { useTermsOfService, acceptTOS } from './useTermsOfService';
3
3
  export { useAuth } from './useAuth';
4
4
  export { useCustomerQueries } from './useCustomer';
5
- export { useCheckCustomer } from './useCheckCustomer';
6
5
  export { useAppVersionCheck } from './useAppVersionCheck';
7
6
  export { useBusinesses } from './useBusinesses';
8
7
  export { useLogout } from './useLogout';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -27,8 +27,6 @@ export declare const useCustomerQueries: () => {
27
27
  saveAddressLoading: boolean;
28
28
  };
29
29
  useFetchSavedCards: () => import("@tanstack/react-query").UseQueryResult<any, unknown>;
30
- useFetchSquareProgram: (queryOptions?: object) => import("@tanstack/react-query").UseQueryResult<any, unknown>;
31
- useFetchSquareLoyalty: (queryOptions?: object) => import("@tanstack/react-query").UseQueryResult<any, unknown>;
32
30
  useSaveCustomerCard: () => {
33
31
  saveCard: import("@tanstack/react-query").UseMutateFunction<void, {
34
32
  code: string;
@@ -43,17 +41,6 @@ export declare const useCustomerQueries: () => {
43
41
  }, string, unknown>;
44
42
  disableCardLoading: boolean;
45
43
  };
46
- useConnectSquareLoyalty: () => {
47
- connectSquareLoyalty: import("@tanstack/react-query").UseMutateFunction<import("axios").AxiosResponse<any, any> | null, unknown, void, unknown>;
48
- connectLoyaltyLoading: boolean;
49
- };
50
- useConnectSquareCustomer: () => {
51
- connectSquare: import("@tanstack/react-query").UseMutateFunction<void, {
52
- code: string;
53
- message: string;
54
- }, void, unknown>;
55
- connectSquareLoading: boolean;
56
- };
57
44
  useFetchLoyaltyRewards: (options?: {
58
45
  enabled?: boolean;
59
46
  }) => import("@tanstack/react-query").UseQueryResult<any, unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"useCustomer.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCustomer.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE5D,eAAO,MAAM,kBAAkB;;;;kBAyCE,MAAM;qBAAW,MAAM;;;;;;kBAgCvB,MAAM;qBAAW,MAAM;;uBAhBnC,MAAM,GAAG,IAAI;uBACb,MAAM,GAAG,IAAI;8BACN,MAAM,GAAG,IAAI;;;;;;kBA0CR,MAAM;qBAAW,MAAM;;;;;2CAsCb,MAAM;2CAyBN,MAAM;;;kBA2ChB,MAAM;qBAAW,MAAM;;;;;;kBA6BvB,MAAM;qBAAW,MAAM;;;;;;;;;;kBA4DvB,MAAM;qBAAW,MAAM;;;;uCAgBjB;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE;CAgB3D,CAAC"}
1
+ {"version":3,"file":"useCustomer.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCustomer.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE5D,eAAO,MAAM,kBAAkB;;;;kBAmCE,MAAM;qBAAW,MAAM;;;;;;kBAgCvB,MAAM;qBAAW,MAAM;;uBAhBnC,MAAM,GAAG,IAAI;uBACb,MAAM,GAAG,IAAI;8BACN,MAAM,GAAG,IAAI;;;;;;kBA0CR,MAAM;qBAAW,MAAM;;;;;;;kBAiDvB,MAAM;qBAAW,MAAM;;;;;;kBA6BvB,MAAM;qBAAW,MAAM;;;;uCAgBjB;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE;CAgB3D,CAAC"}
@@ -0,0 +1,9 @@
1
+ import React, { type FC, type PropsWithChildren } from 'react';
2
+ import type { CustomerContextValue } from './types';
3
+ export interface CustomerProviderProps {
4
+ autoEnroll: boolean;
5
+ loyaltyEnabled: boolean;
6
+ }
7
+ export declare const CustomerContext: React.Context<CustomerContextValue | null>;
8
+ export declare const CustomerProvider: FC<PropsWithChildren<CustomerProviderProps>>;
9
+ //# sourceMappingURL=CustomerProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomerProvider.d.ts","sourceRoot":"","sources":["../../../../../src/providers/customer/CustomerProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAKZ,KAAK,EAAE,EACP,KAAK,iBAAiB,EACvB,MAAM,OAAO,CAAC;AAiBf,OAAO,KAAK,EACV,oBAAoB,EAIrB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;CACzB;AAID,eAAO,MAAM,eAAe,4CAAmD,CAAC;AAEhF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAuOzE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type LoyaltyConnectOutcome = 'refetch' | 'duplicate' | 'no_loyalty' | 'error';
2
+ export declare function classifyLoyaltyError(message: string): LoyaltyConnectOutcome;
3
+ //# sourceMappingURL=classifyLoyaltyError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classifyLoyaltyError.d.ts","sourceRoot":"","sources":["../../../../../src/providers/customer/classifyLoyaltyError.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAC7B,SAAS,GACT,WAAW,GACX,YAAY,GACZ,OAAO,CAAC;AAEZ,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,qBAAqB,CAkB3E"}
@@ -0,0 +1,5 @@
1
+ export { CustomerProvider } from './CustomerProvider';
2
+ export { useSquareCustomer } from './useSquareCustomer';
3
+ export { useLoyalty } from './useLoyalty';
4
+ export type { CustomerStatus, LoyaltyStatus, CustomerLoyalty } from './types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/providers/customer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,25 @@
1
+ export type CustomerStatus = 'idle' | 'loading' | 'ready' | 'error';
2
+ export type LoyaltyStatus = 'idle' | 'loading' | 'not_enrolled' | 'enrolling' | 'ready' | 'no_loyalty' | 'error';
3
+ export interface CustomerLoyalty {
4
+ programId?: string;
5
+ program?: {
6
+ linkedObjectId?: string;
7
+ loyaltyDetails?: {
8
+ points?: number;
9
+ customerId?: string;
10
+ mainProgramId?: string;
11
+ };
12
+ } | null;
13
+ }
14
+ export interface CustomerContextValue {
15
+ customerStatus: CustomerStatus;
16
+ squareCustomerId: string | null;
17
+ customerError: string | null;
18
+ loyaltyStatus: LoyaltyStatus;
19
+ loyalty: CustomerLoyalty | null;
20
+ points: number;
21
+ loyaltyError: string | null;
22
+ enroll: () => void;
23
+ refetchLoyalty: () => void;
24
+ }
25
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/providers/customer/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAEpE,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,SAAS,GACT,cAAc,GACd,WAAW,GACX,OAAO,GACP,YAAY,GACZ,OAAO,CAAC;AAEZ,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE;QACR,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,cAAc,CAAC,EAAE;YACf,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB,CAAC;KACH,GAAG,IAAI,CAAC;CACV;AAED,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B"}
@@ -0,0 +1,11 @@
1
+ import type { CustomerLoyalty, LoyaltyStatus } from './types';
2
+ export declare const useLoyalty: () => {
3
+ loyaltyStatus: LoyaltyStatus;
4
+ isReady: boolean;
5
+ loyalty: CustomerLoyalty | null;
6
+ points: number;
7
+ loyaltyError: string | null;
8
+ enroll: () => void;
9
+ refetchLoyalty: () => void;
10
+ };
11
+ //# sourceMappingURL=useLoyalty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLoyalty.d.ts","sourceRoot":"","sources":["../../../../../src/providers/customer/useLoyalty.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE9D,eAAO,MAAM,UAAU,QAAO;IAC5B,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,cAAc,EAAE,MAAM,IAAI,CAAC;CAe5B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { CustomerStatus } from './types';
2
+ export declare const useSquareCustomer: () => {
3
+ customerStatus: CustomerStatus;
4
+ squareCustomerId: string | null;
5
+ customerError: string | null;
6
+ };
7
+ //# sourceMappingURL=useSquareCustomer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSquareCustomer.d.ts","sourceRoot":"","sources":["../../../../../src/providers/customer/useSquareCustomer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,iBAAiB,QAAO;IACnC,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAW9B,CAAC"}
@@ -1,3 +1,5 @@
1
1
  export { changeUser } from './authentication/actions/authentication.actions';
2
2
  export { useAuthentication, useAuthenticationDispatch, AuthenticationProvider, } from './authentication/AuthenticationProvider';
3
+ export { CustomerProvider, useSquareCustomer, useLoyalty } from './customer';
4
+ export type { CustomerStatus, LoyaltyStatus, CustomerLoyalty, } from './customer';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iDAAiD,CAAC;AAC7E,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,yCAAyC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iDAAiD,CAAC;AAC7E,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7E,YAAY,EACV,cAAc,EACd,aAAa,EACb,eAAe,GAChB,MAAM,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SavedCards.d.ts","sourceRoot":"","sources":["../../../../../src/screens/SavedCards/SavedCards.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG1D,eAAO,MAAM,UAAU;iCAKO,mBAAmB,GAAG,UAAU,KAAK,IAAI;;;iBAqLtE,CAAC"}
1
+ {"version":3,"file":"SavedCards.d.ts","sourceRoot":"","sources":["../../../../../src/screens/SavedCards/SavedCards.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG1D,eAAO,MAAM,UAAU;iCAKO,mBAAmB,GAAG,UAAU,KAAK,IAAI;;;iBA4LtE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiosinc/commons-rn",
3
- "version": "0.15.7",
3
+ "version": "0.16.0",
4
4
  "description": "Common Code",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -1,5 +1,5 @@
1
1
  export const EMAIL_REGEX =
2
- /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$|^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[^@\s]+\.[^@\s]+$/;
2
+ /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$|^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[^@\s]+\.[^@\s]+$/;
3
3
 
4
4
  export const MMKV_KEYS = {
5
5
  BUSINESS_ID: 'BUSINESS_ID',
@@ -2,7 +2,6 @@ export { useDeactivateAccount } from './useDeactivateAccount';
2
2
  export { useTermsOfService, acceptTOS } from './useTermsOfService';
3
3
  export { useAuth } from './useAuth';
4
4
  export { useCustomerQueries } from './useCustomer';
5
- export { useCheckCustomer } from './useCheckCustomer';
6
5
  export { useAppVersionCheck } from './useAppVersionCheck';
7
6
  export { useBusinesses } from './useBusinesses';
8
7
  export { useLogout } from './useLogout';