@plusscommunities/pluss-feature-builder-web-a 1.0.2-beta.0 → 1.0.2-beta.10
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/index.cjs.js +1380 -1337
- package/package.json +1 -1
- package/rollup.config.js +1 -0
- package/src/actions/featureDefinitionsIndex.js +15 -15
- package/src/actions/formActions.js +31 -30
- package/src/actions/listingActions.js +27 -25
- package/src/actions/wizardActions.js +23 -35
- package/src/components/BaseFieldConfig.jsx +234 -234
- package/src/components/IconLoader.jsx +138 -138
- package/src/components/IconSelector.jsx +0 -1
- package/src/components/ListingEditor.jsx +2 -3
- package/src/components/SidebarLayout.jsx +49 -89
- package/src/components/SidebarLayout.module.css +0 -74
- package/src/components/index.js +0 -2
- package/src/components/listing/GalleryDisplay.jsx +0 -1
- package/src/components/listing/ListingFileInput.jsx +98 -80
- package/src/components/listing/ListingFileInput.module.css +1 -4
- package/src/components/listing/ListingGalleryInput.jsx +4 -1
- package/src/components/listing/ListingGalleryInput.module.css +2 -1
- package/src/hooks/useFeatureDefinitionLoader.js +6 -2
- package/src/images/full.png +0 -0
- package/src/images/fullNoTitle.png +0 -0
- package/src/images/previewWidget.png +0 -0
- package/src/images/widget.png +0 -0
- package/src/index.js +6 -6
- package/src/reducers/featureBuilderReducer.js +18 -22
- package/src/screens/Form.module.css +11 -1
- package/src/screens/FormLayoutStep.jsx +422 -424
- package/src/screens/FormOverviewStep.jsx +3 -10
- package/src/screens/ListingScreen.jsx +0 -1
- package/src/selectors/featureBuilderSelectors.js +47 -43
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import React, { useEffect,
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
2
|
import { SidebarLayout } from "../components/SidebarLayout.jsx";
|
|
3
3
|
import {
|
|
4
4
|
GenericInput,
|
|
5
5
|
Text,
|
|
6
6
|
Button,
|
|
7
7
|
LoadingState,
|
|
8
|
-
SkeletonLoader,
|
|
9
8
|
ErrorBoundary,
|
|
10
9
|
FeatureBuilderWelcomePopup,
|
|
11
|
-
CenteredContainer,
|
|
12
10
|
} from "../components";
|
|
13
11
|
import ToastContainer from "../components/ToastContainer.jsx";
|
|
14
12
|
import { values } from "../values.config.js";
|
|
@@ -20,11 +18,11 @@ import { withRouter } from "react-router-dom";
|
|
|
20
18
|
import { useDispatch, useSelector } from "react-redux";
|
|
21
19
|
import {
|
|
22
20
|
setDisplayName,
|
|
21
|
+
clearFormSubmissionState,
|
|
23
22
|
setIcon,
|
|
24
23
|
setInitialValues,
|
|
25
24
|
setTitle,
|
|
26
25
|
submitForm,
|
|
27
|
-
clearFormSubmissionState,
|
|
28
26
|
} from "../actions/formActions";
|
|
29
27
|
import {
|
|
30
28
|
selectFormIcon,
|
|
@@ -36,15 +34,11 @@ import {
|
|
|
36
34
|
selectIsEditMode,
|
|
37
35
|
selectIsStepValid,
|
|
38
36
|
selectStepErrors,
|
|
39
|
-
selectWizardMode,
|
|
40
37
|
selectFormIsSubmitting,
|
|
41
38
|
selectFormSubmitError,
|
|
42
39
|
selectFormSubmitSuccess,
|
|
43
40
|
} from "../selectors/featureBuilderSelectors";
|
|
44
|
-
import {
|
|
45
|
-
validateAndUpdateStep,
|
|
46
|
-
setCurrentStepAndSave,
|
|
47
|
-
} from "../actions/wizardActions";
|
|
41
|
+
import { validateAndUpdateStep } from "../actions/wizardActions";
|
|
48
42
|
import IconSelector from "../components/IconSelector.jsx";
|
|
49
43
|
import ExampleDisplay from "../components/ExampleDisplay.jsx";
|
|
50
44
|
|
|
@@ -130,7 +124,6 @@ const FormOverviewStepInner = (props) => {
|
|
|
130
124
|
|
|
131
125
|
// Clear submission state after showing toast (only for non-edit cases)
|
|
132
126
|
if (!isEditMode) {
|
|
133
|
-
const { clearFormSubmissionState } = require("../actions/formActions");
|
|
134
127
|
dispatch(clearFormSubmissionState());
|
|
135
128
|
}
|
|
136
129
|
}
|
|
@@ -46,7 +46,6 @@ import styles from "./ListingScreen.module.css";
|
|
|
46
46
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
47
47
|
import { faPen, faTrash } from "@fortawesome/free-solid-svg-icons";
|
|
48
48
|
|
|
49
|
-
|
|
50
49
|
const { Button, Text } = PlussCore.Components;
|
|
51
50
|
|
|
52
51
|
const ListingScreen = (props) => {
|
|
@@ -26,7 +26,7 @@ export const selectFormState = (state) => getFeatureBuilderState(state).form;
|
|
|
26
26
|
*/
|
|
27
27
|
export const selectFormTitle = (state) => {
|
|
28
28
|
const formState = selectFormState(state);
|
|
29
|
-
return formState
|
|
29
|
+
return formState?.title;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
/**
|
|
@@ -37,7 +37,7 @@ export const selectFormTitle = (state) => {
|
|
|
37
37
|
*/
|
|
38
38
|
export const selectFormIcon = (state) => {
|
|
39
39
|
const formState = selectFormState(state);
|
|
40
|
-
return formState
|
|
40
|
+
return formState?.icon;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
/**
|
|
@@ -48,7 +48,7 @@ export const selectFormIcon = (state) => {
|
|
|
48
48
|
*/
|
|
49
49
|
export const selectFormDisplayName = (state) => {
|
|
50
50
|
const formState = selectFormState(state);
|
|
51
|
-
return formState
|
|
51
|
+
return formState?.displayName;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
/**
|
|
@@ -59,7 +59,7 @@ export const selectFormDisplayName = (state) => {
|
|
|
59
59
|
*/
|
|
60
60
|
export const selectFormLayout = (state) => {
|
|
61
61
|
const formState = selectFormState(state);
|
|
62
|
-
return formState
|
|
62
|
+
return formState?.layout;
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
/**
|
|
@@ -70,7 +70,7 @@ export const selectFormLayout = (state) => {
|
|
|
70
70
|
*/
|
|
71
71
|
export const selectFormFields = (state) => {
|
|
72
72
|
const formState = selectFormState(state);
|
|
73
|
-
return
|
|
73
|
+
return formState?.fields || [];
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
export const selectFormField = (fieldId) => (state) =>
|
|
@@ -78,21 +78,21 @@ export const selectFormField = (fieldId) => (state) =>
|
|
|
78
78
|
|
|
79
79
|
export const selectFormIsInitial = (state) => {
|
|
80
80
|
const formState = selectFormState(state);
|
|
81
|
-
return formState
|
|
81
|
+
return formState?._isInitial;
|
|
82
82
|
};
|
|
83
83
|
export const selectFormIsSubmitting = (state) => {
|
|
84
84
|
const formState = selectFormState(state);
|
|
85
|
-
return formState
|
|
85
|
+
return formState?._isSubmitting;
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
export const selectFormSubmitError = (state) => {
|
|
89
89
|
const formState = selectFormState(state);
|
|
90
|
-
return formState
|
|
90
|
+
return formState?._submitError;
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
export const selectFormSubmitSuccess = (state) => {
|
|
94
94
|
const formState = selectFormState(state);
|
|
95
|
-
return formState
|
|
95
|
+
return formState?._submitSuccess;
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
// ============ DEFINITION SELECTORS ============
|
|
@@ -102,31 +102,39 @@ export const selectDefinitionState = (state) =>
|
|
|
102
102
|
|
|
103
103
|
export const selectDefinition = (state) => {
|
|
104
104
|
const definitionState = selectDefinitionState(state);
|
|
105
|
-
return definitionState
|
|
105
|
+
return definitionState?.definition;
|
|
106
106
|
};
|
|
107
107
|
export const selectDefinitionId = (state) => {
|
|
108
108
|
const definitionState = selectDefinitionState(state);
|
|
109
|
-
return definitionState
|
|
109
|
+
return definitionState?.id;
|
|
110
110
|
};
|
|
111
111
|
export const selectDefinitionIsLoading = (state) => {
|
|
112
112
|
const definitionState = selectDefinitionState(state);
|
|
113
|
-
return definitionState
|
|
113
|
+
return definitionState?.isLoading;
|
|
114
114
|
};
|
|
115
115
|
export const selectDefinitionError = (state) => {
|
|
116
116
|
const definitionState = selectDefinitionState(state);
|
|
117
|
-
return definitionState
|
|
117
|
+
return definitionState?.error;
|
|
118
118
|
};
|
|
119
119
|
export const selectDefinitionIsCreating = (state) => {
|
|
120
120
|
const definitionState = selectDefinitionState(state);
|
|
121
|
-
return definitionState
|
|
121
|
+
return definitionState?.isCreating;
|
|
122
122
|
};
|
|
123
123
|
export const selectDefinitionIsEditing = (state) => {
|
|
124
124
|
const definitionState = selectDefinitionState(state);
|
|
125
|
-
return definitionState
|
|
125
|
+
return definitionState?.isEditing;
|
|
126
|
+
};
|
|
127
|
+
export const selectDefinitionMode = (state) => {
|
|
128
|
+
const definitionState = selectDefinitionState(state);
|
|
129
|
+
return definitionState?.mode;
|
|
126
130
|
};
|
|
127
131
|
|
|
128
|
-
// Check if we have a definition loaded
|
|
129
|
-
|
|
132
|
+
// Check if we have a definition loaded or if we've determined the mode
|
|
133
|
+
// This is used by hiddenFromFeaturePicker to determine if feature should be shown
|
|
134
|
+
export const selectHasDefinition = (state) => {
|
|
135
|
+
const definition = selectDefinition(state);
|
|
136
|
+
return !!definition;
|
|
137
|
+
};
|
|
130
138
|
|
|
131
139
|
// ============ LISTINGS SELECTORS ============
|
|
132
140
|
|
|
@@ -135,35 +143,35 @@ export const selectListingsState = (state) =>
|
|
|
135
143
|
|
|
136
144
|
export const selectListings = (state) => {
|
|
137
145
|
const listingsState = selectListingsState(state);
|
|
138
|
-
return
|
|
146
|
+
return listingsState?.listings || [];
|
|
139
147
|
};
|
|
140
148
|
export const selectListingsIsLoading = (state) => {
|
|
141
149
|
const listingsState = selectListingsState(state);
|
|
142
|
-
return listingsState
|
|
150
|
+
return listingsState?.isLoading;
|
|
143
151
|
};
|
|
144
152
|
export const selectListingsError = (state) => {
|
|
145
153
|
const listingsState = selectListingsState(state);
|
|
146
|
-
return listingsState
|
|
154
|
+
return listingsState?.error;
|
|
147
155
|
};
|
|
148
156
|
export const selectListingsIsCreating = (state) => {
|
|
149
157
|
const listingsState = selectListingsState(state);
|
|
150
|
-
return listingsState
|
|
158
|
+
return listingsState?.isCreating;
|
|
151
159
|
};
|
|
152
160
|
export const selectListingsIsEditing = (state) => {
|
|
153
161
|
const listingsState = selectListingsState(state);
|
|
154
|
-
return listingsState
|
|
162
|
+
return listingsState?.isEditing;
|
|
155
163
|
};
|
|
156
164
|
export const selectListingsIsDeleting = (state) => {
|
|
157
165
|
const listingsState = selectListingsState(state);
|
|
158
|
-
return listingsState
|
|
166
|
+
return listingsState?.isDeleting;
|
|
159
167
|
};
|
|
160
168
|
export const selectListingsIsRestoring = (state) => {
|
|
161
169
|
const listingsState = selectListingsState(state);
|
|
162
|
-
return listingsState
|
|
170
|
+
return listingsState?.isRestoring;
|
|
163
171
|
};
|
|
164
172
|
export const selectListingsIsInitiallyLoaded = (state) => {
|
|
165
173
|
const listingsState = selectListingsState(state);
|
|
166
|
-
return listingsState
|
|
174
|
+
return listingsState?.isInitiallyLoaded;
|
|
167
175
|
};
|
|
168
176
|
|
|
169
177
|
// Get a specific listing by ID
|
|
@@ -299,7 +307,7 @@ export const selectWizardState = (state) =>
|
|
|
299
307
|
|
|
300
308
|
export const selectWizardMode = (state) => {
|
|
301
309
|
const wizardState = selectWizardState(state);
|
|
302
|
-
return wizardState
|
|
310
|
+
return wizardState?.mode;
|
|
303
311
|
};
|
|
304
312
|
|
|
305
313
|
// Mode detection selectors - wizard mode is the SINGLE SOURCE OF TRUTH for create/edit mode
|
|
@@ -311,57 +319,57 @@ export const selectIsEditMode = (state) => selectWizardMode(state) === "edit";
|
|
|
311
319
|
|
|
312
320
|
export const selectNavigationState = (state) => {
|
|
313
321
|
const wizardState = selectWizardState(state);
|
|
314
|
-
return wizardState
|
|
322
|
+
return wizardState?.navigation;
|
|
315
323
|
};
|
|
316
324
|
|
|
317
325
|
export const selectCurrentStep = (state) => {
|
|
318
326
|
const navigationState = selectNavigationState(state);
|
|
319
|
-
return navigationState
|
|
327
|
+
return navigationState?.currentStep;
|
|
320
328
|
};
|
|
321
329
|
|
|
322
330
|
export const selectCanGoBack = (state) => {
|
|
323
331
|
const navigationState = selectNavigationState(state);
|
|
324
|
-
return navigationState
|
|
332
|
+
return navigationState?.canGoBack;
|
|
325
333
|
};
|
|
326
334
|
|
|
327
335
|
export const selectPreviousStep = (state) => {
|
|
328
336
|
const navigationState = selectNavigationState(state);
|
|
329
|
-
return navigationState
|
|
337
|
+
return navigationState?.previousStep;
|
|
330
338
|
};
|
|
331
339
|
|
|
332
340
|
export const selectCanGoForward = (state) => {
|
|
333
341
|
const navigationState = selectNavigationState(state);
|
|
334
|
-
return navigationState
|
|
342
|
+
return navigationState?.canGoForward;
|
|
335
343
|
};
|
|
336
344
|
|
|
337
345
|
export const selectStepValidation = (state) => {
|
|
338
346
|
const wizardState = selectWizardState(state);
|
|
339
|
-
return wizardState
|
|
347
|
+
return wizardState?.stepValidation;
|
|
340
348
|
};
|
|
341
349
|
|
|
342
350
|
export const selectStepValidationState = (step) => (state) => {
|
|
343
351
|
const stepValidation = selectStepValidation(state);
|
|
344
|
-
return stepValidation
|
|
352
|
+
return stepValidation?.[step];
|
|
345
353
|
};
|
|
346
354
|
|
|
347
355
|
export const selectIsStepValid = (step) => (state) => {
|
|
348
356
|
const stepValidationState = selectStepValidationState(step)(state);
|
|
349
|
-
return stepValidationState
|
|
357
|
+
return stepValidationState?.isValid;
|
|
350
358
|
};
|
|
351
359
|
|
|
352
360
|
export const selectStepErrors = (step) => (state) => {
|
|
353
361
|
const stepValidationState = selectStepValidationState(step)(state);
|
|
354
|
-
return stepValidationState
|
|
362
|
+
return stepValidationState?.errors || {};
|
|
355
363
|
};
|
|
356
364
|
|
|
357
365
|
export const selectStepCompletion = (state) => {
|
|
358
366
|
const wizardState = selectWizardState(state);
|
|
359
|
-
return wizardState
|
|
367
|
+
return wizardState?.stepCompletion;
|
|
360
368
|
};
|
|
361
369
|
|
|
362
370
|
export const selectIsStepComplete = (step) => (state) => {
|
|
363
371
|
const stepCompletion = selectStepCompletion(state);
|
|
364
|
-
return stepCompletion
|
|
372
|
+
return stepCompletion?.[step];
|
|
365
373
|
};
|
|
366
374
|
|
|
367
375
|
export const selectAllStepsComplete = (state) => {
|
|
@@ -418,17 +426,13 @@ export const selectIsStepAccessible = (step) => (state) => {
|
|
|
418
426
|
// Get current sort method
|
|
419
427
|
export const selectSortBy = (state) => {
|
|
420
428
|
const listingsState = selectListingsState(state);
|
|
421
|
-
return listingsState
|
|
422
|
-
? listingsState.sortBy
|
|
423
|
-
: "newest";
|
|
429
|
+
return listingsState?.sortBy || "newest";
|
|
424
430
|
};
|
|
425
431
|
|
|
426
432
|
// Get show deleted toggle state
|
|
427
433
|
export const selectShowDeleted = (state) => {
|
|
428
434
|
const listingsState = selectListingsState(state);
|
|
429
|
-
return listingsState
|
|
430
|
-
? listingsState.showDeleted
|
|
431
|
-
: false;
|
|
435
|
+
return listingsState?.showDeleted || false;
|
|
432
436
|
};
|
|
433
437
|
|
|
434
438
|
// Get sorted and filtered listings
|