@integry/sdk 4.6.2 → 4.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integry/sdk",
3
- "version": "4.6.2",
3
+ "version": "4.6.4",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -186,6 +186,34 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
186
186
  return requiredFieldsWithValues;
187
187
  };
188
188
 
189
+ makeTagSourceFunctionBody = (
190
+ obj: any,
191
+ sourceData: any,
192
+ sourceStepName: string,
193
+ ): any => {
194
+ if (typeof obj === 'string') {
195
+ return obj.replace(
196
+ new RegExp(`{[^}]*\\.${sourceStepName}\\.([a-zA-Z0-9_]+)}`, 'g'),
197
+ (_, key) => sourceData[key] ?? `{${sourceStepName}.${key}}`, // Preserve if not found
198
+ );
199
+ }
200
+ if (Array.isArray(obj)) {
201
+ return obj.map((item) =>
202
+ this.makeTagSourceFunctionBody(item, sourceData, sourceStepName),
203
+ );
204
+ }
205
+ if (typeof obj === 'object' && obj !== null) {
206
+ return Object.fromEntries(
207
+ Object.entries(obj).map(([key, value]) => [
208
+ key,
209
+ this.makeTagSourceFunctionBody(value, sourceData, sourceStepName),
210
+ ]),
211
+ );
212
+ }
213
+
214
+ return obj; // Default return for non-string, non-object, non-array types
215
+ };
216
+
189
217
  refreshRootStepData = async (callback?: any) => {
190
218
  const triggerStep = this.props.genericData.stepWithActivityOutput;
191
219
  if (triggerStep) {
@@ -219,7 +247,11 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
219
247
  (stepMapping[stepIdOfSourceStep].step.machine_name ===
220
248
  sourceStepKey ||
221
249
  stepMapping[stepIdOfSourceStep].step.machine_name ===
222
- stepTagsSource.form_step_machine_name) &&
250
+ stepTagsSource.form_step_machine_name ||
251
+ (stepTagsSource.tag_source_function_invocation_details &&
252
+ stepTagsSource.app_id ===
253
+ stepMapping[stepIdOfSourceStep].step?.authorization_type?.app
254
+ ?.id)) &&
223
255
  !props.genericData.isTestIntegration
224
256
  ) {
225
257
  hasSetData = true;
@@ -247,8 +279,20 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
247
279
  const isFunctionSource = stepTagsSource.activity_output_url.includes(
248
280
  'functions/',
249
281
  );
282
+ const tagSourceFunctionInvocationDetails =
283
+ stepTagsSource.tag_source_function_invocation_details;
284
+ const tagSourceFunctionBody =
285
+ isFunctionSource && tagSourceFunctionInvocationDetails
286
+ ? this.makeTagSourceFunctionBody(
287
+ tagSourceFunctionInvocationDetails.body,
288
+ sourceStepData,
289
+ stepMapping[stepIdOfSourceStep].step.machine_name || '',
290
+ )
291
+ : {};
250
292
  const callDynamicDataEndpointMethod = isFunctionSource
251
- ? 'POST'
293
+ ? tagSourceFunctionInvocationDetails
294
+ ? tagSourceFunctionInvocationDetails.method
295
+ : 'POST'
252
296
  : 'GET';
253
297
 
254
298
  props.apiHandler
@@ -261,7 +305,9 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
261
305
  new URL(stepTagsSource.activity_output_url),
262
306
  {
263
307
  authorization_id: `${props.stepMapping[stepIdOfSourceStep].selectedAuthId}`,
308
+ connected_account_id: `${props.stepMapping[stepIdOfSourceStep].selectedAuthId}`,
264
309
  ...sourceStepData,
310
+ ...tagSourceFunctionBody,
265
311
  },
266
312
  callDynamicDataEndpointMethod,
267
313
  )