@open-tender/utils
Version:
A library of utils for use with Open Tender applications that utilize our cloud-based Order API.
227 lines (226 loc) • 6.06 kB
TypeScript
import { Address, GoogleMapsStyles, LatLng, RevenueCenter, RevenueCenters, ServiceType } from '@open-tender/types';
export declare const getDistance: (pointA: LatLng, pointB: LatLng, inMiles?: boolean) => number;
export declare const inZone: (latLng: LatLng, polygon: number[][]) => boolean;
export declare const addDistance: (revenueCenters: RevenueCenters, latLng: LatLng) => RevenueCenters;
export declare const sortRevenueCenters: (revenueCenters: RevenueCenters, isDelivery?: boolean) => RevenueCenter[];
export declare const calcMinDistance: (revenueCenters: RevenueCenters, maxDistance?: number) => number;
export declare const checkServiceType: (revenueCenter: RevenueCenter, serviceType: ServiceType) => boolean;
export declare const makePickupRevenueCenters: (revenueCenters: Array<RevenueCenter>, maxDistance?: number) => RevenueCenter[];
export declare const makeWalkinRevenueCenters: (revenueCenters: Array<RevenueCenter>, maxDistance?: number) => RevenueCenter[];
export declare const makeDeliveryRevenueCenters: (revenueCenters: Array<RevenueCenter>) => RevenueCenter[];
export declare const makePickupMesssaging: (address: Address | null, latLng: LatLng | null, count: number, minDistance: number, maxDistance?: number, messages?: {
PICKUP: {
default: {
title: string;
msg: string;
};
address: {
title: string;
msg: string;
};
addressFar: {
title: string;
msg: string;
};
geo: {
title: string;
msg: string;
};
geoFar: {
title: string;
msg: string;
};
};
DELIVERY: {
default: {
title: string;
msg: string;
error: null;
};
noStreet: {
title: string;
msg: string;
error: string;
};
hasDelivery: {
title: string;
msg: string;
error: null;
};
noDelivery: {
title: string;
msg: string;
error: null;
};
};
}) => {
title: string;
msg: string;
};
export declare const makeWalkinMessaging: (address: Address | null, latLng: LatLng | null, count: number, minDistance: number, maxDistance?: number, messages?: {
PICKUP: {
default: {
title: string;
msg: string;
};
address: {
title: string;
msg: string;
};
addressFar: {
title: string;
msg: string;
};
geo: {
title: string;
msg: string;
};
geoFar: {
title: string;
msg: string;
};
};
DELIVERY: {
default: {
title: string;
msg: string;
error: null;
};
noStreet: {
title: string;
msg: string;
error: string;
};
hasDelivery: {
title: string;
msg: string;
error: null;
};
noDelivery: {
title: string;
msg: string;
error: null;
};
};
}) => {
title: string;
msg: string;
};
export declare const makeDeliveryMesssaging: (address: Address | null, count: number, messages?: {
PICKUP: {
default: {
title: string;
msg: string;
};
address: {
title: string;
msg: string;
};
addressFar: {
title: string;
msg: string;
};
geo: {
title: string;
msg: string;
};
geoFar: {
title: string;
msg: string;
};
};
DELIVERY: {
default: {
title: string;
msg: string;
error: null;
};
noStreet: {
title: string;
msg: string;
error: string;
};
hasDelivery: {
title: string;
msg: string;
error: null;
};
noDelivery: {
title: string;
msg: string;
error: null;
};
};
}) => {
title: string;
msg: string;
error: null;
} | {
title: string;
msg: string;
error: string;
};
export declare const makeDisplayedRevenueCenters: (revenueCenters: RevenueCenter[], serviceType: ServiceType | null, address: Address | null, latLng: LatLng | null, maxDistance: number, isGroupOrder: boolean) => {
title: string;
msg: string;
error: string | null;
displayed: RevenueCenter[];
};
export declare const LOCATIONS_MESSAGES: {
PICKUP: {
default: {
title: string;
msg: string;
};
address: {
title: string;
msg: string;
};
addressFar: {
title: string;
msg: string;
};
geo: {
title: string;
msg: string;
};
geoFar: {
title: string;
msg: string;
};
};
DELIVERY: {
default: {
title: string;
msg: string;
error: null;
};
noStreet: {
title: string;
msg: string;
error: string;
};
hasDelivery: {
title: string;
msg: string;
error: null;
};
noDelivery: {
title: string;
msg: string;
error: null;
};
};
};
export declare const renameLocation: (str: string, names: string[]) => string;
export declare const makeMapStyles: ({ labelColor, roadColor, featureColor, waterColor, backgroundColor }: GoogleMapsStyles) => {
featureType: string;
elementType: string;
stylers: ({
visibility: string;
color?: undefined;
} | {
color: string;
visibility?: undefined;
})[];
}[];