udp-react-enterprise-component-library 26.2.0-beta.3 → 26.2.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,30 +1,30 @@
1
1
  import { Form } from "../../utilities/form/Form.mjs";
2
2
  import { Field } from "../../utilities/form/Field.mjs";
3
- import { FluentButton } from "../../UI/inputs/buttons/FluentButton.mjs";
4
- import { SubmitButton } from "../../utilities/form/SubmitButton.mjs";
5
- import { FormButtons } from "../../utilities/form/FormButtons.mjs";
6
3
  import { ConfigService } from "../../configService/index.mjs";
7
4
  import { useHandleAxiosSnackbar } from "../../utilities/apiHelpers.mjs";
8
5
  import { useUser } from "../../utilities/auth/useUser.mjs";
9
6
  import { apiMutate } from "../../utilities/useAxiosMutate.mjs";
10
- import { FluentIcon } from "../../utilities/iconLibrary/FluentIcon.mjs";
11
7
  import { getSanitizedName } from "../../utilities/entities/entityUtilities.mjs";
12
8
  import { useAxiosGet } from "../../utilities/useAxiosGet.mjs";
13
9
  import { usePromotedMethodEntity } from "../../hooks/usePromotedMethodEntity.mjs";
14
10
  import { executeQueryAdHoc } from "../utilities/methodUtils.mjs";
15
- import { AmbientTextField } from "../../UI/inputs/textField/AmbientTextField.mjs";
16
- import { AmbientCard } from "../../UI/surfaces/cards/AmbientCard/AmbientCard.mjs";
17
- import { Divider as Divider$1 } from "../../UI/utilityDisplay/Divider.mjs";
18
- import { AmbientAutoComplete } from "../../UI/inputs/textField/AmbientAutoComplete.mjs";
19
- import { DragDropFileUpload } from "../../uploader/DragDropFileUpload.mjs";
11
+ import { UdpButton } from "../../UI/fluent-web-components/UdpButton.mjs";
12
+ import { UdpAutocomplete } from "../../UI/fluent-web-components/UdpAutocomplete.mjs";
13
+ import { UdpText } from "../../UI/fluent-web-components/UdpText.mjs";
14
+ import { UdpCard } from "../../UI/fluent-web-components/UdpCard.mjs";
15
+ import { UdpFileInput } from "../../UI/fluent-web-components/UdpFileInput.mjs";
20
16
  import { AmbientStepper } from "../../UI/inputs/menus/AmbientStepper/AmbientStepper.mjs";
17
+ import { UdpDivider } from "../../UI/fluent-web-components/UdpDivider.mjs";
18
+ import { UdpDropdown } from "../../UI/fluent-web-components/UdpDropdown.mjs";
19
+ import { UdpIcon } from "../../UI/fluent-web-components/UdpIcon.mjs";
20
+ import { UdpTextInput } from "../../UI/fluent-web-components/UdpTextInput.mjs";
21
21
  import { handleExcelFileUpload, handleJsonFileUpload, handleTextFileUpload } from "./fileUtils.mjs";
22
22
  import { FileImportConfigCard } from "./FileImportConfigCard.mjs";
23
- import React, { useCallback, useEffect, useMemo, useState } from "react";
24
- import { Typography } from "@material-ui/core";
25
- import { ChromeBackMirroredIcon } from "@fluentui/react-icons";
23
+ import { c } from "react-compiler-runtime";
24
+ import React, { useEffect, useState } from "react";
26
25
  //#region src/udp/fileImportMapping/FileImportMappingWizard.jsx
27
26
  const FileImportMappingWizard = (props) => {
27
+ const $ = c(70);
28
28
  const { refetchMappings, setNewFileMappingSidesheetOpen, verifyRequiredFields } = props;
29
29
  const user = useUser();
30
30
  const [importHeaderData, setImportHeaderData] = useState();
@@ -32,278 +32,448 @@ const FileImportMappingWizard = (props) => {
32
32
  const [selectedDomain, setSelectedDomain] = useState();
33
33
  const [selectedFileType, setSelectedFileType] = useState();
34
34
  const [fileObject, setFileObject] = useState();
35
- const [fileImportMappingObject, setFileImportMappingObject] = useState({});
35
+ let t0;
36
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
37
+ t0 = [];
38
+ $[0] = t0;
39
+ } else t0 = $[0];
40
+ const [fileItems, setFileItems] = useState(t0);
41
+ let t1;
42
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
43
+ t1 = {};
44
+ $[1] = t1;
45
+ } else t1 = $[1];
46
+ const [fileImportMappingObject, setFileImportMappingObject] = useState(t1);
36
47
  const [activeStep, setActiveStep] = useState(0);
37
48
  const [showIndexNumbers, setShowIndexNumbers] = useState(false);
38
49
  const [errorText, setErrorText] = useState("");
39
50
  const { handleErrorSnackbar, handleSuccessSnackbar } = useHandleAxiosSnackbar();
40
- const executeCreateFileMapping = useCallback(async (data) => apiMutate(ConfigService.productV1ApiUrl, `UdpFileImportMapping`, { method: "post" }, { data }), []);
51
+ const executeCreateFileMapping = _temp;
41
52
  const { data: udpObjectEntity } = usePromotedMethodEntity("UdpObjectInfo", true);
42
- const [{ data: allowedFileTypesData }, refetchAllowedFileTypes] = useAxiosGet(ConfigService.productV1ApiUrl, `UdpFileImportType`, {}, false);
43
- const searchUdpObjectData = useCallback(async () => {
44
- if (udpObjectEntity?.unityBaseSearchMethod?.apiMethodId && user?.id) {
45
- const sapUserRes = await executeQueryAdHoc({ data: {
46
- eagerLoad: true,
47
- pageSize: 200,
48
- filterElements: []
49
- } }, udpObjectEntity?.unityBaseSearchMethod?.apiMethodId);
50
- if (sapUserRes?.data?.pageList.length > 0) setUdpObjectList(sapUserRes?.data?.pageList);
51
- }
52
- }, [udpObjectEntity, user]);
53
- const filterCatalogObjectList = useMemo(() => {
54
- return udpObjectList;
55
- }, [udpObjectList]);
56
- const getNameFormattedOptionLabel = (option) => {
57
- return option?.name.replace(/([A-Z])/g, " $1").trim();
58
- };
59
- const getNameOptionLabel = (option_0) => {
60
- return option_0?.name;
61
- };
62
- const handleFileUpload = async (properties) => {
63
- let result;
64
- if (selectedFileType.extension === ".csv" || selectedFileType.extension === ".txt") result = await handleTextFileUpload(fileObject, properties);
65
- else if (selectedFileType.extension === ".xlsx") result = await handleExcelFileUpload(fileObject, properties);
66
- else if (selectedFileType.extension === ".json") result = await handleJsonFileUpload(fileObject, properties);
67
- setImportHeaderData(result?.headers);
68
- };
69
- useEffect(() => {
70
- searchUdpObjectData();
71
- }, [searchUdpObjectData]);
72
- const handleCreateNewFieldMapping = useCallback(async (values) => {
73
- if ((await executeCreateFileMapping({
74
- name: values.name,
75
- objectInfoSanitizedName: getSanitizedName(selectedDomain.name),
76
- fileImportType: selectedFileType.id,
77
- mapping: JSON.stringify(fileImportMappingObject?.mapping),
78
- properties: JSON.stringify(fileImportMappingObject?.properties)
79
- }).catch((res) => {
80
- handleErrorSnackbar(res);
81
- }))?.status === 201) {
82
- handleSuccessSnackbar("Created Mapping");
83
- refetchMappings();
84
- setNewFileMappingSidesheetOpen(false);
85
- }
86
- }, [
87
- executeCreateFileMapping,
88
- selectedDomain?.name,
89
- selectedFileType?.id,
90
- fileImportMappingObject?.mapping,
91
- fileImportMappingObject?.properties,
92
- handleErrorSnackbar,
93
- handleSuccessSnackbar,
94
- refetchMappings,
95
- setNewFileMappingSidesheetOpen
96
- ]);
97
- const handleUpdateFieldMapping = (values_0) => {
98
- let valid = true;
99
- selectedDomain?.objectFieldInfo?.forEach((option_1) => {
100
- if (!option_1.dataType.endsWith("?") && !option_1.isPrimaryKey && !option_1.udpType) {
101
- if (!Object.entries(values_0).some((obj) => obj[1].businessObjectKey === option_1.businessObjectKey)) {
102
- if (verifyRequiredFields) valid = false;
53
+ let t2;
54
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
55
+ t2 = {};
56
+ $[2] = t2;
57
+ } else t2 = $[2];
58
+ const [t3] = useAxiosGet(ConfigService.productV1ApiUrl, "UdpFileImportType", t2, false);
59
+ const { data: allowedFileTypesData } = t3;
60
+ let t4;
61
+ if ($[3] !== udpObjectEntity?.unityBaseSearchMethod?.apiMethodId || $[4] !== user?.id) {
62
+ t4 = async () => {
63
+ if (udpObjectEntity?.unityBaseSearchMethod?.apiMethodId && user?.id) {
64
+ const sapUserRes = await executeQueryAdHoc({ data: {
65
+ eagerLoad: true,
66
+ pageSize: 200,
67
+ filterElements: []
68
+ } }, udpObjectEntity?.unityBaseSearchMethod?.apiMethodId);
69
+ if (sapUserRes?.data?.pageList.length > 0) setUdpObjectList(sapUserRes?.data?.pageList);
70
+ }
71
+ };
72
+ $[3] = udpObjectEntity?.unityBaseSearchMethod?.apiMethodId;
73
+ $[4] = user?.id;
74
+ $[5] = t4;
75
+ } else t4 = $[5];
76
+ const searchUdpObjectData = t4;
77
+ const filterCatalogObjectList = udpObjectList;
78
+ const getNameFormattedOptionLabel = _temp2;
79
+ let t5;
80
+ if ($[6] !== fileObject || $[7] !== selectedFileType.extension) {
81
+ t5 = async (properties) => {
82
+ let result;
83
+ if (selectedFileType.extension === ".csv" || selectedFileType.extension === ".txt") result = await handleTextFileUpload(fileObject, properties);
84
+ else if (selectedFileType.extension === ".xlsx") result = await handleExcelFileUpload(fileObject, properties);
85
+ else if (selectedFileType.extension === ".json") result = await handleJsonFileUpload(fileObject, properties);
86
+ setImportHeaderData(result?.headers);
87
+ };
88
+ $[6] = fileObject;
89
+ $[7] = selectedFileType.extension;
90
+ $[8] = t5;
91
+ } else t5 = $[8];
92
+ const handleFileUpload = t5;
93
+ let t6;
94
+ let t7;
95
+ if ($[9] !== searchUdpObjectData) {
96
+ t6 = () => {
97
+ searchUdpObjectData();
98
+ };
99
+ t7 = [searchUdpObjectData];
100
+ $[9] = searchUdpObjectData;
101
+ $[10] = t6;
102
+ $[11] = t7;
103
+ } else {
104
+ t6 = $[10];
105
+ t7 = $[11];
106
+ }
107
+ useEffect(t6, t7);
108
+ let t8;
109
+ if ($[12] !== fileImportMappingObject?.mapping || $[13] !== fileImportMappingObject?.properties || $[14] !== handleErrorSnackbar || $[15] !== handleSuccessSnackbar || $[16] !== refetchMappings || $[17] !== selectedDomain?.name || $[18] !== selectedFileType.id || $[19] !== setNewFileMappingSidesheetOpen) {
110
+ t8 = async (values) => {
111
+ if ((await executeCreateFileMapping({
112
+ name: values.name,
113
+ objectInfoSanitizedName: getSanitizedName(selectedDomain?.name),
114
+ fileImportType: selectedFileType?.id,
115
+ mapping: JSON.stringify(fileImportMappingObject?.mapping),
116
+ properties: JSON.stringify(fileImportMappingObject?.properties)
117
+ }).catch((res) => {
118
+ handleErrorSnackbar(res);
119
+ }))?.status === 201) {
120
+ handleSuccessSnackbar("Created Mapping");
121
+ refetchMappings();
122
+ setNewFileMappingSidesheetOpen(false);
123
+ }
124
+ };
125
+ $[12] = fileImportMappingObject?.mapping;
126
+ $[13] = fileImportMappingObject?.properties;
127
+ $[14] = handleErrorSnackbar;
128
+ $[15] = handleSuccessSnackbar;
129
+ $[16] = refetchMappings;
130
+ $[17] = selectedDomain?.name;
131
+ $[18] = selectedFileType.id;
132
+ $[19] = setNewFileMappingSidesheetOpen;
133
+ $[20] = t8;
134
+ } else t8 = $[20];
135
+ const handleCreateNewFieldMapping = t8;
136
+ let t9;
137
+ if ($[21] !== importHeaderData || $[22] !== selectedDomain?.objectFieldInfo || $[23] !== showIndexNumbers || $[24] !== verifyRequiredFields) {
138
+ t9 = (values_0) => {
139
+ let valid = true;
140
+ selectedDomain?.objectFieldInfo?.forEach((option_1) => {
141
+ if (!option_1.dataType.endsWith("?") && !option_1.isPrimaryKey && !option_1.udpType) {
142
+ if (!Object.entries(values_0).some((obj) => obj[1].businessObjectKey === option_1.businessObjectKey)) {
143
+ if (verifyRequiredFields) valid = false;
144
+ }
103
145
  }
146
+ });
147
+ if (!valid) {
148
+ setErrorText("All required Udp fields must have a mapping");
149
+ return;
104
150
  }
105
- });
106
- if (!valid) {
107
- setErrorText("All required Udp fields must have a mapping");
108
- return;
109
- }
110
- const filteredMappings = Object.entries(values_0).filter(([key, value]) => value !== null).reduce((acc, [key_0, value_0]) => {
111
- acc[key_0] = value_0;
112
- return acc;
113
- }, {});
114
- const mappedFieldIndexes = Object.keys(filteredMappings).map((key_1) => parseInt(key_1.split("udpFieldMapping")[1], 10));
115
- const fieldMappings = Object.values(filteredMappings).map((selectedUdpField, index) => {
116
- return {
151
+ const filteredMappings = Object.entries(values_0).filter(_temp3).reduce(_temp4, {});
152
+ const mappedFieldIndexes = Object.keys(filteredMappings).map(_temp5);
153
+ const fieldMappings = Object.values(filteredMappings).map((selectedUdpField, index) => ({
117
154
  udpField: selectedUdpField.name,
118
155
  importFileField: !showIndexNumbers ? importHeaderData[mappedFieldIndexes[index]] : null,
119
156
  headerIndex: !showIndexNumbers ? -1 : mappedFieldIndexes[index]
120
- };
121
- });
122
- setFileImportMappingObject((prev) => {
123
- return {
157
+ }));
158
+ setFileImportMappingObject((prev) => ({
124
159
  ...prev,
125
160
  mapping: fieldMappings
126
- };
127
- });
128
- setActiveStep((prev_0) => prev_0 + 1);
129
- };
130
- const handleUpdateFileProperties = (values_1) => {
131
- setFileImportMappingObject((prev_1) => {
132
- let properties_0 = {};
133
- Object.keys(values_1).forEach((propKey) => properties_0[propKey] = "value" in values_1[propKey] ? values_1[propKey]?.value : values_1[propKey]);
134
- return {
135
- ...prev_1,
136
- properties: properties_0
137
- };
138
- });
139
- if ("includesHeader" in values_1 && values_1?.includesHeader.value === false) setShowIndexNumbers(true);
140
- handleFileUpload(values_1);
141
- setActiveStep((prev_2) => prev_2 + 1);
142
- };
143
- const getUdpFieldOptionLabel = (option_2) => {
144
- if (!option_2.dataType.endsWith("?") && !option_2.isPrimaryKey && !option_2.udpType) return `${option_2.name.replace(/([A-Z])/g, " $1").trim()}*`;
145
- return `${option_2.name} - ${option_2.dataType}`;
146
- };
147
- const handleAddFileToUpload = (fileObj) => {
148
- setFileObject(fileObj[0]);
149
- };
150
- const formattedFileTypeProperties = useMemo(() => {
151
- if (selectedFileType) return JSON.parse(selectedFileType?.properties);
152
- }, [selectedFileType]);
153
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(AmbientCard, { fullWidth: true }, /* @__PURE__ */ React.createElement("div", { style: { marginBottom: 20 } }, /* @__PURE__ */ React.createElement(AmbientStepper, {
154
- activeStep,
155
- steps: [
161
+ }));
162
+ setActiveStep(_temp6);
163
+ };
164
+ $[21] = importHeaderData;
165
+ $[22] = selectedDomain?.objectFieldInfo;
166
+ $[23] = showIndexNumbers;
167
+ $[24] = verifyRequiredFields;
168
+ $[25] = t9;
169
+ } else t9 = $[25];
170
+ const handleUpdateFieldMapping = t9;
171
+ let t10;
172
+ if ($[26] !== handleFileUpload) {
173
+ t10 = (values_1) => {
174
+ setFileImportMappingObject((prev_1) => {
175
+ const properties_0 = {};
176
+ Object.keys(values_1).forEach((propKey) => properties_0[propKey] = "value" in values_1[propKey] ? values_1[propKey]?.value : values_1[propKey]);
177
+ return {
178
+ ...prev_1,
179
+ properties: properties_0
180
+ };
181
+ });
182
+ if ("includesHeader" in values_1 && values_1?.includesHeader.value === false) setShowIndexNumbers(true);
183
+ handleFileUpload(values_1);
184
+ setActiveStep(_temp7);
185
+ };
186
+ $[26] = handleFileUpload;
187
+ $[27] = t10;
188
+ } else t10 = $[27];
189
+ const handleUpdateFileProperties = t10;
190
+ const getUdpFieldOptionLabel = _temp8;
191
+ let t11;
192
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
193
+ t11 = (e) => {
194
+ const items = e.target.value;
195
+ setFileItems(items);
196
+ setFileObject(items.find(_temp9)?.file);
197
+ };
198
+ $[28] = t11;
199
+ } else t11 = $[28];
200
+ const handleAddFileToUpload = t11;
201
+ let t12;
202
+ bb0: {
203
+ if (selectedFileType) {
204
+ let t13;
205
+ if ($[29] !== selectedFileType.properties) {
206
+ t13 = JSON.parse(selectedFileType?.properties);
207
+ $[29] = selectedFileType.properties;
208
+ $[30] = t13;
209
+ } else t13 = $[30];
210
+ t12 = t13;
211
+ break bb0;
212
+ }
213
+ t12 = void 0;
214
+ }
215
+ const formattedFileTypeProperties = t12;
216
+ let t13;
217
+ if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
218
+ t13 = { marginBottom: 20 };
219
+ $[31] = t13;
220
+ } else t13 = $[31];
221
+ let t14;
222
+ if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
223
+ t14 = [
156
224
  "File",
157
225
  "Domain",
158
226
  "Field Mappings",
159
227
  "Review"
160
- ],
161
- orientation: "vertical"
162
- })), activeStep === 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(AmbientAutoComplete, {
163
- isMultiple: false,
164
- id: "fileImportType",
165
- name: "fileImportType",
166
- label: "File Type",
167
- onChange: (val) => setSelectedFileType(val),
168
- options: allowedFileTypesData,
169
- size: "small",
170
- getOptionLabelFunction: getNameOptionLabel,
171
- value: selectedFileType,
172
- required: true
173
- }), selectedFileType && /* @__PURE__ */ React.createElement("div", { style: { marginTop: 5 } }, /* @__PURE__ */ React.createElement(DragDropFileUpload, {
174
- handleUploadFile: handleAddFileToUpload,
175
- accept: {
176
- "text/csv": [".csv"],
177
- "text/plain": [".txt"],
178
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
179
- "application/json": [".json"]
180
- }
181
- })), /* @__PURE__ */ React.createElement(Form, { onSubmit: handleUpdateFileProperties }, formattedFileTypeProperties?.map((property) => property?.options ? /* @__PURE__ */ React.createElement(Field, {
182
- component: AmbientAutoComplete,
183
- isMultiple: false,
184
- id: property.propertyName,
228
+ ];
229
+ $[32] = t14;
230
+ } else t14 = $[32];
231
+ let t15;
232
+ if ($[33] !== activeStep) {
233
+ t15 = /* @__PURE__ */ React.createElement("div", { style: t13 }, /* @__PURE__ */ React.createElement(AmbientStepper, {
234
+ activeStep,
235
+ steps: t14,
236
+ orientation: "vertical"
237
+ }));
238
+ $[33] = activeStep;
239
+ $[34] = t15;
240
+ } else t15 = $[34];
241
+ let t16;
242
+ if ($[35] !== activeStep || $[36] !== allowedFileTypesData || $[37] !== fileItems || $[38] !== fileObject || $[39] !== formattedFileTypeProperties || $[40] !== handleUpdateFileProperties || $[41] !== selectedFileType) {
243
+ t16 = activeStep === 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(UdpDropdown, {
244
+ name: "fileImportType",
245
+ label: "File Type",
246
+ onChange: (e_0) => setSelectedFileType(e_0.target.value),
247
+ options: allowedFileTypesData || [],
248
+ optionLabel: "name",
249
+ optionValue: "id",
250
+ value: selectedFileType,
251
+ required: true
252
+ }), selectedFileType && /* @__PURE__ */ React.createElement("div", { style: { marginTop: 5 } }, /* @__PURE__ */ React.createElement(UdpFileInput, {
253
+ value: fileItems,
254
+ onChange: handleAddFileToUpload,
255
+ accept: ".csv,.txt,.xlsx,.json",
256
+ maxFiles: 1
257
+ })), /* @__PURE__ */ React.createElement(Form, {
258
+ id: "fileProperties",
259
+ onSubmit: handleUpdateFileProperties
260
+ }, formattedFileTypeProperties?.map(_temp0), /* @__PURE__ */ React.createElement(UdpButton, {
261
+ appearance: "secondary",
262
+ type: "submit",
263
+ form: "fileProperties",
264
+ disabled: !fileObject
265
+ }, "Next")));
266
+ $[35] = activeStep;
267
+ $[36] = allowedFileTypesData;
268
+ $[37] = fileItems;
269
+ $[38] = fileObject;
270
+ $[39] = formattedFileTypeProperties;
271
+ $[40] = handleUpdateFileProperties;
272
+ $[41] = selectedFileType;
273
+ $[42] = t16;
274
+ } else t16 = $[42];
275
+ let t17;
276
+ if ($[43] !== activeStep || $[44] !== filterCatalogObjectList || $[45] !== selectedDomain) {
277
+ t17 = activeStep === 1 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(UdpAutocomplete, {
278
+ name: "domain",
279
+ label: "Domain",
280
+ onChange: (e_1) => setSelectedDomain(e_1.target.value),
281
+ options: filterCatalogObjectList,
282
+ optionLabel: getNameFormattedOptionLabel,
283
+ optionValue: "id",
284
+ value: selectedDomain,
285
+ required: true
286
+ }), /* @__PURE__ */ React.createElement("div", { style: {
287
+ float: "right",
288
+ display: "flex",
289
+ gap: 8,
290
+ marginTop: 8
291
+ } }, /* @__PURE__ */ React.createElement(UdpButton, {
292
+ onClick: () => setActiveStep(_temp1),
293
+ disabled: activeStep === 0
294
+ }, "Prev"), /* @__PURE__ */ React.createElement(UdpButton, {
295
+ appearance: "secondary",
296
+ onClick: () => setActiveStep(_temp10),
297
+ disabled: !selectedDomain
298
+ }, "Next")));
299
+ $[43] = activeStep;
300
+ $[44] = filterCatalogObjectList;
301
+ $[45] = selectedDomain;
302
+ $[46] = t17;
303
+ } else t17 = $[46];
304
+ let t18;
305
+ if ($[47] !== activeStep || $[48] !== errorText || $[49] !== handleUpdateFieldMapping || $[50] !== importHeaderData || $[51] !== selectedDomain?.objectFieldInfo || $[52] !== showIndexNumbers) {
306
+ t18 = activeStep === 2 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { style: {
307
+ display: "flex",
308
+ flexDirection: "row",
309
+ justifyContent: "space-between",
310
+ paddingTop: 20
311
+ } }, /* @__PURE__ */ React.createElement(UdpText, { variant: "caption1Strong" }, showIndexNumbers ? "Column index's" : "File Headers"), /* @__PURE__ */ React.createElement(UdpText, { variant: "caption1Strong" }, "UDP Fields")), /* @__PURE__ */ React.createElement(UdpDivider, { style: { margin: "5px 0px" } }), /* @__PURE__ */ React.createElement(Form, {
312
+ id: "fieldMappings",
313
+ onSubmit: handleUpdateFieldMapping
314
+ }, importHeaderData?.map((field, index_0) => /* @__PURE__ */ React.createElement("div", { key: index_0 }, /* @__PURE__ */ React.createElement("div", { style: {
315
+ display: "flex",
316
+ flexDirection: "row",
317
+ alignItems: "center",
318
+ gap: 10
319
+ } }, /* @__PURE__ */ React.createElement(UdpText, { style: { width: "40%" } }, showIndexNumbers ? "index " + index_0 : field), /* @__PURE__ */ React.createElement(UdpIcon, {
320
+ style: { width: "10%" },
321
+ name: "arrow-right"
322
+ }), /* @__PURE__ */ React.createElement("div", { style: { flex: 2 } }, /* @__PURE__ */ React.createElement(Field, {
323
+ component: UdpDropdown,
324
+ multiple: false,
325
+ name: `udpFieldMapping${index_0}`,
326
+ options: selectedDomain?.objectFieldInfo,
327
+ optionLabel: getUdpFieldOptionLabel,
328
+ optionValue: "businessObjectKey",
329
+ includeErrorPadding: false,
330
+ clearable: true
331
+ }))), /* @__PURE__ */ React.createElement(UdpDivider, { style: { margin: "5px 0px" } }))), /* @__PURE__ */ React.createElement("div", { style: {
332
+ paddingTop: 20,
333
+ textAlign: "right",
334
+ color: "red"
335
+ } }, errorText), /* @__PURE__ */ React.createElement("div", { style: {
336
+ display: "flex",
337
+ justifyContent: "flex-start",
338
+ gap: 8,
339
+ paddingTop: 16
340
+ } }, /* @__PURE__ */ React.createElement(UdpButton, {
341
+ onClick: () => setActiveStep(_temp11),
342
+ disabled: activeStep === 0
343
+ }, "Prev"), /* @__PURE__ */ React.createElement(UdpButton, {
344
+ appearance: "secondary",
345
+ type: "submit",
346
+ form: "fieldMappings"
347
+ }, "Next"))));
348
+ $[47] = activeStep;
349
+ $[48] = errorText;
350
+ $[49] = handleUpdateFieldMapping;
351
+ $[50] = importHeaderData;
352
+ $[51] = selectedDomain?.objectFieldInfo;
353
+ $[52] = showIndexNumbers;
354
+ $[53] = t18;
355
+ } else t18 = $[53];
356
+ let t19;
357
+ if ($[54] !== activeStep || $[55] !== handleCreateNewFieldMapping) {
358
+ t19 = activeStep === 3 && /* @__PURE__ */ React.createElement(Form, {
359
+ id: "createMapping",
360
+ onSubmit: handleCreateNewFieldMapping
361
+ }, /* @__PURE__ */ React.createElement(Field, {
362
+ component: UdpTextInput,
363
+ name: "name",
364
+ label: "Mapping Name"
365
+ }), /* @__PURE__ */ React.createElement("div", { style: {
366
+ display: "flex",
367
+ justifyContent: "flex-start",
368
+ gap: 8,
369
+ paddingTop: 16
370
+ } }, /* @__PURE__ */ React.createElement(UdpButton, {
371
+ onClick: () => setActiveStep(_temp12),
372
+ disabled: activeStep === 0
373
+ }, "Prev"), /* @__PURE__ */ React.createElement(UdpButton, {
374
+ appearance: "primary",
375
+ type: "submit",
376
+ form: "createMapping"
377
+ }, "Create Mapping")));
378
+ $[54] = activeStep;
379
+ $[55] = handleCreateNewFieldMapping;
380
+ $[56] = t19;
381
+ } else t19 = $[56];
382
+ let t20;
383
+ if ($[57] !== t15 || $[58] !== t16 || $[59] !== t17 || $[60] !== t18 || $[61] !== t19) {
384
+ t20 = /* @__PURE__ */ React.createElement(UdpCard, { width: "100%" }, t15, t16, t17, t18, t19);
385
+ $[57] = t15;
386
+ $[58] = t16;
387
+ $[59] = t17;
388
+ $[60] = t18;
389
+ $[61] = t19;
390
+ $[62] = t20;
391
+ } else t20 = $[62];
392
+ let t21;
393
+ if ($[63] !== fileImportMappingObject?.mapping || $[64] !== fileImportMappingObject?.properties || $[65] !== selectedDomain?.name) {
394
+ t21 = fileImportMappingObject?.mapping && /* @__PURE__ */ React.createElement("div", { style: { marginTop: 10 } }, /* @__PURE__ */ React.createElement(FileImportConfigCard, {
395
+ fileMappingRecord: {
396
+ mapping: fileImportMappingObject?.mapping,
397
+ properties: fileImportMappingObject?.properties
398
+ },
399
+ domain: selectedDomain?.name.replace(/([A-Z])/g, " $1").trim()
400
+ }));
401
+ $[63] = fileImportMappingObject?.mapping;
402
+ $[64] = fileImportMappingObject?.properties;
403
+ $[65] = selectedDomain?.name;
404
+ $[66] = t21;
405
+ } else t21 = $[66];
406
+ let t22;
407
+ if ($[67] !== t20 || $[68] !== t21) {
408
+ t22 = /* @__PURE__ */ React.createElement(React.Fragment, null, t20, t21);
409
+ $[67] = t20;
410
+ $[68] = t21;
411
+ $[69] = t22;
412
+ } else t22 = $[69];
413
+ return t22;
414
+ };
415
+ async function _temp(data) {
416
+ return apiMutate(ConfigService.productV1ApiUrl, "UdpFileImportMapping", { method: "post" }, { data });
417
+ }
418
+ function _temp2(option) {
419
+ return option?.name.replace(/([A-Z])/g, " $1").trim();
420
+ }
421
+ function _temp3(t0) {
422
+ const [, value] = t0;
423
+ return value !== null;
424
+ }
425
+ function _temp4(acc, t0) {
426
+ const [key_0, value_0] = t0;
427
+ acc[key_0] = value_0;
428
+ return acc;
429
+ }
430
+ function _temp5(key_1) {
431
+ return parseInt(key_1.split("udpFieldMapping")[1], 10);
432
+ }
433
+ function _temp6(prev_0) {
434
+ return prev_0 + 1;
435
+ }
436
+ function _temp7(prev_2) {
437
+ return prev_2 + 1;
438
+ }
439
+ function _temp8(option_2) {
440
+ if (!option_2.dataType.endsWith("?") && !option_2.isPrimaryKey && !option_2.udpType) return `${option_2.name.replace(/([A-Z])/g, " $1").trim()}*`;
441
+ return `${option_2.name} - ${option_2.dataType}`;
442
+ }
443
+ function _temp9(item) {
444
+ return item.kind === "pending";
445
+ }
446
+ function _temp0(property) {
447
+ return property?.options ? /* @__PURE__ */ React.createElement(Field, {
448
+ key: property.propertyName,
449
+ component: UdpDropdown,
450
+ multiple: false,
185
451
  name: property.propertyName,
186
452
  label: property.label,
187
453
  options: property.options,
188
- size: "small",
189
- getOptionLabelFunction: getNameOptionLabel,
454
+ optionLabel: "name",
455
+ optionValue: "value",
190
456
  required: property?.required
191
457
  }) : /* @__PURE__ */ React.createElement(Field, {
192
- component: AmbientTextField,
193
- isMultiple: false,
194
- id: property.propertyName,
458
+ key: property.propertyName,
459
+ component: UdpTextInput,
195
460
  name: property.propertyName,
196
461
  label: property.label,
197
- size: "small",
198
- getOptionLabelFunction: getNameOptionLabel,
199
462
  required: property?.required
200
- })), /* @__PURE__ */ React.createElement(FormButtons, { style: {
201
- display: "flex",
202
- float: "right",
203
- marginRight: -16
204
- } }, /* @__PURE__ */ React.createElement(SubmitButton, {
205
- variant: "contained",
206
- color: "secondary",
207
- disablePristine: false,
208
- disabled: !fileObject
209
- }, "Next")))), activeStep === 1 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(AmbientAutoComplete, {
210
- isMultiple: false,
211
- id: "domain",
212
- name: "domain",
213
- label: "Domain",
214
- onChange: (val_0) => setSelectedDomain(val_0),
215
- options: filterCatalogObjectList,
216
- size: "small",
217
- getOptionLabelFunction: getNameFormattedOptionLabel,
218
- value: selectedDomain,
219
- required: true
220
- }), /* @__PURE__ */ React.createElement("div", { style: {
221
- float: "right",
222
- display: "flex",
223
- gap: 8,
224
- marginTop: 8
225
- } }, /* @__PURE__ */ React.createElement(FluentButton, {
226
- variant: "contained",
227
- onClick: () => setActiveStep((prev_3) => prev_3 - 1),
228
- disabled: activeStep === 0
229
- }, "Prev"), /* @__PURE__ */ React.createElement(FluentButton, {
230
- variant: "contained",
231
- onClick: () => setActiveStep((prev_4) => prev_4 + 1),
232
- color: "secondary",
233
- disabled: !selectedDomain
234
- }, "Next"))), activeStep === 2 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { style: {
235
- display: "flex",
236
- flexDirection: "row",
237
- justifyContent: "space-between",
238
- paddingTop: 20
239
- } }, /* @__PURE__ */ React.createElement(Typography, { variant: "caption" }, showIndexNumbers ? "Column index's" : "File Headers"), /* @__PURE__ */ React.createElement(Typography, { variant: "caption" }, "UDP Fields")), /* @__PURE__ */ React.createElement(Divider$1, { style: { margin: "5px 0px" } }), /* @__PURE__ */ React.createElement(Form, {
240
- onSubmit: handleUpdateFieldMapping,
241
- style: { marginTop: -20 }
242
- }, importHeaderData?.map((field, index_0) => /* @__PURE__ */ React.createElement("div", { style: { height: 42 } }, /* @__PURE__ */ React.createElement("div", { style: {
243
- display: "flex",
244
- flexDirection: "row",
245
- gap: 10
246
- } }, /* @__PURE__ */ React.createElement(Typography, { style: {
247
- marginTop: 25,
248
- width: "50%"
249
- } }, showIndexNumbers ? "index " + index_0 : field), /* @__PURE__ */ React.createElement(FluentIcon, {
250
- style: {
251
- marginTop: 28,
252
- width: "10%"
253
- },
254
- component: ChromeBackMirroredIcon
255
- }), /* @__PURE__ */ React.createElement(Field, {
256
- style: { height: 30 },
257
- component: AmbientAutoComplete,
258
- isMultiple: false,
259
- id: `udpFieldMapping${index_0}`,
260
- name: `udpFieldMapping${index_0}`,
261
- options: selectedDomain?.objectFieldInfo,
262
- size: "small",
263
- getOptionLabelFunction: getUdpFieldOptionLabel
264
- })), /* @__PURE__ */ React.createElement(Divider$1, { style: { margin: "5px 0px" } }))), /* @__PURE__ */ React.createElement("div", { style: {
265
- paddingTop: 20,
266
- textAlign: "right",
267
- color: "red"
268
- } }, errorText), /* @__PURE__ */ React.createElement(FormButtons, { style: {
269
- display: "flex",
270
- float: "right",
271
- paddingTop: 16,
272
- marginRight: -16
273
- } }, /* @__PURE__ */ React.createElement(FluentButton, {
274
- variant: "contained",
275
- onClick: () => setActiveStep((prev_5) => prev_5 - 1),
276
- disabled: activeStep === 0
277
- }, "Prev"), /* @__PURE__ */ React.createElement(SubmitButton, {
278
- variant: "contained",
279
- color: "secondary",
280
- disablePristine: false
281
- }, "Next")))), activeStep === 3 && /* @__PURE__ */ React.createElement(Form, { onSubmit: handleCreateNewFieldMapping }, /* @__PURE__ */ React.createElement(Field, {
282
- component: AmbientTextField,
283
- id: `name`,
284
- name: `name`,
285
- label: "Mapping Name",
286
- size: "small"
287
- }), /* @__PURE__ */ React.createElement(FormButtons, { style: {
288
- display: "flex",
289
- float: "right",
290
- marginRight: -16
291
- } }, /* @__PURE__ */ React.createElement(FluentButton, {
292
- variant: "contained",
293
- onClick: () => setActiveStep((prev_6) => prev_6 - 1),
294
- disabled: activeStep === 0
295
- }, "Prev"), /* @__PURE__ */ React.createElement(SubmitButton, {
296
- variant: "contained",
297
- color: "secondary",
298
- disablePristine: false
299
- }, "Create Mapping")))), fileImportMappingObject?.mapping && /* @__PURE__ */ React.createElement("div", { style: { marginTop: 10 } }, /* @__PURE__ */ React.createElement(FileImportConfigCard, {
300
- fileMappingRecord: {
301
- mapping: fileImportMappingObject?.mapping,
302
- properties: fileImportMappingObject?.properties
303
- },
304
- domain: selectedDomain?.name.replace(/([A-Z])/g, " $1").trim()
305
- })));
306
- };
463
+ });
464
+ }
465
+ function _temp1(prev_3) {
466
+ return prev_3 - 1;
467
+ }
468
+ function _temp10(prev_4) {
469
+ return prev_4 + 1;
470
+ }
471
+ function _temp11(prev_5) {
472
+ return prev_5 - 1;
473
+ }
474
+ function _temp12(prev_6) {
475
+ return prev_6 - 1;
476
+ }
307
477
  //#endregion
308
478
  export { FileImportMappingWizard as default };
309
479