@plusscommunities/pluss-feature-builder-web-d 1.0.2-beta.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.
Files changed (117) hide show
  1. package/.babelrc +4 -0
  2. package/dist/index.cjs.js +7792 -0
  3. package/package.json +54 -0
  4. package/rollup.config.js +68 -0
  5. package/src/actions/featureBuilderStringsActions.js +88 -0
  6. package/src/actions/featureDefinitionsIndex.js +258 -0
  7. package/src/actions/formActions.js +311 -0
  8. package/src/actions/index.js +12 -0
  9. package/src/actions/listingActions.js +350 -0
  10. package/src/actions/wizardActions.js +240 -0
  11. package/src/components/ActivityCardExample.jsx +86 -0
  12. package/src/components/ActivityCardExample.module.css +130 -0
  13. package/src/components/BackgroundLoader.jsx +33 -0
  14. package/src/components/BackgroundLoader.module.css +46 -0
  15. package/src/components/BaseFieldConfig.jsx +305 -0
  16. package/src/components/BaseFieldConfig.module.css +42 -0
  17. package/src/components/CenteredContainer.jsx +29 -0
  18. package/src/components/CenteredContainer.module.css +171 -0
  19. package/src/components/DeleteConfirmationPopup.jsx +95 -0
  20. package/src/components/DeleteConfirmationPopup.module.css +12 -0
  21. package/src/components/ErrorBoundary.jsx +134 -0
  22. package/src/components/ErrorBoundary.module.css +77 -0
  23. package/src/components/ErrorMessage.jsx +85 -0
  24. package/src/components/ErrorMessage.module.css +116 -0
  25. package/src/components/ExampleDisplay.jsx +26 -0
  26. package/src/components/ExampleDisplay.module.css +3 -0
  27. package/src/components/FeatureBuilderSidebar.jsx +84 -0
  28. package/src/components/FeatureBuilderSuccessPopup.jsx +55 -0
  29. package/src/components/FeatureBuilderSuccessPopup.module.css +43 -0
  30. package/src/components/FeatureBuilderWelcomePopup.jsx +51 -0
  31. package/src/components/FeatureBuilderWelcomePopup.module.css +21 -0
  32. package/src/components/FeatureListingCard.jsx +104 -0
  33. package/src/components/FeatureListingCard.module.css +62 -0
  34. package/src/components/Fields.jsx +460 -0
  35. package/src/components/Fields.module.css +159 -0
  36. package/src/components/IconLoader.jsx +153 -0
  37. package/src/components/IconLoader.module.css +92 -0
  38. package/src/components/IconSelector.jsx +112 -0
  39. package/src/components/IconSelector.module.css +197 -0
  40. package/src/components/ListingEditor.jsx +406 -0
  41. package/src/components/ListingEditor.module.css +14 -0
  42. package/src/components/ListingSuccessPopup.jsx +52 -0
  43. package/src/components/LoadingScreen.jsx +54 -0
  44. package/src/components/LoadingScreen.module.css +103 -0
  45. package/src/components/LoadingState.jsx +40 -0
  46. package/src/components/LoadingState.module.css +18 -0
  47. package/src/components/PreviewFull.js +24 -0
  48. package/src/components/PreviewFull.module.css +11 -0
  49. package/src/components/PreviewGrid.js +14 -0
  50. package/src/components/PreviewWidget.js +27 -0
  51. package/src/components/PreviewWidget.module.css +15 -0
  52. package/src/components/SidebarLayout.jsx +292 -0
  53. package/src/components/SidebarLayout.module.css +145 -0
  54. package/src/components/SkeletonLoader.jsx +128 -0
  55. package/src/components/SkeletonLoader.module.css +295 -0
  56. package/src/components/SortButtonGroup.jsx +34 -0
  57. package/src/components/SortButtonGroup.module.css +51 -0
  58. package/src/components/ToastContainer.jsx +98 -0
  59. package/src/components/ToastContainer.module.css +156 -0
  60. package/src/components/ToggleSwitch.js +40 -0
  61. package/src/components/ToggleSwitch.module.css +48 -0
  62. package/src/components/TwoColumnInput.jsx +29 -0
  63. package/src/components/TwoColumnInput.module.css +32 -0
  64. package/src/components/ViewFull.js +139 -0
  65. package/src/components/ViewFull.module.css +71 -0
  66. package/src/components/ViewWidget.js +62 -0
  67. package/src/components/ViewWidget.module.css +28 -0
  68. package/src/components/iconCategories.js +135 -0
  69. package/src/components/iconImports.js +409 -0
  70. package/src/components/index.js +61 -0
  71. package/src/components/listing/FileListItem.jsx +86 -0
  72. package/src/components/listing/GalleryDisplay.jsx +331 -0
  73. package/src/components/listing/GalleryDisplay.module.css +309 -0
  74. package/src/components/listing/ListingCTAInput.jsx +82 -0
  75. package/src/components/listing/ListingDescriptionInput.jsx +73 -0
  76. package/src/components/listing/ListingField.jsx +101 -0
  77. package/src/components/listing/ListingField.module.css +106 -0
  78. package/src/components/listing/ListingFileInput.jsx +255 -0
  79. package/src/components/listing/ListingFileInput.module.css +192 -0
  80. package/src/components/listing/ListingForm.jsx +90 -0
  81. package/src/components/listing/ListingForm.module.css +38 -0
  82. package/src/components/listing/ListingGalleryInput.jsx +236 -0
  83. package/src/components/listing/ListingGalleryInput.module.css +131 -0
  84. package/src/components/listing/ListingImageInput.jsx +153 -0
  85. package/src/components/listing/ListingTextInput.jsx +72 -0
  86. package/src/feature.config.js +130 -0
  87. package/src/helper/index.js +135 -0
  88. package/src/hooks/useFeatureDefinitionLoader.js +62 -0
  89. package/src/images/full.png +0 -0
  90. package/src/images/fullNoTitle.png +0 -0
  91. package/src/images/previewWidget.png +0 -0
  92. package/src/images/widget.png +0 -0
  93. package/src/index.js +38 -0
  94. package/src/pages/CreateListingPage.jsx +49 -0
  95. package/src/pages/EditListingPage.jsx +58 -0
  96. package/src/reducers/featureBuilderReducer.js +744 -0
  97. package/src/screens/CreateListing.module.css +45 -0
  98. package/src/screens/Form.module.css +734 -0
  99. package/src/screens/FormFieldsStep.jsx +689 -0
  100. package/src/screens/FormLayoutStep.jsx +445 -0
  101. package/src/screens/FormOverviewStep.jsx +396 -0
  102. package/src/screens/ListingScreen.jsx +478 -0
  103. package/src/screens/ListingScreen.module.css +333 -0
  104. package/src/selectors/featureBuilderSelectors.js +529 -0
  105. package/src/types/index.js +91 -0
  106. package/src/utils/textUtils.js +89 -0
  107. package/src/validators/galleryValidators.js +345 -0
  108. package/src/values.config.a.js +49 -0
  109. package/src/values.config.b.js +49 -0
  110. package/src/values.config.c.js +49 -0
  111. package/src/values.config.d.js +49 -0
  112. package/src/values.config.js +49 -0
  113. package/src/webapi/featureDefinitionActions.js +0 -0
  114. package/src/webapi/featuresActions.js +90 -0
  115. package/src/webapi/helper.js +4 -0
  116. package/src/webapi/index.js +12 -0
  117. package/src/webapi/listingActions.js +176 -0
@@ -0,0 +1,12 @@
1
+ import { PlussCore } from "../feature.config";
2
+
3
+ const { Apis } = PlussCore;
4
+ export const stringActions = Apis.stringActions;
5
+ export const analyticsActions = Apis.analyticsActions;
6
+ export const fileActions = Apis.fileActions;
7
+ export const userActions = Apis.userActions;
8
+ export const typeActions = Apis.typeActions;
9
+
10
+ // Feature Builder specific API actions
11
+ export { featureDefinitionActions } from "./featuresActions";
12
+ export { listingActions } from "./listingActions";
@@ -0,0 +1,176 @@
1
+ import { PlussCore } from "../feature.config";
2
+ import { values } from "../values.config";
3
+ const { Helper, Session } = PlussCore;
4
+
5
+ const { getUrl } = Helper;
6
+ const { authedFunction } = Session;
7
+
8
+ export const listingActions = {
9
+ /**
10
+ * Retrieves all listings for the current feature (excluding deleted listings)
11
+ *
12
+ * @param {string} site - The site ID to fetch listings for
13
+ * @returns {Promise<ApiResponse>} Promise resolving to API response with listings array
14
+ * @throws {Error} When API call fails
15
+ */
16
+ getAll: async (site) => {
17
+ const query = {
18
+ featureDefinitionId: values.featureId,
19
+ site: site,
20
+ };
21
+ const url = getUrl("feature-builder", "listing/get/all", query);
22
+
23
+ return authedFunction({
24
+ method: "GET",
25
+ url,
26
+ });
27
+ },
28
+
29
+ /**
30
+ * Retrieves a single listing by its unique ID
31
+ *
32
+ * @param {string} id - The unique identifier of the listing to retrieve
33
+ * @param {string} site - The site ID where the listing belongs
34
+ * @returns {Promise<ApiResponse>} Promise resolving to API response with listing data
35
+ * @throws {Error} When listing is not found or API call fails
36
+ *
37
+ */
38
+ getSingle: async (id, site) => {
39
+ const query = {
40
+ id: id,
41
+ site: site,
42
+ };
43
+ const url = getUrl("feature-builder", "listing/get/single", query);
44
+ return authedFunction({
45
+ method: "GET",
46
+ url: url,
47
+ });
48
+ },
49
+
50
+ /**
51
+ * Creates a new listing instance with the provided data
52
+ *
53
+ * @param {Object} listingData - The listing data to create
54
+ * @param {Object} listingData.fields - Field values for the listing
55
+ * @param {string} [listingData.title] - Optional title for the listing
56
+ * @param {string} [listingData.description] - Optional description for the listing
57
+ * @param {string} site - The site ID where the listing will be created
58
+ * @returns {Promise<ApiResponse>} Promise resolving to API response with created listing data
59
+ * @throws {Error} When creation fails due to validation or API errors
60
+ *
61
+ * @example
62
+ * try {
63
+ * const response = await listingActions.create({
64
+ * title: 'New Listing',
65
+ * fields: { name: 'John Doe', email: 'john@example.com' }
66
+ */
67
+ create: async (listingData, site) => {
68
+ // Add site as query parameter (required by API)
69
+ const query = {
70
+ site: site,
71
+ };
72
+ const url = getUrl("feature-builder", "listing/update/create", query);
73
+
74
+ const dataWithFeatureId = {
75
+ site: site,
76
+ featureDefinitionId: values.featureId,
77
+ ...listingData,
78
+ };
79
+
80
+ try {
81
+ const response = await authedFunction({
82
+ method: "POST",
83
+ url: url,
84
+ data: dataWithFeatureId,
85
+ });
86
+ return response;
87
+ } catch (error) {
88
+ throw error;
89
+ }
90
+ },
91
+
92
+ /**
93
+ * Updates an existing listing with new data
94
+ *
95
+ * @param {Object} listingData - The updated listing data
96
+ * @param {string} listingData.id - The unique identifier of the listing to update
97
+ * @param {Object} listingData.fields - Updated field values
98
+ * @param {string} [listingData.title] - Updated title
99
+ * @param {string} [listingData.description] - Updated description
100
+ * @param {string} site - The site ID where the listing exists
101
+ * @returns {Promise<ApiResponse>} Promise resolving to API response with updated listing data
102
+ * @throws {Error} When update fails due to validation or API errors
103
+ *
104
+ * @example
105
+ * try {
106
+ */
107
+ edit: async (listingData, site) => {
108
+ // Add site as query parameter (required by API)
109
+ const query = {
110
+ site: site,
111
+ };
112
+ const url = getUrl("feature-builder", "listing/update/edit", query);
113
+
114
+ // Add site to the request body as well
115
+ const dataWithSite = {
116
+ site: site,
117
+ ...listingData,
118
+ };
119
+
120
+ try {
121
+ const response = await authedFunction({
122
+ method: "POST",
123
+ url: url,
124
+ data: dataWithSite,
125
+ });
126
+ return response;
127
+ } catch (error) {
128
+ throw error;
129
+ }
130
+ },
131
+
132
+ /**
133
+ * Soft deletes a listing (marks as deleted but doesn't permanently remove)
134
+ *
135
+ * @param {string} id - The unique identifier of the listing to delete
136
+ * @param {string} site - The site ID where the listing exists
137
+ * @returns {Promise<ApiResponse>} Promise resolving to API response confirming deletion
138
+ * @throws {Error} When deletion fails or listing is not found
139
+ *
140
+ */
141
+ delete: async (id, site) => {
142
+ const query = {
143
+ site: site,
144
+ id: id,
145
+ };
146
+ return authedFunction({
147
+ method: "POST",
148
+ url: getUrl("feature-builder", "listing/update/delete", query),
149
+ data: { id },
150
+ });
151
+ },
152
+
153
+ /**
154
+ * Restores a previously soft-deleted listing
155
+ *
156
+ * @param {string} id - The unique identifier of the listing to restore
157
+ * @param {string} site - The site ID where the listing exists
158
+ * @returns {Promise<ApiResponse>} Promise resolving to API response confirming restoration
159
+ * @throws {Error} When restoration fails or listing is not found
160
+ *
161
+ */
162
+ undelete: async (id, site) => {
163
+ const query = {
164
+ site: site,
165
+ id: id,
166
+ };
167
+ return authedFunction({
168
+ method: "POST",
169
+ url: getUrl("feature-builder", "listing/update/undelete", query),
170
+ data: { id },
171
+ });
172
+ },
173
+ };
174
+
175
+ // Note: This file has been updated to use the new API endpoint patterns
176
+ // Legacy exports have been removed as Redux actions now use the new listingActions object