1 | import { ClientApplication } from '../client';
|
2 | import { ActionSet } from './helper';
|
3 | import { ErrorAction } from './Error/actions';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | export declare enum Group {
|
9 | AuthCode = "AuthCode",
|
10 | Button = "Button",
|
11 | ButtonGroup = "ButtonGroup",
|
12 | Cart = "Cart",
|
13 | ContextualSaveBar = "ContextualSaveBar",
|
14 | Error = "Error",
|
15 | Features = "Features",
|
16 | Fullscreen = "Fullscreen",
|
17 | Link = "Link",
|
18 | Loading = "Loading",
|
19 | Menu = "Menu",
|
20 | Modal = "Modal",
|
21 | Navigation = "Navigation",
|
22 | Pos = "Pos",
|
23 | Print = "Print",
|
24 | ResourcePicker = "Resource_Picker",
|
25 | Scanner = "Scanner",
|
26 | SessionToken = "SessionToken",
|
27 | Share = "Share",
|
28 | TitleBar = "TitleBar",
|
29 | Toast = "Toast"
|
30 | }
|
31 |
|
32 |
|
33 |
|
34 | export declare enum ComponentType {
|
35 | Button = "Button",
|
36 | ButtonGroup = "ButtonGroup"
|
37 | }
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | export interface AnyAction {
|
47 | type: any;
|
48 | [extraProps: string]: any;
|
49 | }
|
50 | export interface ClientInterface {
|
51 | name?: string;
|
52 | version?: string;
|
53 | }
|
54 |
|
55 |
|
56 |
|
57 | export interface MetaAction extends AnyAction {
|
58 | clientInterface?: ClientInterface;
|
59 | readonly version: string;
|
60 | readonly group: string;
|
61 | readonly type: string;
|
62 | payload?: any;
|
63 | }
|
64 |
|
65 |
|
66 |
|
67 | export interface ClickAction extends MetaAction {
|
68 | payload: {
|
69 | id: string;
|
70 | payload?: any;
|
71 | };
|
72 | }
|
73 |
|
74 |
|
75 |
|
76 | export interface ActionCallback {
|
77 | (data: any): void;
|
78 | }
|
79 |
|
80 |
|
81 |
|
82 | export interface ErrorCallback {
|
83 | (data: ErrorAction): void;
|
84 | }
|
85 |
|
86 |
|
87 |
|
88 | export interface UpdateSubscribe {
|
89 | (group: string, subgroups: string[]): void;
|
90 | }
|
91 |
|
92 |
|
93 |
|
94 | export interface Unsubscribe {
|
95 | (): void;
|
96 | }
|
97 |
|
98 |
|
99 |
|
100 | export interface ErrorSubscriber {
|
101 | (callback: ErrorCallback): Unsubscribe;
|
102 | }
|
103 |
|
104 |
|
105 |
|
106 | export interface ActionSubscription {
|
107 | component: Component;
|
108 | eventType: string;
|
109 | callback: ActionCallback;
|
110 | unsubscribe: Unsubscribe;
|
111 | updateSubscribe: UpdateSubscribe;
|
112 | }
|
113 |
|
114 |
|
115 |
|
116 | export interface UpdateSubscription {
|
117 | (subscriptionToRemove: ActionSubscription, group: string, subgroups: string[]): void;
|
118 | }
|
119 |
|
120 |
|
121 |
|
122 | export interface Component {
|
123 | readonly id: string;
|
124 | readonly type: string;
|
125 | subgroups?: string[];
|
126 | }
|
127 |
|
128 |
|
129 |
|
130 | export interface ActionSetInterface extends Component {
|
131 | readonly app: ClientApplication<any>;
|
132 | readonly defaultGroup: string;
|
133 | group: string;
|
134 | component: Component;
|
135 | subscriptions: ActionSubscription[];
|
136 | updateSubscription: UpdateSubscription;
|
137 | error: ErrorSubscriber;
|
138 | subscribe(eventName: string, callback: ActionCallback, component?: Component, currentIndex?: number): Unsubscribe;
|
139 | unsubscribe(resetOnly: boolean): ActionSetInterface;
|
140 | }
|
141 |
|
142 |
|
143 |
|
144 | export interface DispatchAction {
|
145 | type: string;
|
146 | payload: any;
|
147 | }
|
148 |
|
149 |
|
150 |
|
151 | export interface SimpleDispatch {
|
152 | dispatch(action: string): ActionSet;
|
153 | }
|
154 |
|
155 |
|
156 |
|
157 | export interface ComplexDispatch<P> {
|
158 | dispatch(action: string, payload: P): ActionSet;
|
159 | }
|
160 |
|
161 |
|
162 |
|
163 | export interface ActionSetProps<T, P> extends SimpleDispatch {
|
164 | options: T;
|
165 | payload: P;
|
166 | set(options: Partial<T>): ActionSet;
|
167 | }
|
168 |
|
169 |
|
170 |
|
171 | export interface ActionSetPayload<P> extends SimpleDispatch {
|
172 | payload: P;
|
173 | }
|
174 |
|
175 |
|
176 |
|
177 | export interface ActionSetOptions<T> {
|
178 | options: T;
|
179 | set(options: Partial<T>): ActionSet;
|
180 | }
|
181 |
|
182 |
|
183 |
|
184 | export interface Dispatch<_> {
|
185 | <A extends AnyAction>(action: A): A;
|
186 | }
|