@integry/sdk 4.5.4 → 4.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/launch.json +1 -1
- package/dist/esm/index.csm.d.ts +7 -4
- package/dist/esm/index.csm.js +35 -16
- package/dist/umd/index.umd.d.ts +1 -0
- package/dist/umd/index.umd.js +35 -16
- package/package.json +2 -1
- package/src/features/common/ActionForm/index.ts +64 -21
- package/src/features/common/ActionForm/styles.module.scss +5 -0
- package/src/index.ts +42 -0
- package/src/renderFlowStep.test.ts +0 -0
- package/src/store/actionFunctions.ts +9 -4
- package/vitest.config.ts +6 -0
|
@@ -29,6 +29,7 @@ import NewMappingUI from '@/features/common/NewMappingUI';
|
|
|
29
29
|
import { ObjectField } from '@/components/form';
|
|
30
30
|
import { areParentValuesValid, getFieldLabelTags } from '@/utils/stepUtils';
|
|
31
31
|
import ConfigureFieldWrapper from '@/components/ConfigureFieldWrapper';
|
|
32
|
+
import { notEmpty } from '@/types/utils';
|
|
32
33
|
import {
|
|
33
34
|
JSONToActivityOutputData,
|
|
34
35
|
JSONToDynamicFieldData,
|
|
@@ -44,6 +45,7 @@ interface ActionFormPropsType extends StoreType {
|
|
|
44
45
|
eventEmitter: EventEmitter<IntegrySDKEvents>;
|
|
45
46
|
isReadOnly?: boolean;
|
|
46
47
|
accountConnected: boolean;
|
|
48
|
+
selectedAuthId: string;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
interface ActionFormStateType {
|
|
@@ -711,6 +713,9 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
|
|
|
711
713
|
};
|
|
712
714
|
|
|
713
715
|
private shouldShowStep = (field: TemplateField) => {
|
|
716
|
+
if (!this.props.showStepValidation) {
|
|
717
|
+
return true;
|
|
718
|
+
}
|
|
714
719
|
const stepId = this.props.step.id;
|
|
715
720
|
const stepObject = this.props.stepMapping && this.props.stepMapping[stepId];
|
|
716
721
|
|
|
@@ -756,13 +761,15 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
|
|
|
756
761
|
|
|
757
762
|
private stepIsOfType = (fields: string[]) => {
|
|
758
763
|
const stepId = this.props.step.id;
|
|
759
|
-
const stepObject = this.props.stepMapping &&
|
|
760
|
-
|
|
764
|
+
const stepObject = (this.props.stepMapping &&
|
|
765
|
+
this.props.stepMapping[stepId]) || { step: this.props.step };
|
|
766
|
+
return fields.indexOf(stepObject.step.activity?.type) > -1;
|
|
761
767
|
};
|
|
762
768
|
|
|
763
769
|
private textFieldParentHasValues = (currentField: any) => {
|
|
764
770
|
const stepId = this.props.step.id;
|
|
765
|
-
const stepObject = this.props.stepMapping &&
|
|
771
|
+
const stepObject = (this.props.stepMapping &&
|
|
772
|
+
this.props.stepMapping[stepId]) || { step: this.props.step };
|
|
766
773
|
|
|
767
774
|
const anyVisibleFields = stepObject.step.template_fields.filter(
|
|
768
775
|
(el) => el.is_visible,
|
|
@@ -1123,8 +1130,10 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
|
|
|
1123
1130
|
isReadOnly,
|
|
1124
1131
|
accountConnected,
|
|
1125
1132
|
} = this.props;
|
|
1126
|
-
const selectedStep =
|
|
1127
|
-
|
|
1133
|
+
const selectedStep =
|
|
1134
|
+
(stepMapping[step.id] && stepMapping[step.id].step) || step;
|
|
1135
|
+
const selectedStepData =
|
|
1136
|
+
(stepDataMapping && stepDataMapping[step.id]) || {};
|
|
1128
1137
|
const actionConfigPayload = {};
|
|
1129
1138
|
// userConfig?.objects && genericData.directActionPayloadName
|
|
1130
1139
|
// ? embedConfig?.objects[genericData.directActionPayloadName]
|
|
@@ -1134,9 +1143,9 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
|
|
|
1134
1143
|
const activityOutputData =
|
|
1135
1144
|
actionConfigPayload || this.props.activityOutputData || {};
|
|
1136
1145
|
const noStepFields =
|
|
1137
|
-
selectedStep.template_fields
|
|
1146
|
+
selectedStep.template_fields?.length === 0 ||
|
|
1138
1147
|
(!(this.props.userConfig && this.props.userConfig.viewAsIU) &&
|
|
1139
|
-
selectedStep.template_fields
|
|
1148
|
+
selectedStep.template_fields?.filter((field) => field.is_visible)
|
|
1140
1149
|
.length === 0);
|
|
1141
1150
|
return html`
|
|
1142
1151
|
${this.state.loading
|
|
@@ -1144,12 +1153,18 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
|
|
|
1144
1153
|
: html`
|
|
1145
1154
|
${selectedStep
|
|
1146
1155
|
? html`
|
|
1147
|
-
<div
|
|
1156
|
+
<div
|
|
1157
|
+
class=${`${styles.actionFormWrap} ${
|
|
1158
|
+
this.props.selectedAuthId && this.props.accountConnected
|
|
1159
|
+
? `${styles.actionFormWrapAutoWidth}`
|
|
1160
|
+
: ``
|
|
1161
|
+
}`}
|
|
1162
|
+
>
|
|
1148
1163
|
${noStepFields
|
|
1149
1164
|
? html`<span class=${styles.noStepFields}
|
|
1150
1165
|
>There’s nothing to configure, please proceed.</span
|
|
1151
1166
|
>`
|
|
1152
|
-
: selectedStep.template_fields
|
|
1167
|
+
: selectedStep.template_fields?.map((el) => {
|
|
1153
1168
|
if (
|
|
1154
1169
|
this.shouldShowStep(el) &&
|
|
1155
1170
|
(el.activity_field || el.type === 'SECTION')
|
|
@@ -1239,11 +1254,15 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
|
|
|
1239
1254
|
type=${el.activity_field?.type}
|
|
1240
1255
|
selectedAuthId=${`${
|
|
1241
1256
|
this.props.stepMapping[this.props.step.id]
|
|
1242
|
-
?.selectedAuthId ||
|
|
1257
|
+
?.selectedAuthId ||
|
|
1258
|
+
this.props.selectedAuthId ||
|
|
1259
|
+
''
|
|
1243
1260
|
}`}
|
|
1244
|
-
disabled=${
|
|
1245
|
-
this.props.step.id
|
|
1246
|
-
|
|
1261
|
+
disabled=${
|
|
1262
|
+
!this.props.stepMapping[this.props.step.id]
|
|
1263
|
+
?.isAuthVerified &&
|
|
1264
|
+
!this.props.accountConnected
|
|
1265
|
+
}
|
|
1247
1266
|
sourceFlowData=${this.sourceFlowData(el)}
|
|
1248
1267
|
sourceFlowIntegrataionInvocationUrl=${
|
|
1249
1268
|
el.source_flow_integration_invocation_url
|
|
@@ -1337,9 +1356,16 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
|
|
|
1337
1356
|
}
|
|
1338
1357
|
placeholder=${this.getPlaceholder(el)}
|
|
1339
1358
|
showStepValidation=${showStepValidation}
|
|
1340
|
-
regex=${
|
|
1359
|
+
regex=${
|
|
1360
|
+
selectedStepData[el.id]
|
|
1361
|
+
? selectedStepData[el.id].regex
|
|
1362
|
+
: ''
|
|
1363
|
+
}
|
|
1341
1364
|
regexErrorMessage=${
|
|
1342
|
-
selectedStepData[el.id]
|
|
1365
|
+
selectedStepData[el.id]
|
|
1366
|
+
? selectedStepData[el.id]
|
|
1367
|
+
.regexErrorMessage
|
|
1368
|
+
: ''
|
|
1343
1369
|
}
|
|
1344
1370
|
isRequired=${el.is_required}
|
|
1345
1371
|
isHidden=${el.is_hidden}
|
|
@@ -1449,10 +1475,15 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
|
|
|
1449
1475
|
placeholder=${el.placeholder ||
|
|
1450
1476
|
'Please enter a URL'}
|
|
1451
1477
|
showStepValidation=${showStepValidation}
|
|
1452
|
-
regex=${selectedStepData[el.id]
|
|
1478
|
+
regex=${selectedStepData[el.id]
|
|
1479
|
+
? selectedStepData[el.id].regex
|
|
1480
|
+
: ''}
|
|
1453
1481
|
regexErrorMessage=${selectedStepData[
|
|
1454
1482
|
el.id
|
|
1455
|
-
]
|
|
1483
|
+
]
|
|
1484
|
+
? selectedStepData[el.id]
|
|
1485
|
+
.regexErrorMessage
|
|
1486
|
+
: ''}
|
|
1456
1487
|
isRequired=${el.is_required}
|
|
1457
1488
|
onChange=${(
|
|
1458
1489
|
val: string,
|
|
@@ -1586,10 +1617,15 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
|
|
|
1586
1617
|
placeholder=${el.placeholder ||
|
|
1587
1618
|
el.activity_field?.placeholder ||
|
|
1588
1619
|
'Please enter a value'}
|
|
1589
|
-
regex=${selectedStepData[el.id]
|
|
1620
|
+
regex=${selectedStepData[el.id]
|
|
1621
|
+
? selectedStepData[el.id].regex
|
|
1622
|
+
: ''}
|
|
1590
1623
|
regexErrorMessage=${selectedStepData[
|
|
1591
1624
|
el.id
|
|
1592
|
-
]
|
|
1625
|
+
]
|
|
1626
|
+
? selectedStepData[el.id]
|
|
1627
|
+
.regexErrorMessage
|
|
1628
|
+
: ''}
|
|
1593
1629
|
showStepValidation=${showStepValidation}
|
|
1594
1630
|
isRequired=${el.is_required}
|
|
1595
1631
|
onChange=${(val: string) => {
|
|
@@ -1631,9 +1667,16 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
|
|
|
1631
1667
|
''
|
|
1632
1668
|
}
|
|
1633
1669
|
placeholder=${this.getPlaceholder(el)}
|
|
1634
|
-
regex=${
|
|
1670
|
+
regex=${
|
|
1671
|
+
selectedStepData[el.id].regex
|
|
1672
|
+
? selectedStepData[el.id].regex
|
|
1673
|
+
: ''
|
|
1674
|
+
}
|
|
1635
1675
|
regexErrorMessage=${
|
|
1636
|
-
selectedStepData[el.id]
|
|
1676
|
+
selectedStepData[el.id]
|
|
1677
|
+
? selectedStepData[el.id]
|
|
1678
|
+
.regexErrorMessage
|
|
1679
|
+
: ''
|
|
1637
1680
|
}
|
|
1638
1681
|
showStepValidation=${showStepValidation}
|
|
1639
1682
|
isRequired=${el.is_required}
|
package/src/index.ts
CHANGED
|
@@ -41,6 +41,7 @@ import FlowSetupContainer from '@/features/containers/FlowSetupContainer';
|
|
|
41
41
|
import MarketplaceContainer from '@/features/containers/MarketplaceContainer';
|
|
42
42
|
import AppFlowContainer from '@/features/containers/AppFlowContainer';
|
|
43
43
|
import MarketplaceAppsContainer from '@/features/containers/MarketplaceAppsContainer';
|
|
44
|
+
import ActionForm from '@/features/common/ActionForm';
|
|
44
45
|
|
|
45
46
|
import FunctionForm from '@/features/common/FunctionForm';
|
|
46
47
|
import { openPopupWindow } from '@/utils/popup';
|
|
@@ -1980,6 +1981,47 @@ export class IntegryJS {
|
|
|
1980
1981
|
}
|
|
1981
1982
|
};
|
|
1982
1983
|
|
|
1984
|
+
public renderFlowStep = (
|
|
1985
|
+
containerId: string,
|
|
1986
|
+
step: any,
|
|
1987
|
+
connectedAccountId: string,
|
|
1988
|
+
) => {
|
|
1989
|
+
const target = document.getElementById(containerId);
|
|
1990
|
+
|
|
1991
|
+
if (target) {
|
|
1992
|
+
const store = createSDKStore();
|
|
1993
|
+
render(
|
|
1994
|
+
html`<div>
|
|
1995
|
+
<${AppContext.Provider}
|
|
1996
|
+
value=${{
|
|
1997
|
+
apiHandler: this.apiHandler,
|
|
1998
|
+
eventEmitter: this.eventEmitter,
|
|
1999
|
+
isPreviewMode: false,
|
|
2000
|
+
}}
|
|
2001
|
+
>
|
|
2002
|
+
<${Provider} store=${store} key=${this.getRandomFlowId(10)}>
|
|
2003
|
+
<${ActionForm}
|
|
2004
|
+
step=${step}
|
|
2005
|
+
stepType=${'CONFIGURE'}
|
|
2006
|
+
showStepValidation=${false}
|
|
2007
|
+
apiHandler=${this.apiHandler}
|
|
2008
|
+
eventEmitter=${this.eventEmitter}
|
|
2009
|
+
isReadOnly="${false}"
|
|
2010
|
+
selectedAuthId="${connectedAccountId}"
|
|
2011
|
+
accountConnected=${true}
|
|
2012
|
+
/>
|
|
2013
|
+
<//>
|
|
2014
|
+
<//>
|
|
2015
|
+
</div>`,
|
|
2016
|
+
target,
|
|
2017
|
+
);
|
|
2018
|
+
} else {
|
|
2019
|
+
console.warn(
|
|
2020
|
+
`Integry SDK render target with id ${containerId} was not found`,
|
|
2021
|
+
);
|
|
2022
|
+
}
|
|
2023
|
+
};
|
|
2024
|
+
|
|
1983
2025
|
public verifyAuthConfig = () =>
|
|
1984
2026
|
this.apiHandler.verifyAuthConfig({
|
|
1985
2027
|
deploymentId: this.config.deploymentId,
|
|
File without changes
|
|
@@ -517,10 +517,15 @@ export const actionFunctions = (storeSnapshot: Store<State>) => ({
|
|
|
517
517
|
const { stepDataMapping, conditionalFieldMapping } = state;
|
|
518
518
|
const element = stepDataMapping[stepId];
|
|
519
519
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
520
|
+
let fieldsData: any[] = [];
|
|
521
|
+
if (element) {
|
|
522
|
+
fieldsData = Object.keys(element).map((fieldId) => {
|
|
523
|
+
const ele = element[Number(fieldId)];
|
|
524
|
+
return ele;
|
|
525
|
+
});
|
|
526
|
+
} else {
|
|
527
|
+
fieldsData = [];
|
|
528
|
+
}
|
|
524
529
|
|
|
525
530
|
const visibleFields = fieldsData.filter((el) => {
|
|
526
531
|
// filter out hidden conditional fields
|
package/vitest.config.ts
CHANGED