@myissue/vue-website-page-builder 3.2.13 → 3.2.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myissue/vue-website-page-builder",
3
- "version": "v3.2.13",
3
+ "version": "v3.2.16",
4
4
  "description": "🚧 DEVELOPMENT VERSION - Vue.js page builder component with drag & drop functionality. Not ready for production use.",
5
5
  "type": "module",
6
6
  "main": "./dist/vue-website-page-builder.umd.cjs",
@@ -52,45 +52,28 @@ const features = [
52
52
  },
53
53
  ]
54
54
 
55
- // const configPageBuilderTemplate = {
56
- // updateOrCreate: {
57
- // formType: 'create',
58
- // createNewResourceFormName: 'post',
59
- // },
60
- // pageBuilderLogo: {
61
- // src: '/logo/logo.svg',
62
- // },
63
- // userForPageBuilder: { name: 'John Doe' },
64
- // resourceData: {
65
- // title: 'Demo Article',
66
- // id: 1,
67
- // },
68
- // userSettings: {
69
- // theme: 'light',
70
- // language: 'en',
71
- // autoSave: true,
72
- // },
73
- // }
74
-
75
55
  const configPageBuilder = {
76
- userForPageBuilder: {
77
- name: 'John Doe',
78
- },
56
+ // userForPageBuilder: {
57
+ // name: 'John Doe',
58
+ // },
79
59
  updateOrCreate: {
80
60
  formType: 'update',
81
- // createNewResourceFormName: 0,
61
+ formName: 'news',
82
62
  },
83
63
  pageBuilderLogo: {
84
64
  src: '/logo/logo.svg',
85
65
  },
86
- resourceData: {
87
- title: 'Demo Article',
88
- id: 1,
89
- },
90
- userSettings: {
91
- theme: 'light',
92
- language: 'en',
93
- autoSave: true,
66
+ // resourceData: {
67
+ // title: 'Demo Article',
68
+ // id: 1,
69
+ // },
70
+ // userSettings: {
71
+ // // theme: 'light',
72
+ // // language: 'en',
73
+ // // autoSave: true,
74
+ // },
75
+ settings: {
76
+ brandColor: '#DB93B0',
94
77
  },
95
78
  }
96
79
 
@@ -15,12 +15,9 @@ const handleButton = function () {
15
15
  <img class="h-6" src="/logo/logo.svg" alt="Logo" />
16
16
 
17
17
  <div class="flex lg:gap-x-12 myPrimaryGap">
18
- <p
19
- @click="handleButton"
20
- class="text-lg font-medium text-myPrimaryDarkGrayColor flex gap-2 items-center cursor-pointer"
21
- >
22
- Start Builder
23
- </p>
18
+ <div class="text-lg font-medium text-myPrimaryDarkGrayColor flex gap-2 items-center">
19
+ Page Builder
20
+ </div>
24
21
  </div>
25
22
  </nav>
26
23
  </template>
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { ref, computed, onMounted, nextTick, watch, inject } from 'vue'
2
+ import { ref, computed, onMounted, inject } from 'vue'
3
3
  import DynamicModalBuilder from '../../../Modals/DynamicModalBuilder.vue'
4
4
  import TipTapInput from '../../../TipTap/TipTapInput.vue'
5
5
  import PageBuilderClass from '../../../../composables/PageBuilderClass.ts'
@@ -203,26 +203,11 @@ const handleModalIframeSrc = function () {
203
203
  }
204
204
  }
205
205
 
206
- const pagebuilder = ref(null)
207
- const videoElement = ref(null)
206
+ // const pagebuilder = ref(null)
207
+ // const videoElement = ref(null)
208
208
 
209
- watch(
210
- pagebuilder,
211
- async (newValue) => {
212
- if (newValue) {
213
- console.log('new value:', newValue)
214
- videoElement.value = pagebuilder.value?.querySelector('#youtube-video')
215
- console.log('video er:', videoElement.value)
216
- }
217
- },
218
- { immediate: true },
219
- )
220
-
221
- onMounted(async () => {
222
- pagebuilder.value = document.querySelector('#pagebuilder')
223
- console.log('pagebuilder:', pagebuilder.value)
224
- await nextTick()
225
- })
209
+ // videoElement.value = pagebuilder.value.querySelector('#youtube-video')
210
+ // pagebuilder.value = document.querySelector('#pagebuilder')
226
211
  </script>
227
212
  <template>
228
213
  <div>
@@ -460,8 +460,8 @@ const handleDownloadHTML = function () {
460
460
  </tr>
461
461
  <tr
462
462
  v-if="
463
- getConfigPageBuilder.updateOrCreate.createNewResourceFormName &&
464
- getConfigPageBuilder.updateOrCreate.createNewResourceFormName.length > 0
463
+ getConfigPageBuilder.updateOrCreate.formName &&
464
+ getConfigPageBuilder.updateOrCreate.formName.length > 0
465
465
  "
466
466
  >
467
467
  <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
@@ -471,7 +471,7 @@ const handleDownloadHTML = function () {
471
471
  <span
472
472
  class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium"
473
473
  >
474
- {{ getConfigPageBuilder.updateOrCreate.createNewResourceFormName }}
474
+ {{ getConfigPageBuilder.updateOrCreate.formName }}
475
475
  </span>
476
476
  </td>
477
477
  </tr>
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import ModalBuilder from '../Modals/ModalBuilder.vue'
3
- import NoneCustomSearchComponent from '../PageBuilder/DemoContent/NoneCustomSearchComponent.vue'
3
+ import NoneCustomBuilderComponents from '../PageBuilder/DemoContent/NoneCustomBuilderComponents.vue'
4
4
 
5
5
  defineProps({
6
6
  firstButtonText: {
@@ -14,7 +14,7 @@ defineProps({
14
14
  default: false,
15
15
  required: true,
16
16
  },
17
- CustomSearchComponent: {
17
+ CustomBuilderComponents: {
18
18
  type: Object,
19
19
  default: null,
20
20
  },
@@ -54,10 +54,10 @@ const firstButtonBuilder = function () {
54
54
 
55
55
  <div class="p-4">
56
56
  <!-- Only show custom search component if provided -->
57
- <div v-if="CustomSearchComponent" class="border border-gray-200 rounded-lg p-4">
58
- <component :is="CustomSearchComponent" />
57
+ <div v-if="CustomBuilderComponents" class="border border-gray-200 rounded-lg p-4">
58
+ <component :is="CustomBuilderComponents" />
59
59
  </div>
60
- <div v-else><NoneCustomSearchComponent /></div>
60
+ <div v-else><NoneCustomBuilderComponents /></div>
61
61
  </div>
62
62
  </div>
63
63
  <div class="bg-slate-50 px-2 py-4 flex sm:justify-end justify-center">
@@ -9,20 +9,12 @@ import SearchComponents from '../Components/Search/SearchComponents.vue'
9
9
  import OptionsDropdown from '../Components/PageBuilder/DropdownsPlusToggles/OptionsDropdown.vue'
10
10
  import RightSidebarEditor from '../Components/PageBuilder/EditorMenu/RightSidebarEditor.vue'
11
11
  import { sharedPageBuilderPinia, sharedPageBuilderStore } from '../stores/shared-store'
12
- import {
13
- isChildrenEmpty,
14
- onlyUserIsValid,
15
- onlyUpdateOrCreateIsValid,
16
- onlyPageBuilderLogoIsValid,
17
- onlyResourceDataIsValid,
18
- onlyUserSettingsIsValid,
19
- updateOrCreateIsFalsy,
20
- } from '../helpers/passedPageBuilderConfig'
12
+ import { updateOrCreateIsFalsy } from '../helpers/passedPageBuilderConfig'
21
13
  /**
22
14
  * Props for PageBuilder component
23
15
  * @typedef {Object} Props
24
16
  * @property {Object|null} CustomMediaLibraryComponent - Custom media component
25
- * @property {Object|null} CustomSearchComponent - Custom search component
17
+ * @property {Object|null} CustomBuilderComponents - Custom search component
26
18
  * @property {Object} configPageBuilder - Configuration object containing:
27
19
  */
28
20
  const props = defineProps({
@@ -30,7 +22,7 @@ const props = defineProps({
30
22
  type: Object,
31
23
  default: null,
32
24
  },
33
- CustomSearchComponent: {
25
+ CustomBuilderComponents: {
34
26
  type: Object,
35
27
  default: null,
36
28
  },
@@ -52,7 +44,7 @@ provide('internalPinia', internalPinia)
52
44
 
53
45
  // Provide custom components for child components
54
46
  provide('CustomMediaComponent', props.CustomMediaLibraryComponent)
55
- provide('CustomSearchComponent', props.CustomSearchComponent)
47
+ provide('CustomBuilderComponents', props.CustomBuilderComponents)
56
48
 
57
49
  // Provide modal close function for custom components
58
50
  const closeAddComponentModal = () => {
@@ -155,7 +147,7 @@ const draggableZone = ref(null)
155
147
  const defaultConfigValues = {
156
148
  updateOrCreate: {
157
149
  formType: 'create',
158
- createNewResourceFormName: 'post',
150
+ formName: 'post',
159
151
  },
160
152
 
161
153
  userSettings: {
@@ -172,59 +164,17 @@ const handleConfig = function (config) {
172
164
  config === undefined ||
173
165
  (config && Object.keys(config).length === 0 && config.constructor === Object)
174
166
  ) {
175
- console.log('1')
167
+ console.log('0000')
176
168
  pageBuilderClass.setConfigPageBuilder(defaultConfigValues)
177
169
  return
178
170
  }
179
171
 
180
172
  if (config && Object.keys(config).length !== 0 && config.constructor === Object) {
181
- //
182
- // Check alone
183
- // Returns true if all config fields are missing or empty
184
- if (isChildrenEmpty(config)) {
185
- console.log('1:')
186
- return
187
- }
188
-
189
- if (onlyUserIsValid(config)) {
190
- console.log('2:')
191
- return
192
- }
193
-
194
- if (onlyUpdateOrCreateIsValid(config)) {
195
- console.log('3:')
196
- return
197
- }
198
-
199
- if (onlyPageBuilderLogoIsValid(config)) {
200
- console.log('4:')
201
- return
202
- }
203
-
204
- if (onlyResourceDataIsValid(config)) {
205
- console.log('5:')
206
- return
207
- }
208
-
209
- if (onlyUserSettingsIsValid(config)) {
210
- console.log('6:')
211
- return
212
- }
213
-
214
- if (onlyUserSettingsIsValid(config)) {
215
- console.log('7:')
216
- return
217
- }
218
-
219
173
  if (updateOrCreateIsFalsy(config)) {
220
- console.log('8:')
174
+ console.log('8888:')
221
175
  return
222
176
  }
223
-
224
- // Check against eachoter in all combinations
225
177
  }
226
-
227
- // In the end make check if form type for update or create is set:
228
178
  }
229
179
 
230
180
  watch(
@@ -294,7 +244,7 @@ onMounted(async () => {
294
244
  :show="showModalAddComponent"
295
245
  :firstButtonText="firstButtonTextSearchComponents"
296
246
  :title="titleModalAddComponent"
297
- :CustomSearchComponent="props.CustomSearchComponent"
247
+ :CustomBuilderComponents="props.CustomBuilderComponents"
298
248
  @firstModalButtonSearchComponentsFunction="firstModalButtonSearchComponentsFunction"
299
249
  ></SearchComponents>
300
250
  <PageBuilderPreviewModal
@@ -1116,12 +1116,17 @@ class PageBuilderClass {
1116
1116
  // const updateOrCreate =
1117
1117
  // this.pageBuilderStateStore.getConfigPageBuilder?.updateOrCreate?.formType || 'create'
1118
1118
 
1119
+ console.log(
1120
+ 'config for page builder to work with:',
1121
+ this.pageBuilderStateStore.getConfigPageBuilder,
1122
+ )
1123
+
1119
1124
  const updateOrCreate = this.pageBuilderStateStore.getConfigPageBuilder?.updateOrCreate?.formType
1120
1125
 
1121
1126
  const resourceData = this.pageBuilderStateStore.getConfigPageBuilder?.resourceData
1122
1127
 
1123
1128
  const resourceFormName =
1124
- this.pageBuilderStateStore.getConfigPageBuilder?.updateOrCreate?.createNewResourceFormName
1129
+ this.pageBuilderStateStore.getConfigPageBuilder?.updateOrCreate?.formName
1125
1130
 
1126
1131
  // Logic for create resource
1127
1132
  if (updateOrCreate === 'create') {
@@ -8,288 +8,19 @@ const pageBuilderStateStore = sharedPageBuilderStore
8
8
  // Initialize PageBuilder with store
9
9
  const pageBuilderClass = new PageBuilderClass(pageBuilderStateStore)
10
10
 
11
- export const isChildrenEmpty = function (config: PageBuilderConfig) {
12
- if (
13
- (!config.updateOrCreate || isEmptyObject(config.updateOrCreate)) &&
14
- (!config.pageBuilderLogo || isEmptyObject(config.pageBuilderLogo)) &&
15
- (!config.resourceData || isEmptyObject(config.resourceData)) &&
16
- (!config.userForPageBuilder || isEmptyObject(config.userForPageBuilder)) &&
17
- (!config.userSettings || isEmptyObject(config.userSettings))
18
- ) {
19
- const editorConfig = {
20
- updateOrCreate: {
21
- formType: 'create' as 'create',
22
- createNewResourceFormName: 'post',
23
- },
24
- userSettings: {
25
- theme: 'light' as 'light',
26
- language: 'en',
27
- autoSave: false,
28
- },
29
- pageBuilderLogo: null,
30
- resourceData: null,
31
- userForPageBuilder: null,
32
- }
33
- pageBuilderClass.setConfigPageBuilder(editorConfig)
34
- return true
35
- } else {
36
- return false
37
- }
38
- }
39
- export const onlyUserIsValid = function (config: PageBuilderConfig) {
40
- if (
41
- config.userForPageBuilder &&
42
- typeof config.userForPageBuilder.name === 'string' &&
43
- config.userForPageBuilder.name.length > 0
44
- ) {
45
- if (!config.userSettings || (config.userSettings && isEmptyObject(config.userSettings))) {
46
- if (
47
- !config.updateOrCreate ||
48
- (config.updateOrCreate && typeof config.updateOrCreate.formType !== 'string') ||
49
- (config.updateOrCreate && isEmptyObject(config.updateOrCreate))
50
- ) {
51
- if (
52
- !config.pageBuilderLogo ||
53
- (config.pageBuilderLogo &&
54
- config.pageBuilderLogo.src &&
55
- typeof config.pageBuilderLogo.src === 'string' &&
56
- config.pageBuilderLogo.src.length === 0) ||
57
- (config.pageBuilderLogo && isEmptyObject(config.pageBuilderLogo))
58
- ) {
59
- if (!config.resourceData || (config.resourceData && isEmptyObject(config.resourceData))) {
60
- const editorConfig = {
61
- userForPageBuilder: config.userForPageBuilder,
62
- updateOrCreate: {
63
- formType: 'create' as 'create',
64
- createNewResourceFormName: 'post',
65
- },
66
- userSettings: {
67
- theme: 'light' as 'light',
68
- language: 'en',
69
- autoSave: false,
70
- },
71
- }
72
-
73
- pageBuilderClass.setConfigPageBuilder(editorConfig)
74
- return true
75
- } else {
76
- return false
77
- }
78
- }
79
- }
80
- }
81
- }
82
- }
83
-
84
- export const onlyUpdateOrCreateIsValid = function (config: PageBuilderConfig) {
85
- if (
86
- !config.updateOrCreate ||
87
- (config.updateOrCreate && typeof config.updateOrCreate.formType !== 'string') ||
88
- (config.updateOrCreate && isEmptyObject(config.updateOrCreate))
89
- ) {
90
- if (
91
- !config.userForPageBuilder ||
92
- (config.userForPageBuilder && typeof config.userForPageBuilder.name !== 'string') ||
93
- (typeof config.userForPageBuilder.name === 'string' &&
94
- config.userForPageBuilder.name.length < 1) ||
95
- (config.userForPageBuilder && isEmptyObject(config.userForPageBuilder))
96
- ) {
97
- if (
98
- !config.pageBuilderLogo ||
99
- (config.pageBuilderLogo &&
100
- config.pageBuilderLogo.src &&
101
- typeof config.pageBuilderLogo.src === 'string' &&
102
- config.pageBuilderLogo.src.length === 0) ||
103
- (config.pageBuilderLogo && isEmptyObject(config.pageBuilderLogo))
104
- ) {
105
- if (!config.userSettings || (config.userSettings && isEmptyObject(config.userSettings))) {
106
- if (!config.resourceData || (config.resourceData && isEmptyObject(config.resourceData))) {
107
- const editorConfig = {
108
- updateOrCreate: config.updateOrCreate,
109
- userSettings: {
110
- theme: 'light' as 'light',
111
- language: 'en',
112
- autoSave: false,
113
- },
114
- }
115
- pageBuilderClass.setConfigPageBuilder(editorConfig)
116
- return true
117
- } else {
118
- return false
119
- }
120
- }
121
- }
122
- }
123
- }
124
- }
125
-
126
- export const onlyPageBuilderLogoIsValid = function (config: PageBuilderConfig) {
127
- if (
128
- config.updateOrCreate &&
129
- typeof config.updateOrCreate.formType === 'string' &&
130
- (config.updateOrCreate.formType === 'create' || config.updateOrCreate.formType === 'update')
131
- ) {
132
- if (
133
- !config.userForPageBuilder ||
134
- (config.userForPageBuilder && typeof config.userForPageBuilder.name !== 'string') ||
135
- (typeof config.userForPageBuilder.name === 'string' &&
136
- config.userForPageBuilder.name.length < 1) ||
137
- (config.userForPageBuilder && isEmptyObject(config.userForPageBuilder))
138
- ) {
139
- if (
140
- !config.pageBuilderLogo ||
141
- (config.pageBuilderLogo &&
142
- config.pageBuilderLogo.src &&
143
- typeof config.pageBuilderLogo.src === 'string' &&
144
- config.pageBuilderLogo.src.length === 0) ||
145
- (config.pageBuilderLogo && isEmptyObject(config.pageBuilderLogo))
146
- ) {
147
- if (!config.userSettings || (config.userSettings && isEmptyObject(config.userSettings))) {
148
- if (!config.resourceData || (config.resourceData && isEmptyObject(config.resourceData))) {
149
- const editorConfig = {
150
- updateOrCreate: {
151
- formType: 'create' as 'create',
152
- createNewResourceFormName: 'post',
153
- },
154
- userSettings: {
155
- theme: 'light' as 'light',
156
- language: 'en',
157
- autoSave: false,
158
- },
159
- pageBuilderLogo: config.pageBuilderLogo,
160
- resourceData: null,
161
- userForPageBuilder: null,
162
- }
163
- pageBuilderClass.setConfigPageBuilder(editorConfig)
164
- return true
165
- } else {
166
- return false
167
- }
168
- }
169
- }
170
- }
171
- }
172
- }
173
-
174
- export const onlyResourceDataIsValid = function (config: PageBuilderConfig) {
175
- if (
176
- config.resourceData &&
177
- typeof config.resourceData.title === 'string' &&
178
- config.resourceData.title.length > 0
179
- ) {
180
- if (
181
- !config.updateOrCreate ||
182
- (config.updateOrCreate && typeof config.updateOrCreate.formType !== 'string') ||
183
- (config.updateOrCreate && isEmptyObject(config.updateOrCreate))
184
- ) {
185
- if (
186
- !config.userForPageBuilder ||
187
- (config.userForPageBuilder && typeof config.userForPageBuilder.name !== 'string') ||
188
- (typeof config.userForPageBuilder.name === 'string' &&
189
- config.userForPageBuilder.name.length < 1) ||
190
- (config.userForPageBuilder && isEmptyObject(config.userForPageBuilder))
191
- ) {
192
- if (
193
- !config.pageBuilderLogo ||
194
- (config.pageBuilderLogo &&
195
- config.pageBuilderLogo.src &&
196
- typeof config.pageBuilderLogo.src === 'string' &&
197
- config.pageBuilderLogo.src.length === 0) ||
198
- (config.pageBuilderLogo && isEmptyObject(config.pageBuilderLogo))
199
- ) {
200
- if (!config.userSettings || (config.userSettings && isEmptyObject(config.userSettings))) {
201
- const editorConfig = {
202
- updateOrCreate: {
203
- formType: 'create' as 'create',
204
- createNewResourceFormName: 'post',
205
- },
206
- userSettings: {
207
- theme: 'light' as 'light',
208
- language: 'en',
209
- autoSave: false,
210
- },
211
- pageBuilderLogo: config.pageBuilderLogo,
212
- resourceData: null,
213
- userForPageBuilder: null,
214
- }
215
- pageBuilderClass.setConfigPageBuilder(editorConfig)
216
- return true
217
- } else {
218
- return false
219
- }
220
- }
221
- }
222
- }
223
- }
224
- }
225
-
226
- export const onlyUserSettingsIsValid = function (config: PageBuilderConfig) {
227
- if (
228
- config.userSettings &&
229
- typeof config.userSettings.theme === 'string' &&
230
- config.userSettings.theme.length > 0
231
- ) {
232
- if (
233
- config.resourceData &&
234
- typeof config.resourceData.title === 'string' &&
235
- config.resourceData.title.length > 0
236
- ) {
237
- if (
238
- !config.updateOrCreate ||
239
- (config.updateOrCreate && typeof config.updateOrCreate.formType !== 'string') ||
240
- (config.updateOrCreate && isEmptyObject(config.updateOrCreate))
241
- ) {
242
- if (
243
- !config.userForPageBuilder ||
244
- (config.userForPageBuilder && typeof config.userForPageBuilder.name !== 'string') ||
245
- (typeof config.userForPageBuilder.name === 'string' &&
246
- config.userForPageBuilder.name.length < 1) ||
247
- (config.userForPageBuilder && isEmptyObject(config.userForPageBuilder))
248
- ) {
249
- if (
250
- !config.pageBuilderLogo ||
251
- (config.pageBuilderLogo &&
252
- config.pageBuilderLogo.src &&
253
- typeof config.pageBuilderLogo.src === 'string' &&
254
- config.pageBuilderLogo.src.length === 0) ||
255
- (config.pageBuilderLogo && isEmptyObject(config.pageBuilderLogo))
256
- ) {
257
- const editorConfig = {
258
- updateOrCreate: {
259
- formType: 'create' as 'create',
260
- createNewResourceFormName: 'post',
261
- },
262
- userSettings: {
263
- theme: 'light' as 'light',
264
- language: 'en',
265
- autoSave: false,
266
- },
267
- pageBuilderLogo: config.pageBuilderLogo,
268
- resourceData: null,
269
- userForPageBuilder: null,
270
- }
271
- pageBuilderClass.setConfigPageBuilder(editorConfig)
272
- return true
273
- } else {
274
- return false
275
- }
276
- }
277
- }
278
- }
279
- }
280
- }
281
-
282
11
  export const updateOrCreateIsFalsy = function (config: PageBuilderConfig) {
12
+ // Case A: updateOrCreate is missing, not an object, has an invalid formType, or is an empty object
283
13
  if (
284
14
  !config.updateOrCreate ||
285
15
  (config.updateOrCreate && typeof config.updateOrCreate.formType !== 'string') ||
286
16
  (config.updateOrCreate && isEmptyObject(config.updateOrCreate))
287
17
  ) {
18
+ console.log('aaaa')
288
19
  const updatedConfig = {
289
20
  ...config,
290
21
  updateOrCreate: {
291
22
  formType: 'create' as 'create',
292
- createNewResourceFormName: 'pøøøøøøøøost',
23
+ formName: 'post',
293
24
  },
294
25
  }
295
26
 
@@ -297,56 +28,43 @@ export const updateOrCreateIsFalsy = function (config: PageBuilderConfig) {
297
28
  return true
298
29
  }
299
30
 
31
+ // Case B: formType exists but is not 'create' or 'update', and formName is missing or invalid
300
32
  if (
301
33
  config.updateOrCreate &&
302
34
  typeof config.updateOrCreate.formType === 'string' &&
303
35
  config.updateOrCreate.formType !== 'create' &&
304
36
  config.updateOrCreate.formType !== 'update' &&
305
- typeof config.createNewResourceFormName !== 'string'
37
+ typeof config.formName !== 'string'
306
38
  ) {
39
+ console.log('bbbb')
307
40
  const updatedConfig = {
308
41
  ...config,
309
42
  updateOrCreate: {
310
43
  formType: 'create' as 'create',
311
- createNewResourceFormName: 'post',
44
+ formName: 'post',
312
45
  },
313
46
  }
314
47
 
315
48
  pageBuilderClass.setConfigPageBuilder(updatedConfig)
316
49
  return true
317
50
  }
51
+
52
+ // Case C: formType is valid ('create' or 'update'), but formName is missing or an empty string
318
53
  if (
319
54
  (config.updateOrCreate &&
320
55
  typeof config.updateOrCreate.formType === 'string' &&
321
56
  (config.updateOrCreate.formType === 'create' ||
322
57
  config.updateOrCreate.formType === 'update') &&
323
- typeof config.updateOrCreate.createNewResourceFormName !== 'string') ||
324
- (typeof config.updateOrCreate.createNewResourceFormName === 'string' &&
325
- config.updateOrCreate.createNewResourceFormName.length === 0)
58
+ typeof config.updateOrCreate.formName !== 'string') ||
59
+ (typeof config.updateOrCreate.formName === 'string' &&
60
+ config.updateOrCreate.formName.length === 0)
326
61
  ) {
62
+ console.log('cccc')
327
63
  const updatedConfig = {
328
64
  ...config,
329
65
  updateOrCreate: {
330
- formType: 'create' as 'create',
331
- createNewResourceFormName: 'post',
332
- },
333
- }
334
-
335
- pageBuilderClass.setConfigPageBuilder(updatedConfig)
336
- return true
337
- }
338
- if (
339
- config.updateOrCreate &&
340
- typeof config.updateOrCreate.formType === 'string' &&
341
- (config.updateOrCreate.formType === 'create' || config.updateOrCreate.formType === 'update') &&
342
- typeof config.updateOrCreate.createNewResourceFormName === 'string' &&
343
- config.updateOrCreate.createNewResourceFormName.length > 0
344
- ) {
345
- const updatedConfig = {
346
- ...config,
347
- updateOrCreate: {
348
- formType: 'create' as 'create',
349
- createNewResourceFormName: config.updateOrCreate.createNewResourceFormName,
66
+ formType: config.updateOrCreate.formType,
67
+ formName: 'post',
350
68
  },
351
69
  }
352
70