@integry/sdk 4.5.3 → 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/dist/esm/index.csm.js
CHANGED
|
@@ -3377,7 +3377,7 @@ var e,t,n,i,o,s,a,l={},r=[],d=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]
|
|
|
3377
3377
|
`;var i,o}))}
|
|
3378
3378
|
${l&&R` <a onClick=${()=>{u([...c,{}])}}>+ Add another ${t.title}</a> `}
|
|
3379
3379
|
</div>
|
|
3380
|
-
`};var Js={actionFormWrap:"styles-module_actionFormWrap__1--9G",noStepFields:"styles-module_noStepFields__1NQe1",unsupported:"styles-module_unsupported__2swxl",actionFormLoader:"styles-module_actionFormLoader__2AXe4"};ue('.styles-module_actionFormWrap__1--9G {\n width: 100%;\n}\n.styles-module_actionFormWrap__1--9G .styles-module_noStepFields__1NQe1 {\n font-family: "Inter";\n font-weight: 400;\n font-size: 14px;\n line-height: 24px;\n color: #999999;\n}\n\n.styles-module_unsupported__2swxl {\n font-size: 12px;\n color: #ca8c1b;\n}\n\n.styles-module_actionFormLoader__2AXe4 {\n width: 15px;\n margin: 0 auto;\n}');var Xs=B.connect(["stepState","stepMapping","stepDataMapping","parentChildMapping","fieldListMapping","conditionalFieldMapping","embedConfig","activityOutputData","genericData","userConfig","authMapping"],re)(class extends g{constructor(e){super(e),this.state={loading:!1,dynamicFieldDataState:{}}}componentDidMount(){const{step:e,verifyStepValidity:t}=this.props;t(e.id);const n=this.props.genericData.stepWithActivityOutput;if(n){const{id:e}=n,t=this.getVisibleFieldsDataOnRootStep(e);this.setRootStepData(t)}else this.setRootStepData({})}componentDidUpdate(e){const{step:t,verifyStepValidity:n}=this.props;if(e.step.id!==t.id){n(t.id);const e=this.props.genericData.stepWithActivityOutput;if(e){const{id:t}=e,n=this.getVisibleFieldsDataOnRootStep(t);this.setRootStepData(n)}else this.setRootStepData({})}}getVisibleFieldsDataOnRootStep=e=>{const t=this.props.stepDataMapping[e];return Object.keys(t).filter((e=>t[Number(e)].value)).reduce(((e,n)=>{const i=t[Number(n)];return{...e,[i.machineName]:i.value}}),{})};refreshRootStepData=async e=>{const t=this.props.genericData.stepWithActivityOutput;if(t){const{id:n}=t,i=this.getVisibleFieldsDataOnRootStep(n);this.setRootStepData(i,!0,e)}else this.setRootStepData({},!0,e)};setActivityOutputFromSourceStep=(e,t,n)=>{const{setDynamicData:i}=this,o=this.setState.bind(this),s=this.props.step.source_steps,{stepMapping:a}=this.props,{props:l}=this;Object.keys(s).forEach((s=>{const r=l.step.source_steps[s];let d=!1;return Object.keys(a).every((p=>{const c=a[p].step.id;if(c&&(a[c].step.machine_name===s||a[c].step.machine_name===r.form_step_machine_name)&&!l.genericData.isTestIntegration){if(d=!0,r.activity_output_url){e||o({loading:!0});const n={},a=Object.keys(l.stepDataMapping[c]);for(let e=0;e<a.length;e+=1){const t=a[e],i=l.stepDataMapping[c][t];i.value&&(n[i.machineName]=i.value)}l.apiHandler.callDynamicDataEndpoint(new URL(r.activity_output_url),{authorization_id:`${l.stepMapping[c].selectedAuthId}`,...n}).then((e=>{o({loading:!1});let n=!1;e?l.setActivityOutputData({activityOutputData:r.loop_variable_name?this.replaceContactPrefix(e,s,r):e}):n=!0,t&&t(n)})),r.sample_data_endpoint_url&&c&&i(r.sample_data_endpoint_url,c,{...n})}else r.activity_output&&(o({loading:!1}),t&&t(),this.setActivityOutputFromIntegryObjectOrRawActivityOutput(n,r,s));return!1}return!((l.genericData.isTestIntegration||!r.app_id&&!this.canOverrideIntegryObject(n))&&r.activity_output)||(o({loading:!1}),t&&t(),d=!0,this.setActivityOutputFromRawActivityOutput(r,s),!1)})),!d&&r.activity_output?(this.setActivityOutputFromIntegryObjectOrRawActivityOutput(n,r,s),o({loading:!1}),t&&t(),d=!0,!1):!d}))};replaceContactPrefix=(e,t,n)=>{const i=`steps.${t}.out.${n.loop_variable_name?`${n.loop_variable_name}`:""}`;return e.map((e=>({...e,value:e.value.replace("contact_v1",i)})))};setActivityOutputFromRawActivityOutput=(()=>{var e=this;return function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";try{let i={};i=t.activity_output;const o=Yo(i,"",`steps.${n}.out.${t.loop_variable_name?`${t.loop_variable_name}.`:""}`),s=Qo(i,"",`steps.${n}.out.${t.loop_variable_name?`${t.loop_variable_name}.`:""}`);e.props.setIncomingWebhookPayload({incomingWebhookPayload:i}),e.props.setActivityOutputData({activityOutputData:o||[]}),e.props.setDynamicFieldData({dynamicFieldData:s||{}}),e.setState({dynamicFieldDataState:s||{}})}catch(e){console.error(e)}}})();setDynamicData=(e,t,n)=>{this.props.apiHandler.callDynamicDataEndpoint(new URL(e),{authorization_id:`${this.props.stepMapping[t].selectedAuthId}`,...n}).then((e=>{e&&(this.props.setDynamicFieldData({dynamicFieldData:e}),this.setState({dynamicFieldDataState:e}))}))};canOverrideIntegryObject=e=>{if(e)try{const t=JSON.parse(e);if(this.props.userConfig?.objects?.[t.name])return!0}catch(e){return!1}return!1};setActivityOutputFromIntegryObjectOrRawActivityOutput=(()=>{var e=this;return function(t,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(t)try{const o=JSON.parse(t);let s={};s=e.props.userConfig?.objects?.[o.name]?e.props.userConfig?.objects?.[o.name]:JSON.parse(o.payload);const a=Yo(s,"",`steps.${i}.out.${n.loop_variable_name?`${n.loop_variable_name}.`:""}`),l=Qo(s,"",`steps.${i}.out.${n.loop_variable_name?`${n.loop_variable_name}.`:""}`);e.props.setIncomingWebhookPayload({incomingWebhookPayload:s}),e.props.setActivityOutputData({activityOutputData:a||[]}),e.props.setDynamicFieldData({dynamicFieldData:l||{}}),e.setState({dynamicFieldDataState:l||{}})}catch(e){console.error(e)}else e.setActivityOutputFromRawActivityOutput(n,i)}})();setRootStepData=async(e,t,n)=>{const i=this.props.genericData.stepWithActivityOutput;let o=i?.template_fields.find((e=>"integry_webhook_object"===e.activity_field?.machine_name))?.default_value;if(o){let e={};try{e=JSON.parse(o||"{}")}catch(t){e={}}e={payload:o||"{}",name:i?.template_fields.find((e=>"payload_name"===e.activity_field?.machine_name))?.default_value||"payload"},o=JSON.stringify(e)}if(this.props.setActivityOutputData({activityOutputData:[]}),this.props.step.source_steps&&Object.keys(this.props.step.source_steps).length>0)this.setActivityOutputFromSourceStep(t,n,o);else if(i){const{id:s}=i;i.activity.activity_output_url?(t||this.setState({loading:!0}),this.props.apiHandler.callDynamicDataEndpoint(new URL(i.activity.activity_output_url),{authorization_id:`${this.props.stepMapping[s].selectedAuthId}`,...e}).then((e=>{this.setState({loading:!1}),n&&n(),e&&this.props.setActivityOutputData({activityOutputData:e})}))):i.activity.activity_output?(this.setActivityOutputFromIntegryObjectOrRawActivityOutput(o,i.activity),this.setState({loading:!1}),n&&n()):(this.setState({loading:!1}),n&&n()),i.activity.dynamic_field_data_endpoint&&this.setDynamicData(i.activity.dynamic_field_data_endpoint,s,e)}};removeCurlyBraces=e=>e.replace(/^{(.*)}$/,"$1");isNotJSON=e=>{try{return!(Array.isArray(e)&&e.length>0&&"object"==typeof e[0])&&(JSON.parse(e),!!Number(e))}catch(e){return!0}};arrayToNestedJSONWithFirstValue=(e,t)=>{let n={},i=[];e&&Array.isArray(e)&&(i=e),Object.keys(t||{}).forEach((e=>{const i=this.removeCurlyBraces(e);n={...n,[i]:t[e]||""}}));let o={};(i||[]).forEach((e=>{o={...o,[e.text]:t[e.value]||""}}));const s={};return(i||[]).forEach((e=>{if(!e.text||!e.value)return;const t=e.text.split(".");let i=s;t.forEach(((o,s)=>{i[o]||(s===t.length-1?n[e.value]&&n[e.value][0]&&this.isNotJSON(n[e.value][0])?i[o]=n[e.value][0]||"":i[o]="":i[o]={}),i=i[o]}))})),s};getFieldValFromActivityOutputRaw=(e,t)=>{const n=t.match(/{([^}]+)}/g);let i=t;return(n||[]).forEach((t=>{const n=t.replace(/{|}/g,"");(e||[]).forEach((e=>{e.text===n&&(i=i.replace(t,`{${e.value}}`))}))})),i};getStepVisibleFieldsData=e=>{const t=this.props.stepDataMapping[e];return Object.keys(t).filter((e=>t[Number(e)].value)).reduce(((e,n)=>{const i=t[Number(n)];return{...e,[i.machineName]:i.value}}),{})};areParentValuesFilled=(e,t)=>{let n=!0;for(let i=0;i<t.length;i+=1){const o=t[i];let s=null;this.props.parentChildMapping[e][o]&&(s=this.props.parentChildMapping[e][o].fieldId);const a=s&&this.props.stepDataMapping[e]&&this.props.stepDataMapping[e][s];if(!a||!a.value){n=!1;break}}return n};doParentFieldsHaveValues=(e,t)=>{let n=!0;const i=this.props.parentChildMapping[e][t];if(i&&i.parentFields)for(let t=0;t<i.parentFields.length;t+=1){const o=this.props.parentChildMapping[e][i.parentFields[t]],s=o&&this.props.stepDataMapping[e]&&this.props.stepDataMapping[e][o.fieldId];if(!s||!s.value){n=!1;break}}return n};shouldShowStep=e=>{const t=this.props.step.id,n=this.props.stepMapping&&this.props.stepMapping[t];if("BUTTON"===e.type||"HTML"===e.type||"SECTION"===e.type)return!0;if(n&&e.activity_field){if(this.props.userConfig&&this.props.userConfig.viewAsIU)return!0;const n=!e.is_hidden,i=!0,{parentFields:o}=this.props.parentChildMapping[t][e.activity_field.machine_name],s=this.props.conditionalFieldMapping[t][e.activity_field.machine_name];let a=!0,l=!0;o&&(a=this.areParentValuesFilled(t,o)),s&&(l=ae(t,s,this.props.stepDataMapping));const r=a&&l;return n&&i&&r}return!1};stepIsOfType=e=>{const t=this.props.step.id,n=this.props.stepMapping&&this.props.stepMapping[t];return e.indexOf(n.step.activity.type)>-1};textFieldParentHasValues=e=>{const t=this.props.step.id,n=this.props.stepMapping&&this.props.stepMapping[t],i=n.step.template_fields.filter((e=>e.is_visible)),o=!(!this.props?.userConfig||!this.props?.userConfig.viewAsIU)||n.selectedAuthId;if(!i.filter((e=>e.activity_field&&"DYNAMIC"===e.activity_field.type))[0])return!0;let s=!1;return i.forEach((t=>{const{activity_field:n}=t,{activity_field:i}=e;n?.child_fields?.includes(i.machine_name)&&(s=!0)})),!s||!!(i.length>0&&e&&e.activity_field&&o&&this.doParentFieldsHaveValues(t,e.activity_field.machine_name))};shouldShowOldMapping=()=>{const e=this.props.step.id,t=this.props.stepMapping&&this.props.stepMapping[e];if(this.stepIsOfType(["ADAPTER","ACTION"])){const n=t.step.template_fields.filter((e=>e.is_visible)),i=t.step.template_fields.filter((e=>e.is_visible&&"TEXTFIELD"===e.activity_field?.type)),o=t.selectedAuthId,s=n.filter((e=>e.activity_field&&"DYNAMIC"===e.activity_field.type))[0];if(i.length>0&&o&&!s&&!this.shouldShowNewMapping())return!0;if(!s)return!1;if(n.length>0&&o&&s&&s.activity_field&&this.doParentFieldsHaveValues(e,s.activity_field.machine_name)){const t=this.props.conditionalFieldMapping[e][s.activity_field.machine_name];return!t||ae(e,t,this.props.stepDataMapping)}return!1}return!1};shouldShowNewMapping=()=>{const{step:e,stepMapping:t}=this.props,n=t[e.id];if(this.stepIsOfType(["ADAPTER","ACTION"])){const e=n.step.template_fields.filter((e=>e.is_visible));if(e){if(e.filter((e=>e.activity_field&&"FIELD_MAPPING"===e.activity_field.type))[0])return!0}}return!1};getMappingDataInput=()=>{const e=this.props.step.id;return{authId:(this.props.stepMapping&&this.props.stepMapping[e]).selectedAuthId,fieldsData:this.getStepVisibleFieldsData(e)}};onFieldChange=e=>{let{stepId:t,fieldId:n,value:i,isRequired:o}=e;this.props.setStepFieldData({stepId:`${t}`,fieldId:`${n}`,value:i,isRequired:o}),this.props.clearChildFields({stepId:t,fieldId:n}),this.props.verifyStepValidity(Number(t))};fieldDynamicData=e=>{const t=this.props.step.id;if(this.props.stepMapping&&this.props.stepMapping[t]&&e.activity_field){const n=this.props.parentChildMapping[t][e.activity_field.machine_name]?.parentFields||null;if(n){return n.reduce(((e,n)=>{const{fieldId:i}=this.props.parentChildMapping[t][n];return i?{...e,[n]:this.props.stepDataMapping[t][i].value}:e}),{})}}return null};sourceFlowData=e=>{if(e.source_flow_integration_invocation_url){const{stepMapping:e,stepDataMapping:t}=this.props;return{steps:{...Object.keys(e).reduce(((n,i)=>{const{machine_name:o,id:s}=e[i].step;return o?{...n,[o]:{in:Object.keys(t[s]).reduce(((e,n)=>{const i=parseInt(n,10);if(t[s][i]){const{value:n,machineName:o}=t[s][i];return{...e,[o]:n}}return e}),{})}}:n}),{})}}}return null};isHTML=e=>!!/<\/?[a-z][\s\S]*>/i.test(e);getPlaceholder=e=>{let t="Incoming Webhook"===this.props.genericData.stepWithActivityOutput?.activity?.app?.name?this.props.genericData.selfAppName:this.props.genericData.stepWithActivityOutput?.activity?.app?.name||"";if(!t||t.includes("Webhook")){const e=this.props.step.source_steps,{stepMapping:n}=this.props,{props:i}=this;let o=null;Object.keys(e).forEach((e=>{const s=i.step.source_steps[e];o=s.app_id,s.app_name?t=s.app_name:Object.keys(n).every((e=>(n[e].step.authorization_type.app.id===s.app_id&&(t=n[e].step.activity.app.name),!0)))})),t?.includes("Incoming Webhook")&&null===o&&(t="Webhook")}return"TEXTAREA"===e.activity_field?.type||"TEXTFIELD"===e.activity_field?.type||"DYNAMIC"===e.activity_field?.type?!e.is_editable||e.is_mappable||e.allow_tags_in_text?!e.is_editable&&e.is_mappable?`Map to a ${t} field...`:e.is_editable&&(e.is_mappable||e.allow_tags_in_text)?`Enter text or map to a ${t} field...`:"Please enter a value":"Enter text...":"CHECKBOX"===e.activity_field?.type||"SELECT"===e.activity_field?.type||"RADIO"===e.activity_field?.type?!e.is_editable||e.is_mappable||e.allow_tags_in_text?!e.is_editable&&e.is_mappable?`Select a value or map to a ${t} field...`:e.is_editable&&e.allow_tags_in_text?`Enter text with ${t} fields or select a value...`:e.is_editable&&e.is_mappable?`Enter text, select a value or map to a ${t} field...`:"Select a value...":"Enter text or select a value...":"TEXTAREA"===e.activity_field?.type||"TEXTFIELD"===e.activity_field?.type?"Enter text...":"CHECKBOX"===e.activity_field?.type||"SELECT"===e.activity_field?.type||"RADIO"===e.activity_field?.type?"Select a value...":""};replacePlaceholders=(e,t)=>{const n={};return Object.entries(e).forEach((e=>{let[i,o]=e;if("string"==typeof o&&o.includes("{")){const e=o.match(/{(.*?)}/);if(e&&e[1]){const s=e[1],a=s.split(".").pop();void 0!==t[s]?n[i]=o.replace(e[0],t[s]):a&&void 0!==t[a]&&(n[i]=o.replace(e[0],t[a]))}}else"string"==typeof o&&o&&(n[i]=o)})),n};render(){const{step:e,stepMapping:t,stepDataMapping:n,setStepFieldData:i,showStepValidation:o,isReadOnly:s,accountConnected:a}=this.props,l=t[e.id]&&t[e.id].step,r=n&&n[e.id],d={}||this.props.activityOutputData||{},p=0===l.template_fields.length||!(this.props.userConfig&&this.props.userConfig.viewAsIU)&&0===l.template_fields.filter((e=>e.is_visible)).length;return R`
|
|
3380
|
+
`};var Js={actionFormWrap:"styles-module_actionFormWrap__1--9G",noStepFields:"styles-module_noStepFields__1NQe1",unsupported:"styles-module_unsupported__2swxl",actionFormLoader:"styles-module_actionFormLoader__2AXe4"};ue('.styles-module_actionFormWrap__1--9G {\n width: 100%;\n}\n.styles-module_actionFormWrap__1--9G .styles-module_noStepFields__1NQe1 {\n font-family: "Inter";\n font-weight: 400;\n font-size: 14px;\n line-height: 24px;\n color: #999999;\n}\n\n.styles-module_unsupported__2swxl {\n font-size: 12px;\n color: #ca8c1b;\n}\n\n.styles-module_actionFormLoader__2AXe4 {\n width: 15px;\n margin: 0 auto;\n}');var Xs=B.connect(["stepState","stepMapping","stepDataMapping","parentChildMapping","fieldListMapping","conditionalFieldMapping","embedConfig","activityOutputData","genericData","userConfig","authMapping"],re)(class extends g{constructor(e){super(e),this.state={loading:!1,dynamicFieldDataState:{}}}componentDidMount(){const{step:e,verifyStepValidity:t}=this.props;t(e.id);const n=this.props.genericData.stepWithActivityOutput;if(n){const{id:e}=n,t=this.getVisibleFieldsDataOnRootStep(e);this.setRootStepData(t)}else this.setRootStepData({})}componentDidUpdate(e){const{step:t,verifyStepValidity:n}=this.props;if(e.step.id!==t.id){n(t.id);const e=this.props.genericData.stepWithActivityOutput;if(e){const{id:t}=e,n=this.getVisibleFieldsDataOnRootStep(t);this.setRootStepData(n)}else this.setRootStepData({})}}getVisibleFieldsDataOnRootStep=e=>{const t=this.props.stepDataMapping[e];return Object.keys(t).filter((e=>t[Number(e)].value)).reduce(((e,n)=>{const i=t[Number(n)];return{...e,[i.machineName]:i.value}}),{})};refreshRootStepData=async e=>{const t=this.props.genericData.stepWithActivityOutput;if(t){const{id:n}=t,i=this.getVisibleFieldsDataOnRootStep(n);this.setRootStepData(i,!0,e)}else this.setRootStepData({},!0,e)};setActivityOutputFromSourceStep=(e,t,n)=>{const{setDynamicData:i}=this,o=this.setState.bind(this),s=this.props.step.source_steps,{stepMapping:a}=this.props,{props:l}=this;Object.keys(s).forEach((s=>{const r=l.step.source_steps[s];let d=!1;return Object.keys(a).every((p=>{const c=a[p].step.id;if(c&&(a[c].step.machine_name===s||a[c].step.machine_name===r.form_step_machine_name)&&!l.genericData.isTestIntegration){if(d=!0,r.activity_output_url){e||o({loading:!0});const n={},a=Object.keys(l.stepDataMapping[c]);for(let e=0;e<a.length;e+=1){const t=a[e],i=l.stepDataMapping[c][t];i.value&&(n[i.machineName]=i.value)}const d=r.activity_output_url.includes("functions/"),p=d?"POST":"GET";l.apiHandler.callDynamicDataEndpoint(new URL(r.activity_output_url),{authorization_id:`${l.stepMapping[c].selectedAuthId}`,...n},p).then((e=>{o({loading:!1});let n=!1;if(e){const t=e;d&&"output"in t?this.setActivityOutputFromIntegryObjectOrRawActivityOutput(t.output,r,s,!0):l.setActivityOutputData({activityOutputData:r.loop_variable_name?this.replaceContactPrefix(e,s,r):e})}else n=!0;t&&t(n)})),r.sample_data_endpoint_url&&c&&i(r.sample_data_endpoint_url,c,{...n})}else r.activity_output&&(o({loading:!1}),t&&t(),this.setActivityOutputFromIntegryObjectOrRawActivityOutput(n,r,s));return!1}return!((l.genericData.isTestIntegration||!r.app_id&&!this.canOverrideIntegryObject(n))&&r.activity_output)||(o({loading:!1}),t&&t(),d=!0,this.setActivityOutputFromRawActivityOutput(r,s),!1)})),!d&&r.activity_output?(this.setActivityOutputFromIntegryObjectOrRawActivityOutput(n,r,s),o({loading:!1}),t&&t(),d=!0,!1):!d}))};replaceContactPrefix=(e,t,n)=>{const i=`steps.${t}.out.${n.loop_variable_name?`${n.loop_variable_name}`:""}`;return e.map((e=>({...e,value:e.value.replace("contact_v1",i)})))};setActivityOutputFromRawActivityOutput=(()=>{var e=this;return function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";try{let i={};i=t.activity_output;const o=Yo(i,"",`steps.${n}.out.${t.loop_variable_name?`${t.loop_variable_name}.`:""}`),s=Qo(i,"",`steps.${n}.out.${t.loop_variable_name?`${t.loop_variable_name}.`:""}`);e.props.setIncomingWebhookPayload({incomingWebhookPayload:i}),e.props.setActivityOutputData({activityOutputData:o||[]}),e.props.setDynamicFieldData({dynamicFieldData:s||{}}),e.setState({dynamicFieldDataState:s||{}})}catch(e){console.error(e)}}})();setDynamicData=(e,t,n)=>{this.props.apiHandler.callDynamicDataEndpoint(new URL(e),{authorization_id:`${this.props.stepMapping[t].selectedAuthId}`,...n}).then((e=>{e&&(this.props.setDynamicFieldData({dynamicFieldData:e}),this.setState({dynamicFieldDataState:e}))}))};canOverrideIntegryObject=e=>{if(e)try{const t=JSON.parse(e);if(this.props.userConfig?.objects?.[t.name])return!0}catch(e){return!1}return!1};setActivityOutputFromIntegryObjectOrRawActivityOutput=(()=>{var e=this;return function(t,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t)try{let s={};if(o)s=t;else{const n=JSON.parse(t);s=e.props.userConfig?.objects?.[n.name]?e.props.userConfig?.objects?.[n.name]:JSON.parse(n.payload)}const a=Yo(s,"",`steps.${i}.out.${n.loop_variable_name?`${n.loop_variable_name}.`:""}`),l=Qo(s,"",`steps.${i}.out.${n.loop_variable_name?`${n.loop_variable_name}.`:""}`);e.props.setIncomingWebhookPayload({incomingWebhookPayload:s}),e.props.setActivityOutputData({activityOutputData:a||[]}),e.props.setDynamicFieldData({dynamicFieldData:l||{}}),e.setState({dynamicFieldDataState:l||{}})}catch(e){console.error(e)}else e.setActivityOutputFromRawActivityOutput(n,i)}})();setRootStepData=async(e,t,n)=>{const i=this.props.genericData.stepWithActivityOutput;let o=i?.template_fields.find((e=>"integry_webhook_object"===e.activity_field?.machine_name))?.default_value;if(o){let e={};try{e=JSON.parse(o||"{}")}catch(t){e={}}e={payload:o||"{}",name:i?.template_fields.find((e=>"payload_name"===e.activity_field?.machine_name))?.default_value||"payload"},o=JSON.stringify(e)}if(this.props.setActivityOutputData({activityOutputData:[]}),this.props.step.source_steps&&Object.keys(this.props.step.source_steps).length>0)this.setActivityOutputFromSourceStep(t,n,o);else if(i){const{id:s}=i;i.activity.activity_output_url?(t||this.setState({loading:!0}),this.props.apiHandler.callDynamicDataEndpoint(new URL(i.activity.activity_output_url),{authorization_id:`${this.props.stepMapping[s].selectedAuthId}`,...e}).then((e=>{this.setState({loading:!1}),n&&n(),e&&this.props.setActivityOutputData({activityOutputData:e})}))):i.activity.activity_output?(this.setActivityOutputFromIntegryObjectOrRawActivityOutput(o,i.activity),this.setState({loading:!1}),n&&n()):(this.setState({loading:!1}),n&&n()),i.activity.dynamic_field_data_endpoint&&this.setDynamicData(i.activity.dynamic_field_data_endpoint,s,e)}};removeCurlyBraces=e=>e.replace(/^{(.*)}$/,"$1");isNotJSON=e=>{try{return!(Array.isArray(e)&&e.length>0&&"object"==typeof e[0])&&(JSON.parse(e),!!Number(e))}catch(e){return!0}};arrayToNestedJSONWithFirstValue=(e,t)=>{let n={},i=[];e&&Array.isArray(e)&&(i=e),Object.keys(t||{}).forEach((e=>{const i=this.removeCurlyBraces(e);n={...n,[i]:t[e]||""}}));let o={};(i||[]).forEach((e=>{o={...o,[e.text]:t[e.value]||""}}));const s={};return(i||[]).forEach((e=>{if(!e.text||!e.value)return;const t=e.text.split(".");let i=s;t.forEach(((o,s)=>{i[o]||(s===t.length-1?n[e.value]&&n[e.value][0]&&this.isNotJSON(n[e.value][0])?i[o]=n[e.value][0]||"":i[o]="":i[o]={}),i=i[o]}))})),s};getFieldValFromActivityOutputRaw=(e,t)=>{const n=t.match(/{([^}]+)}/g);let i=t;return(n||[]).forEach((t=>{const n=t.replace(/{|}/g,"");(e||[]).forEach((e=>{e.text===n&&(i=i.replace(t,`{${e.value}}`))}))})),i};getStepVisibleFieldsData=e=>{const t=this.props.stepDataMapping[e];return Object.keys(t).filter((e=>t[Number(e)].value)).reduce(((e,n)=>{const i=t[Number(n)];return{...e,[i.machineName]:i.value}}),{})};areParentValuesFilled=(e,t)=>{let n=!0;for(let i=0;i<t.length;i+=1){const o=t[i];let s=null;this.props.parentChildMapping[e][o]&&(s=this.props.parentChildMapping[e][o].fieldId);const a=s&&this.props.stepDataMapping[e]&&this.props.stepDataMapping[e][s];if(!a||!a.value){n=!1;break}}return n};doParentFieldsHaveValues=(e,t)=>{let n=!0;const i=this.props.parentChildMapping[e][t];if(i&&i.parentFields)for(let t=0;t<i.parentFields.length;t+=1){const o=this.props.parentChildMapping[e][i.parentFields[t]],s=o&&this.props.stepDataMapping[e]&&this.props.stepDataMapping[e][o.fieldId];if(!s||!s.value){n=!1;break}}return n};shouldShowStep=e=>{const t=this.props.step.id,n=this.props.stepMapping&&this.props.stepMapping[t];if("BUTTON"===e.type||"HTML"===e.type||"SECTION"===e.type)return!0;if(n&&e.activity_field){if(this.props.userConfig&&this.props.userConfig.viewAsIU)return!0;const n=!e.is_hidden,i=!0,{parentFields:o}=this.props.parentChildMapping[t][e.activity_field.machine_name],s=this.props.conditionalFieldMapping[t][e.activity_field.machine_name];let a=!0,l=!0;o&&(a=this.areParentValuesFilled(t,o)),s&&(l=ae(t,s,this.props.stepDataMapping));const r=a&&l;return n&&i&&r}return!1};stepIsOfType=e=>{const t=this.props.step.id,n=this.props.stepMapping&&this.props.stepMapping[t];return e.indexOf(n.step.activity.type)>-1};textFieldParentHasValues=e=>{const t=this.props.step.id,n=this.props.stepMapping&&this.props.stepMapping[t],i=n.step.template_fields.filter((e=>e.is_visible)),o=!(!this.props?.userConfig||!this.props?.userConfig.viewAsIU)||n.selectedAuthId;if(!i.filter((e=>e.activity_field&&"DYNAMIC"===e.activity_field.type))[0])return!0;let s=!1;return i.forEach((t=>{const{activity_field:n}=t,{activity_field:i}=e;n?.child_fields?.includes(i.machine_name)&&(s=!0)})),!s||!!(i.length>0&&e&&e.activity_field&&o&&this.doParentFieldsHaveValues(t,e.activity_field.machine_name))};shouldShowOldMapping=()=>{const e=this.props.step.id,t=this.props.stepMapping&&this.props.stepMapping[e];if(this.stepIsOfType(["ADAPTER","ACTION"])){const n=t.step.template_fields.filter((e=>e.is_visible)),i=t.step.template_fields.filter((e=>e.is_visible&&"TEXTFIELD"===e.activity_field?.type)),o=t.selectedAuthId,s=n.filter((e=>e.activity_field&&"DYNAMIC"===e.activity_field.type))[0];if(i.length>0&&o&&!s&&!this.shouldShowNewMapping())return!0;if(!s)return!1;if(n.length>0&&o&&s&&s.activity_field&&this.doParentFieldsHaveValues(e,s.activity_field.machine_name)){const t=this.props.conditionalFieldMapping[e][s.activity_field.machine_name];return!t||ae(e,t,this.props.stepDataMapping)}return!1}return!1};shouldShowNewMapping=()=>{const{step:e,stepMapping:t}=this.props,n=t[e.id];if(this.stepIsOfType(["ADAPTER","ACTION"])){const e=n.step.template_fields.filter((e=>e.is_visible));if(e){if(e.filter((e=>e.activity_field&&"FIELD_MAPPING"===e.activity_field.type))[0])return!0}}return!1};getMappingDataInput=()=>{const e=this.props.step.id;return{authId:(this.props.stepMapping&&this.props.stepMapping[e]).selectedAuthId,fieldsData:this.getStepVisibleFieldsData(e)}};onFieldChange=e=>{let{stepId:t,fieldId:n,value:i,isRequired:o}=e;this.props.setStepFieldData({stepId:`${t}`,fieldId:`${n}`,value:i,isRequired:o}),this.props.clearChildFields({stepId:t,fieldId:n}),this.props.verifyStepValidity(Number(t))};fieldDynamicData=e=>{const t=this.props.step.id;if(this.props.stepMapping&&this.props.stepMapping[t]&&e.activity_field){const n=this.props.parentChildMapping[t][e.activity_field.machine_name]?.parentFields||null;if(n){return n.reduce(((e,n)=>{const{fieldId:i}=this.props.parentChildMapping[t][n];return i?{...e,[n]:this.props.stepDataMapping[t][i].value}:e}),{})}}return null};sourceFlowData=e=>{if(e.source_flow_integration_invocation_url){const{stepMapping:e,stepDataMapping:t}=this.props;return{steps:{...Object.keys(e).reduce(((n,i)=>{const{machine_name:o,id:s}=e[i].step;return o?{...n,[o]:{in:Object.keys(t[s]).reduce(((e,n)=>{const i=parseInt(n,10);if(t[s][i]){const{value:n,machineName:o}=t[s][i];return{...e,[o]:n}}return e}),{})}}:n}),{})}}}return null};isHTML=e=>!!/<\/?[a-z][\s\S]*>/i.test(e);getPlaceholder=e=>{let t="Incoming Webhook"===this.props.genericData.stepWithActivityOutput?.activity?.app?.name?this.props.genericData.selfAppName:this.props.genericData.stepWithActivityOutput?.activity?.app?.name||"";if(!t||t.includes("Webhook")){const e=this.props.step.source_steps,{stepMapping:n}=this.props,{props:i}=this;let o=null;Object.keys(e).forEach((e=>{const s=i.step.source_steps[e];o=s.app_id,s.app_name?t=s.app_name:Object.keys(n).every((e=>(n[e].step.authorization_type.app.id===s.app_id&&(t=n[e].step.activity.app.name),!0)))})),t?.includes("Incoming Webhook")&&null===o&&(t="Webhook")}return"TEXTAREA"===e.activity_field?.type||"TEXTFIELD"===e.activity_field?.type||"DYNAMIC"===e.activity_field?.type?!e.is_editable||e.is_mappable||e.allow_tags_in_text?!e.is_editable&&e.is_mappable?`Map to a ${t} field...`:e.is_editable&&(e.is_mappable||e.allow_tags_in_text)?`Enter text or map to a ${t} field...`:"Please enter a value":"Enter text...":"CHECKBOX"===e.activity_field?.type||"SELECT"===e.activity_field?.type||"RADIO"===e.activity_field?.type?!e.is_editable||e.is_mappable||e.allow_tags_in_text?!e.is_editable&&e.is_mappable?`Select a value or map to a ${t} field...`:e.is_editable&&e.allow_tags_in_text?`Enter text with ${t} fields or select a value...`:e.is_editable&&e.is_mappable?`Enter text, select a value or map to a ${t} field...`:"Select a value...":"Enter text or select a value...":"TEXTAREA"===e.activity_field?.type||"TEXTFIELD"===e.activity_field?.type?"Enter text...":"CHECKBOX"===e.activity_field?.type||"SELECT"===e.activity_field?.type||"RADIO"===e.activity_field?.type?"Select a value...":""};replacePlaceholders=(e,t)=>{const n={};return Object.entries(e).forEach((e=>{let[i,o]=e;if("string"==typeof o&&o.includes("{")){const e=o.match(/{(.*?)}/);if(e&&e[1]){const s=e[1],a=s.split(".").pop();void 0!==t[s]?n[i]=o.replace(e[0],t[s]):a&&void 0!==t[a]&&(n[i]=o.replace(e[0],t[a]))}}else"string"==typeof o&&o&&(n[i]=o)})),n};render(){const{step:e,stepMapping:t,stepDataMapping:n,setStepFieldData:i,showStepValidation:o,isReadOnly:s,accountConnected:a}=this.props,l=t[e.id]&&t[e.id].step,r=n&&n[e.id],d={}||this.props.activityOutputData||{},p=0===l.template_fields.length||!(this.props.userConfig&&this.props.userConfig.viewAsIU)&&0===l.template_fields.filter((e=>e.is_visible)).length;return R`
|
|
3381
3381
|
${this.state.loading?R`<div class=${Js.actionFormLoader}><${Ye} /></div>`:R`
|
|
3382
3382
|
${l?R`
|
|
3383
3383
|
<div class=${Js.actionFormWrap}>
|
|
@@ -6998,7 +6998,7 @@ var e,t,n,i,o,s,a,l={},r=[],d=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]
|
|
|
6998
6998
|
</div>
|
|
6999
6999
|
</div>
|
|
7000
7000
|
`}
|
|
7001
|
-
`}});const Rd={getAuthHash:async function(e,t){const n=e=>new Uint8Array([...unescape(encodeURIComponent(e))].map((e=>e.charCodeAt(0)))),i=n(t),o=n(e),s=await crypto.subtle.importKey("raw",i,{name:"HMAC",hash:"SHA-256"},!0,["sign"]),a=await crypto.subtle.sign("HMAC",s,o);return[...new Uint8Array(a)].map((e=>e.toString(16).padStart(2,"0"))).join("")}};class Wd{static SDK_VERSION="4.5.
|
|
7001
|
+
`}});const Rd={getAuthHash:async function(e,t){const n=e=>new Uint8Array([...unescape(encodeURIComponent(e))].map((e=>e.charCodeAt(0)))),i=n(t),o=n(e),s=await crypto.subtle.importKey("raw",i,{name:"HMAC",hash:"SHA-256"},!0,["sign"]),a=await crypto.subtle.sign("HMAC",s,o);return[...new Uint8Array(a)].map((e=>e.toString(16).padStart(2,"0"))).join("")}};class Wd{static SDK_VERSION="4.5.4";config;apiHandler;initConfig;eventEmitter=(()=>new G)();static html=(()=>R)();static RenderModes=(()=>ee)();static TemplateFormRenderModes=(()=>Y)();static Layouts=(()=>X)();static ViewStyles=(()=>J)();static MarketplaceRenderModes=(()=>Q)();static Helpers;authModalId="";forceRerender=!1;constructor(e){let t;const n=e.baseUrl||"https://app.integry.io",i=e;if(i.user){const{userId:e,apiKey:t,...n}=i.user;"userId"in i||(i.userId=""),"userId"in i&&(i.userId=e.toString()),i.xIntegryConfig||(i.xIntegryConfig={}),i.xIntegryConfig.appAuth||(i.xIntegryConfig.appAuth={}),i.xIntegryConfig.appAuth.extras||(i.xIntegryConfig.appAuth.extras={}),i.xIntegryConfig.appAuth.apiKey=(t||"").toString(),i.xIntegryConfig.appAuth.extras=n}const o={oauthVerifyPath:"auth/verify",endpointsUrl:"https://integry-app.appspot.com",baseUrl:n,baseUrlv2:`${n}/v2`,baseAPIUrl:"https://api.integry.io",apiKey:i.xIntegryConfig?.appAuth?.apiKey,authId:i.xIntegryConfig?.appAuth?.authId,extras:i.xIntegryConfig?.appAuth?.extras},s=i.options||i.userConfig||{};if(i.options&&i.payloads&&(i.options.objects=e.payloads),"appKey"in i)t={...i,...o,appKey:i.appKey,hash:i.hash,userId:i.userId},this.config={...i,...o,appKey:i.appKey,hash:i.hash,userId:i.userId,deploymentId:i.deploymentId,userConfig:i.deploymentId?{...s,tags:s?.tags?[...s?.tags,`${i.deploymentId}`]:[`${i.deploymentId}`]}:s};else{const e=this.getAuthParamsFromUrl()||{};t={...o,...e},this.config={...o,...e,userConfig:i.userConfig}}this.authModalId=this.getRandomFlowId(6),this.apiHandler=new j(t),this.verifyAuthConfig().then((e=>{e?.config_verified?this.eventEmitter.emit("ready",{isReady:!0}):console.error("IntegrySDK: Auth config verification failed, are your auth parameters correct?")})).catch((e=>console.error(e))),this.initConfig={containerId:"",renderMode:Y.INLINE}}SDKFailedHandler=(e,t)=>{const n=e.options||e.userConfig||{},i=document.getElementById(t);throw i&&T(R`
|
|
7002
7002
|
<${nl}
|
|
7003
7003
|
message="SDK failed to load"
|
|
7004
7004
|
debug=${n.debug}
|
package/dist/umd/index.umd.js
CHANGED
|
@@ -3377,7 +3377,7 @@
|
|
|
3377
3377
|
`;var i,o}))}
|
|
3378
3378
|
${l&&R` <a onClick=${()=>{u([...c,{}])}}>+ Add another ${t.title}</a> `}
|
|
3379
3379
|
</div>
|
|
3380
|
-
`};var Js={actionFormWrap:"styles-module_actionFormWrap__1--9G",noStepFields:"styles-module_noStepFields__1NQe1",unsupported:"styles-module_unsupported__2swxl",actionFormLoader:"styles-module_actionFormLoader__2AXe4"};ue('.styles-module_actionFormWrap__1--9G {\n width: 100%;\n}\n.styles-module_actionFormWrap__1--9G .styles-module_noStepFields__1NQe1 {\n font-family: "Inter";\n font-weight: 400;\n font-size: 14px;\n line-height: 24px;\n color: #999999;\n}\n\n.styles-module_unsupported__2swxl {\n font-size: 12px;\n color: #ca8c1b;\n}\n\n.styles-module_actionFormLoader__2AXe4 {\n width: 15px;\n margin: 0 auto;\n}');var Xs=B.connect(["stepState","stepMapping","stepDataMapping","parentChildMapping","fieldListMapping","conditionalFieldMapping","embedConfig","activityOutputData","genericData","userConfig","authMapping"],re)(class extends g{constructor(e){super(e),this.state={loading:!1,dynamicFieldDataState:{}}}componentDidMount(){const{step:e,verifyStepValidity:t}=this.props;t(e.id);const n=this.props.genericData.stepWithActivityOutput;if(n){const{id:e}=n,t=this.getVisibleFieldsDataOnRootStep(e);this.setRootStepData(t)}else this.setRootStepData({})}componentDidUpdate(e){const{step:t,verifyStepValidity:n}=this.props;if(e.step.id!==t.id){n(t.id);const e=this.props.genericData.stepWithActivityOutput;if(e){const{id:t}=e,n=this.getVisibleFieldsDataOnRootStep(t);this.setRootStepData(n)}else this.setRootStepData({})}}getVisibleFieldsDataOnRootStep=e=>{const t=this.props.stepDataMapping[e];return Object.keys(t).filter((e=>t[Number(e)].value)).reduce(((e,n)=>{const i=t[Number(n)];return{...e,[i.machineName]:i.value}}),{})};refreshRootStepData=async e=>{const t=this.props.genericData.stepWithActivityOutput;if(t){const{id:n}=t,i=this.getVisibleFieldsDataOnRootStep(n);this.setRootStepData(i,!0,e)}else this.setRootStepData({},!0,e)};setActivityOutputFromSourceStep=(e,t,n)=>{const{setDynamicData:i}=this,o=this.setState.bind(this),s=this.props.step.source_steps,{stepMapping:a}=this.props,{props:l}=this;Object.keys(s).forEach((s=>{const r=l.step.source_steps[s];let d=!1;return Object.keys(a).every((p=>{const c=a[p].step.id;if(c&&(a[c].step.machine_name===s||a[c].step.machine_name===r.form_step_machine_name)&&!l.genericData.isTestIntegration){if(d=!0,r.activity_output_url){e||o({loading:!0});const n={},a=Object.keys(l.stepDataMapping[c]);for(let e=0;e<a.length;e+=1){const t=a[e],i=l.stepDataMapping[c][t];i.value&&(n[i.machineName]=i.value)}l.apiHandler.callDynamicDataEndpoint(new URL(r.activity_output_url),{authorization_id:`${l.stepMapping[c].selectedAuthId}`,...n}).then((e=>{o({loading:!1});let n=!1;e?l.setActivityOutputData({activityOutputData:r.loop_variable_name?this.replaceContactPrefix(e,s,r):e}):n=!0,t&&t(n)})),r.sample_data_endpoint_url&&c&&i(r.sample_data_endpoint_url,c,{...n})}else r.activity_output&&(o({loading:!1}),t&&t(),this.setActivityOutputFromIntegryObjectOrRawActivityOutput(n,r,s));return!1}return!((l.genericData.isTestIntegration||!r.app_id&&!this.canOverrideIntegryObject(n))&&r.activity_output)||(o({loading:!1}),t&&t(),d=!0,this.setActivityOutputFromRawActivityOutput(r,s),!1)})),!d&&r.activity_output?(this.setActivityOutputFromIntegryObjectOrRawActivityOutput(n,r,s),o({loading:!1}),t&&t(),d=!0,!1):!d}))};replaceContactPrefix=(e,t,n)=>{const i=`steps.${t}.out.${n.loop_variable_name?`${n.loop_variable_name}`:""}`;return e.map((e=>({...e,value:e.value.replace("contact_v1",i)})))};setActivityOutputFromRawActivityOutput=(()=>{var e=this;return function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";try{let i={};i=t.activity_output;const o=Yo(i,"",`steps.${n}.out.${t.loop_variable_name?`${t.loop_variable_name}.`:""}`),s=Qo(i,"",`steps.${n}.out.${t.loop_variable_name?`${t.loop_variable_name}.`:""}`);e.props.setIncomingWebhookPayload({incomingWebhookPayload:i}),e.props.setActivityOutputData({activityOutputData:o||[]}),e.props.setDynamicFieldData({dynamicFieldData:s||{}}),e.setState({dynamicFieldDataState:s||{}})}catch(e){console.error(e)}}})();setDynamicData=(e,t,n)=>{this.props.apiHandler.callDynamicDataEndpoint(new URL(e),{authorization_id:`${this.props.stepMapping[t].selectedAuthId}`,...n}).then((e=>{e&&(this.props.setDynamicFieldData({dynamicFieldData:e}),this.setState({dynamicFieldDataState:e}))}))};canOverrideIntegryObject=e=>{if(e)try{const t=JSON.parse(e);if(this.props.userConfig?.objects?.[t.name])return!0}catch(e){return!1}return!1};setActivityOutputFromIntegryObjectOrRawActivityOutput=(()=>{var e=this;return function(t,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(t)try{const o=JSON.parse(t);let s={};s=e.props.userConfig?.objects?.[o.name]?e.props.userConfig?.objects?.[o.name]:JSON.parse(o.payload);const a=Yo(s,"",`steps.${i}.out.${n.loop_variable_name?`${n.loop_variable_name}.`:""}`),l=Qo(s,"",`steps.${i}.out.${n.loop_variable_name?`${n.loop_variable_name}.`:""}`);e.props.setIncomingWebhookPayload({incomingWebhookPayload:s}),e.props.setActivityOutputData({activityOutputData:a||[]}),e.props.setDynamicFieldData({dynamicFieldData:l||{}}),e.setState({dynamicFieldDataState:l||{}})}catch(e){console.error(e)}else e.setActivityOutputFromRawActivityOutput(n,i)}})();setRootStepData=async(e,t,n)=>{const i=this.props.genericData.stepWithActivityOutput;let o=i?.template_fields.find((e=>"integry_webhook_object"===e.activity_field?.machine_name))?.default_value;if(o){let e={};try{e=JSON.parse(o||"{}")}catch(t){e={}}e={payload:o||"{}",name:i?.template_fields.find((e=>"payload_name"===e.activity_field?.machine_name))?.default_value||"payload"},o=JSON.stringify(e)}if(this.props.setActivityOutputData({activityOutputData:[]}),this.props.step.source_steps&&Object.keys(this.props.step.source_steps).length>0)this.setActivityOutputFromSourceStep(t,n,o);else if(i){const{id:s}=i;i.activity.activity_output_url?(t||this.setState({loading:!0}),this.props.apiHandler.callDynamicDataEndpoint(new URL(i.activity.activity_output_url),{authorization_id:`${this.props.stepMapping[s].selectedAuthId}`,...e}).then((e=>{this.setState({loading:!1}),n&&n(),e&&this.props.setActivityOutputData({activityOutputData:e})}))):i.activity.activity_output?(this.setActivityOutputFromIntegryObjectOrRawActivityOutput(o,i.activity),this.setState({loading:!1}),n&&n()):(this.setState({loading:!1}),n&&n()),i.activity.dynamic_field_data_endpoint&&this.setDynamicData(i.activity.dynamic_field_data_endpoint,s,e)}};removeCurlyBraces=e=>e.replace(/^{(.*)}$/,"$1");isNotJSON=e=>{try{return!(Array.isArray(e)&&e.length>0&&"object"==typeof e[0])&&(JSON.parse(e),!!Number(e))}catch(e){return!0}};arrayToNestedJSONWithFirstValue=(e,t)=>{let n={},i=[];e&&Array.isArray(e)&&(i=e),Object.keys(t||{}).forEach((e=>{const i=this.removeCurlyBraces(e);n={...n,[i]:t[e]||""}}));let o={};(i||[]).forEach((e=>{o={...o,[e.text]:t[e.value]||""}}));const s={};return(i||[]).forEach((e=>{if(!e.text||!e.value)return;const t=e.text.split(".");let i=s;t.forEach(((o,s)=>{i[o]||(s===t.length-1?n[e.value]&&n[e.value][0]&&this.isNotJSON(n[e.value][0])?i[o]=n[e.value][0]||"":i[o]="":i[o]={}),i=i[o]}))})),s};getFieldValFromActivityOutputRaw=(e,t)=>{const n=t.match(/{([^}]+)}/g);let i=t;return(n||[]).forEach((t=>{const n=t.replace(/{|}/g,"");(e||[]).forEach((e=>{e.text===n&&(i=i.replace(t,`{${e.value}}`))}))})),i};getStepVisibleFieldsData=e=>{const t=this.props.stepDataMapping[e];return Object.keys(t).filter((e=>t[Number(e)].value)).reduce(((e,n)=>{const i=t[Number(n)];return{...e,[i.machineName]:i.value}}),{})};areParentValuesFilled=(e,t)=>{let n=!0;for(let i=0;i<t.length;i+=1){const o=t[i];let s=null;this.props.parentChildMapping[e][o]&&(s=this.props.parentChildMapping[e][o].fieldId);const a=s&&this.props.stepDataMapping[e]&&this.props.stepDataMapping[e][s];if(!a||!a.value){n=!1;break}}return n};doParentFieldsHaveValues=(e,t)=>{let n=!0;const i=this.props.parentChildMapping[e][t];if(i&&i.parentFields)for(let t=0;t<i.parentFields.length;t+=1){const o=this.props.parentChildMapping[e][i.parentFields[t]],s=o&&this.props.stepDataMapping[e]&&this.props.stepDataMapping[e][o.fieldId];if(!s||!s.value){n=!1;break}}return n};shouldShowStep=e=>{const t=this.props.step.id,n=this.props.stepMapping&&this.props.stepMapping[t];if("BUTTON"===e.type||"HTML"===e.type||"SECTION"===e.type)return!0;if(n&&e.activity_field){if(this.props.userConfig&&this.props.userConfig.viewAsIU)return!0;const n=!e.is_hidden,i=!0,{parentFields:o}=this.props.parentChildMapping[t][e.activity_field.machine_name],s=this.props.conditionalFieldMapping[t][e.activity_field.machine_name];let a=!0,l=!0;o&&(a=this.areParentValuesFilled(t,o)),s&&(l=ae(t,s,this.props.stepDataMapping));const r=a&&l;return n&&i&&r}return!1};stepIsOfType=e=>{const t=this.props.step.id,n=this.props.stepMapping&&this.props.stepMapping[t];return e.indexOf(n.step.activity.type)>-1};textFieldParentHasValues=e=>{const t=this.props.step.id,n=this.props.stepMapping&&this.props.stepMapping[t],i=n.step.template_fields.filter((e=>e.is_visible)),o=!(!this.props?.userConfig||!this.props?.userConfig.viewAsIU)||n.selectedAuthId;if(!i.filter((e=>e.activity_field&&"DYNAMIC"===e.activity_field.type))[0])return!0;let s=!1;return i.forEach((t=>{const{activity_field:n}=t,{activity_field:i}=e;n?.child_fields?.includes(i.machine_name)&&(s=!0)})),!s||!!(i.length>0&&e&&e.activity_field&&o&&this.doParentFieldsHaveValues(t,e.activity_field.machine_name))};shouldShowOldMapping=()=>{const e=this.props.step.id,t=this.props.stepMapping&&this.props.stepMapping[e];if(this.stepIsOfType(["ADAPTER","ACTION"])){const n=t.step.template_fields.filter((e=>e.is_visible)),i=t.step.template_fields.filter((e=>e.is_visible&&"TEXTFIELD"===e.activity_field?.type)),o=t.selectedAuthId,s=n.filter((e=>e.activity_field&&"DYNAMIC"===e.activity_field.type))[0];if(i.length>0&&o&&!s&&!this.shouldShowNewMapping())return!0;if(!s)return!1;if(n.length>0&&o&&s&&s.activity_field&&this.doParentFieldsHaveValues(e,s.activity_field.machine_name)){const t=this.props.conditionalFieldMapping[e][s.activity_field.machine_name];return!t||ae(e,t,this.props.stepDataMapping)}return!1}return!1};shouldShowNewMapping=()=>{const{step:e,stepMapping:t}=this.props,n=t[e.id];if(this.stepIsOfType(["ADAPTER","ACTION"])){const e=n.step.template_fields.filter((e=>e.is_visible));if(e){if(e.filter((e=>e.activity_field&&"FIELD_MAPPING"===e.activity_field.type))[0])return!0}}return!1};getMappingDataInput=()=>{const e=this.props.step.id;return{authId:(this.props.stepMapping&&this.props.stepMapping[e]).selectedAuthId,fieldsData:this.getStepVisibleFieldsData(e)}};onFieldChange=e=>{let{stepId:t,fieldId:n,value:i,isRequired:o}=e;this.props.setStepFieldData({stepId:`${t}`,fieldId:`${n}`,value:i,isRequired:o}),this.props.clearChildFields({stepId:t,fieldId:n}),this.props.verifyStepValidity(Number(t))};fieldDynamicData=e=>{const t=this.props.step.id;if(this.props.stepMapping&&this.props.stepMapping[t]&&e.activity_field){const n=this.props.parentChildMapping[t][e.activity_field.machine_name]?.parentFields||null;if(n){return n.reduce(((e,n)=>{const{fieldId:i}=this.props.parentChildMapping[t][n];return i?{...e,[n]:this.props.stepDataMapping[t][i].value}:e}),{})}}return null};sourceFlowData=e=>{if(e.source_flow_integration_invocation_url){const{stepMapping:e,stepDataMapping:t}=this.props;return{steps:{...Object.keys(e).reduce(((n,i)=>{const{machine_name:o,id:s}=e[i].step;return o?{...n,[o]:{in:Object.keys(t[s]).reduce(((e,n)=>{const i=parseInt(n,10);if(t[s][i]){const{value:n,machineName:o}=t[s][i];return{...e,[o]:n}}return e}),{})}}:n}),{})}}}return null};isHTML=e=>!!/<\/?[a-z][\s\S]*>/i.test(e);getPlaceholder=e=>{let t="Incoming Webhook"===this.props.genericData.stepWithActivityOutput?.activity?.app?.name?this.props.genericData.selfAppName:this.props.genericData.stepWithActivityOutput?.activity?.app?.name||"";if(!t||t.includes("Webhook")){const e=this.props.step.source_steps,{stepMapping:n}=this.props,{props:i}=this;let o=null;Object.keys(e).forEach((e=>{const s=i.step.source_steps[e];o=s.app_id,s.app_name?t=s.app_name:Object.keys(n).every((e=>(n[e].step.authorization_type.app.id===s.app_id&&(t=n[e].step.activity.app.name),!0)))})),t?.includes("Incoming Webhook")&&null===o&&(t="Webhook")}return"TEXTAREA"===e.activity_field?.type||"TEXTFIELD"===e.activity_field?.type||"DYNAMIC"===e.activity_field?.type?!e.is_editable||e.is_mappable||e.allow_tags_in_text?!e.is_editable&&e.is_mappable?`Map to a ${t} field...`:e.is_editable&&(e.is_mappable||e.allow_tags_in_text)?`Enter text or map to a ${t} field...`:"Please enter a value":"Enter text...":"CHECKBOX"===e.activity_field?.type||"SELECT"===e.activity_field?.type||"RADIO"===e.activity_field?.type?!e.is_editable||e.is_mappable||e.allow_tags_in_text?!e.is_editable&&e.is_mappable?`Select a value or map to a ${t} field...`:e.is_editable&&e.allow_tags_in_text?`Enter text with ${t} fields or select a value...`:e.is_editable&&e.is_mappable?`Enter text, select a value or map to a ${t} field...`:"Select a value...":"Enter text or select a value...":"TEXTAREA"===e.activity_field?.type||"TEXTFIELD"===e.activity_field?.type?"Enter text...":"CHECKBOX"===e.activity_field?.type||"SELECT"===e.activity_field?.type||"RADIO"===e.activity_field?.type?"Select a value...":""};replacePlaceholders=(e,t)=>{const n={};return Object.entries(e).forEach((e=>{let[i,o]=e;if("string"==typeof o&&o.includes("{")){const e=o.match(/{(.*?)}/);if(e&&e[1]){const s=e[1],a=s.split(".").pop();void 0!==t[s]?n[i]=o.replace(e[0],t[s]):a&&void 0!==t[a]&&(n[i]=o.replace(e[0],t[a]))}}else"string"==typeof o&&o&&(n[i]=o)})),n};render(){const{step:e,stepMapping:t,stepDataMapping:n,setStepFieldData:i,showStepValidation:o,isReadOnly:s,accountConnected:a}=this.props,l=t[e.id]&&t[e.id].step,r=n&&n[e.id],d={}||this.props.activityOutputData||{},p=0===l.template_fields.length||!(this.props.userConfig&&this.props.userConfig.viewAsIU)&&0===l.template_fields.filter((e=>e.is_visible)).length;return R`
|
|
3380
|
+
`};var Js={actionFormWrap:"styles-module_actionFormWrap__1--9G",noStepFields:"styles-module_noStepFields__1NQe1",unsupported:"styles-module_unsupported__2swxl",actionFormLoader:"styles-module_actionFormLoader__2AXe4"};ue('.styles-module_actionFormWrap__1--9G {\n width: 100%;\n}\n.styles-module_actionFormWrap__1--9G .styles-module_noStepFields__1NQe1 {\n font-family: "Inter";\n font-weight: 400;\n font-size: 14px;\n line-height: 24px;\n color: #999999;\n}\n\n.styles-module_unsupported__2swxl {\n font-size: 12px;\n color: #ca8c1b;\n}\n\n.styles-module_actionFormLoader__2AXe4 {\n width: 15px;\n margin: 0 auto;\n}');var Xs=B.connect(["stepState","stepMapping","stepDataMapping","parentChildMapping","fieldListMapping","conditionalFieldMapping","embedConfig","activityOutputData","genericData","userConfig","authMapping"],re)(class extends g{constructor(e){super(e),this.state={loading:!1,dynamicFieldDataState:{}}}componentDidMount(){const{step:e,verifyStepValidity:t}=this.props;t(e.id);const n=this.props.genericData.stepWithActivityOutput;if(n){const{id:e}=n,t=this.getVisibleFieldsDataOnRootStep(e);this.setRootStepData(t)}else this.setRootStepData({})}componentDidUpdate(e){const{step:t,verifyStepValidity:n}=this.props;if(e.step.id!==t.id){n(t.id);const e=this.props.genericData.stepWithActivityOutput;if(e){const{id:t}=e,n=this.getVisibleFieldsDataOnRootStep(t);this.setRootStepData(n)}else this.setRootStepData({})}}getVisibleFieldsDataOnRootStep=e=>{const t=this.props.stepDataMapping[e];return Object.keys(t).filter((e=>t[Number(e)].value)).reduce(((e,n)=>{const i=t[Number(n)];return{...e,[i.machineName]:i.value}}),{})};refreshRootStepData=async e=>{const t=this.props.genericData.stepWithActivityOutput;if(t){const{id:n}=t,i=this.getVisibleFieldsDataOnRootStep(n);this.setRootStepData(i,!0,e)}else this.setRootStepData({},!0,e)};setActivityOutputFromSourceStep=(e,t,n)=>{const{setDynamicData:i}=this,o=this.setState.bind(this),s=this.props.step.source_steps,{stepMapping:a}=this.props,{props:l}=this;Object.keys(s).forEach((s=>{const r=l.step.source_steps[s];let d=!1;return Object.keys(a).every((p=>{const c=a[p].step.id;if(c&&(a[c].step.machine_name===s||a[c].step.machine_name===r.form_step_machine_name)&&!l.genericData.isTestIntegration){if(d=!0,r.activity_output_url){e||o({loading:!0});const n={},a=Object.keys(l.stepDataMapping[c]);for(let e=0;e<a.length;e+=1){const t=a[e],i=l.stepDataMapping[c][t];i.value&&(n[i.machineName]=i.value)}const d=r.activity_output_url.includes("functions/"),p=d?"POST":"GET";l.apiHandler.callDynamicDataEndpoint(new URL(r.activity_output_url),{authorization_id:`${l.stepMapping[c].selectedAuthId}`,...n},p).then((e=>{o({loading:!1});let n=!1;if(e){const t=e;d&&"output"in t?this.setActivityOutputFromIntegryObjectOrRawActivityOutput(t.output,r,s,!0):l.setActivityOutputData({activityOutputData:r.loop_variable_name?this.replaceContactPrefix(e,s,r):e})}else n=!0;t&&t(n)})),r.sample_data_endpoint_url&&c&&i(r.sample_data_endpoint_url,c,{...n})}else r.activity_output&&(o({loading:!1}),t&&t(),this.setActivityOutputFromIntegryObjectOrRawActivityOutput(n,r,s));return!1}return!((l.genericData.isTestIntegration||!r.app_id&&!this.canOverrideIntegryObject(n))&&r.activity_output)||(o({loading:!1}),t&&t(),d=!0,this.setActivityOutputFromRawActivityOutput(r,s),!1)})),!d&&r.activity_output?(this.setActivityOutputFromIntegryObjectOrRawActivityOutput(n,r,s),o({loading:!1}),t&&t(),d=!0,!1):!d}))};replaceContactPrefix=(e,t,n)=>{const i=`steps.${t}.out.${n.loop_variable_name?`${n.loop_variable_name}`:""}`;return e.map((e=>({...e,value:e.value.replace("contact_v1",i)})))};setActivityOutputFromRawActivityOutput=(()=>{var e=this;return function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";try{let i={};i=t.activity_output;const o=Yo(i,"",`steps.${n}.out.${t.loop_variable_name?`${t.loop_variable_name}.`:""}`),s=Qo(i,"",`steps.${n}.out.${t.loop_variable_name?`${t.loop_variable_name}.`:""}`);e.props.setIncomingWebhookPayload({incomingWebhookPayload:i}),e.props.setActivityOutputData({activityOutputData:o||[]}),e.props.setDynamicFieldData({dynamicFieldData:s||{}}),e.setState({dynamicFieldDataState:s||{}})}catch(e){console.error(e)}}})();setDynamicData=(e,t,n)=>{this.props.apiHandler.callDynamicDataEndpoint(new URL(e),{authorization_id:`${this.props.stepMapping[t].selectedAuthId}`,...n}).then((e=>{e&&(this.props.setDynamicFieldData({dynamicFieldData:e}),this.setState({dynamicFieldDataState:e}))}))};canOverrideIntegryObject=e=>{if(e)try{const t=JSON.parse(e);if(this.props.userConfig?.objects?.[t.name])return!0}catch(e){return!1}return!1};setActivityOutputFromIntegryObjectOrRawActivityOutput=(()=>{var e=this;return function(t,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t)try{let s={};if(o)s=t;else{const n=JSON.parse(t);s=e.props.userConfig?.objects?.[n.name]?e.props.userConfig?.objects?.[n.name]:JSON.parse(n.payload)}const a=Yo(s,"",`steps.${i}.out.${n.loop_variable_name?`${n.loop_variable_name}.`:""}`),l=Qo(s,"",`steps.${i}.out.${n.loop_variable_name?`${n.loop_variable_name}.`:""}`);e.props.setIncomingWebhookPayload({incomingWebhookPayload:s}),e.props.setActivityOutputData({activityOutputData:a||[]}),e.props.setDynamicFieldData({dynamicFieldData:l||{}}),e.setState({dynamicFieldDataState:l||{}})}catch(e){console.error(e)}else e.setActivityOutputFromRawActivityOutput(n,i)}})();setRootStepData=async(e,t,n)=>{const i=this.props.genericData.stepWithActivityOutput;let o=i?.template_fields.find((e=>"integry_webhook_object"===e.activity_field?.machine_name))?.default_value;if(o){let e={};try{e=JSON.parse(o||"{}")}catch(t){e={}}e={payload:o||"{}",name:i?.template_fields.find((e=>"payload_name"===e.activity_field?.machine_name))?.default_value||"payload"},o=JSON.stringify(e)}if(this.props.setActivityOutputData({activityOutputData:[]}),this.props.step.source_steps&&Object.keys(this.props.step.source_steps).length>0)this.setActivityOutputFromSourceStep(t,n,o);else if(i){const{id:s}=i;i.activity.activity_output_url?(t||this.setState({loading:!0}),this.props.apiHandler.callDynamicDataEndpoint(new URL(i.activity.activity_output_url),{authorization_id:`${this.props.stepMapping[s].selectedAuthId}`,...e}).then((e=>{this.setState({loading:!1}),n&&n(),e&&this.props.setActivityOutputData({activityOutputData:e})}))):i.activity.activity_output?(this.setActivityOutputFromIntegryObjectOrRawActivityOutput(o,i.activity),this.setState({loading:!1}),n&&n()):(this.setState({loading:!1}),n&&n()),i.activity.dynamic_field_data_endpoint&&this.setDynamicData(i.activity.dynamic_field_data_endpoint,s,e)}};removeCurlyBraces=e=>e.replace(/^{(.*)}$/,"$1");isNotJSON=e=>{try{return!(Array.isArray(e)&&e.length>0&&"object"==typeof e[0])&&(JSON.parse(e),!!Number(e))}catch(e){return!0}};arrayToNestedJSONWithFirstValue=(e,t)=>{let n={},i=[];e&&Array.isArray(e)&&(i=e),Object.keys(t||{}).forEach((e=>{const i=this.removeCurlyBraces(e);n={...n,[i]:t[e]||""}}));let o={};(i||[]).forEach((e=>{o={...o,[e.text]:t[e.value]||""}}));const s={};return(i||[]).forEach((e=>{if(!e.text||!e.value)return;const t=e.text.split(".");let i=s;t.forEach(((o,s)=>{i[o]||(s===t.length-1?n[e.value]&&n[e.value][0]&&this.isNotJSON(n[e.value][0])?i[o]=n[e.value][0]||"":i[o]="":i[o]={}),i=i[o]}))})),s};getFieldValFromActivityOutputRaw=(e,t)=>{const n=t.match(/{([^}]+)}/g);let i=t;return(n||[]).forEach((t=>{const n=t.replace(/{|}/g,"");(e||[]).forEach((e=>{e.text===n&&(i=i.replace(t,`{${e.value}}`))}))})),i};getStepVisibleFieldsData=e=>{const t=this.props.stepDataMapping[e];return Object.keys(t).filter((e=>t[Number(e)].value)).reduce(((e,n)=>{const i=t[Number(n)];return{...e,[i.machineName]:i.value}}),{})};areParentValuesFilled=(e,t)=>{let n=!0;for(let i=0;i<t.length;i+=1){const o=t[i];let s=null;this.props.parentChildMapping[e][o]&&(s=this.props.parentChildMapping[e][o].fieldId);const a=s&&this.props.stepDataMapping[e]&&this.props.stepDataMapping[e][s];if(!a||!a.value){n=!1;break}}return n};doParentFieldsHaveValues=(e,t)=>{let n=!0;const i=this.props.parentChildMapping[e][t];if(i&&i.parentFields)for(let t=0;t<i.parentFields.length;t+=1){const o=this.props.parentChildMapping[e][i.parentFields[t]],s=o&&this.props.stepDataMapping[e]&&this.props.stepDataMapping[e][o.fieldId];if(!s||!s.value){n=!1;break}}return n};shouldShowStep=e=>{const t=this.props.step.id,n=this.props.stepMapping&&this.props.stepMapping[t];if("BUTTON"===e.type||"HTML"===e.type||"SECTION"===e.type)return!0;if(n&&e.activity_field){if(this.props.userConfig&&this.props.userConfig.viewAsIU)return!0;const n=!e.is_hidden,i=!0,{parentFields:o}=this.props.parentChildMapping[t][e.activity_field.machine_name],s=this.props.conditionalFieldMapping[t][e.activity_field.machine_name];let a=!0,l=!0;o&&(a=this.areParentValuesFilled(t,o)),s&&(l=ae(t,s,this.props.stepDataMapping));const r=a&&l;return n&&i&&r}return!1};stepIsOfType=e=>{const t=this.props.step.id,n=this.props.stepMapping&&this.props.stepMapping[t];return e.indexOf(n.step.activity.type)>-1};textFieldParentHasValues=e=>{const t=this.props.step.id,n=this.props.stepMapping&&this.props.stepMapping[t],i=n.step.template_fields.filter((e=>e.is_visible)),o=!(!this.props?.userConfig||!this.props?.userConfig.viewAsIU)||n.selectedAuthId;if(!i.filter((e=>e.activity_field&&"DYNAMIC"===e.activity_field.type))[0])return!0;let s=!1;return i.forEach((t=>{const{activity_field:n}=t,{activity_field:i}=e;n?.child_fields?.includes(i.machine_name)&&(s=!0)})),!s||!!(i.length>0&&e&&e.activity_field&&o&&this.doParentFieldsHaveValues(t,e.activity_field.machine_name))};shouldShowOldMapping=()=>{const e=this.props.step.id,t=this.props.stepMapping&&this.props.stepMapping[e];if(this.stepIsOfType(["ADAPTER","ACTION"])){const n=t.step.template_fields.filter((e=>e.is_visible)),i=t.step.template_fields.filter((e=>e.is_visible&&"TEXTFIELD"===e.activity_field?.type)),o=t.selectedAuthId,s=n.filter((e=>e.activity_field&&"DYNAMIC"===e.activity_field.type))[0];if(i.length>0&&o&&!s&&!this.shouldShowNewMapping())return!0;if(!s)return!1;if(n.length>0&&o&&s&&s.activity_field&&this.doParentFieldsHaveValues(e,s.activity_field.machine_name)){const t=this.props.conditionalFieldMapping[e][s.activity_field.machine_name];return!t||ae(e,t,this.props.stepDataMapping)}return!1}return!1};shouldShowNewMapping=()=>{const{step:e,stepMapping:t}=this.props,n=t[e.id];if(this.stepIsOfType(["ADAPTER","ACTION"])){const e=n.step.template_fields.filter((e=>e.is_visible));if(e){if(e.filter((e=>e.activity_field&&"FIELD_MAPPING"===e.activity_field.type))[0])return!0}}return!1};getMappingDataInput=()=>{const e=this.props.step.id;return{authId:(this.props.stepMapping&&this.props.stepMapping[e]).selectedAuthId,fieldsData:this.getStepVisibleFieldsData(e)}};onFieldChange=e=>{let{stepId:t,fieldId:n,value:i,isRequired:o}=e;this.props.setStepFieldData({stepId:`${t}`,fieldId:`${n}`,value:i,isRequired:o}),this.props.clearChildFields({stepId:t,fieldId:n}),this.props.verifyStepValidity(Number(t))};fieldDynamicData=e=>{const t=this.props.step.id;if(this.props.stepMapping&&this.props.stepMapping[t]&&e.activity_field){const n=this.props.parentChildMapping[t][e.activity_field.machine_name]?.parentFields||null;if(n){return n.reduce(((e,n)=>{const{fieldId:i}=this.props.parentChildMapping[t][n];return i?{...e,[n]:this.props.stepDataMapping[t][i].value}:e}),{})}}return null};sourceFlowData=e=>{if(e.source_flow_integration_invocation_url){const{stepMapping:e,stepDataMapping:t}=this.props;return{steps:{...Object.keys(e).reduce(((n,i)=>{const{machine_name:o,id:s}=e[i].step;return o?{...n,[o]:{in:Object.keys(t[s]).reduce(((e,n)=>{const i=parseInt(n,10);if(t[s][i]){const{value:n,machineName:o}=t[s][i];return{...e,[o]:n}}return e}),{})}}:n}),{})}}}return null};isHTML=e=>!!/<\/?[a-z][\s\S]*>/i.test(e);getPlaceholder=e=>{let t="Incoming Webhook"===this.props.genericData.stepWithActivityOutput?.activity?.app?.name?this.props.genericData.selfAppName:this.props.genericData.stepWithActivityOutput?.activity?.app?.name||"";if(!t||t.includes("Webhook")){const e=this.props.step.source_steps,{stepMapping:n}=this.props,{props:i}=this;let o=null;Object.keys(e).forEach((e=>{const s=i.step.source_steps[e];o=s.app_id,s.app_name?t=s.app_name:Object.keys(n).every((e=>(n[e].step.authorization_type.app.id===s.app_id&&(t=n[e].step.activity.app.name),!0)))})),t?.includes("Incoming Webhook")&&null===o&&(t="Webhook")}return"TEXTAREA"===e.activity_field?.type||"TEXTFIELD"===e.activity_field?.type||"DYNAMIC"===e.activity_field?.type?!e.is_editable||e.is_mappable||e.allow_tags_in_text?!e.is_editable&&e.is_mappable?`Map to a ${t} field...`:e.is_editable&&(e.is_mappable||e.allow_tags_in_text)?`Enter text or map to a ${t} field...`:"Please enter a value":"Enter text...":"CHECKBOX"===e.activity_field?.type||"SELECT"===e.activity_field?.type||"RADIO"===e.activity_field?.type?!e.is_editable||e.is_mappable||e.allow_tags_in_text?!e.is_editable&&e.is_mappable?`Select a value or map to a ${t} field...`:e.is_editable&&e.allow_tags_in_text?`Enter text with ${t} fields or select a value...`:e.is_editable&&e.is_mappable?`Enter text, select a value or map to a ${t} field...`:"Select a value...":"Enter text or select a value...":"TEXTAREA"===e.activity_field?.type||"TEXTFIELD"===e.activity_field?.type?"Enter text...":"CHECKBOX"===e.activity_field?.type||"SELECT"===e.activity_field?.type||"RADIO"===e.activity_field?.type?"Select a value...":""};replacePlaceholders=(e,t)=>{const n={};return Object.entries(e).forEach((e=>{let[i,o]=e;if("string"==typeof o&&o.includes("{")){const e=o.match(/{(.*?)}/);if(e&&e[1]){const s=e[1],a=s.split(".").pop();void 0!==t[s]?n[i]=o.replace(e[0],t[s]):a&&void 0!==t[a]&&(n[i]=o.replace(e[0],t[a]))}}else"string"==typeof o&&o&&(n[i]=o)})),n};render(){const{step:e,stepMapping:t,stepDataMapping:n,setStepFieldData:i,showStepValidation:o,isReadOnly:s,accountConnected:a}=this.props,l=t[e.id]&&t[e.id].step,r=n&&n[e.id],d={}||this.props.activityOutputData||{},p=0===l.template_fields.length||!(this.props.userConfig&&this.props.userConfig.viewAsIU)&&0===l.template_fields.filter((e=>e.is_visible)).length;return R`
|
|
3381
3381
|
${this.state.loading?R`<div class=${Js.actionFormLoader}><${Ye} /></div>`:R`
|
|
3382
3382
|
${l?R`
|
|
3383
3383
|
<div class=${Js.actionFormWrap}>
|
|
@@ -6998,7 +6998,7 @@
|
|
|
6998
6998
|
</div>
|
|
6999
6999
|
</div>
|
|
7000
7000
|
`}
|
|
7001
|
-
`}});class Rd{static SDK_VERSION="4.5.
|
|
7001
|
+
`}});class Rd{static SDK_VERSION="4.5.4";config;apiHandler;initConfig;eventEmitter=(()=>new G)();static html=(()=>R)();static RenderModes=(()=>ee)();static TemplateFormRenderModes=(()=>Y)();static Layouts=(()=>X)();static ViewStyles=(()=>J)();static MarketplaceRenderModes=(()=>Q)();static Helpers;authModalId="";forceRerender=!1;constructor(e){let t;const n=e.baseUrl||"https://app.integry.io",i=e;if(i.user){const{userId:e,apiKey:t,...n}=i.user;"userId"in i||(i.userId=""),"userId"in i&&(i.userId=e.toString()),i.xIntegryConfig||(i.xIntegryConfig={}),i.xIntegryConfig.appAuth||(i.xIntegryConfig.appAuth={}),i.xIntegryConfig.appAuth.extras||(i.xIntegryConfig.appAuth.extras={}),i.xIntegryConfig.appAuth.apiKey=(t||"").toString(),i.xIntegryConfig.appAuth.extras=n}const o={oauthVerifyPath:"auth/verify",endpointsUrl:"https://integry-app.appspot.com",baseUrl:n,baseUrlv2:`${n}/v2`,baseAPIUrl:"https://api.integry.io",apiKey:i.xIntegryConfig?.appAuth?.apiKey,authId:i.xIntegryConfig?.appAuth?.authId,extras:i.xIntegryConfig?.appAuth?.extras},s=i.options||i.userConfig||{};if(i.options&&i.payloads&&(i.options.objects=e.payloads),"appKey"in i)t={...i,...o,appKey:i.appKey,hash:i.hash,userId:i.userId},this.config={...i,...o,appKey:i.appKey,hash:i.hash,userId:i.userId,deploymentId:i.deploymentId,userConfig:i.deploymentId?{...s,tags:s?.tags?[...s?.tags,`${i.deploymentId}`]:[`${i.deploymentId}`]}:s};else{const e=this.getAuthParamsFromUrl()||{};t={...o,...e},this.config={...o,...e,userConfig:i.userConfig}}this.authModalId=this.getRandomFlowId(6),this.apiHandler=new j(t),this.verifyAuthConfig().then((e=>{e?.config_verified?this.eventEmitter.emit("ready",{isReady:!0}):console.error("IntegrySDK: Auth config verification failed, are your auth parameters correct?")})).catch((e=>console.error(e))),this.initConfig={containerId:"",renderMode:Y.INLINE}}SDKFailedHandler=(e,t)=>{const n=e.options||e.userConfig||{},i=document.getElementById(t);throw i&&T(R`
|
|
7002
7002
|
<${nl}
|
|
7003
7003
|
message="SDK failed to load"
|
|
7004
7004
|
debug=${n.debug}
|
package/package.json
CHANGED
|
@@ -173,16 +173,27 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
const isFunctionSource = stepTagsSource.activity_output_url.includes(
|
|
177
|
+
'functions/',
|
|
178
|
+
);
|
|
179
|
+
const callDynamicDataEndpointMethod = isFunctionSource
|
|
180
|
+
? 'POST'
|
|
181
|
+
: 'GET';
|
|
182
|
+
|
|
176
183
|
props.apiHandler
|
|
177
184
|
.callDynamicDataEndpoint<
|
|
178
185
|
{
|
|
179
186
|
text: string;
|
|
180
187
|
value: string;
|
|
181
188
|
}[]
|
|
182
|
-
>(
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
189
|
+
>(
|
|
190
|
+
new URL(stepTagsSource.activity_output_url),
|
|
191
|
+
{
|
|
192
|
+
authorization_id: `${props.stepMapping[stepIdOfSourceStep].selectedAuthId}`,
|
|
193
|
+
...sourceStepData,
|
|
194
|
+
},
|
|
195
|
+
callDynamicDataEndpointMethod,
|
|
196
|
+
)
|
|
186
197
|
.then((res) => {
|
|
187
198
|
setState({
|
|
188
199
|
loading: false,
|
|
@@ -190,15 +201,26 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
|
|
|
190
201
|
|
|
191
202
|
let error = false;
|
|
192
203
|
if (res) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
204
|
+
const functionResponse: any = res;
|
|
205
|
+
|
|
206
|
+
if (isFunctionSource && 'output' in functionResponse) {
|
|
207
|
+
this.setActivityOutputFromIntegryObjectOrRawActivityOutput(
|
|
208
|
+
functionResponse.output,
|
|
209
|
+
stepTagsSource,
|
|
210
|
+
sourceStepKey,
|
|
211
|
+
true,
|
|
212
|
+
);
|
|
213
|
+
} else {
|
|
214
|
+
props.setActivityOutputData({
|
|
215
|
+
activityOutputData: stepTagsSource.loop_variable_name
|
|
216
|
+
? this.replaceContactPrefix(
|
|
217
|
+
res,
|
|
218
|
+
sourceStepKey,
|
|
219
|
+
stepTagsSource,
|
|
220
|
+
)
|
|
221
|
+
: res,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
202
224
|
} else {
|
|
203
225
|
error = true;
|
|
204
226
|
}
|
|
@@ -377,20 +399,26 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
|
|
|
377
399
|
integryObject: any,
|
|
378
400
|
stepTagsSource: any,
|
|
379
401
|
sourceStepKey = '',
|
|
402
|
+
isFunctionSource = false,
|
|
380
403
|
) => {
|
|
381
404
|
if (integryObject) {
|
|
382
405
|
try {
|
|
383
|
-
const parsedIntegryObject = JSON.parse(
|
|
384
|
-
integryObject,
|
|
385
|
-
) as IncomingWebhookObject;
|
|
386
406
|
let objectPaylaod = {};
|
|
387
|
-
if (
|
|
388
|
-
objectPaylaod =
|
|
389
|
-
parsedIntegryObject.name
|
|
390
|
-
];
|
|
407
|
+
if (isFunctionSource) {
|
|
408
|
+
objectPaylaod = integryObject;
|
|
391
409
|
} else {
|
|
392
|
-
|
|
410
|
+
const parsedIntegryObject = JSON.parse(
|
|
411
|
+
integryObject,
|
|
412
|
+
) as IncomingWebhookObject;
|
|
413
|
+
if (this.props.userConfig?.objects?.[parsedIntegryObject.name]) {
|
|
414
|
+
objectPaylaod = this.props.userConfig?.objects?.[
|
|
415
|
+
parsedIntegryObject.name
|
|
416
|
+
];
|
|
417
|
+
} else {
|
|
418
|
+
objectPaylaod = JSON.parse(parsedIntegryObject.payload);
|
|
419
|
+
}
|
|
393
420
|
}
|
|
421
|
+
|
|
394
422
|
const activityOutputData = JSONToActivityOutputData(
|
|
395
423
|
objectPaylaod,
|
|
396
424
|
'',
|