@open-tender/utils 0.0.35 → 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.
@@ -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';
@@ -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);
@@ -50,7 +50,7 @@ export declare const isoToDateStrMinutes: (iso: string, tz: Timezone | TimezoneP
50
50
  };
51
51
  export declare const makeReadableDateStrFromIso: (iso: string, tz: Timezone | TimezonePython, verbose?: boolean) => string;
52
52
  export declare const makeRequestedIso: (requestedAt: string) => string;
53
- export declare const makeRequestedAtStr: (requestedAt: string, tz: Timezone | TimezonePython, verbose?: boolean) => string;
53
+ export declare const makeRequestedAtStr: (requestedAt: string | null, tz: Timezone | TimezonePython, verbose?: boolean) => string;
54
54
  export declare const makeEstimatedTime: (requestedAt: ISOString | string, revenueCenter: Partial<CustomerRevenueCenter>, serviceType: ServiceType, verbose?: boolean) => string | null;
55
55
  export declare const makeOppositeTimes: (times: Array<number>, interval: number, min?: number, max?: number) => Array<number>;
56
56
  export declare const makeWeekdaysExcluded: (validTimes: {
@@ -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';
@@ -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';
@@ -50,7 +50,7 @@ export declare const isoToDateStrMinutes: (iso: string, tz: Timezone | TimezoneP
50
50
  };
51
51
  export declare const makeReadableDateStrFromIso: (iso: string, tz: Timezone | TimezonePython, verbose?: boolean) => string;
52
52
  export declare const makeRequestedIso: (requestedAt: string) => string;
53
- export declare const makeRequestedAtStr: (requestedAt: string, tz: Timezone | TimezonePython, verbose?: boolean) => string;
53
+ export declare const makeRequestedAtStr: (requestedAt: string | null, tz: Timezone | TimezonePython, verbose?: boolean) => string;
54
54
  export declare const makeEstimatedTime: (requestedAt: ISOString | string, revenueCenter: Partial<CustomerRevenueCenter>, serviceType: ServiceType, verbose?: boolean) => string | null;
55
55
  export declare const makeOppositeTimes: (times: Array<number>, interval: number, min?: number, max?: number) => Array<number>;
56
56
  export declare const makeWeekdaysExcluded: (validTimes: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-tender/utils",
3
- "version": "0.0.35",
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.91",
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,8 +0,0 @@
1
- declare const useLatLng: () => import("immer/dist/internal").WritableDraft<import("@open-tender/types").Address> | {
2
- lat: number;
3
- lng: number;
4
- } | {
5
- lat: null;
6
- lng: null;
7
- };
8
- export default useLatLng;
@@ -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,2 +0,0 @@
1
- declare const useLoyaltyPoints: () => import("@open-tender/types").CustomerLoyalty | null;
2
- export default useLoyaltyPoints;
@@ -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,8 +0,0 @@
1
- declare const useLatLng: () => import("immer/dist/internal").WritableDraft<import("@open-tender/types").Address> | {
2
- lat: number;
3
- lng: number;
4
- } | {
5
- lat: null;
6
- lng: null;
7
- };
8
- export default useLatLng;
@@ -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,2 +0,0 @@
1
- declare const useLoyaltyPoints: () => import("@open-tender/types").CustomerLoyalty | null;
2
- export default useLoyaltyPoints;
@@ -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;