@hubspot/ui-extensions 0.0.1-prealpha.3 → 0.0.1-prealpha.5
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/README.md +375 -17
- package/dist/coreComponents.d.ts +142 -0
- package/dist/coreComponents.js +30 -0
- package/dist/crm/components.d.ts +7 -0
- package/dist/crm/components.js +3 -0
- package/dist/crm/index.d.ts +2 -0
- package/dist/crm/index.js +2 -0
- package/dist/hubspot.d.ts +7 -0
- package/dist/hubspot.js +17 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/types.d.ts +263 -0
- package/dist/utils/createExtensionComponent.d.ts +3 -0
- package/dist/utils/createExtensionComponent.js +4 -0
- package/package.json +38 -4
- package/CrmComponents/crmComponents.ts +0 -11
- package/coreComponents.ts +0 -94
- package/hubspot.ts +0 -32
- package/index.ts +0 -25
- package/types.ts +0 -297
- package/utils/createExtensionComponent.ts +0 -20
- /package/{CrmComponents/index.ts → dist/types.js} +0 -0
package/types.ts
DELETED
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
// Do not manually update this file, changes will be overridden from ui-extensions-remote-renderer/static/js/types.ts
|
|
2
|
-
import { ReactNode, ComponentType } from 'react';
|
|
3
|
-
|
|
4
|
-
export interface AlertProps {
|
|
5
|
-
title: string;
|
|
6
|
-
body?: string;
|
|
7
|
-
children?: ReactNode;
|
|
8
|
-
variant?: 'info' | 'warning' | 'success' | 'error' | 'danger';
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface ButtonProps {
|
|
12
|
-
text: string;
|
|
13
|
-
onClick?: () => void;
|
|
14
|
-
href?: string;
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
variant?: 'primary' | 'secondary' | 'destructive';
|
|
17
|
-
type?: 'button' | 'reset' | 'submit';
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface ButtonRowProps {
|
|
21
|
-
children: ReactNode;
|
|
22
|
-
disableDropdown?: boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface CardProps {
|
|
26
|
-
children: ReactNode;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface DescriptionListItemProps {
|
|
30
|
-
children: ReactNode;
|
|
31
|
-
label: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface DescriptionListProps {
|
|
35
|
-
children: ReactNode;
|
|
36
|
-
direction?: 'row' | 'column';
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface DividerProps {
|
|
40
|
-
distance?:
|
|
41
|
-
| 'flush'
|
|
42
|
-
| 'extra-small'
|
|
43
|
-
| 'small'
|
|
44
|
-
| 'medium'
|
|
45
|
-
| 'large'
|
|
46
|
-
| 'extra-large';
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface FormProps {
|
|
50
|
-
children: ReactNode;
|
|
51
|
-
onSubmit?: () => void;
|
|
52
|
-
preventDefault?: boolean;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface HeadingProps {
|
|
56
|
-
text: string;
|
|
57
|
-
format?: 'plaintext' | 'markdown';
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface ImageProps {
|
|
61
|
-
alt?: string;
|
|
62
|
-
href?: string;
|
|
63
|
-
onClick?: () => void;
|
|
64
|
-
src: string;
|
|
65
|
-
width?: number;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface InputProps {
|
|
69
|
-
label: string;
|
|
70
|
-
name: string;
|
|
71
|
-
value?: string;
|
|
72
|
-
required?: boolean;
|
|
73
|
-
readonly?: boolean;
|
|
74
|
-
description?: string;
|
|
75
|
-
tooltip?: string;
|
|
76
|
-
placeholder?: string;
|
|
77
|
-
error?: boolean;
|
|
78
|
-
errorMessage?: string;
|
|
79
|
-
onChange: (value: string) => void;
|
|
80
|
-
onInput: (value: string) => void;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export interface ProgressBarProps {
|
|
84
|
-
title?: string;
|
|
85
|
-
showPercentage?: boolean;
|
|
86
|
-
value?: number;
|
|
87
|
-
valueMax?: number;
|
|
88
|
-
valueDescription?: string;
|
|
89
|
-
variant?: 'success' | 'danger' | 'warning';
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface SelectProps {
|
|
93
|
-
label: string;
|
|
94
|
-
name: string;
|
|
95
|
-
value?: string | number | boolean;
|
|
96
|
-
required?: boolean;
|
|
97
|
-
readonly?: boolean;
|
|
98
|
-
description?: string;
|
|
99
|
-
tooltip?: string;
|
|
100
|
-
placeholder?: string;
|
|
101
|
-
error?: boolean;
|
|
102
|
-
errorMessage?: string;
|
|
103
|
-
onChange: (value: string) => void;
|
|
104
|
-
options: {
|
|
105
|
-
label: string;
|
|
106
|
-
value: string | number | boolean;
|
|
107
|
-
}[];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export interface TagProps {
|
|
111
|
-
text: string;
|
|
112
|
-
onClick?: () => void;
|
|
113
|
-
variant?: 'default' | 'warning' | 'success' | 'error';
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export interface TextProps {
|
|
117
|
-
format?: 'plaintext' | 'markdown';
|
|
118
|
-
text: string;
|
|
119
|
-
variant?: 'bodytext' | 'microcopy';
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export interface TileProps {
|
|
123
|
-
children: ReactNode;
|
|
124
|
-
flush?: boolean;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
interface Team {
|
|
128
|
-
id: number;
|
|
129
|
-
name: string;
|
|
130
|
-
teammates: number[];
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export interface UserContext {
|
|
134
|
-
id: number;
|
|
135
|
-
emails: string[];
|
|
136
|
-
email: string;
|
|
137
|
-
firstName: string;
|
|
138
|
-
lastName: string;
|
|
139
|
-
roles: string[];
|
|
140
|
-
teams: Team[];
|
|
141
|
-
locale?: string;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export interface PortalContext {
|
|
145
|
-
id: number;
|
|
146
|
-
timezone: string;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export interface Context {
|
|
150
|
-
user: UserContext;
|
|
151
|
-
portal: PortalContext;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
type distanceOptions = 'flush' | 'small';
|
|
155
|
-
|
|
156
|
-
export interface StackProps {
|
|
157
|
-
distance?: distanceOptions;
|
|
158
|
-
children?: React.ReactNode;
|
|
159
|
-
}
|
|
160
|
-
export interface StatisticsTrendProps {
|
|
161
|
-
value: string;
|
|
162
|
-
direction: 'increase' | 'decrease';
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export interface StatisticsItemProps {
|
|
166
|
-
id?: string;
|
|
167
|
-
label: string;
|
|
168
|
-
number: string;
|
|
169
|
-
children: ReactNode;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export interface StatisticsProps {
|
|
173
|
-
children: ReactNode;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export interface ServerlessRunnerParams {
|
|
177
|
-
name: string;
|
|
178
|
-
payload: Record<string, unknown>;
|
|
179
|
-
onError?: () => void;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export type ServerlessFuncRunner = (
|
|
183
|
-
params: ServerlessRunnerParams
|
|
184
|
-
) => Promise<any>;
|
|
185
|
-
|
|
186
|
-
export interface ServerlessSuccessResponse {
|
|
187
|
-
logId: string;
|
|
188
|
-
response: {
|
|
189
|
-
message?:
|
|
190
|
-
| {
|
|
191
|
-
type: 'SUCCESS' | 'ERROR';
|
|
192
|
-
body: string;
|
|
193
|
-
}
|
|
194
|
-
| string;
|
|
195
|
-
context?: Record<string, unknown>;
|
|
196
|
-
section?: Record<string, unknown>;
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export interface ServerlessErrorResponse {
|
|
201
|
-
responseJSON?: {
|
|
202
|
-
message: string;
|
|
203
|
-
correlationId: string;
|
|
204
|
-
category: string;
|
|
205
|
-
subCategory?: string;
|
|
206
|
-
errors?: { message: string; subCategory: string }[];
|
|
207
|
-
};
|
|
208
|
-
status: number;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export interface ExtensionCardContextData {
|
|
212
|
-
cardId: string;
|
|
213
|
-
appId: number | string;
|
|
214
|
-
objectId: number | string;
|
|
215
|
-
objectTypeId: string;
|
|
216
|
-
location: keyof ExtensionPoints;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export type ExtensionPointAction = (...args: any[]) => Promise<any> | void;
|
|
220
|
-
|
|
221
|
-
export interface ExtensionPointContract {
|
|
222
|
-
actions?: { [k: string]: ExtensionPointAction } | {};
|
|
223
|
-
customComponents: Record<string, ComponentType<any>>;
|
|
224
|
-
}
|
|
225
|
-
type AlertType = 'info' | 'warning' | 'success' | 'danger' | 'tip' | undefined;
|
|
226
|
-
|
|
227
|
-
export type AddAlertAction = (args: {
|
|
228
|
-
type?: AlertType;
|
|
229
|
-
message: string;
|
|
230
|
-
}) => void;
|
|
231
|
-
|
|
232
|
-
export type ReloadPageAction = () => void;
|
|
233
|
-
|
|
234
|
-
export type FetchCrmObjectPropertiesAction = (
|
|
235
|
-
properties: string[]
|
|
236
|
-
) => Promise<{ name: string; value: string }[]>;
|
|
237
|
-
|
|
238
|
-
interface CrmMiddleExtensionPoint extends ExtensionPointContract {
|
|
239
|
-
actions: {
|
|
240
|
-
addAlert: AddAlertAction;
|
|
241
|
-
reloadPage: ReloadPageAction;
|
|
242
|
-
fetchCrmObjectProperties: FetchCrmObjectPropertiesAction;
|
|
243
|
-
openIframeModal: (action: OpenIframeActionPayload) => void;
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
interface CrmSidebarExtensionPoint extends ExtensionPointContract {
|
|
248
|
-
actions: {
|
|
249
|
-
reloadPage: ReloadPageAction;
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
interface RemotePlaygroundExtensionPoint extends ExtensionPointContract {
|
|
254
|
-
actions: {
|
|
255
|
-
warn: () => void;
|
|
256
|
-
};
|
|
257
|
-
customComponents: {
|
|
258
|
-
ExampleCrmComponent: ComponentType<ExampleCrmComponentProps>;
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
export interface ExtensionPoints {
|
|
263
|
-
'uie.playground.middle': RemotePlaygroundExtensionPoint;
|
|
264
|
-
'crm.record.tab': CrmMiddleExtensionPoint;
|
|
265
|
-
'crm.record.sidebar': CrmSidebarExtensionPoint;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
//TODO(Randy): Delete once we have real custom components
|
|
269
|
-
export interface ExampleCrmComponentProps {
|
|
270
|
-
name: string;
|
|
271
|
-
size: 'sm' | 'md' | 'lg';
|
|
272
|
-
count: number;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
export interface ExtensionPointApi<
|
|
276
|
-
ExtensionPointName extends keyof ExtensionPoints
|
|
277
|
-
> {
|
|
278
|
-
context: Context;
|
|
279
|
-
runServerlessFunction: ServerlessFuncRunner;
|
|
280
|
-
actions: ExtensionPoints[ExtensionPointName]['actions'];
|
|
281
|
-
customComponents: string[];
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
interface OpenIframeActionPayload {
|
|
285
|
-
uri: string;
|
|
286
|
-
height: number;
|
|
287
|
-
width: number;
|
|
288
|
-
associatedObjectProperties?: string[];
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
export interface LoadingSpinnerProps {
|
|
292
|
-
label: string;
|
|
293
|
-
showLabel?: boolean;
|
|
294
|
-
size?: 'xs' | 'sm' | 'md';
|
|
295
|
-
layout?: 'inline' | 'centered';
|
|
296
|
-
grow?: boolean;
|
|
297
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { RemoteComponentType } from '@remote-ui/core';
|
|
2
|
-
import type { ReactComponentTypeFromRemoteComponentType } from '@remote-ui/react';
|
|
3
|
-
import { createRemoteReactComponent } from '@remote-ui/react';
|
|
4
|
-
|
|
5
|
-
export function createExtensionComponent<
|
|
6
|
-
ComponentType extends string,
|
|
7
|
-
Props = Record<string, never>,
|
|
8
|
-
AllowedChildren extends RemoteComponentType<string, any> | boolean = true
|
|
9
|
-
>(
|
|
10
|
-
componentType:
|
|
11
|
-
| ComponentType
|
|
12
|
-
| RemoteComponentType<ComponentType, Props, AllowedChildren>
|
|
13
|
-
): RemoteComponentType<ComponentType, Props, AllowedChildren> &
|
|
14
|
-
ReactComponentTypeFromRemoteComponentType<
|
|
15
|
-
RemoteComponentType<ComponentType, Props, AllowedChildren>
|
|
16
|
-
> {
|
|
17
|
-
return createRemoteReactComponent<ComponentType, Props, AllowedChildren>(
|
|
18
|
-
componentType
|
|
19
|
-
);
|
|
20
|
-
}
|
|
File without changes
|