@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.
- package/README.md +20 -0
- package/lib/commonjs/constants/index.js +1 -1
- package/lib/commonjs/constants/index.js.map +1 -1
- package/lib/commonjs/hooks/index.js +0 -7
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useCustomer.js +0 -86
- package/lib/commonjs/hooks/useCustomer.js.map +1 -1
- package/lib/commonjs/providers/customer/CustomerProvider.js +214 -0
- package/lib/commonjs/providers/customer/CustomerProvider.js.map +1 -0
- package/lib/commonjs/providers/customer/README.md +122 -0
- package/lib/commonjs/providers/customer/classifyLoyaltyError.js +19 -0
- package/lib/commonjs/providers/customer/classifyLoyaltyError.js.map +1 -0
- package/lib/commonjs/providers/customer/index.js +27 -0
- package/lib/commonjs/providers/customer/index.js.map +1 -0
- package/lib/commonjs/providers/customer/types.js +2 -0
- package/lib/commonjs/providers/customer/types.js.map +1 -0
- package/lib/commonjs/providers/customer/useLoyalty.js +25 -0
- package/lib/commonjs/providers/customer/useLoyalty.js.map +1 -0
- package/lib/commonjs/providers/customer/useSquareCustomer.js +21 -0
- package/lib/commonjs/providers/customer/useSquareCustomer.js.map +1 -0
- package/lib/commonjs/providers/index.js +19 -0
- package/lib/commonjs/providers/index.js.map +1 -1
- package/lib/commonjs/screens/SavedCards/SavedCards.js +9 -4
- package/lib/commonjs/screens/SavedCards/SavedCards.js.map +1 -1
- package/lib/module/constants/index.js +1 -1
- package/lib/module/constants/index.js.map +1 -1
- package/lib/module/hooks/index.js +0 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useCustomer.js +1 -87
- package/lib/module/hooks/useCustomer.js.map +1 -1
- package/lib/module/providers/customer/CustomerProvider.js +204 -0
- package/lib/module/providers/customer/CustomerProvider.js.map +1 -0
- package/lib/module/providers/customer/README.md +122 -0
- package/lib/module/providers/customer/classifyLoyaltyError.js +13 -0
- package/lib/module/providers/customer/classifyLoyaltyError.js.map +1 -0
- package/lib/module/providers/customer/index.js +4 -0
- package/lib/module/providers/customer/index.js.map +1 -0
- package/lib/module/providers/customer/types.js +2 -0
- package/lib/module/providers/customer/types.js.map +1 -0
- package/lib/module/providers/customer/useLoyalty.js +18 -0
- package/lib/module/providers/customer/useLoyalty.js.map +1 -0
- package/lib/module/providers/customer/useSquareCustomer.js +14 -0
- package/lib/module/providers/customer/useSquareCustomer.js.map +1 -0
- package/lib/module/providers/index.js +1 -0
- package/lib/module/providers/index.js.map +1 -1
- package/lib/module/screens/SavedCards/SavedCards.js +10 -5
- package/lib/module/screens/SavedCards/SavedCards.js.map +1 -1
- package/lib/typescript/src/constants/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/index.d.ts +0 -1
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useCustomer.d.ts +0 -13
- package/lib/typescript/src/hooks/useCustomer.d.ts.map +1 -1
- package/lib/typescript/src/providers/customer/CustomerProvider.d.ts +9 -0
- package/lib/typescript/src/providers/customer/CustomerProvider.d.ts.map +1 -0
- package/lib/typescript/src/providers/customer/classifyLoyaltyError.d.ts +3 -0
- package/lib/typescript/src/providers/customer/classifyLoyaltyError.d.ts.map +1 -0
- package/lib/typescript/src/providers/customer/index.d.ts +5 -0
- package/lib/typescript/src/providers/customer/index.d.ts.map +1 -0
- package/lib/typescript/src/providers/customer/types.d.ts +25 -0
- package/lib/typescript/src/providers/customer/types.d.ts.map +1 -0
- package/lib/typescript/src/providers/customer/useLoyalty.d.ts +11 -0
- package/lib/typescript/src/providers/customer/useLoyalty.d.ts.map +1 -0
- package/lib/typescript/src/providers/customer/useSquareCustomer.d.ts +7 -0
- package/lib/typescript/src/providers/customer/useSquareCustomer.d.ts.map +1 -0
- package/lib/typescript/src/providers/index.d.ts +2 -0
- package/lib/typescript/src/providers/index.d.ts.map +1 -1
- package/lib/typescript/src/screens/SavedCards/SavedCards.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/constants/index.ts +1 -1
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useCustomer.ts +0 -129
- package/src/providers/customer/CustomerProvider.tsx +272 -0
- package/src/providers/customer/README.md +122 -0
- package/src/providers/customer/classifyLoyaltyError.ts +25 -0
- package/src/providers/customer/index.ts +4 -0
- package/src/providers/customer/types.ts +34 -0
- package/src/providers/customer/useLoyalty.ts +27 -0
- package/src/providers/customer/useSquareCustomer.ts +19 -0
- package/src/providers/index.ts +6 -0
- package/src/screens/SavedCards/SavedCards.tsx +10 -3
- package/lib/commonjs/hooks/useCheckCustomer.js +0 -57
- package/lib/commonjs/hooks/useCheckCustomer.js.map +0 -1
- package/lib/module/hooks/useCheckCustomer.js +0 -49
- package/lib/module/hooks/useCheckCustomer.js.map +0 -1
- package/lib/typescript/src/hooks/useCheckCustomer.d.ts +0 -5
- package/lib/typescript/src/hooks/useCheckCustomer.d.ts.map +0 -1
- package/src/hooks/useCheckCustomer.ts +0 -49
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Alert,
|
|
4
4
|
Button,
|
|
@@ -13,7 +13,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
13
13
|
import { FlatList, Platform } from 'react-native';
|
|
14
14
|
import { onStartCardEntry } from '../../utils/square';
|
|
15
15
|
import { useCustomerQueries } from '../../hooks/useCustomer';
|
|
16
|
-
import {
|
|
16
|
+
import { CustomerContext } from '../../providers/customer/CustomerProvider';
|
|
17
17
|
import { CardRow } from './CardRow';
|
|
18
18
|
import { CustomerCardPayment } from '../../types/commons';
|
|
19
19
|
import { useApplePay } from './useApplePay';
|
|
@@ -29,13 +29,20 @@ export const SavedCards = ({
|
|
|
29
29
|
}) => {
|
|
30
30
|
const { t } = useTranslation();
|
|
31
31
|
const theme = useTheme();
|
|
32
|
-
const
|
|
32
|
+
const customerCtx = useContext(CustomerContext);
|
|
33
|
+
if (__DEV__ && !customerCtx) {
|
|
34
|
+
console.warn(
|
|
35
|
+
'SavedCards: CustomerProvider not found in tree — customer setup will not run'
|
|
36
|
+
);
|
|
37
|
+
}
|
|
33
38
|
const {
|
|
39
|
+
useFetchCustomer,
|
|
34
40
|
useSaveCustomerCard,
|
|
35
41
|
useFetchSavedCards,
|
|
36
42
|
useDisableCard,
|
|
37
43
|
useUpdateCustomer,
|
|
38
44
|
} = useCustomerQueries();
|
|
45
|
+
const { data: customer } = useFetchCustomer();
|
|
39
46
|
const { saveCard, saveCardLoading } = useSaveCustomerCard();
|
|
40
47
|
const { disableCard, disableCardLoading } = useDisableCard();
|
|
41
48
|
const [selectedPaymentId, setSelectedPaymentId] = useState('');
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useCheckCustomer = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _useCustomer = require("./useCustomer");
|
|
9
|
-
var _auth = _interopRequireDefault(require("@react-native-firebase/auth"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
const useCheckCustomer = () => {
|
|
12
|
-
const user = (0, _auth.default)().currentUser;
|
|
13
|
-
const isLoggedIn = user && !user.isAnonymous;
|
|
14
|
-
const {
|
|
15
|
-
useFetchCustomer,
|
|
16
|
-
useCreateCustomer,
|
|
17
|
-
useFetchSquareProgram,
|
|
18
|
-
useConnectSquareCustomer
|
|
19
|
-
} = (0, _useCustomer.useCustomerQueries)();
|
|
20
|
-
const {
|
|
21
|
-
connectSquare
|
|
22
|
-
} = useConnectSquareCustomer();
|
|
23
|
-
const {
|
|
24
|
-
createCustomerHook
|
|
25
|
-
} = useCreateCustomer();
|
|
26
|
-
const {
|
|
27
|
-
data: customer
|
|
28
|
-
} = useFetchCustomer();
|
|
29
|
-
const {
|
|
30
|
-
data: program,
|
|
31
|
-
isFetched: isProgramFetched
|
|
32
|
-
} = useFetchSquareProgram({
|
|
33
|
-
enabled: Boolean(customer?.uid),
|
|
34
|
-
refetchOnWindowFocus: false
|
|
35
|
-
});
|
|
36
|
-
const hasAttemptedCreate = (0, _react.useRef)(false);
|
|
37
|
-
const hasAttemptedConnect = (0, _react.useRef)(false);
|
|
38
|
-
(0, _react.useEffect)(() => {
|
|
39
|
-
if (isLoggedIn && customer?.customer === null && !hasAttemptedCreate.current) {
|
|
40
|
-
hasAttemptedCreate.current = true;
|
|
41
|
-
createCustomerHook();
|
|
42
|
-
}
|
|
43
|
-
}, [customer, createCustomerHook, isLoggedIn]);
|
|
44
|
-
(0, _react.useEffect)(() => {
|
|
45
|
-
if (isProgramFetched && program === null && !hasAttemptedConnect.current) {
|
|
46
|
-
hasAttemptedConnect.current = true;
|
|
47
|
-
connectSquare();
|
|
48
|
-
}
|
|
49
|
-
}, [isProgramFetched, program, connectSquare]);
|
|
50
|
-
const isCustomerReady = Boolean(customer?.uid && isProgramFetched && program != null);
|
|
51
|
-
return {
|
|
52
|
-
customer,
|
|
53
|
-
isCustomerReady
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
exports.useCheckCustomer = useCheckCustomer;
|
|
57
|
-
//# sourceMappingURL=useCheckCustomer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_useCustomer","_auth","_interopRequireDefault","obj","__esModule","default","useCheckCustomer","user","firebase","currentUser","isLoggedIn","isAnonymous","useFetchCustomer","useCreateCustomer","useFetchSquareProgram","useConnectSquareCustomer","useCustomerQueries","connectSquare","createCustomerHook","data","customer","program","isFetched","isProgramFetched","enabled","Boolean","uid","refetchOnWindowFocus","hasAttemptedCreate","useRef","hasAttemptedConnect","useEffect","current","isCustomerReady","exports"],"sourceRoot":"../../../src","sources":["hooks/useCheckCust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ACF,CAAC,EAAE,CAACE,QAAQ,EAAEF,kBAAkB,EAAER,UAAU,CAAC,CAAC;EAE9C,IAAAqB,gBAAS,EAAC,MAAM;IACd,IAAIR,gBAAgB,IAAIF,OAAO,KAAK,IAAI,IAAI,CAACS,mBAAmB,CAACE,OAAO,EAAE;MACxEF,mBAAmB,CAACE,OAAO,GAAG,IAAI;MAClCf,aAAa,CAAC,CAAC;IACjB;EACF,CAAC,EAAE,CAACM,gBAAgB,EAAEF,OAAO,EAAEJ,aAAa,CAAC,CAAC;EAE9C,MAAMgB,eAAe,GAAGR,OAAO,CAC7BL,QAAQ,EAAEM,GAAG,IAAIH,gBAAgB,IAAIF,OAAO,IAAI,IAClD,CAAC;EAED,OAAO;IAAED,QAAQ;IAAEa;EAAgB,CAAC;AACtC,CAAC;AAACC,OAAA,CAAA5B,gBAAA,GAAAA,gBAAA"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { useCustomerQueries } from './useCustomer';
|
|
3
|
-
import firebase from '@react-native-firebase/auth';
|
|
4
|
-
export const useCheckCustomer = () => {
|
|
5
|
-
const user = firebase().currentUser;
|
|
6
|
-
const isLoggedIn = user && !user.isAnonymous;
|
|
7
|
-
const {
|
|
8
|
-
useFetchCustomer,
|
|
9
|
-
useCreateCustomer,
|
|
10
|
-
useFetchSquareProgram,
|
|
11
|
-
useConnectSquareCustomer
|
|
12
|
-
} = useCustomerQueries();
|
|
13
|
-
const {
|
|
14
|
-
connectSquare
|
|
15
|
-
} = useConnectSquareCustomer();
|
|
16
|
-
const {
|
|
17
|
-
createCustomerHook
|
|
18
|
-
} = useCreateCustomer();
|
|
19
|
-
const {
|
|
20
|
-
data: customer
|
|
21
|
-
} = useFetchCustomer();
|
|
22
|
-
const {
|
|
23
|
-
data: program,
|
|
24
|
-
isFetched: isProgramFetched
|
|
25
|
-
} = useFetchSquareProgram({
|
|
26
|
-
enabled: Boolean(customer?.uid),
|
|
27
|
-
refetchOnWindowFocus: false
|
|
28
|
-
});
|
|
29
|
-
const hasAttemptedCreate = useRef(false);
|
|
30
|
-
const hasAttemptedConnect = useRef(false);
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (isLoggedIn && customer?.customer === null && !hasAttemptedCreate.current) {
|
|
33
|
-
hasAttemptedCreate.current = true;
|
|
34
|
-
createCustomerHook();
|
|
35
|
-
}
|
|
36
|
-
}, [customer, createCustomerHook, isLoggedIn]);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (isProgramFetched && program === null && !hasAttemptedConnect.current) {
|
|
39
|
-
hasAttemptedConnect.current = true;
|
|
40
|
-
connectSquare();
|
|
41
|
-
}
|
|
42
|
-
}, [isProgramFetched, program, connectSquare]);
|
|
43
|
-
const isCustomerReady = Boolean(customer?.uid && isProgramFetched && program != null);
|
|
44
|
-
return {
|
|
45
|
-
customer,
|
|
46
|
-
isCustomerReady
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
//# sourceMappingURL=useCheckCustomer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","useCustomerQueries","firebase","useCheckCustomer","user","currentUser","isLoggedIn","isAnonymous","useFetchCustomer","useCreateCustomer","useFetchSquareProgram","useConnectSquareCustomer","connectSquare","createCustomerHook","data","customer","program","isFetched","isProgramFetched","enabled","Boolean","uid","refetchOnWindowFocus","hasAttemptedCreate","hasAttemptedConnect","current","isCustomerReady"],"sourceRoot":"../../../src","sources":["hooks/useCheckCustomer.ts"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,kBAAkB,QAAQ,eAAe;AAClD,OAAOC,QAAQ,MAAM,6BAA6B;AAElD,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EACpC,MAAMC,IAAI,GAAGF,QAAQ,CAAC,CAAC,CAACG,WAAW;EACnC,MAAMC,UAAU,GAAGF,IAAI,IAAI,CAACA,IAAI,CA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,IAClD,CAAC;EAED,OAAO;IAAED,QAAQ;IAAEW;EAAgB,CAAC;AACtC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCheckCustomer.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCheckCustomer.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB;;;CA4C5B,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { useCustomerQueries } from './useCustomer';
|
|
3
|
-
import firebase from '@react-native-firebase/auth';
|
|
4
|
-
|
|
5
|
-
export const useCheckCustomer = () => {
|
|
6
|
-
const user = firebase().currentUser;
|
|
7
|
-
const isLoggedIn = user && !user.isAnonymous;
|
|
8
|
-
const {
|
|
9
|
-
useFetchCustomer,
|
|
10
|
-
useCreateCustomer,
|
|
11
|
-
useFetchSquareProgram,
|
|
12
|
-
useConnectSquareCustomer,
|
|
13
|
-
} = useCustomerQueries();
|
|
14
|
-
const { connectSquare } = useConnectSquareCustomer();
|
|
15
|
-
|
|
16
|
-
const { createCustomerHook } = useCreateCustomer();
|
|
17
|
-
const { data: customer } = useFetchCustomer();
|
|
18
|
-
const { data: program, isFetched: isProgramFetched } = useFetchSquareProgram({
|
|
19
|
-
enabled: Boolean(customer?.uid),
|
|
20
|
-
refetchOnWindowFocus: false,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const hasAttemptedCreate = useRef(false);
|
|
24
|
-
const hasAttemptedConnect = useRef(false);
|
|
25
|
-
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (
|
|
28
|
-
isLoggedIn &&
|
|
29
|
-
customer?.customer === null &&
|
|
30
|
-
!hasAttemptedCreate.current
|
|
31
|
-
) {
|
|
32
|
-
hasAttemptedCreate.current = true;
|
|
33
|
-
createCustomerHook();
|
|
34
|
-
}
|
|
35
|
-
}, [customer, createCustomerHook, isLoggedIn]);
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (isProgramFetched && program === null && !hasAttemptedConnect.current) {
|
|
39
|
-
hasAttemptedConnect.current = true;
|
|
40
|
-
connectSquare();
|
|
41
|
-
}
|
|
42
|
-
}, [isProgramFetched, program, connectSquare]);
|
|
43
|
-
|
|
44
|
-
const isCustomerReady = Boolean(
|
|
45
|
-
customer?.uid && isProgramFetched && program != null
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
return { customer, isCustomerReady };
|
|
49
|
-
};
|