@integry/sdk 4.5.2 → 4.5.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/.vscode/launch.json +2 -2
- package/THIRD_PARTY_LICENSES +0 -37
- package/dist/esm/index.csm.d.ts +12 -2
- package/dist/esm/index.csm.js +7262 -1
- package/dist/umd/index.umd.d.ts +9 -1
- package/dist/umd/index.umd.js +7262 -1
- package/jest.config.cjs +10 -0
- package/package.json +10 -4
- package/src/components/AddTagButton/index.ts +23 -0
- package/src/components/BasicSelect/index.ts +114 -0
- package/src/components/BasicSelect/styles.module.scss +44 -0
- package/src/components/Button/index.ts +94 -0
- package/src/components/Button/styles.module.scss +152 -0
- package/src/components/CheckboxGroup/Checkbox.ts +104 -0
- package/src/components/CheckboxGroup/index.ts +190 -0
- package/src/components/CheckboxGroup/styles.module.scss +63 -0
- package/src/components/CollapsedMenu/index.ts +101 -0
- package/src/components/CollapsedMenu/styles.module.scss +46 -0
- package/src/components/ConfigureFieldWrapper/index.ts +85 -0
- package/src/components/ConfigureFieldWrapper/styles.module.scss +57 -0
- package/src/components/EditableText/index.ts +121 -0
- package/src/components/EditableText/styles.module.scss +38 -0
- package/src/components/EditableTextArea/index.ts +143 -0
- package/src/components/EditableTextArea/styles.module.scss +91 -0
- package/src/components/ErrorMessage/index.ts +16 -0
- package/src/components/ErrorMessage/styles.module.scss +19 -0
- package/src/components/ErrorPage/index.ts +42 -0
- package/src/components/ErrorPage/styles.module.scss +26 -0
- package/src/components/Footer/index.ts +41 -0
- package/src/components/Footer/styles.module.scss +40 -0
- package/src/components/HTMLContent/index.tsx +275 -0
- package/src/components/HTMLContent/styles.module.scss +3 -0
- package/src/components/InfoBox/index.ts +48 -0
- package/src/components/InfoBox/styles.module.scss +21 -0
- package/src/components/Input/BaseInput/index.ts +170 -0
- package/src/components/Input/BaseInput/styles.module.scss +94 -0
- package/src/components/Input/DateInput/index.ts +103 -0
- package/src/components/Input/DateInput/styles.module.scss +50 -0
- package/src/components/Input/Input/index.ts +206 -0
- package/src/components/Input/Input/styles.module.scss +14 -0
- package/src/components/Input/PasswordInput/index.ts +164 -0
- package/src/components/Input/PasswordInput/styles.module.scss +37 -0
- package/src/components/Input/index.ts +7 -0
- package/src/components/Label/index.ts +61 -0
- package/src/components/Label/styles.module.scss +41 -0
- package/src/components/LargeLoader/index.ts +25 -0
- package/src/components/LargeLoader/styles.module.scss +16 -0
- package/src/components/Listbox/ListBoxItem.ts +57 -0
- package/src/components/Listbox/index.ts +479 -0
- package/src/components/Listbox/styles.module.scss +197 -0
- package/src/components/Loader/index.ts +25 -0
- package/src/components/Loader/styles.module.scss +16 -0
- package/src/components/MediaGallery/MediaGalleryModal.ts +82 -0
- package/src/components/MediaGallery/MediaSlider.ts +76 -0
- package/src/components/MediaGallery/index.ts +92 -0
- package/src/components/MediaGallery/styles.module.scss +156 -0
- package/src/components/MediaUpload/index.ts +233 -0
- package/src/components/MediaUpload/styles.module.scss +118 -0
- package/src/components/Modal/index.ts +87 -0
- package/src/components/Modal/styles.module.scss +441 -0
- package/src/components/MultipurposeField/Dropdown/ListBoxItem.tsx +58 -0
- package/src/components/MultipurposeField/Dropdown/index.tsx +981 -0
- package/src/components/MultipurposeField/Dropdown/styles.module.scss +208 -0
- package/src/components/MultipurposeField/TagMenu/index.ts +384 -0
- package/src/components/MultipurposeField/TagMenu/styles.module.scss +136 -0
- package/src/components/MultipurposeField/TagOptions/index.tsx +83 -0
- package/src/components/MultipurposeField/TagOptions/styles.module.scss +95 -0
- package/src/components/MultipurposeField/index.tsx +687 -0
- package/src/components/MultipurposeField/styles.module.scss +56 -0
- package/src/components/NewModal/index.ts +69 -0
- package/src/components/NewModal/styles.module.scss +70 -0
- package/src/components/OverflowTooltip/index.tsx +59 -0
- package/src/components/PopUp/ConfirmationPopUp/index.ts +58 -0
- package/src/components/PopUp/ConfirmationPopUp/styles.module.scss +49 -0
- package/src/components/PopUp/SuccessPopUp/index.ts +62 -0
- package/src/components/PopUp/SuccessPopUp/styles.module.scss +38 -0
- package/src/components/RadioGroup/Radio.ts +129 -0
- package/src/components/RadioGroup/index.ts +169 -0
- package/src/components/RadioGroup/styles.module.scss +81 -0
- package/src/components/Search/index.ts +69 -0
- package/src/components/Search/styles.module.scss +149 -0
- package/src/components/TabBar/Tab.ts +33 -0
- package/src/components/TabBar/index.ts +64 -0
- package/src/components/TabBar/styles.module.scss +43 -0
- package/src/components/Tag/index.ts +29 -0
- package/src/components/Tag/styles.module.scss +57 -0
- package/src/components/TextArea/index.ts +172 -0
- package/src/components/TextArea/styles.module.scss +70 -0
- package/src/components/TextContent/index.tsx +128 -0
- package/src/components/TextContent/styles.module.scss +6 -0
- package/src/components/ThreeDotLoader/index.ts +39 -0
- package/src/components/ThreeDotLoader/styles.module.scss +41 -0
- package/src/components/TimeInput/index.ts +129 -0
- package/src/components/TimeInput/styles.module.scss +16 -0
- package/src/components/Toggle/index.ts +34 -0
- package/src/components/Toggle/styles.module.scss +56 -0
- package/src/components/Toggle-v2/index.ts +40 -0
- package/src/components/Toggle-v2/styles.module.scss +86 -0
- package/src/components/Tooltip/index.ts +271 -0
- package/src/components/Tooltip/styles.module.scss +105 -0
- package/src/components/form/ObjectField/index.ts +364 -0
- package/src/components/form/ObjectField/styles.module.scss +103 -0
- package/src/components/form/index.ts +3 -0
- package/src/contexts/AppContext.ts +12 -0
- package/src/declaration.d.ts +7 -0
- package/src/extensions/HMAC.ts +25 -0
- package/src/extensions/IntegryAPIError.ts +19 -0
- package/src/features/common/AccountDropdown/index.ts +291 -0
- package/src/features/common/AccountDropdown/styles.module.scss +19 -0
- package/src/features/common/ActionForm/index.ts +1818 -0
- package/src/features/common/ActionForm/styles.module.scss +23 -0
- package/src/features/common/AppCard/index.ts +207 -0
- package/src/features/common/AppCard/styles.module.scss +117 -0
- package/src/features/common/AppCardCompact/index.ts +189 -0
- package/src/features/common/AppCardCompact/styles.module.scss +141 -0
- package/src/features/common/AuthSelector/index.ts +537 -0
- package/src/features/common/AuthSelector/styles.module.scss +161 -0
- package/src/features/common/AuthSelectorCompact/index.ts +706 -0
- package/src/features/common/AuthSelectorCompact/styles.module.scss +219 -0
- package/src/features/common/AuthSelectorDropdown/index.ts +704 -0
- package/src/features/common/AuthSelectorDropdown/styles.module.scss +361 -0
- package/src/features/common/DynamicField/index.ts +229 -0
- package/src/features/common/DynamicField/styles.module.scss +67 -0
- package/src/features/common/DynamicTypedField/index.ts +217 -0
- package/src/features/common/DynamicTypedField/styles.module.scss +67 -0
- package/src/features/common/FunctionForm/index.ts +862 -0
- package/src/features/common/FunctionForm/styles.module.scss +163 -0
- package/src/features/common/MappingUI/index.ts +649 -0
- package/src/features/common/MappingUI/styles.module.scss +121 -0
- package/src/features/common/MarketplaceAppCard/index.ts +279 -0
- package/src/features/common/MarketplaceAppCard/styles.module.scss +231 -0
- package/src/features/common/MarketplaceAppCardCompact/index.ts +283 -0
- package/src/features/common/MarketplaceAppCardCompact/styles.module.scss +255 -0
- package/src/features/common/NewMappingUI/index.ts +515 -0
- package/src/features/common/NewMappingUI/styles.module.scss +113 -0
- package/src/features/common/RequestAppWidget/RequestAppModal/index.ts +67 -0
- package/src/features/common/RequestAppWidget/RequestAppModal/styles.module.scss +23 -0
- package/src/features/common/RequestAppWidget/index.ts +48 -0
- package/src/features/common/RequestAppWidget/request-app-form.ts +89 -0
- package/src/features/common/RequestAppWidget/styles.module.scss +43 -0
- package/src/features/common/SectionField/index.ts +272 -0
- package/src/features/common/SectionField/styles.module.scss +67 -0
- package/src/features/common/Step/index.ts +827 -0
- package/src/features/common/Step/styles.module.scss +12 -0
- package/src/features/common/StepNavigation/CollapsedSteps.ts +125 -0
- package/src/features/common/StepNavigation/NavItem.ts +111 -0
- package/src/features/common/StepNavigation/index.ts +257 -0
- package/src/features/common/StepNavigation/styles.module.scss +117 -0
- package/src/features/common/Steps/index.ts +1139 -0
- package/src/features/common/Steps/styles.module.scss +314 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/compactStyles.module.scss +383 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/flow-instance.tsx +367 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.tsx +194 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.tsx +389 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowInstanceCompact.tsx +577 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/index.tsx +83 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/styles.module.scss +212 -0
- package/src/features/containers/AppFlowContainer/AppFlowWrap/app-page-loader.tsx +45 -0
- package/src/features/containers/AppFlowContainer/AppFlowWrap/index.tsx +1081 -0
- package/src/features/containers/AppFlowContainer/AppFlowWrap/styles.module.scss +452 -0
- package/src/features/containers/AppFlowContainer/Authentication/index.ts +610 -0
- package/src/features/containers/AppFlowContainer/Authentication/styles.module.scss +468 -0
- package/src/features/containers/AppFlowContainer/index.ts +114 -0
- package/src/features/containers/AppPageContainer/AppPage/index.tsx +262 -0
- package/src/features/containers/AppPageContainer/AppPage/styles.module.scss +120 -0
- package/src/features/containers/AppPageContainer/IntegrationCard/index.ts +165 -0
- package/src/features/containers/AppPageContainer/IntegrationCard/styles.module.scss +81 -0
- package/src/features/containers/AppPageContainer/index.tsx +93 -0
- package/src/features/containers/AppPageContainer/styles.module.scss +0 -0
- package/src/features/containers/AppsForFlows/index.ts +161 -0
- package/src/features/containers/AppsForFlows/styles.module.scss +280 -0
- package/src/features/containers/AppsForFlowsCompact/index.ts +161 -0
- package/src/features/containers/AppsForFlowsCompact/styles.module.scss +279 -0
- package/src/features/containers/AuthSetupContainer/AppSelection.ts +73 -0
- package/src/features/containers/AuthSetupContainer/AuthTypeSelection.ts +67 -0
- package/src/features/containers/AuthSetupContainer/Footer.ts +32 -0
- package/src/features/containers/AuthSetupContainer/Header.ts +39 -0
- package/src/features/containers/AuthSetupContainer/PostAdditionPopup.ts +27 -0
- package/src/features/containers/AuthSetupContainer/index.ts +349 -0
- package/src/features/containers/AuthSetupContainer/styles.module.scss +229 -0
- package/src/features/containers/FlowSetupContainer/index.ts +390 -0
- package/src/features/containers/FlowSetupContainer/styles.module.scss +18 -0
- package/src/features/containers/MarkeplaceApps/index.ts +574 -0
- package/src/features/containers/MarkeplaceApps/styles.module.scss +559 -0
- package/src/features/containers/MarketplaceAppsCompact/index.ts +576 -0
- package/src/features/containers/MarketplaceAppsCompact/styles.module.scss +546 -0
- package/src/features/containers/MarketplaceAppsContainer/index.ts +83 -0
- package/src/features/containers/MarketplaceContainer/AppCard/index.ts +91 -0
- package/src/features/containers/MarketplaceContainer/AppCard/styles.module.scss +66 -0
- package/src/features/containers/MarketplaceContainer/AppListing/index.ts +34 -0
- package/src/features/containers/MarketplaceContainer/AppListing/styles.module.scss +10 -0
- package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/index.ts +132 -0
- package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/styles.module.scss +117 -0
- package/src/features/containers/MarketplaceContainer/index.ts +242 -0
- package/src/features/containers/MarketplaceContainer/styles.module.scss +84 -0
- package/src/features/containers/SDKContainer/index.ts +817 -0
- package/src/features/containers/SDKContainer/styles.module.scss +266 -0
- package/src/features/containers/SDKDebugContainer/index.ts +137 -0
- package/src/features/containers/SDKDebugContainer/styles.module.scss +37 -0
- package/src/features/containers/SDKFailedContainer/index.ts +117 -0
- package/src/features/containers/SDKFailedContainer/styles.module.scss +57 -0
- package/src/features/integrations/IntegrationRow/Icons.ts +77 -0
- package/src/features/integrations/IntegrationRow/index.ts +129 -0
- package/src/features/integrations/IntegrationRow/styles.module.scss +62 -0
- package/src/features/integrations/IntegrationsHeader/index.ts +34 -0
- package/src/features/integrations/IntegrationsHeader/styles.module.scss +47 -0
- package/src/features/integrations/IntegrationsList/index.ts +252 -0
- package/src/features/integrations/IntegrationsList/styles.module.scss +67 -0
- package/src/features/templates/Template/index.ts +295 -0
- package/src/features/templates/Template/styles.module.scss +226 -0
- package/src/features/templates/TemplatesView/index.ts +368 -0
- package/src/features/templates/TemplatesView/styles.module.scss +71 -0
- package/src/features/templates/TemplatesViewCompact/index.ts +364 -0
- package/src/features/templates/TemplatesViewCompact/styles.module.scss +141 -0
- package/src/hooks/useAutosizeTextArea.ts +22 -0
- package/src/hooks/useCustomRef.ts +13 -0
- package/src/hooks/useDebounce.ts +17 -0
- package/src/hooks/useElementResize.ts +40 -0
- package/src/hooks/useEventListener.ts +44 -0
- package/src/hooks/useHover.ts +40 -0
- package/src/hooks/useOnClickOutside.ts +32 -0
- package/src/index.ts +2051 -0
- package/src/index.umd.ts +13 -0
- package/src/interfaces/index.ts +924 -0
- package/src/modules/api/index.ts +1315 -0
- package/src/modules/api/responseHandler.ts +38 -0
- package/src/modules/event-emitter/index.ts +72 -0
- package/src/modules/event-emitter/runners/abstract.ts +21 -0
- package/src/modules/event-emitter/runners/default.ts +11 -0
- package/src/modules/event-emitter/runners/ntimes.ts +28 -0
- package/src/modules/event-emitter/types.ts +34 -0
- package/src/store/actionFunctions.ts +1573 -0
- package/src/store/index.ts +17 -0
- package/src/store/initialState.ts +58 -0
- package/src/stories/Button.stories.tsx +83 -0
- package/src/stories/Checkbox/Checkbox.stories.tsx +41 -0
- package/src/stories/Checkbox/CheckboxGroup.stories.tsx +46 -0
- package/src/stories/EditableText.stories.tsx +35 -0
- package/src/stories/Input/BaseInput.stories.tsx +48 -0
- package/src/stories/Input/DateInput.stories.tsx +28 -0
- package/src/stories/Input/Input.stories.tsx +24 -0
- package/src/stories/Input/PasswordInput.stories.tsx +26 -0
- package/src/stories/Introduction.stories.mdx +211 -0
- package/src/stories/Label.stories.tsx +27 -0
- package/src/stories/Listbox.stories.tsx +122 -0
- package/src/stories/Radio/Radio.stories.tsx +39 -0
- package/src/stories/Radio/RadioGroup.stories.tsx +46 -0
- package/src/stories/StepNavigation/NavItem.stories.tsx +31 -0
- package/src/stories/StepNavigation/StepNavigation.stories.tsx +50 -0
- package/src/stories/TabBar.stories.tsx +31 -0
- package/src/stories/TextArea.stories.tsx +23 -0
- package/src/stories/TimeInput.stories.tsx +37 -0
- package/src/stories/Toggle.stories.tsx +33 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/stories/assets/stackalt.svg +1 -0
- package/src/types/index.ts +293 -0
- package/src/types/store.ts +366 -0
- package/src/types/utils.ts +19 -0
- package/src/utils/ActivityOutputUtils.ts +163 -0
- package/src/utils/common.ts +20 -0
- package/src/utils/copyToClipboard.ts +24 -0
- package/src/utils/datetime.ts +101 -0
- package/src/utils/getUrlParam.ts +11 -0
- package/src/utils/isAuthMessage.ts +16 -0
- package/src/utils/isBrowser.ts +1 -0
- package/src/utils/jsonEncodeDecode.ts +15 -0
- package/src/utils/objectUtils.ts +116 -0
- package/src/utils/popup.ts +30 -0
- package/src/utils/searchJson.ts +51 -0
- package/src/utils/stepUtils.ts +45 -0
- package/src/utils/truncate.ts +6 -0
- package/test/setup.ts +1 -0
- package/vitest.config.ts +10 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { html } from 'htm/preact';
|
|
2
|
+
import { useState } from 'preact/hooks';
|
|
3
|
+
import { Input } from '@/components/Input';
|
|
4
|
+
import { TextArea } from '@/components/TextArea';
|
|
5
|
+
import { CheckboxGroup } from '@/components/CheckboxGroup';
|
|
6
|
+
import ConfigureFieldWrapper from '@/components/ConfigureFieldWrapper';
|
|
7
|
+
import { ListBox } from '@/components/MultipurposeField/Dropdown';
|
|
8
|
+
import { MultipurposeField } from '@/components/MultipurposeField';
|
|
9
|
+
import styles from './styles.module.scss';
|
|
10
|
+
|
|
11
|
+
interface ObjectFieldProps {
|
|
12
|
+
field: any;
|
|
13
|
+
functionArguments: any;
|
|
14
|
+
connectedAccount: string;
|
|
15
|
+
appName: string;
|
|
16
|
+
onChange: (
|
|
17
|
+
fieldId: string,
|
|
18
|
+
value: any,
|
|
19
|
+
type: string,
|
|
20
|
+
required: boolean,
|
|
21
|
+
parentFieldId?: string,
|
|
22
|
+
index?: number,
|
|
23
|
+
) => void;
|
|
24
|
+
apiHandler: any;
|
|
25
|
+
isArray?: boolean; // New prop to check if the input is an array
|
|
26
|
+
activityOutputData: any;
|
|
27
|
+
activityOutputDataRaw: any;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type Option = {
|
|
31
|
+
id: any;
|
|
32
|
+
value: string;
|
|
33
|
+
};
|
|
34
|
+
interface FieldDetails {
|
|
35
|
+
meta: {
|
|
36
|
+
title: string;
|
|
37
|
+
description_for_users: string;
|
|
38
|
+
is_required: boolean;
|
|
39
|
+
ui: {
|
|
40
|
+
placeholder: string;
|
|
41
|
+
regex?: string;
|
|
42
|
+
regex_error_message?: string;
|
|
43
|
+
ui_field: {
|
|
44
|
+
type?: string;
|
|
45
|
+
options?: Option[];
|
|
46
|
+
data_source?: any; // If needed, define this more specifically
|
|
47
|
+
endpointURL?: string; // Add endpointURL here
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
properties?: any; // If there are nested fields for objects
|
|
52
|
+
type: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Define the structure of each object in the array
|
|
56
|
+
type FieldObject = {
|
|
57
|
+
[key: string]: any; // Allow any string key with any value
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const transformTemplateFieldsToProperties = (templateFields: any[]) => {
|
|
61
|
+
const properties: { [key: string]: FieldDetails } = {};
|
|
62
|
+
|
|
63
|
+
templateFields.forEach((tf) => {
|
|
64
|
+
properties[tf.id] = {
|
|
65
|
+
meta: {
|
|
66
|
+
title: tf.title,
|
|
67
|
+
description_for_users: tf.description,
|
|
68
|
+
is_required: tf.is_required,
|
|
69
|
+
ui: {
|
|
70
|
+
placeholder: tf.placeholder,
|
|
71
|
+
regex: tf.regex || '',
|
|
72
|
+
regex_error_message: tf.regex_msg || 'Invalid input.',
|
|
73
|
+
ui_field: {
|
|
74
|
+
type: tf.type || 'TEXTFIELD',
|
|
75
|
+
options: [], // Populate if needed
|
|
76
|
+
data_source: null, // Adjust if needed
|
|
77
|
+
endpointURL: '', // Adjust if needed
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
properties: tf.template_fields?.length
|
|
82
|
+
? transformTemplateFieldsToProperties(tf.template_fields)
|
|
83
|
+
: undefined,
|
|
84
|
+
type: tf.data_type || 'string',
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
return properties;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const ObjectField = (props: ObjectFieldProps) => {
|
|
92
|
+
const {
|
|
93
|
+
field,
|
|
94
|
+
functionArguments,
|
|
95
|
+
connectedAccount,
|
|
96
|
+
appName,
|
|
97
|
+
onChange,
|
|
98
|
+
apiHandler,
|
|
99
|
+
isArray = false, // Default to false
|
|
100
|
+
activityOutputData,
|
|
101
|
+
activityOutputDataRaw,
|
|
102
|
+
} = props;
|
|
103
|
+
const normalizedField = {
|
|
104
|
+
...field,
|
|
105
|
+
properties:
|
|
106
|
+
field.properties ||
|
|
107
|
+
(field.template_fields
|
|
108
|
+
? transformTemplateFieldsToProperties(field.template_fields)
|
|
109
|
+
: {}),
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const [objectArray, setObjectArray] = useState<FieldObject[]>([{}]); // Start with one empty object in the array
|
|
113
|
+
|
|
114
|
+
// Method to handle field changes for each object in the array
|
|
115
|
+
const handleFieldChange = (
|
|
116
|
+
index: number,
|
|
117
|
+
fieldId: string,
|
|
118
|
+
value: any,
|
|
119
|
+
dataType: string,
|
|
120
|
+
) => {
|
|
121
|
+
const updatedObjectArray = [...objectArray];
|
|
122
|
+
updatedObjectArray[index][fieldId] = value;
|
|
123
|
+
|
|
124
|
+
// Update the state with the modified object array
|
|
125
|
+
setObjectArray(updatedObjectArray);
|
|
126
|
+
|
|
127
|
+
// Optionally trigger the parent change handler
|
|
128
|
+
if (isArray) {
|
|
129
|
+
onChange(
|
|
130
|
+
fieldId,
|
|
131
|
+
updatedObjectArray,
|
|
132
|
+
dataType,
|
|
133
|
+
field.is_required,
|
|
134
|
+
field.id,
|
|
135
|
+
index,
|
|
136
|
+
);
|
|
137
|
+
} else {
|
|
138
|
+
onChange(fieldId, value, dataType, field.is_required, field.id);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// Method to handle the 'Add More' button click
|
|
143
|
+
const handleAddMore = () => {
|
|
144
|
+
setObjectArray([...objectArray, {}]); // Add another empty object to the array
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const getRegex: any = (f: any) => {
|
|
148
|
+
if (f.type === 'boolean') {
|
|
149
|
+
return '^(true|false)$'; // Matches "true" or "false" as strings
|
|
150
|
+
}
|
|
151
|
+
if (f.type === 'number') {
|
|
152
|
+
return '^\\d+$'; // Matches numeric values only
|
|
153
|
+
}
|
|
154
|
+
if (f.type === 'array' && f.items && f.items.type === 'number') {
|
|
155
|
+
return '^\\d+$'; // Matches numeric values only
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return ''; // Default to empty string
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const getRegexErrorMessage: any = (f: any) => {
|
|
162
|
+
if (f.type === 'boolean') {
|
|
163
|
+
return 'Please enter "true" or "false".'; // Error message for boolean fields
|
|
164
|
+
}
|
|
165
|
+
if (f.type === 'number') {
|
|
166
|
+
return 'Please enter a valid number.'; // Error message for number fields
|
|
167
|
+
}
|
|
168
|
+
if (f.type === 'array' && f.items && f.items.type === 'number') {
|
|
169
|
+
return 'Please enter a valid number.'; // Error message for number fields
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return 'Invalid input.'; // Default error message
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const handleDeleteIconClick = (index: number) => {
|
|
176
|
+
setObjectArray((prevValues) => {
|
|
177
|
+
const newValues = prevValues.filter((_, i) => i !== index);
|
|
178
|
+
return newValues;
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// Render fields for each object in the array
|
|
183
|
+
const renderFields = (
|
|
184
|
+
properties: { [key: string]: FieldDetails },
|
|
185
|
+
objectIndex: number,
|
|
186
|
+
) =>
|
|
187
|
+
Object.entries(properties).map(([fieldName, fieldDetails], index) => {
|
|
188
|
+
const fieldType = fieldDetails.meta.ui.ui_field?.type || 'TEXTFIELD';
|
|
189
|
+
const options: Option[] = fieldDetails.meta.ui.ui_field?.options || [];
|
|
190
|
+
const placeholder =
|
|
191
|
+
fieldDetails.meta.ui.placeholder ||
|
|
192
|
+
(['DYNAMIC_DROPDOWN', 'STATIC_DROPDOWN'].includes(
|
|
193
|
+
fieldDetails.meta.ui.ui_field?.type || '',
|
|
194
|
+
)
|
|
195
|
+
? `Select or enter a value here...`
|
|
196
|
+
: `Enter value here...`);
|
|
197
|
+
|
|
198
|
+
const fieldElement = html`
|
|
199
|
+
<div class="${styles.functionFieldWrap} integry-action-field-wrap">
|
|
200
|
+
<${ConfigureFieldWrapper} field=${fieldDetails}>
|
|
201
|
+
${fieldType === 'TEXTFIELD' &&
|
|
202
|
+
html`
|
|
203
|
+
<${MultipurposeField}
|
|
204
|
+
id="${fieldName}"
|
|
205
|
+
title="${fieldDetails.meta.title}"
|
|
206
|
+
activityOutputData=${activityOutputData}
|
|
207
|
+
activityOutputDataRaw=${activityOutputDataRaw}
|
|
208
|
+
description="${fieldDetails.meta.description_for_users}"
|
|
209
|
+
value=${(objectArray[objectIndex] || {})[fieldName] || ''}
|
|
210
|
+
placeholder="${placeholder}"
|
|
211
|
+
onChange=${(val: any) => {
|
|
212
|
+
const valueReceived =
|
|
213
|
+
fieldDetails.type === 'number' ? Number(val) : val;
|
|
214
|
+
handleFieldChange(
|
|
215
|
+
objectIndex,
|
|
216
|
+
fieldName,
|
|
217
|
+
valueReceived,
|
|
218
|
+
fieldDetails.meta.ui.ui_field?.type || 'TEXTFIELD',
|
|
219
|
+
);
|
|
220
|
+
}}
|
|
221
|
+
regex=${fieldDetails.meta.ui.regex || getRegex(fieldDetails)}
|
|
222
|
+
regexErrorMessage=${fieldDetails.meta.ui.regex_error_message ||
|
|
223
|
+
getRegexErrorMessage(fieldDetails)}
|
|
224
|
+
isRequired="${fieldDetails.meta.is_required}"
|
|
225
|
+
type=${fieldType}
|
|
226
|
+
isMappable=${activityOutputDataRaw &&
|
|
227
|
+
Object.entries(activityOutputDataRaw).length > 0}
|
|
228
|
+
isEditable=${true}
|
|
229
|
+
allowTagsInText=${activityOutputDataRaw}
|
|
230
|
+
fieldId=${`${field.id}_${fieldName}`}
|
|
231
|
+
><//>
|
|
232
|
+
`}
|
|
233
|
+
${fieldType === 'TEXTAREA' &&
|
|
234
|
+
html`
|
|
235
|
+
<${MultipurposeField}
|
|
236
|
+
id="${fieldName}"
|
|
237
|
+
title="${fieldDetails.meta.title}"
|
|
238
|
+
description="${fieldDetails.meta.description_for_users}"
|
|
239
|
+
activityOutputData=${activityOutputData}
|
|
240
|
+
activityOutputDataRaw=${activityOutputDataRaw}
|
|
241
|
+
value=${(objectArray[objectIndex] || {})[fieldName] || ''}
|
|
242
|
+
onChange=${(val: any) =>
|
|
243
|
+
handleFieldChange(
|
|
244
|
+
objectIndex,
|
|
245
|
+
fieldName,
|
|
246
|
+
val,
|
|
247
|
+
fieldDetails.meta.ui.ui_field?.type || 'TEXTAREA',
|
|
248
|
+
)}
|
|
249
|
+
placeholder="${placeholder}"
|
|
250
|
+
isRequired="${fieldDetails.meta.is_required}"
|
|
251
|
+
regex=${fieldDetails.meta.ui.regex || getRegex(fieldDetails)}
|
|
252
|
+
regexErrorMessage=${fieldDetails.meta.ui.regex_error_message ||
|
|
253
|
+
getRegexErrorMessage(fieldDetails)}
|
|
254
|
+
isEditable=${true}
|
|
255
|
+
fieldId=${`${field.id}_${fieldName}`}
|
|
256
|
+
type=${fieldType}
|
|
257
|
+
isMappable=${activityOutputDataRaw &&
|
|
258
|
+
Object.entries(activityOutputDataRaw).length > 0}
|
|
259
|
+
allowTagsInText=${activityOutputDataRaw}
|
|
260
|
+
><//>
|
|
261
|
+
`}
|
|
262
|
+
${fieldType === 'CHECKBOX' &&
|
|
263
|
+
html`
|
|
264
|
+
<${CheckboxGroup}
|
|
265
|
+
fieldId="${fieldName}"
|
|
266
|
+
title="${fieldDetails.meta.title}"
|
|
267
|
+
value=${(objectArray[objectIndex] || {})[fieldName] || ''}
|
|
268
|
+
onChange=${(val: any) =>
|
|
269
|
+
handleFieldChange(
|
|
270
|
+
objectIndex,
|
|
271
|
+
fieldName,
|
|
272
|
+
val,
|
|
273
|
+
fieldDetails.meta.ui.ui_field?.type || 'CHECKBOX',
|
|
274
|
+
)}
|
|
275
|
+
/>
|
|
276
|
+
`}
|
|
277
|
+
${fieldType === 'DYNAMIC_DROPDOWN' &&
|
|
278
|
+
html`
|
|
279
|
+
<${ListBox}
|
|
280
|
+
key=${fieldName}
|
|
281
|
+
fieldId=${fieldName}
|
|
282
|
+
apiHandler=${apiHandler}
|
|
283
|
+
title=${fieldDetails.meta.title}
|
|
284
|
+
description=${fieldDetails.meta.description_for_users}
|
|
285
|
+
placeholder="${placeholder}"
|
|
286
|
+
isRequired="${fieldDetails.meta.is_required}"
|
|
287
|
+
endpointUrl=${fieldDetails.meta.ui.ui_field?.endpointURL || ''}
|
|
288
|
+
options=${options}
|
|
289
|
+
value=${(objectArray[objectIndex] || {})[fieldName] || ''}
|
|
290
|
+
onChange=${(val: any) =>
|
|
291
|
+
handleFieldChange(
|
|
292
|
+
objectIndex,
|
|
293
|
+
fieldName,
|
|
294
|
+
val,
|
|
295
|
+
fieldDetails.meta.ui.ui_field?.type || 'DYNAMIC_DROPDOWN',
|
|
296
|
+
)}
|
|
297
|
+
/>
|
|
298
|
+
`}
|
|
299
|
+
<//>
|
|
300
|
+
</div>
|
|
301
|
+
`;
|
|
302
|
+
|
|
303
|
+
return fieldElement;
|
|
304
|
+
});
|
|
305
|
+
return html`
|
|
306
|
+
<div class="${styles.objectContainer}">
|
|
307
|
+
${objectArray.map(
|
|
308
|
+
(_, index) =>
|
|
309
|
+
html`
|
|
310
|
+
<div class="${styles.objectFieldWrap}">
|
|
311
|
+
<div class="${styles.label}">
|
|
312
|
+
<label class="${styles.subLabel}">
|
|
313
|
+
<div>
|
|
314
|
+
${field.title}${isArray ? ` ${index + 1}` : ''}
|
|
315
|
+
${isArray &&
|
|
316
|
+
objectArray.length > 1 &&
|
|
317
|
+
index !== objectArray.length - 1 &&
|
|
318
|
+
html`
|
|
319
|
+
<div class=${styles.removeButton}>
|
|
320
|
+
<button
|
|
321
|
+
class="${styles.removeButton}"
|
|
322
|
+
onClick=${() => {
|
|
323
|
+
if (handleDeleteIconClick) {
|
|
324
|
+
handleDeleteIconClick(index);
|
|
325
|
+
}
|
|
326
|
+
}}
|
|
327
|
+
tabindex="-1"
|
|
328
|
+
>
|
|
329
|
+
<svg
|
|
330
|
+
width="15"
|
|
331
|
+
height="15"
|
|
332
|
+
viewBox="0 0 15 15"
|
|
333
|
+
fill="none"
|
|
334
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
335
|
+
>
|
|
336
|
+
<path d="M1.5 4.1999H13.65" stroke="#999999" />
|
|
337
|
+
<path
|
|
338
|
+
d="M11.6254 5.5498V6.2248L10.9504 13.6498H4.20039L3.52539 6.2248V5.5498"
|
|
339
|
+
stroke="#999999"
|
|
340
|
+
stroke-linejoin="round"
|
|
341
|
+
/>
|
|
342
|
+
<path
|
|
343
|
+
d="M5.55078 3.525V2.175C5.55078 1.80221 5.85299 1.5 6.22578 1.5H8.92578C9.29857 1.5 9.60078 1.80221 9.60078 2.175V3.525"
|
|
344
|
+
stroke="#999999"
|
|
345
|
+
/>
|
|
346
|
+
</svg>
|
|
347
|
+
</button>
|
|
348
|
+
</div>
|
|
349
|
+
`}
|
|
350
|
+
</div>
|
|
351
|
+
<div>${field.description}</div>
|
|
352
|
+
</label>
|
|
353
|
+
</div>
|
|
354
|
+
${renderFields(normalizedField.properties, index)}
|
|
355
|
+
</div>
|
|
356
|
+
`,
|
|
357
|
+
)}
|
|
358
|
+
${isArray &&
|
|
359
|
+
html` <a onClick=${handleAddMore}>+ Add another ${field.title}</a> `}
|
|
360
|
+
</div>
|
|
361
|
+
`;
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
export { ObjectField, ObjectFieldProps };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
.inputGroupWrapper {
|
|
2
|
+
fieldset {
|
|
3
|
+
padding: 0;
|
|
4
|
+
margin: 0;
|
|
5
|
+
border: none;
|
|
6
|
+
margin-bottom: 24px;
|
|
7
|
+
}
|
|
8
|
+
.readonlyHint {
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: -webkit-fill-available;
|
|
11
|
+
z-index: 99;
|
|
12
|
+
position: absolute;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
.objectContainer {
|
|
16
|
+
margin-bottom: 20px;
|
|
17
|
+
.objectFieldWrap {
|
|
18
|
+
border-top: 1px solid #e2e0db;
|
|
19
|
+
padding-top: 20px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
legend {
|
|
23
|
+
font-size: 12px;
|
|
24
|
+
padding-left: 0; /* Remove padding on the left */
|
|
25
|
+
margin-left: 0; /* Remove margin on the left */
|
|
26
|
+
border-left: none; /* Remove the default left border */
|
|
27
|
+
width: auto;
|
|
28
|
+
}
|
|
29
|
+
hr {
|
|
30
|
+
border: none;
|
|
31
|
+
height: 1px;
|
|
32
|
+
background-color: #e2e0db;
|
|
33
|
+
}
|
|
34
|
+
a {
|
|
35
|
+
color: #007bff;
|
|
36
|
+
text-decoration: none;
|
|
37
|
+
font-size: 12px;
|
|
38
|
+
&:hover {
|
|
39
|
+
text-decoration: underline;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
.label {
|
|
44
|
+
margin-bottom: 15px;
|
|
45
|
+
.subLabel {
|
|
46
|
+
display: block;
|
|
47
|
+
margin-bottom: 0;
|
|
48
|
+
|
|
49
|
+
> div:first-child {
|
|
50
|
+
color: #000;
|
|
51
|
+
font-family: Inter;
|
|
52
|
+
font-size: 12px;
|
|
53
|
+
font-style: normal;
|
|
54
|
+
font-weight: 400;
|
|
55
|
+
line-height: normal;
|
|
56
|
+
margin-bottom: 3px;
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: row;
|
|
59
|
+
align-items: center;
|
|
60
|
+
|
|
61
|
+
.tagSpan {
|
|
62
|
+
margin-left: 10px;
|
|
63
|
+
}
|
|
64
|
+
.refreshIcon {
|
|
65
|
+
margin-left: 8px;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
> div:nth-child(2) {
|
|
70
|
+
color: var(--black-and-grey-draft-and-tooltip-desc, #999);
|
|
71
|
+
font-family: Inter;
|
|
72
|
+
font-size: 12px;
|
|
73
|
+
font-style: normal;
|
|
74
|
+
font-weight: 400;
|
|
75
|
+
line-height: normal;
|
|
76
|
+
margin-bottom: 8px;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
.required {
|
|
80
|
+
color: #333;
|
|
81
|
+
font-size: 16px;
|
|
82
|
+
margin-left: 2px;
|
|
83
|
+
}
|
|
84
|
+
.removeButton {
|
|
85
|
+
background: none;
|
|
86
|
+
border: none;
|
|
87
|
+
color: #999999; /* Red color */
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
font-size: 18px; /* Size of the delete icon */
|
|
90
|
+
padding: 0;
|
|
91
|
+
display: flex;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
align-items: center;
|
|
94
|
+
margin-right: 10px;
|
|
95
|
+
margin-left: auto;
|
|
96
|
+
margin-right: 0px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.removeButton:hover {
|
|
100
|
+
color: #999999; /* Darker red on hover */
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-cycle
|
|
2
|
+
import { IntegryAPI } from '@/modules/api';
|
|
3
|
+
import { EventEmitter } from '@/modules/event-emitter';
|
|
4
|
+
import { IntegrySDKEvents } from '@/types';
|
|
5
|
+
import { createContext } from 'preact';
|
|
6
|
+
|
|
7
|
+
export default createContext<{
|
|
8
|
+
apiHandler: IntegryAPI;
|
|
9
|
+
eventEmitter: EventEmitter<IntegrySDKEvents>;
|
|
10
|
+
isPreviewMode: boolean;
|
|
11
|
+
isReadOnly?: boolean;
|
|
12
|
+
} | null>(null);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param key Key to sign hash
|
|
4
|
+
* @param message Message to hash
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
export async function HMAC(message: string, key: string): Promise<string> {
|
|
8
|
+
const g = (str: string) =>
|
|
9
|
+
new Uint8Array(
|
|
10
|
+
[...unescape(encodeURIComponent(str))].map((c) => c.charCodeAt(0)),
|
|
11
|
+
);
|
|
12
|
+
const k = g(key);
|
|
13
|
+
const m = g(message);
|
|
14
|
+
const c = await crypto.subtle.importKey(
|
|
15
|
+
'raw',
|
|
16
|
+
k,
|
|
17
|
+
{ name: 'HMAC', hash: 'SHA-256' },
|
|
18
|
+
true,
|
|
19
|
+
['sign'],
|
|
20
|
+
);
|
|
21
|
+
const s = await crypto.subtle.sign('HMAC', c, m);
|
|
22
|
+
return [...new Uint8Array(s)]
|
|
23
|
+
.map((b) => b.toString(16).padStart(2, '0'))
|
|
24
|
+
.join('');
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UnfetchResponse } from '../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Extend default Error class
|
|
5
|
+
*/
|
|
6
|
+
class IntegryAPIError extends Error {
|
|
7
|
+
statusCode: number | undefined;
|
|
8
|
+
|
|
9
|
+
response: UnfetchResponse | undefined;
|
|
10
|
+
|
|
11
|
+
constructor(errorMessage: string, response?: UnfetchResponse) {
|
|
12
|
+
super(errorMessage);
|
|
13
|
+
this.name = this.constructor.name;
|
|
14
|
+
this.statusCode = response?.status;
|
|
15
|
+
this.response = response;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { IntegryAPIError };
|