@use-stall/types 0.3.5 → 0.3.7
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/package.json +1 -1
- package/src/extensions.d.ts +27 -12
- package/src/lookup.d.ts +52 -32
- package/src/payments.d.ts +7 -0
- package/src/utils/lookup.d.ts +0 -17
package/package.json
CHANGED
package/src/extensions.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import { UnifiedOrderType } from "./orders";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
LookupActionHelpersType,
|
|
5
|
+
LookupGroupRouteType,
|
|
6
|
+
LookupListFilterType,
|
|
7
|
+
} from "./lookup";
|
|
4
8
|
import type { CoreConfig } from "./core-sdk";
|
|
5
9
|
|
|
6
10
|
interface StallExtension {
|
|
@@ -26,22 +30,23 @@ interface ExtensionActionShortcut {
|
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
interface ExtensionLookupAction {
|
|
29
|
-
|
|
30
|
-
name: string;
|
|
33
|
+
id: string;
|
|
31
34
|
label: string;
|
|
32
|
-
|
|
33
|
-
close_on_complete: boolean; // Close lookup
|
|
35
|
+
close_on_complete?: boolean; // Close lookup
|
|
34
36
|
reopen_on_return?: boolean; // Reopen lookup on return from an external page
|
|
35
37
|
always_show?: boolean; // Always show the action in the lookup even if no item is selected or highlighted
|
|
36
38
|
shortcut?: ExtensionActionShortcut;
|
|
37
39
|
paths?: string[]; // You can specify a list of paths where this action should be available, when left empty it will be available everywhere
|
|
40
|
+
static_args?: Record<string, any>;
|
|
41
|
+
run: (arg: ExtensionLookupActionArgs) => Promise<void> | void;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
|
-
interface
|
|
41
|
-
|
|
42
|
-
item: any;
|
|
43
|
-
router: Router;
|
|
44
|
+
interface ExtensionLookupActionArgs {
|
|
45
|
+
item: any | null;
|
|
44
46
|
active_group: LookupGroupRouteType;
|
|
47
|
+
search_query: string;
|
|
48
|
+
helpers: LookupActionHelpersType;
|
|
49
|
+
static_args: Record<string, any>;
|
|
45
50
|
action: ExtensionLookupAction;
|
|
46
51
|
}
|
|
47
52
|
|
|
@@ -86,12 +91,20 @@ type ListFilters = {
|
|
|
86
91
|
dynamic: boolean;
|
|
87
92
|
};
|
|
88
93
|
|
|
94
|
+
interface ExtensionLookupFetchArgs {
|
|
95
|
+
filters: LookupListFilterType[];
|
|
96
|
+
active_group: LookupGroupRouteType;
|
|
97
|
+
parent_item: Record<string, any>;
|
|
98
|
+
search_query: string;
|
|
99
|
+
helpers: LookupActionHelpersType;
|
|
100
|
+
}
|
|
101
|
+
|
|
89
102
|
interface LocalListUIComponent {
|
|
90
103
|
id: string;
|
|
91
104
|
title: string;
|
|
92
105
|
description: string;
|
|
93
106
|
data_origin: "local";
|
|
94
|
-
filters:
|
|
107
|
+
filters: LookupListFilterType[];
|
|
95
108
|
sorting: {
|
|
96
109
|
key: string;
|
|
97
110
|
order: "asc" | "desc";
|
|
@@ -106,12 +119,13 @@ interface RemoteListUIComponent {
|
|
|
106
119
|
title: string;
|
|
107
120
|
description: string;
|
|
108
121
|
data_origin: "remote";
|
|
109
|
-
filters:
|
|
122
|
+
filters: LookupListFilterType[];
|
|
110
123
|
sorting: {
|
|
111
124
|
key: string;
|
|
112
125
|
order: "asc" | "desc";
|
|
113
126
|
};
|
|
114
127
|
source: string;
|
|
128
|
+
fetch: (arg: ExtensionLookupFetchArgs) => Promise<any[]> | any[];
|
|
115
129
|
keys: ListKeys;
|
|
116
130
|
actions: ExtensionLookupAction[];
|
|
117
131
|
}
|
|
@@ -153,7 +167,8 @@ export type {
|
|
|
153
167
|
ExtensionPage,
|
|
154
168
|
ExtensionActionShortcut,
|
|
155
169
|
ExtensionLookupAction,
|
|
156
|
-
|
|
170
|
+
ExtensionLookupActionArgs,
|
|
171
|
+
ExtensionLookupFetchArgs,
|
|
157
172
|
ListFilters,
|
|
158
173
|
ListFormatKey,
|
|
159
174
|
ListKeys,
|
package/src/lookup.d.ts
CHANGED
|
@@ -1,45 +1,65 @@
|
|
|
1
|
-
import { ExtensionModule } from "@/extensions/types";
|
|
2
|
-
import React from "react";
|
|
3
|
-
|
|
4
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
export type LookupValueType = "string" | "number" | "array";
|
|
3
|
+
|
|
4
|
+
export interface LookupListFilterType {
|
|
5
|
+
key: string;
|
|
6
|
+
type: LookupValueType;
|
|
7
|
+
query_value: string;
|
|
8
|
+
dynamic: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface LookupRouteExtensionType {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
export interface LookupGroupRouteType {
|
|
13
17
|
id: string;
|
|
14
18
|
title: string;
|
|
15
|
-
extension:
|
|
16
|
-
id: string;
|
|
17
|
-
title: string;
|
|
18
|
-
};
|
|
19
|
+
extension: LookupRouteExtensionType;
|
|
19
20
|
previous_route_item: Record<string, any>;
|
|
20
|
-
filters?:
|
|
21
|
+
filters?: LookupListFilterType[];
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
24
|
+
export interface LookupStateType {
|
|
25
|
+
active_group: LookupGroupRouteType | undefined;
|
|
26
|
+
routes: LookupGroupRouteType[];
|
|
27
|
+
search_query: string;
|
|
28
|
+
is_shortcut?: boolean;
|
|
29
|
+
}
|
|
29
30
|
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
}
|
|
31
|
+
export interface LookupLastInstanceType extends LookupStateType {
|
|
32
|
+
path: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface LookupOpenGroupArgsType {
|
|
36
|
+
group: Omit<LookupGroupRouteType, "previous_route_item">;
|
|
37
|
+
item?: Record<string, any>;
|
|
38
|
+
}
|
|
33
39
|
|
|
34
|
-
export interface
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
export interface LookupActionHelpersType {
|
|
41
|
+
navigate: (
|
|
42
|
+
path: string | number,
|
|
43
|
+
options?: {
|
|
44
|
+
replace?: boolean;
|
|
45
|
+
reopen_on_return?: boolean;
|
|
46
|
+
lookup_item?: any;
|
|
47
|
+
},
|
|
48
|
+
) => void;
|
|
49
|
+
open_group: (arg: LookupOpenGroupArgsType) => void;
|
|
50
|
+
go_back: (force?: boolean) => void;
|
|
51
|
+
close_lookup: (force?: boolean) => void;
|
|
52
|
+
set_search_query: (value: string) => void;
|
|
53
|
+
get_lookup_state: () => LookupStateType | null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface LookUpStateType {
|
|
43
57
|
active_group: LookupGroupRouteType | undefined;
|
|
44
|
-
|
|
58
|
+
routes: LookupGroupRouteType[];
|
|
59
|
+
search_query: string;
|
|
60
|
+
is_shortcut?: boolean;
|
|
45
61
|
}
|
|
62
|
+
|
|
63
|
+
export type LookupActionTriggerType = null | {
|
|
64
|
+
global: boolean;
|
|
65
|
+
};
|
package/src/payments.d.ts
CHANGED
|
@@ -51,6 +51,13 @@ export interface UnifiedPaymentProviderConfigType {
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
export interface FrontendPaymentMethodType {
|
|
55
|
+
provider: string;
|
|
56
|
+
external_id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
type: UnifiedMethodsType;
|
|
59
|
+
}
|
|
60
|
+
|
|
54
61
|
export type UnifiedPaymentCollectionStatus =
|
|
55
62
|
| "pending"
|
|
56
63
|
| "processing"
|
package/src/utils/lookup.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface LookupGroupRouteType {
|
|
2
|
-
id: string;
|
|
3
|
-
title: string;
|
|
4
|
-
extension: {
|
|
5
|
-
id: string;
|
|
6
|
-
title: string;
|
|
7
|
-
};
|
|
8
|
-
previous_route_item: Record<string, any>;
|
|
9
|
-
filters?: LookupListFilters[];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type LookupListFilters = {
|
|
13
|
-
key: string;
|
|
14
|
-
type: "string" | "number" | "array";
|
|
15
|
-
query_value: string;
|
|
16
|
-
dynamic: boolean;
|
|
17
|
-
};
|