@hubspot/ui-extensions 0.0.1-prealpha.2 → 0.0.1-prealpha.4
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 +1228 -0
- package/package.json +38 -4
- package/CrmComponents/crmComponents.ts +0 -11
- package/CrmComponents/index.ts +0 -1
- package/coreComponents.ts +0 -88
- package/hubspot.ts +0 -32
- package/index.ts +0 -24
- package/types.ts +0 -289
- package/utils/createExtensionComponent.ts +0 -20
package/package.json
CHANGED
|
@@ -1,17 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/ui-extensions",
|
|
3
|
-
"version": "0.0.1-prealpha.
|
|
3
|
+
"version": "0.0.1-prealpha.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "index.
|
|
7
|
-
"
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "rm -rf dist/ && tsc",
|
|
10
|
+
"watch": "rm -rf dist/ && tsc --watch"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/**/*"
|
|
14
|
+
],
|
|
15
|
+
"prepare": "npm run build",
|
|
8
16
|
"publishConfig": {
|
|
9
17
|
"access": "public"
|
|
10
18
|
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": "./dist/index.js",
|
|
21
|
+
"./crm": "./dist/crm/index.js"
|
|
22
|
+
},
|
|
11
23
|
"license": "MIT",
|
|
12
24
|
"dependencies": {
|
|
13
25
|
"@remote-ui/react": "^5.0.0",
|
|
14
26
|
"react": "^18.2.0"
|
|
15
27
|
},
|
|
16
|
-
"
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=16"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@remote-ui/react": "^5.0.0",
|
|
33
|
+
"react": "^18.2.0",
|
|
34
|
+
"typescript": "^5.0.4"
|
|
35
|
+
},
|
|
36
|
+
"peerDependenciesMeta": {
|
|
37
|
+
"react": {
|
|
38
|
+
"optional": false
|
|
39
|
+
},
|
|
40
|
+
"@remote-ui/react": {
|
|
41
|
+
"optional": false
|
|
42
|
+
},
|
|
43
|
+
"typescript": {
|
|
44
|
+
"optional": true
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"typescript": "5.0.4"
|
|
49
|
+
},
|
|
50
|
+
"gitHead": "d3ed42de0f9675a2f599416ba1886ba379ecfcd0"
|
|
17
51
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* Hello! To create your first component, uncomment the code below and replace
|
|
2
|
-
* the entrie with your props and component name
|
|
3
|
-
* import { createExtensionComponent } from '../utils/createExtensionComponent';
|
|
4
|
-
* import type { ExampleCrmComponentProps } from '../types';
|
|
5
|
-
|
|
6
|
-
* const ExampleCrmComponent = createExtensionComponent<
|
|
7
|
-
* 'ExampleCrmComponent',
|
|
8
|
-
* ExampleCrmComponentProps
|
|
9
|
-
* >('ExampleCrmComponent');
|
|
10
|
-
*/
|
|
11
|
-
export {};
|
package/CrmComponents/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/coreComponents.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { createRemoteReactComponent } from '@remote-ui/react';
|
|
2
|
-
|
|
3
|
-
import type {
|
|
4
|
-
AlertProps,
|
|
5
|
-
ButtonProps,
|
|
6
|
-
ButtonRowProps,
|
|
7
|
-
CardProps,
|
|
8
|
-
DescriptionListProps,
|
|
9
|
-
DescriptionListItemProps,
|
|
10
|
-
FormProps,
|
|
11
|
-
HeadingProps,
|
|
12
|
-
ImageProps,
|
|
13
|
-
InputProps,
|
|
14
|
-
ProgressBarProps,
|
|
15
|
-
SelectProps,
|
|
16
|
-
TagProps,
|
|
17
|
-
TextProps,
|
|
18
|
-
TileProps,
|
|
19
|
-
StackProps,
|
|
20
|
-
StatisticsProps,
|
|
21
|
-
StatisticsItemProps,
|
|
22
|
-
StatisticsTrendProps,
|
|
23
|
-
} from './types';
|
|
24
|
-
|
|
25
|
-
const Alert = createRemoteReactComponent<'Alert', AlertProps>('Alert');
|
|
26
|
-
const Button = createRemoteReactComponent<'Button', ButtonProps>('Button');
|
|
27
|
-
const ButtonRow = createRemoteReactComponent<'ButtonRow', ButtonRowProps>(
|
|
28
|
-
'ButtonRow'
|
|
29
|
-
);
|
|
30
|
-
const Card = createRemoteReactComponent<'Card', CardProps>('Card');
|
|
31
|
-
const DescriptionList = createRemoteReactComponent<
|
|
32
|
-
'DescriptionList',
|
|
33
|
-
DescriptionListProps
|
|
34
|
-
>('DescriptionList');
|
|
35
|
-
const DescriptionListItem = createRemoteReactComponent<
|
|
36
|
-
'DescriptionListItem',
|
|
37
|
-
DescriptionListItemProps
|
|
38
|
-
>('DescriptionListItem');
|
|
39
|
-
const Divider = createRemoteReactComponent<'Divider', {}>('Divider');
|
|
40
|
-
const Form = createRemoteReactComponent<'Form', FormProps>('Form');
|
|
41
|
-
const Heading = createRemoteReactComponent<'Heading', HeadingProps>('Heading');
|
|
42
|
-
const Image = createRemoteReactComponent<'Image', ImageProps>('Image');
|
|
43
|
-
const Input = createRemoteReactComponent<'Input', InputProps>('Input');
|
|
44
|
-
const ProgressBar = createRemoteReactComponent<'ProgressBar', ProgressBarProps>(
|
|
45
|
-
'ProgressBar'
|
|
46
|
-
);
|
|
47
|
-
const Select = createRemoteReactComponent<'Select', SelectProps>('Select');
|
|
48
|
-
const Tag = createRemoteReactComponent<'Tag', TagProps>('Tag');
|
|
49
|
-
const Text = createRemoteReactComponent<'Text', TextProps>('Text');
|
|
50
|
-
const Tile = createRemoteReactComponent<'Tile', TileProps>('Tile');
|
|
51
|
-
const Stack = createRemoteReactComponent<'Stack', StackProps>('Stack');
|
|
52
|
-
|
|
53
|
-
const StatisticsItem = createRemoteReactComponent<
|
|
54
|
-
'StatisticsItem',
|
|
55
|
-
StatisticsItemProps
|
|
56
|
-
>('StatisticsItem');
|
|
57
|
-
|
|
58
|
-
const Statistics = createRemoteReactComponent<'Statistics', StatisticsProps>(
|
|
59
|
-
'Statistics'
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
const StatisticsTrend = createRemoteReactComponent<
|
|
63
|
-
'StatisticsTrend',
|
|
64
|
-
StatisticsTrendProps
|
|
65
|
-
>('StatisticsTrend');
|
|
66
|
-
|
|
67
|
-
export {
|
|
68
|
-
Alert,
|
|
69
|
-
Button,
|
|
70
|
-
ButtonRow,
|
|
71
|
-
Card,
|
|
72
|
-
DescriptionList,
|
|
73
|
-
DescriptionListItem,
|
|
74
|
-
Divider,
|
|
75
|
-
Form,
|
|
76
|
-
Heading,
|
|
77
|
-
Image,
|
|
78
|
-
Input,
|
|
79
|
-
ProgressBar,
|
|
80
|
-
Select,
|
|
81
|
-
Stack,
|
|
82
|
-
Statistics,
|
|
83
|
-
StatisticsItem,
|
|
84
|
-
StatisticsTrend,
|
|
85
|
-
Tag,
|
|
86
|
-
Text,
|
|
87
|
-
Tile,
|
|
88
|
-
};
|
package/hubspot.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/* eslint-disable hubspot-dev/no-confusing-browser-globals */
|
|
2
|
-
|
|
3
|
-
import { createRoot, RemoteRoot } from '@remote-ui/react';
|
|
4
|
-
import { ReactElement, isValidElement } from 'react';
|
|
5
|
-
import { ExtensionPoints, ExtensionPointApi } from './types';
|
|
6
|
-
|
|
7
|
-
export const hubspot = {
|
|
8
|
-
extend: render,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const extend = (...args) => (self as any).extend(...args);
|
|
12
|
-
|
|
13
|
-
function render<ExtensionPointName extends keyof ExtensionPoints>(
|
|
14
|
-
renderCallback: (
|
|
15
|
-
api: ExtensionPointApi<ExtensionPointName>
|
|
16
|
-
) => ReactElement<any>
|
|
17
|
-
) {
|
|
18
|
-
return extend(
|
|
19
|
-
(root: RemoteRoot, api: ExtensionPointApi<ExtensionPointName>) => {
|
|
20
|
-
const renderCallbackResult = renderCallback(api);
|
|
21
|
-
|
|
22
|
-
if (!isValidElement(renderCallbackResult)) {
|
|
23
|
-
throw new Error(
|
|
24
|
-
`[hubspot.extend]: Expected callback function to return a valid element, got: ${renderCallbackResult}`
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
createRoot(root).render(renderCallbackResult);
|
|
29
|
-
root.mount();
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
}
|
package/index.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
Alert,
|
|
3
|
-
Button,
|
|
4
|
-
ButtonRow,
|
|
5
|
-
Card,
|
|
6
|
-
DescriptionList,
|
|
7
|
-
DescriptionListItem,
|
|
8
|
-
Divider,
|
|
9
|
-
Form,
|
|
10
|
-
Heading,
|
|
11
|
-
Image,
|
|
12
|
-
Input,
|
|
13
|
-
ProgressBar,
|
|
14
|
-
Select,
|
|
15
|
-
Stack,
|
|
16
|
-
Statistics,
|
|
17
|
-
StatisticsItem,
|
|
18
|
-
StatisticsTrend,
|
|
19
|
-
Tag,
|
|
20
|
-
Text,
|
|
21
|
-
Tile,
|
|
22
|
-
} from './coreComponents';
|
|
23
|
-
|
|
24
|
-
export { hubspot } from './hubspot';
|
package/types.ts
DELETED
|
@@ -1,289 +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
|
-
}
|
|
@@ -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
|
-
}
|