impaktapps-ui-builder 0.0.409 → 0.0.411

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.
Files changed (31) hide show
  1. package/dist/impaktapps-ui-builder.es.js +467 -258
  2. package/dist/impaktapps-ui-builder.es.js.map +1 -1
  3. package/dist/impaktapps-ui-builder.umd.js +13 -13
  4. package/dist/impaktapps-ui-builder.umd.js.map +1 -1
  5. package/dist/src/impaktapps-ui-builder/builder/build/buildBasicUiSchema.d.ts +4 -2
  6. package/dist/src/impaktapps-ui-builder/builder/build/buildTreeMap.d.ts +1 -0
  7. package/dist/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.d.ts +19 -0
  8. package/dist/src/impaktapps-ui-builder/builder/build/uischema/wrapperSection.d.ts +1 -1
  9. package/dist/src/impaktapps-ui-builder/builder/services/pageMaster.d.ts +2 -2
  10. package/dist/src/impaktapps-ui-builder/runtime/services/events.d.ts +7 -5
  11. package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +7 -8
  12. package/package.json +1 -1
  13. package/src/impaktapps-ui-builder/builder/build/buildBasicUiSchema.ts +9 -6
  14. package/src/impaktapps-ui-builder/builder/build/buildConfig.ts +0 -7
  15. package/src/impaktapps-ui-builder/builder/build/buildTreeMap.ts +58 -0
  16. package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +45 -49
  17. package/src/impaktapps-ui-builder/builder/build/buildWrapperSection.ts +16 -13
  18. package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +20 -8
  19. package/src/impaktapps-ui-builder/builder/build/uischema/card.ts +1 -1
  20. package/src/impaktapps-ui-builder/builder/build/uischema/coreSection.ts +19 -0
  21. package/src/impaktapps-ui-builder/builder/build/uischema/graph.ts +0 -1
  22. package/src/impaktapps-ui-builder/builder/build/uischema/wrapperSection.ts +1 -1
  23. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +24 -18
  24. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +19 -1
  25. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +2 -2
  26. package/src/impaktapps-ui-builder/builder/services/component.ts +55 -53
  27. package/src/impaktapps-ui-builder/builder/services/event.ts +5 -2
  28. package/src/impaktapps-ui-builder/builder/services/pageMaster.ts +5 -5
  29. package/src/impaktapps-ui-builder/runtime/services/downloadFile.ts +1 -1
  30. package/src/impaktapps-ui-builder/runtime/services/events.ts +129 -90
  31. package/src/impaktapps-ui-builder/runtime/services/service.ts +73 -45
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash";
2
- import { ComponentSchema } from "../elements/UiSchema/Component/schema";
2
+ import { ComponentSchema } from "../elements/UiSchema/Component/schema";
3
3
  import { componentBasicUiSchema } from "../elements/UiSchema/Component/uiSchema";
4
4
  import { CoreSection } from "../build/uischema/coreSection";
5
5
  import { EventSection } from "../build/uischema/eventSection";
@@ -10,56 +10,58 @@ import { ValueTab } from "../build/uischema/valueTab";
10
10
  import { ValidationSection } from "../build/uischema/validationSections";
11
11
  import { getFormdataFromLocalStorage, okHandler, saveFormdataInLocalStorage, saveHandler } from "./utils";
12
12
  const sectionLabels = {
13
- Select: ["Core", "Properties","Value", "style", "Event","Validation"],
14
- MultipleSelect: ["Core", "Properties","Value", "style", "Event","Validation"],
15
- Table: ["Core", "Components", "Properties","style", "Event","Validation"],
16
- LeaderBoard: ["Core", "Components", "Properties", "style", "Event","Validation"],
17
- WrapperSection: ["Core", "Components","Properties", "style","Validation"],
18
- TabSection: ["Core", "Components", "Properties", "style","Validation"],
19
- SpeedoMeter:["Core", "Properties", "style", "Event","Validation"],
20
- card:["Core", "Properties", "style", "Event","Validation"],
21
- UploadFile:["Core", "style", "Event","Validation"],
22
- Graph:["Core", "Properties", "style", "Event","Validation"],
23
- DownloadFile:["Core", "style", "Event","Validation"],
24
- Box: ["Core", "style", "Event","Validation"],
25
- Properties: ["Core", "Properties", "style", "Event","Validation"],
26
- ProgressBarCard: ["Core", "Properties", "style", "Event","Validation"],
27
- RankCard: ["Core", "Properties", "style", "Event","Validation"],
28
- Slider: ["Core", "Components", "style", "Event","Validation"],
29
- Timer: ["Core", "style", "Event","Validation"],
30
- Rank: ["Core","style", "Event","Validation"],
31
- Button: ["Core", "Properties", "style", "Event","Validation"],
32
- Array:["Core","Components","Validation"],
33
- Radio:["Core", "Properties", "style", "Event","Validation"],
34
- Text:["Core","Properties","style", "Event","Validation"],
35
- TextArea:["Core","Properties","style", "Event","Validation"],
36
- PopUp: ["Core", "Components","Properties", "style"],
37
- Stepper: ["Core", "Components","Properties","Event", "style"],
38
- DataGrid: ["Core", "Components","Properties","Event", "style"],
39
- InputSlider:["Core","Properties","style", "Event","Validation"],
13
+ Select: ["Core", "Properties", "Value", "Event", "Style", "Validation"],
14
+ MultipleSelect: ["Core", "Properties", "Value", "Event", "Style", "Validation"],
15
+ Table: ["Core", "Components", "Properties", "Event", "Style", "Validation"],
16
+ LeaderBoard: ["Core", "Components", "Properties", "Event", "Style", "Validation"],
17
+ WrapperSection: ["Core", "Components", "Properties", "Style", "Validation"],
18
+ TabSection: ["Core", "Components", "Properties", "Style", "Validation"],
19
+ SpeedoMeter: ["Core", "Properties", "Event", "Style", "Validation"],
20
+ card: ["Core", "Properties", "Event", "Style", "Validation"],
21
+ UploadFile: ["Core", "Event", "Style", "Validation"],
22
+ Graph: ["Core", "Properties", "Event", "Style", "Validation"],
23
+ DownloadFile: ["Core", "Event", "Style", "Validation"],
24
+ Box: ["Core", "Event", "Style", "Validation"],
25
+ Properties: ["Core", "Properties", "Event", "Style", "Validation"],
26
+ ProgressBarCard: ["Core", "Properties", "Event", "Style", "Validation"],
27
+ RankCard: ["Core", "Properties", "Event", "Style", "Validation"],
28
+ Slider: ["Core", "Components", "Event", "Style", "Validation"],
29
+ Timer: ["Core", "Event", "Style", "Validation"],
30
+ Rank: ["Core", "Event", "Style", "Validation"],
31
+ Button: ["Core", "Properties", "Event", "Style", "Validation"],
32
+ Array: ["Core", "Components", "Validation"],
33
+ Radio: ["Core", "Properties", "Event", "Style", "Validation"],
34
+ Text: ["Core", "Properties", "Event", "Style", "Validation"],
35
+ TextArea: ["Core", "Properties", "Event", "Style", "Validation"],
36
+ PopUp: ["Core", "Components", "Properties", "Style"],
37
+ Stepper: ["Core", "Components", "Properties", "Event", "Style"],
38
+ DataGrid: ["Core", "Components", "Properties", "Event", "Style"],
39
+ InputSlider: ["Core", "Properties", "Event", "Style", "Validation"],
40
+ TreeMap: ["Core", "Components", "Properties", "Event", "Style"],
41
+ ColumnGroup: ["Core", "Components"]
40
42
  }
41
43
 
42
44
 
43
45
 
44
- export const refreshPage = (type:string,store:any) => {
46
+ export const refreshPage = (type: string, store: any) => {
45
47
  const UiSchema = _.cloneDeep(componentBasicUiSchema)
46
- if(type){
47
- const sectionUiSchema = {
48
- Core: CoreSection,
49
- Value: ValueTab,
50
- style: StyleSection,
51
- Event: EventSection,
52
- Components: TableSection,
53
- Properties: buildPropertiesSection(type),
54
- Validation:ValidationSection
55
-
48
+ if (type) {
49
+ const sectionUiSchema = {
50
+ Core: CoreSection,
51
+ Value: ValueTab,
52
+ Style: StyleSection,
53
+ Event: EventSection,
54
+ Components: TableSection,
55
+ Properties: buildPropertiesSection(type),
56
+ Validation: ValidationSection
57
+
58
+ }
59
+ const elements = sectionLabels[type]?.map(e => sectionUiSchema[e]);
60
+ UiSchema.elements[1].config.main.tabLabels = sectionLabels[type] || ["Core", "Style", "Event", "Validation"];
61
+ UiSchema.elements[1].elements = elements || [CoreSection, StyleSection, EventSection, ValidationSection];
62
+
56
63
  }
57
- const elements = sectionLabels[type]?.map(e => sectionUiSchema[e]);
58
- UiSchema.elements[1].config.main.tabLabels = sectionLabels[type] || ["Core", "style","Event","Validation"];
59
- UiSchema.elements[1].elements = elements || [CoreSection, StyleSection,EventSection,ValidationSection];
60
-
61
- }
62
- store.setUiSchema(UiSchema);
64
+ store.setUiSchema(UiSchema);
63
65
  }
64
66
 
65
67
  export default (store: any, dynamicData: any, submitHandler: any, service: any) => {
@@ -68,26 +70,26 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
68
70
  const formdata = await this.getFormdata();
69
71
  store.setFormdata(formdata);
70
72
  const schema = this.getSchema();
71
- store.setSchema(schema);
72
- this.refreshPage(formdata?.type, store);
73
-
73
+ store.setSchema(schema);
74
+ this.refreshPage(formdata?.type, store);
75
+
74
76
  },
75
- refreshPage:refreshPage,
77
+ refreshPage: refreshPage,
76
78
  getFormdata: function () {
77
79
  const path = store.searchParams?.get("path");
78
- return getFormdataFromLocalStorage(path)
80
+ return getFormdataFromLocalStorage(path)
79
81
  },
80
82
  getSchema: function () {
81
83
  return ComponentSchema;
82
84
  },
83
- okHandler:()=>okHandler(store),
84
- saveHandler: async ()=> await saveHandler(store,service,submitHandler,"PageMaster"),
85
+ okHandler: () => okHandler(store),
86
+ saveHandler: async () => await saveHandler(store, service, submitHandler, "PageMaster"),
85
87
  onChange: function () {
86
88
  if (
87
89
  store?.formData?.type !== store?.newData?.type &&
88
90
  store?.newData?.type !== undefined
89
91
  ) {
90
- this.refreshPage(store?.newData?.type,store);
92
+ this.refreshPage(store?.newData?.type, store);
91
93
  }
92
94
  },
93
95
  editComponents: function () {
@@ -3,9 +3,10 @@ import { EventUiSchema } from "../elements/UiSchema/event/uiSchema";
3
3
  import Component from "./component";
4
4
  import { okHandler, saveFormdataInLocalStorage, saveHandler } from "./utils";
5
5
  import { APISection } from "../build/uischema/apiSection";
6
- import { getSelectField, getTextArea } from "../build/uischema/buildPropertiesSection";
6
+ import { getRadioInputField, getSelectField, getTextArea } from "../build/uischema/buildPropertiesSection";
7
7
  import { refreshSectionUiSchema } from "../build/uischema/refresh";
8
8
  import _ from "lodash";
9
+ import emptyBox from "../build/uischema/emptyBox";
9
10
 
10
11
  export default (
11
12
  store: any,
@@ -27,7 +28,9 @@ export default (
27
28
  const schema: any = _.cloneDeep(EventSchema)
28
29
  if (handlerType) {
29
30
  if (handlerType === "custom") {
30
- uiSchema.elements[1].elements[0].elements[2] = getTextArea("eventCode", "Write Custom Code", false)
31
+ uiSchema.elements[1].elements[0].elements[2] = getRadioInputField("isSync","Run in Sync",["Yes","No"])
32
+ uiSchema.elements[1].elements[0].elements[3] = emptyBox;
33
+ uiSchema.elements[1].elements[0].elements[4] = getTextArea("eventCode", "Write Custom Code", false)
31
34
  schema.required = ["eventType", "Handler", "eventCode"]
32
35
 
33
36
  } else if (handlerType === "api") {
@@ -8,13 +8,12 @@ import { getFormdataFromLocalStorage, saveFormdataInLocalStorage, saveHandler }
8
8
  interface funcParamsProps {
9
9
  store: any,
10
10
  dynamicData: any,
11
-
11
+ pageConfigProvider: any,
12
12
  submitHandler: any,
13
13
  service: any
14
- config?: any
15
14
  }
16
15
  export default (funcParams: funcParamsProps) => {
17
- const { store, dynamicData, config, submitHandler, service } = funcParams
16
+ const { store, dynamicData, submitHandler, service } = funcParams
18
17
  return {
19
18
  setPage: async function () {
20
19
  const formdata = await this.getFormdata();
@@ -24,8 +23,9 @@ export default (funcParams: funcParamsProps) => {
24
23
  store.setSchema(schema);
25
24
  store.setUiSchema(uiSchema);
26
25
  },
27
- getFormdata: function () {
26
+ getFormdata: async function () {
28
27
  const id = store.searchParams?.get("id");
28
+ const config: any = await funcParams.pageConfigProvider(id)
29
29
  const formData = getFormdataFromLocalStorage()
30
30
  if (formData) {
31
31
  return formData;
@@ -53,7 +53,7 @@ export default (funcParams: funcParamsProps) => {
53
53
  store.navigate(
54
54
  `/Component?path=${`elements[${response?.elements.length}]`}&id=${id}`
55
55
  );
56
- }else{
56
+ } else {
57
57
  store.navigate(
58
58
  `/Component?path=${`elements[${response?.elements.length}]`}`
59
59
  );
@@ -29,4 +29,4 @@ export const doDownload = (response: any, service) => {
29
29
  document.body.appendChild(link);
30
30
  link.click();
31
31
  link.parentNode.removeChild(link);
32
- };
32
+ };
@@ -1,87 +1,127 @@
1
1
  import _, { cloneDeep } from "lodash";
2
2
  import { handlersProps } from "./interface";
3
-
4
-
5
- export const executeEvents = async (
6
- params: handlersProps
7
- ) => {
3
+ export const executeEvents = (params: handlersProps) => {
8
4
  let nextEvent = [];
9
5
  let finalResponse = null;
6
+
7
+ if (params.config.isSync !== "Yes") {
8
+ return shouldEventExecute(params)
9
+ .then((shouldExecute) => {
10
+ if (!shouldExecute) {
11
+ throw new Error('onStart Event not allow to run Parent Events');
12
+ }
13
+ return executeEventsHandler(params);
14
+ })
15
+ .then((response) => {
16
+ finalResponse = response;
17
+ const SuccessEvent = params.config?.events.filter(e => e.eventType === "Success");
18
+ nextEvent = SuccessEvent;
19
+ })
20
+ .catch((err) => {
21
+ const FailEvent = params.config?.events?.filter(e => e.eventType === "Fail");
22
+ const setEvent = FailEvent?.length > 0 ? FailEvent : [];
23
+ nextEvent = setEvent;
24
+ })
25
+ .then(() => {
26
+ if (nextEvent?.length > 0) {
27
+ return nextEvent.reduce((chain, actionConfig) => {
28
+ return chain.then(() => executeEvents({ ...params, config: actionConfig, parentEventOutput: finalResponse }));
29
+ }, Promise.resolve());
30
+ }
31
+ })
32
+ .then(() => finalResponse)
33
+ }
34
+ const shouldExecute = shouldEventExecute(params);
35
+ if (!shouldExecute) {
36
+ return { response: undefined, events: undefined };
37
+ }
10
38
  try {
11
- const shouldExecute = await shouldEventExecute(params)
12
- if (!shouldExecute) {
13
- return { response: undefined, events: undefined };
14
- }
15
- const response = await executeEventsHandler(params)
16
- finalResponse = response;
39
+ const eventsResponse = executeEventsHandler(params);
40
+ finalResponse = eventsResponse;
17
41
  const SuccessEvent = params.config?.events.filter(e => e.eventType === "Success");
18
42
  nextEvent = SuccessEvent;
19
- } catch (err) {
20
- const FailEvent = params.config?.events?.filter(e => e.eventType === "Fail")
21
- const setEvent = FailEvent?.length > 0 ? FailEvent : []
43
+ } catch {
44
+ const FailEvent = params.config?.events?.filter(e => e.eventType === "Fail");
45
+ const setEvent = FailEvent?.length > 0 ? FailEvent : [];
22
46
  nextEvent = setEvent;
23
47
  }
24
48
  if (nextEvent?.length > 0) {
25
49
  for (const actionConfig of nextEvent) {
26
- await executeEvents({ ...params, config: actionConfig, parentEventOutput: finalResponse })
50
+ executeEvents({ ...params, config: actionConfig, parentEventOutput: finalResponse })
27
51
  }
28
52
  }
29
53
  return finalResponse;
30
- }
54
+ }
31
55
 
32
- async function executeEventsHandler(params: handlersProps) {
56
+ function executeEventsHandler(params: handlersProps) {
33
57
  if (params.config.Handler === "api") {
34
- return await executeApiEventHandler(params)
35
- }
36
- else if (params.config.Handler === "inBuiltFunction") {
37
- return await executeInBuiltFunctionHandler(params)
38
- }
39
- else if (params.config.Handler === "custom") {
40
- return await executeCustomHandler(params)
41
- }
42
- else if (params.config.Handler === "refresh") {
43
- return await executeRefreshHandler(params)
44
- }
45
- else if (params.config.Handler === "mergeFormdata") {
46
- const result = await mergeFormdata(
47
- params.parentEventOutput, params.componentName, params.config, params.store, params.service)
48
- return result;
49
- }
50
- else if (params.config.Handler === "onBackHandler") {
51
- return params.store.functionParameters?.handleBack()
52
- }
53
- else if (params.config.Handler === "onNextHandler") {
54
- return params.store.functionParameters?.handleNext()
55
- }
56
- else if (params.config.Handler === "onResetHandler") {
57
- return params.store.functionParameters?.handleReset()
58
+ return executeApiRequest(params);
59
+ } else if (params.config.Handler === "inBuiltFunction") {
60
+ return executeInBuiltFunctionHandler(params);
61
+ } else if (params.config.Handler === "custom") {
62
+ return executeCustomHandler(params);
63
+ } else if (params.config.Handler === "refresh") {
64
+ return executeRefreshHandler(params);
65
+ } else if (params.config.Handler === "mergeFormdata") {
66
+ return mergeFormdata(
67
+ params.parentEventOutput,
68
+ params.componentName,
69
+ params.config,
70
+ params.store,
71
+ params.service
72
+ );
73
+ } else if (params.config.Handler === "onBackHandler") {
74
+ return params.store.functionParameters?.handleBack();
75
+ } else if (params.config.Handler === "onNextHandler") {
76
+ return params.store.functionParameters?.handleNext();
77
+ } else if (params.config.Handler === "onResetHandler") {
78
+ return params.store.functionParameters?.handleReset();
58
79
  }
59
80
  }
60
- export async function executeRefreshHandler(params: handlersProps) {
61
- const compToRefresh: string[] = getRefreshElements(params.config, params.eventGroups)
62
- for (const componentName of compToRefresh) {
63
- for (const compEventConfig of params.eventGroups.onLoad[componentName]) {
64
- await executeEvents({ ...params, config: compEventConfig, componentName });
81
+
82
+ export function getRefreshElements(eventConfig: any, eventGropus: any) {
83
+ let result: string[] = [];
84
+ if (eventConfig?.refreshElements?.length > 0) {
85
+ result = eventConfig.refreshElements.map((e) => {
86
+ return e.value
87
+ })
88
+
89
+ } else {
90
+ if (eventGropus?.onLoad) {
91
+ result = Object.keys(eventGropus?.onLoad)
92
+ result.push(result[0]);
65
93
  }
66
94
  }
95
+ console.log(result);
96
+ return result;
67
97
  }
68
- async function executeApiEventHandler(params: handlersProps) {
98
+ export function executeRefreshHandler(params: handlersProps) {
99
+ const compToRefresh: string[] = getRefreshElements(params.config, params.eventGroups);
100
+
101
+ return Promise.all(compToRefresh.map(componentName => {
102
+ return Promise.all(params.eventGroups.onLoad[componentName].map(compEventConfig => {
103
+ return executeEvents({ ...params, config: compEventConfig, componentName });
104
+ }));
105
+ }))
106
+ };
107
+ export function executeApiRequest(params: any) {
69
108
  const initialBody = { ...params.userValue?.payload };
70
109
  const initialHeaders = {
71
110
  "X-Requested-With": "XMLHttpRequest",
72
111
  "Access-Control-Allow-Origin": "*"
73
112
  };
74
- const { body, headers } = await buildApiPayload(params.config, initialBody, initialHeaders, params.store, params.dynamicData, params.userValue, params.service)
75
113
 
76
- const response = await params.service[params.config.method](
114
+ const payloadApi = buildApiPayload(params.config, initialBody, initialHeaders, params.store, params.dynamicData, params.userValue, params.service)
115
+ return params.service[params.config.method](
77
116
  params.config.path,
78
- body,
79
- headers && { headers: headers }
80
- );
81
- return response;
82
- }
117
+ payloadApi.body,
118
+ { headers: payloadApi.headers }
119
+ ).then((response) => {
120
+ return response;
121
+ });
122
+ };
83
123
 
84
- async function executeInBuiltFunctionHandler(params: handlersProps) {
124
+ function executeInBuiltFunctionHandler(params: handlersProps) {
85
125
  let parameter = {};
86
126
  if (params.config.funcParametersCode) {
87
127
  const makeFunc = eval(params.config.funcParametersCode)
@@ -92,13 +132,18 @@ async function executeInBuiltFunctionHandler(params: handlersProps) {
92
132
  }
93
133
  }
94
134
 
95
- async function executeCustomHandler(params: handlersProps) {
135
+ function executeCustomHandler(params: handlersProps) {
96
136
  const makeFunc = eval(params.config.eventCode)
97
- const response = await makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service, params.componentName);
98
- return response;
137
+ if (params.config.isSync !== "Yes") {
138
+ return makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service, params.componentName).then((res) => res)
139
+ } else {
140
+ const response = makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service, params.componentName)
141
+ return response;
142
+ }
143
+
99
144
  }
100
145
 
101
- async function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any, service: any) {
146
+ function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any, service: any) {
102
147
  if (eventConfig.type === "Select" && !(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
103
148
  store.setSchema((pre) => {
104
149
  return {
@@ -134,7 +179,6 @@ async function mergeFormdata(handlerResponse: any, componentName: string, eventC
134
179
  else {
135
180
  if (handlerResponse) {
136
181
  store.setFormdata((pre) => { return { ...pre, [componentName]: eventConfig.lazyLoading ? handlerResponse?.data?.data : handlerResponse.data } });
137
- const demoData = await asyncOperation();
138
182
  }
139
183
  }
140
184
  }
@@ -176,50 +220,45 @@ const buildHeadersFormat = (headers: any[]) => {
176
220
  return headerObj;
177
221
  }
178
222
 
179
- async function shouldEventExecute(params: handlersProps) {
223
+ export function shouldEventExecute(params: handlersProps) {
180
224
  const startEvent = params.config?.events?.filter(e => e.eventType === "onStart");
225
+
181
226
  if (startEvent?.length > 0) {
182
- const response = await executeEventsHandler({ ...params, config: startEvent[0] });
183
- return response;
227
+ if (startEvent[0]?.isSync !== "Yes") {
228
+ return executeEventsHandler({ ...params, config: startEvent[0] }).then((response) => {
229
+ return response;
230
+ });
231
+ } else {
232
+ return executeEventsHandler({ ...params, config: startEvent[0] })
233
+ }
184
234
  } else {
185
- return true
235
+ if (params.config.isSync !== "Yes") {
236
+ return Promise.resolve(true)
237
+ } else {
238
+ return true
239
+ }
186
240
  }
187
241
  }
188
242
 
189
- export async function buildApiPayload(compConfig: any, body: any, headers: any, store: any, dynamicData: any, userValue: any, service) {
190
- if (compConfig?.headers) {
191
- headers = buildHeadersFormat(compConfig.headers)
192
243
 
244
+ export function buildApiPayload(compConfig: any, body: any, headers: any, store: any, dynamicData: any, userValue: any, service) {
245
+ if (compConfig?.headers) {
246
+ headers = buildHeadersFormat(compConfig.headers);
193
247
  }
248
+
194
249
  if (compConfig.body) {
195
250
  body = { ...buildBodyFormat(compConfig.body, store.newData || store?.ctx?.core?.data || store.formData, userValue) };
196
251
  }
197
- if (compConfig.apiBody) {
198
- const makeFunc = eval(compConfig.apiBody);
199
- const data = await makeFunc(store, dynamicData, userValue, body);
200
- body = data
201
- }
202
- return { body, headers };
203
- }
204
252
 
205
- export function getRefreshElements(eventConfig: any, eventGropus: any) {
206
- let result: string[] = [];
207
- if (eventConfig?.refreshElements?.length > 0) {
208
- result = eventConfig.refreshElements.map((e) => {
209
- return e.value
210
- })
253
+ const promiseChain = { body, headers };
211
254
 
212
- } else {
213
- if (eventGropus?.onLoad) {
214
- result = Object.keys(eventGropus?.onLoad)
215
- result.push(result[0]);
216
- }
255
+
256
+ if (compConfig.apiBody) {
257
+ const makeFunc = eval(compConfig.apiBody);
258
+ return { body: makeFunc(store, dynamicData, userValue, promiseChain.body), headers: promiseChain.headers };
217
259
  }
218
- console.log(result);
219
- return result;
260
+ return promiseChain;
220
261
  }
221
-
222
-
223
262
  export function asyncOperation() {
224
263
  return new Promise((resolve, reject) => {
225
264
  setTimeout(() => {
@@ -230,4 +269,4 @@ export function asyncOperation() {
230
269
  }
231
270
  }, 50);
232
271
  });
233
- }
272
+ }