@useparagon/connect 0.0.16-canary.2
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/LICENSE +21 -0
- package/README.md +44 -0
- package/dist/src/ConnectSDK.d.ts +245 -0
- package/dist/src/SDKEventEmitter.d.ts +56 -0
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/entities/base.entity.d.ts +5 -0
- package/dist/src/entities/connectCredential.interface.d.ts +36 -0
- package/dist/src/entities/credential.interface.d.ts +15 -0
- package/dist/src/entities/customIntegration.interface.d.ts +60 -0
- package/dist/src/entities/integration.interface.d.ts +45 -0
- package/dist/src/entities/integrationConfig.interface.d.ts +9 -0
- package/dist/src/entities/license.interface.d.ts +6 -0
- package/dist/src/entities/persona.interface.d.ts +34 -0
- package/dist/src/entities/project.interface.d.ts +32 -0
- package/dist/src/entities/steps.d.ts +30 -0
- package/dist/src/entities/team.interface.d.ts +19 -0
- package/dist/src/entities/user.interface.d.ts +23 -0
- package/dist/src/entities/workflow.interface.d.ts +11 -0
- package/dist/src/file-picker/integrations/googledrive.d.ts +24 -0
- package/dist/src/file-picker/integrations/index.d.ts +5 -0
- package/dist/src/file-picker/types/baseFilePicker.d.ts +32 -0
- package/dist/src/file-picker/types/externalFilePicker.d.ts +9 -0
- package/dist/src/file-picker/types/index.d.ts +1 -0
- package/dist/src/helpers/ConnectUserContext.d.ts +18 -0
- package/dist/src/helpers/index.d.ts +29 -0
- package/dist/src/helpers/oauth.d.ts +20 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.LICENSE.txt +14 -0
- package/dist/src/server.types.d.ts +14 -0
- package/dist/src/types/action.d.ts +266 -0
- package/dist/src/types/billing.d.ts +2 -0
- package/dist/src/types/connect.d.ts +213 -0
- package/dist/src/types/connectModal.d.ts +35 -0
- package/dist/src/types/environment.d.ts +16 -0
- package/dist/src/types/execution.d.ts +5 -0
- package/dist/src/types/index.d.ts +9 -0
- package/dist/src/types/resolvers.d.ts +297 -0
- package/dist/src/types/sdk.d.ts +302 -0
- package/dist/src/types/stripe.d.ts +23 -0
- package/dist/src/utils/connect.d.ts +13 -0
- package/dist/src/utils/crypto.d.ts +7 -0
- package/dist/src/utils/generic.d.ts +30 -0
- package/dist/src/utils/http.d.ts +57 -0
- package/dist/src/utils/throttle.d.ts +118 -0
- package/package.json +103 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AuthenticationScheme } from '../entities/credential.interface';
|
|
3
|
+
import { SidebarInput } from './connect';
|
|
4
|
+
import { DataType, KeyedSource, Source } from './resolvers';
|
|
5
|
+
export declare enum SidebarInputType {
|
|
6
|
+
Auth = "AUTH",
|
|
7
|
+
Enum = "ENUM",
|
|
8
|
+
DynamicEnum = "DYNAMIC_ENUM",
|
|
9
|
+
Intent = "INTENT",
|
|
10
|
+
Text = "TEXT",
|
|
11
|
+
TextArea = "TEXTAREA",
|
|
12
|
+
ValueText = "TEXT_NO_VARS",
|
|
13
|
+
ValueTextArea = "TEXTAREA_NO_VARS",
|
|
14
|
+
Code = "CODE",
|
|
15
|
+
ActionButton = "ACTION_BUTTON",
|
|
16
|
+
Conditional = "CONDITIONAL",
|
|
17
|
+
DynamicConditional = "DYNAMIC_CONDITIONAL",
|
|
18
|
+
NestedList = "NESTED_LIST",
|
|
19
|
+
File = "FILE",
|
|
20
|
+
EditableDynamicEnum = "EDITABLE_DYNAMIC_ENUM",
|
|
21
|
+
EditableEnum = "EDITABLE_ENUM",
|
|
22
|
+
BooleanInput = "BOOLEAN_INPUT",
|
|
23
|
+
UserSuppliedCredential = "USER_SUPPLIED_CREDENTIAL",
|
|
24
|
+
NativeDynamicEnumInput = "NATIVE_DYNAMIC_INPUT",
|
|
25
|
+
TimeConstraintInput = "TIME_CONSTRAINT_INPUT",
|
|
26
|
+
LinesListInput = "LinesListInput",
|
|
27
|
+
LinesListDynamicInput = "LinesListDynamicInput",
|
|
28
|
+
Number = "NUMBER",
|
|
29
|
+
Email = "EMAIL",
|
|
30
|
+
URL = "URL",
|
|
31
|
+
EnumTextAreaPairInput = "EnumTextAreaPairInput",
|
|
32
|
+
FieldMapper = "FIELD_MAPPER",
|
|
33
|
+
ComboInput = "COMBO_INPUT",
|
|
34
|
+
Password = "PASSWORD",
|
|
35
|
+
Switch = "SWITCH"
|
|
36
|
+
}
|
|
37
|
+
interface BaseInput {
|
|
38
|
+
id: string;
|
|
39
|
+
title: string;
|
|
40
|
+
subtitle?: ReactNode;
|
|
41
|
+
placeholder?: string;
|
|
42
|
+
/**
|
|
43
|
+
* if not provided then treated as true
|
|
44
|
+
*/
|
|
45
|
+
required?: boolean;
|
|
46
|
+
defaultValue?: any;
|
|
47
|
+
documentationLink?: string;
|
|
48
|
+
documentationLinkLabel?: string;
|
|
49
|
+
/**
|
|
50
|
+
* hide input in sidebarsection
|
|
51
|
+
*/
|
|
52
|
+
hidden?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* can not change value if readOnly
|
|
55
|
+
*/
|
|
56
|
+
readOnly?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface IntegrationConnectInput extends BaseInput {
|
|
59
|
+
type: SidebarInputType.ValueText | SidebarInputType.Password | SidebarInputType.DynamicEnum | SidebarInputType.ComboInput | SidebarInputType.Enum | SidebarInputType.Switch | SidebarInputType.ValueTextArea;
|
|
60
|
+
inputType?: string;
|
|
61
|
+
prefixLabel?: string;
|
|
62
|
+
suffixLabel?: string;
|
|
63
|
+
sourceType?: string;
|
|
64
|
+
fallbackText?: string;
|
|
65
|
+
hiddenInConnect?: boolean;
|
|
66
|
+
}
|
|
67
|
+
type EnumSection<T = any> = {
|
|
68
|
+
title: string;
|
|
69
|
+
items: EnumInputValue<T>[];
|
|
70
|
+
};
|
|
71
|
+
type EnumInputValue<T = any> = {
|
|
72
|
+
value: T;
|
|
73
|
+
label: string;
|
|
74
|
+
/**
|
|
75
|
+
* subtitle property is for displaying a little helper text to explain the item in dropdown
|
|
76
|
+
*/
|
|
77
|
+
subtitle?: string;
|
|
78
|
+
};
|
|
79
|
+
export declare enum TokenType {
|
|
80
|
+
ACCESS_TOKEN = "ACCESS_TOKEN",
|
|
81
|
+
REFRESH_TOKEN = "REFRESH_TOKEN",
|
|
82
|
+
BOT_TOKEN = "BOT_TOKEN",
|
|
83
|
+
KLAVIYO_API_KEY = "KLAVIYO_API_KEY",
|
|
84
|
+
MARKETO_CLIENT_ID = "MARKETO_CLIENT_ID",
|
|
85
|
+
MARKETO_CLIENT_SECRET = "MARKETO_CLIENT_SECRETI",
|
|
86
|
+
MARKETO_ENDPOINT = "MARKETO_ENDPOINT",
|
|
87
|
+
MARKETO_IDENTITY = "MARKETO_IDENTITY",
|
|
88
|
+
MONDAY_API_TOKEN = "MONDAY_API_TOKEN",
|
|
89
|
+
ORACLE_CLOUD_URL = "ORACLE_CLOUD_URL",
|
|
90
|
+
ORACLE_PASSWORD = "ORACLE_PASSWORD",
|
|
91
|
+
ORACLE_USERNAME = "ORACLE_USERNAME",
|
|
92
|
+
SAGE_INTACCT_COMPANY_ID = "SAGE_INTACCT_COMPANY_ID",
|
|
93
|
+
SAGE_INTACCT_USER_ID = "SAGE_INTACCT_USER_ID",
|
|
94
|
+
SAGE_INTACCT_USER_PASSWORD = "SAGE_INTACCT_USER_PASSWORD",
|
|
95
|
+
SAILTHRU_COMPANY_KEY = "SAILTHRU_COMPANY_KEY",
|
|
96
|
+
SAILTHRU_COMPANY_SECRET = "SAILTHRU_COMPANY_SECRET",
|
|
97
|
+
SERVICENOW_PASSWORD = "SERVICENOW_PASSWORD",
|
|
98
|
+
SERVICENOW_SUBDOMAIN = "SERVICENOW_SUBDOMAIN",
|
|
99
|
+
SERVICENOW_USERNAME = "SERVICENOW_USERNAME",
|
|
100
|
+
TABLEAU_PERSONAL_ACCESS_TOKEN_NAME = "TABLEAU_PERSONAL_ACCESS_TOKEN_NAME",
|
|
101
|
+
TABLEAU_PERSONAL_ACCESS_TOKEN_SECRET = "TABLEAU_PERSONAL_ACCESS_TOKEN_SECRET",
|
|
102
|
+
TABLEAU_SERVER_NAME = "TABLEAU_SERVER_NAME",
|
|
103
|
+
TABLEAU_SITE_ID = "TABLEAU_SITE_ID",
|
|
104
|
+
TRELLO_API_KEY = "TRELLO_API_KEY",
|
|
105
|
+
TRELLO_API_TOKEN = "TRELLO_API_TOKEN",
|
|
106
|
+
WOOCOMMERCE_CONSUMER_KEY = "WOOCOMMERCE_CONSUMER_KEY",
|
|
107
|
+
WOOCOMMERCE_CONSUMER_SECRET = "WOOCOMMERCE_CONSUMER_SECRET",
|
|
108
|
+
WOOCOMMERCE_STORE_DOMAIN = "WOOCOMMERCE_STORE_DOMAIN",
|
|
109
|
+
WORKABLE_API_ACCESS_TOKEN = "WORKABLE_API_ACCESS_TOKEN",
|
|
110
|
+
WORKABLE_ACCOUNT_SUBDOMAIN = "WORKABLE_ACCOUNT_SUBDOMAIN",
|
|
111
|
+
ZOHO_CRM_ACCOUNTS_SERVER = "ZOHO_CRM_ACCOUNTS_SERVER",
|
|
112
|
+
ZOHO_CRM_API_DOMAIN = "ZOHO_CRM_API_DOMAIN"
|
|
113
|
+
}
|
|
114
|
+
export type DataSource = DynamicDataSource<any> | StaticEnumDataSource | FieldMapperDataSource | ComboInputDataSource;
|
|
115
|
+
type BasicDataSource = {
|
|
116
|
+
/**
|
|
117
|
+
* title for data source
|
|
118
|
+
*/
|
|
119
|
+
title: string;
|
|
120
|
+
/**
|
|
121
|
+
* description for data source
|
|
122
|
+
*/
|
|
123
|
+
subtitle?: ReactNode;
|
|
124
|
+
/**
|
|
125
|
+
* If specified, instructionalText replaces the default text explaining the input under the selection,
|
|
126
|
+
* e.g. "Let your users select <input name> from their <integration name> account."
|
|
127
|
+
*/
|
|
128
|
+
instructionalText?: ReactNode;
|
|
129
|
+
/**
|
|
130
|
+
* If true, this property hides this data source as a Connect field type.
|
|
131
|
+
* @default false
|
|
132
|
+
*/
|
|
133
|
+
hideFromConnectFieldTypes?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* If true, dataSource will be fetched in pagination format
|
|
136
|
+
* @default false
|
|
137
|
+
*/
|
|
138
|
+
supportPagination?: boolean;
|
|
139
|
+
};
|
|
140
|
+
type DynamicDataSource<TValues = EnumInputValue[]> = BasicDataSource & {
|
|
141
|
+
type: DataSourceType.DYNAMIC;
|
|
142
|
+
/**
|
|
143
|
+
* If provided, the response from the refresh method will be saved into the step.
|
|
144
|
+
*/
|
|
145
|
+
cacheKey?: string;
|
|
146
|
+
/**
|
|
147
|
+
* This array is used to determine whether or not the input's values should be
|
|
148
|
+
* refreshed. Strings can be used to specify a KeyedSource dependency within
|
|
149
|
+
* `options.actionParameters`, and a function can be used to specify any other
|
|
150
|
+
* dependency within the step's parameters.
|
|
151
|
+
*
|
|
152
|
+
* If `refreshDependencies` is an empty array, the input will refresh on mount.
|
|
153
|
+
* If `refreshDependencies` is not provided, the input will not refresh unless
|
|
154
|
+
* manually invoked (i.e., by a button).
|
|
155
|
+
*/
|
|
156
|
+
refreshDependencies?: (string | ((options: ActionStepParameters) => any))[];
|
|
157
|
+
/**
|
|
158
|
+
* When the data comes back from the intent requested by the `refresh` method,
|
|
159
|
+
* this is the method used to map the data into the input + cache
|
|
160
|
+
*/
|
|
161
|
+
mapRefreshToValues: (response: any) => TValues;
|
|
162
|
+
/**
|
|
163
|
+
* This method is responsible for specifying the action, intent and parameters
|
|
164
|
+
* for loading the data into the input
|
|
165
|
+
*/
|
|
166
|
+
getRefreshActionParameters: (options: ActionStepParameters, inputs: SidebarInput[], activeInput: SidebarInput) => ActionStepParameters;
|
|
167
|
+
/**
|
|
168
|
+
* called after the input refreshes w/ the values mapped from `mapRefreshToValues`
|
|
169
|
+
*/
|
|
170
|
+
onRefresh?: (value: any) => ActionResponse;
|
|
171
|
+
};
|
|
172
|
+
type ActionResponse = AlertActionResponse | DispatchActionResponse;
|
|
173
|
+
type AlertActionResponse = {
|
|
174
|
+
type: ActionResponseType.ALERT;
|
|
175
|
+
status: ActionResponseStatus;
|
|
176
|
+
message: string;
|
|
177
|
+
};
|
|
178
|
+
type DispatchActionResponse = {
|
|
179
|
+
type: ActionResponseType.DISPATCH;
|
|
180
|
+
status: ActionResponseStatus;
|
|
181
|
+
id: string;
|
|
182
|
+
source: Source;
|
|
183
|
+
};
|
|
184
|
+
declare enum ActionResponseStatus {
|
|
185
|
+
INFO = "INFO",
|
|
186
|
+
ERROR = "ERROR",
|
|
187
|
+
SUCCESS = "SUCCESS"
|
|
188
|
+
}
|
|
189
|
+
declare enum ActionResponseType {
|
|
190
|
+
NONE = "NONE",
|
|
191
|
+
RE_AUTHENTICATE = "RE_AUTHENTICATE",
|
|
192
|
+
ALERT = "ALERT",
|
|
193
|
+
DISPATCH = "DISPATCH"
|
|
194
|
+
}
|
|
195
|
+
type StaticEnumDataSource = BasicDataSource & {
|
|
196
|
+
type: DataSourceType.STATIC_ENUM;
|
|
197
|
+
/**
|
|
198
|
+
* id for data source
|
|
199
|
+
*/
|
|
200
|
+
id: string;
|
|
201
|
+
values: EnumInputValue[] | EnumSection[];
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* A FieldMapperDataSource refers to a source that is able to drive an input that is responsible
|
|
205
|
+
* for mapping remote/integration fields to local/project fields.
|
|
206
|
+
*/
|
|
207
|
+
type FieldMapperDataSource = BasicDataSource & {
|
|
208
|
+
id: string;
|
|
209
|
+
type: DataSourceType.FIELD_MAPPER;
|
|
210
|
+
recordSource: DynamicDataSource<(EnumSection | EnumInputValue)[]>;
|
|
211
|
+
fieldSource: DynamicDataSource<(EnumSection | EnumInputValue)[]>;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* A ComboInputDataSource refers to a source that is able to drive an input that is responsible
|
|
215
|
+
* for combining the remote/integration fields to local/project fields.
|
|
216
|
+
*/
|
|
217
|
+
type ComboInputDataSource = BasicDataSource & {
|
|
218
|
+
id: string;
|
|
219
|
+
type: DataSourceType.COMBO_INPUT;
|
|
220
|
+
mainInputSource: DynamicDataSource<(EnumSection | EnumInputValue)[]>;
|
|
221
|
+
dependentInputSource: DynamicDataSource<(EnumSection | EnumInputValue)[]>;
|
|
222
|
+
fieldSource?: DynamicDataSource<(EnumSection | EnumInputValue)[]>;
|
|
223
|
+
};
|
|
224
|
+
type BaseActionStepParameters = {
|
|
225
|
+
actionType: string;
|
|
226
|
+
credentials: string[];
|
|
227
|
+
retryOnFailure?: boolean;
|
|
228
|
+
ignoreFailure?: boolean;
|
|
229
|
+
};
|
|
230
|
+
declare enum DataSourceType {
|
|
231
|
+
DYNAMIC = "DYNAMIC_DATA_SOURCE",
|
|
232
|
+
STATIC_ENUM = "STATIC_ENUM_DATA_SOURCE",
|
|
233
|
+
FIELD_MAPPER = "FIELD_MAPPER_DATA_SOURCE",
|
|
234
|
+
COMBO_INPUT = "COMBO_INPUT_DATA_SOURCE"
|
|
235
|
+
}
|
|
236
|
+
type ActionStepParameters = BaseActionStepParameters & {
|
|
237
|
+
intent: string;
|
|
238
|
+
actionParameters: KeyedSource<DataType.ANY>[];
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* It will override the action alias for making files name more cleaner
|
|
242
|
+
*/
|
|
243
|
+
export declare const overrideActionAlias: Partial<Record<string, string>>;
|
|
244
|
+
export declare const AUTH_TOKEN_ALLOWED_INTEGRATIONS: Record<string, Record<'accessTokenPath', string>>;
|
|
245
|
+
export type AccountType = {
|
|
246
|
+
/**
|
|
247
|
+
* Provide a unique identifier for this account type, so that the relevant `sidebarSections`
|
|
248
|
+
* or `oauthParameters` will be consumed by the AuthSelector accordingly.
|
|
249
|
+
*/
|
|
250
|
+
id: string;
|
|
251
|
+
/**
|
|
252
|
+
* authentication scheme
|
|
253
|
+
*/
|
|
254
|
+
scheme: AuthenticationScheme;
|
|
255
|
+
/**
|
|
256
|
+
* For AuthenticationScheme.OAUTH-schemed credentials, specify value sources to be passed
|
|
257
|
+
* through to the getAuthEssentials action.
|
|
258
|
+
*/
|
|
259
|
+
oauthParameters?: KeyedSource<DataType.ANY>[];
|
|
260
|
+
/**
|
|
261
|
+
* Specify additional user inputs that are required to start the OAuth flow, i.e. a name
|
|
262
|
+
* or subdomain prefix for a service that is a part of the OAuth authorization URL.
|
|
263
|
+
*/
|
|
264
|
+
endUserSuppliedValues?: IntegrationConnectInput[];
|
|
265
|
+
};
|
|
266
|
+
export {};
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { ConnectCredentialProviderData, CredentialStatus, IConnectCredential } from '../entities/connectCredential.interface';
|
|
2
|
+
import { PersonaMeta } from '../entities/persona.interface';
|
|
3
|
+
import { AccountType, DataSource, IntegrationConnectInput, SidebarInputType } from './action';
|
|
4
|
+
import { OrConditions } from './resolvers';
|
|
5
|
+
export interface ConnectCredentialConfig {
|
|
6
|
+
configuredWorkflows?: IntegrationWorkflowStateMap;
|
|
7
|
+
sharedSettings?: {
|
|
8
|
+
[inputId: string]: ConnectInputValue | undefined;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
type ConnectInputValue = string | number | boolean | FieldMappingValue | ComboInputValue | undefined;
|
|
12
|
+
type FieldMappingValue = {
|
|
13
|
+
objectMapping?: string;
|
|
14
|
+
fieldMappings?: {
|
|
15
|
+
[label: string]: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
dynamicMappings?: {
|
|
18
|
+
[mappingKey: string]: {
|
|
19
|
+
applicationField?: string;
|
|
20
|
+
integrationField?: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
userCreatedFields?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* Type of field mapper used for creating field mappings
|
|
26
|
+
* @default STATIC
|
|
27
|
+
*/
|
|
28
|
+
mappingType?: 'STATIC' | 'DYNAMIC';
|
|
29
|
+
};
|
|
30
|
+
type ComboInputValue = {
|
|
31
|
+
mainInput?: string;
|
|
32
|
+
dependentInput?: string;
|
|
33
|
+
fieldMappings?: {
|
|
34
|
+
[label: string]: string | undefined;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
type IntegrationWorkflowStateMap = {
|
|
38
|
+
[workflowId: string]: IntegrationWorkflowState | undefined;
|
|
39
|
+
};
|
|
40
|
+
export type IntegrationWorkflowState = {
|
|
41
|
+
enabled: boolean;
|
|
42
|
+
settings: {
|
|
43
|
+
[inputId: string]: ConnectInputValue | undefined;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export type ModalConfig = {
|
|
47
|
+
/**
|
|
48
|
+
* A primary color for the background color of the Connect modal.
|
|
49
|
+
*/
|
|
50
|
+
accentColor?: string;
|
|
51
|
+
/**
|
|
52
|
+
* A boolean to show / hide paragon link in footer section. (default true)
|
|
53
|
+
*/
|
|
54
|
+
paragonLink?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* A description for the integration's purpose. Appears just below the integration name.
|
|
57
|
+
*/
|
|
58
|
+
description?: string;
|
|
59
|
+
/**
|
|
60
|
+
* A long-form description for the integration's purpose. Appears in the Overview tab of the
|
|
61
|
+
* Connect modal.
|
|
62
|
+
*/
|
|
63
|
+
overview?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Inputs and metadata about this integration's workflows.
|
|
66
|
+
*/
|
|
67
|
+
workflowMeta?: IntegrationWorkflowMetaMap;
|
|
68
|
+
/**
|
|
69
|
+
* Inputs metadata for shared workflow settings
|
|
70
|
+
*/
|
|
71
|
+
sharedMeta?: IntegrationSharedMeta;
|
|
72
|
+
};
|
|
73
|
+
type IntegrationSharedMeta = {
|
|
74
|
+
/**
|
|
75
|
+
* Inputs to intake global/shared user settings, configured in the Portal Editor.
|
|
76
|
+
*/
|
|
77
|
+
inputs?: SerializedConnectInput[];
|
|
78
|
+
};
|
|
79
|
+
declare const SupportedConnectInputTypes: readonly [SidebarInputType.ValueText, SidebarInputType.DynamicEnum, SidebarInputType.Enum, SidebarInputType.Number, SidebarInputType.Email, SidebarInputType.URL, SidebarInputType.FieldMapper, SidebarInputType.BooleanInput, SidebarInputType.ComboInput, SidebarInputType.Password, SidebarInputType.Switch, SidebarInputType.ValueTextArea];
|
|
80
|
+
type SupportedConnectInputType = (typeof SupportedConnectInputTypes)[number];
|
|
81
|
+
export type SidebarInput = IntegrationConnectInput;
|
|
82
|
+
type SupportedConnectInput<T extends SidebarInput = SidebarInput> = Extract<T, {
|
|
83
|
+
type: SupportedConnectInputType;
|
|
84
|
+
}>;
|
|
85
|
+
/**
|
|
86
|
+
* A SerializedConnectInput is one that excludes the properties of a DynamicDataSource, which are
|
|
87
|
+
* loaded in at runtime rather than saved in the DB.
|
|
88
|
+
*/
|
|
89
|
+
type SerializedConnectInput<TInputType extends SupportedConnectInputType = SupportedConnectInputType> = {
|
|
90
|
+
[T in SupportedConnectInputType]: Extract<SupportedConnectInput, {
|
|
91
|
+
type: T;
|
|
92
|
+
}> extends {
|
|
93
|
+
source: DataSource;
|
|
94
|
+
} | {
|
|
95
|
+
getValues: Function;
|
|
96
|
+
} ? Omit<Extract<SupportedConnectInput, {
|
|
97
|
+
type: T;
|
|
98
|
+
}>, 'source' | 'getValues'> & {
|
|
99
|
+
/**
|
|
100
|
+
* If a Connect input is dynamic and uses a DynamicDataSource, `sourceType` will match the
|
|
101
|
+
* `cacheKey` property of the source specified in the action's sources module.
|
|
102
|
+
*
|
|
103
|
+
* If it uses a FieldMapperDataSource, `sourceType` will match the `id` property of the source.
|
|
104
|
+
*/
|
|
105
|
+
sourceType?: string;
|
|
106
|
+
fallbackText?: string;
|
|
107
|
+
} : Extract<SupportedConnectInput, {
|
|
108
|
+
type: T;
|
|
109
|
+
}>;
|
|
110
|
+
}[TInputType] & {
|
|
111
|
+
tooltip?: string;
|
|
112
|
+
};
|
|
113
|
+
type IntegrationWorkflowMetaMap = {
|
|
114
|
+
[id: string]: IntegrationWorkflowMeta;
|
|
115
|
+
};
|
|
116
|
+
type IntegrationWorkflowMeta = {
|
|
117
|
+
/**
|
|
118
|
+
* The ID of the WorkflowEntity.
|
|
119
|
+
*/
|
|
120
|
+
id: string;
|
|
121
|
+
/**
|
|
122
|
+
* A longer-form description for the Workflow's functionality. Acts as a "subtitle" to the
|
|
123
|
+
* WorkflowEntity's `description` property.
|
|
124
|
+
*/
|
|
125
|
+
infoText?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Determine whether or not to enable workflow for connected user
|
|
128
|
+
* @default false
|
|
129
|
+
*/
|
|
130
|
+
defaultEnabled?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Determines whether or not the workflow displays in the Connect Portal.
|
|
133
|
+
* @default false
|
|
134
|
+
*/
|
|
135
|
+
hidden?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* An index to track the positional order of a workflow in the list of displayed workflows.
|
|
138
|
+
* If `order` is undefined, the workflow will be sorted by its `createdAt` property (after those
|
|
139
|
+
* that are sorted manually by `order`.)
|
|
140
|
+
*/
|
|
141
|
+
order?: number;
|
|
142
|
+
/**
|
|
143
|
+
* Inputs to intake workflow-specific settings, configured in the Portal Editor.
|
|
144
|
+
*/
|
|
145
|
+
inputs: SerializedConnectInput[];
|
|
146
|
+
/**
|
|
147
|
+
* Conditions to evaluate permission for endUser based on persona metadata.
|
|
148
|
+
*/
|
|
149
|
+
permissions?: OrConditions;
|
|
150
|
+
};
|
|
151
|
+
export type DynamicMappingField = {
|
|
152
|
+
label: string;
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
155
|
+
export type DynamicMappingOptions = {
|
|
156
|
+
fields: DynamicMappingField[];
|
|
157
|
+
userCanRemoveMappings?: boolean;
|
|
158
|
+
userCanCreateFields?: boolean;
|
|
159
|
+
defaultFields?: string[];
|
|
160
|
+
};
|
|
161
|
+
export type AuthenticatedConnectUser = {
|
|
162
|
+
authenticated: true;
|
|
163
|
+
token: string;
|
|
164
|
+
userId: string;
|
|
165
|
+
integrations: SDKIntegrationState;
|
|
166
|
+
meta: PersonaMeta;
|
|
167
|
+
resources: SDKResourceState[];
|
|
168
|
+
};
|
|
169
|
+
export type SDKResourceState = {
|
|
170
|
+
id: string;
|
|
171
|
+
slug: string;
|
|
172
|
+
};
|
|
173
|
+
export type SDKIntegration = {
|
|
174
|
+
enabled: boolean;
|
|
175
|
+
credentialId?: string;
|
|
176
|
+
credentialStatus?: CredentialStatus;
|
|
177
|
+
providerId?: string;
|
|
178
|
+
providerData?: ConnectCredentialProviderData;
|
|
179
|
+
allCredentials: IConnectCredential[];
|
|
180
|
+
} & ConnectCredentialConfig;
|
|
181
|
+
export type SDKIntegrationConfig = {
|
|
182
|
+
oauthInputs: IntegrationConnectInput[];
|
|
183
|
+
accountTypes: AccountType[];
|
|
184
|
+
authConfigInputs: IntegrationConnectInput[];
|
|
185
|
+
postOauthInputs: IntegrationConnectInput[];
|
|
186
|
+
dataSources: {
|
|
187
|
+
[key: string]: DataSource;
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* The contents of the `integrations` field for an authenticated ConnectUser.
|
|
192
|
+
*
|
|
193
|
+
* The fields from `ConnectCredentialConfig` are stored; all other fields are computed from other
|
|
194
|
+
* available entities.
|
|
195
|
+
*/
|
|
196
|
+
export type SDKIntegrationState = Partial<Record<string, SDKIntegration>>;
|
|
197
|
+
export type UninstallOptions = {
|
|
198
|
+
selectedCredentialId?: string;
|
|
199
|
+
};
|
|
200
|
+
export type DisableWorkflowOptions = {
|
|
201
|
+
selectedCredentialId?: string;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* method options for getIntegrationAccount in sdk
|
|
205
|
+
*/
|
|
206
|
+
export type GetIntegrationAccountOptions = {
|
|
207
|
+
includeAccountAuth?: boolean;
|
|
208
|
+
selectedCredentialId?: string;
|
|
209
|
+
};
|
|
210
|
+
export type IConnectUser = Omit<AuthenticatedConnectUser, 'token'>;
|
|
211
|
+
export declare const INFER_CONTENT_TYPE_FROM_CONNECT_OPTIONS = "auto";
|
|
212
|
+
export declare const SELECTED_CREDENTIAL_ID_HEADER = "X-Paragon-Credential";
|
|
213
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IPublishedCustomIntegration } from '../entities/customIntegration.interface';
|
|
3
|
+
import { IConnectIntegrationWithCredentialInfo } from '../entities/integration.interface';
|
|
4
|
+
import { AccountType } from './action';
|
|
5
|
+
import { ModalConfig } from './connect';
|
|
6
|
+
import { InstallOptions, ModalView } from './sdk';
|
|
7
|
+
type ModalApiInstallationOptions = InstallOptions & {
|
|
8
|
+
selectedAccountConfig?: AccountType;
|
|
9
|
+
};
|
|
10
|
+
export type Props = {
|
|
11
|
+
integration: IConnectIntegrationWithCredentialInfo | null;
|
|
12
|
+
customIntegration?: IPublishedCustomIntegration;
|
|
13
|
+
config?: ModalConfig;
|
|
14
|
+
contentStyle?: React.CSSProperties;
|
|
15
|
+
overlayStyle?: React.CSSProperties;
|
|
16
|
+
popupProps?: Record<string, string>;
|
|
17
|
+
hideCross?: boolean;
|
|
18
|
+
tabView?: ModalView;
|
|
19
|
+
isPreviewMode?: boolean;
|
|
20
|
+
onBeforeEnableIntegration?: () => void | Promise<void>;
|
|
21
|
+
onClose?: () => void;
|
|
22
|
+
onOpen?: () => void;
|
|
23
|
+
onTabViewChange?: (view: ModalView) => void;
|
|
24
|
+
/**
|
|
25
|
+
* this flag is for controlling the enabling behavior from outside this component.
|
|
26
|
+
* It is currently used in BYO to show input settings while adding them live
|
|
27
|
+
*/
|
|
28
|
+
previewSettings?: {
|
|
29
|
+
isEnabling: boolean;
|
|
30
|
+
};
|
|
31
|
+
apiInstallationOptions?: ModalApiInstallationOptions;
|
|
32
|
+
connectionError?: string;
|
|
33
|
+
selectedCredentialId?: string;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum NODE_ENV {
|
|
2
|
+
PRODUCTION = "production",
|
|
3
|
+
DEVELOPMENT = "development",
|
|
4
|
+
TEST = "test"
|
|
5
|
+
}
|
|
6
|
+
export declare enum PLATFORM_ENV {
|
|
7
|
+
PRODUCTION = "production",
|
|
8
|
+
PRODUCTION_MIRROR_1 = "p-m1",
|
|
9
|
+
STAGING = "staging",
|
|
10
|
+
STAGING_MIRROR_1 = "s-m1",
|
|
11
|
+
DEVELOPMENT = "dev",
|
|
12
|
+
TEST = "test",
|
|
13
|
+
SANDBOX = "sandbox",
|
|
14
|
+
RELEASE = "release",
|
|
15
|
+
ENTERPRISE = "enterprise"
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './action';
|
|
2
|
+
export * from './billing';
|
|
3
|
+
export * from './connect';
|
|
4
|
+
export * from './connectModal';
|
|
5
|
+
export * from './environment';
|
|
6
|
+
export * from './execution';
|
|
7
|
+
export * from './resolvers';
|
|
8
|
+
export * from './sdk';
|
|
9
|
+
export * from './stripe';
|