@open-tender/utils 0.0.36 → 0.0.37
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/dist/cjs/hooks/index.d.ts +0 -2
- package/dist/cjs/hooks/index.js +0 -2
- package/dist/esm/hooks/index.d.ts +0 -2
- package/dist/esm/hooks/index.js +0 -2
- package/package.json +2 -2
- package/dist/cjs/hooks/useLatLng.d.ts +0 -8
- package/dist/cjs/hooks/useLatLng.js +0 -13
- package/dist/cjs/hooks/useLoyaltyPoints.d.ts +0 -2
- package/dist/cjs/hooks/useLoyaltyPoints.js +0 -18
- package/dist/esm/hooks/useLatLng.d.ts +0 -8
- package/dist/esm/hooks/useLatLng.js +0 -11
- package/dist/esm/hooks/useLoyaltyPoints.d.ts +0 -2
- package/dist/esm/hooks/useLoyaltyPoints.js +0 -16
|
@@ -9,7 +9,5 @@ export * from './useGiftCardAssignForm';
|
|
|
9
9
|
export * from './useGiftCardAssignOtherForm';
|
|
10
10
|
export * from './useGiftCardForm';
|
|
11
11
|
export * from './useGiftCardsForm';
|
|
12
|
-
export * from './useLatLng';
|
|
13
|
-
export * from './useLoyaltyPoints';
|
|
14
12
|
export * from './useOrderRating';
|
|
15
13
|
export * from './useProfileForm';
|
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -12,7 +12,5 @@ tslib_1.__exportStar(require("./useGiftCardAssignForm"), exports);
|
|
|
12
12
|
tslib_1.__exportStar(require("./useGiftCardAssignOtherForm"), exports);
|
|
13
13
|
tslib_1.__exportStar(require("./useGiftCardForm"), exports);
|
|
14
14
|
tslib_1.__exportStar(require("./useGiftCardsForm"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./useLatLng"), exports);
|
|
16
|
-
tslib_1.__exportStar(require("./useLoyaltyPoints"), exports);
|
|
17
15
|
tslib_1.__exportStar(require("./useOrderRating"), exports);
|
|
18
16
|
tslib_1.__exportStar(require("./useProfileForm"), exports);
|
|
@@ -9,7 +9,5 @@ export * from './useGiftCardAssignForm';
|
|
|
9
9
|
export * from './useGiftCardAssignOtherForm';
|
|
10
10
|
export * from './useGiftCardForm';
|
|
11
11
|
export * from './useGiftCardsForm';
|
|
12
|
-
export * from './useLatLng';
|
|
13
|
-
export * from './useLoyaltyPoints';
|
|
14
12
|
export * from './useOrderRating';
|
|
15
13
|
export * from './useProfileForm';
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -9,7 +9,5 @@ export * from './useGiftCardAssignForm';
|
|
|
9
9
|
export * from './useGiftCardAssignOtherForm';
|
|
10
10
|
export * from './useGiftCardForm';
|
|
11
11
|
export * from './useGiftCardsForm';
|
|
12
|
-
export * from './useLatLng';
|
|
13
|
-
export * from './useLoyaltyPoints';
|
|
14
12
|
export * from './useOrderRating';
|
|
15
13
|
export * from './useProfileForm';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.37",
|
|
4
4
|
"description": "A library of utils for use with Open Tender applications that utilize our cloud-based Order API.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@open-tender/cloud": "^0.0.79"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@open-tender/types": "^0.0.
|
|
62
|
+
"@open-tender/types": "^0.0.92",
|
|
63
63
|
"date-fns": "^2.29.3",
|
|
64
64
|
"date-fns-tz": "^1.3.7",
|
|
65
65
|
"react-native-responsive-screen": "^1.4.2"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const react_redux_1 = require("react-redux");
|
|
4
|
-
const cloud_1 = require("@open-tender/cloud");
|
|
5
|
-
const useLatLng = () => {
|
|
6
|
-
// geoLatLng will be null if we don't have the user's geolocation
|
|
7
|
-
const geoLatLng = (0, react_redux_1.useSelector)(cloud_1.selectGeoLatLng);
|
|
8
|
-
// address will be null if we don't have the user's address
|
|
9
|
-
const { address } = (0, react_redux_1.useSelector)(cloud_1.selectOrder);
|
|
10
|
-
// make sure we always return an object with lat and lng attributes
|
|
11
|
-
return address || geoLatLng || { lat: null, lng: null };
|
|
12
|
-
};
|
|
13
|
-
exports.default = useLatLng;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const react_1 = require("react");
|
|
4
|
-
const react_redux_1 = require("react-redux");
|
|
5
|
-
const cloud_1 = require("@open-tender/cloud");
|
|
6
|
-
const useLoyaltyPoints = () => {
|
|
7
|
-
const dispatch = (0, cloud_1.useAppDispatch)();
|
|
8
|
-
const { profile } = (0, react_redux_1.useSelector)(cloud_1.selectCustomer);
|
|
9
|
-
const { customer_id } = profile || {};
|
|
10
|
-
const pointsProgram = (0, react_redux_1.useSelector)(cloud_1.selectPointsProgram);
|
|
11
|
-
(0, react_1.useEffect)(() => {
|
|
12
|
-
if (customer_id) {
|
|
13
|
-
dispatch((0, cloud_1.fetchCustomerLoyalty)());
|
|
14
|
-
}
|
|
15
|
-
}, [customer_id, dispatch]);
|
|
16
|
-
return pointsProgram || null;
|
|
17
|
-
};
|
|
18
|
-
exports.default = useLoyaltyPoints;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useSelector } from 'react-redux';
|
|
2
|
-
import { selectOrder, selectGeoLatLng } from '@open-tender/cloud';
|
|
3
|
-
const useLatLng = () => {
|
|
4
|
-
// geoLatLng will be null if we don't have the user's geolocation
|
|
5
|
-
const geoLatLng = useSelector(selectGeoLatLng);
|
|
6
|
-
// address will be null if we don't have the user's address
|
|
7
|
-
const { address } = useSelector(selectOrder);
|
|
8
|
-
// make sure we always return an object with lat and lng attributes
|
|
9
|
-
return address || geoLatLng || { lat: null, lng: null };
|
|
10
|
-
};
|
|
11
|
-
export default useLatLng;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { useSelector } from 'react-redux';
|
|
3
|
-
import { fetchCustomerLoyalty, selectCustomer, selectPointsProgram, useAppDispatch, } from '@open-tender/cloud';
|
|
4
|
-
const useLoyaltyPoints = () => {
|
|
5
|
-
const dispatch = useAppDispatch();
|
|
6
|
-
const { profile } = useSelector(selectCustomer);
|
|
7
|
-
const { customer_id } = profile || {};
|
|
8
|
-
const pointsProgram = useSelector(selectPointsProgram);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (customer_id) {
|
|
11
|
-
dispatch(fetchCustomerLoyalty());
|
|
12
|
-
}
|
|
13
|
-
}, [customer_id, dispatch]);
|
|
14
|
-
return pointsProgram || null;
|
|
15
|
-
};
|
|
16
|
-
export default useLoyaltyPoints;
|