@open-tender/store
Version:
A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API
455 lines (454 loc) • 20.5 kB
TypeScript
import { AppTheme, Devices, KioskBrand, KioskContent, KioskDisplaySettings, KioskStyles, RequestError, RequestStatus, Store } from '@open-tender/types';
import { AppConfig } from '@open-tender/ui';
import { AppState } from '../app';
export interface KioskApp {
apiUrl: string;
}
export interface KioskState {
app: KioskApp | null;
brand: KioskBrand | null;
config: AppConfig | null;
content: KioskContent | null;
devices: Devices | null;
error: RequestError | null;
loading: RequestStatus;
ratio: number;
retries: number;
settings: KioskDisplaySettings | null;
store: Store | null;
styles: KioskStyles | null;
theme: AppTheme | null;
version?: string | null;
paymentConfigs?: {
integration: string;
is_testing: boolean;
merchant_api_key: string;
merchant_id: string;
merchant_password: string;
merchant_username: string;
offline_limit: string;
saved_cards: boolean;
signature_threshold: string | null;
freedompay_store_id: string;
card_stor_service_url: string;
client_selling_system: string;
client_selling_system_version: string;
freedompay_terminal_id: string;
} | null;
}
export declare enum KioskActionType {
FetchKiosk = "kiosk/getKiosk",
TestKioskPrinter = "kiosk/testKioskPrinter",
FetchPaymentConfigs = "kiosk/fetchPaymentConfigs"
}
export declare const fetchKioskConfig: import("@reduxjs/toolkit").AsyncThunk<KioskState, {
apiUrl: string;
}, {
state: AppState;
rejectValue: RequestError;
dispatch?: import("redux").Dispatch<import("redux").UnknownAction> | undefined;
extra?: unknown;
serializedErrorType?: unknown;
pendingMeta?: unknown;
fulfilledMeta?: unknown;
rejectedMeta?: unknown;
}>;
export declare const testKioskPrinter: import("@reduxjs/toolkit").AsyncThunk<boolean, {
apiUrl: string;
}, {
state: AppState;
rejectValue: RequestError;
dispatch?: import("redux").Dispatch<import("redux").UnknownAction> | undefined;
extra?: unknown;
serializedErrorType?: unknown;
pendingMeta?: unknown;
fulfilledMeta?: unknown;
rejectedMeta?: unknown;
}>;
export declare const fetchPaymentConfigs: import("@reduxjs/toolkit").AsyncThunk<any, {
apiUrl: string;
posTerminalId: number;
}, {
state: AppState;
rejectValue: RequestError;
dispatch?: import("redux").Dispatch<import("redux").UnknownAction> | undefined;
extra?: unknown;
serializedErrorType?: unknown;
pendingMeta?: unknown;
fulfilledMeta?: unknown;
rejectedMeta?: unknown;
}>;
export declare const resetKiosk: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"kiosk/resetKiosk">, resetKioskRetries: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"kiosk/resetKioskRetries">, incrementKioskRetries: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"kiosk/incrementKioskRetries">, setKioskVersion: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "kiosk/setKioskVersion">, setKioskRatio: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "kiosk/setKioskRatio">, setKioskConfig: import("@reduxjs/toolkit").ActionCreatorWithPayload<AppConfig | null, "kiosk/setKioskConfig">, setKioskStyles: import("@reduxjs/toolkit").ActionCreatorWithPayload<KioskStyles | null, "kiosk/setKioskStyles">;
export declare const selectKiosk: (state: AppState) => KioskState;
export declare const selectKioskVersion: (state: AppState) => string | null | undefined;
export declare const selectKioskStore: (state: AppState) => Store | null;
export declare const selectKioskBrand: (state: AppState) => KioskBrand | null;
export declare const selectKioskDevices: (state: AppState) => Devices | null;
export declare const selectTerminalId: (state: AppState) => number | null;
export declare const selectStoreSettings: ((state: {
alerts: import("@open-tender/types").Alerts;
allergens: import("./allergens").AllergensState;
arrivals: import("./arrivals").ArrivalsState;
cartSummary: import("./cartSummary").CartSummaryState;
checkout: import("./checkout").CheckoutState;
config: import("./config").ConfigState;
customer: import("./customer").CustomerState;
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
deals: import("./deals").DealsState;
discounts: import("./discounts").DiscountsState;
errorAlerts: import("./errorAlerts").ErrorAlertsState;
kds: import("./kds").KdsState;
kiosk: KioskState;
menu: import("./menu").MenuState;
menuPages: import("./menuPages").MenuPagesState;
modal: import("./modal").ModalState;
notifications: import("@open-tender/types").Notifications;
offlineAuths: import("./offlineAuths").OfflineAuthsState;
order: import("./order").OrderState;
pos: import("./pos").PosState;
punches: import("./punches").PunchesState;
refund: import("./refund").RefundState;
sendReceipt: import("./sendReceipt").SendReceiptState;
settings: import("./settings").SettingsState;
sidebar: import("./sidebar").SidebarState;
surcharges: import("./surcharges").SurchargesState;
taxes: import("./taxes").TaxesState;
idle: import("./idle").IdleState;
tags: import("./tags").TagsState;
revenueCenter: import("./revenueCenter").RevenueCenterState;
}) => Store) & {
clearCache: () => void;
resultsCount: () => number;
resetResultsCount: () => void;
} & {
resultFunc: (resultFuncArgs_0: Store | null) => Store;
memoizedResultFunc: ((resultFuncArgs_0: Store | null) => Store) & {
clearCache: () => void;
resultsCount: () => number;
resetResultsCount: () => void;
};
lastResult: () => Store;
dependencies: [(state: AppState) => Store | null];
recomputations: () => number;
resetRecomputations: () => void;
dependencyRecomputations: () => number;
resetDependencyRecomputations: () => void;
} & {
argsMemoize: typeof import("reselect").weakMapMemoize;
memoize: typeof import("reselect").weakMapMemoize;
};
export declare const selectKioskTerminal: ((state: {
alerts: import("@open-tender/types").Alerts;
allergens: import("./allergens").AllergensState;
arrivals: import("./arrivals").ArrivalsState;
cartSummary: import("./cartSummary").CartSummaryState;
checkout: import("./checkout").CheckoutState;
config: import("./config").ConfigState;
customer: import("./customer").CustomerState;
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
deals: import("./deals").DealsState;
discounts: import("./discounts").DiscountsState;
errorAlerts: import("./errorAlerts").ErrorAlertsState;
kds: import("./kds").KdsState;
kiosk: KioskState;
menu: import("./menu").MenuState;
menuPages: import("./menuPages").MenuPagesState;
modal: import("./modal").ModalState;
notifications: import("@open-tender/types").Notifications;
offlineAuths: import("./offlineAuths").OfflineAuthsState;
order: import("./order").OrderState;
pos: import("./pos").PosState;
punches: import("./punches").PunchesState;
refund: import("./refund").RefundState;
sendReceipt: import("./sendReceipt").SendReceiptState;
settings: import("./settings").SettingsState;
sidebar: import("./sidebar").SidebarState;
surcharges: import("./surcharges").SurchargesState;
taxes: import("./taxes").TaxesState;
idle: import("./idle").IdleState;
tags: import("./tags").TagsState;
revenueCenter: import("./revenueCenter").RevenueCenterState;
}) => import("@open-tender/types").PosTerminal | null) & {
clearCache: () => void;
resultsCount: () => number;
resetResultsCount: () => void;
} & {
resultFunc: (resultFuncArgs_0: Devices | null, resultFuncArgs_1: number | null) => import("@open-tender/types").PosTerminal | null;
memoizedResultFunc: ((resultFuncArgs_0: Devices | null, resultFuncArgs_1: number | null) => import("@open-tender/types").PosTerminal | null) & {
clearCache: () => void;
resultsCount: () => number;
resetResultsCount: () => void;
};
lastResult: () => import("@open-tender/types").PosTerminal | null;
dependencies: [(state: AppState) => Devices | null, (state: AppState) => number | null];
recomputations: () => number;
resetRecomputations: () => void;
dependencyRecomputations: () => number;
resetDependencyRecomputations: () => void;
} & {
argsMemoize: typeof import("reselect").weakMapMemoize;
memoize: typeof import("reselect").weakMapMemoize;
};
export declare const selectKioskHasPrinter: ((state: {
alerts: import("@open-tender/types").Alerts;
allergens: import("./allergens").AllergensState;
arrivals: import("./arrivals").ArrivalsState;
cartSummary: import("./cartSummary").CartSummaryState;
checkout: import("./checkout").CheckoutState;
config: import("./config").ConfigState;
customer: import("./customer").CustomerState;
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
deals: import("./deals").DealsState;
discounts: import("./discounts").DiscountsState;
errorAlerts: import("./errorAlerts").ErrorAlertsState;
kds: import("./kds").KdsState;
kiosk: KioskState;
menu: import("./menu").MenuState;
menuPages: import("./menuPages").MenuPagesState;
modal: import("./modal").ModalState;
notifications: import("@open-tender/types").Notifications;
offlineAuths: import("./offlineAuths").OfflineAuthsState;
order: import("./order").OrderState;
pos: import("./pos").PosState;
punches: import("./punches").PunchesState;
refund: import("./refund").RefundState;
sendReceipt: import("./sendReceipt").SendReceiptState;
settings: import("./settings").SettingsState;
sidebar: import("./sidebar").SidebarState;
surcharges: import("./surcharges").SurchargesState;
taxes: import("./taxes").TaxesState;
idle: import("./idle").IdleState;
tags: import("./tags").TagsState;
revenueCenter: import("./revenueCenter").RevenueCenterState;
}) => boolean) & {
clearCache: () => void;
resultsCount: () => number;
resetResultsCount: () => void;
} & {
resultFunc: (resultFuncArgs_0: Devices | null, resultFuncArgs_1: number | null) => boolean;
memoizedResultFunc: ((resultFuncArgs_0: Devices | null, resultFuncArgs_1: number | null) => boolean) & {
clearCache: () => void;
resultsCount: () => number;
resetResultsCount: () => void;
};
lastResult: () => boolean;
dependencies: [(state: AppState) => Devices | null, (state: AppState) => number | null];
recomputations: () => number;
resetRecomputations: () => void;
dependencyRecomputations: () => number;
resetDependencyRecomputations: () => void;
} & {
argsMemoize: typeof import("reselect").weakMapMemoize;
memoize: typeof import("reselect").weakMapMemoize;
};
export declare const selectKioskHasScanner: ((state: {
alerts: import("@open-tender/types").Alerts;
allergens: import("./allergens").AllergensState;
arrivals: import("./arrivals").ArrivalsState;
cartSummary: import("./cartSummary").CartSummaryState;
checkout: import("./checkout").CheckoutState;
config: import("./config").ConfigState;
customer: import("./customer").CustomerState;
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
deals: import("./deals").DealsState;
discounts: import("./discounts").DiscountsState;
errorAlerts: import("./errorAlerts").ErrorAlertsState;
kds: import("./kds").KdsState;
kiosk: KioskState;
menu: import("./menu").MenuState;
menuPages: import("./menuPages").MenuPagesState;
modal: import("./modal").ModalState;
notifications: import("@open-tender/types").Notifications;
offlineAuths: import("./offlineAuths").OfflineAuthsState;
order: import("./order").OrderState;
pos: import("./pos").PosState;
punches: import("./punches").PunchesState;
refund: import("./refund").RefundState;
sendReceipt: import("./sendReceipt").SendReceiptState;
settings: import("./settings").SettingsState;
sidebar: import("./sidebar").SidebarState;
surcharges: import("./surcharges").SurchargesState;
taxes: import("./taxes").TaxesState;
idle: import("./idle").IdleState;
tags: import("./tags").TagsState;
revenueCenter: import("./revenueCenter").RevenueCenterState;
}) => boolean) & {
clearCache: () => void;
resultsCount: () => number;
resetResultsCount: () => void;
} & {
resultFunc: (resultFuncArgs_0: Devices | null, resultFuncArgs_1: number | null) => boolean;
memoizedResultFunc: ((resultFuncArgs_0: Devices | null, resultFuncArgs_1: number | null) => boolean) & {
clearCache: () => void;
resultsCount: () => number;
resetResultsCount: () => void;
};
lastResult: () => boolean;
dependencies: [(state: AppState) => Devices | null, (state: AppState) => number | null];
recomputations: () => number;
resetRecomputations: () => void;
dependencyRecomputations: () => number;
resetDependencyRecomputations: () => void;
} & {
argsMemoize: typeof import("reselect").weakMapMemoize;
memoize: typeof import("reselect").weakMapMemoize;
};
export declare const selectKioskApi: ((state: {
alerts: import("@open-tender/types").Alerts;
allergens: import("./allergens").AllergensState;
arrivals: import("./arrivals").ArrivalsState;
cartSummary: import("./cartSummary").CartSummaryState;
checkout: import("./checkout").CheckoutState;
config: import("./config").ConfigState;
customer: import("./customer").CustomerState;
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
deals: import("./deals").DealsState;
discounts: import("./discounts").DiscountsState;
errorAlerts: import("./errorAlerts").ErrorAlertsState;
kds: import("./kds").KdsState;
kiosk: KioskState;
menu: import("./menu").MenuState;
menuPages: import("./menuPages").MenuPagesState;
modal: import("./modal").ModalState;
notifications: import("@open-tender/types").Notifications;
offlineAuths: import("./offlineAuths").OfflineAuthsState;
order: import("./order").OrderState;
pos: import("./pos").PosState;
punches: import("./punches").PunchesState;
refund: import("./refund").RefundState;
sendReceipt: import("./sendReceipt").SendReceiptState;
settings: import("./settings").SettingsState;
sidebar: import("./sidebar").SidebarState;
surcharges: import("./surcharges").SurchargesState;
taxes: import("./taxes").TaxesState;
idle: import("./idle").IdleState;
tags: import("./tags").TagsState;
revenueCenter: import("./revenueCenter").RevenueCenterState;
}) => string) & {
clearCache: () => void;
resultsCount: () => number;
resetResultsCount: () => void;
} & {
resultFunc: (resultFuncArgs_0: KioskApp | null) => string;
memoizedResultFunc: ((resultFuncArgs_0: KioskApp | null) => string) & {
clearCache: () => void;
resultsCount: () => number;
resetResultsCount: () => void;
};
lastResult: () => string;
dependencies: [(state: AppState) => KioskApp | null];
recomputations: () => number;
resetRecomputations: () => void;
dependencyRecomputations: () => number;
resetDependencyRecomputations: () => void;
} & {
argsMemoize: typeof import("reselect").weakMapMemoize;
memoize: typeof import("reselect").weakMapMemoize;
};
export declare const selectKioskConfig: ((state: {
alerts: import("@open-tender/types").Alerts;
allergens: import("./allergens").AllergensState;
arrivals: import("./arrivals").ArrivalsState;
cartSummary: import("./cartSummary").CartSummaryState;
checkout: import("./checkout").CheckoutState;
config: import("./config").ConfigState;
customer: import("./customer").CustomerState;
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
deals: import("./deals").DealsState;
discounts: import("./discounts").DiscountsState;
errorAlerts: import("./errorAlerts").ErrorAlertsState;
kds: import("./kds").KdsState;
kiosk: KioskState;
menu: import("./menu").MenuState;
menuPages: import("./menuPages").MenuPagesState;
modal: import("./modal").ModalState;
notifications: import("@open-tender/types").Notifications;
offlineAuths: import("./offlineAuths").OfflineAuthsState;
order: import("./order").OrderState;
pos: import("./pos").PosState;
punches: import("./punches").PunchesState;
refund: import("./refund").RefundState;
sendReceipt: import("./sendReceipt").SendReceiptState;
settings: import("./settings").SettingsState;
sidebar: import("./sidebar").SidebarState;
surcharges: import("./surcharges").SurchargesState;
taxes: import("./taxes").TaxesState;
idle: import("./idle").IdleState;
tags: import("./tags").TagsState;
revenueCenter: import("./revenueCenter").RevenueCenterState;
}) => AppConfig) & {
clearCache: () => void;
resultsCount: () => number;
resetResultsCount: () => void;
} & {
resultFunc: (resultFuncArgs_0: AppConfig | null) => AppConfig;
memoizedResultFunc: ((resultFuncArgs_0: AppConfig | null) => AppConfig) & {
clearCache: () => void;
resultsCount: () => number;
resetResultsCount: () => void;
};
lastResult: () => AppConfig;
dependencies: [(state: AppState) => AppConfig | null];
recomputations: () => number;
resetRecomputations: () => void;
dependencyRecomputations: () => number;
resetDependencyRecomputations: () => void;
} & {
argsMemoize: typeof import("reselect").weakMapMemoize;
memoize: typeof import("reselect").weakMapMemoize;
};
export declare const selectKioskConfigScreen: (screen: string) => ((state: {
alerts: import("@open-tender/types").Alerts;
allergens: import("./allergens").AllergensState;
arrivals: import("./arrivals").ArrivalsState;
cartSummary: import("./cartSummary").CartSummaryState;
checkout: import("./checkout").CheckoutState;
config: import("./config").ConfigState;
customer: import("./customer").CustomerState;
customerIdentify: import("./customerIdentify").CustomerIdentifyState;
deals: import("./deals").DealsState;
discounts: import("./discounts").DiscountsState;
errorAlerts: import("./errorAlerts").ErrorAlertsState;
kds: import("./kds").KdsState;
kiosk: KioskState;
menu: import("./menu").MenuState;
menuPages: import("./menuPages").MenuPagesState;
modal: import("./modal").ModalState;
notifications: import("@open-tender/types").Notifications;
offlineAuths: import("./offlineAuths").OfflineAuthsState;
order: import("./order").OrderState;
pos: import("./pos").PosState;
punches: import("./punches").PunchesState;
refund: import("./refund").RefundState;
sendReceipt: import("./sendReceipt").SendReceiptState;
settings: import("./settings").SettingsState;
sidebar: import("./sidebar").SidebarState;
surcharges: import("./surcharges").SurchargesState;
taxes: import("./taxes").TaxesState;
idle: import("./idle").IdleState;
tags: import("./tags").TagsState;
revenueCenter: import("./revenueCenter").RevenueCenterState;
}) => import("@open-tender/ui").ScreenConfig | null) & {
clearCache: () => void;
resultsCount: () => number;
resetResultsCount: () => void;
} & {
resultFunc: (resultFuncArgs_0: AppConfig | null) => import("@open-tender/ui").ScreenConfig | null;
memoizedResultFunc: ((resultFuncArgs_0: AppConfig | null) => import("@open-tender/ui").ScreenConfig | null) & {
clearCache: () => void;
resultsCount: () => number;
resetResultsCount: () => void;
};
lastResult: () => import("@open-tender/ui").ScreenConfig | null;
dependencies: [(state: AppState) => AppConfig | null];
recomputations: () => number;
resetRecomputations: () => void;
dependencyRecomputations: () => number;
resetDependencyRecomputations: () => void;
} & {
argsMemoize: typeof import("reselect").weakMapMemoize;
memoize: typeof import("reselect").weakMapMemoize;
};
export declare const selectKioskStyles: (state: AppState) => KioskStyles | null;
export declare const selectKioskRatio: (state: AppState) => number;
export declare const kioskReducer: import("redux").Reducer<KioskState>;