@trackunit/custom-field-api 0.1.130 → 0.1.131

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/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useQuery, useMutation } from '@apollo/client';
2
- import { useCurrentUserLanguage } from '@trackunit/react-core-hooks';
2
+ import { useCurrentUserLanguage, useIrisAppId } from '@trackunit/react-core-hooks';
3
3
  import { nonNullable, exhaustiveCheck, objectKeys } from '@trackunit/shared-utils';
4
4
  import { useMemo, useCallback } from 'react';
5
5
  import { isValidCustomFieldValue, getCustomFieldValueToSaveFromRawValue } from '@trackunit/iris-app-runtime-core';
@@ -952,13 +952,845 @@ const GetCustomFieldsForSiteDocument = {
952
952
  },
953
953
  ],
954
954
  };
955
+ const GetCustomFieldsForAssetForIrisAppDocument = {
956
+ kind: "Document",
957
+ definitions: [
958
+ {
959
+ kind: "OperationDefinition",
960
+ operation: "query",
961
+ name: { kind: "Name", value: "GetCustomFieldsForAssetForIrisApp" },
962
+ variableDefinitions: [
963
+ {
964
+ kind: "VariableDefinition",
965
+ variable: { kind: "Variable", name: { kind: "Name", value: "entityId" } },
966
+ type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ID" } } },
967
+ },
968
+ {
969
+ kind: "VariableDefinition",
970
+ variable: { kind: "Variable", name: { kind: "Name", value: "systemOfMeasurement" } },
971
+ type: { kind: "NamedType", name: { kind: "Name", value: "SystemOfMeasurement" } },
972
+ },
973
+ {
974
+ kind: "VariableDefinition",
975
+ variable: { kind: "Variable", name: { kind: "Name", value: "irisAppId" } },
976
+ type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } },
977
+ },
978
+ ],
979
+ selectionSet: {
980
+ kind: "SelectionSet",
981
+ selections: [
982
+ {
983
+ kind: "Field",
984
+ name: { kind: "Name", value: "asset" },
985
+ arguments: [
986
+ {
987
+ kind: "Argument",
988
+ name: { kind: "Name", value: "id" },
989
+ value: { kind: "Variable", name: { kind: "Name", value: "entityId" } },
990
+ },
991
+ ],
992
+ selectionSet: {
993
+ kind: "SelectionSet",
994
+ selections: [
995
+ {
996
+ kind: "Field",
997
+ name: { kind: "Name", value: "customFields" },
998
+ arguments: [
999
+ {
1000
+ kind: "Argument",
1001
+ name: { kind: "Name", value: "owner" },
1002
+ value: {
1003
+ kind: "ObjectValue",
1004
+ fields: [
1005
+ {
1006
+ kind: "ObjectField",
1007
+ name: { kind: "Name", value: "ownerType" },
1008
+ value: { kind: "EnumValue", value: "IRIS_APP" },
1009
+ },
1010
+ {
1011
+ kind: "ObjectField",
1012
+ name: { kind: "Name", value: "irisAppId" },
1013
+ value: { kind: "Variable", name: { kind: "Name", value: "irisAppId" } },
1014
+ },
1015
+ ],
1016
+ },
1017
+ },
1018
+ ],
1019
+ selectionSet: {
1020
+ kind: "SelectionSet",
1021
+ selections: [
1022
+ {
1023
+ kind: "Field",
1024
+ name: { kind: "Name", value: "edges" },
1025
+ selectionSet: {
1026
+ kind: "SelectionSet",
1027
+ selections: [
1028
+ {
1029
+ kind: "Field",
1030
+ name: { kind: "Name", value: "node" },
1031
+ selectionSet: {
1032
+ kind: "SelectionSet",
1033
+ selections: [
1034
+ {
1035
+ kind: "FragmentSpread",
1036
+ name: { kind: "Name", value: "CustomFieldValueAndDefinition" },
1037
+ },
1038
+ ],
1039
+ },
1040
+ },
1041
+ ],
1042
+ },
1043
+ },
1044
+ ],
1045
+ },
1046
+ },
1047
+ ],
1048
+ },
1049
+ },
1050
+ ],
1051
+ },
1052
+ },
1053
+ {
1054
+ kind: "FragmentDefinition",
1055
+ name: { kind: "Name", value: "CustomFieldValueAndDefinition" },
1056
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CustomFieldValueAndDefinition" } },
1057
+ selectionSet: {
1058
+ kind: "SelectionSet",
1059
+ selections: [
1060
+ { kind: "Field", name: { kind: "Name", value: "__typename" } },
1061
+ {
1062
+ kind: "Field",
1063
+ name: { kind: "Name", value: "definition" },
1064
+ selectionSet: {
1065
+ kind: "SelectionSet",
1066
+ selections: [
1067
+ { kind: "Field", name: { kind: "Name", value: "__typename" } },
1068
+ { kind: "Field", name: { kind: "Name", value: "description" } },
1069
+ { kind: "Field", name: { kind: "Name", value: "entityType" } },
1070
+ { kind: "Field", name: { kind: "Name", value: "id" } },
1071
+ { kind: "Field", name: { kind: "Name", value: "key" } },
1072
+ {
1073
+ kind: "Field",
1074
+ name: { kind: "Name", value: "owner" },
1075
+ selectionSet: {
1076
+ kind: "SelectionSet",
1077
+ selections: [
1078
+ { kind: "Field", name: { kind: "Name", value: "irisAppId" } },
1079
+ {
1080
+ kind: "Field",
1081
+ name: { kind: "Name", value: "marketplaceEntry" },
1082
+ selectionSet: {
1083
+ kind: "SelectionSet",
1084
+ selections: [{ kind: "Field", name: { kind: "Name", value: "name" } }],
1085
+ },
1086
+ },
1087
+ { kind: "Field", name: { kind: "Name", value: "ownerType" } },
1088
+ ],
1089
+ },
1090
+ },
1091
+ { kind: "Field", name: { kind: "Name", value: "title" } },
1092
+ {
1093
+ kind: "Field",
1094
+ name: { kind: "Name", value: "translations" },
1095
+ selectionSet: {
1096
+ kind: "SelectionSet",
1097
+ selections: [
1098
+ { kind: "Field", name: { kind: "Name", value: "description" } },
1099
+ { kind: "Field", name: { kind: "Name", value: "title" } },
1100
+ { kind: "Field", name: { kind: "Name", value: "language" } },
1101
+ ],
1102
+ },
1103
+ },
1104
+ { kind: "Field", name: { kind: "Name", value: "type" } },
1105
+ { kind: "Field", name: { kind: "Name", value: "uiEditable" } },
1106
+ { kind: "Field", name: { kind: "Name", value: "uiVisible" } },
1107
+ {
1108
+ kind: "InlineFragment",
1109
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "DropDownFieldDefinition" } },
1110
+ selectionSet: {
1111
+ kind: "SelectionSet",
1112
+ selections: [
1113
+ { kind: "Field", name: { kind: "Name", value: "allValues" } },
1114
+ { kind: "Field", name: { kind: "Name", value: "multiSelect" } },
1115
+ ],
1116
+ },
1117
+ },
1118
+ {
1119
+ kind: "InlineFragment",
1120
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "NumberFieldDefinition" } },
1121
+ selectionSet: {
1122
+ kind: "SelectionSet",
1123
+ selections: [
1124
+ { kind: "Field", name: { kind: "Name", value: "isInteger" } },
1125
+ {
1126
+ kind: "Field",
1127
+ name: { kind: "Name", value: "maximumNumber" },
1128
+ arguments: [
1129
+ {
1130
+ kind: "Argument",
1131
+ name: { kind: "Name", value: "systemOfMeasurement" },
1132
+ value: { kind: "Variable", name: { kind: "Name", value: "systemOfMeasurement" } },
1133
+ },
1134
+ ],
1135
+ },
1136
+ {
1137
+ kind: "Field",
1138
+ name: { kind: "Name", value: "minimumNumber" },
1139
+ arguments: [
1140
+ {
1141
+ kind: "Argument",
1142
+ name: { kind: "Name", value: "systemOfMeasurement" },
1143
+ value: { kind: "Variable", name: { kind: "Name", value: "systemOfMeasurement" } },
1144
+ },
1145
+ ],
1146
+ },
1147
+ { kind: "Field", name: { kind: "Name", value: "unitSi" } },
1148
+ { kind: "Field", name: { kind: "Name", value: "unitUs" } },
1149
+ ],
1150
+ },
1151
+ },
1152
+ {
1153
+ kind: "InlineFragment",
1154
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "MonetaryFieldDefinition" } },
1155
+ selectionSet: {
1156
+ kind: "SelectionSet",
1157
+ selections: [
1158
+ { kind: "Field", name: { kind: "Name", value: "currency" } },
1159
+ { kind: "Field", name: { kind: "Name", value: "maximumNumber" } },
1160
+ { kind: "Field", name: { kind: "Name", value: "minimumNumber" } },
1161
+ ],
1162
+ },
1163
+ },
1164
+ {
1165
+ kind: "InlineFragment",
1166
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "StringFieldDefinition" } },
1167
+ selectionSet: {
1168
+ kind: "SelectionSet",
1169
+ selections: [
1170
+ { kind: "Field", name: { kind: "Name", value: "maximumLength" } },
1171
+ { kind: "Field", name: { kind: "Name", value: "minimumLength" } },
1172
+ { kind: "Field", name: { kind: "Name", value: "pattern" } },
1173
+ ],
1174
+ },
1175
+ },
1176
+ ],
1177
+ },
1178
+ },
1179
+ { kind: "Field", name: { kind: "Name", value: "valueEditable" } },
1180
+ {
1181
+ kind: "InlineFragment",
1182
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "BooleanFieldValueAndDefinition" } },
1183
+ selectionSet: {
1184
+ kind: "SelectionSet",
1185
+ selections: [{ kind: "Field", name: { kind: "Name", value: "booleanValue" } }],
1186
+ },
1187
+ },
1188
+ {
1189
+ kind: "InlineFragment",
1190
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "DateFieldValueAndDefinition" } },
1191
+ selectionSet: {
1192
+ kind: "SelectionSet",
1193
+ selections: [{ kind: "Field", name: { kind: "Name", value: "dateValue" } }],
1194
+ },
1195
+ },
1196
+ {
1197
+ kind: "InlineFragment",
1198
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "DropDownFieldValueAndDefinition" } },
1199
+ selectionSet: {
1200
+ kind: "SelectionSet",
1201
+ selections: [{ kind: "Field", name: { kind: "Name", value: "stringArrayValue" } }],
1202
+ },
1203
+ },
1204
+ {
1205
+ kind: "InlineFragment",
1206
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "EmailFieldValueAndDefinition" } },
1207
+ selectionSet: {
1208
+ kind: "SelectionSet",
1209
+ selections: [{ kind: "Field", name: { kind: "Name", value: "stringValue" } }],
1210
+ },
1211
+ },
1212
+ {
1213
+ kind: "InlineFragment",
1214
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "JsonFieldValueAndDefinition" } },
1215
+ selectionSet: {
1216
+ kind: "SelectionSet",
1217
+ selections: [{ kind: "Field", name: { kind: "Name", value: "jsonValue" } }],
1218
+ },
1219
+ },
1220
+ {
1221
+ kind: "InlineFragment",
1222
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "NumberFieldValueAndDefinition" } },
1223
+ selectionSet: {
1224
+ kind: "SelectionSet",
1225
+ selections: [
1226
+ {
1227
+ kind: "Field",
1228
+ name: { kind: "Name", value: "numberValue" },
1229
+ arguments: [
1230
+ {
1231
+ kind: "Argument",
1232
+ name: { kind: "Name", value: "systemOfMeasurement" },
1233
+ value: { kind: "Variable", name: { kind: "Name", value: "systemOfMeasurement" } },
1234
+ },
1235
+ ],
1236
+ },
1237
+ ],
1238
+ },
1239
+ },
1240
+ {
1241
+ kind: "InlineFragment",
1242
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "MonetaryFieldValueAndDefinition" } },
1243
+ selectionSet: {
1244
+ kind: "SelectionSet",
1245
+ selections: [{ kind: "Field", name: { kind: "Name", value: "numberValue" } }],
1246
+ },
1247
+ },
1248
+ {
1249
+ kind: "InlineFragment",
1250
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "PhoneNumberFieldValueAndDefinition" } },
1251
+ selectionSet: {
1252
+ kind: "SelectionSet",
1253
+ selections: [{ kind: "Field", name: { kind: "Name", value: "stringValue" } }],
1254
+ },
1255
+ },
1256
+ {
1257
+ kind: "InlineFragment",
1258
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "StringFieldValueAndDefinition" } },
1259
+ selectionSet: {
1260
+ kind: "SelectionSet",
1261
+ selections: [{ kind: "Field", name: { kind: "Name", value: "stringValue" } }],
1262
+ },
1263
+ },
1264
+ {
1265
+ kind: "InlineFragment",
1266
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "WebAddressFieldValueAndDefinition" } },
1267
+ selectionSet: {
1268
+ kind: "SelectionSet",
1269
+ selections: [{ kind: "Field", name: { kind: "Name", value: "stringValue" } }],
1270
+ },
1271
+ },
1272
+ ],
1273
+ },
1274
+ },
1275
+ ],
1276
+ };
1277
+ const GetCustomFieldsForSiteForIrisAppDocument = {
1278
+ kind: "Document",
1279
+ definitions: [
1280
+ {
1281
+ kind: "OperationDefinition",
1282
+ operation: "query",
1283
+ name: { kind: "Name", value: "GetCustomFieldsForSiteForIrisApp" },
1284
+ variableDefinitions: [
1285
+ {
1286
+ kind: "VariableDefinition",
1287
+ variable: { kind: "Variable", name: { kind: "Name", value: "entityId" } },
1288
+ type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ID" } } },
1289
+ },
1290
+ {
1291
+ kind: "VariableDefinition",
1292
+ variable: { kind: "Variable", name: { kind: "Name", value: "systemOfMeasurement" } },
1293
+ type: { kind: "NamedType", name: { kind: "Name", value: "SystemOfMeasurement" } },
1294
+ },
1295
+ {
1296
+ kind: "VariableDefinition",
1297
+ variable: { kind: "Variable", name: { kind: "Name", value: "irisAppId" } },
1298
+ type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } },
1299
+ },
1300
+ ],
1301
+ selectionSet: {
1302
+ kind: "SelectionSet",
1303
+ selections: [
1304
+ {
1305
+ kind: "Field",
1306
+ name: { kind: "Name", value: "site" },
1307
+ arguments: [
1308
+ {
1309
+ kind: "Argument",
1310
+ name: { kind: "Name", value: "id" },
1311
+ value: { kind: "Variable", name: { kind: "Name", value: "entityId" } },
1312
+ },
1313
+ ],
1314
+ selectionSet: {
1315
+ kind: "SelectionSet",
1316
+ selections: [
1317
+ {
1318
+ kind: "Field",
1319
+ name: { kind: "Name", value: "customFields" },
1320
+ arguments: [
1321
+ {
1322
+ kind: "Argument",
1323
+ name: { kind: "Name", value: "owner" },
1324
+ value: {
1325
+ kind: "ObjectValue",
1326
+ fields: [
1327
+ {
1328
+ kind: "ObjectField",
1329
+ name: { kind: "Name", value: "ownerType" },
1330
+ value: { kind: "EnumValue", value: "IRIS_APP" },
1331
+ },
1332
+ {
1333
+ kind: "ObjectField",
1334
+ name: { kind: "Name", value: "irisAppId" },
1335
+ value: { kind: "Variable", name: { kind: "Name", value: "irisAppId" } },
1336
+ },
1337
+ ],
1338
+ },
1339
+ },
1340
+ ],
1341
+ selectionSet: {
1342
+ kind: "SelectionSet",
1343
+ selections: [
1344
+ {
1345
+ kind: "Field",
1346
+ name: { kind: "Name", value: "edges" },
1347
+ selectionSet: {
1348
+ kind: "SelectionSet",
1349
+ selections: [
1350
+ {
1351
+ kind: "Field",
1352
+ name: { kind: "Name", value: "node" },
1353
+ selectionSet: {
1354
+ kind: "SelectionSet",
1355
+ selections: [
1356
+ {
1357
+ kind: "FragmentSpread",
1358
+ name: { kind: "Name", value: "CustomFieldValueAndDefinition" },
1359
+ },
1360
+ ],
1361
+ },
1362
+ },
1363
+ ],
1364
+ },
1365
+ },
1366
+ ],
1367
+ },
1368
+ },
1369
+ ],
1370
+ },
1371
+ },
1372
+ ],
1373
+ },
1374
+ },
1375
+ {
1376
+ kind: "FragmentDefinition",
1377
+ name: { kind: "Name", value: "CustomFieldValueAndDefinition" },
1378
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CustomFieldValueAndDefinition" } },
1379
+ selectionSet: {
1380
+ kind: "SelectionSet",
1381
+ selections: [
1382
+ { kind: "Field", name: { kind: "Name", value: "__typename" } },
1383
+ {
1384
+ kind: "Field",
1385
+ name: { kind: "Name", value: "definition" },
1386
+ selectionSet: {
1387
+ kind: "SelectionSet",
1388
+ selections: [
1389
+ { kind: "Field", name: { kind: "Name", value: "__typename" } },
1390
+ { kind: "Field", name: { kind: "Name", value: "description" } },
1391
+ { kind: "Field", name: { kind: "Name", value: "entityType" } },
1392
+ { kind: "Field", name: { kind: "Name", value: "id" } },
1393
+ { kind: "Field", name: { kind: "Name", value: "key" } },
1394
+ {
1395
+ kind: "Field",
1396
+ name: { kind: "Name", value: "owner" },
1397
+ selectionSet: {
1398
+ kind: "SelectionSet",
1399
+ selections: [
1400
+ { kind: "Field", name: { kind: "Name", value: "irisAppId" } },
1401
+ {
1402
+ kind: "Field",
1403
+ name: { kind: "Name", value: "marketplaceEntry" },
1404
+ selectionSet: {
1405
+ kind: "SelectionSet",
1406
+ selections: [{ kind: "Field", name: { kind: "Name", value: "name" } }],
1407
+ },
1408
+ },
1409
+ { kind: "Field", name: { kind: "Name", value: "ownerType" } },
1410
+ ],
1411
+ },
1412
+ },
1413
+ { kind: "Field", name: { kind: "Name", value: "title" } },
1414
+ {
1415
+ kind: "Field",
1416
+ name: { kind: "Name", value: "translations" },
1417
+ selectionSet: {
1418
+ kind: "SelectionSet",
1419
+ selections: [
1420
+ { kind: "Field", name: { kind: "Name", value: "description" } },
1421
+ { kind: "Field", name: { kind: "Name", value: "title" } },
1422
+ { kind: "Field", name: { kind: "Name", value: "language" } },
1423
+ ],
1424
+ },
1425
+ },
1426
+ { kind: "Field", name: { kind: "Name", value: "type" } },
1427
+ { kind: "Field", name: { kind: "Name", value: "uiEditable" } },
1428
+ { kind: "Field", name: { kind: "Name", value: "uiVisible" } },
1429
+ {
1430
+ kind: "InlineFragment",
1431
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "DropDownFieldDefinition" } },
1432
+ selectionSet: {
1433
+ kind: "SelectionSet",
1434
+ selections: [
1435
+ { kind: "Field", name: { kind: "Name", value: "allValues" } },
1436
+ { kind: "Field", name: { kind: "Name", value: "multiSelect" } },
1437
+ ],
1438
+ },
1439
+ },
1440
+ {
1441
+ kind: "InlineFragment",
1442
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "NumberFieldDefinition" } },
1443
+ selectionSet: {
1444
+ kind: "SelectionSet",
1445
+ selections: [
1446
+ { kind: "Field", name: { kind: "Name", value: "isInteger" } },
1447
+ {
1448
+ kind: "Field",
1449
+ name: { kind: "Name", value: "maximumNumber" },
1450
+ arguments: [
1451
+ {
1452
+ kind: "Argument",
1453
+ name: { kind: "Name", value: "systemOfMeasurement" },
1454
+ value: { kind: "Variable", name: { kind: "Name", value: "systemOfMeasurement" } },
1455
+ },
1456
+ ],
1457
+ },
1458
+ {
1459
+ kind: "Field",
1460
+ name: { kind: "Name", value: "minimumNumber" },
1461
+ arguments: [
1462
+ {
1463
+ kind: "Argument",
1464
+ name: { kind: "Name", value: "systemOfMeasurement" },
1465
+ value: { kind: "Variable", name: { kind: "Name", value: "systemOfMeasurement" } },
1466
+ },
1467
+ ],
1468
+ },
1469
+ { kind: "Field", name: { kind: "Name", value: "unitSi" } },
1470
+ { kind: "Field", name: { kind: "Name", value: "unitUs" } },
1471
+ ],
1472
+ },
1473
+ },
1474
+ {
1475
+ kind: "InlineFragment",
1476
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "MonetaryFieldDefinition" } },
1477
+ selectionSet: {
1478
+ kind: "SelectionSet",
1479
+ selections: [
1480
+ { kind: "Field", name: { kind: "Name", value: "currency" } },
1481
+ { kind: "Field", name: { kind: "Name", value: "maximumNumber" } },
1482
+ { kind: "Field", name: { kind: "Name", value: "minimumNumber" } },
1483
+ ],
1484
+ },
1485
+ },
1486
+ {
1487
+ kind: "InlineFragment",
1488
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "StringFieldDefinition" } },
1489
+ selectionSet: {
1490
+ kind: "SelectionSet",
1491
+ selections: [
1492
+ { kind: "Field", name: { kind: "Name", value: "maximumLength" } },
1493
+ { kind: "Field", name: { kind: "Name", value: "minimumLength" } },
1494
+ { kind: "Field", name: { kind: "Name", value: "pattern" } },
1495
+ ],
1496
+ },
1497
+ },
1498
+ ],
1499
+ },
1500
+ },
1501
+ { kind: "Field", name: { kind: "Name", value: "valueEditable" } },
1502
+ {
1503
+ kind: "InlineFragment",
1504
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "BooleanFieldValueAndDefinition" } },
1505
+ selectionSet: {
1506
+ kind: "SelectionSet",
1507
+ selections: [{ kind: "Field", name: { kind: "Name", value: "booleanValue" } }],
1508
+ },
1509
+ },
1510
+ {
1511
+ kind: "InlineFragment",
1512
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "DateFieldValueAndDefinition" } },
1513
+ selectionSet: {
1514
+ kind: "SelectionSet",
1515
+ selections: [{ kind: "Field", name: { kind: "Name", value: "dateValue" } }],
1516
+ },
1517
+ },
1518
+ {
1519
+ kind: "InlineFragment",
1520
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "DropDownFieldValueAndDefinition" } },
1521
+ selectionSet: {
1522
+ kind: "SelectionSet",
1523
+ selections: [{ kind: "Field", name: { kind: "Name", value: "stringArrayValue" } }],
1524
+ },
1525
+ },
1526
+ {
1527
+ kind: "InlineFragment",
1528
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "EmailFieldValueAndDefinition" } },
1529
+ selectionSet: {
1530
+ kind: "SelectionSet",
1531
+ selections: [{ kind: "Field", name: { kind: "Name", value: "stringValue" } }],
1532
+ },
1533
+ },
1534
+ {
1535
+ kind: "InlineFragment",
1536
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "JsonFieldValueAndDefinition" } },
1537
+ selectionSet: {
1538
+ kind: "SelectionSet",
1539
+ selections: [{ kind: "Field", name: { kind: "Name", value: "jsonValue" } }],
1540
+ },
1541
+ },
1542
+ {
1543
+ kind: "InlineFragment",
1544
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "NumberFieldValueAndDefinition" } },
1545
+ selectionSet: {
1546
+ kind: "SelectionSet",
1547
+ selections: [
1548
+ {
1549
+ kind: "Field",
1550
+ name: { kind: "Name", value: "numberValue" },
1551
+ arguments: [
1552
+ {
1553
+ kind: "Argument",
1554
+ name: { kind: "Name", value: "systemOfMeasurement" },
1555
+ value: { kind: "Variable", name: { kind: "Name", value: "systemOfMeasurement" } },
1556
+ },
1557
+ ],
1558
+ },
1559
+ ],
1560
+ },
1561
+ },
1562
+ {
1563
+ kind: "InlineFragment",
1564
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "MonetaryFieldValueAndDefinition" } },
1565
+ selectionSet: {
1566
+ kind: "SelectionSet",
1567
+ selections: [{ kind: "Field", name: { kind: "Name", value: "numberValue" } }],
1568
+ },
1569
+ },
1570
+ {
1571
+ kind: "InlineFragment",
1572
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "PhoneNumberFieldValueAndDefinition" } },
1573
+ selectionSet: {
1574
+ kind: "SelectionSet",
1575
+ selections: [{ kind: "Field", name: { kind: "Name", value: "stringValue" } }],
1576
+ },
1577
+ },
1578
+ {
1579
+ kind: "InlineFragment",
1580
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "StringFieldValueAndDefinition" } },
1581
+ selectionSet: {
1582
+ kind: "SelectionSet",
1583
+ selections: [{ kind: "Field", name: { kind: "Name", value: "stringValue" } }],
1584
+ },
1585
+ },
1586
+ {
1587
+ kind: "InlineFragment",
1588
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "WebAddressFieldValueAndDefinition" } },
1589
+ selectionSet: {
1590
+ kind: "SelectionSet",
1591
+ selections: [{ kind: "Field", name: { kind: "Name", value: "stringValue" } }],
1592
+ },
1593
+ },
1594
+ ],
1595
+ },
1596
+ },
1597
+ ],
1598
+ };
955
1599
  const GetCustomFieldDefinitionsDocument = {
956
1600
  kind: "Document",
957
1601
  definitions: [
958
1602
  {
959
1603
  kind: "OperationDefinition",
960
1604
  operation: "query",
961
- name: { kind: "Name", value: "GetCustomFieldDefinitions" },
1605
+ name: { kind: "Name", value: "GetCustomFieldDefinitions" },
1606
+ variableDefinitions: [
1607
+ {
1608
+ kind: "VariableDefinition",
1609
+ variable: { kind: "Variable", name: { kind: "Name", value: "entityType" } },
1610
+ type: { kind: "NamedType", name: { kind: "Name", value: "CustomFieldEntityType" } },
1611
+ defaultValue: { kind: "EnumValue", value: "ASSET" },
1612
+ },
1613
+ {
1614
+ kind: "VariableDefinition",
1615
+ variable: { kind: "Variable", name: { kind: "Name", value: "systemOfMeasurement" } },
1616
+ type: { kind: "NamedType", name: { kind: "Name", value: "SystemOfMeasurement" } },
1617
+ },
1618
+ ],
1619
+ selectionSet: {
1620
+ kind: "SelectionSet",
1621
+ selections: [
1622
+ {
1623
+ kind: "Field",
1624
+ name: { kind: "Name", value: "customFieldDefinitions" },
1625
+ arguments: [
1626
+ {
1627
+ kind: "Argument",
1628
+ name: { kind: "Name", value: "uiVisible" },
1629
+ value: { kind: "BooleanValue", value: true },
1630
+ },
1631
+ { kind: "Argument", name: { kind: "Name", value: "first" }, value: { kind: "IntValue", value: "100" } },
1632
+ {
1633
+ kind: "Argument",
1634
+ name: { kind: "Name", value: "entityType" },
1635
+ value: { kind: "Variable", name: { kind: "Name", value: "entityType" } },
1636
+ },
1637
+ ],
1638
+ selectionSet: {
1639
+ kind: "SelectionSet",
1640
+ selections: [
1641
+ {
1642
+ kind: "Field",
1643
+ name: { kind: "Name", value: "edges" },
1644
+ selectionSet: {
1645
+ kind: "SelectionSet",
1646
+ selections: [
1647
+ {
1648
+ kind: "Field",
1649
+ name: { kind: "Name", value: "node" },
1650
+ selectionSet: {
1651
+ kind: "SelectionSet",
1652
+ selections: [
1653
+ { kind: "FragmentSpread", name: { kind: "Name", value: "CustomFieldDefinition" } },
1654
+ ],
1655
+ },
1656
+ },
1657
+ ],
1658
+ },
1659
+ },
1660
+ ],
1661
+ },
1662
+ },
1663
+ ],
1664
+ },
1665
+ },
1666
+ {
1667
+ kind: "FragmentDefinition",
1668
+ name: { kind: "Name", value: "CustomFieldDefinition" },
1669
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CustomFieldDefinition" } },
1670
+ selectionSet: {
1671
+ kind: "SelectionSet",
1672
+ selections: [
1673
+ { kind: "Field", name: { kind: "Name", value: "__typename" } },
1674
+ { kind: "Field", name: { kind: "Name", value: "description" } },
1675
+ { kind: "Field", name: { kind: "Name", value: "entityType" } },
1676
+ { kind: "Field", name: { kind: "Name", value: "id" } },
1677
+ { kind: "Field", name: { kind: "Name", value: "key" } },
1678
+ {
1679
+ kind: "Field",
1680
+ name: { kind: "Name", value: "owner" },
1681
+ selectionSet: {
1682
+ kind: "SelectionSet",
1683
+ selections: [
1684
+ { kind: "Field", name: { kind: "Name", value: "irisAppId" } },
1685
+ {
1686
+ kind: "Field",
1687
+ name: { kind: "Name", value: "marketplaceEntry" },
1688
+ selectionSet: {
1689
+ kind: "SelectionSet",
1690
+ selections: [{ kind: "Field", name: { kind: "Name", value: "name" } }],
1691
+ },
1692
+ },
1693
+ { kind: "Field", name: { kind: "Name", value: "ownerType" } },
1694
+ ],
1695
+ },
1696
+ },
1697
+ { kind: "Field", name: { kind: "Name", value: "title" } },
1698
+ {
1699
+ kind: "Field",
1700
+ name: { kind: "Name", value: "translations" },
1701
+ selectionSet: {
1702
+ kind: "SelectionSet",
1703
+ selections: [
1704
+ { kind: "Field", name: { kind: "Name", value: "description" } },
1705
+ { kind: "Field", name: { kind: "Name", value: "title" } },
1706
+ { kind: "Field", name: { kind: "Name", value: "language" } },
1707
+ ],
1708
+ },
1709
+ },
1710
+ { kind: "Field", name: { kind: "Name", value: "type" } },
1711
+ { kind: "Field", name: { kind: "Name", value: "uiEditable" } },
1712
+ { kind: "Field", name: { kind: "Name", value: "uiVisible" } },
1713
+ {
1714
+ kind: "InlineFragment",
1715
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "DropDownFieldDefinition" } },
1716
+ selectionSet: {
1717
+ kind: "SelectionSet",
1718
+ selections: [
1719
+ { kind: "Field", name: { kind: "Name", value: "allValues" } },
1720
+ { kind: "Field", name: { kind: "Name", value: "multiSelect" } },
1721
+ ],
1722
+ },
1723
+ },
1724
+ {
1725
+ kind: "InlineFragment",
1726
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "NumberFieldDefinition" } },
1727
+ selectionSet: {
1728
+ kind: "SelectionSet",
1729
+ selections: [
1730
+ { kind: "Field", name: { kind: "Name", value: "isInteger" } },
1731
+ {
1732
+ kind: "Field",
1733
+ name: { kind: "Name", value: "maximumNumber" },
1734
+ arguments: [
1735
+ {
1736
+ kind: "Argument",
1737
+ name: { kind: "Name", value: "systemOfMeasurement" },
1738
+ value: { kind: "Variable", name: { kind: "Name", value: "systemOfMeasurement" } },
1739
+ },
1740
+ ],
1741
+ },
1742
+ {
1743
+ kind: "Field",
1744
+ name: { kind: "Name", value: "minimumNumber" },
1745
+ arguments: [
1746
+ {
1747
+ kind: "Argument",
1748
+ name: { kind: "Name", value: "systemOfMeasurement" },
1749
+ value: { kind: "Variable", name: { kind: "Name", value: "systemOfMeasurement" } },
1750
+ },
1751
+ ],
1752
+ },
1753
+ { kind: "Field", name: { kind: "Name", value: "unitSi" } },
1754
+ { kind: "Field", name: { kind: "Name", value: "unitUs" } },
1755
+ ],
1756
+ },
1757
+ },
1758
+ {
1759
+ kind: "InlineFragment",
1760
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "MonetaryFieldDefinition" } },
1761
+ selectionSet: {
1762
+ kind: "SelectionSet",
1763
+ selections: [
1764
+ { kind: "Field", name: { kind: "Name", value: "currency" } },
1765
+ { kind: "Field", name: { kind: "Name", value: "maximumNumber" } },
1766
+ { kind: "Field", name: { kind: "Name", value: "minimumNumber" } },
1767
+ ],
1768
+ },
1769
+ },
1770
+ {
1771
+ kind: "InlineFragment",
1772
+ typeCondition: { kind: "NamedType", name: { kind: "Name", value: "StringFieldDefinition" } },
1773
+ selectionSet: {
1774
+ kind: "SelectionSet",
1775
+ selections: [
1776
+ { kind: "Field", name: { kind: "Name", value: "maximumLength" } },
1777
+ { kind: "Field", name: { kind: "Name", value: "minimumLength" } },
1778
+ { kind: "Field", name: { kind: "Name", value: "pattern" } },
1779
+ ],
1780
+ },
1781
+ },
1782
+ ],
1783
+ },
1784
+ },
1785
+ ],
1786
+ };
1787
+ const GetCustomFieldDefinitionsForIrisAppDocument = {
1788
+ kind: "Document",
1789
+ definitions: [
1790
+ {
1791
+ kind: "OperationDefinition",
1792
+ operation: "query",
1793
+ name: { kind: "Name", value: "GetCustomFieldDefinitionsForIrisApp" },
962
1794
  variableDefinitions: [
963
1795
  {
964
1796
  kind: "VariableDefinition",
@@ -971,6 +1803,11 @@ const GetCustomFieldDefinitionsDocument = {
971
1803
  variable: { kind: "Variable", name: { kind: "Name", value: "systemOfMeasurement" } },
972
1804
  type: { kind: "NamedType", name: { kind: "Name", value: "SystemOfMeasurement" } },
973
1805
  },
1806
+ {
1807
+ kind: "VariableDefinition",
1808
+ variable: { kind: "Variable", name: { kind: "Name", value: "irisAppId" } },
1809
+ type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } },
1810
+ },
974
1811
  ],
975
1812
  selectionSet: {
976
1813
  kind: "SelectionSet",
@@ -990,6 +1827,25 @@ const GetCustomFieldDefinitionsDocument = {
990
1827
  name: { kind: "Name", value: "entityType" },
991
1828
  value: { kind: "Variable", name: { kind: "Name", value: "entityType" } },
992
1829
  },
1830
+ {
1831
+ kind: "Argument",
1832
+ name: { kind: "Name", value: "owner" },
1833
+ value: {
1834
+ kind: "ObjectValue",
1835
+ fields: [
1836
+ {
1837
+ kind: "ObjectField",
1838
+ name: { kind: "Name", value: "ownerType" },
1839
+ value: { kind: "EnumValue", value: "IRIS_APP" },
1840
+ },
1841
+ {
1842
+ kind: "ObjectField",
1843
+ name: { kind: "Name", value: "irisAppId" },
1844
+ value: { kind: "Variable", name: { kind: "Name", value: "irisAppId" } },
1845
+ },
1846
+ ],
1847
+ },
1848
+ },
993
1849
  ],
994
1850
  selectionSet: {
995
1851
  kind: "SelectionSet",
@@ -1242,9 +2098,164 @@ const UpdateCustomFieldValuesDocument = {
1242
2098
  ],
1243
2099
  };
1244
2100
 
2101
+ const getCustomFieldDefinitionFromRelevantNode$1 = (node) => getFragmentData(CustomFieldDefinitionFragmentDoc, node);
2102
+ /**
2103
+ * Custom hook to fetch all custom field definitions for a specified entity type.
2104
+ *
2105
+ * @param {UseAllCustomFieldDefinitionsProps} props - The properties for the custom fields query.
2106
+ * @param {SupportedEntityTypes} [props.entityType] - The type of the entity (e.g., 'ASSET' or 'SITE').
2107
+ * @returns {UseAllCustomFieldDefinitionsReturnValue} An object containing a loading state and an array of custom field definitions.
2108
+ */
2109
+ const useAllCustomFieldDefinitions = ({ entityType, filterQuery, owners, systemOfMeasurement, onlyEditable, }) => {
2110
+ var _a;
2111
+ const { data: definitions, loading } = useQuery(GetCustomFieldDefinitionsDocument, {
2112
+ variables: {
2113
+ entityType,
2114
+ systemOfMeasurement,
2115
+ },
2116
+ context: {
2117
+ headers: {
2118
+ "TU-PREVIEW": "JUNGLE-DIGGER",
2119
+ },
2120
+ },
2121
+ });
2122
+ const { language } = useCurrentUserLanguage();
2123
+ const definitionsArray = useMemo(() => {
2124
+ var _a, _b;
2125
+ return (((_b = (_a = definitions === null || definitions === void 0 ? void 0 : definitions.customFieldDefinitions) === null || _a === void 0 ? void 0 : _a.edges) === null || _b === void 0 ? void 0 : _b.map(edge => getCustomFieldDefinitionFromRelevantNode$1(edge === null || edge === void 0 ? void 0 : edge.node))) ||
2126
+ []);
2127
+ }, [(_a = definitions === null || definitions === void 0 ? void 0 : definitions.customFieldDefinitions) === null || _a === void 0 ? void 0 : _a.edges]);
2128
+ const filteredDefinitions = useMemo(() => definitionsArray
2129
+ .filter(nonNullable)
2130
+ .filter(def => { var _a; return (owners && ((_a = def.owner) === null || _a === void 0 ? void 0 : _a.ownerType) ? owners.includes(def.owner.ownerType) : true); })
2131
+ .filter(def => (onlyEditable ? def.uiEditable : true))
2132
+ .map(def => {
2133
+ var _a, _b, _c;
2134
+ return (Object.assign(Object.assign({}, def), { title: (_c = (_b = (_a = def.translations) === null || _a === void 0 ? void 0 : _a.find(t => (t === null || t === void 0 ? void 0 : t.language) === language || (t === null || t === void 0 ? void 0 : t.language) === "en")) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : "" }));
2135
+ })
2136
+ .filter(def => (filterQuery ? def.title.toLowerCase().includes(filterQuery.toLowerCase()) : true)), [definitionsArray, filterQuery, language, owners, onlyEditable]);
2137
+ const appNameFromId = useCallback((appId) => {
2138
+ var _a, _b, _c, _d;
2139
+ if (!appId) {
2140
+ return undefined;
2141
+ }
2142
+ const matching = filteredDefinitions.find(definition => { var _a; return ((_a = definition.owner) === null || _a === void 0 ? void 0 : _a.irisAppId) === appId; });
2143
+ if (!matching) {
2144
+ return undefined;
2145
+ }
2146
+ return (_c = (_b = (_a = matching.owner) === null || _a === void 0 ? void 0 : _a.marketplaceEntry) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : (_d = matching.owner) === null || _d === void 0 ? void 0 : _d.irisAppId;
2147
+ }, [filteredDefinitions]);
2148
+ return useMemo(() => ({ definitions: filteredDefinitions, loading, appNameFromId }), [filteredDefinitions, loading, appNameFromId]);
2149
+ };
2150
+
2151
+ /**
2152
+ * A function used to get the CustomFieldValueAndDefinition from a node of CustomFieldValueAndDefinition.
2153
+ *
2154
+ * @param node - The node containing the CustomFieldValueAndDefinition, which may be null or undefined.
2155
+ * @returns {CustomFieldValueAndDefinitionNode} The CustomFieldValueAndDefinition if it exists, or undefined otherwise.
2156
+ */
2157
+ const getAllCustomFieldValueAndDefinitionFromRelevantNode = (node) => getFragmentData(CustomFieldValueAndDefinitionFragmentDoc, node);
2158
+ /**
2159
+ * Custom hook to fetch custom fields and definitions for a specified entity.
2160
+ * This only returns the values that are filled out. If the value is null or undefined, it will not be returned.
2161
+ * It does return all custom fields, even if they are not filled out.
2162
+ *
2163
+ * @param {UseAllCustomFieldsValueAndDefinitionProps} props - The properties for the custom fields query.
2164
+ * @param {string} [props.entityId] - The ID of the entity for which custom fields are fetched. Can be either an asset or a site.
2165
+ * @param {AllSupportedEntityTypes} [props.entityType] - The type of the entity (e.g., 'ASSET' or 'SITE'). Determines which query to execute.
2166
+ * @param {SystemOfMeasurement} props.systemOfMeasurement - The system of measurement to be used in the custom fields.
2167
+ * @returns {UseAllCustomFieldsValueAndDefinitionReturnValue} An object containing a loading state and an array of custom fields and definitions.
2168
+ */
2169
+ const useAllCustomFieldsValueAndDefinition = ({ entityId, entityType, systemOfMeasurement, }) => {
2170
+ var _a, _b, _c, _d;
2171
+ const { data: assetFields, loading: loadingAssetFields } = useQuery(GetCustomFieldsForAssetDocument, {
2172
+ variables: {
2173
+ // eslint-disable-next-line local-rules/no-typescript-assertion
2174
+ entityId: entityId, // Assertion used as ts does not understand the skip removes nulls and undefined.
2175
+ systemOfMeasurement,
2176
+ },
2177
+ skip: entityType !== "ASSET" || !entityId,
2178
+ context: {
2179
+ headers: {
2180
+ "TU-PREVIEW": "JUNGLE-DIGGER",
2181
+ },
2182
+ },
2183
+ });
2184
+ const { data: siteFields, loading: loadingSiteFields } = useQuery(GetCustomFieldsForSiteDocument, {
2185
+ variables: {
2186
+ // eslint-disable-next-line local-rules/no-typescript-assertion
2187
+ entityId: entityId, // Assertion used as ts does not understand the skip removes nulls and undefined.
2188
+ systemOfMeasurement,
2189
+ },
2190
+ skip: entityType !== "SITE" || !entityId,
2191
+ context: {
2192
+ headers: {
2193
+ "TU-PREVIEW": "JUNGLE-DIGGER",
2194
+ },
2195
+ },
2196
+ });
2197
+ const fields = useMemo(() => {
2198
+ var _a, _b, _c, _d, _e, _f;
2199
+ switch (entityType) {
2200
+ case "ASSET":
2201
+ return (((_c = (_b = (_a = assetFields === null || assetFields === void 0 ? void 0 : assetFields.asset) === null || _a === void 0 ? void 0 : _a.customFields) === null || _b === void 0 ? void 0 : _b.edges) === null || _c === void 0 ? void 0 : _c.map(edge => getAllCustomFieldValueAndDefinitionFromRelevantNode(edge === null || edge === void 0 ? void 0 : edge.node))) || []);
2202
+ case "SITE":
2203
+ return (((_f = (_e = (_d = siteFields === null || siteFields === void 0 ? void 0 : siteFields.site) === null || _d === void 0 ? void 0 : _d.customFields) === null || _e === void 0 ? void 0 : _e.edges) === null || _f === void 0 ? void 0 : _f.map(edge => getAllCustomFieldValueAndDefinitionFromRelevantNode(edge === null || edge === void 0 ? void 0 : edge.node))) || []);
2204
+ default:
2205
+ return [];
2206
+ }
2207
+ }, [(_b = (_a = assetFields === null || assetFields === void 0 ? void 0 : assetFields.asset) === null || _a === void 0 ? void 0 : _a.customFields) === null || _b === void 0 ? void 0 : _b.edges, entityType, (_d = (_c = siteFields === null || siteFields === void 0 ? void 0 : siteFields.site) === null || _c === void 0 ? void 0 : _c.customFields) === null || _d === void 0 ? void 0 : _d.edges]);
2208
+ const loading = useMemo(() => loadingAssetFields || loadingSiteFields, [loadingAssetFields, loadingSiteFields]);
2209
+ const noneNullableFields = useMemo(() => fields.filter(nonNullable), [fields]);
2210
+ return useMemo(() => ({ fields: noneNullableFields, loading }), [noneNullableFields, loading]);
2211
+ };
2212
+ /**
2213
+ * Utility function that given a {CustomFieldValueAndDefinition} can tell if it contains a value or not
2214
+ *
2215
+ * @param {AllCustomFieldValueAndDefinition} field - the custom field that might contain a value.
2216
+ * @returns {boolean} true if the field contains a value.
2217
+ */
2218
+ const allCustomFieldHasValue = (field) => {
2219
+ switch (field.__typename) {
2220
+ case "WebAddressFieldValueAndDefinition": {
2221
+ return !!field.stringValue;
2222
+ }
2223
+ case "EmailFieldValueAndDefinition": {
2224
+ return !!field.stringValue;
2225
+ }
2226
+ case "PhoneNumberFieldValueAndDefinition": {
2227
+ return !!field.stringValue;
2228
+ }
2229
+ case "StringFieldValueAndDefinition": {
2230
+ return !!field.stringValue;
2231
+ }
2232
+ case "NumberFieldValueAndDefinition": {
2233
+ return !!field.numberValue || field.numberValue === 0;
2234
+ }
2235
+ case "BooleanFieldValueAndDefinition": {
2236
+ return !(field.booleanValue === null);
2237
+ }
2238
+ case "DropDownFieldValueAndDefinition": {
2239
+ return !!field.stringArrayValue;
2240
+ }
2241
+ case "DateFieldValueAndDefinition": {
2242
+ return !!field.dateValue;
2243
+ }
2244
+ case "JsonFieldValueAndDefinition": {
2245
+ return false;
2246
+ }
2247
+ case "MonetaryFieldValueAndDefinition": {
2248
+ return !!field.numberValue || field.numberValue === 0;
2249
+ }
2250
+ default:
2251
+ return exhaustiveCheck(field);
2252
+ }
2253
+ };
2254
+
1245
2255
  const getCustomFieldDefinitionFromRelevantNode = (node) => getFragmentData(CustomFieldDefinitionFragmentDoc, node);
1246
2256
  /**
1247
2257
  * Custom hook to fetch custom field definitions for a specified entity type.
2258
+ * It only returns the custom field for the current iris app.
1248
2259
  *
1249
2260
  * @param {UseCustomFieldDefinitionsProps} props - The properties for the custom fields query.
1250
2261
  * @param {SupportedEntityTypes} [props.entityType] - The type of the entity (e.g., 'ASSET' or 'SITE').
@@ -1252,11 +2263,14 @@ const getCustomFieldDefinitionFromRelevantNode = (node) => getFragmentData(Custo
1252
2263
  */
1253
2264
  const useCustomFieldDefinitions = ({ entityType, filterQuery, owners, systemOfMeasurement, onlyEditable, }) => {
1254
2265
  var _a;
1255
- const { data: definitions, loading } = useQuery(GetCustomFieldDefinitionsDocument, {
2266
+ const { irisAppId } = useIrisAppId();
2267
+ const { data: definitions, loading } = useQuery(GetCustomFieldDefinitionsForIrisAppDocument, {
1256
2268
  variables: {
1257
2269
  entityType,
1258
2270
  systemOfMeasurement,
2271
+ irisAppId: irisAppId,
1259
2272
  },
2273
+ skip: !irisAppId,
1260
2274
  context: {
1261
2275
  headers: {
1262
2276
  "TU-PREVIEW": "JUNGLE-DIGGER",
@@ -1301,6 +2315,9 @@ const useCustomFieldDefinitions = ({ entityType, filterQuery, owners, systemOfMe
1301
2315
  const getCustomFieldValueAndDefinitionFromRelevantNode = (node) => getFragmentData(CustomFieldValueAndDefinitionFragmentDoc, node);
1302
2316
  /**
1303
2317
  * Custom hook to fetch custom fields and definitions for a specified entity.
2318
+ * This only returns the values that are filled out. If the value is null or undefined, it will not be returned.
2319
+ * It does return all custom fields, even if they are not filled out.
2320
+ * It only returns the custom field for the current iris app.
1304
2321
  *
1305
2322
  * @param {UseCustomFieldsValueAndDefinitionProps} props - The properties for the custom fields query.
1306
2323
  * @param {string} [props.entityId] - The ID of the entity for which custom fields are fetched. Can be either an asset or a site.
@@ -1310,26 +2327,31 @@ const getCustomFieldValueAndDefinitionFromRelevantNode = (node) => getFragmentDa
1310
2327
  */
1311
2328
  const useCustomFieldsValueAndDefinition = ({ entityId, entityType, systemOfMeasurement, }) => {
1312
2329
  var _a, _b, _c, _d;
1313
- const { data: assetFields, loading: loadingAssetFields } = useQuery(GetCustomFieldsForAssetDocument, {
2330
+ const { irisAppId } = useIrisAppId();
2331
+ const { data: assetFields, loading: loadingAssetFields } = useQuery(GetCustomFieldsForAssetForIrisAppDocument, {
1314
2332
  variables: {
1315
2333
  // eslint-disable-next-line local-rules/no-typescript-assertion
1316
2334
  entityId: entityId, // Assertion used as ts does not understand the skip removes nulls and undefined.
1317
2335
  systemOfMeasurement,
2336
+ // eslint-disable-next-line local-rules/no-typescript-assertion
2337
+ irisAppId: irisAppId,
1318
2338
  },
1319
- skip: entityType !== "ASSET" || !entityId,
2339
+ skip: entityType !== "ASSET" || !entityId || !irisAppId,
1320
2340
  context: {
1321
2341
  headers: {
1322
2342
  "TU-PREVIEW": "JUNGLE-DIGGER",
1323
2343
  },
1324
2344
  },
1325
2345
  });
1326
- const { data: siteFields, loading: loadingSiteFields } = useQuery(GetCustomFieldsForSiteDocument, {
2346
+ const { data: siteFields, loading: loadingSiteFields } = useQuery(GetCustomFieldsForSiteForIrisAppDocument, {
1327
2347
  variables: {
1328
2348
  // eslint-disable-next-line local-rules/no-typescript-assertion
1329
2349
  entityId: entityId, // Assertion used as ts does not understand the skip removes nulls and undefined.
1330
2350
  systemOfMeasurement,
2351
+ // eslint-disable-next-line local-rules/no-typescript-assertion
2352
+ irisAppId: irisAppId,
1331
2353
  },
1332
- skip: entityType !== "SITE" || !entityId,
2354
+ skip: entityType !== "SITE" || !entityId || !irisAppId,
1333
2355
  context: {
1334
2356
  headers: {
1335
2357
  "TU-PREVIEW": "JUNGLE-DIGGER",
@@ -1486,4 +2508,4 @@ const useUpdateCustomFieldValues = (entityId, entityType, customFields, systemOf
1486
2508
  }), [updateCustomFields, saveResult, savingCustomFields]);
1487
2509
  };
1488
2510
 
1489
- export { GetCustomFieldDefinitionsDocument, GetCustomFieldsForAssetDocument, GetCustomFieldsForSiteDocument, customFieldHasValue, getCustomFieldValueAndDefinitionFromRelevantNode, useCustomFieldDefinitions, useCustomFieldsValueAndDefinition, useUpdateCustomFieldValues };
2511
+ export { GetCustomFieldDefinitionsDocument, GetCustomFieldsForAssetDocument, GetCustomFieldsForSiteDocument, allCustomFieldHasValue, customFieldHasValue, getAllCustomFieldValueAndDefinitionFromRelevantNode, getCustomFieldValueAndDefinitionFromRelevantNode, useAllCustomFieldDefinitions, useAllCustomFieldsValueAndDefinition, useCustomFieldDefinitions, useCustomFieldsValueAndDefinition, useUpdateCustomFieldValues };