-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
100 lines (84 loc) · 3.37 KB
/
index.d.ts
File metadata and controls
100 lines (84 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import type { ComputedRef, WritableComputedRef } from 'vue'
import type { Endpoint, MessageEndpoint, RemoteCallable } from '@remote-ui/rpc'
import type {
ContextAccessor,
ContextSchema,
CustomFieldKind,
IsReadonly,
RejectionHandler,
TypeOf,
TypeOfCustom,
} from '@retailcrm/embed-ui-v1-types/context'
import type {
ContextStore,
ContextStoreDefinition,
} from '@retailcrm/embed-ui-v1-contexts/remote'
import type { Router } from '@omnicajs/symfony-router'
import type {
Schema as CurrentUserSchema,
} from '@retailcrm/embed-ui-v1-contexts/types/user/current'
import type {
Schema as CustomerCardPhoneSchema,
} from '@retailcrm/embed-ui-v1-contexts/types/customer/card-phone'
import type {
Schema as CustomerCardSchema,
} from '@retailcrm/embed-ui-v1-contexts/types/customer/card'
import type {
Schema as OrderCardSchema,
} from '@retailcrm/embed-ui-v1-contexts/types/order/card'
import type {
Schema as OrderCardSettingsSchema,
} from '@retailcrm/embed-ui-v1-contexts/types/order/card-settings'
import type {
Schema as SettingsSchema,
} from '@retailcrm/embed-ui-v1-contexts/types/settings'
import type { SchemaList } from '@retailcrm/embed-ui-v1-contexts/types'
import type { Callable } from './types/host/callable'
import type { WidgetRunner } from './types/widget'
export declare const createWidgetEndpoint: (
widget: WidgetRunner,
messenger: MessageEndpoint
) => Endpoint<ContextAccessor<SchemaList> & Callable>
export type { ContextStore }
export type { ContextStoreDefinition }
export declare const useField: <S extends ContextSchema, F extends keyof S>(
store: ContextStore<S>,
field: F,
onReject?: RejectionHandler | null
) => IsReadonly<S[F]> extends true
? ComputedRef<TypeOf<S[F]>>
: WritableComputedRef<TypeOf<S[F]>>
export declare const useCustomField: <
T extends string,
K extends CustomFieldKind = CustomFieldKind,
R extends boolean = false
>(
store: CustomContextStore<T>,
code: string,
options?: {
kind?: K | K[],
readonly?: R,
onReject?: RejectionHandler,
}
) => R extends false
? WritableComputedRef<TypeOfCustom<K> | null, TypeOfCustom<K>>
: ComputedRef<TypeOfCustom<K> | null>
export declare const useHost = () => RemoteCallable<Callable>
declare module 'pinia' {
interface PiniaCustomProperties {
endpoint: Endpoint<ContextAccessor & Callable>;
}
}
export declare const customerCardSchema: CustomerCardSchema
export declare const customerCardPhoneSchema: CustomerCardPhoneSchema
export declare const orderCardSchema: OrderCardSchema
export declare const orderCardSettingsSchema: OrderCardSettingsSchema
export declare const currentUserSchema: CurrentUserSchema
export declare const settingsSchema: SettingsSchema
export declare const useCustomerCardContext: ContextStoreDefinition<'customer/card', CustomerCardSchema>
export declare const useCustomerCardPhoneContext: ContextStoreDefinition<'customer/card:phone', CustomerCardPhoneSchema>
export declare const useOrderCardContext: ContextStoreDefinition<'order/card', OrderCardSchema>
export declare const useOrderCardSettingsContext: ContextStoreDefinition<'order/card:settings', OrderCardSettingsSchema>
export declare const useCurrentUserContext: ContextStoreDefinition<'user/current', CurrentUserSchema>
export declare const useSettingsContext: ContextStoreDefinition<'settings', SettingsSchema>
export declare const useRouter: () => ComputedRef<Pick<Router, 'generate'>>