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