@integry/sdk 4.6.2 → 4.6.3

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.3",
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) {
@@ -247,8 +275,20 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
247
275
  const isFunctionSource = stepTagsSource.activity_output_url.includes(
248
276
  'functions/',
249
277
  );
278
+ const tagSourceFunctionInvocationDetails =
279
+ stepTagsSource.tag_source_function_invocation_details;
280
+ const tagSourceFunctionBody =
281
+ isFunctionSource && tagSourceFunctionInvocationDetails
282
+ ? this.makeTagSourceFunctionBody(
283
+ tagSourceFunctionInvocationDetails.body,
284
+ sourceStepData,
285
+ stepTagsSource.form_step_machine_name,
286
+ )
287
+ : {};
250
288
  const callDynamicDataEndpointMethod = isFunctionSource
251
- ? 'POST'
289
+ ? tagSourceFunctionInvocationDetails
290
+ ? tagSourceFunctionInvocationDetails.method
291
+ : 'POST'
252
292
  : 'GET';
253
293
 
254
294
  props.apiHandler
@@ -262,6 +302,7 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
262
302
  {
263
303
  authorization_id: `${props.stepMapping[stepIdOfSourceStep].selectedAuthId}`,
264
304
  ...sourceStepData,
305
+ ...tagSourceFunctionBody,
265
306
  },
266
307
  callDynamicDataEndpointMethod,
267
308
  )