@useparagon/connect 1.0.0 → 1.0.1
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 -674
- package/README.md +33 -8
- package/dist/src/ConnectSDK.d.ts +189 -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 +42 -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 +33 -0
- package/dist/src/entities/integrationConfig.interface.d.ts +9 -0
- package/{src/entities/license.interface.ts → dist/src/entities/license.interface.d.ts} +2 -4
- 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/helpers/ConnectUserContext.d.ts +18 -0
- package/dist/src/helpers/index.d.ts +15 -0
- package/dist/src/helpers/oauth.d.ts +30 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.js +4376 -0
- package/dist/src/server.types.d.ts +13 -0
- package/dist/src/types/action.d.ts +252 -0
- package/dist/src/types/billing.d.ts +2 -0
- package/dist/src/types/connect.d.ts +200 -0
- package/dist/src/types/connectModal.d.ts +28 -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 +10 -0
- package/dist/src/types/oauth.d.ts +3 -0
- package/dist/src/types/resolvers.d.ts +297 -0
- package/dist/src/types/sdk.d.ts +223 -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 +13 -0
- package/dist/src/utils/throttle.d.ts +118 -0
- package/package.json +16 -42
- package/src/ConnectSDK.tsx +0 -1065
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* environment variables needed for connect sdk
|
|
3
|
+
*/
|
|
4
|
+
export type ConnectSdkEnvironments = {
|
|
5
|
+
CDN_PUBLIC_URL: string;
|
|
6
|
+
CONNECT_PUBLIC_URL: string;
|
|
7
|
+
DASHBOARD_PUBLIC_URL: string;
|
|
8
|
+
NODE_ENV: string;
|
|
9
|
+
PASSPORT_PUBLIC_URL: string;
|
|
10
|
+
PLATFORM_ENV: string;
|
|
11
|
+
VERSION: string;
|
|
12
|
+
ZEUS_PUBLIC_URL: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,252 @@
|
|
|
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 type ActionConfigDTO = {
|
|
245
|
+
name: string;
|
|
246
|
+
brandColor: string;
|
|
247
|
+
provider: string | undefined;
|
|
248
|
+
authScheme: AuthenticationScheme | undefined;
|
|
249
|
+
endUserSuppliedValues: IntegrationConnectInput[] | undefined;
|
|
250
|
+
isAccountTypeSupported: boolean;
|
|
251
|
+
};
|
|
252
|
+
export {};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { ConnectCredentialProviderData, CredentialStatus } from '../entities/connectCredential.interface';
|
|
2
|
+
import { PersonaMeta } from '../entities/persona.interface';
|
|
3
|
+
import { 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
|
+
* timestamp value for last Execution Date for workflow . Will be synced up by chronos service.
|
|
47
|
+
*/
|
|
48
|
+
lastExecutionDate?: Date;
|
|
49
|
+
/**
|
|
50
|
+
* last execution status for workflow . Will be synced up by chronos service.
|
|
51
|
+
*/
|
|
52
|
+
lastExecutionStatus?: ExecutionStatus;
|
|
53
|
+
};
|
|
54
|
+
declare enum ExecutionStatus {
|
|
55
|
+
NOT_STARTED = "NOT_STARTED",
|
|
56
|
+
DELAYED = "DELAYED",
|
|
57
|
+
PAUSED = "PAUSED",
|
|
58
|
+
EXECUTING = "EXECUTING",
|
|
59
|
+
FAILED = "FAILED",
|
|
60
|
+
SUCCEEDED = "SUCCEEDED",
|
|
61
|
+
WAITING = "WAITING"
|
|
62
|
+
}
|
|
63
|
+
export type ModalConfig = {
|
|
64
|
+
/**
|
|
65
|
+
* A primary color for the background color of the Connect modal.
|
|
66
|
+
*/
|
|
67
|
+
accentColor?: string;
|
|
68
|
+
/**
|
|
69
|
+
* A boolean to show / hide paragon link in footer section. (default true)
|
|
70
|
+
*/
|
|
71
|
+
paragonLink?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* A description for the integration's purpose. Appears just below the integration name.
|
|
74
|
+
*/
|
|
75
|
+
description?: string;
|
|
76
|
+
/**
|
|
77
|
+
* A long-form description for the integration's purpose. Appears in the Overview tab of the
|
|
78
|
+
* Connect modal.
|
|
79
|
+
*/
|
|
80
|
+
overview?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Inputs and metadata about this integration's workflows.
|
|
83
|
+
*/
|
|
84
|
+
workflowMeta?: IntegrationWorkflowMetaMap;
|
|
85
|
+
/**
|
|
86
|
+
* Inputs metadata for shared workflow settings
|
|
87
|
+
*/
|
|
88
|
+
sharedMeta?: IntegrationSharedMeta;
|
|
89
|
+
};
|
|
90
|
+
type IntegrationSharedMeta = {
|
|
91
|
+
/**
|
|
92
|
+
* Inputs to intake global/shared user settings, configured in the Portal Editor.
|
|
93
|
+
*/
|
|
94
|
+
inputs?: SerializedConnectInput[];
|
|
95
|
+
};
|
|
96
|
+
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];
|
|
97
|
+
type SupportedConnectInputType = (typeof SupportedConnectInputTypes)[number];
|
|
98
|
+
export type SidebarInput = IntegrationConnectInput;
|
|
99
|
+
type SupportedConnectInput<T extends SidebarInput = SidebarInput> = Extract<T, {
|
|
100
|
+
type: SupportedConnectInputType;
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* A SerializedConnectInput is one that excludes the properties of a DynamicDataSource, which are
|
|
104
|
+
* loaded in at runtime rather than saved in the DB.
|
|
105
|
+
*/
|
|
106
|
+
type SerializedConnectInput<TInputType extends SupportedConnectInputType = SupportedConnectInputType> = {
|
|
107
|
+
[T in SupportedConnectInputType]: Extract<SupportedConnectInput, {
|
|
108
|
+
type: T;
|
|
109
|
+
}> extends {
|
|
110
|
+
source: DataSource;
|
|
111
|
+
} | {
|
|
112
|
+
getValues: Function;
|
|
113
|
+
} ? Omit<Extract<SupportedConnectInput, {
|
|
114
|
+
type: T;
|
|
115
|
+
}>, 'source' | 'getValues'> & {
|
|
116
|
+
/**
|
|
117
|
+
* If a Connect input is dynamic and uses a DynamicDataSource, `sourceType` will match the
|
|
118
|
+
* `cacheKey` property of the source specified in the action's sources module.
|
|
119
|
+
*
|
|
120
|
+
* If it uses a FieldMapperDataSource, `sourceType` will match the `id` property of the source.
|
|
121
|
+
*/
|
|
122
|
+
sourceType?: string;
|
|
123
|
+
fallbackText?: string;
|
|
124
|
+
} : Extract<SupportedConnectInput, {
|
|
125
|
+
type: T;
|
|
126
|
+
}>;
|
|
127
|
+
}[TInputType] & {
|
|
128
|
+
tooltip?: string;
|
|
129
|
+
};
|
|
130
|
+
type IntegrationWorkflowMetaMap = {
|
|
131
|
+
[id: string]: IntegrationWorkflowMeta;
|
|
132
|
+
};
|
|
133
|
+
type IntegrationWorkflowMeta = {
|
|
134
|
+
/**
|
|
135
|
+
* The ID of the WorkflowEntity.
|
|
136
|
+
*/
|
|
137
|
+
id: string;
|
|
138
|
+
/**
|
|
139
|
+
* A longer-form description for the Workflow's functionality. Acts as a "subtitle" to the
|
|
140
|
+
* WorkflowEntity's `description` property.
|
|
141
|
+
*/
|
|
142
|
+
infoText?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Determine whether or not to enable workflow for connected user
|
|
145
|
+
* @default false
|
|
146
|
+
*/
|
|
147
|
+
defaultEnabled?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Determines whether or not the workflow displays in the Connect Portal.
|
|
150
|
+
* @default false
|
|
151
|
+
*/
|
|
152
|
+
hidden?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* An index to track the positional order of a workflow in the list of displayed workflows.
|
|
155
|
+
* If `order` is undefined, the workflow will be sorted by its `createdAt` property (after those
|
|
156
|
+
* that are sorted manually by `order`.)
|
|
157
|
+
*/
|
|
158
|
+
order?: number;
|
|
159
|
+
/**
|
|
160
|
+
* Inputs to intake workflow-specific settings, configured in the Portal Editor.
|
|
161
|
+
*/
|
|
162
|
+
inputs: SerializedConnectInput[];
|
|
163
|
+
/**
|
|
164
|
+
* Conditions to evaluate permission for endUser based on persona metadata.
|
|
165
|
+
*/
|
|
166
|
+
permissions?: OrConditions;
|
|
167
|
+
};
|
|
168
|
+
export type DynamicMappingField = {
|
|
169
|
+
label: string;
|
|
170
|
+
value: string;
|
|
171
|
+
};
|
|
172
|
+
export type DynamicMappingOptions = {
|
|
173
|
+
fields: DynamicMappingField[];
|
|
174
|
+
userCanRemoveMappings?: boolean;
|
|
175
|
+
userCanCreateFields?: boolean;
|
|
176
|
+
defaultFields?: string[];
|
|
177
|
+
};
|
|
178
|
+
export type AuthenticatedConnectUser = {
|
|
179
|
+
authenticated: true;
|
|
180
|
+
token: string;
|
|
181
|
+
userId: string;
|
|
182
|
+
integrations: SDKIntegrationState;
|
|
183
|
+
meta: PersonaMeta;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* The contents of the `integrations` field for an authenticated ConnectUser.
|
|
187
|
+
*
|
|
188
|
+
* The fields from `ConnectCredentialConfig` are stored; all other fields are computed from other
|
|
189
|
+
* available entities.
|
|
190
|
+
*/
|
|
191
|
+
type SDKIntegrationState = Partial<Record<string, {
|
|
192
|
+
enabled: boolean;
|
|
193
|
+
credentialId?: string;
|
|
194
|
+
credentialStatus?: CredentialStatus;
|
|
195
|
+
providerId?: string;
|
|
196
|
+
providerData?: ConnectCredentialProviderData;
|
|
197
|
+
} & ConnectCredentialConfig>>;
|
|
198
|
+
export type IConnectUser = Omit<AuthenticatedConnectUser, 'token'>;
|
|
199
|
+
export declare const INFER_CONTENT_TYPE_FROM_CONNECT_OPTIONS = "auto";
|
|
200
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IPublishedCustomIntegration } from '../entities/customIntegration.interface';
|
|
3
|
+
import { IConnectIntegrationWithCredentialInfo } from '../entities/integration.interface';
|
|
4
|
+
import { ModalConfig } from './connect';
|
|
5
|
+
import { InstallOptions, ModalView } from './sdk';
|
|
6
|
+
export type Props = {
|
|
7
|
+
integration: IConnectIntegrationWithCredentialInfo | null;
|
|
8
|
+
customIntegration?: IPublishedCustomIntegration;
|
|
9
|
+
config?: ModalConfig;
|
|
10
|
+
contentStyle?: React.CSSProperties;
|
|
11
|
+
overlayStyle?: React.CSSProperties;
|
|
12
|
+
popupProps?: Record<string, string>;
|
|
13
|
+
hideCross?: boolean;
|
|
14
|
+
tabView?: ModalView;
|
|
15
|
+
isPreviewMode?: boolean;
|
|
16
|
+
onBeforeEnableIntegration?: () => void | Promise<void>;
|
|
17
|
+
onClose?: () => void;
|
|
18
|
+
onOpen?: () => void;
|
|
19
|
+
onTabViewChange?: (view: ModalView) => void;
|
|
20
|
+
/**
|
|
21
|
+
* this flag is for controlling the enabling behavior from outside this component.
|
|
22
|
+
* It is currently used in BYO to show input settings while adding them live
|
|
23
|
+
*/
|
|
24
|
+
previewSettings?: {
|
|
25
|
+
isEnabling: boolean;
|
|
26
|
+
};
|
|
27
|
+
apiInstallationOptions?: InstallOptions;
|
|
28
|
+
};
|
|
@@ -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,10 @@
|
|
|
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 './oauth';
|
|
8
|
+
export * from './resolvers';
|
|
9
|
+
export * from './sdk';
|
|
10
|
+
export * from './stripe';
|