@overmap-ai/core 1.0.35-projects-licensing.20 → 1.0.36-add-image-to-forms.0
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/dist/forms/builder/FieldActions.d.ts +4 -1
- package/dist/forms/constants.d.ts +9 -0
- package/dist/forms/fields/BaseField/BaseField.d.ts +1 -0
- package/dist/forms/fields/BaseField/layouts.d.ts +1 -0
- package/dist/forms/fields/SelectField/BaseSelectField.d.ts +1 -0
- package/dist/forms/fields/constants.d.ts +3 -0
- package/dist/forms/renderer/PatchForm/Provider.d.ts +4 -0
- package/dist/forms/typings.d.ts +1 -0
- package/dist/forms/utils.d.ts +2 -0
- package/dist/overmap-core.js +1058 -847
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +1051 -840
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/sdk.d.ts +1 -2
- package/dist/sdk/services/MainService.d.ts +1 -2
- package/dist/sdk/services/ProjectService.d.ts +3 -2
- package/dist/sdk/services/UserFormService.d.ts +4 -3
- package/dist/sdk/services/index.d.ts +0 -1
- package/dist/store/slices/categorySlice.d.ts +0 -1
- package/dist/store/slices/index.d.ts +0 -1
- package/dist/store/slices/issueSlice.d.ts +4 -2
- package/dist/store/slices/organizationSlice.d.ts +1 -5
- package/dist/store/slices/projectFileSlice.d.ts +0 -1
- package/dist/store/slices/projectSlice.d.ts +1 -7
- package/dist/store/slices/settingsSlice.d.ts +1 -7
- package/dist/store/slices/userFormSlice.d.ts +11 -2
- package/dist/store/slices/workspaceSlice.d.ts +0 -1
- package/dist/store/store.d.ts +1 -4
- package/dist/style.css +161 -48
- package/dist/typings/models/base.d.ts +0 -4
- package/dist/typings/models/forms.d.ts +5 -0
- package/dist/typings/models/index.d.ts +0 -1
- package/dist/typings/models/organizations.d.ts +0 -2
- package/dist/typings/models/projects.d.ts +0 -2
- package/package.json +1 -1
- package/dist/forms/builder/componentConstants.d.ts +0 -8
- package/dist/sdk/services/LicenseService.d.ts +0 -10
- package/dist/store/slices/licenseSlice.d.ts +0 -25
- package/dist/typings/models/license.d.ts +0 -19
|
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
(function(global2, factory) {
|
|
8
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react/jsx-runtime"), require("@overmap-ai/blocks"), require("dependency-graph"), require("@redux-offline/redux-offline"), require("@redux-offline/redux-offline/lib/defaults"), require("localforage"), require("redux-persist-migrate"), require("@reduxjs/toolkit"), require("superagent"), require("react-redux"), require("uuid"), require("color"), require("jwt-decode"), require("@redux-offline/redux-offline/lib/constants"), require("idb"), require("formik"), require("lodash.get"), require("linkify-react"), require("@hello-pangea/dnd"), require("
|
|
9
|
-
})(this, function(exports2, React, jsxRuntime, blocks, dependencyGraph, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, reactRedux, uuid, ColorCls, jwtDecode, constants, idb, formik, get, Linkify, dnd,
|
|
8
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react/jsx-runtime"), require("@overmap-ai/blocks"), require("dependency-graph"), require("@redux-offline/redux-offline"), require("@redux-offline/redux-offline/lib/defaults"), require("localforage"), require("redux-persist-migrate"), require("@reduxjs/toolkit"), require("superagent"), require("react-redux"), require("uuid"), require("color"), require("jwt-decode"), require("@redux-offline/redux-offline/lib/constants"), require("idb"), require("file-saver"), require("formik"), require("lodash.get"), require("linkify-react"), require("@hello-pangea/dnd"), require("lodash.set"), require("lodash.clonedeep"), require("react-dom")) : typeof define === "function" && define.amd ? define(["exports", "react", "react/jsx-runtime", "@overmap-ai/blocks", "dependency-graph", "@redux-offline/redux-offline", "@redux-offline/redux-offline/lib/defaults", "localforage", "redux-persist-migrate", "@reduxjs/toolkit", "superagent", "react-redux", "uuid", "color", "jwt-decode", "@redux-offline/redux-offline/lib/constants", "idb", "file-saver", "formik", "lodash.get", "linkify-react", "@hello-pangea/dnd", "lodash.set", "lodash.clonedeep", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["overmap-core"] = {}, global2.React, global2.jsxRuntime, global2.blocks, global2.dependencyGraph, global2.reduxOffline, global2.offlineConfig, global2.localforage, global2.createMigration, global2.toolkit, global2.request, global2.reactRedux, global2.uuid, global2.ColorCls, global2.jwtDecode, global2.constants, global2.idb, global2.saveAs, global2.formik, global2.get, global2.Linkify, global2.dnd, global2.set, global2.cloneDeep, global2.ReactDOM));
|
|
9
|
+
})(this, function(exports2, React, jsxRuntime, blocks, dependencyGraph, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, reactRedux, uuid, ColorCls, jwtDecode, constants, idb, saveAs, formik, get, Linkify, dnd, set, cloneDeep, ReactDOM) {
|
|
10
10
|
var _a;
|
|
11
11
|
"use strict";
|
|
12
12
|
function _interopNamespaceDefault(e) {
|
|
@@ -622,15 +622,15 @@ var __publicField = (obj, key, value) => {
|
|
|
622
622
|
};
|
|
623
623
|
const migrations = [initialVersioning, signOut, signOut, createOutboxState];
|
|
624
624
|
const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
|
|
625
|
-
const initialState$
|
|
625
|
+
const initialState$l = {
|
|
626
626
|
accessToken: "",
|
|
627
627
|
refreshToken: "",
|
|
628
628
|
isLoggedIn: false
|
|
629
629
|
};
|
|
630
630
|
const authSlice = toolkit.createSlice({
|
|
631
631
|
name: "auth",
|
|
632
|
-
initialState: initialState$
|
|
633
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
632
|
+
initialState: initialState$l,
|
|
633
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
|
|
634
634
|
reducers: {
|
|
635
635
|
setTokens: (state, action) => {
|
|
636
636
|
state.accessToken = action.payload.accessToken;
|
|
@@ -1334,7 +1334,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1334
1334
|
return getLocalDateString(date);
|
|
1335
1335
|
return relative.format(days, "days");
|
|
1336
1336
|
});
|
|
1337
|
-
const initialState$
|
|
1337
|
+
const initialState$k = {
|
|
1338
1338
|
categories: {},
|
|
1339
1339
|
usedCategoryColors: [],
|
|
1340
1340
|
categoryVisibility: {
|
|
@@ -1344,8 +1344,8 @@ var __publicField = (obj, key, value) => {
|
|
|
1344
1344
|
};
|
|
1345
1345
|
const categorySlice = toolkit.createSlice({
|
|
1346
1346
|
name: "categories",
|
|
1347
|
-
initialState: initialState$
|
|
1348
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1347
|
+
initialState: initialState$k,
|
|
1348
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
|
|
1349
1349
|
reducers: {
|
|
1350
1350
|
setCategories: (state, action) => {
|
|
1351
1351
|
if (!Array.isArray(action.payload))
|
|
@@ -1478,13 +1478,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1478
1478
|
return hiddenCategoryCount;
|
|
1479
1479
|
};
|
|
1480
1480
|
const categoryReducer = categorySlice.reducer;
|
|
1481
|
-
const initialState$
|
|
1481
|
+
const initialState$j = {
|
|
1482
1482
|
components: {}
|
|
1483
1483
|
};
|
|
1484
1484
|
const componentSlice = toolkit.createSlice({
|
|
1485
1485
|
name: "components",
|
|
1486
|
-
initialState: initialState$
|
|
1487
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1486
|
+
initialState: initialState$j,
|
|
1487
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
|
|
1488
1488
|
reducers: {
|
|
1489
1489
|
addComponent: (state, action) => {
|
|
1490
1490
|
state.components[action.payload.offline_id] = action.payload;
|
|
@@ -1596,13 +1596,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1596
1596
|
removeAllComponentsOfType
|
|
1597
1597
|
} = componentSlice.actions;
|
|
1598
1598
|
const componentReducer = componentSlice.reducer;
|
|
1599
|
-
const initialState$
|
|
1599
|
+
const initialState$i = {
|
|
1600
1600
|
completionsByComponentId: {}
|
|
1601
1601
|
};
|
|
1602
1602
|
const componentStageCompletionSlice = toolkit.createSlice({
|
|
1603
1603
|
name: "componentStageCompletions",
|
|
1604
|
-
initialState: initialState$
|
|
1605
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1604
|
+
initialState: initialState$i,
|
|
1605
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
|
|
1606
1606
|
reducers: {
|
|
1607
1607
|
addStageCompletion: (state, action) => {
|
|
1608
1608
|
let stageToCompletionDateMapping = state.completionsByComponentId[action.payload.component];
|
|
@@ -1653,13 +1653,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1653
1653
|
return Object.keys(state.componentStageCompletionReducer.completionsByComponentId[component.offline_id] ?? {});
|
|
1654
1654
|
};
|
|
1655
1655
|
const componentStageCompletionReducer = componentStageCompletionSlice.reducer;
|
|
1656
|
-
const initialState$
|
|
1656
|
+
const initialState$h = {
|
|
1657
1657
|
stages: {}
|
|
1658
1658
|
};
|
|
1659
1659
|
const componentStageSlice = toolkit.createSlice({
|
|
1660
1660
|
name: "componentStages",
|
|
1661
|
-
initialState: initialState$
|
|
1662
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1661
|
+
initialState: initialState$h,
|
|
1662
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
|
|
1663
1663
|
reducers: {
|
|
1664
1664
|
addStages: (state, action) => {
|
|
1665
1665
|
Object.assign(state.stages, toOfflineIdRecord(action.payload));
|
|
@@ -1719,14 +1719,14 @@ var __publicField = (obj, key, value) => {
|
|
|
1719
1719
|
);
|
|
1720
1720
|
const { addStages, updateStages, removeStages } = componentStageSlice.actions;
|
|
1721
1721
|
const componentStageReducer = componentStageSlice.reducer;
|
|
1722
|
-
const initialState$
|
|
1722
|
+
const initialState$g = {
|
|
1723
1723
|
componentTypes: {},
|
|
1724
1724
|
hiddenComponentTypeIds: {}
|
|
1725
1725
|
};
|
|
1726
1726
|
const componentTypeSlice = toolkit.createSlice({
|
|
1727
1727
|
name: "componentTypes",
|
|
1728
|
-
initialState: initialState$
|
|
1729
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
1728
|
+
initialState: initialState$g,
|
|
1729
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
|
|
1730
1730
|
reducers: {
|
|
1731
1731
|
addComponentType: (state, action) => {
|
|
1732
1732
|
state.componentTypes[action.payload.offline_id] = action.payload;
|
|
@@ -1785,13 +1785,13 @@ var __publicField = (obj, key, value) => {
|
|
|
1785
1785
|
const selectHiddenComponentTypeIds = (state) => state.componentTypeReducer.hiddenComponentTypeIds;
|
|
1786
1786
|
const { addComponentType, setComponentTypes, toggleComponentTypeVisibility, deleteComponentType } = componentTypeSlice.actions;
|
|
1787
1787
|
const componentTypeReducer = componentTypeSlice.reducer;
|
|
1788
|
-
const initialState$
|
|
1788
|
+
const initialState$f = {
|
|
1789
1789
|
workspaces: {},
|
|
1790
1790
|
activeWorkspaceId: null
|
|
1791
1791
|
};
|
|
1792
1792
|
const workspaceSlice = toolkit.createSlice({
|
|
1793
1793
|
name: "workspace",
|
|
1794
|
-
initialState: initialState$
|
|
1794
|
+
initialState: initialState$f,
|
|
1795
1795
|
// The `reducers` field lets us define reducers and generate associated actions
|
|
1796
1796
|
reducers: {
|
|
1797
1797
|
setWorkspaces: (state, action) => {
|
|
@@ -1848,20 +1848,21 @@ var __publicField = (obj, key, value) => {
|
|
|
1848
1848
|
);
|
|
1849
1849
|
const workspaceReducer = workspaceSlice.reducer;
|
|
1850
1850
|
const maxRecentIssues = 10;
|
|
1851
|
-
const initialState$
|
|
1851
|
+
const initialState$e = {
|
|
1852
1852
|
issues: {},
|
|
1853
1853
|
attachments: {},
|
|
1854
1854
|
comments: {},
|
|
1855
1855
|
visibleStatuses: [IssueStatus.BACKLOG, IssueStatus.SELECTED],
|
|
1856
|
+
isFetchingInitialData: false,
|
|
1856
1857
|
visibleUserIds: null,
|
|
1857
1858
|
recentIssueIds: [],
|
|
1858
1859
|
activeIssueId: null
|
|
1859
1860
|
};
|
|
1860
1861
|
const issueSlice = toolkit.createSlice({
|
|
1861
1862
|
name: "issues",
|
|
1862
|
-
initialState: initialState$
|
|
1863
|
+
initialState: initialState$e,
|
|
1863
1864
|
extraReducers: (builder) => builder.addCase("RESET", (state) => {
|
|
1864
|
-
Object.assign(state, initialState$
|
|
1865
|
+
Object.assign(state, initialState$e);
|
|
1865
1866
|
}),
|
|
1866
1867
|
reducers: {
|
|
1867
1868
|
setIssues: (state, action) => {
|
|
@@ -1940,6 +1941,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1940
1941
|
setVisibleStatuses: (state, action) => {
|
|
1941
1942
|
state.visibleStatuses = action.payload;
|
|
1942
1943
|
},
|
|
1944
|
+
setIsFetchingInitialData: (state, action) => {
|
|
1945
|
+
state.isFetchingInitialData = action.payload;
|
|
1946
|
+
},
|
|
1943
1947
|
setVisibleUserIds: (state, action) => {
|
|
1944
1948
|
state.visibleUserIds = [...new Set(action.payload)];
|
|
1945
1949
|
},
|
|
@@ -1998,6 +2002,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1998
2002
|
resetRecentIssues,
|
|
1999
2003
|
setActiveIssueId,
|
|
2000
2004
|
setAttachments,
|
|
2005
|
+
setIsFetchingInitialData,
|
|
2001
2006
|
setIssueComments,
|
|
2002
2007
|
setIssues,
|
|
2003
2008
|
setVisibleStatuses,
|
|
@@ -2096,6 +2101,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2096
2101
|
return mapping[id];
|
|
2097
2102
|
})
|
|
2098
2103
|
);
|
|
2104
|
+
const selectIsFetchingInitialData = (state) => state.issueReducer.isFetchingInitialData;
|
|
2099
2105
|
const selectAllAttachments = toolkit.createSelector([selectIssueAttachmentMapping], (mapping) => Object.values(mapping));
|
|
2100
2106
|
const searchIssues = restructureCreateSelectorWithArgs(
|
|
2101
2107
|
toolkit.createSelector(
|
|
@@ -2187,15 +2193,15 @@ var __publicField = (obj, key, value) => {
|
|
|
2187
2193
|
}
|
|
2188
2194
|
);
|
|
2189
2195
|
const issueReducer = issueSlice.reducer;
|
|
2190
|
-
const initialState$
|
|
2196
|
+
const initialState$d = {
|
|
2191
2197
|
s3Urls: {}
|
|
2192
2198
|
};
|
|
2193
2199
|
const msPerHour = 1e3 * 60 * 60;
|
|
2194
2200
|
const msPerWeek = msPerHour * 24 * 7;
|
|
2195
2201
|
const fileSlice = toolkit.createSlice({
|
|
2196
2202
|
name: "file",
|
|
2197
|
-
initialState: initialState$
|
|
2198
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2203
|
+
initialState: initialState$d,
|
|
2204
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
|
|
2199
2205
|
reducers: {
|
|
2200
2206
|
setUploadUrl: (state, action) => {
|
|
2201
2207
|
const { url, fields, sha1 } = action.payload;
|
|
@@ -2222,7 +2228,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2222
2228
|
return url;
|
|
2223
2229
|
};
|
|
2224
2230
|
const fileReducer = fileSlice.reducer;
|
|
2225
|
-
const initialState$
|
|
2231
|
+
const initialState$c = {
|
|
2226
2232
|
// TODO: Change first MapStyle.SATELLITE to MaptStyle.None when project creation map is fixed
|
|
2227
2233
|
mapStyle: MapStyle.SATELLITE,
|
|
2228
2234
|
showTooltips: false,
|
|
@@ -2230,8 +2236,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2230
2236
|
};
|
|
2231
2237
|
const mapSlice = toolkit.createSlice({
|
|
2232
2238
|
name: "map",
|
|
2233
|
-
initialState: initialState$
|
|
2234
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2239
|
+
initialState: initialState$c,
|
|
2240
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
|
|
2235
2241
|
reducers: {
|
|
2236
2242
|
setMapStyle: (state, action) => {
|
|
2237
2243
|
state.mapStyle = action.payload;
|
|
@@ -2273,18 +2279,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2273
2279
|
VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
|
|
2274
2280
|
return VerificationCodeType2;
|
|
2275
2281
|
})(VerificationCodeType || {});
|
|
2276
|
-
|
|
2277
|
-
LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
|
|
2278
|
-
return LicenseLevel2;
|
|
2279
|
-
})(LicenseLevel || {});
|
|
2280
|
-
var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
|
|
2281
|
-
LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
|
|
2282
|
-
LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
|
|
2283
|
-
LicenseStatus2[LicenseStatus2["CANCELED"] = 4] = "CANCELED";
|
|
2284
|
-
LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
|
|
2285
|
-
return LicenseStatus2;
|
|
2286
|
-
})(LicenseStatus || {});
|
|
2287
|
-
const initialState$c = {
|
|
2282
|
+
const initialState$b = {
|
|
2288
2283
|
users: {},
|
|
2289
2284
|
currentUser: {
|
|
2290
2285
|
id: 0,
|
|
@@ -2295,8 +2290,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2295
2290
|
};
|
|
2296
2291
|
const userSlice = toolkit.createSlice({
|
|
2297
2292
|
name: "users",
|
|
2298
|
-
initialState: initialState$
|
|
2299
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2293
|
+
initialState: initialState$b,
|
|
2294
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
|
|
2300
2295
|
reducers: {
|
|
2301
2296
|
setUsers: (state, action) => {
|
|
2302
2297
|
const usersMapping = {};
|
|
@@ -2358,13 +2353,13 @@ var __publicField = (obj, key, value) => {
|
|
|
2358
2353
|
const selectUsersAsMapping = (state) => state.userReducer.users;
|
|
2359
2354
|
const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
|
|
2360
2355
|
const userReducer = userSlice.reducer;
|
|
2361
|
-
const initialState$
|
|
2356
|
+
const initialState$a = {
|
|
2362
2357
|
organizationAccesses: {}
|
|
2363
2358
|
};
|
|
2364
2359
|
const organizationAccessSlice = toolkit.createSlice({
|
|
2365
2360
|
name: "organizationAccess",
|
|
2366
|
-
initialState: initialState$
|
|
2367
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2361
|
+
initialState: initialState$a,
|
|
2362
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
|
|
2368
2363
|
reducers: {
|
|
2369
2364
|
setOrganizationAccesses: (state, action) => {
|
|
2370
2365
|
if (!Array.isArray(action.payload))
|
|
@@ -2427,13 +2422,151 @@ var __publicField = (obj, key, value) => {
|
|
|
2427
2422
|
return organizationAccesses;
|
|
2428
2423
|
};
|
|
2429
2424
|
const organizationAccessReducer = organizationAccessSlice.reducer;
|
|
2430
|
-
const initialState$
|
|
2425
|
+
const initialState$9 = {
|
|
2426
|
+
organizations: {},
|
|
2427
|
+
activeOrganizationId: null
|
|
2428
|
+
};
|
|
2429
|
+
const organizationSlice = toolkit.createSlice({
|
|
2430
|
+
name: "organizations",
|
|
2431
|
+
initialState: initialState$9,
|
|
2432
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
|
|
2433
|
+
reducers: {
|
|
2434
|
+
setOrganizations: (state, action) => {
|
|
2435
|
+
for (const org of action.payload) {
|
|
2436
|
+
state.organizations[org.id] = org;
|
|
2437
|
+
}
|
|
2438
|
+
},
|
|
2439
|
+
updateActiveOrganization: (state, action) => {
|
|
2440
|
+
if (!state.activeOrganizationId) {
|
|
2441
|
+
throw new Error("Cannot update name of active organization. Active organization ID does not exist");
|
|
2442
|
+
}
|
|
2443
|
+
if (state.activeOrganizationId !== action.payload.id) {
|
|
2444
|
+
throw new Error("Tried updating active organization with different organization");
|
|
2445
|
+
}
|
|
2446
|
+
state.organizations[state.activeOrganizationId] = action.payload;
|
|
2447
|
+
},
|
|
2448
|
+
setActiveOrganizationId: (state, action) => {
|
|
2449
|
+
state.activeOrganizationId = action.payload;
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
});
|
|
2453
|
+
const { setOrganizations, setActiveOrganizationId, updateActiveOrganization } = organizationSlice.actions;
|
|
2454
|
+
const selectActiveOrganizationId = (state) => {
|
|
2455
|
+
return state.organizationReducer.activeOrganizationId;
|
|
2456
|
+
};
|
|
2457
|
+
const selectOrganizations = (state) => {
|
|
2458
|
+
return Object.values(state.organizationReducer.organizations);
|
|
2459
|
+
};
|
|
2460
|
+
const selectOrganizationsWithAccess = toolkit.createSelector(
|
|
2461
|
+
[selectOrganizations],
|
|
2462
|
+
(organizations) => Object.values(organizations).filter((organization) => organization.has_access)
|
|
2463
|
+
);
|
|
2464
|
+
const selectActiveOrganization = (state) => {
|
|
2465
|
+
const id = selectActiveOrganizationId(state);
|
|
2466
|
+
if (!id) {
|
|
2467
|
+
return null;
|
|
2468
|
+
}
|
|
2469
|
+
const organization = state.organizationReducer.organizations[id];
|
|
2470
|
+
if (!organization) {
|
|
2471
|
+
return null;
|
|
2472
|
+
}
|
|
2473
|
+
return organization;
|
|
2474
|
+
};
|
|
2475
|
+
const selectOrganizationUsersIds = toolkit.createSelector(
|
|
2476
|
+
[selectOrganizationAccesses],
|
|
2477
|
+
(organizationAccesses) => Object.values(organizationAccesses).map((organizationAccess) => organizationAccess.user)
|
|
2478
|
+
);
|
|
2479
|
+
const selectOrganizationUsersAsMapping = toolkit.createSelector(
|
|
2480
|
+
[selectOrganizationUsersIds, selectUsersAsMapping],
|
|
2481
|
+
(organizationUserIds, users) => organizationUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
|
|
2482
|
+
);
|
|
2483
|
+
const selectSortedOrganizationUsers = toolkit.createSelector(
|
|
2484
|
+
[selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
|
|
2485
|
+
(currentUser, userMapping, organizationAccessMapping) => {
|
|
2486
|
+
return Object.values(userMapping).sort((userA, userB) => {
|
|
2487
|
+
if (userA.id === currentUser.id) {
|
|
2488
|
+
return -1;
|
|
2489
|
+
} else if (userB.id === currentUser.id) {
|
|
2490
|
+
return 1;
|
|
2491
|
+
}
|
|
2492
|
+
const organizationAccessesA = organizationAccessMapping[userA.id];
|
|
2493
|
+
const organizationAccessesB = organizationAccessMapping[userB.id];
|
|
2494
|
+
if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === (organizationAccessesB == null ? void 0 : organizationAccessesB.access_level)) {
|
|
2495
|
+
return userA.username.localeCompare(userB.username);
|
|
2496
|
+
}
|
|
2497
|
+
if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === OrganizationAccessLevel.ADMIN) {
|
|
2498
|
+
return -1;
|
|
2499
|
+
}
|
|
2500
|
+
return 1;
|
|
2501
|
+
});
|
|
2502
|
+
}
|
|
2503
|
+
);
|
|
2504
|
+
const selectOrganization = (id) => (state) => {
|
|
2505
|
+
return state.organizationReducer.organizations[id];
|
|
2506
|
+
};
|
|
2507
|
+
const organizationReducer = organizationSlice.reducer;
|
|
2508
|
+
const createOfflineAction = (request2, baseUrl) => {
|
|
2509
|
+
const requestWithUuid = request2.uuid ? request2 : { ...request2, uuid: uuid.v4() };
|
|
2510
|
+
return {
|
|
2511
|
+
payload: requestWithUuid,
|
|
2512
|
+
type: "",
|
|
2513
|
+
meta: {
|
|
2514
|
+
offline: {
|
|
2515
|
+
effect: {
|
|
2516
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2517
|
+
request: requestWithUuid,
|
|
2518
|
+
BASE_URL: baseUrl
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
};
|
|
2523
|
+
};
|
|
2524
|
+
const initialState$8 = {
|
|
2525
|
+
deletedRequests: [],
|
|
2526
|
+
latestRetryTime: 0
|
|
2527
|
+
};
|
|
2528
|
+
const outboxSlice = toolkit.createSlice({
|
|
2529
|
+
name: "outbox",
|
|
2530
|
+
initialState: initialState$8,
|
|
2531
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
|
|
2532
|
+
reducers: {
|
|
2533
|
+
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
2534
|
+
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
2535
|
+
// Then this reducer enqueueRequest() is responsible for adding the actual request data to the outbox
|
|
2536
|
+
enqueueRequest: {
|
|
2537
|
+
reducer: (state, _action) => {
|
|
2538
|
+
return state;
|
|
2539
|
+
},
|
|
2540
|
+
prepare: (payload) => {
|
|
2541
|
+
console.debug("Preparing to enqueue request", payload);
|
|
2542
|
+
const { BASE_URL, ...rest } = payload;
|
|
2543
|
+
return createOfflineAction(rest, BASE_URL);
|
|
2544
|
+
}
|
|
2545
|
+
},
|
|
2546
|
+
markForDeletion(state, action) {
|
|
2547
|
+
state.deletedRequests.push(action.payload);
|
|
2548
|
+
},
|
|
2549
|
+
markAsDeleted(state, action) {
|
|
2550
|
+
const index2 = state.deletedRequests.indexOf(action.payload);
|
|
2551
|
+
if (index2 !== -1)
|
|
2552
|
+
state.deletedRequests.splice(index2, 1);
|
|
2553
|
+
},
|
|
2554
|
+
_setLatestRetryTime: (state, action) => {
|
|
2555
|
+
state.latestRetryTime = action.payload;
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
});
|
|
2559
|
+
const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
|
|
2560
|
+
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
2561
|
+
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
2562
|
+
const outboxReducer = outboxSlice.reducer;
|
|
2563
|
+
const initialState$7 = {
|
|
2431
2564
|
projectAccesses: {}
|
|
2432
2565
|
};
|
|
2433
2566
|
const projectAccessSlice = toolkit.createSlice({
|
|
2434
2567
|
name: "projectAccess",
|
|
2435
|
-
initialState: initialState$
|
|
2436
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2568
|
+
initialState: initialState$7,
|
|
2569
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
|
|
2437
2570
|
reducers: {
|
|
2438
2571
|
setProjectAccesses: (state, action) => {
|
|
2439
2572
|
if (!Array.isArray(action.payload))
|
|
@@ -2501,7 +2634,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2501
2634
|
return projectAccesses;
|
|
2502
2635
|
};
|
|
2503
2636
|
const projectAccessReducer = projectAccessSlice.reducer;
|
|
2504
|
-
const initialState$
|
|
2637
|
+
const initialState$6 = {
|
|
2505
2638
|
projects: {},
|
|
2506
2639
|
activeProjectId: null,
|
|
2507
2640
|
recentProjectIds: [],
|
|
@@ -2510,7 +2643,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2510
2643
|
};
|
|
2511
2644
|
const projectSlice = toolkit.createSlice({
|
|
2512
2645
|
name: "projects",
|
|
2513
|
-
initialState: initialState$
|
|
2646
|
+
initialState: initialState$6,
|
|
2514
2647
|
reducers: {
|
|
2515
2648
|
setProjects: (state, action) => {
|
|
2516
2649
|
const projectsMap = {};
|
|
@@ -2556,20 +2689,6 @@ var __publicField = (obj, key, value) => {
|
|
|
2556
2689
|
} else {
|
|
2557
2690
|
throw new Error("Accept project invite: user is not in this project");
|
|
2558
2691
|
}
|
|
2559
|
-
},
|
|
2560
|
-
updateActiveProjectIssuesCount: (state, action) => {
|
|
2561
|
-
if (state.activeProjectId) {
|
|
2562
|
-
state.projects[state.activeProjectId].issues_count += action.payload;
|
|
2563
|
-
} else {
|
|
2564
|
-
throw new Error("Update issues count: no active project");
|
|
2565
|
-
}
|
|
2566
|
-
},
|
|
2567
|
-
updateActiveProjectFormSubmissionsCount: (state, action) => {
|
|
2568
|
-
if (state.activeProjectId) {
|
|
2569
|
-
state.projects[state.activeProjectId].form_submissions_count += action.payload;
|
|
2570
|
-
} else {
|
|
2571
|
-
throw new Error("Update form submissions count: no active project");
|
|
2572
|
-
}
|
|
2573
2692
|
}
|
|
2574
2693
|
}
|
|
2575
2694
|
});
|
|
@@ -2580,9 +2699,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2580
2699
|
setActiveProjectId,
|
|
2581
2700
|
setCreateProjectType,
|
|
2582
2701
|
deleteProject,
|
|
2583
|
-
acceptProjectInvite
|
|
2584
|
-
updateActiveProjectIssuesCount,
|
|
2585
|
-
updateActiveProjectFormSubmissionsCount
|
|
2702
|
+
acceptProjectInvite
|
|
2586
2703
|
} = projectSlice.actions;
|
|
2587
2704
|
const selectProjects = (state) => state.projectReducer.projects;
|
|
2588
2705
|
const selectActiveProjectId = (state) => state.projectReducer.activeProjectId;
|
|
@@ -2646,264 +2763,39 @@ var __publicField = (obj, key, value) => {
|
|
|
2646
2763
|
});
|
|
2647
2764
|
}
|
|
2648
2765
|
);
|
|
2649
|
-
const initialState$
|
|
2650
|
-
|
|
2766
|
+
const initialState$5 = {
|
|
2767
|
+
projectFiles: {},
|
|
2768
|
+
activeProjectFileId: null,
|
|
2769
|
+
isImportingProjectFile: false,
|
|
2770
|
+
enabledProjectFiles: {}
|
|
2651
2771
|
};
|
|
2652
|
-
const
|
|
2653
|
-
name: "
|
|
2654
|
-
initialState: initialState$
|
|
2655
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$
|
|
2772
|
+
const projectFileSlice = toolkit.createSlice({
|
|
2773
|
+
name: "projectFiles",
|
|
2774
|
+
initialState: initialState$5,
|
|
2775
|
+
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
|
|
2656
2776
|
reducers: {
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2777
|
+
addOrReplaceProjectFiles: (state, action) => {
|
|
2778
|
+
for (let fileObj of action.payload) {
|
|
2779
|
+
let file = fileObj.file;
|
|
2780
|
+
if (file.includes("+")) {
|
|
2781
|
+
console.warn("Attempting to apply fix for image URL with '+' character:", file);
|
|
2782
|
+
const parts = file.split("/");
|
|
2783
|
+
if (parts.length < 2) {
|
|
2784
|
+
throw new Error("Invalid URL: " + file);
|
|
2785
|
+
}
|
|
2786
|
+
const lastPart = encodeURIComponent(parts[parts.length - 1]);
|
|
2787
|
+
file = parts.slice(0, -1).join("/") + "/" + lastPart;
|
|
2788
|
+
console.warn("Fixed URL:", file);
|
|
2789
|
+
fileObj = { ...fileObj, file };
|
|
2790
|
+
}
|
|
2791
|
+
state.projectFiles[fileObj.offline_id] = fileObj;
|
|
2666
2792
|
}
|
|
2667
|
-
state.licenses = licenses;
|
|
2668
2793
|
},
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2794
|
+
addOrReplaceProjectFile: (state, action) => {
|
|
2795
|
+
if (!action.payload.project) {
|
|
2796
|
+
throw new Error("ProjectFile has no project. A project must be set before storing.");
|
|
2672
2797
|
}
|
|
2673
|
-
|
|
2674
|
-
updateLicense: (state, action) => {
|
|
2675
|
-
if (!(action.payload.offline_id in state.licenses)) {
|
|
2676
|
-
throw new Error("Tried to update license that does not exist.");
|
|
2677
|
-
}
|
|
2678
|
-
state.licenses[action.payload.offline_id] = action.payload;
|
|
2679
|
-
}
|
|
2680
|
-
}
|
|
2681
|
-
});
|
|
2682
|
-
const { setLicenses, addLicenses, updateLicense } = licenseSlice.actions;
|
|
2683
|
-
const selectLicenses = (state) => {
|
|
2684
|
-
return state.licenseReducer.licenses;
|
|
2685
|
-
};
|
|
2686
|
-
const selectLicense = (licenseId) => (state) => state.licenseReducer.licenses[licenseId];
|
|
2687
|
-
const selectActiveLicense = toolkit.createSelector(
|
|
2688
|
-
[selectLicenses, selectActiveProjectId],
|
|
2689
|
-
(licenses, activeProjectId) => {
|
|
2690
|
-
const activeLicense = Object.values(licenses).find((license) => license.project === activeProjectId);
|
|
2691
|
-
return activeLicense ?? null;
|
|
2692
|
-
}
|
|
2693
|
-
);
|
|
2694
|
-
const selectLicenseForProject = restructureCreateSelectorWithArgs(
|
|
2695
|
-
toolkit.createSelector(
|
|
2696
|
-
[selectLicenses, (_state, projectId) => projectId],
|
|
2697
|
-
(licenses, projectId) => Object.values(licenses).find((license) => license.project === projectId) ?? null
|
|
2698
|
-
)
|
|
2699
|
-
);
|
|
2700
|
-
const selectActiveStatusLicenses = toolkit.createSelector(
|
|
2701
|
-
[selectLicenses],
|
|
2702
|
-
(licenses) => Object.values(licenses).filter((license) => license.is_active)
|
|
2703
|
-
);
|
|
2704
|
-
const selectLicencesMapping = toolkit.createSelector(
|
|
2705
|
-
[selectLicenses],
|
|
2706
|
-
(licenses) => Object.values(licenses).filter((license) => license.project).reduce((accum, license) => ({ ...accum, [license.project]: license }), {})
|
|
2707
|
-
);
|
|
2708
|
-
const licenseReducer = licenseSlice.reducer;
|
|
2709
|
-
const initialState$7 = {
|
|
2710
|
-
organizations: {},
|
|
2711
|
-
activeOrganizationId: null
|
|
2712
|
-
};
|
|
2713
|
-
const organizationSlice = toolkit.createSlice({
|
|
2714
|
-
name: "organizations",
|
|
2715
|
-
initialState: initialState$7,
|
|
2716
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
|
|
2717
|
-
reducers: {
|
|
2718
|
-
setOrganizations: (state, action) => {
|
|
2719
|
-
for (const org of action.payload) {
|
|
2720
|
-
state.organizations[org.id] = org;
|
|
2721
|
-
}
|
|
2722
|
-
},
|
|
2723
|
-
updateActiveOrganization: (state, action) => {
|
|
2724
|
-
if (!state.activeOrganizationId) {
|
|
2725
|
-
throw new Error("Cannot update name of active organization. Active organization ID does not exist");
|
|
2726
|
-
}
|
|
2727
|
-
if (state.activeOrganizationId !== action.payload.id) {
|
|
2728
|
-
throw new Error("Tried updating active organization with different organization");
|
|
2729
|
-
}
|
|
2730
|
-
state.organizations[state.activeOrganizationId] = action.payload;
|
|
2731
|
-
},
|
|
2732
|
-
setActiveOrganizationId: (state, action) => {
|
|
2733
|
-
state.activeOrganizationId = action.payload;
|
|
2734
|
-
}
|
|
2735
|
-
}
|
|
2736
|
-
});
|
|
2737
|
-
const { setOrganizations, setActiveOrganizationId, updateActiveOrganization } = organizationSlice.actions;
|
|
2738
|
-
const selectActiveOrganizationId = (state) => {
|
|
2739
|
-
return state.organizationReducer.activeOrganizationId;
|
|
2740
|
-
};
|
|
2741
|
-
const selectOrganizations = (state) => {
|
|
2742
|
-
return Object.values(state.organizationReducer.organizations);
|
|
2743
|
-
};
|
|
2744
|
-
const selectOrganizationsMapping = (state) => {
|
|
2745
|
-
return state.organizationReducer.organizations;
|
|
2746
|
-
};
|
|
2747
|
-
const selectOrganizationsWithAccess = toolkit.createSelector(
|
|
2748
|
-
[selectOrganizations],
|
|
2749
|
-
(organizations) => Object.values(organizations).filter((organization) => organization.has_access)
|
|
2750
|
-
);
|
|
2751
|
-
const selectActiveOrganization = (state) => {
|
|
2752
|
-
const id = selectActiveOrganizationId(state);
|
|
2753
|
-
if (!id) {
|
|
2754
|
-
return null;
|
|
2755
|
-
}
|
|
2756
|
-
const organization = state.organizationReducer.organizations[id];
|
|
2757
|
-
if (!organization) {
|
|
2758
|
-
return null;
|
|
2759
|
-
}
|
|
2760
|
-
return organization;
|
|
2761
|
-
};
|
|
2762
|
-
const selectOrganizationUsersIds = toolkit.createSelector(
|
|
2763
|
-
[selectOrganizationAccesses],
|
|
2764
|
-
(organizationAccesses) => Object.values(organizationAccesses).map((organizationAccess) => organizationAccess.user)
|
|
2765
|
-
);
|
|
2766
|
-
const selectActiveOrganizationProjects = toolkit.createSelector(
|
|
2767
|
-
[selectProjects, selectActiveOrganizationId],
|
|
2768
|
-
(projects, activeOrganizationId) => activeOrganizationId ? Object.values(projects).filter((project) => project.owner_organization === activeOrganizationId) : []
|
|
2769
|
-
);
|
|
2770
|
-
const selectActiveOrganizationLicenses = toolkit.createSelector(
|
|
2771
|
-
[selectActiveOrganizationId, selectLicenses],
|
|
2772
|
-
(activeOrganizationId, licenses) => !activeOrganizationId ? [] : Object.values(licenses).filter((license) => license.organization_owner === activeOrganizationId)
|
|
2773
|
-
);
|
|
2774
|
-
const selectSortedOrganizationLicenses = toolkit.createSelector(
|
|
2775
|
-
[selectActiveOrganizationLicenses, selectProjects],
|
|
2776
|
-
(licences, projects) => licences.sort((licenseA, licenseB) => {
|
|
2777
|
-
if (!licenseA.project) {
|
|
2778
|
-
return 1;
|
|
2779
|
-
}
|
|
2780
|
-
if (!licenseB.project) {
|
|
2781
|
-
return -1;
|
|
2782
|
-
}
|
|
2783
|
-
return projects[licenseA.project].name.toLowerCase().localeCompare(
|
|
2784
|
-
projects[licenseB.project].name.toLowerCase(),
|
|
2785
|
-
void 0,
|
|
2786
|
-
{ numeric: true }
|
|
2787
|
-
);
|
|
2788
|
-
})
|
|
2789
|
-
);
|
|
2790
|
-
const selectOrganizationUsersAsMapping = toolkit.createSelector(
|
|
2791
|
-
[selectOrganizationUsersIds, selectUsersAsMapping],
|
|
2792
|
-
(organizationUserIds, users) => organizationUserIds.reduce((accum, userId) => ({ ...accum, [userId]: users[userId] }), {})
|
|
2793
|
-
);
|
|
2794
|
-
const selectSortedOrganizationUsers = toolkit.createSelector(
|
|
2795
|
-
[selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
|
|
2796
|
-
(currentUser, userMapping, organizationAccessMapping) => {
|
|
2797
|
-
return Object.values(userMapping).sort((userA, userB) => {
|
|
2798
|
-
if (userA.id === currentUser.id) {
|
|
2799
|
-
return -1;
|
|
2800
|
-
} else if (userB.id === currentUser.id) {
|
|
2801
|
-
return 1;
|
|
2802
|
-
}
|
|
2803
|
-
const organizationAccessesA = organizationAccessMapping[userA.id];
|
|
2804
|
-
const organizationAccessesB = organizationAccessMapping[userB.id];
|
|
2805
|
-
if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === (organizationAccessesB == null ? void 0 : organizationAccessesB.access_level)) {
|
|
2806
|
-
return userA.username.localeCompare(userB.username);
|
|
2807
|
-
}
|
|
2808
|
-
if ((organizationAccessesA == null ? void 0 : organizationAccessesA.access_level) === OrganizationAccessLevel.ADMIN) {
|
|
2809
|
-
return -1;
|
|
2810
|
-
}
|
|
2811
|
-
return 1;
|
|
2812
|
-
});
|
|
2813
|
-
}
|
|
2814
|
-
);
|
|
2815
|
-
const selectOrganization = (id) => (state) => {
|
|
2816
|
-
return state.organizationReducer.organizations[id];
|
|
2817
|
-
};
|
|
2818
|
-
const organizationReducer = organizationSlice.reducer;
|
|
2819
|
-
const createOfflineAction = (request2, baseUrl) => {
|
|
2820
|
-
const requestWithUuid = request2.uuid ? request2 : { ...request2, uuid: uuid.v4() };
|
|
2821
|
-
return {
|
|
2822
|
-
payload: requestWithUuid,
|
|
2823
|
-
type: "",
|
|
2824
|
-
meta: {
|
|
2825
|
-
offline: {
|
|
2826
|
-
effect: {
|
|
2827
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2828
|
-
request: requestWithUuid,
|
|
2829
|
-
BASE_URL: baseUrl
|
|
2830
|
-
}
|
|
2831
|
-
}
|
|
2832
|
-
}
|
|
2833
|
-
};
|
|
2834
|
-
};
|
|
2835
|
-
const initialState$6 = {
|
|
2836
|
-
deletedRequests: [],
|
|
2837
|
-
latestRetryTime: 0
|
|
2838
|
-
};
|
|
2839
|
-
const outboxSlice = toolkit.createSlice({
|
|
2840
|
-
name: "outbox",
|
|
2841
|
-
initialState: initialState$6,
|
|
2842
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
|
|
2843
|
-
reducers: {
|
|
2844
|
-
// enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
|
|
2845
|
-
// Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
|
|
2846
|
-
// Then this reducer enqueueRequest() is responsible for adding the actual request data to the outbox
|
|
2847
|
-
enqueueRequest: {
|
|
2848
|
-
reducer: (state, _action) => {
|
|
2849
|
-
return state;
|
|
2850
|
-
},
|
|
2851
|
-
prepare: (payload) => {
|
|
2852
|
-
console.debug("Preparing to enqueue request", payload);
|
|
2853
|
-
const { BASE_URL, ...rest } = payload;
|
|
2854
|
-
return createOfflineAction(rest, BASE_URL);
|
|
2855
|
-
}
|
|
2856
|
-
},
|
|
2857
|
-
markForDeletion(state, action) {
|
|
2858
|
-
state.deletedRequests.push(action.payload);
|
|
2859
|
-
},
|
|
2860
|
-
markAsDeleted(state, action) {
|
|
2861
|
-
const index2 = state.deletedRequests.indexOf(action.payload);
|
|
2862
|
-
if (index2 !== -1)
|
|
2863
|
-
state.deletedRequests.splice(index2, 1);
|
|
2864
|
-
},
|
|
2865
|
-
_setLatestRetryTime: (state, action) => {
|
|
2866
|
-
state.latestRetryTime = action.payload;
|
|
2867
|
-
}
|
|
2868
|
-
}
|
|
2869
|
-
});
|
|
2870
|
-
const selectDeletedRequests = (state) => state.outboxReducer.deletedRequests;
|
|
2871
|
-
const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
|
|
2872
|
-
const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
|
|
2873
|
-
const outboxReducer = outboxSlice.reducer;
|
|
2874
|
-
const initialState$5 = {
|
|
2875
|
-
projectFiles: {},
|
|
2876
|
-
activeProjectFileId: null,
|
|
2877
|
-
isImportingProjectFile: false,
|
|
2878
|
-
enabledProjectFiles: {}
|
|
2879
|
-
};
|
|
2880
|
-
const projectFileSlice = toolkit.createSlice({
|
|
2881
|
-
name: "projectFiles",
|
|
2882
|
-
initialState: initialState$5,
|
|
2883
|
-
extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
|
|
2884
|
-
reducers: {
|
|
2885
|
-
addOrReplaceProjectFiles: (state, action) => {
|
|
2886
|
-
for (let fileObj of action.payload) {
|
|
2887
|
-
let file = fileObj.file;
|
|
2888
|
-
if (file.includes("+")) {
|
|
2889
|
-
console.warn("Attempting to apply fix for image URL with '+' character:", file);
|
|
2890
|
-
const parts = file.split("/");
|
|
2891
|
-
if (parts.length < 2) {
|
|
2892
|
-
throw new Error("Invalid URL: " + file);
|
|
2893
|
-
}
|
|
2894
|
-
const lastPart = encodeURIComponent(parts[parts.length - 1]);
|
|
2895
|
-
file = parts.slice(0, -1).join("/") + "/" + lastPart;
|
|
2896
|
-
console.warn("Fixed URL:", file);
|
|
2897
|
-
fileObj = { ...fileObj, file };
|
|
2898
|
-
}
|
|
2899
|
-
state.projectFiles[fileObj.offline_id] = fileObj;
|
|
2900
|
-
}
|
|
2901
|
-
},
|
|
2902
|
-
addOrReplaceProjectFile: (state, action) => {
|
|
2903
|
-
if (!action.payload.project) {
|
|
2904
|
-
throw new Error("ProjectFile has no project. A project must be set before storing.");
|
|
2905
|
-
}
|
|
2906
|
-
state.projectFiles[action.payload.offline_id] = action.payload;
|
|
2798
|
+
state.projectFiles[action.payload.offline_id] = action.payload;
|
|
2907
2799
|
},
|
|
2908
2800
|
setProjectFileVisible: (state, action) => {
|
|
2909
2801
|
state.enabledProjectFiles[action.payload.fileId] = action.payload.visible;
|
|
@@ -3007,9 +2899,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3007
2899
|
Components: false,
|
|
3008
2900
|
Experimental: false
|
|
3009
2901
|
},
|
|
3010
|
-
appearance: "dark"
|
|
3011
|
-
isFetchingInitialData: false,
|
|
3012
|
-
isLoading: false
|
|
2902
|
+
appearance: "dark"
|
|
3013
2903
|
};
|
|
3014
2904
|
const settingSlice = toolkit.createSlice({
|
|
3015
2905
|
name: "settings",
|
|
@@ -3033,12 +2923,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3033
2923
|
},
|
|
3034
2924
|
setAppearance: (state, action) => {
|
|
3035
2925
|
state.appearance = action.payload;
|
|
3036
|
-
},
|
|
3037
|
-
setIsFetchingInitialData: (state, action) => {
|
|
3038
|
-
state.isFetchingInitialData = action.payload;
|
|
3039
|
-
},
|
|
3040
|
-
setIsLoading: (state, action) => {
|
|
3041
|
-
state.isLoading = action.payload;
|
|
3042
2926
|
}
|
|
3043
2927
|
}
|
|
3044
2928
|
});
|
|
@@ -3047,9 +2931,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3047
2931
|
setEnablePlacementMode,
|
|
3048
2932
|
setSectionExpanded,
|
|
3049
2933
|
setEnableClustering,
|
|
3050
|
-
setAppearance
|
|
3051
|
-
setIsFetchingInitialData,
|
|
3052
|
-
setIsLoading
|
|
2934
|
+
setAppearance
|
|
3053
2935
|
} = settingSlice.actions;
|
|
3054
2936
|
const selectEnablePlacementMode = (state) => state.settingReducer.placementMode;
|
|
3055
2937
|
const selectEnableDuplicateIssues = (state) => state.settingReducer.useIssueTemplate;
|
|
@@ -3058,8 +2940,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3058
2940
|
const selectEnableClustering = (state) => state.settingReducer.enableClustering;
|
|
3059
2941
|
const selectAppearance = (state) => state.settingReducer.appearance;
|
|
3060
2942
|
const settingReducer = settingSlice.reducer;
|
|
3061
|
-
const selectIsFetchingInitialData = (state) => state.settingReducer.isFetchingInitialData;
|
|
3062
|
-
const selectIsLoading = (state) => state.settingReducer.isLoading;
|
|
3063
2943
|
const LATEST_REVISION_CACHE = {};
|
|
3064
2944
|
function considerCachingRevision(revision, formId2, preferPending = false) {
|
|
3065
2945
|
var _a2;
|
|
@@ -3091,7 +2971,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3091
2971
|
userForms: {},
|
|
3092
2972
|
revisions: {},
|
|
3093
2973
|
submissions: {},
|
|
3094
|
-
submissionAttachments: {}
|
|
2974
|
+
submissionAttachments: {},
|
|
2975
|
+
revisionAttachments: {}
|
|
3095
2976
|
};
|
|
3096
2977
|
const userFormSlice = toolkit.createSlice({
|
|
3097
2978
|
name: "userForms",
|
|
@@ -3144,6 +3025,15 @@ var __publicField = (obj, key, value) => {
|
|
|
3144
3025
|
state.submissionAttachments[submissionId] = [action.payload];
|
|
3145
3026
|
}
|
|
3146
3027
|
},
|
|
3028
|
+
addUserFormRevisionAttachment: (state, action) => {
|
|
3029
|
+
const revisionId = action.payload.revision;
|
|
3030
|
+
const revisionAttachments = state.revisionAttachments[revisionId];
|
|
3031
|
+
if (revisionAttachments) {
|
|
3032
|
+
revisionAttachments.push(action.payload);
|
|
3033
|
+
} else {
|
|
3034
|
+
state.revisionAttachments[revisionId] = [action.payload];
|
|
3035
|
+
}
|
|
3036
|
+
},
|
|
3147
3037
|
setUserFormSubmissionAttachments: (state, action) => {
|
|
3148
3038
|
state.submissionAttachments = {};
|
|
3149
3039
|
for (const attachment of action.payload) {
|
|
@@ -3156,6 +3046,18 @@ var __publicField = (obj, key, value) => {
|
|
|
3156
3046
|
}
|
|
3157
3047
|
}
|
|
3158
3048
|
},
|
|
3049
|
+
setUserFormRevisionAttachments: (state, action) => {
|
|
3050
|
+
state.revisionAttachments = {};
|
|
3051
|
+
for (const attachment of action.payload) {
|
|
3052
|
+
const revisionId = attachment.revision;
|
|
3053
|
+
const revisionAttachments = state.revisionAttachments[revisionId];
|
|
3054
|
+
if (revisionAttachments) {
|
|
3055
|
+
revisionAttachments.push(attachment);
|
|
3056
|
+
} else {
|
|
3057
|
+
state.revisionAttachments[revisionId] = [attachment];
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
3060
|
+
},
|
|
3159
3061
|
deleteUserFormSubmission: (state, action) => {
|
|
3160
3062
|
delete state.submissions[action.payload];
|
|
3161
3063
|
},
|
|
@@ -3212,11 +3114,16 @@ var __publicField = (obj, key, value) => {
|
|
|
3212
3114
|
setUserFormSubmissions,
|
|
3213
3115
|
addUserFormRevision,
|
|
3214
3116
|
addUserFormSubmissionAttachment,
|
|
3215
|
-
|
|
3117
|
+
addUserFormRevisionAttachment,
|
|
3118
|
+
setUserFormSubmissionAttachments,
|
|
3119
|
+
setUserFormRevisionAttachments
|
|
3216
3120
|
} = userFormSlice.actions;
|
|
3217
3121
|
const selectSubmissionAttachments = (submissionId) => (state) => {
|
|
3218
3122
|
return state.userFormReducer.submissionAttachments[submissionId] || [];
|
|
3219
3123
|
};
|
|
3124
|
+
const selectRevisionAttachments = (revisionId) => (state) => {
|
|
3125
|
+
return state.userFormReducer.revisionAttachments[revisionId] || [];
|
|
3126
|
+
};
|
|
3220
3127
|
const selectFilteredUserForms = restructureCreateSelectorWithArgs(
|
|
3221
3128
|
toolkit.createSelector(
|
|
3222
3129
|
[
|
|
@@ -3287,6 +3194,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3287
3194
|
const selectSubmissionMapping = (state) => state.userFormReducer.submissions;
|
|
3288
3195
|
const selectSubmissions = toolkit.createSelector([selectSubmissionMapping], (submissions) => Object.values(submissions));
|
|
3289
3196
|
const selectRevisionMapping = (state) => state.userFormReducer.revisions;
|
|
3197
|
+
const selectRevisionAttachmentsMapping = (state) => state.userFormReducer.revisionAttachments;
|
|
3290
3198
|
const selectRevisions = toolkit.createSelector([selectRevisionMapping], (revisions) => Object.values(revisions));
|
|
3291
3199
|
const selectRevisionsForForm = restructureCreateSelectorWithArgs(
|
|
3292
3200
|
toolkit.createSelector([selectRevisions, (_state, formId2) => formId2], (revisions, formId2) => {
|
|
@@ -3340,6 +3248,19 @@ var __publicField = (obj, key, value) => {
|
|
|
3340
3248
|
}
|
|
3341
3249
|
return latestRevisions;
|
|
3342
3250
|
});
|
|
3251
|
+
const selectAllRevisionAttachmentsByLatestRevisionId = toolkit.createSelector(
|
|
3252
|
+
[selectUserFormMapping, selectRevisionMapping, selectRevisionAttachmentsMapping],
|
|
3253
|
+
(forms, revisions, attachments) => {
|
|
3254
|
+
const mappedAttachments = {};
|
|
3255
|
+
for (const form of Object.values(forms)) {
|
|
3256
|
+
const latestRevision = _selectLatestFormRevision(revisions, form.offline_id);
|
|
3257
|
+
if (attachments[latestRevision.offline_id] !== void 0) {
|
|
3258
|
+
mappedAttachments[latestRevision.offline_id] = attachments[latestRevision.offline_id];
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
return mappedAttachments;
|
|
3262
|
+
}
|
|
3263
|
+
);
|
|
3343
3264
|
const selectNumberOfUserForms = toolkit.createSelector([selectUserFormMapping], (userForms) => {
|
|
3344
3265
|
return Object.keys(userForms).length;
|
|
3345
3266
|
});
|
|
@@ -3420,8 +3341,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3420
3341
|
userFormReducer,
|
|
3421
3342
|
userReducer,
|
|
3422
3343
|
workspaceReducer,
|
|
3423
|
-
emailDomainsReducer
|
|
3424
|
-
licenseReducer
|
|
3344
|
+
emailDomainsReducer
|
|
3425
3345
|
};
|
|
3426
3346
|
const overmapReducer = toolkit.combineReducers(overmapReducers);
|
|
3427
3347
|
const resetStore = "RESET";
|
|
@@ -3582,6 +3502,19 @@ var __publicField = (obj, key, value) => {
|
|
|
3582
3502
|
return errorRes.body.error;
|
|
3583
3503
|
if (typeof errorRes.body.message === "string")
|
|
3584
3504
|
return errorRes.body.message;
|
|
3505
|
+
try {
|
|
3506
|
+
return Object.entries(errorRes.body).map(([key, value]) => {
|
|
3507
|
+
if (typeof value === "string") {
|
|
3508
|
+
return `${key}: ${value}`;
|
|
3509
|
+
}
|
|
3510
|
+
if (Array.isArray(value)) {
|
|
3511
|
+
return value.map((v) => `${key}: ${v}`).join("\n");
|
|
3512
|
+
}
|
|
3513
|
+
return `${key}: ${JSON.stringify(value)}`;
|
|
3514
|
+
}).join("\n");
|
|
3515
|
+
} catch (e) {
|
|
3516
|
+
console.error("Failed to extract error message from response body", e);
|
|
3517
|
+
}
|
|
3585
3518
|
} else if (typeof errorRes.body === "string")
|
|
3586
3519
|
return errorRes.body;
|
|
3587
3520
|
} else if (errorRes == null ? void 0 : errorRes.text) {
|
|
@@ -4122,7 +4055,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4122
4055
|
* @returns {Promise<TokenPair>} The new access and refresh tokens
|
|
4123
4056
|
*/
|
|
4124
4057
|
__publicField(this, "_getRenewedTokens", async (refreshToken) => {
|
|
4125
|
-
const
|
|
4058
|
+
const promise = this.enqueueRequest({
|
|
4126
4059
|
description: "Get renewed tokens",
|
|
4127
4060
|
method: HttpMethod.POST,
|
|
4128
4061
|
url: "/api/token/refresh/",
|
|
@@ -4135,6 +4068,14 @@ var __publicField = (obj, key, value) => {
|
|
|
4135
4068
|
// Don't wait for other requests to finish, or we might end up in a deadlock.
|
|
4136
4069
|
immediate: true
|
|
4137
4070
|
});
|
|
4071
|
+
let response = void 0;
|
|
4072
|
+
try {
|
|
4073
|
+
response = await promise;
|
|
4074
|
+
} catch (e) {
|
|
4075
|
+
await this.logout();
|
|
4076
|
+
}
|
|
4077
|
+
if (!response)
|
|
4078
|
+
throw new Error("No response");
|
|
4138
4079
|
if (!response.access)
|
|
4139
4080
|
throw new Error("Missing access token");
|
|
4140
4081
|
if (!response.refresh)
|
|
@@ -4854,7 +4795,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4854
4795
|
});
|
|
4855
4796
|
store.dispatch(addIssue(issuePayload));
|
|
4856
4797
|
store.dispatch(addToRecentIssues(issuePayload.offline_id));
|
|
4857
|
-
store.dispatch(updateActiveProjectIssuesCount(1));
|
|
4858
4798
|
const promise = this.enqueueRequest({
|
|
4859
4799
|
description: "Create issue",
|
|
4860
4800
|
method: HttpMethod.POST,
|
|
@@ -4881,7 +4821,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4881
4821
|
});
|
|
4882
4822
|
}
|
|
4883
4823
|
store.dispatch(removeIssue(issuePayload.offline_id));
|
|
4884
|
-
store.dispatch(updateActiveProjectIssuesCount(-1));
|
|
4885
4824
|
throw error2;
|
|
4886
4825
|
});
|
|
4887
4826
|
return [issuePayload, promise];
|
|
@@ -4920,8 +4859,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4920
4859
|
return [fullIssue, promise];
|
|
4921
4860
|
}
|
|
4922
4861
|
async remove(id) {
|
|
4923
|
-
const
|
|
4924
|
-
const state = store.getState();
|
|
4862
|
+
const state = this.client.store.getState();
|
|
4925
4863
|
const backup = state.issueReducer.issues[id];
|
|
4926
4864
|
if (!backup) {
|
|
4927
4865
|
throw new Error(`No issue with id ${id} found in the store`);
|
|
@@ -4929,7 +4867,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4929
4867
|
const attachments = Object.values(state.issueReducer.attachments).filter((a) => a.issue_id === id);
|
|
4930
4868
|
const attachmentsOfIssue = selectPhotoAttachmentsOfIssue(id)(state);
|
|
4931
4869
|
this.client.store.dispatch(removeIssue(id));
|
|
4932
|
-
store.dispatch(updateActiveProjectIssuesCount(-1));
|
|
4933
4870
|
if (attachmentsOfIssue) {
|
|
4934
4871
|
this.client.store.dispatch(removeAttachmentsOfIssue(id));
|
|
4935
4872
|
}
|
|
@@ -4944,7 +4881,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4944
4881
|
} catch (e) {
|
|
4945
4882
|
this.client.store.dispatch(addIssue(backup));
|
|
4946
4883
|
this.client.store.dispatch(addAttachments(attachments));
|
|
4947
|
-
store.dispatch(updateActiveProjectIssuesCount(1));
|
|
4948
4884
|
throw e;
|
|
4949
4885
|
}
|
|
4950
4886
|
}
|
|
@@ -5020,9 +4956,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5020
4956
|
owner_organization: projectData.organization_owner,
|
|
5021
4957
|
owner_user: projectData.user_owner,
|
|
5022
4958
|
bounds: projectData.bounds,
|
|
5023
|
-
invited: projectData.invited || false
|
|
5024
|
-
issues_count: projectData.issues_count,
|
|
5025
|
-
form_submissions_count: projectData.form_submissions_count
|
|
4959
|
+
invited: projectData.invited || false
|
|
5026
4960
|
});
|
|
5027
4961
|
if (currentProjectId === projectData.id && !projectData.invited) {
|
|
5028
4962
|
isProjectIdValid = true;
|
|
@@ -5040,7 +4974,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5040
4974
|
}
|
|
5041
4975
|
store.dispatch(setCurrentUser(data.user));
|
|
5042
4976
|
store.dispatch(addUsers(data.project_owners));
|
|
5043
|
-
store.dispatch(setLicenses(data.licenses));
|
|
5044
4977
|
const organizationsData = data.organizations;
|
|
5045
4978
|
store.dispatch(setOrganizations(organizationsData));
|
|
5046
4979
|
const validProjects = projects.filter((project) => !project.invited);
|
|
@@ -5353,7 +5286,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5353
5286
|
if (!project) {
|
|
5354
5287
|
throw new Error("Expected project to exist");
|
|
5355
5288
|
}
|
|
5356
|
-
const license = selectLicenseForProject(project.id);
|
|
5357
5289
|
const activeProjectId = state.projectReducer.activeProjectId;
|
|
5358
5290
|
if (activeProjectId === projectId) {
|
|
5359
5291
|
store.dispatch({ type: "project/setActiveProjectId", payload: null });
|
|
@@ -5364,9 +5296,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5364
5296
|
store.dispatch(removeProjectAccessesOfProject(project.id));
|
|
5365
5297
|
store.dispatch({ type: "rehydrated/setRehydrated", payload: false });
|
|
5366
5298
|
store.dispatch(deleteProject(project));
|
|
5367
|
-
if (license) {
|
|
5368
|
-
store.dispatch(updateLicense({ ...license, project: null }));
|
|
5369
|
-
}
|
|
5370
5299
|
try {
|
|
5371
5300
|
await this.enqueueRequest({
|
|
5372
5301
|
description: "Delete project",
|
|
@@ -5382,9 +5311,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5382
5311
|
store.dispatch(addOrReplaceProjectFiles(filesToDelete));
|
|
5383
5312
|
store.dispatch(setActiveProjectId(activeProjectId));
|
|
5384
5313
|
store.dispatch({ type: "rehydrated/setRehydrated", payload: true });
|
|
5385
|
-
if (license) {
|
|
5386
|
-
store.dispatch(updateLicense({ ...license, project: project.id }));
|
|
5387
|
-
}
|
|
5388
5314
|
throw e;
|
|
5389
5315
|
}
|
|
5390
5316
|
}
|
|
@@ -5423,8 +5349,72 @@ var __publicField = (obj, key, value) => {
|
|
|
5423
5349
|
});
|
|
5424
5350
|
}
|
|
5425
5351
|
}
|
|
5352
|
+
const separateImageFromFields = async (payload) => {
|
|
5353
|
+
const { fields } = payload;
|
|
5354
|
+
const images = {};
|
|
5355
|
+
const newFields = [];
|
|
5356
|
+
for (const section of fields) {
|
|
5357
|
+
if (section.type !== "section") {
|
|
5358
|
+
throw new Error(`Expected ISerializedField type to be a section. Got ${section.type} instead.`);
|
|
5359
|
+
}
|
|
5360
|
+
const { fields: sectionFields } = section;
|
|
5361
|
+
const newSectionFields = [];
|
|
5362
|
+
for (const field of sectionFields) {
|
|
5363
|
+
if (field.image) {
|
|
5364
|
+
if (field.image instanceof Promise) {
|
|
5365
|
+
try {
|
|
5366
|
+
images[field.identifier] = await field.image;
|
|
5367
|
+
} catch (e) {
|
|
5368
|
+
console.error("Failed to get image from promise", e);
|
|
5369
|
+
}
|
|
5370
|
+
} else {
|
|
5371
|
+
images[field.identifier] = field.image;
|
|
5372
|
+
}
|
|
5373
|
+
delete field.image;
|
|
5374
|
+
}
|
|
5375
|
+
newSectionFields.push(field);
|
|
5376
|
+
}
|
|
5377
|
+
newFields.push({ ...section, fields: newSectionFields });
|
|
5378
|
+
}
|
|
5379
|
+
const payloadWithoutImage = {
|
|
5380
|
+
...payload,
|
|
5381
|
+
fields: newFields
|
|
5382
|
+
};
|
|
5383
|
+
return { payloadWithoutImage, images };
|
|
5384
|
+
};
|
|
5426
5385
|
class UserFormService extends BaseApiService {
|
|
5427
|
-
|
|
5386
|
+
constructor() {
|
|
5387
|
+
super(...arguments);
|
|
5388
|
+
// Attach images to revision, after uploading them to S3
|
|
5389
|
+
__publicField(this, "getAttachImagePromises", (images, offlineRevisionId) => {
|
|
5390
|
+
const { store } = this.client;
|
|
5391
|
+
return Object.entries(images).map(async ([key, image]) => {
|
|
5392
|
+
const sha1 = await hashFile(image);
|
|
5393
|
+
await this.client.files.addCache(image, sha1);
|
|
5394
|
+
const [fileProps] = await this.client.files.uploadFileToS3(sha1);
|
|
5395
|
+
const revisionAttachmentPayload = offline({
|
|
5396
|
+
...fileProps,
|
|
5397
|
+
revision: offlineRevisionId,
|
|
5398
|
+
field_identifier: key
|
|
5399
|
+
});
|
|
5400
|
+
const attach = await this.enqueueRequest({
|
|
5401
|
+
description: "Attach image to form revision field",
|
|
5402
|
+
method: HttpMethod.POST,
|
|
5403
|
+
url: `/forms/revisions/${offlineRevisionId}/attachments/`,
|
|
5404
|
+
payload: revisionAttachmentPayload,
|
|
5405
|
+
blockers: [revisionAttachmentPayload.revision],
|
|
5406
|
+
blocks: [revisionAttachmentPayload.offline_id]
|
|
5407
|
+
});
|
|
5408
|
+
const offlinePayload = {
|
|
5409
|
+
...revisionAttachmentPayload,
|
|
5410
|
+
file: URL.createObjectURL(image)
|
|
5411
|
+
};
|
|
5412
|
+
store.dispatch(addUserFormRevisionAttachment(offlinePayload));
|
|
5413
|
+
return attach;
|
|
5414
|
+
});
|
|
5415
|
+
});
|
|
5416
|
+
}
|
|
5417
|
+
async add(state, initialRevision, url, ownerUser, ownerOrganization) {
|
|
5428
5418
|
if (!!ownerUser === !!ownerOrganization) {
|
|
5429
5419
|
throw new Error("Exactly one of ownerUser and ownerOrganization must be defined.");
|
|
5430
5420
|
}
|
|
@@ -5444,8 +5434,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5444
5434
|
created_by: currentUser.id,
|
|
5445
5435
|
...ownerAttrs
|
|
5446
5436
|
};
|
|
5437
|
+
const { payloadWithoutImage, images } = await separateImageFromFields(offlineRevisionPayload);
|
|
5447
5438
|
const retRevision = {
|
|
5448
|
-
...
|
|
5439
|
+
...payloadWithoutImage,
|
|
5449
5440
|
created_by: currentUser.id,
|
|
5450
5441
|
form: retForm.offline_id,
|
|
5451
5442
|
revision: 0
|
|
@@ -5460,24 +5451,26 @@ var __publicField = (obj, key, value) => {
|
|
|
5460
5451
|
queryParams: activeWorkspaceId ? {
|
|
5461
5452
|
workspace_id: activeWorkspaceId
|
|
5462
5453
|
} : void 0,
|
|
5463
|
-
payload: { ...offlineFormPayload, initial_revision:
|
|
5454
|
+
payload: { ...offlineFormPayload, initial_revision: payloadWithoutImage },
|
|
5464
5455
|
blockers: [],
|
|
5465
|
-
blocks: [offlineFormPayload.offline_id,
|
|
5456
|
+
blocks: [offlineFormPayload.offline_id, payloadWithoutImage.offline_id]
|
|
5466
5457
|
});
|
|
5458
|
+
const attachImagesPromises = this.getAttachImagePromises(images, offlineRevisionPayload.offline_id);
|
|
5467
5459
|
void formPromise.catch((e) => {
|
|
5468
5460
|
store.dispatch(deleteUserForm(retForm.offline_id));
|
|
5469
5461
|
store.dispatch(deleteUserFormRevision(retRevision.offline_id));
|
|
5470
5462
|
throw e;
|
|
5471
5463
|
});
|
|
5472
|
-
|
|
5464
|
+
const settledPromise = Promise.all([formPromise, ...attachImagesPromises]).then(() => formPromise);
|
|
5465
|
+
return [retForm, retRevision, formPromise, settledPromise];
|
|
5473
5466
|
}
|
|
5474
|
-
addForOrganization(initialRevision) {
|
|
5467
|
+
async addForOrganization(initialRevision) {
|
|
5475
5468
|
const state = this.client.store.getState();
|
|
5476
5469
|
const activeOrganizationId = state.organizationReducer.activeOrganizationId;
|
|
5477
5470
|
if (!activeOrganizationId) {
|
|
5478
5471
|
throw new Error("Cannot add forms for organization when there is no active organization.");
|
|
5479
5472
|
}
|
|
5480
|
-
return this.add(
|
|
5473
|
+
return await this.add(
|
|
5481
5474
|
state,
|
|
5482
5475
|
initialRevision,
|
|
5483
5476
|
`/forms/in-organization/${activeOrganizationId}/`,
|
|
@@ -5485,12 +5478,12 @@ var __publicField = (obj, key, value) => {
|
|
|
5485
5478
|
activeOrganizationId
|
|
5486
5479
|
);
|
|
5487
5480
|
}
|
|
5488
|
-
addForCurrentUser(initialRevision) {
|
|
5481
|
+
async addForCurrentUser(initialRevision) {
|
|
5489
5482
|
const state = this.client.store.getState();
|
|
5490
5483
|
const currentUser = state.userReducer.currentUser;
|
|
5491
|
-
return this.add(state, initialRevision, "/forms/my-forms/", currentUser.id);
|
|
5484
|
+
return await this.add(state, initialRevision, "/forms/my-forms/", currentUser.id);
|
|
5492
5485
|
}
|
|
5493
|
-
createRevision(formId2, revision) {
|
|
5486
|
+
async createRevision(formId2, revision) {
|
|
5494
5487
|
const offlineRevision = offline(revision);
|
|
5495
5488
|
const { store } = this.client;
|
|
5496
5489
|
const state = store.getState();
|
|
@@ -5499,8 +5492,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5499
5492
|
throw new Error("Cannot create form revision when there is no active project.");
|
|
5500
5493
|
}
|
|
5501
5494
|
const currentUserId = state.userReducer.currentUser.id;
|
|
5495
|
+
const { payloadWithoutImage, images } = await separateImageFromFields(offlineRevision);
|
|
5502
5496
|
const fullRevision = {
|
|
5503
|
-
...
|
|
5497
|
+
...payloadWithoutImage,
|
|
5504
5498
|
created_by: currentUserId,
|
|
5505
5499
|
revision: "Pending",
|
|
5506
5500
|
form: formId2
|
|
@@ -5510,19 +5504,21 @@ var __publicField = (obj, key, value) => {
|
|
|
5510
5504
|
description: "Create form revision",
|
|
5511
5505
|
method: HttpMethod.PATCH,
|
|
5512
5506
|
url: `/forms/${formId2}/`,
|
|
5513
|
-
payload: { initial_revision:
|
|
5507
|
+
payload: { initial_revision: payloadWithoutImage },
|
|
5514
5508
|
queryParams: {
|
|
5515
5509
|
project_id: activeProjectId.toString()
|
|
5516
5510
|
},
|
|
5517
5511
|
blockers: [formId2],
|
|
5518
5512
|
blocks: [offlineRevision.offline_id]
|
|
5519
5513
|
});
|
|
5514
|
+
const attachImagesPromises = this.getAttachImagePromises(images, offlineRevision.offline_id);
|
|
5520
5515
|
void promise.then((result) => {
|
|
5521
5516
|
store.dispatch(addUserFormRevision(result));
|
|
5522
5517
|
}).catch(() => {
|
|
5523
5518
|
store.dispatch(deleteUserFormRevision(fullRevision.offline_id));
|
|
5524
5519
|
});
|
|
5525
|
-
|
|
5520
|
+
const settledPromise = Promise.all([promise, ...attachImagesPromises]).then(() => promise);
|
|
5521
|
+
return [fullRevision, settledPromise];
|
|
5526
5522
|
}
|
|
5527
5523
|
async favorite(formId2) {
|
|
5528
5524
|
const { store } = this.client;
|
|
@@ -5604,6 +5600,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5604
5600
|
});
|
|
5605
5601
|
store.dispatch(addUserForms(Object.values(result.forms)));
|
|
5606
5602
|
store.dispatch(addUserFormRevisions(Object.values(result.revisions)));
|
|
5603
|
+
store.dispatch(setUserFormRevisionAttachments(Object.values(result.attachments)));
|
|
5607
5604
|
}
|
|
5608
5605
|
}
|
|
5609
5606
|
const isArrayOfFiles = (value) => {
|
|
@@ -5690,11 +5687,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5690
5687
|
store.dispatch(addUserFormSubmission(offlineResultWithoutFiles));
|
|
5691
5688
|
void promise.then((result) => {
|
|
5692
5689
|
store.dispatch(addUserFormSubmission(result));
|
|
5693
|
-
store.dispatch(updateActiveProjectFormSubmissionsCount(1));
|
|
5694
5690
|
return result;
|
|
5695
5691
|
}).catch(() => {
|
|
5696
5692
|
store.dispatch(deleteUserFormSubmission(payload.offline_id));
|
|
5697
|
-
store.dispatch(updateActiveProjectFormSubmissionsCount(-1));
|
|
5698
5693
|
});
|
|
5699
5694
|
const settledPromise = Promise.all([promise, ...attachFilesPromises]).then(() => promise);
|
|
5700
5695
|
return [fullOfflineResult, settledPromise];
|
|
@@ -5704,7 +5699,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5704
5699
|
const state = store.getState();
|
|
5705
5700
|
const submission = state.userFormReducer.submissions[submissionId];
|
|
5706
5701
|
store.dispatch(deleteUserFormSubmission(submissionId));
|
|
5707
|
-
store.dispatch(updateActiveProjectFormSubmissionsCount(-1));
|
|
5708
5702
|
try {
|
|
5709
5703
|
return await this.enqueueRequest({
|
|
5710
5704
|
description: "Delete user form submissions",
|
|
@@ -5716,7 +5710,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5716
5710
|
} catch (e) {
|
|
5717
5711
|
if (submission) {
|
|
5718
5712
|
store.dispatch(addUserFormSubmission(submission));
|
|
5719
|
-
store.dispatch(updateActiveProjectFormSubmissionsCount(1));
|
|
5720
5713
|
}
|
|
5721
5714
|
throw e;
|
|
5722
5715
|
}
|
|
@@ -6129,12 +6122,10 @@ var __publicField = (obj, key, value) => {
|
|
|
6129
6122
|
const organizationAccesses = data.organization_accesses;
|
|
6130
6123
|
const emailDomains = data.email_domains;
|
|
6131
6124
|
const users = data.users;
|
|
6132
|
-
const licenses = data.licenses;
|
|
6133
6125
|
store.dispatch(addUsers(users));
|
|
6134
6126
|
store.dispatch(setActiveOrganizationId(activeOrganization.id));
|
|
6135
6127
|
store.dispatch(setOrganizationAccesses(organizationAccesses));
|
|
6136
6128
|
store.dispatch(setEmailDomains(emailDomains));
|
|
6137
|
-
store.dispatch(addLicenses(licenses));
|
|
6138
6129
|
if (showLoading) {
|
|
6139
6130
|
store.dispatch(setIsFetchingInitialData(false));
|
|
6140
6131
|
}
|
|
@@ -6175,109 +6166,6 @@ var __publicField = (obj, key, value) => {
|
|
|
6175
6166
|
});
|
|
6176
6167
|
}
|
|
6177
6168
|
}
|
|
6178
|
-
class LicenseService extends BaseApiService {
|
|
6179
|
-
async getLicensesForOrganization(organizationId, showLoading = false) {
|
|
6180
|
-
if (showLoading) {
|
|
6181
|
-
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
6182
|
-
}
|
|
6183
|
-
return this.enqueueRequest({
|
|
6184
|
-
description: "Get licenses",
|
|
6185
|
-
method: HttpMethod.GET,
|
|
6186
|
-
url: `/organizations/${organizationId}/licenses/`,
|
|
6187
|
-
isAuthNeeded: true,
|
|
6188
|
-
blockers: [organizationId.toString()],
|
|
6189
|
-
blocks: []
|
|
6190
|
-
}).then((result) => {
|
|
6191
|
-
if (showLoading) {
|
|
6192
|
-
this.client.store.dispatch(setIsFetchingInitialData(false));
|
|
6193
|
-
}
|
|
6194
|
-
return result;
|
|
6195
|
-
});
|
|
6196
|
-
}
|
|
6197
|
-
async pauseLicense(license) {
|
|
6198
|
-
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
6199
|
-
return this.enqueueRequest({
|
|
6200
|
-
description: "Pause license",
|
|
6201
|
-
method: HttpMethod.DELETE,
|
|
6202
|
-
url: `/billing/${license.offline_id}/suspend/`,
|
|
6203
|
-
isAuthNeeded: true,
|
|
6204
|
-
blockers: [
|
|
6205
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6206
|
-
],
|
|
6207
|
-
blocks: []
|
|
6208
|
-
}).then((result) => {
|
|
6209
|
-
this.client.store.dispatch(updateLicense(result));
|
|
6210
|
-
this.client.store.dispatch(setIsFetchingInitialData(false));
|
|
6211
|
-
return result;
|
|
6212
|
-
});
|
|
6213
|
-
}
|
|
6214
|
-
async resumeLicense(license) {
|
|
6215
|
-
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
6216
|
-
return this.enqueueRequest({
|
|
6217
|
-
description: "Resume license",
|
|
6218
|
-
method: HttpMethod.PATCH,
|
|
6219
|
-
url: `/billing/${license.offline_id}/suspend/`,
|
|
6220
|
-
isAuthNeeded: true,
|
|
6221
|
-
blockers: [
|
|
6222
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6223
|
-
],
|
|
6224
|
-
blocks: []
|
|
6225
|
-
}).then((result) => {
|
|
6226
|
-
this.client.store.dispatch(updateLicense(result));
|
|
6227
|
-
this.client.store.dispatch(setIsFetchingInitialData(false));
|
|
6228
|
-
return result;
|
|
6229
|
-
});
|
|
6230
|
-
}
|
|
6231
|
-
async cancelLicense(license) {
|
|
6232
|
-
this.client.store.dispatch(setIsFetchingInitialData(true));
|
|
6233
|
-
return this.enqueueRequest({
|
|
6234
|
-
description: "Cancel license",
|
|
6235
|
-
method: HttpMethod.DELETE,
|
|
6236
|
-
url: `/billing/${license.offline_id}/`,
|
|
6237
|
-
isAuthNeeded: true,
|
|
6238
|
-
blockers: [
|
|
6239
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6240
|
-
],
|
|
6241
|
-
blocks: []
|
|
6242
|
-
}).then((result) => {
|
|
6243
|
-
this.client.store.dispatch(updateLicense(result));
|
|
6244
|
-
this.client.store.dispatch(setIsFetchingInitialData(false));
|
|
6245
|
-
return result;
|
|
6246
|
-
});
|
|
6247
|
-
}
|
|
6248
|
-
async attachLicenseToProject(license, project) {
|
|
6249
|
-
return this.enqueueRequest({
|
|
6250
|
-
description: "Attach license",
|
|
6251
|
-
method: HttpMethod.PATCH,
|
|
6252
|
-
url: `/billing/${license.offline_id}/project/`,
|
|
6253
|
-
isAuthNeeded: true,
|
|
6254
|
-
payload: { project: project.id },
|
|
6255
|
-
blockers: [
|
|
6256
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : "",
|
|
6257
|
-
project.id ? project.id.toString() : ""
|
|
6258
|
-
],
|
|
6259
|
-
blocks: []
|
|
6260
|
-
}).then((result) => {
|
|
6261
|
-
this.client.store.dispatch(updateLicense(result));
|
|
6262
|
-
return result;
|
|
6263
|
-
});
|
|
6264
|
-
}
|
|
6265
|
-
async detachLicenseFromProject(license) {
|
|
6266
|
-
return this.enqueueRequest({
|
|
6267
|
-
description: "Detach license",
|
|
6268
|
-
method: HttpMethod.DELETE,
|
|
6269
|
-
url: `/billing/${license.offline_id}/project/`,
|
|
6270
|
-
isAuthNeeded: true,
|
|
6271
|
-
blockers: [
|
|
6272
|
-
license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
|
|
6273
|
-
],
|
|
6274
|
-
blocks: []
|
|
6275
|
-
}).then((result) => {
|
|
6276
|
-
this.client.store.dispatch(updateLicense(result));
|
|
6277
|
-
return result;
|
|
6278
|
-
});
|
|
6279
|
-
}
|
|
6280
|
-
}
|
|
6281
6169
|
class OvermapSDK {
|
|
6282
6170
|
constructor(apiUrl, store) {
|
|
6283
6171
|
__publicField(this, "API_URL");
|
|
@@ -6303,7 +6191,6 @@ var __publicField = (obj, key, value) => {
|
|
|
6303
6191
|
__publicField(this, "projectFiles", new ProjectFileService(this));
|
|
6304
6192
|
__publicField(this, "emailVerification", new EmailVerificationService(this));
|
|
6305
6193
|
__publicField(this, "emailDomains", new EmailDomainsService(this));
|
|
6306
|
-
__publicField(this, "licenses", new LicenseService(this));
|
|
6307
6194
|
this.API_URL = apiUrl;
|
|
6308
6195
|
this.store = store;
|
|
6309
6196
|
}
|
|
@@ -6332,16 +6219,26 @@ var __publicField = (obj, key, value) => {
|
|
|
6332
6219
|
}
|
|
6333
6220
|
return /* @__PURE__ */ jsxRuntime.jsx(OvermapContext.Provider, { value: null, children: ret });
|
|
6334
6221
|
};
|
|
6335
|
-
const description$
|
|
6336
|
-
const floatingButtonContainer$
|
|
6337
|
-
const
|
|
6338
|
-
const
|
|
6339
|
-
const
|
|
6340
|
-
const
|
|
6341
|
-
const
|
|
6222
|
+
const description$2 = "_description_1rtl0_1";
|
|
6223
|
+
const floatingButtonContainer$2 = "_floatingButtonContainer_1rtl0_5";
|
|
6224
|
+
const FullScreenImageContainer$2 = "_FullScreenImageContainer_1rtl0_12";
|
|
6225
|
+
const fileName$2 = "_fileName_1rtl0_22";
|
|
6226
|
+
const longIconButton$2 = "_longIconButton_1rtl0_27";
|
|
6227
|
+
const previewImage$3 = "_previewImage_1rtl0_33";
|
|
6228
|
+
const FullScreenImage$2 = "_FullScreenImage_1rtl0_12";
|
|
6229
|
+
const tabsList = "_tabsList_1rtl0_51";
|
|
6230
|
+
const tabTrigger = "_tabTrigger_1rtl0_59";
|
|
6231
|
+
const patchfieldBorder = "_patchfieldBorder_1rtl0_63";
|
|
6232
|
+
const title = "_title_1rtl0_63";
|
|
6233
|
+
const error = "_error_1rtl0_79";
|
|
6342
6234
|
const styles$7 = {
|
|
6343
|
-
description: description$
|
|
6344
|
-
floatingButtonContainer: floatingButtonContainer$
|
|
6235
|
+
description: description$2,
|
|
6236
|
+
floatingButtonContainer: floatingButtonContainer$2,
|
|
6237
|
+
FullScreenImageContainer: FullScreenImageContainer$2,
|
|
6238
|
+
fileName: fileName$2,
|
|
6239
|
+
longIconButton: longIconButton$2,
|
|
6240
|
+
previewImage: previewImage$3,
|
|
6241
|
+
FullScreenImage: FullScreenImage$2,
|
|
6345
6242
|
tabsList,
|
|
6346
6243
|
tabTrigger,
|
|
6347
6244
|
patchfieldBorder,
|
|
@@ -6382,12 +6279,13 @@ var __publicField = (obj, key, value) => {
|
|
|
6382
6279
|
};
|
|
6383
6280
|
class BaseField extends BaseFormElement {
|
|
6384
6281
|
constructor(options) {
|
|
6385
|
-
const { label, required, fieldValidators = [], formValidators = [], ...base } = options;
|
|
6282
|
+
const { label, required, image, fieldValidators = [], formValidators = [], ...base } = options;
|
|
6386
6283
|
super(base);
|
|
6387
6284
|
__publicField(this, "required");
|
|
6388
6285
|
__publicField(this, "formValidators");
|
|
6389
6286
|
__publicField(this, "fieldValidators");
|
|
6390
6287
|
__publicField(this, "label");
|
|
6288
|
+
__publicField(this, "image");
|
|
6391
6289
|
/**
|
|
6392
6290
|
* By default, validation doesn't execute on `onChange` events when editing fields
|
|
6393
6291
|
* until the field has been `touched`. This can be overridden by setting this to `false`
|
|
@@ -6397,6 +6295,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6397
6295
|
__publicField(this, "onlyValidateAfterTouched", true);
|
|
6398
6296
|
this.label = label;
|
|
6399
6297
|
this.required = required;
|
|
6298
|
+
this.image = image;
|
|
6400
6299
|
this.fieldValidators = fieldValidators;
|
|
6401
6300
|
this.formValidators = formValidators;
|
|
6402
6301
|
}
|
|
@@ -6431,7 +6330,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6431
6330
|
return {
|
|
6432
6331
|
...super._serialize(),
|
|
6433
6332
|
label: this.label,
|
|
6434
|
-
required: this.required
|
|
6333
|
+
required: this.required,
|
|
6334
|
+
image: this.image
|
|
6435
6335
|
};
|
|
6436
6336
|
}
|
|
6437
6337
|
getFieldValidators() {
|
|
@@ -6443,108 +6343,22 @@ var __publicField = (obj, key, value) => {
|
|
|
6443
6343
|
}
|
|
6444
6344
|
__publicField(BaseField, "fieldTypeName");
|
|
6445
6345
|
__publicField(BaseField, "fieldTypeDescription");
|
|
6446
|
-
const description = "
|
|
6447
|
-
const floatingButtonContainer = "
|
|
6346
|
+
const description$1 = "_description_1nfty_1";
|
|
6347
|
+
const floatingButtonContainer$1 = "_floatingButtonContainer_1nfty_5";
|
|
6348
|
+
const FullScreenImageContainer$1 = "_FullScreenImageContainer_1nfty_12";
|
|
6349
|
+
const fileName$1 = "_fileName_1nfty_22";
|
|
6350
|
+
const longIconButton$1 = "_longIconButton_1nfty_27";
|
|
6351
|
+
const previewImage$2 = "_previewImage_1nfty_33";
|
|
6352
|
+
const FullScreenImage$1 = "_FullScreenImage_1nfty_12";
|
|
6448
6353
|
const styles$6 = {
|
|
6449
|
-
description,
|
|
6450
|
-
floatingButtonContainer
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
children
|
|
6457
|
-
] }) });
|
|
6458
|
-
};
|
|
6459
|
-
const InputWithHelpText = (props) => {
|
|
6460
|
-
const { helpText, children, severity } = props;
|
|
6461
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", gap: "1", children: [
|
|
6462
|
-
children,
|
|
6463
|
-
/* @__PURE__ */ jsxRuntime.jsx(blocks.Flex, { direction: "column", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "1", severity, className: styles$6.description, children: helpText }) })
|
|
6464
|
-
] });
|
|
6465
|
-
};
|
|
6466
|
-
const InputWithLabelAndHelpText = (props) => {
|
|
6467
|
-
const { children, ...restProps } = props;
|
|
6468
|
-
return /* @__PURE__ */ jsxRuntime.jsx(InputWithHelpText, { ...restProps, children });
|
|
6469
|
-
};
|
|
6470
|
-
const useFormikInput = (props) => {
|
|
6471
|
-
const { id, field, formId: formId2, size, showInputOnly, ...rest } = props;
|
|
6472
|
-
const [fieldProps, meta, helpers] = formik.useField(field.getId());
|
|
6473
|
-
const { touched } = meta;
|
|
6474
|
-
const helpText = meta.error ?? field.description;
|
|
6475
|
-
const severity = meta.error ? "danger" : void 0;
|
|
6476
|
-
const inputId = id ?? `${formId2}-${field.getId()}-input`;
|
|
6477
|
-
const labelId = `${inputId}-label`;
|
|
6478
|
-
const label = field.required ? `${field.label} *` : field.label;
|
|
6479
|
-
const fieldPropsWithValidation = React.useMemo(() => {
|
|
6480
|
-
const handleChange = (e) => {
|
|
6481
|
-
const value = field.getValueFromChangeEvent(e);
|
|
6482
|
-
void helpers.setValue(value, false).then();
|
|
6483
|
-
if (touched || !field.onlyValidateAfterTouched) {
|
|
6484
|
-
helpers.setError(field.getError(value));
|
|
6485
|
-
}
|
|
6486
|
-
};
|
|
6487
|
-
const handleBlur = (e) => {
|
|
6488
|
-
void helpers.setTouched(true, false).then();
|
|
6489
|
-
helpers.setError(field.getError(field.getValueFromChangeEvent(e)));
|
|
6490
|
-
};
|
|
6491
|
-
return {
|
|
6492
|
-
...fieldProps,
|
|
6493
|
-
onChange: handleChange,
|
|
6494
|
-
onBlur: handleBlur
|
|
6495
|
-
};
|
|
6496
|
-
}, [field, fieldProps, helpers, touched]);
|
|
6497
|
-
return [
|
|
6498
|
-
{
|
|
6499
|
-
helpText,
|
|
6500
|
-
size,
|
|
6501
|
-
severity,
|
|
6502
|
-
inputId,
|
|
6503
|
-
labelId,
|
|
6504
|
-
label,
|
|
6505
|
-
showInputOnly,
|
|
6506
|
-
fieldProps: fieldPropsWithValidation,
|
|
6507
|
-
helpers,
|
|
6508
|
-
field
|
|
6509
|
-
},
|
|
6510
|
-
{ ...rest, "aria-labelledby": labelId }
|
|
6511
|
-
];
|
|
6354
|
+
description: description$1,
|
|
6355
|
+
floatingButtonContainer: floatingButtonContainer$1,
|
|
6356
|
+
FullScreenImageContainer: FullScreenImageContainer$1,
|
|
6357
|
+
fileName: fileName$1,
|
|
6358
|
+
longIconButton: longIconButton$1,
|
|
6359
|
+
previewImage: previewImage$2,
|
|
6360
|
+
FullScreenImage: FullScreenImage$1
|
|
6512
6361
|
};
|
|
6513
|
-
const truthyValues = [true, "true"];
|
|
6514
|
-
const BooleanInput = React.memo((props) => {
|
|
6515
|
-
const [{ inputId, labelId, size, severity, showInputOnly, fieldProps }, rest] = useFormikInput(props);
|
|
6516
|
-
let [{ helpText, label }] = useFormikInput(props);
|
|
6517
|
-
helpText = showInputOnly ? null : helpText;
|
|
6518
|
-
label = showInputOnly ? "" : label;
|
|
6519
|
-
const color = blocks.useSeverityColor(severity);
|
|
6520
|
-
const value = truthyValues.includes(fieldProps.value);
|
|
6521
|
-
return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6522
|
-
InputWithLabel,
|
|
6523
|
-
{
|
|
6524
|
-
size,
|
|
6525
|
-
severity,
|
|
6526
|
-
inputId,
|
|
6527
|
-
labelId,
|
|
6528
|
-
label,
|
|
6529
|
-
flexProps: { direction: "row-reverse", justify: "end", align: "center", gap: "2" },
|
|
6530
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6531
|
-
blocks.Checkbox,
|
|
6532
|
-
{
|
|
6533
|
-
...rest,
|
|
6534
|
-
...fieldProps,
|
|
6535
|
-
id: inputId,
|
|
6536
|
-
color,
|
|
6537
|
-
value: value.toString(),
|
|
6538
|
-
checked: value,
|
|
6539
|
-
onCheckedChange: fieldProps.onChange,
|
|
6540
|
-
onChange: void 0,
|
|
6541
|
-
onBlur: void 0
|
|
6542
|
-
}
|
|
6543
|
-
)
|
|
6544
|
-
}
|
|
6545
|
-
) });
|
|
6546
|
-
});
|
|
6547
|
-
BooleanInput.displayName = "BooleanInput";
|
|
6548
6362
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
6549
6363
|
if (source == null)
|
|
6550
6364
|
return {};
|
|
@@ -6809,6 +6623,24 @@ var __publicField = (obj, key, value) => {
|
|
|
6809
6623
|
clipRule: "evenodd"
|
|
6810
6624
|
}));
|
|
6811
6625
|
});
|
|
6626
|
+
var _excluded$2C = ["color"];
|
|
6627
|
+
var ImageIcon = /* @__PURE__ */ React.forwardRef(function(_ref, forwardedRef) {
|
|
6628
|
+
var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$2C);
|
|
6629
|
+
return React.createElement("svg", Object.assign({
|
|
6630
|
+
width: "15",
|
|
6631
|
+
height: "15",
|
|
6632
|
+
viewBox: "0 0 15 15",
|
|
6633
|
+
fill: "none",
|
|
6634
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
6635
|
+
}, props, {
|
|
6636
|
+
ref: forwardedRef
|
|
6637
|
+
}), React.createElement("path", {
|
|
6638
|
+
d: "M2.5 1H12.5C13.3284 1 14 1.67157 14 2.5V12.5C14 13.3284 13.3284 14 12.5 14H2.5C1.67157 14 1 13.3284 1 12.5V2.5C1 1.67157 1.67157 1 2.5 1ZM2.5 2C2.22386 2 2 2.22386 2 2.5V8.3636L3.6818 6.6818C3.76809 6.59551 3.88572 6.54797 4.00774 6.55007C4.12975 6.55216 4.24568 6.60372 4.32895 6.69293L7.87355 10.4901L10.6818 7.6818C10.8575 7.50607 11.1425 7.50607 11.3182 7.6818L13 9.3636V2.5C13 2.22386 12.7761 2 12.5 2H2.5ZM2 12.5V9.6364L3.98887 7.64753L7.5311 11.4421L8.94113 13H2.5C2.22386 13 2 12.7761 2 12.5ZM12.5 13H10.155L8.48336 11.153L11 8.6364L13 10.6364V12.5C13 12.7761 12.7761 13 12.5 13ZM6.64922 5.5C6.64922 5.03013 7.03013 4.64922 7.5 4.64922C7.96987 4.64922 8.35078 5.03013 8.35078 5.5C8.35078 5.96987 7.96987 6.35078 7.5 6.35078C7.03013 6.35078 6.64922 5.96987 6.64922 5.5ZM7.5 3.74922C6.53307 3.74922 5.74922 4.53307 5.74922 5.5C5.74922 6.46693 6.53307 7.25078 7.5 7.25078C8.46693 7.25078 9.25078 6.46693 9.25078 5.5C9.25078 4.53307 8.46693 3.74922 7.5 3.74922Z",
|
|
6639
|
+
fill: color,
|
|
6640
|
+
fillRule: "evenodd",
|
|
6641
|
+
clipRule: "evenodd"
|
|
6642
|
+
}));
|
|
6643
|
+
});
|
|
6812
6644
|
var _excluded$2E = ["color"];
|
|
6813
6645
|
var InputIcon = /* @__PURE__ */ React.forwardRef(function(_ref, forwardedRef) {
|
|
6814
6646
|
var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$2E);
|
|
@@ -7005,6 +6837,196 @@ var __publicField = (obj, key, value) => {
|
|
|
7005
6837
|
clipRule: "evenodd"
|
|
7006
6838
|
}));
|
|
7007
6839
|
});
|
|
6840
|
+
const FullScreenImagePreview = React.memo((props) => {
|
|
6841
|
+
const { file, url, name, setShowPreview } = props;
|
|
6842
|
+
const handleDownload = React.useCallback(
|
|
6843
|
+
(event) => {
|
|
6844
|
+
event.stopPropagation();
|
|
6845
|
+
const blob = new Blob([file]);
|
|
6846
|
+
saveAs(blob, name);
|
|
6847
|
+
},
|
|
6848
|
+
[name, file]
|
|
6849
|
+
);
|
|
6850
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6851
|
+
"button",
|
|
6852
|
+
{
|
|
6853
|
+
className: styles$6.FullScreenImageContainer,
|
|
6854
|
+
onClick: () => {
|
|
6855
|
+
setShowPreview(false);
|
|
6856
|
+
},
|
|
6857
|
+
children: [
|
|
6858
|
+
/* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { align: "center", children: [
|
|
6859
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6860
|
+
blocks.IconButton,
|
|
6861
|
+
{
|
|
6862
|
+
className: styles$6.longIconButton,
|
|
6863
|
+
variant: "soft",
|
|
6864
|
+
"aria-label": "Exit preview",
|
|
6865
|
+
onClick: () => {
|
|
6866
|
+
setShowPreview(false);
|
|
6867
|
+
},
|
|
6868
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ArrowLeftIcon, {})
|
|
6869
|
+
}
|
|
6870
|
+
),
|
|
6871
|
+
/* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: styles$6.fileName, children: name }),
|
|
6872
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6873
|
+
blocks.IconButton,
|
|
6874
|
+
{
|
|
6875
|
+
className: styles$6.longIconButton,
|
|
6876
|
+
variant: "soft",
|
|
6877
|
+
"aria-label": `Download ${name}`,
|
|
6878
|
+
onClick: handleDownload,
|
|
6879
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DownloadIcon, {})
|
|
6880
|
+
}
|
|
6881
|
+
)
|
|
6882
|
+
] }),
|
|
6883
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6884
|
+
"img",
|
|
6885
|
+
{
|
|
6886
|
+
className: styles$6.FullScreenImage,
|
|
6887
|
+
src: url,
|
|
6888
|
+
alt: name,
|
|
6889
|
+
onClick: (e) => {
|
|
6890
|
+
e.stopPropagation();
|
|
6891
|
+
}
|
|
6892
|
+
}
|
|
6893
|
+
)
|
|
6894
|
+
]
|
|
6895
|
+
}
|
|
6896
|
+
);
|
|
6897
|
+
});
|
|
6898
|
+
FullScreenImagePreview.displayName = "FullScreenImagePreview";
|
|
6899
|
+
const InputWithLabel = (props) => {
|
|
6900
|
+
const { label, children, size, severity, inputId, labelId, image, flexProps } = props;
|
|
6901
|
+
const [resolvedImage, setResolvedImage] = React.useState(void 0);
|
|
6902
|
+
const [showImagePreview, setShowImagePreview] = React.useState(false);
|
|
6903
|
+
React.useEffect(() => {
|
|
6904
|
+
if (image instanceof Promise) {
|
|
6905
|
+
image.then(setResolvedImage).catch(console.error);
|
|
6906
|
+
} else {
|
|
6907
|
+
setResolvedImage(image);
|
|
6908
|
+
}
|
|
6909
|
+
}, [image]);
|
|
6910
|
+
const resolvedImageURL = resolvedImage ? URL.createObjectURL(resolvedImage) : void 0;
|
|
6911
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", gap: "2", children: [
|
|
6912
|
+
resolvedImage && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6913
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6914
|
+
"img",
|
|
6915
|
+
{
|
|
6916
|
+
className: styles$6.previewImage,
|
|
6917
|
+
src: resolvedImageURL,
|
|
6918
|
+
alt: resolvedImage.name,
|
|
6919
|
+
onClick: () => {
|
|
6920
|
+
setShowImagePreview(true);
|
|
6921
|
+
}
|
|
6922
|
+
}
|
|
6923
|
+
),
|
|
6924
|
+
showImagePreview && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6925
|
+
FullScreenImagePreview,
|
|
6926
|
+
{
|
|
6927
|
+
file: resolvedImage,
|
|
6928
|
+
url: resolvedImageURL,
|
|
6929
|
+
name: resolvedImage.name,
|
|
6930
|
+
setShowPreview: setShowImagePreview
|
|
6931
|
+
}
|
|
6932
|
+
)
|
|
6933
|
+
] }),
|
|
6934
|
+
/* @__PURE__ */ jsxRuntime.jsx(blocks.Flex, { direction: "column", gap: "1", asChild: true, ...flexProps, children: /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: inputId, children: [
|
|
6935
|
+
/* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size, severity, id: labelId, children: label }),
|
|
6936
|
+
children
|
|
6937
|
+
] }) })
|
|
6938
|
+
] });
|
|
6939
|
+
};
|
|
6940
|
+
const InputWithHelpText = (props) => {
|
|
6941
|
+
const { helpText, children, severity } = props;
|
|
6942
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", gap: "1", children: [
|
|
6943
|
+
children,
|
|
6944
|
+
/* @__PURE__ */ jsxRuntime.jsx(blocks.Flex, { direction: "column", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "1", severity, className: styles$6.description, children: helpText }) })
|
|
6945
|
+
] });
|
|
6946
|
+
};
|
|
6947
|
+
const InputWithLabelAndHelpText = (props) => {
|
|
6948
|
+
const { children, ...restProps } = props;
|
|
6949
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InputWithHelpText, { ...restProps, children });
|
|
6950
|
+
};
|
|
6951
|
+
const useFormikInput = (props) => {
|
|
6952
|
+
const { id, field, formId: formId2, size, showInputOnly, ...rest } = props;
|
|
6953
|
+
const [fieldProps, meta, helpers] = formik.useField(field.getId());
|
|
6954
|
+
const { touched } = meta;
|
|
6955
|
+
const helpText = meta.error ?? field.description;
|
|
6956
|
+
const severity = meta.error ? "danger" : void 0;
|
|
6957
|
+
const inputId = id ?? `${formId2}-${field.getId()}-input`;
|
|
6958
|
+
const labelId = `${inputId}-label`;
|
|
6959
|
+
const label = field.required ? `${field.label} *` : field.label;
|
|
6960
|
+
const fieldPropsWithValidation = React.useMemo(() => {
|
|
6961
|
+
const handleChange = (e) => {
|
|
6962
|
+
const value = field.getValueFromChangeEvent(e);
|
|
6963
|
+
void helpers.setValue(value, false).then();
|
|
6964
|
+
if (touched || !field.onlyValidateAfterTouched) {
|
|
6965
|
+
helpers.setError(field.getError(value));
|
|
6966
|
+
}
|
|
6967
|
+
};
|
|
6968
|
+
const handleBlur = (e) => {
|
|
6969
|
+
void helpers.setTouched(true, false).then();
|
|
6970
|
+
helpers.setError(field.getError(field.getValueFromChangeEvent(e)));
|
|
6971
|
+
};
|
|
6972
|
+
return {
|
|
6973
|
+
...fieldProps,
|
|
6974
|
+
onChange: handleChange,
|
|
6975
|
+
onBlur: handleBlur
|
|
6976
|
+
};
|
|
6977
|
+
}, [field, fieldProps, helpers, touched]);
|
|
6978
|
+
return [
|
|
6979
|
+
{
|
|
6980
|
+
helpText,
|
|
6981
|
+
size,
|
|
6982
|
+
severity,
|
|
6983
|
+
inputId,
|
|
6984
|
+
labelId,
|
|
6985
|
+
label,
|
|
6986
|
+
showInputOnly,
|
|
6987
|
+
fieldProps: fieldPropsWithValidation,
|
|
6988
|
+
helpers,
|
|
6989
|
+
field
|
|
6990
|
+
},
|
|
6991
|
+
{ ...rest, "aria-labelledby": labelId }
|
|
6992
|
+
];
|
|
6993
|
+
};
|
|
6994
|
+
const truthyValues = [true, "true"];
|
|
6995
|
+
const BooleanInput = React.memo((props) => {
|
|
6996
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
|
|
6997
|
+
let [{ helpText, label }] = useFormikInput(props);
|
|
6998
|
+
helpText = showInputOnly ? null : helpText;
|
|
6999
|
+
label = showInputOnly ? "" : label;
|
|
7000
|
+
const color = blocks.useSeverityColor(severity);
|
|
7001
|
+
const value = truthyValues.includes(fieldProps.value);
|
|
7002
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7003
|
+
InputWithLabel,
|
|
7004
|
+
{
|
|
7005
|
+
size,
|
|
7006
|
+
severity,
|
|
7007
|
+
inputId,
|
|
7008
|
+
labelId,
|
|
7009
|
+
label,
|
|
7010
|
+
image: showInputOnly ? void 0 : field.image,
|
|
7011
|
+
flexProps: { direction: "row-reverse", justify: "end", align: "center", gap: "2" },
|
|
7012
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7013
|
+
blocks.Checkbox,
|
|
7014
|
+
{
|
|
7015
|
+
...rest,
|
|
7016
|
+
...fieldProps,
|
|
7017
|
+
id: inputId,
|
|
7018
|
+
color,
|
|
7019
|
+
value: value.toString(),
|
|
7020
|
+
checked: value,
|
|
7021
|
+
onCheckedChange: fieldProps.onChange,
|
|
7022
|
+
onChange: void 0,
|
|
7023
|
+
onBlur: void 0
|
|
7024
|
+
}
|
|
7025
|
+
)
|
|
7026
|
+
}
|
|
7027
|
+
) });
|
|
7028
|
+
});
|
|
7029
|
+
BooleanInput.displayName = "BooleanInput";
|
|
7008
7030
|
const emptyBooleanField = {
|
|
7009
7031
|
...emptyBaseField,
|
|
7010
7032
|
type: "boolean"
|
|
@@ -8433,25 +8455,36 @@ var __publicField = (obj, key, value) => {
|
|
|
8433
8455
|
Content: TabsContent
|
|
8434
8456
|
});
|
|
8435
8457
|
const NumberInput = React.memo((props) => {
|
|
8436
|
-
const [{ inputId, labelId, size, severity, showInputOnly,
|
|
8458
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
|
|
8437
8459
|
let [{ helpText, label }] = useFormikInput(props);
|
|
8438
8460
|
helpText = showInputOnly ? null : helpText;
|
|
8439
8461
|
label = showInputOnly ? "" : label;
|
|
8440
8462
|
const color = blocks.useSeverityColor(severity);
|
|
8441
|
-
return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8442
|
-
|
|
8463
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8464
|
+
InputWithLabel,
|
|
8443
8465
|
{
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8466
|
+
size,
|
|
8467
|
+
severity,
|
|
8468
|
+
inputId,
|
|
8469
|
+
labelId,
|
|
8470
|
+
label,
|
|
8471
|
+
image: showInputOnly ? void 0 : field.image,
|
|
8472
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8473
|
+
TextField$1.Input,
|
|
8474
|
+
{
|
|
8475
|
+
...rest,
|
|
8476
|
+
...fieldProps,
|
|
8477
|
+
type: "number",
|
|
8478
|
+
id: inputId,
|
|
8479
|
+
placeholder: "Enter a number",
|
|
8480
|
+
min: field.minimum,
|
|
8481
|
+
max: field.maximum,
|
|
8482
|
+
step: field.integers ? 1 : 0.1,
|
|
8483
|
+
color
|
|
8484
|
+
}
|
|
8485
|
+
)
|
|
8453
8486
|
}
|
|
8454
|
-
) })
|
|
8487
|
+
) });
|
|
8455
8488
|
});
|
|
8456
8489
|
NumberInput.displayName = "NumberInput";
|
|
8457
8490
|
const emptyNumberField = {
|
|
@@ -8585,13 +8618,24 @@ var __publicField = (obj, key, value) => {
|
|
|
8585
8618
|
});
|
|
8586
8619
|
let NumberField = _NumberField;
|
|
8587
8620
|
const DateInput = React.memo((props) => {
|
|
8588
|
-
const [{ inputId, labelId, size, severity, showInputOnly, fieldProps }, rest] = useFormikInput(props);
|
|
8621
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
|
|
8589
8622
|
let [{ helpText, label }] = useFormikInput(props);
|
|
8590
8623
|
helpText = showInputOnly ? null : helpText;
|
|
8591
8624
|
label = showInputOnly ? "" : label;
|
|
8592
8625
|
const color = blocks.useSeverityColor(severity);
|
|
8593
8626
|
const value = fieldProps.value ? fieldProps.value.split("T")[0] : "";
|
|
8594
|
-
return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8627
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8628
|
+
InputWithLabel,
|
|
8629
|
+
{
|
|
8630
|
+
size,
|
|
8631
|
+
severity,
|
|
8632
|
+
inputId,
|
|
8633
|
+
labelId,
|
|
8634
|
+
label,
|
|
8635
|
+
image: showInputOnly ? void 0 : field.image,
|
|
8636
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(TextField$1.Input, { ...rest, ...fieldProps, type: "date", id: inputId, color, value })
|
|
8637
|
+
}
|
|
8638
|
+
) });
|
|
8595
8639
|
});
|
|
8596
8640
|
DateInput.displayName = "DateInput";
|
|
8597
8641
|
const emptyDateField = {
|
|
@@ -8735,43 +8779,54 @@ var __publicField = (obj, key, value) => {
|
|
|
8735
8779
|
TextFieldInputCopy
|
|
8736
8780
|
};
|
|
8737
8781
|
const StringInput = React.memo((props) => {
|
|
8738
|
-
const [{ inputId, labelId, size, severity, showInputOnly,
|
|
8782
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
|
|
8739
8783
|
let [{ helpText, label }] = useFormikInput(props);
|
|
8740
8784
|
helpText = showInputOnly ? null : helpText;
|
|
8741
8785
|
label = showInputOnly ? "" : label;
|
|
8742
8786
|
const color = blocks.useSeverityColor(severity);
|
|
8743
|
-
return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8744
|
-
|
|
8787
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8788
|
+
InputWithLabel,
|
|
8745
8789
|
{
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8790
|
+
size,
|
|
8791
|
+
severity,
|
|
8792
|
+
inputId,
|
|
8793
|
+
labelId,
|
|
8794
|
+
label,
|
|
8795
|
+
image: showInputOnly ? void 0 : field.image,
|
|
8796
|
+
children: !rest.disabled || !fieldProps.value ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8797
|
+
TextField$1.Input,
|
|
8798
|
+
{
|
|
8799
|
+
...rest,
|
|
8800
|
+
...fieldProps,
|
|
8801
|
+
type: field.inputType,
|
|
8802
|
+
id: inputId,
|
|
8803
|
+
placeholder: "Enter a short description",
|
|
8804
|
+
color
|
|
8805
|
+
}
|
|
8806
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(TextField$1.Root, { className: styles$5.clickableLinkContainer, children: [
|
|
8807
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8808
|
+
"div",
|
|
8763
8809
|
{
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
children:
|
|
8810
|
+
className: classNames$1(
|
|
8811
|
+
"rt-TextFieldInput rt-r-size-2 rt-variant-surface",
|
|
8812
|
+
styles$5.TextFieldInputCopy
|
|
8813
|
+
),
|
|
8814
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8815
|
+
Linkify,
|
|
8816
|
+
{
|
|
8817
|
+
options: {
|
|
8818
|
+
target: "_blank",
|
|
8819
|
+
rel: "noopener"
|
|
8820
|
+
},
|
|
8821
|
+
children: fieldProps.value
|
|
8822
|
+
}
|
|
8823
|
+
)
|
|
8769
8824
|
}
|
|
8770
|
-
)
|
|
8771
|
-
|
|
8772
|
-
|
|
8773
|
-
|
|
8774
|
-
|
|
8825
|
+
),
|
|
8826
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rt-TextFieldChrome" })
|
|
8827
|
+
] })
|
|
8828
|
+
}
|
|
8829
|
+
) });
|
|
8775
8830
|
});
|
|
8776
8831
|
StringInput.displayName = "StringInput";
|
|
8777
8832
|
const emptyStringField = {
|
|
@@ -8807,21 +8862,32 @@ var __publicField = (obj, key, value) => {
|
|
|
8807
8862
|
__publicField(_StringField, "Icon", InputIcon);
|
|
8808
8863
|
let StringField = _StringField;
|
|
8809
8864
|
const TextInput = React.memo((props) => {
|
|
8810
|
-
const [{ inputId, labelId, size, severity, showInputOnly, fieldProps }, rest] = useFormikInput(props);
|
|
8865
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
|
|
8811
8866
|
let [{ helpText, label }] = useFormikInput(props);
|
|
8812
8867
|
helpText = showInputOnly ? null : helpText;
|
|
8813
8868
|
label = showInputOnly ? "" : label;
|
|
8814
|
-
return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8815
|
-
|
|
8869
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8870
|
+
InputWithLabel,
|
|
8816
8871
|
{
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8872
|
+
size,
|
|
8873
|
+
severity,
|
|
8874
|
+
inputId,
|
|
8875
|
+
labelId,
|
|
8876
|
+
label,
|
|
8877
|
+
image: showInputOnly ? void 0 : field.image,
|
|
8878
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8879
|
+
blocks.TextArea,
|
|
8880
|
+
{
|
|
8881
|
+
...rest,
|
|
8882
|
+
...fieldProps,
|
|
8883
|
+
resize: "vertical",
|
|
8884
|
+
id: inputId,
|
|
8885
|
+
placeholder: "Enter a description",
|
|
8886
|
+
severity
|
|
8887
|
+
}
|
|
8888
|
+
)
|
|
8823
8889
|
}
|
|
8824
|
-
) })
|
|
8890
|
+
) });
|
|
8825
8891
|
});
|
|
8826
8892
|
TextInput.displayName = "TextInput";
|
|
8827
8893
|
const emptyTextField = {
|
|
@@ -8853,7 +8919,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8853
8919
|
__publicField(_TextField, "Icon", RowsIcon);
|
|
8854
8920
|
let TextField = _TextField;
|
|
8855
8921
|
const SelectInput = React.memo((props) => {
|
|
8856
|
-
const [{ inputId, labelId, size, severity, showInputOnly,
|
|
8922
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
|
|
8857
8923
|
const { onChange, onBlur } = fieldProps;
|
|
8858
8924
|
let [{ helpText, label }] = useFormikInput(props);
|
|
8859
8925
|
helpText = showInputOnly ? null : helpText;
|
|
@@ -8869,18 +8935,29 @@ var __publicField = (obj, key, value) => {
|
|
|
8869
8935
|
},
|
|
8870
8936
|
[onChange, onBlur]
|
|
8871
8937
|
);
|
|
8872
|
-
return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8873
|
-
|
|
8938
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8939
|
+
InputWithLabel,
|
|
8874
8940
|
{
|
|
8875
|
-
|
|
8876
|
-
...fieldProps,
|
|
8877
|
-
onValueChange: handleChange,
|
|
8878
|
-
placeholder: "Select one...",
|
|
8879
|
-
id: inputId,
|
|
8941
|
+
size,
|
|
8880
8942
|
severity,
|
|
8881
|
-
|
|
8943
|
+
inputId,
|
|
8944
|
+
labelId,
|
|
8945
|
+
label,
|
|
8946
|
+
image: showInputOnly ? void 0 : field.image,
|
|
8947
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8948
|
+
blocks.Select,
|
|
8949
|
+
{
|
|
8950
|
+
items: options,
|
|
8951
|
+
...fieldProps,
|
|
8952
|
+
onValueChange: handleChange,
|
|
8953
|
+
placeholder: "Select one...",
|
|
8954
|
+
id: inputId,
|
|
8955
|
+
severity,
|
|
8956
|
+
...rest
|
|
8957
|
+
}
|
|
8958
|
+
)
|
|
8882
8959
|
}
|
|
8883
|
-
) })
|
|
8960
|
+
) });
|
|
8884
8961
|
});
|
|
8885
8962
|
SelectInput.displayName = "SelectInput";
|
|
8886
8963
|
const emptySection = (id = "", fields = []) => ({
|
|
@@ -9048,7 +9125,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9048
9125
|
return { reorderSection, reorderField };
|
|
9049
9126
|
};
|
|
9050
9127
|
const MultiStringInput = React.memo((props) => {
|
|
9051
|
-
const [{ inputId, labelId, size, severity, showInputOnly, fieldProps }, rest] = useFormikInput(props);
|
|
9128
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
|
|
9052
9129
|
let [{ helpText, label }] = useFormikInput(props);
|
|
9053
9130
|
helpText = showInputOnly ? null : helpText;
|
|
9054
9131
|
label = showInputOnly ? "" : label;
|
|
@@ -9121,32 +9198,43 @@ var __publicField = (obj, key, value) => {
|
|
|
9121
9198
|
[setValueAndTouched, value]
|
|
9122
9199
|
);
|
|
9123
9200
|
return /* @__PURE__ */ jsxRuntime.jsx(dnd.DragDropContext, { onDragEnd: handleDragEnd, children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", gap: "2", children: [
|
|
9124
|
-
/* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText: updatedHelpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
|
|
9201
|
+
/* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText: updatedHelpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9202
|
+
InputWithLabel,
|
|
9203
|
+
{
|
|
9204
|
+
size,
|
|
9205
|
+
severity,
|
|
9206
|
+
inputId,
|
|
9207
|
+
labelId,
|
|
9208
|
+
label,
|
|
9209
|
+
image: showInputOnly ? void 0 : field.image,
|
|
9210
|
+
children: (!disabled || value.length === 0) && /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { gap: "2", children: [
|
|
9211
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { grow: "1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9212
|
+
TextField$1.Input,
|
|
9213
|
+
{
|
|
9214
|
+
placeholder: "Press enter to add a new option",
|
|
9215
|
+
...rest,
|
|
9216
|
+
...fieldProps,
|
|
9217
|
+
value: intermediateValue,
|
|
9218
|
+
onChange: handleChange,
|
|
9219
|
+
onKeyDown: handleKeyDown,
|
|
9220
|
+
id: inputId,
|
|
9221
|
+
color: updatedColor,
|
|
9222
|
+
onBlur: void 0
|
|
9223
|
+
}
|
|
9224
|
+
) }),
|
|
9225
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9226
|
+
blocks.IconButton,
|
|
9227
|
+
{
|
|
9228
|
+
type: "button",
|
|
9229
|
+
"aria-label": "Add option",
|
|
9230
|
+
disabled: !!internalError || disabled,
|
|
9231
|
+
onClick: addOption,
|
|
9232
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(PlusIcon, {})
|
|
9233
|
+
}
|
|
9234
|
+
)
|
|
9235
|
+
] })
|
|
9236
|
+
}
|
|
9237
|
+
) }),
|
|
9150
9238
|
/* @__PURE__ */ jsxRuntime.jsx(dnd.Droppable, { droppableId, children: (droppableProvided) => /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { ...droppableProvided.droppableProps, ref: droppableProvided.innerRef, direction: "column", children: [
|
|
9151
9239
|
value.map((option, index2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9152
9240
|
dnd.Draggable,
|
|
@@ -9328,7 +9416,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9328
9416
|
return [value];
|
|
9329
9417
|
};
|
|
9330
9418
|
const MultiSelectInput = React.memo((props) => {
|
|
9331
|
-
const [{ inputId, labelId, size, severity, showInputOnly,
|
|
9419
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
|
|
9332
9420
|
const { onChange, onBlur } = fieldProps;
|
|
9333
9421
|
let [{ helpText, label }] = useFormikInput(props);
|
|
9334
9422
|
helpText = showInputOnly ? null : helpText;
|
|
@@ -9341,19 +9429,30 @@ var __publicField = (obj, key, value) => {
|
|
|
9341
9429
|
},
|
|
9342
9430
|
[onChange, onBlur]
|
|
9343
9431
|
);
|
|
9344
|
-
return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9345
|
-
|
|
9432
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9433
|
+
InputWithLabel,
|
|
9346
9434
|
{
|
|
9347
|
-
|
|
9348
|
-
onValueChange: handleChange,
|
|
9349
|
-
options: field.options,
|
|
9350
|
-
name: fieldProps.name,
|
|
9351
|
-
placeholder: "Select one or more...",
|
|
9352
|
-
id: inputId,
|
|
9435
|
+
size,
|
|
9353
9436
|
severity,
|
|
9354
|
-
|
|
9437
|
+
inputId,
|
|
9438
|
+
labelId,
|
|
9439
|
+
label,
|
|
9440
|
+
image: showInputOnly ? void 0 : field.image,
|
|
9441
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9442
|
+
blocks.MultiSelect,
|
|
9443
|
+
{
|
|
9444
|
+
value,
|
|
9445
|
+
onValueChange: handleChange,
|
|
9446
|
+
options: field.options,
|
|
9447
|
+
name: fieldProps.name,
|
|
9448
|
+
placeholder: "Select one or more...",
|
|
9449
|
+
id: inputId,
|
|
9450
|
+
severity,
|
|
9451
|
+
...rest
|
|
9452
|
+
}
|
|
9453
|
+
)
|
|
9355
9454
|
}
|
|
9356
|
-
) })
|
|
9455
|
+
) });
|
|
9357
9456
|
});
|
|
9358
9457
|
MultiSelectInput.displayName = "MultiSelectInput";
|
|
9359
9458
|
const emptyMultiSelectField = {
|
|
@@ -9429,23 +9528,15 @@ var __publicField = (obj, key, value) => {
|
|
|
9429
9528
|
super(options, FieldInputCloner);
|
|
9430
9529
|
}
|
|
9431
9530
|
}
|
|
9432
|
-
const previewImage = "
|
|
9433
|
-
const nameContainer = "
|
|
9434
|
-
const hasPreview = "
|
|
9435
|
-
const useEllipsis = "
|
|
9436
|
-
const FullScreenImageContainer = "_FullScreenImageContainer_y4yd1_25";
|
|
9437
|
-
const fileName = "_fileName_y4yd1_35";
|
|
9438
|
-
const longIconButton = "_longIconButton_y4yd1_40";
|
|
9439
|
-
const FullScreenImage = "_FullScreenImage_y4yd1_25";
|
|
9531
|
+
const previewImage$1 = "_previewImage_ebhyt_1";
|
|
9532
|
+
const nameContainer = "_nameContainer_ebhyt_9";
|
|
9533
|
+
const hasPreview = "_hasPreview_ebhyt_14";
|
|
9534
|
+
const useEllipsis = "_useEllipsis_ebhyt_19";
|
|
9440
9535
|
const styles$4 = {
|
|
9441
|
-
previewImage,
|
|
9536
|
+
previewImage: previewImage$1,
|
|
9442
9537
|
nameContainer,
|
|
9443
9538
|
hasPreview,
|
|
9444
|
-
useEllipsis
|
|
9445
|
-
FullScreenImageContainer,
|
|
9446
|
-
fileName,
|
|
9447
|
-
longIconButton,
|
|
9448
|
-
FullScreenImage
|
|
9539
|
+
useEllipsis
|
|
9449
9540
|
};
|
|
9450
9541
|
const convertBytesToLargestUnit = (bytes) => {
|
|
9451
9542
|
const units = ["byte", "kilobyte", "megabyte"];
|
|
@@ -9465,7 +9556,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9465
9556
|
};
|
|
9466
9557
|
const UploadInput = React.memo((props) => {
|
|
9467
9558
|
var _a2;
|
|
9468
|
-
const [{ inputId, labelId, size, severity, helpText, showInputOnly,
|
|
9559
|
+
const [{ inputId, labelId, size, severity, helpText, showInputOnly, field, fieldProps }, rest] = useFormikInput(props);
|
|
9469
9560
|
const { onChange } = fieldProps;
|
|
9470
9561
|
let [{ label }] = useFormikInput(props);
|
|
9471
9562
|
label = showInputOnly ? "" : label;
|
|
@@ -9499,28 +9590,39 @@ var __publicField = (obj, key, value) => {
|
|
|
9499
9590
|
const singleButtonText = value ? "Select new file" : "Select a file";
|
|
9500
9591
|
const buttonText = field.maxFiles > 1 ? multipleButtonText : singleButtonText;
|
|
9501
9592
|
return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", gap: "2", children: [
|
|
9502
|
-
/* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText: updatedHelpText, severity, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
|
|
9593
|
+
/* @__PURE__ */ jsxRuntime.jsx(InputWithLabelAndHelpText, { helpText: updatedHelpText, severity, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9594
|
+
InputWithLabel,
|
|
9595
|
+
{
|
|
9596
|
+
size,
|
|
9597
|
+
severity,
|
|
9598
|
+
inputId,
|
|
9599
|
+
labelId,
|
|
9600
|
+
label,
|
|
9601
|
+
image: showInputOnly ? void 0 : field.image,
|
|
9602
|
+
children: [
|
|
9603
|
+
/* @__PURE__ */ jsxRuntime.jsx(blocks.Flex, { direction: "row", gap: "2", children: /* @__PURE__ */ jsxRuntime.jsx(Box, { width: "max-content", asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Button, { ...rest, variant: "soft", onClick: handleClick, id: "upload-input-upload-button", children: [
|
|
9604
|
+
/* @__PURE__ */ jsxRuntime.jsx(UploadIcon, {}),
|
|
9605
|
+
" ",
|
|
9606
|
+
buttonText
|
|
9607
|
+
] }) }) }),
|
|
9608
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9609
|
+
"input",
|
|
9610
|
+
{
|
|
9611
|
+
...rest,
|
|
9612
|
+
type: "file",
|
|
9613
|
+
ref: input,
|
|
9614
|
+
id: inputId,
|
|
9615
|
+
accept: (_a2 = field.extensions) == null ? void 0 : _a2.join(","),
|
|
9616
|
+
multiple: field.maxFiles > 1,
|
|
9617
|
+
color,
|
|
9618
|
+
style: { display: "none" },
|
|
9619
|
+
...fieldProps,
|
|
9620
|
+
value: ""
|
|
9621
|
+
}
|
|
9622
|
+
)
|
|
9623
|
+
]
|
|
9624
|
+
}
|
|
9625
|
+
) }),
|
|
9524
9626
|
Array.isArray(value) && value.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(blocks.Flex, { direction: "column", gap: "2", children: value.map((file, index2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9525
9627
|
DisplayFile,
|
|
9526
9628
|
{
|
|
@@ -9571,7 +9673,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9571
9673
|
throw new Error("Cannot download a file that is not resolved.");
|
|
9572
9674
|
}
|
|
9573
9675
|
const blob = new Blob([resolvedFile]);
|
|
9574
|
-
|
|
9676
|
+
saveAs.saveAs(blob, name);
|
|
9575
9677
|
},
|
|
9576
9678
|
[name, resolvedFile]
|
|
9577
9679
|
);
|
|
@@ -9626,51 +9728,13 @@ var __publicField = (obj, key, value) => {
|
|
|
9626
9728
|
}
|
|
9627
9729
|
}
|
|
9628
9730
|
),
|
|
9629
|
-
showPreview && /* @__PURE__ */ jsxRuntime.
|
|
9630
|
-
|
|
9731
|
+
showPreview && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9732
|
+
FullScreenImagePreview,
|
|
9631
9733
|
{
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
children: [
|
|
9637
|
-
/* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { align: "center", children: [
|
|
9638
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9639
|
-
blocks.IconButton,
|
|
9640
|
-
{
|
|
9641
|
-
className: styles$4.longIconButton,
|
|
9642
|
-
variant: "soft",
|
|
9643
|
-
"aria-label": "Exit preview",
|
|
9644
|
-
onClick: () => {
|
|
9645
|
-
setShowPreview(false);
|
|
9646
|
-
},
|
|
9647
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ArrowLeftIcon, {})
|
|
9648
|
-
}
|
|
9649
|
-
),
|
|
9650
|
-
/* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { className: styles$4.fileName, children: name }),
|
|
9651
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9652
|
-
blocks.IconButton,
|
|
9653
|
-
{
|
|
9654
|
-
className: styles$4.longIconButton,
|
|
9655
|
-
variant: "soft",
|
|
9656
|
-
"aria-label": `Download ${name}`,
|
|
9657
|
-
onClick: handleDownload,
|
|
9658
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(DownloadIcon, {})
|
|
9659
|
-
}
|
|
9660
|
-
)
|
|
9661
|
-
] }),
|
|
9662
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9663
|
-
"img",
|
|
9664
|
-
{
|
|
9665
|
-
className: styles$4.FullScreenImage,
|
|
9666
|
-
src: url,
|
|
9667
|
-
alt: name,
|
|
9668
|
-
onClick: (e) => {
|
|
9669
|
-
e.stopPropagation();
|
|
9670
|
-
}
|
|
9671
|
-
}
|
|
9672
|
-
)
|
|
9673
|
-
]
|
|
9734
|
+
file: resolvedFile,
|
|
9735
|
+
url,
|
|
9736
|
+
name,
|
|
9737
|
+
setShowPreview
|
|
9674
9738
|
}
|
|
9675
9739
|
)
|
|
9676
9740
|
] })
|
|
@@ -9684,7 +9748,6 @@ var __publicField = (obj, key, value) => {
|
|
|
9684
9748
|
maximum_size: void 0,
|
|
9685
9749
|
maximum_files: 1
|
|
9686
9750
|
};
|
|
9687
|
-
const largestSupportedSize = 50;
|
|
9688
9751
|
const _UploadField = class _UploadField extends BaseField {
|
|
9689
9752
|
constructor(options) {
|
|
9690
9753
|
const { extensions, maximum_files, maximum_size, ...base } = options;
|
|
@@ -9722,11 +9785,11 @@ var __publicField = (obj, key, value) => {
|
|
|
9722
9785
|
field: new NumberField({
|
|
9723
9786
|
// TODO: Default value
|
|
9724
9787
|
label: "What is the maximum size of each file?",
|
|
9725
|
-
description: `Maximum file size in megabytes (between 1MB–${
|
|
9788
|
+
description: `Maximum file size in megabytes (between 1MB–${maxFileSizeMB}MB).`,
|
|
9726
9789
|
required: false,
|
|
9727
9790
|
identifier: `${path}maximum_size`,
|
|
9728
9791
|
minimum: 1,
|
|
9729
|
-
maximum:
|
|
9792
|
+
maximum: maxFileSizeMB,
|
|
9730
9793
|
integers: true
|
|
9731
9794
|
}),
|
|
9732
9795
|
showDirectly: false
|
|
@@ -9766,7 +9829,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9766
9829
|
}
|
|
9767
9830
|
getFieldValidators() {
|
|
9768
9831
|
const validators = super.getFieldValidators();
|
|
9769
|
-
const maxFileSizeInMB = this.maxFileSize ??
|
|
9832
|
+
const maxFileSizeInMB = this.maxFileSize ?? maxFileSizeMB;
|
|
9770
9833
|
const maxFileSizeInB = maxFileSizeInMB * 1e3 * 1e3;
|
|
9771
9834
|
const maxFiles = this.maxFiles || 1;
|
|
9772
9835
|
validators.push((value) => {
|
|
@@ -9828,6 +9891,9 @@ var __publicField = (obj, key, value) => {
|
|
|
9828
9891
|
"multi-string": emptyMultiStringField,
|
|
9829
9892
|
"multi-select": emptyMultiSelectField
|
|
9830
9893
|
};
|
|
9894
|
+
const maxFileSizeMB = 50;
|
|
9895
|
+
const maxFileSizeKB = maxFileSizeMB * 1e3;
|
|
9896
|
+
const maxFileSizeB = maxFileSizeKB * 1e3;
|
|
9831
9897
|
const deserializeField = (serializedField) => {
|
|
9832
9898
|
const fieldType = serializedField.type;
|
|
9833
9899
|
const fieldCls = FieldTypeToClsMapping[fieldType];
|
|
@@ -10093,6 +10159,29 @@ var __publicField = (obj, key, value) => {
|
|
|
10093
10159
|
cloneDeep(values)
|
|
10094
10160
|
);
|
|
10095
10161
|
};
|
|
10162
|
+
const useAttachImagesToFormRevisionFields = (revision) => {
|
|
10163
|
+
const { sdk } = useSDK();
|
|
10164
|
+
const revisionCopy = React.useMemo(
|
|
10165
|
+
() => JSON.parse(JSON.stringify(revision)),
|
|
10166
|
+
[revision]
|
|
10167
|
+
);
|
|
10168
|
+
React.useEffect(() => {
|
|
10169
|
+
const attachments = selectRevisionAttachments(revisionCopy.offline_id)(sdk.store.getState()) ?? [];
|
|
10170
|
+
for (const attachment of attachments) {
|
|
10171
|
+
const filePromise = sdk.files.fetchFileFromUrl(attachment.file, attachment.file_sha1, attachment.file_name);
|
|
10172
|
+
let sectionIndex = -1;
|
|
10173
|
+
let fieldIndex = -1;
|
|
10174
|
+
sectionIndex = revisionCopy.fields.findIndex((section) => {
|
|
10175
|
+
fieldIndex = section.fields.findIndex((field) => field.identifier === attachment.field_identifier);
|
|
10176
|
+
return fieldIndex !== -1;
|
|
10177
|
+
});
|
|
10178
|
+
if (sectionIndex !== -1 && fieldIndex !== -1) {
|
|
10179
|
+
set(revisionCopy, `fields[${sectionIndex}].fields[${fieldIndex}].image`, filePromise);
|
|
10180
|
+
}
|
|
10181
|
+
}
|
|
10182
|
+
}, [revisionCopy, sdk]);
|
|
10183
|
+
return revisionCopy;
|
|
10184
|
+
};
|
|
10096
10185
|
const defaultHandleSubmit = () => {
|
|
10097
10186
|
throw new Error("onSubmit must be provided if form is not readonly.");
|
|
10098
10187
|
};
|
|
@@ -10161,9 +10250,10 @@ var __publicField = (obj, key, value) => {
|
|
|
10161
10250
|
`Could not find revision ${submission.form_revision} for submission ${submission.offline_id}.`
|
|
10162
10251
|
);
|
|
10163
10252
|
}
|
|
10253
|
+
const revisionWithImages = useAttachImagesToFormRevisionFields(revision);
|
|
10164
10254
|
const schema = React.useMemo(() => {
|
|
10165
|
-
return formRevisionToSchema(
|
|
10166
|
-
}, [
|
|
10255
|
+
return formRevisionToSchema(revisionWithImages, { readonly: true });
|
|
10256
|
+
}, [revisionWithImages]);
|
|
10167
10257
|
const submissionValuesWithAttachments = React.useMemo(() => {
|
|
10168
10258
|
const attachments = selectSubmissionAttachments(submission.offline_id)(sdk.store.getState()) ?? [];
|
|
10169
10259
|
const downloadedAttachments = {};
|
|
@@ -10450,9 +10540,9 @@ var __publicField = (obj, key, value) => {
|
|
|
10450
10540
|
PatchField.displayName = "PatchField";
|
|
10451
10541
|
const PatchFormProvider = React.memo(
|
|
10452
10542
|
React.forwardRef((props, ref) => {
|
|
10453
|
-
const { children, schema, values, onPatch, onError, ...rest } = props;
|
|
10543
|
+
const { children, schema, values, onPatch, onError, requiresDiff = true, onDirtyChange, ...rest } = props;
|
|
10454
10544
|
const initialValues2 = React.useMemo(() => initialFormValues(schema.fields, values), [schema.fields, values]);
|
|
10455
|
-
const
|
|
10545
|
+
const getDiff = React.useCallback(
|
|
10456
10546
|
(values2) => {
|
|
10457
10547
|
const diff = {};
|
|
10458
10548
|
for (const key in values2) {
|
|
@@ -10461,11 +10551,18 @@ var __publicField = (obj, key, value) => {
|
|
|
10461
10551
|
diff[key] = value;
|
|
10462
10552
|
}
|
|
10463
10553
|
}
|
|
10464
|
-
|
|
10554
|
+
return diff;
|
|
10555
|
+
},
|
|
10556
|
+
[initialValues2]
|
|
10557
|
+
);
|
|
10558
|
+
const handlePatch = React.useCallback(
|
|
10559
|
+
(values2) => {
|
|
10560
|
+
const diff = getDiff(values2);
|
|
10561
|
+
if (requiresDiff && !hasKeys(diff))
|
|
10465
10562
|
return;
|
|
10466
10563
|
onPatch(diff);
|
|
10467
10564
|
},
|
|
10468
|
-
[
|
|
10565
|
+
[getDiff, onPatch, requiresDiff]
|
|
10469
10566
|
);
|
|
10470
10567
|
const validate = React.useCallback(
|
|
10471
10568
|
(form) => {
|
|
@@ -10473,9 +10570,13 @@ var __publicField = (obj, key, value) => {
|
|
|
10473
10570
|
if (error2) {
|
|
10474
10571
|
onError(error2);
|
|
10475
10572
|
}
|
|
10573
|
+
if (onDirtyChange) {
|
|
10574
|
+
const diff = getDiff(form);
|
|
10575
|
+
onDirtyChange(hasKeys(diff));
|
|
10576
|
+
}
|
|
10476
10577
|
return error2;
|
|
10477
10578
|
},
|
|
10478
|
-
[schema, onError]
|
|
10579
|
+
[schema, onDirtyChange, onError, getDiff]
|
|
10479
10580
|
);
|
|
10480
10581
|
const formik$1 = formik.useFormik({
|
|
10481
10582
|
initialValues: initialValues2,
|
|
@@ -10485,13 +10586,21 @@ var __publicField = (obj, key, value) => {
|
|
|
10485
10586
|
validateOnBlur: false,
|
|
10486
10587
|
validateOnChange: false
|
|
10487
10588
|
});
|
|
10589
|
+
const handleChange = React.useCallback(() => {
|
|
10590
|
+
if (onDirtyChange) {
|
|
10591
|
+
const diff = getDiff(formik$1.values);
|
|
10592
|
+
if (hasKeys(diff)) {
|
|
10593
|
+
onDirtyChange(true);
|
|
10594
|
+
}
|
|
10595
|
+
}
|
|
10596
|
+
}, [formik$1.values, getDiff, onDirtyChange]);
|
|
10488
10597
|
const { errors, resetForm } = formik$1;
|
|
10489
10598
|
React.useEffect(() => {
|
|
10490
10599
|
if (hasKeys(errors)) {
|
|
10491
10600
|
resetForm({ values: initialValues2, errors: {} });
|
|
10492
10601
|
}
|
|
10493
10602
|
}, [errors, initialValues2, resetForm]);
|
|
10494
|
-
return /* @__PURE__ */ jsxRuntime.jsx(formik.FormikProvider, { value: formik$1, children: /* @__PURE__ */ jsxRuntime.jsx("form", { ...rest, ref, onSubmit: formik$1.handleSubmit, children }) });
|
|
10603
|
+
return /* @__PURE__ */ jsxRuntime.jsx(formik.FormikProvider, { value: formik$1, children: /* @__PURE__ */ jsxRuntime.jsx("form", { ...rest, ref, onSubmit: formik$1.handleSubmit, onChange: handleChange, children }) });
|
|
10495
10604
|
})
|
|
10496
10605
|
);
|
|
10497
10606
|
const typeBadge$1 = "_typeBadge_an5ff_1";
|
|
@@ -10505,8 +10614,12 @@ var __publicField = (obj, key, value) => {
|
|
|
10505
10614
|
sm: mobile ? "none" : display
|
|
10506
10615
|
});
|
|
10507
10616
|
const FieldActions = React.memo((props) => {
|
|
10508
|
-
const { index: index2, sectionIndex, remove: remove2, duplicate, move } = props;
|
|
10617
|
+
const { index: index2, type, sectionIndex, remove: remove2, duplicate, move, upload } = props;
|
|
10618
|
+
if (type !== "section" && !upload) {
|
|
10619
|
+
throw new Error("Upload function prop must be defined for non-section fields.");
|
|
10620
|
+
}
|
|
10509
10621
|
const { values } = formik.useFormikContext();
|
|
10622
|
+
const fileInputRef = React.useRef(null);
|
|
10510
10623
|
const actions = React.useMemo(() => {
|
|
10511
10624
|
const actions2 = [
|
|
10512
10625
|
{
|
|
@@ -10517,11 +10630,24 @@ var __publicField = (obj, key, value) => {
|
|
|
10517
10630
|
},
|
|
10518
10631
|
{
|
|
10519
10632
|
Icon: TrashIcon,
|
|
10520
|
-
buttonProps: { onClick: remove2 },
|
|
10521
10633
|
key: "delete",
|
|
10522
|
-
text: "Delete"
|
|
10634
|
+
text: "Delete",
|
|
10635
|
+
buttonProps: { onClick: remove2 }
|
|
10523
10636
|
}
|
|
10524
10637
|
];
|
|
10638
|
+
if (type !== "section") {
|
|
10639
|
+
actions2.unshift({
|
|
10640
|
+
Icon: ImageIcon,
|
|
10641
|
+
key: "upload",
|
|
10642
|
+
text: "Upload image",
|
|
10643
|
+
buttonProps: {
|
|
10644
|
+
onClick: () => {
|
|
10645
|
+
var _a2;
|
|
10646
|
+
(_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
|
|
10647
|
+
}
|
|
10648
|
+
}
|
|
10649
|
+
});
|
|
10650
|
+
}
|
|
10525
10651
|
if (sectionIndex === void 0 && index2 !== values.fields.length - 1 || sectionIndex !== void 0 && (sectionIndex < values.fields.length - 1 || index2 !== values.fields[sectionIndex].fields.length - 1)) {
|
|
10526
10652
|
actions2.unshift({
|
|
10527
10653
|
Icon: ArrowDownIcon,
|
|
@@ -10547,7 +10673,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10547
10673
|
});
|
|
10548
10674
|
}
|
|
10549
10675
|
return actions2;
|
|
10550
|
-
}, [duplicate, index2, move, remove2, sectionIndex, values.fields]);
|
|
10676
|
+
}, [duplicate, index2, move, remove2, sectionIndex, type, values.fields]);
|
|
10551
10677
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10552
10678
|
/* @__PURE__ */ jsxRuntime.jsx(blocks.Flex, { display: forMobile(false, "flex"), direction: "column", gap: "5", mx: "2", children: actions.map((Action) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
10553
10679
|
blocks.IconButton,
|
|
@@ -10576,17 +10702,36 @@ var __publicField = (obj, key, value) => {
|
|
|
10576
10702
|
};
|
|
10577
10703
|
})
|
|
10578
10704
|
}
|
|
10579
|
-
) })
|
|
10705
|
+
) }),
|
|
10706
|
+
type !== "section" && /* @__PURE__ */ jsxRuntime.jsx("input", { style: { display: "none" }, ref: fileInputRef, type: "file", accept: "image/*", onChange: upload })
|
|
10580
10707
|
] });
|
|
10581
10708
|
});
|
|
10582
10709
|
FieldActions.displayName = "FieldActions";
|
|
10583
|
-
const
|
|
10584
|
-
const
|
|
10585
|
-
const
|
|
10586
|
-
const
|
|
10587
|
-
const
|
|
10710
|
+
const description = "_description_13g4a_1";
|
|
10711
|
+
const floatingButtonContainer = "_floatingButtonContainer_13g4a_5";
|
|
10712
|
+
const FullScreenImageContainer = "_FullScreenImageContainer_13g4a_12";
|
|
10713
|
+
const fileName = "_fileName_13g4a_22";
|
|
10714
|
+
const longIconButton = "_longIconButton_13g4a_27";
|
|
10715
|
+
const previewImage = "_previewImage_13g4a_33";
|
|
10716
|
+
const FullScreenImage = "_FullScreenImage_13g4a_12";
|
|
10717
|
+
const popoverInputsContainer = "_popoverInputsContainer_13g4a_51";
|
|
10718
|
+
const imageContainer = "_imageContainer_13g4a_55";
|
|
10719
|
+
const deleteImageButton = "_deleteImageButton_13g4a_60";
|
|
10720
|
+
const typeBadge = "_typeBadge_13g4a_71";
|
|
10721
|
+
const previewInput = "_previewInput_13g4a_76";
|
|
10722
|
+
const directInput = "_directInput_13g4a_80";
|
|
10723
|
+
const grow = "_grow_13g4a_85";
|
|
10588
10724
|
const styles = {
|
|
10725
|
+
description,
|
|
10726
|
+
floatingButtonContainer,
|
|
10727
|
+
FullScreenImageContainer,
|
|
10728
|
+
fileName,
|
|
10729
|
+
longIconButton,
|
|
10730
|
+
previewImage,
|
|
10731
|
+
FullScreenImage,
|
|
10589
10732
|
popoverInputsContainer,
|
|
10733
|
+
imageContainer,
|
|
10734
|
+
deleteImageButton,
|
|
10590
10735
|
typeBadge,
|
|
10591
10736
|
previewInput,
|
|
10592
10737
|
directInput,
|
|
@@ -10622,6 +10767,9 @@ var __publicField = (obj, key, value) => {
|
|
|
10622
10767
|
});
|
|
10623
10768
|
}, [onSelect]);
|
|
10624
10769
|
};
|
|
10770
|
+
const isSection = (field) => {
|
|
10771
|
+
return field.type === "section";
|
|
10772
|
+
};
|
|
10625
10773
|
const FieldSettingsPopover = React.memo((props) => {
|
|
10626
10774
|
const { popoverInputs, hasError } = props;
|
|
10627
10775
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10651,6 +10799,8 @@ var __publicField = (obj, key, value) => {
|
|
|
10651
10799
|
const FieldBuilder = React.memo((props) => {
|
|
10652
10800
|
var _a2, _b, _c, _d, _e, _f;
|
|
10653
10801
|
const { parentPath, index: index2, initial, conditionalSourceFields } = props;
|
|
10802
|
+
const { values, setFieldValue, errors } = formik.useFormikContext();
|
|
10803
|
+
const fieldTypeItems = useFieldTypeItems();
|
|
10654
10804
|
const RADIX_SM_MIN_WIDTH = 576;
|
|
10655
10805
|
const [isLargeScreen, setIsLargeScreen] = React.useState(
|
|
10656
10806
|
window.matchMedia(`(min-width: ${RADIX_SM_MIN_WIDTH}px)`).matches
|
|
@@ -10665,22 +10815,39 @@ var __publicField = (obj, key, value) => {
|
|
|
10665
10815
|
mediaQuery.removeEventListener("change", handleMediaQueryChange);
|
|
10666
10816
|
};
|
|
10667
10817
|
}, []);
|
|
10668
|
-
const
|
|
10669
|
-
const
|
|
10670
|
-
|
|
10671
|
-
|
|
10672
|
-
|
|
10818
|
+
const [resolvedImage, setResolvedImage] = React.useState(void 0);
|
|
10819
|
+
const [showImagePreview, setShowImagePreview] = React.useState(false);
|
|
10820
|
+
React.useEffect(() => {
|
|
10821
|
+
if (!isSection(initial)) {
|
|
10822
|
+
if (initial.image instanceof Promise) {
|
|
10823
|
+
initial.image.then(setResolvedImage).catch(console.error);
|
|
10824
|
+
} else {
|
|
10825
|
+
setResolvedImage(initial.image);
|
|
10826
|
+
}
|
|
10827
|
+
} else {
|
|
10828
|
+
setResolvedImage(void 0);
|
|
10829
|
+
}
|
|
10830
|
+
}, [initial]);
|
|
10831
|
+
const resolvedImageURL = resolvedImage ? URL.createObjectURL(resolvedImage) : void 0;
|
|
10832
|
+
const handleImageDelete = React.useCallback(
|
|
10833
|
+
(event) => {
|
|
10834
|
+
event.stopPropagation();
|
|
10835
|
+
const { image: _, ...fieldWithoutImage } = initial;
|
|
10836
|
+
void setFieldValue(`${parentPath}.${index2}`, fieldWithoutImage).then();
|
|
10837
|
+
},
|
|
10838
|
+
[index2, initial, parentPath, setFieldValue]
|
|
10839
|
+
);
|
|
10673
10840
|
React.useEffect(() => {
|
|
10674
10841
|
if (isSection(initial) && !initial.conditional) {
|
|
10675
10842
|
void setFieldValue(`${parentPath}.${index2}.condition`, null).then();
|
|
10676
10843
|
}
|
|
10677
|
-
}, [index2, initial,
|
|
10844
|
+
}, [index2, initial, parentPath, setFieldValue]);
|
|
10678
10845
|
const conditionLabel = React.useMemo(
|
|
10679
10846
|
() => {
|
|
10680
10847
|
var _a3, _b2;
|
|
10681
10848
|
return isSection(initial) ? (_b2 = findFieldByIdentifier(values.fields, (_a3 = initial.condition) == null ? void 0 : _a3.identifier)) == null ? void 0 : _b2.label : void 0;
|
|
10682
10849
|
},
|
|
10683
|
-
[initial,
|
|
10850
|
+
[initial, values.fields]
|
|
10684
10851
|
);
|
|
10685
10852
|
const conditionComparison = isSection(initial) ? Array.isArray((_a2 = initial.condition) == null ? void 0 : _a2.value) ? "contains all of" : "equals" : void 0;
|
|
10686
10853
|
let conditionValue = void 0;
|
|
@@ -10791,6 +10958,41 @@ var __publicField = (obj, key, value) => {
|
|
|
10791
10958
|
/* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { align: "center", gap: "3", children: [
|
|
10792
10959
|
/* @__PURE__ */ jsxRuntime.jsx(blocks.Badge, { className: styles.typeBadge, children: (_f = fieldTypeItems.flat().find((item) => item.value === type)) == null ? void 0 : _f.content }),
|
|
10793
10960
|
showPopoverInputs && /* @__PURE__ */ jsxRuntime.jsx(FieldSettingsPopover, { popoverInputs, hasError: popoverHasErrors })
|
|
10961
|
+
] }),
|
|
10962
|
+
resolvedImage && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10963
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.imageContainer, children: [
|
|
10964
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10965
|
+
"img",
|
|
10966
|
+
{
|
|
10967
|
+
className: styles.previewImage,
|
|
10968
|
+
src: resolvedImageURL,
|
|
10969
|
+
alt: resolvedImage.name,
|
|
10970
|
+
onClick: () => {
|
|
10971
|
+
setShowImagePreview(true);
|
|
10972
|
+
}
|
|
10973
|
+
}
|
|
10974
|
+
),
|
|
10975
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10976
|
+
blocks.IconButton,
|
|
10977
|
+
{
|
|
10978
|
+
className: styles.deleteImageButton,
|
|
10979
|
+
variant: "solid",
|
|
10980
|
+
severity: "danger",
|
|
10981
|
+
"aria-label": "delete",
|
|
10982
|
+
onClick: handleImageDelete,
|
|
10983
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(TrashIcon, {})
|
|
10984
|
+
}
|
|
10985
|
+
)
|
|
10986
|
+
] }),
|
|
10987
|
+
showImagePreview && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10988
|
+
FullScreenImagePreview,
|
|
10989
|
+
{
|
|
10990
|
+
file: resolvedImage,
|
|
10991
|
+
url: resolvedImageURL,
|
|
10992
|
+
name: resolvedImage.name,
|
|
10993
|
+
setShowPreview: setShowImagePreview
|
|
10994
|
+
}
|
|
10995
|
+
)
|
|
10794
10996
|
] })
|
|
10795
10997
|
] }),
|
|
10796
10998
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10847,6 +11049,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10847
11049
|
const { field, index: index2, sectionIndex, takenLabels, remove: remove2 } = props;
|
|
10848
11050
|
const { setFieldValue, values } = formik.useFormikContext();
|
|
10849
11051
|
const { reorderField } = useFieldReordering();
|
|
11052
|
+
const { showError } = blocks.useToast();
|
|
10850
11053
|
const parentPath = `fields.${sectionIndex}.fields`;
|
|
10851
11054
|
const editFieldProps = React.useMemo(
|
|
10852
11055
|
() => ({
|
|
@@ -10890,6 +11093,28 @@ var __publicField = (obj, key, value) => {
|
|
|
10890
11093
|
},
|
|
10891
11094
|
[sectionIndex, values.fields, index2, reorderField, setFieldValue]
|
|
10892
11095
|
);
|
|
11096
|
+
const uploadImage = React.useCallback(
|
|
11097
|
+
(event) => {
|
|
11098
|
+
const { files } = event.target;
|
|
11099
|
+
if (!files || files.length !== 1)
|
|
11100
|
+
return;
|
|
11101
|
+
const file = files.item(0);
|
|
11102
|
+
if (!file)
|
|
11103
|
+
return;
|
|
11104
|
+
if (file.size > maxFileSizeB) {
|
|
11105
|
+
showError({
|
|
11106
|
+
title: "File upload error",
|
|
11107
|
+
description: `The file ${file.name} exceeded the maximum file size`
|
|
11108
|
+
});
|
|
11109
|
+
return;
|
|
11110
|
+
}
|
|
11111
|
+
void setFieldValue(`${parentPath}.${index2}`, {
|
|
11112
|
+
...field,
|
|
11113
|
+
image: file
|
|
11114
|
+
}).then();
|
|
11115
|
+
},
|
|
11116
|
+
[field, index2, parentPath, setFieldValue, showError]
|
|
11117
|
+
);
|
|
10893
11118
|
return /* @__PURE__ */ jsxRuntime.jsx(dnd.Draggable, { draggableId: field.identifier, index: index2, children: (draggableProvided) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
10894
11119
|
Card,
|
|
10895
11120
|
{
|
|
@@ -10908,10 +11133,12 @@ var __publicField = (obj, key, value) => {
|
|
|
10908
11133
|
FieldActions,
|
|
10909
11134
|
{
|
|
10910
11135
|
index: index2,
|
|
11136
|
+
type: field.type,
|
|
10911
11137
|
sectionIndex,
|
|
10912
11138
|
remove: remove2,
|
|
10913
11139
|
duplicate: duplicateField,
|
|
10914
|
-
move: moveField
|
|
11140
|
+
move: moveField,
|
|
11141
|
+
upload: uploadImage
|
|
10915
11142
|
}
|
|
10916
11143
|
)
|
|
10917
11144
|
] })
|
|
@@ -10919,12 +11146,6 @@ var __publicField = (obj, key, value) => {
|
|
|
10919
11146
|
) });
|
|
10920
11147
|
});
|
|
10921
11148
|
FieldWithActions.displayName = "FieldWithActions";
|
|
10922
|
-
const FieldTypeDropdown = React.memo((props) => {
|
|
10923
|
-
const { setFieldType, children } = props;
|
|
10924
|
-
const fieldTypeItems = useFieldTypeItems(setFieldType);
|
|
10925
|
-
return /* @__PURE__ */ jsxRuntime.jsx(blocks.DropdownItemMenu, { trigger: children, items: fieldTypeItems.flat() });
|
|
10926
|
-
});
|
|
10927
|
-
FieldTypeDropdown.displayName = "FieldTypeDropdown";
|
|
10928
11149
|
const FieldSectionWithActions = React.memo((props) => {
|
|
10929
11150
|
var _a2;
|
|
10930
11151
|
const { field, index: sectionIndex, dropState } = props;
|
|
@@ -11060,6 +11281,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11060
11281
|
},
|
|
11061
11282
|
[sectionIndex, field.fields.length, values, setFieldValue]
|
|
11062
11283
|
);
|
|
11284
|
+
const fieldTypeItems = useFieldTypeItems(handleCreateField);
|
|
11063
11285
|
return /* @__PURE__ */ jsxRuntime.jsx(dnd.Draggable, { draggableId: field.identifier, index: sectionIndex, children: (draggableProvided) => {
|
|
11064
11286
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11065
11287
|
Card,
|
|
@@ -11099,10 +11321,16 @@ var __publicField = (obj, key, value) => {
|
|
|
11099
11321
|
child.identifier
|
|
11100
11322
|
)),
|
|
11101
11323
|
droppableProvided.placeholder,
|
|
11102
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11103
|
-
|
|
11104
|
-
|
|
11105
|
-
|
|
11324
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11325
|
+
blocks.DropdownItemMenu,
|
|
11326
|
+
{
|
|
11327
|
+
trigger: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Button, { type: "button", variant: "soft", children: [
|
|
11328
|
+
/* @__PURE__ */ jsxRuntime.jsx(PlusIcon, {}),
|
|
11329
|
+
" Add field"
|
|
11330
|
+
] }),
|
|
11331
|
+
items: fieldTypeItems.flat()
|
|
11332
|
+
}
|
|
11333
|
+
)
|
|
11106
11334
|
]
|
|
11107
11335
|
}
|
|
11108
11336
|
)
|
|
@@ -11113,6 +11341,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11113
11341
|
FieldActions,
|
|
11114
11342
|
{
|
|
11115
11343
|
index: sectionIndex,
|
|
11344
|
+
type: field.type,
|
|
11116
11345
|
remove: removeSection,
|
|
11117
11346
|
duplicate: duplicateSection,
|
|
11118
11347
|
move: moveSection
|
|
@@ -11491,9 +11720,6 @@ var __publicField = (obj, key, value) => {
|
|
|
11491
11720
|
exports2.IssuePriority = IssuePriority;
|
|
11492
11721
|
exports2.IssueService = IssueService;
|
|
11493
11722
|
exports2.IssueStatus = IssueStatus;
|
|
11494
|
-
exports2.LicenseLevel = LicenseLevel;
|
|
11495
|
-
exports2.LicenseService = LicenseService;
|
|
11496
|
-
exports2.LicenseStatus = LicenseStatus;
|
|
11497
11723
|
exports2.MainService = MainService;
|
|
11498
11724
|
exports2.MapStyle = MapStyle;
|
|
11499
11725
|
exports2.MultiSelectField = MultiSelectField;
|
|
@@ -11541,7 +11767,6 @@ var __publicField = (obj, key, value) => {
|
|
|
11541
11767
|
exports2.addEmailDomain = addEmailDomain;
|
|
11542
11768
|
exports2.addFavouriteProjectId = addFavouriteProjectId;
|
|
11543
11769
|
exports2.addIssue = addIssue;
|
|
11544
|
-
exports2.addLicenses = addLicenses;
|
|
11545
11770
|
exports2.addOrReplaceCategories = addOrReplaceCategories;
|
|
11546
11771
|
exports2.addOrReplaceIssueComment = addOrReplaceIssueComment;
|
|
11547
11772
|
exports2.addOrReplaceProjectFile = addOrReplaceProjectFile;
|
|
@@ -11554,6 +11779,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11554
11779
|
exports2.addToRecentIssues = addToRecentIssues;
|
|
11555
11780
|
exports2.addUserForm = addUserForm;
|
|
11556
11781
|
exports2.addUserFormRevision = addUserFormRevision;
|
|
11782
|
+
exports2.addUserFormRevisionAttachment = addUserFormRevisionAttachment;
|
|
11557
11783
|
exports2.addUserFormRevisions = addUserFormRevisions;
|
|
11558
11784
|
exports2.addUserFormSubmission = addUserFormSubmission;
|
|
11559
11785
|
exports2.addUserFormSubmissionAttachment = addUserFormSubmissionAttachment;
|
|
@@ -11640,8 +11866,6 @@ var __publicField = (obj, key, value) => {
|
|
|
11640
11866
|
exports2.issueReducer = issueReducer;
|
|
11641
11867
|
exports2.issueSlice = issueSlice;
|
|
11642
11868
|
exports2.issueToSearchResult = issueToSearchResult;
|
|
11643
|
-
exports2.licenseReducer = licenseReducer;
|
|
11644
|
-
exports2.licenseSlice = licenseSlice;
|
|
11645
11869
|
exports2.literalToCoordinates = literalToCoordinates;
|
|
11646
11870
|
exports2.logOnlyOnce = logOnlyOnce;
|
|
11647
11871
|
exports2.makeClient = makeClient;
|
|
@@ -11708,20 +11932,17 @@ var __publicField = (obj, key, value) => {
|
|
|
11708
11932
|
exports2.searchIssues = searchIssues;
|
|
11709
11933
|
exports2.selectAccessToken = selectAccessToken;
|
|
11710
11934
|
exports2.selectActiveIssueId = selectActiveIssueId;
|
|
11711
|
-
exports2.selectActiveLicense = selectActiveLicense;
|
|
11712
11935
|
exports2.selectActiveOrganization = selectActiveOrganization;
|
|
11713
11936
|
exports2.selectActiveOrganizationAccess = selectActiveOrganizationAccess;
|
|
11714
11937
|
exports2.selectActiveOrganizationId = selectActiveOrganizationId;
|
|
11715
|
-
exports2.selectActiveOrganizationLicenses = selectActiveOrganizationLicenses;
|
|
11716
|
-
exports2.selectActiveOrganizationProjects = selectActiveOrganizationProjects;
|
|
11717
11938
|
exports2.selectActiveProject = selectActiveProject;
|
|
11718
11939
|
exports2.selectActiveProjectAccess = selectActiveProjectAccess;
|
|
11719
11940
|
exports2.selectActiveProjectFileId = selectActiveProjectFileId;
|
|
11720
11941
|
exports2.selectActiveProjectId = selectActiveProjectId;
|
|
11721
|
-
exports2.selectActiveStatusLicenses = selectActiveStatusLicenses;
|
|
11722
11942
|
exports2.selectActiveWorkspace = selectActiveWorkspace;
|
|
11723
11943
|
exports2.selectActiveWorkspaceId = selectActiveWorkspaceId;
|
|
11724
11944
|
exports2.selectAllAttachments = selectAllAttachments;
|
|
11945
|
+
exports2.selectAllRevisionAttachmentsByLatestRevisionId = selectAllRevisionAttachmentsByLatestRevisionId;
|
|
11725
11946
|
exports2.selectAppearance = selectAppearance;
|
|
11726
11947
|
exports2.selectCategories = selectCategories;
|
|
11727
11948
|
exports2.selectCategoriesOfWorkspace = selectCategoriesOfWorkspace;
|
|
@@ -11763,7 +11984,6 @@ var __publicField = (obj, key, value) => {
|
|
|
11763
11984
|
exports2.selectHiddenComponentTypeIds = selectHiddenComponentTypeIds;
|
|
11764
11985
|
exports2.selectIsFetchingInitialData = selectIsFetchingInitialData;
|
|
11765
11986
|
exports2.selectIsImportingProjectFile = selectIsImportingProjectFile;
|
|
11766
|
-
exports2.selectIsLoading = selectIsLoading;
|
|
11767
11987
|
exports2.selectIsLoggedIn = selectIsLoggedIn;
|
|
11768
11988
|
exports2.selectIssue = selectIssue;
|
|
11769
11989
|
exports2.selectIssueAttachmentMapping = selectIssueAttachmentMapping;
|
|
@@ -11773,10 +11993,6 @@ var __publicField = (obj, key, value) => {
|
|
|
11773
11993
|
exports2.selectLatestFormRevision = selectLatestFormRevision;
|
|
11774
11994
|
exports2.selectLatestRetryTime = selectLatestRetryTime;
|
|
11775
11995
|
exports2.selectLatestRevisionByFormId = selectLatestRevisionByFormId;
|
|
11776
|
-
exports2.selectLicencesMapping = selectLicencesMapping;
|
|
11777
|
-
exports2.selectLicense = selectLicense;
|
|
11778
|
-
exports2.selectLicenseForProject = selectLicenseForProject;
|
|
11779
|
-
exports2.selectLicenses = selectLicenses;
|
|
11780
11996
|
exports2.selectMainWorkspace = selectMainWorkspace;
|
|
11781
11997
|
exports2.selectMapStyle = selectMapStyle;
|
|
11782
11998
|
exports2.selectNumberOfComponentTypesMatchingCaseInsensitiveName = selectNumberOfComponentTypesMatchingCaseInsensitiveName;
|
|
@@ -11790,7 +12006,6 @@ var __publicField = (obj, key, value) => {
|
|
|
11790
12006
|
exports2.selectOrganizationUsersAsMapping = selectOrganizationUsersAsMapping;
|
|
11791
12007
|
exports2.selectOrganizationUsersIds = selectOrganizationUsersIds;
|
|
11792
12008
|
exports2.selectOrganizations = selectOrganizations;
|
|
11793
|
-
exports2.selectOrganizationsMapping = selectOrganizationsMapping;
|
|
11794
12009
|
exports2.selectOrganizationsWithAccess = selectOrganizationsWithAccess;
|
|
11795
12010
|
exports2.selectPermittedWorkspaceIds = selectPermittedWorkspaceIds;
|
|
11796
12011
|
exports2.selectPhotoAttachmentsOfIssue = selectPhotoAttachmentsOfIssue;
|
|
@@ -11808,10 +12023,10 @@ var __publicField = (obj, key, value) => {
|
|
|
11808
12023
|
exports2.selectRecentIssuesAsSearchResults = selectRecentIssuesAsSearchResults;
|
|
11809
12024
|
exports2.selectRecentProjects = selectRecentProjects;
|
|
11810
12025
|
exports2.selectRehydrated = selectRehydrated;
|
|
12026
|
+
exports2.selectRevisionAttachments = selectRevisionAttachments;
|
|
11811
12027
|
exports2.selectRevisionsForForm = selectRevisionsForForm;
|
|
11812
12028
|
exports2.selectShowTooltips = selectShowTooltips;
|
|
11813
12029
|
exports2.selectSortedEmailDomains = selectSortedEmailDomains;
|
|
11814
|
-
exports2.selectSortedOrganizationLicenses = selectSortedOrganizationLicenses;
|
|
11815
12030
|
exports2.selectSortedOrganizationUsers = selectSortedOrganizationUsers;
|
|
11816
12031
|
exports2.selectSortedProjectUsers = selectSortedProjectUsers;
|
|
11817
12032
|
exports2.selectSortedProjects = selectSortedProjects;
|
|
@@ -11854,10 +12069,8 @@ var __publicField = (obj, key, value) => {
|
|
|
11854
12069
|
exports2.setEnablePlacementMode = setEnablePlacementMode;
|
|
11855
12070
|
exports2.setIsFetchingInitialData = setIsFetchingInitialData;
|
|
11856
12071
|
exports2.setIsImportingProjectFile = setIsImportingProjectFile;
|
|
11857
|
-
exports2.setIsLoading = setIsLoading;
|
|
11858
12072
|
exports2.setIssueComments = setIssueComments;
|
|
11859
12073
|
exports2.setIssues = setIssues;
|
|
11860
|
-
exports2.setLicenses = setLicenses;
|
|
11861
12074
|
exports2.setLoggedIn = setLoggedIn;
|
|
11862
12075
|
exports2.setMapStyle = setMapStyle;
|
|
11863
12076
|
exports2.setOrganizationAccesses = setOrganizationAccesses;
|
|
@@ -11872,6 +12085,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11872
12085
|
exports2.setTokens = setTokens;
|
|
11873
12086
|
exports2.setTourStep = setTourStep;
|
|
11874
12087
|
exports2.setUploadUrl = setUploadUrl;
|
|
12088
|
+
exports2.setUserFormRevisionAttachments = setUserFormRevisionAttachments;
|
|
11875
12089
|
exports2.setUserFormSubmissionAttachments = setUserFormSubmissionAttachments;
|
|
11876
12090
|
exports2.setUserFormSubmissions = setUserFormSubmissions;
|
|
11877
12091
|
exports2.setUsers = setUsers;
|
|
@@ -11892,12 +12106,9 @@ var __publicField = (obj, key, value) => {
|
|
|
11892
12106
|
exports2.unhideAllCategories = unhideAllCategories;
|
|
11893
12107
|
exports2.unhideCategory = unhideCategory;
|
|
11894
12108
|
exports2.updateActiveOrganization = updateActiveOrganization;
|
|
11895
|
-
exports2.updateActiveProjectFormSubmissionsCount = updateActiveProjectFormSubmissionsCount;
|
|
11896
|
-
exports2.updateActiveProjectIssuesCount = updateActiveProjectIssuesCount;
|
|
11897
12109
|
exports2.updateAttachment = updateAttachment;
|
|
11898
12110
|
exports2.updateComponent = updateComponent;
|
|
11899
12111
|
exports2.updateIssue = updateIssue;
|
|
11900
|
-
exports2.updateLicense = updateLicense;
|
|
11901
12112
|
exports2.updateOrCreateProject = updateOrCreateProject;
|
|
11902
12113
|
exports2.updateOrganizationAccess = updateOrganizationAccess;
|
|
11903
12114
|
exports2.updateProjectAccess = updateProjectAccess;
|