@plusscommunities/pluss-feature-builder-web-b 1.0.2-beta.4 → 1.0.2-beta.6
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 +188 -144
- package/package.json +1 -1
- package/src/actions/featureDefinitionsIndex.js +15 -15
- package/src/actions/formActions.js +148 -158
- package/src/actions/listingActions.js +27 -25
- package/src/actions/wizardActions.js +174 -189
- 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 +0 -1
- package/src/components/SidebarLayout.jsx +47 -25
- package/src/components/SidebarLayout.module.css +0 -34
- package/src/components/index.js +0 -2
- package/src/components/listing/GalleryDisplay.jsx +0 -1
- package/src/components/listing/ListingGalleryInput.jsx +4 -1
- package/src/hooks/useFeatureDefinitionLoader.js +6 -2
- package/src/index.js +6 -6
- package/src/reducers/featureBuilderReducer.js +14 -25
- package/src/screens/Form.module.css +11 -1
- package/src/screens/FormLayoutStep.jsx +10 -13
- package/src/screens/FormOverviewStep.jsx +351 -357
- package/src/screens/ListingScreen.jsx +0 -1
- package/src/selectors/featureBuilderSelectors.js +52 -43
|
@@ -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,44 @@ 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
|
+
// When mode is "create", definition is null but we've determined the feature doesn't exist
|
|
135
|
+
// When mode is "edit", definition exists and we've determined the feature exists
|
|
136
|
+
export const selectHasDefinition = (state) => {
|
|
137
|
+
const definition = selectDefinition(state);
|
|
138
|
+
const mode = selectDefinitionMode(state);
|
|
139
|
+
// Consider feature "loaded" if definition exists OR mode is set
|
|
140
|
+
// Mode being set means we've successfully fetched and determined the state
|
|
141
|
+
return !!definition || !!mode;
|
|
142
|
+
};
|
|
130
143
|
|
|
131
144
|
// ============ LISTINGS SELECTORS ============
|
|
132
145
|
|
|
@@ -135,35 +148,35 @@ export const selectListingsState = (state) =>
|
|
|
135
148
|
|
|
136
149
|
export const selectListings = (state) => {
|
|
137
150
|
const listingsState = selectListingsState(state);
|
|
138
|
-
return
|
|
151
|
+
return listingsState?.listings || [];
|
|
139
152
|
};
|
|
140
153
|
export const selectListingsIsLoading = (state) => {
|
|
141
154
|
const listingsState = selectListingsState(state);
|
|
142
|
-
return listingsState
|
|
155
|
+
return listingsState?.isLoading;
|
|
143
156
|
};
|
|
144
157
|
export const selectListingsError = (state) => {
|
|
145
158
|
const listingsState = selectListingsState(state);
|
|
146
|
-
return listingsState
|
|
159
|
+
return listingsState?.error;
|
|
147
160
|
};
|
|
148
161
|
export const selectListingsIsCreating = (state) => {
|
|
149
162
|
const listingsState = selectListingsState(state);
|
|
150
|
-
return listingsState
|
|
163
|
+
return listingsState?.isCreating;
|
|
151
164
|
};
|
|
152
165
|
export const selectListingsIsEditing = (state) => {
|
|
153
166
|
const listingsState = selectListingsState(state);
|
|
154
|
-
return listingsState
|
|
167
|
+
return listingsState?.isEditing;
|
|
155
168
|
};
|
|
156
169
|
export const selectListingsIsDeleting = (state) => {
|
|
157
170
|
const listingsState = selectListingsState(state);
|
|
158
|
-
return listingsState
|
|
171
|
+
return listingsState?.isDeleting;
|
|
159
172
|
};
|
|
160
173
|
export const selectListingsIsRestoring = (state) => {
|
|
161
174
|
const listingsState = selectListingsState(state);
|
|
162
|
-
return listingsState
|
|
175
|
+
return listingsState?.isRestoring;
|
|
163
176
|
};
|
|
164
177
|
export const selectListingsIsInitiallyLoaded = (state) => {
|
|
165
178
|
const listingsState = selectListingsState(state);
|
|
166
|
-
return listingsState
|
|
179
|
+
return listingsState?.isInitiallyLoaded;
|
|
167
180
|
};
|
|
168
181
|
|
|
169
182
|
// Get a specific listing by ID
|
|
@@ -299,7 +312,7 @@ export const selectWizardState = (state) =>
|
|
|
299
312
|
|
|
300
313
|
export const selectWizardMode = (state) => {
|
|
301
314
|
const wizardState = selectWizardState(state);
|
|
302
|
-
return wizardState
|
|
315
|
+
return wizardState?.mode;
|
|
303
316
|
};
|
|
304
317
|
|
|
305
318
|
// Mode detection selectors - wizard mode is the SINGLE SOURCE OF TRUTH for create/edit mode
|
|
@@ -311,57 +324,57 @@ export const selectIsEditMode = (state) => selectWizardMode(state) === "edit";
|
|
|
311
324
|
|
|
312
325
|
export const selectNavigationState = (state) => {
|
|
313
326
|
const wizardState = selectWizardState(state);
|
|
314
|
-
return wizardState
|
|
327
|
+
return wizardState?.navigation;
|
|
315
328
|
};
|
|
316
329
|
|
|
317
330
|
export const selectCurrentStep = (state) => {
|
|
318
331
|
const navigationState = selectNavigationState(state);
|
|
319
|
-
return navigationState
|
|
332
|
+
return navigationState?.currentStep;
|
|
320
333
|
};
|
|
321
334
|
|
|
322
335
|
export const selectCanGoBack = (state) => {
|
|
323
336
|
const navigationState = selectNavigationState(state);
|
|
324
|
-
return navigationState
|
|
337
|
+
return navigationState?.canGoBack;
|
|
325
338
|
};
|
|
326
339
|
|
|
327
340
|
export const selectPreviousStep = (state) => {
|
|
328
341
|
const navigationState = selectNavigationState(state);
|
|
329
|
-
return navigationState
|
|
342
|
+
return navigationState?.previousStep;
|
|
330
343
|
};
|
|
331
344
|
|
|
332
345
|
export const selectCanGoForward = (state) => {
|
|
333
346
|
const navigationState = selectNavigationState(state);
|
|
334
|
-
return navigationState
|
|
347
|
+
return navigationState?.canGoForward;
|
|
335
348
|
};
|
|
336
349
|
|
|
337
350
|
export const selectStepValidation = (state) => {
|
|
338
351
|
const wizardState = selectWizardState(state);
|
|
339
|
-
return wizardState
|
|
352
|
+
return wizardState?.stepValidation;
|
|
340
353
|
};
|
|
341
354
|
|
|
342
355
|
export const selectStepValidationState = (step) => (state) => {
|
|
343
356
|
const stepValidation = selectStepValidation(state);
|
|
344
|
-
return stepValidation
|
|
357
|
+
return stepValidation?.[step];
|
|
345
358
|
};
|
|
346
359
|
|
|
347
360
|
export const selectIsStepValid = (step) => (state) => {
|
|
348
361
|
const stepValidationState = selectStepValidationState(step)(state);
|
|
349
|
-
return stepValidationState
|
|
362
|
+
return stepValidationState?.isValid;
|
|
350
363
|
};
|
|
351
364
|
|
|
352
365
|
export const selectStepErrors = (step) => (state) => {
|
|
353
366
|
const stepValidationState = selectStepValidationState(step)(state);
|
|
354
|
-
return stepValidationState
|
|
367
|
+
return stepValidationState?.errors || {};
|
|
355
368
|
};
|
|
356
369
|
|
|
357
370
|
export const selectStepCompletion = (state) => {
|
|
358
371
|
const wizardState = selectWizardState(state);
|
|
359
|
-
return wizardState
|
|
372
|
+
return wizardState?.stepCompletion;
|
|
360
373
|
};
|
|
361
374
|
|
|
362
375
|
export const selectIsStepComplete = (step) => (state) => {
|
|
363
376
|
const stepCompletion = selectStepCompletion(state);
|
|
364
|
-
return stepCompletion
|
|
377
|
+
return stepCompletion?.[step];
|
|
365
378
|
};
|
|
366
379
|
|
|
367
380
|
export const selectAllStepsComplete = (state) => {
|
|
@@ -418,17 +431,13 @@ export const selectIsStepAccessible = (step) => (state) => {
|
|
|
418
431
|
// Get current sort method
|
|
419
432
|
export const selectSortBy = (state) => {
|
|
420
433
|
const listingsState = selectListingsState(state);
|
|
421
|
-
return listingsState
|
|
422
|
-
? listingsState.sortBy
|
|
423
|
-
: "newest";
|
|
434
|
+
return listingsState?.sortBy ?? "newest";
|
|
424
435
|
};
|
|
425
436
|
|
|
426
437
|
// Get show deleted toggle state
|
|
427
438
|
export const selectShowDeleted = (state) => {
|
|
428
439
|
const listingsState = selectListingsState(state);
|
|
429
|
-
return listingsState
|
|
430
|
-
? listingsState.showDeleted
|
|
431
|
-
: false;
|
|
440
|
+
return listingsState?.showDeleted ?? false;
|
|
432
441
|
};
|
|
433
442
|
|
|
434
443
|
// Get sorted and filtered listings
|